CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
76 lines
3.9 KiB
MLIR
76 lines
3.9 KiB
MLIR
// RUN: mlir-opt %s --convert-shard-to-mpi -canonicalize | FileCheck %s
|
|
|
|
module attributes { mpi.dlti = #dlti.map<"MPI:comm_world_rank" = 24> } {
|
|
|
|
// CHECK: shard.grid @grid0
|
|
shard.grid @grid0(shape = 3x4x5)
|
|
|
|
// Notice: comm_world_rank/linear index 24 is multiindex [1, 0, 4] in @grid0
|
|
|
|
// all shards are equal
|
|
// CHECK-LABEL: func.func @shard_shape_equal() -> (index, index, index) {
|
|
func.func @shard_shape_equal() -> (index, index, index) {
|
|
%sharding = shard.sharding @grid0 split_axes = [[0], [1], [2]] : !shard.sharding
|
|
%0:3 = shard.process_multi_index on @grid0 : index, index, index
|
|
%c9 = arith.constant 9 : index
|
|
%c12 = arith.constant 12 : index
|
|
// CHECK: [[vc3:%.*]] = arith.constant 3 : index
|
|
%1:3 = shard.shard_shape dims = [%c9, %c12, 15] sharding = %sharding device = [%0#0, %0#1, %0#2] : index, index, index
|
|
// CHECK: return [[vc3]], [[vc3]], [[vc3]] : index, index, index
|
|
return %1#0, %1#1, %1#2 : index, index, index
|
|
}
|
|
|
|
// last shard in last dim gets an extra element
|
|
// CHECK-LABEL: func.func @shard_shape_odd_1() -> (index, index, index) {
|
|
func.func @shard_shape_odd_1() -> (index, index, index) {
|
|
%sharding = shard.sharding @grid0 split_axes = [[0], [1], [2]] : !shard.sharding
|
|
%0:3 = shard.process_multi_index on @grid0 : index, index, index
|
|
%c9 = arith.constant 9 : index
|
|
%c12 = arith.constant 12 : index
|
|
// CHECK-DAG: [[vc3:%.*]] = arith.constant 3 : index
|
|
// CHECK-DAG: [[vc4:%.*]] = arith.constant 4 : index
|
|
%1:3 = shard.shard_shape dims = [%c9, %c12, 16] sharding = %sharding device = [%0#0, %0#1, %0#2] : index, index, index
|
|
// CHECK: return [[vc3]], [[vc3]], [[vc4]] : index, index, index
|
|
return %1#0, %1#1, %1#2 : index, index, index
|
|
}
|
|
|
|
// In the second dimension the shard sizes are now [3 4 4 4]
|
|
// CHECK-LABEL: func.func @shard_shape_odd_2() -> (index, index, index) {
|
|
func.func @shard_shape_odd_2() -> (index, index, index) {
|
|
%sharding = shard.sharding @grid0 split_axes = [[0], [1], [2]] : !shard.sharding
|
|
%0:3 = shard.process_multi_index on @grid0 : index, index, index
|
|
%c9 = arith.constant 9 : index
|
|
// CHECK: [[vc3:%.*]] = arith.constant 3 : index
|
|
%1:3 = shard.shard_shape dims = [%c9, 15, 15] sharding = %sharding device = [%0#0, %0#1, %0#2] : index, index, index
|
|
// CHECK: return [[vc3]], [[vc3]], [[vc3]] : index, index, index
|
|
return %1#0, %1#1, %1#2 : index, index, index
|
|
}
|
|
|
|
// In the first dimension the shard sizes are now [3 4 4]
|
|
// CHECK-LABEL: func.func @shard_shape_odd_3() -> (index, index, index) {
|
|
func.func @shard_shape_odd_3() -> (index, index, index) {
|
|
%sharding = shard.sharding @grid0 split_axes = [[0], [1], [2]] : !shard.sharding
|
|
%0:3 = shard.process_multi_index on @grid0 : index, index, index
|
|
// CHECK-DAG: [[vc3:%.*]] = arith.constant 3 : index
|
|
// CHECK-DAG: [[vc4:%.*]] = arith.constant 4 : index
|
|
%1:3 = shard.shard_shape dims = [11, 12, 15] sharding = %sharding device = [%0#0, %0#1, %0#2] : index, index, index
|
|
// CHECK: return [[vc4]], [[vc3]], [[vc3]] : index, index, index
|
|
return %1#0, %1#1, %1#2 : index, index, index
|
|
}
|
|
|
|
// extract from sharded_dims_offsets
|
|
// CHECK-LABEL: func.func @shard_shape_sharded_dims_offs() -> (index, index, index) {
|
|
func.func @shard_shape_sharded_dims_offs() -> (index, index, index) {
|
|
%sharding = shard.sharding @grid0 split_axes = [[0], [1], [2]]
|
|
sharded_dims_offsets = [0, 1, 4, 9, 0, 2, 6, 12, 12, 0, 3, 6, 9, 12, 15]: !shard.sharding
|
|
%0:3 = shard.process_multi_index on @grid0 : index, index, index
|
|
%c9 = arith.constant 9 : index
|
|
%c12 = arith.constant 12 : index
|
|
// CHECK: [[vc3:%.*]] = arith.constant 3 : index
|
|
// CHECK: [[vc2:%.*]] = arith.constant 2 : index
|
|
%1:3 = shard.shard_shape dims = [%c9, %c12, 15] sharding = %sharding device = [%0#0, %0#1, %0#2] : index, index, index
|
|
// CHECK: return [[vc3]], [[vc2]], [[vc3]] : index, index, index
|
|
return %1#0, %1#1, %1#2 : index, index, index
|
|
}
|
|
}
|