-
Notifications
You must be signed in to change notification settings - Fork 434
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert multi-row reduction tests to hlo tests.
PiperOrigin-RevId: 668007266
- Loading branch information
1 parent
b425085
commit d3d3c22
Showing
4 changed files
with
68 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// RUN: fusion_to_mlir %s | FileCheck %s | ||
// RUN: test_correctness %s --bijection_inputs=reduce:0 --bijection_outputs=reduce | ||
|
||
add { | ||
lhs = f32[] parameter(0) | ||
rhs = f32[] parameter(1) | ||
ROOT add = f32[] add(lhs, rhs) | ||
} | ||
|
||
fused_computation { | ||
param_0 = f32[1024,4] parameter(0) | ||
c = f32[] constant(0) | ||
ROOT reduce = f32[1024] reduce(param_0, c), dimensions={1}, to_apply=add | ||
} | ||
|
||
// Multi-row reductions do not use shared memory. | ||
// CHECK-NOT: allocate_shared | ||
// There should be 8 elements per warp. | ||
// CHECK: shuffle_reduce {{.*}} to 2 | ||
// CHECK-NOT: allocate_shared |
19 changes: 19 additions & 0 deletions
19
xla/service/gpu/fusions/tests/reduce_multirow/maximum_vector_size.hlo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// RUN: fusion_to_mlir %s | mlir_fusions_opt -xla-gpu-test-to-inline -xla-gpu-test-vectorize | FileCheck %s | ||
// RUN: test_correctness %s | ||
|
||
or { | ||
tmp_0 = pred[] parameter(0) | ||
tmp_1 = pred[] parameter(1) | ||
ROOT tmp_2 = pred[] or(tmp_0, tmp_1) | ||
} | ||
|
||
fusion { | ||
p0 = pred[76800,2] parameter(0) | ||
c0 = pred[] constant(false) | ||
ROOT reduce = pred[76800] reduce(p0, c0), dimensions={1}, to_apply=or | ||
} | ||
|
||
// Normally, we would attempt to vectorize this to v4. However, codegen does not | ||
// currently support a larger vector size than row width. | ||
|
||
// CHECK: vector.transfer_read {{.*}} vector<2xi8> |
26 changes: 26 additions & 0 deletions
26
xla/service/gpu/fusions/tests/reduce_multirow/pred_mof_x2_v4.hlo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// RUN: fusion_to_mlir %s | mlir_fusions_opt -xla-gpu-test-to-inline -xla-gpu-test-vectorize | FileCheck %s | ||
// RUN: test_correctness %s --bijection_inputs=tmp_5:0 --bijection_inputs=tmp_8:0 --bijection_outputs=tmp_5 --bijection_outputs=tmp_8 | ||
|
||
or { | ||
tmp_0 = pred[] parameter(0) | ||
tmp_1 = pred[] parameter(1) | ||
ROOT tmp_2 = pred[] or(tmp_0, tmp_1) | ||
} | ||
|
||
fusion { | ||
tmp_0 = f32[7680,16] parameter(0) | ||
tmp_1 = f32[] constant(-1.70141173e+38) | ||
tmp_2 = f32[7680,16] broadcast(tmp_1), dimensions={} | ||
tmp_3 = pred[7680,16] compare(tmp_0, tmp_2), direction=GT | ||
tmp_4 = pred[] constant(false) | ||
tmp_5 = pred[7680] reduce(tmp_3, tmp_4), dimensions={1}, to_apply=or | ||
tmp_6 = f32[7680,16] parameter(1) | ||
tmp_7 = pred[7680,16] compare(tmp_6, tmp_2), direction=GT | ||
tmp_8 = pred[7680] reduce(tmp_7, tmp_4), dimensions={1}, to_apply=or | ||
ROOT tmp_9 = (pred[7680], pred[7680]) tuple(tmp_5, tmp_8) | ||
} | ||
|
||
// CHECK: vector.transfer_read {{.*}} vector<4xf32> | ||
// CHECK: xla_gpu.shuffle_reduce @or_tmp_2 | ||
// CHECK: vector.transfer_read {{.*}} vector<4xf32> | ||
// CHECK: xla_gpu.shuffle_reduce @or_tmp_2 |