|
| 1 | +// RUN: env TRITON_INTEL_ENABLE_BLOCK_IO_STORE_ON_REGULAR_PTR=1 triton-opt %s -split-input-file --intel-allocate-shared-memory --convert-triton-intel-gpu-to-llvm | FileCheck %s --implicit-check-not=llvm.inline_asm |
| 2 | +// RUN: env TRITON_INTEL_ENABLE_BLOCK_IO_STORE_ON_REGULAR_PTR=1 TRITON_INTEL_ENABLE_BLOCK_IO_ALL_LAYOUTS=1 triton-opt %s -split-input-file --intel-allocate-shared-memory --convert-triton-intel-gpu-to-llvm | FileCheck %s --implicit-check-not=llvm.inline_asm --check-prefixes=ALL-LAYOUT |
| 3 | + |
| 4 | +#blocked = #ttg.blocked<{sizePerThread = [1, 4, 2], threadsPerWarp = [1, 1, 32], warpsPerCTA = [1, 8, 2], order = [2, 1, 0]}> |
| 5 | +#slice = #ttg.slice<{dim = 1, parent = #blocked}> |
| 6 | +module attributes {ttig.support_sg_2d_block, "ttg.num-warps" = 16 : i32} { |
| 7 | + // CHECK-LABEL: @regular_pointer_block_io |
| 8 | + tt.func public @regular_pointer_block_io(%arg0: !tt.ptr<i8>) { |
| 9 | + %0 = tt.make_range {end = 256 : i32, start = 0 : i32} : tensor<256xi32, #ttg.slice<{dim = 1, parent = #slice}>> |
| 10 | + %1 = tt.expand_dims %0 {axis = 1 : i32} : tensor<256xi32, #ttg.slice<{dim = 1, parent = #slice}>> -> tensor<256x1xi32, #slice> |
| 11 | + %2 = arith.constant dense<64> : tensor<256x1xi32, #slice> |
| 12 | + %3 = arith.muli %1, %2 : tensor<256x1xi32, #slice> |
| 13 | + %4 = tt.make_range {end = 64 : i32, start = 0 : i32} : tensor<64xi32, #ttg.slice<{dim = 0, parent = #slice}>> |
| 14 | + %5 = tt.expand_dims %4 {axis = 0 : i32} : tensor<64xi32, #ttg.slice<{dim = 0, parent = #slice}>> -> tensor<1x64xi32, #slice> |
| 15 | + %6 = tt.broadcast %3 : tensor<256x1xi32, #slice> -> tensor<256x64xi32, #slice> |
| 16 | + %7 = tt.broadcast %5 : tensor<1x64xi32, #slice> -> tensor<256x64xi32, #slice> |
| 17 | + %8 = arith.addi %6, %7 : tensor<256x64xi32, #slice> |
| 18 | + %9 = tt.splat %arg0 : !tt.ptr<i8> -> tensor<256x64x!tt.ptr<i8>, #slice> |
| 19 | + %addr = tt.addptr %9, %8 : tensor<256x64x!tt.ptr<i8>, #slice>, tensor<256x64xi32, #slice> |
| 20 | + %cst = arith.constant dense<0> : tensor<256x64xi8, #slice> |
| 21 | + // ALL-LAYOUT-COUNT-32: triton_gen.2Dblockstore {{.*}} {elem_size_in_bits = 16, tile_width = 32, tile_height = 8, v_blocks = 1, cache_control = Default} |
| 22 | + tt.store %addr, %cst {ttig.block_io = "row_major"} : tensor<256x64x!tt.ptr<i8>, #slice> |
| 23 | + |
| 24 | + tt.return |
| 25 | + } |
| 26 | +} |
| 27 | + |
| 28 | +// ----- |
| 29 | + |
| 30 | +#blocked = #ttg.blocked<{sizePerThread = [4, 2], threadsPerWarp = [1, 32], warpsPerCTA = [8, 2], order = [1, 0]}> |
| 31 | +module attributes {ttig.support_sg_2d_block, "ttg.num-warps" = 16 : i32} { |
| 32 | + // CHECK-LABEL: @regular_pointer_block_io |
| 33 | + tt.func public @regular_pointer_block_io(%arg0: !tt.ptr<i8>) { |
| 34 | + %0 = tt.make_range {end = 256 : i32, start = 0 : i32} : tensor<256xi32, #ttg.slice<{dim = 1, parent = #blocked}>> |
| 35 | + %1 = tt.expand_dims %0 {axis = 1 : i32} : tensor<256xi32, #ttg.slice<{dim = 1, parent = #blocked}>> -> tensor<256x1xi32, #blocked> |
| 36 | + %2 = arith.constant dense<64> : tensor<256x1xi32, #blocked> |
| 37 | + %3 = arith.muli %1, %2 : tensor<256x1xi32, #blocked> |
| 38 | + %4 = tt.make_range {end = 64 : i32, start = 0 : i32} : tensor<64xi32, #ttg.slice<{dim = 0, parent = #blocked}>> |
| 39 | + %5 = tt.expand_dims %4 {axis = 0 : i32} : tensor<64xi32, #ttg.slice<{dim = 0, parent = #blocked}>> -> tensor<1x64xi32, #blocked> |
| 40 | + %6 = tt.broadcast %3 : tensor<256x1xi32, #blocked> -> tensor<256x64xi32, #blocked> |
| 41 | + %7 = tt.broadcast %5 : tensor<1x64xi32, #blocked> -> tensor<256x64xi32, #blocked> |
| 42 | + %8 = arith.addi %6, %7 : tensor<256x64xi32, #blocked> |
| 43 | + %9 = tt.splat %arg0 : !tt.ptr<i8> -> tensor<256x64x!tt.ptr<i8>, #blocked> |
| 44 | + %addr = tt.addptr %9, %8 : tensor<256x64x!tt.ptr<i8>, #blocked>, tensor<256x64xi32, #blocked> |
| 45 | + %cst = arith.constant dense<0> : tensor<256x64xi8, #blocked> |
| 46 | + // ALL-LAYOUT-COUNT-8: triton_gen.2Dblockstore {{.*}} {elem_size_in_bits = 16, tile_width = 32, tile_height = 4, v_blocks = 1, cache_control = Default} |
| 47 | + tt.store %addr, %cst {ttig.block_io = "row_major"} : tensor<256x64x!tt.ptr<i8>, #blocked> |
| 48 | + |
| 49 | + tt.return |
| 50 | + } |
| 51 | +} |
| 52 | + |
| 53 | +// ----- |
| 54 | + |
| 55 | +#dpas = #ttig.dpas<{repeatCount = 8, systolicDepth = 8, executionSize = 16, opsPerChan = 4, threadsPerWarp = 16, warpsPerCTA = [4, 4], repCluster = [2, 2]}> |
| 56 | +#dot_a = #ttg.dot_op<{opIdx = 0, parent = #dpas, kWidth = 2}> |
| 57 | +module attributes {ttig.support_sg_2d_block, "ttg.num-warps" = 16 : i32} { |
| 58 | + // CHECK-LABEL: @regular_pointer_block_io |
| 59 | + tt.func public @regular_pointer_block_io(%arg0: !tt.ptr<i8>) { |
| 60 | + %0 = tt.make_range {end = 256 : i32, start = 0 : i32} : tensor<256xi32, #ttg.slice<{dim = 1, parent = #dot_a}>> |
| 61 | + %1 = tt.expand_dims %0 {axis = 1 : i32} : tensor<256xi32, #ttg.slice<{dim = 1, parent = #dot_a}>> -> tensor<256x1xi32, #dot_a> |
| 62 | + %2 = arith.constant dense<64> : tensor<256x1xi32, #dot_a> |
| 63 | + %3 = arith.muli %1, %2 : tensor<256x1xi32, #dot_a> |
| 64 | + %4 = tt.make_range {end = 64 : i32, start = 0 : i32} : tensor<64xi32, #ttg.slice<{dim = 0, parent = #dot_a}>> |
| 65 | + %5 = tt.expand_dims %4 {axis = 0 : i32} : tensor<64xi32, #ttg.slice<{dim = 0, parent = #dot_a}>> -> tensor<1x64xi32, #dot_a> |
| 66 | + %6 = tt.broadcast %3 : tensor<256x1xi32, #dot_a> -> tensor<256x64xi32, #dot_a> |
| 67 | + %7 = tt.broadcast %5 : tensor<1x64xi32, #dot_a> -> tensor<256x64xi32, #dot_a> |
| 68 | + %8 = arith.addi %6, %7 : tensor<256x64xi32, #dot_a> |
| 69 | + %9 = tt.splat %arg0 : !tt.ptr<i8> -> tensor<256x64x!tt.ptr<i8>, #dot_a> |
| 70 | + %addr = tt.addptr %9, %8 : tensor<256x64x!tt.ptr<i8>, #dot_a>, tensor<256x64xi32, #dot_a> |
| 71 | + %cst = arith.constant dense<0> : tensor<256x64xi8, #dot_a> |
| 72 | + // CHECK-COUNT-32: triton_gen.2Dblockstore {{.*}} {elem_size_in_bits = 16, tile_width = 16, tile_height = 8, v_blocks = 1, cache_control = Default} |
| 73 | + tt.store %addr, %cst {ttig.block_io = "row_major"} : tensor<256x64x!tt.ptr<i8>, #dot_a> |
| 74 | + |
| 75 | + tt.return |
| 76 | + } |
| 77 | +} |
| 78 | + |
| 79 | +// ----- |
| 80 | + |
| 81 | +#dpas = #ttig.dpas<{repeatCount = 8, systolicDepth = 8, executionSize = 16, opsPerChan = 1, threadsPerWarp = 16, warpsPerCTA = [4, 4], repCluster = [2, 2]}> |
| 82 | +#dot_a = #ttg.dot_op<{opIdx = 0, parent = #dpas, kWidth = 1}> |
| 83 | +module attributes {ttig.support_sg_2d_block, "ttg.num-warps" = 16 : i32} { |
| 84 | + // CHECK-LABEL: @regular_pointer_block_io |
| 85 | + tt.func public @regular_pointer_block_io(%arg0: !tt.ptr<f32>) { |
| 86 | + %0 = tt.make_range {end = 256 : i32, start = 0 : i32} : tensor<256xi32, #ttg.slice<{dim = 1, parent = #dot_a}>> |
| 87 | + %1 = tt.expand_dims %0 {axis = 1 : i32} : tensor<256xi32, #ttg.slice<{dim = 1, parent = #dot_a}>> -> tensor<256x1xi32, #dot_a> |
| 88 | + %2 = arith.constant dense<64> : tensor<256x1xi32, #dot_a> |
| 89 | + %3 = arith.muli %1, %2 : tensor<256x1xi32, #dot_a> |
| 90 | + %4 = tt.make_range {end = 64 : i32, start = 0 : i32} : tensor<64xi32, #ttg.slice<{dim = 0, parent = #dot_a}>> |
| 91 | + %5 = tt.expand_dims %4 {axis = 0 : i32} : tensor<64xi32, #ttg.slice<{dim = 0, parent = #dot_a}>> -> tensor<1x64xi32, #dot_a> |
| 92 | + %6 = tt.broadcast %3 : tensor<256x1xi32, #dot_a> -> tensor<256x64xi32, #dot_a> |
| 93 | + %7 = tt.broadcast %5 : tensor<1x64xi32, #dot_a> -> tensor<256x64xi32, #dot_a> |
| 94 | + %8 = arith.addi %6, %7 : tensor<256x64xi32, #dot_a> |
| 95 | + %9 = tt.splat %arg0 : !tt.ptr<f32> -> tensor<256x64x!tt.ptr<f32>, #dot_a> |
| 96 | + %addr = tt.addptr %9, %8 : tensor<256x64x!tt.ptr<f32>, #dot_a>, tensor<256x64xi32, #dot_a> |
| 97 | + %cst = arith.constant dense<0.000000e+00> : tensor<256x64xf32, #dot_a> |
| 98 | + // CHECK-COUNT-128: triton_gen.2Dblockstore {{.*}} {elem_size_in_bits = 32, tile_width = 8, tile_height = 8, v_blocks = 1, cache_control = Default} |
| 99 | + tt.store %addr, %cst {ttig.block_io = "row_major"} : tensor<256x64x!tt.ptr<f32>, #dot_a> |
| 100 | + |
| 101 | + tt.return |
| 102 | + } |
| 103 | +} |
| 104 | + |
| 105 | +// ----- |
| 106 | + |
| 107 | +#dpas = #ttig.dpas<{repeatCount = 8, systolicDepth = 8, executionSize = 16, opsPerChan = 1, threadsPerWarp = 16, warpsPerCTA = [4, 4], repCluster = [2, 2]}> |
| 108 | +#dot_b = #ttg.dot_op<{opIdx = 1, parent = #dpas, kWidth = 1}> |
| 109 | +module attributes {ttig.support_sg_2d_block, "ttg.num-warps" = 16 : i32} { |
| 110 | + // CHECK-LABEL: @regular_pointer_block_io |
| 111 | + tt.func public @regular_pointer_block_io(%arg0: !tt.ptr<f32>) { |
| 112 | + %0 = tt.make_range {end = 256 : i32, start = 0 : i32} : tensor<256xi32, #ttg.slice<{dim = 1, parent = #dot_b}>> |
| 113 | + %1 = tt.expand_dims %0 {axis = 1 : i32} : tensor<256xi32, #ttg.slice<{dim = 1, parent = #dot_b}>> -> tensor<256x1xi32, #dot_b> |
| 114 | + %2 = arith.constant dense<64> : tensor<256x1xi32, #dot_b> |
| 115 | + %3 = arith.muli %1, %2 : tensor<256x1xi32, #dot_b> |
| 116 | + %4 = tt.make_range {end = 64 : i32, start = 0 : i32} : tensor<64xi32, #ttg.slice<{dim = 0, parent = #dot_b}>> |
| 117 | + %5 = tt.expand_dims %4 {axis = 0 : i32} : tensor<64xi32, #ttg.slice<{dim = 0, parent = #dot_b}>> -> tensor<1x64xi32, #dot_b> |
| 118 | + %6 = tt.broadcast %3 : tensor<256x1xi32, #dot_b> -> tensor<256x64xi32, #dot_b> |
| 119 | + %7 = tt.broadcast %5 : tensor<1x64xi32, #dot_b> -> tensor<256x64xi32, #dot_b> |
| 120 | + %8 = arith.addi %6, %7 : tensor<256x64xi32, #dot_b> |
| 121 | + %9 = tt.splat %arg0 : !tt.ptr<f32> -> tensor<256x64x!tt.ptr<f32>, #dot_b> |
| 122 | + %addr = tt.addptr %9, %8 : tensor<256x64x!tt.ptr<f32>, #dot_b>, tensor<256x64xi32, #dot_b> |
| 123 | + %cst = arith.constant dense<0.000000e+00> : tensor<256x64xf32, #dot_b> |
| 124 | + // CHECK-COUNT-128: triton_gen.2Dblockstore {{.*}} {elem_size_in_bits = 32, tile_width = 16, tile_height = 8, v_blocks = 1, cache_control = Default} |
| 125 | + tt.store %addr, %cst {ttig.block_io = "row_major"} : tensor<256x64x!tt.ptr<f32>, #dot_b> |
| 126 | + |
| 127 | + tt.return |
| 128 | + } |
| 129 | +} |
| 130 | + |
| 131 | +// ----- |
| 132 | + |
| 133 | +#dpas = #ttig.dpas<{repeatCount = 8, systolicDepth = 8, executionSize = 16, opsPerChan = 1, threadsPerWarp = 16, warpsPerCTA = [4, 4], repCluster = [2, 2]}> |
| 134 | +module attributes {ttig.support_sg_2d_block, "ttg.num-warps" = 16 : i32} { |
| 135 | + // CHECK-LABEL: @regular_pointer_block_io |
| 136 | + tt.func public @regular_pointer_block_io(%arg0: !tt.ptr<f32>) { |
| 137 | + %0 = tt.make_range {end = 256 : i32, start = 0 : i32} : tensor<256xi32, #ttg.slice<{dim = 1, parent = #dpas}>> |
| 138 | + %1 = tt.expand_dims %0 {axis = 1 : i32} : tensor<256xi32, #ttg.slice<{dim = 1, parent = #dpas}>> -> tensor<256x1xi32, #dpas> |
| 139 | + %2 = arith.constant dense<64> : tensor<256x1xi32, #dpas> |
| 140 | + %3 = arith.muli %1, %2 : tensor<256x1xi32, #dpas> |
| 141 | + %4 = tt.make_range {end = 64 : i32, start = 0 : i32} : tensor<64xi32, #ttg.slice<{dim = 0, parent = #dpas}>> |
| 142 | + %5 = tt.expand_dims %4 {axis = 0 : i32} : tensor<64xi32, #ttg.slice<{dim = 0, parent = #dpas}>> -> tensor<1x64xi32, #dpas> |
| 143 | + %6 = tt.broadcast %3 : tensor<256x1xi32, #dpas> -> tensor<256x64xi32, #dpas> |
| 144 | + %7 = tt.broadcast %5 : tensor<1x64xi32, #dpas> -> tensor<256x64xi32, #dpas> |
| 145 | + %8 = arith.addi %6, %7 : tensor<256x64xi32, #dpas> |
| 146 | + %9 = tt.splat %arg0 : !tt.ptr<f32> -> tensor<256x64x!tt.ptr<f32>, #dpas> |
| 147 | + %addr = tt.addptr %9, %8 : tensor<256x64x!tt.ptr<f32>, #dpas>, tensor<256x64xi32, #dpas> |
| 148 | + %cst = arith.constant dense<0.000000e+00> : tensor<256x64xf32, #dpas> |
| 149 | + // CHECK-COUNT-32: triton_gen.2Dblockstore {{.*}} {elem_size_in_bits = 32, tile_width = 16, tile_height = 8, v_blocks = 1, cache_control = Default} |
| 150 | + tt.store %addr, %cst {ttig.block_io = "row_major"} : tensor<256x64x!tt.ptr<f32>, #dpas> |
| 151 | + |
| 152 | + tt.return |
| 153 | + } |
| 154 | +} |
0 commit comments