|
1 | 1 | // RUN: triton-opt %s -triton-intel-tdesc-to-block-pointer | FileCheck %s
|
2 | 2 |
|
3 |
| -// COM: Test make_tensor_descriptor is not rewritten when it is used by descriptor_gather. |
4 |
| -// CHECK-NOT: make_tensor_ptr |
5 |
| -// CHECK: tt.make_tensor_descriptor |
6 |
| -module { |
7 |
| - tt.func public @test_descriptor_gather(%arg0: !tt.ptr<f32>, %arg1: i64, %arg2: tensor<32xi32>, %arg3: i32) { |
8 |
| - %c128_i32 = arith.constant 128 : i32 |
9 |
| - %0 = tt.make_tensor_descriptor %arg0, [%c128_i32, %c128_i32], [%arg1, %arg1] : <f32>, <tensor<1x32xf32>> |
10 |
| - %1 = tt.descriptor_gather %0[%arg2, %arg3] : (!tt.tensordesc<tensor<1x32xf32>>, tensor<32xi32>, i32) -> tensor<32x32xf32> |
11 |
| - tt.return |
12 |
| - } |
| 3 | +// COM: Test that `make_tensor_descriptor` is not rewritten when it is used by `descriptor_gather`. |
| 4 | +tt.func public @test_descriptor_gather(%arg0: !tt.ptr<f32>, %arg1: i64, %arg2: tensor<32xi32>, %arg3: i32) { |
| 5 | + // CHECK-NOT: make_tensor_ptr |
| 6 | + // CHECK: tt.make_tensor_descriptor |
| 7 | + %c128_i32 = arith.constant 128 : i32 |
| 8 | + %0 = tt.make_tensor_descriptor %arg0, [%c128_i32, %c128_i32], [%arg1, %arg1] : <f32>, <tensor<1x32xf32>> |
| 9 | + %1 = tt.descriptor_gather %0[%arg2, %arg3] : (!tt.tensordesc<tensor<1x32xf32>>, tensor<32xi32>, i32) -> tensor<32x32xf32> |
| 10 | + tt.return |
| 11 | +} |
| 12 | + |
| 13 | +// COM: Test that `descriptor_load/descriptor_store` operations are not rewritten if it they use a tensor descriptor function arg. |
| 14 | +tt.func public @test_host_descriptor(%desc: !tt.tensordesc<tensor<2x16xf16>>) { |
| 15 | + // CHECK: tt.func public @test_host_descriptor([[DESC:%.*]]: !tt.tensordesc<tensor<2x16xf16>>) { |
| 16 | + // CHECK: tt.descriptor_load [[DESC]] |
| 17 | + // CHECK: tt.descriptor_store [[DESC]] |
| 18 | + %c2_i32 = arith.constant 2 : i32 |
| 19 | + %c32_i32 = arith.constant 32 : i32 |
| 20 | + %0 = tt.descriptor_load %desc[%c2_i32, %c32_i32] : !tt.tensordesc<tensor<2x16xf16>> -> tensor<2x16xf16> |
| 21 | + tt.descriptor_store %desc[%c2_i32, %c32_i32], %0 : !tt.tensordesc<tensor<2x16xf16>>, tensor<2x16xf16> |
| 22 | + tt.return |
13 | 23 | }
|
0 commit comments