147229111SKrzysztof Drewniak// RUN: mlir-opt -int-range-optimizations -split-input-file %s | FileCheck %s 23e01af09SChristian Sigg 33e01af09SChristian Sigg// CHECK-LABEL: func @launch_func 43e01af09SChristian Siggfunc.func @launch_func(%arg0 : index) { 53e01af09SChristian Sigg %0 = test.with_bounds { 63e01af09SChristian Sigg umin = 3 : index, umax = 5 : index, 73e01af09SChristian Sigg smin = 3 : index, smax = 5 : index 8acd10074SFelix Schneider } : index 93e01af09SChristian Sigg %1 = test.with_bounds { 103e01af09SChristian Sigg umin = 7 : index, umax = 11 : index, 113e01af09SChristian Sigg smin = 7 : index, smax = 11 : index 12acd10074SFelix Schneider } : index 133e01af09SChristian Sigg gpu.launch blocks(%block_id_x, %block_id_y, %block_id_z) in (%grid_dim_x = %0, %grid_dim_y = %1, %grid_dim_z = %arg0) 143e01af09SChristian Sigg threads(%thread_id_x, %thread_id_y, %thread_id_z) in (%block_dim_x = %arg0, %block_dim_y = %0, %block_dim_z = %1) { 153e01af09SChristian Sigg 163e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 5 : index, smin = 3 : index, umax = 5 : index, umin = 3 : index} 173e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 11 : index, smin = 7 : index, umax = 11 : index, umin = 7 : index} 183e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 4294967295 : index, smin = 1 : index, umax = 4294967295 : index, umin = 1 : index} 19acd10074SFelix Schneider %grid_dim_x0 = test.reflect_bounds %grid_dim_x : index 20acd10074SFelix Schneider %grid_dim_y0 = test.reflect_bounds %grid_dim_y : index 21acd10074SFelix Schneider %grid_dim_z0 = test.reflect_bounds %grid_dim_z : index 223e01af09SChristian Sigg 233e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 4 : index, smin = 0 : index, umax = 4 : index, umin = 0 : index} 243e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 10 : index, smin = 0 : index, umax = 10 : index, umin = 0 : index} 253e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 4294967294 : index, smin = 0 : index, umax = 4294967294 : index, umin = 0 : index} 26acd10074SFelix Schneider %block_id_x0 = test.reflect_bounds %block_id_x : index 27acd10074SFelix Schneider %block_id_y0 = test.reflect_bounds %block_id_y : index 28acd10074SFelix Schneider %block_id_z0 = test.reflect_bounds %block_id_z : index 293e01af09SChristian Sigg 303e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 4294967295 : index, smin = 1 : index, umax = 4294967295 : index, umin = 1 : index} 313e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 5 : index, smin = 3 : index, umax = 5 : index, umin = 3 : index} 323e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 11 : index, smin = 7 : index, umax = 11 : index, umin = 7 : index} 33acd10074SFelix Schneider %block_dim_x0 = test.reflect_bounds %block_dim_x : index 34acd10074SFelix Schneider %block_dim_y0 = test.reflect_bounds %block_dim_y : index 35acd10074SFelix Schneider %block_dim_z0 = test.reflect_bounds %block_dim_z : index 363e01af09SChristian Sigg 373e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 4294967294 : index, smin = 0 : index, umax = 4294967294 : index, umin = 0 : index} 383e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 4 : index, smin = 0 : index, umax = 4 : index, umin = 0 : index} 393e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 10 : index, smin = 0 : index, umax = 10 : index, umin = 0 : index} 40acd10074SFelix Schneider %thread_id_x0 = test.reflect_bounds %thread_id_x : index 41acd10074SFelix Schneider %thread_id_y0 = test.reflect_bounds %thread_id_y : index 42acd10074SFelix Schneider %thread_id_z0 = test.reflect_bounds %thread_id_z : index 433e01af09SChristian Sigg 44be575c5dSKrzysztof Drewniak // The launch bounds are not constant, and so this can't infer anything 45be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 4294967294 : index, smin = 0 : index, umax = 4294967294 : index, umin = 0 : index} 46be575c5dSKrzysztof Drewniak %thread_id_op = gpu.thread_id y 47acd10074SFelix Schneider %thread_id_op0 = test.reflect_bounds %thread_id_op : index 483e01af09SChristian Sigg gpu.terminator 493e01af09SChristian Sigg } 503e01af09SChristian Sigg 513e01af09SChristian Sigg func.return 523e01af09SChristian Sigg} 533e01af09SChristian Sigg 54be575c5dSKrzysztof Drewniak// ----- 55be575c5dSKrzysztof Drewniak 563e01af09SChristian Sigg// CHECK-LABEL: func @kernel 573e01af09SChristian Siggmodule attributes {gpu.container_module} { 583e01af09SChristian Sigg gpu.module @gpu_module { 593e01af09SChristian Sigg llvm.func @kernel() attributes {gpu.kernel} { 603e01af09SChristian Sigg 613e01af09SChristian Sigg %grid_dim_x = gpu.grid_dim x 623e01af09SChristian Sigg %grid_dim_y = gpu.grid_dim y 633e01af09SChristian Sigg %grid_dim_z = gpu.grid_dim z 643e01af09SChristian Sigg 653e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 4294967295 : index, smin = 1 : index, umax = 4294967295 : index, umin = 1 : index} 663e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 4294967295 : index, smin = 1 : index, umax = 4294967295 : index, umin = 1 : index} 673e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 4294967295 : index, smin = 1 : index, umax = 4294967295 : index, umin = 1 : index} 68acd10074SFelix Schneider %grid_dim_x0 = test.reflect_bounds %grid_dim_x : index 69acd10074SFelix Schneider %grid_dim_y0 = test.reflect_bounds %grid_dim_y : index 70acd10074SFelix Schneider %grid_dim_z0 = test.reflect_bounds %grid_dim_z : index 713e01af09SChristian Sigg 723e01af09SChristian Sigg %block_id_x = gpu.block_id x 733e01af09SChristian Sigg %block_id_y = gpu.block_id y 743e01af09SChristian Sigg %block_id_z = gpu.block_id z 753e01af09SChristian Sigg 763e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 4294967294 : index, smin = 0 : index, umax = 4294967294 : index, umin = 0 : index} 773e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 4294967294 : index, smin = 0 : index, umax = 4294967294 : index, umin = 0 : index} 783e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 4294967294 : index, smin = 0 : index, umax = 4294967294 : index, umin = 0 : index} 79acd10074SFelix Schneider %block_id_x0 = test.reflect_bounds %block_id_x : index 80acd10074SFelix Schneider %block_id_y0 = test.reflect_bounds %block_id_y : index 81acd10074SFelix Schneider %block_id_z0 = test.reflect_bounds %block_id_z : index 823e01af09SChristian Sigg 833e01af09SChristian Sigg %block_dim_x = gpu.block_dim x 843e01af09SChristian Sigg %block_dim_y = gpu.block_dim y 853e01af09SChristian Sigg %block_dim_z = gpu.block_dim z 863e01af09SChristian Sigg 873e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 4294967295 : index, smin = 1 : index, umax = 4294967295 : index, umin = 1 : index} 883e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 4294967295 : index, smin = 1 : index, umax = 4294967295 : index, umin = 1 : index} 893e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 4294967295 : index, smin = 1 : index, umax = 4294967295 : index, umin = 1 : index} 90acd10074SFelix Schneider %block_dim_x0 = test.reflect_bounds %block_dim_x : index 91acd10074SFelix Schneider %block_dim_y0 = test.reflect_bounds %block_dim_y : index 92acd10074SFelix Schneider %block_dim_z0 = test.reflect_bounds %block_dim_z : index 933e01af09SChristian Sigg 943e01af09SChristian Sigg %thread_id_x = gpu.thread_id x 953e01af09SChristian Sigg %thread_id_y = gpu.thread_id y 963e01af09SChristian Sigg %thread_id_z = gpu.thread_id z 973e01af09SChristian Sigg 983e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 4294967294 : index, smin = 0 : index, umax = 4294967294 : index, umin = 0 : index} 993e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 4294967294 : index, smin = 0 : index, umax = 4294967294 : index, umin = 0 : index} 1003e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 4294967294 : index, smin = 0 : index, umax = 4294967294 : index, umin = 0 : index} 101acd10074SFelix Schneider %thread_id_x0 = test.reflect_bounds %thread_id_x : index 102acd10074SFelix Schneider %thread_id_y0 = test.reflect_bounds %thread_id_y : index 103acd10074SFelix Schneider %thread_id_z0 = test.reflect_bounds %thread_id_z : index 1043e01af09SChristian Sigg 1053e01af09SChristian Sigg %global_id_x = gpu.global_id x 1063e01af09SChristian Sigg %global_id_y = gpu.global_id y 1073e01af09SChristian Sigg %global_id_z = gpu.global_id z 1083e01af09SChristian Sigg 109be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 9223372036854775807 : index, smin = -9223372036854775808 : index, umax = -8589934592 : index, umin = 0 : index} 110be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 9223372036854775807 : index, smin = -9223372036854775808 : index, umax = -8589934592 : index, umin = 0 : index} 111be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 9223372036854775807 : index, smin = -9223372036854775808 : index, umax = -8589934592 : index, umin = 0 : index} 112acd10074SFelix Schneider %global_id_x0 = test.reflect_bounds %global_id_x : index 113acd10074SFelix Schneider %global_id_y0 = test.reflect_bounds %global_id_y : index 114acd10074SFelix Schneider %global_id_z0 = test.reflect_bounds %global_id_z : index 1153e01af09SChristian Sigg 1163e01af09SChristian Sigg %subgroup_size = gpu.subgroup_size : index 1173e01af09SChristian Sigg %lane_id = gpu.lane_id 1183e01af09SChristian Sigg %num_subgroups = gpu.num_subgroups : index 1193e01af09SChristian Sigg %subgroup_id = gpu.subgroup_id : index 1203e01af09SChristian Sigg 1213e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 128 : index, smin = 1 : index, umax = 128 : index, umin = 1 : index} 1223e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 127 : index, smin = 0 : index, umax = 127 : index, umin = 0 : index} 1233e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 4294967295 : index, smin = 1 : index, umax = 4294967295 : index, umin = 1 : index} 1243e01af09SChristian Sigg // CHECK: test.reflect_bounds {smax = 4294967294 : index, smin = 0 : index, umax = 4294967294 : index, umin = 0 : index} 125acd10074SFelix Schneider %subgroup_size0 = test.reflect_bounds %subgroup_size : index 126acd10074SFelix Schneider %lane_id0 = test.reflect_bounds %lane_id : index 127acd10074SFelix Schneider %num_subgroups0 = test.reflect_bounds %num_subgroups : index 128acd10074SFelix Schneider %subgroup_id0 = test.reflect_bounds %subgroup_id : index 1293e01af09SChristian Sigg 1303e01af09SChristian Sigg llvm.return 1313e01af09SChristian Sigg } 1323e01af09SChristian Sigg } 1333e01af09SChristian Sigg} 1343e01af09SChristian Sigg 135be575c5dSKrzysztof Drewniak// ----- 136be575c5dSKrzysztof Drewniak 137be575c5dSKrzysztof Drewniak// CHECK-LABEL: func @annotated_kernel 138be575c5dSKrzysztof Drewniakmodule attributes {gpu.container_module} { 139be575c5dSKrzysztof Drewniak gpu.module @gpu_module { 140be575c5dSKrzysztof Drewniak gpu.func @annotated_kernel() kernel 141*43fd4c49SKrzysztof Drewniak attributes {known_block_size = array<i32: 8, 12, 16>, 142*43fd4c49SKrzysztof Drewniak known_grid_size = array<i32: 20, 24, 28>} { 143be575c5dSKrzysztof Drewniak 144be575c5dSKrzysztof Drewniak %grid_dim_x = gpu.grid_dim x 145be575c5dSKrzysztof Drewniak %grid_dim_y = gpu.grid_dim y 146be575c5dSKrzysztof Drewniak %grid_dim_z = gpu.grid_dim z 147be575c5dSKrzysztof Drewniak 148be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 20 : index, smin = 20 : index, umax = 20 : index, umin = 20 : index} 149be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 24 : index, smin = 24 : index, umax = 24 : index, umin = 24 : index} 150be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 28 : index, smin = 28 : index, umax = 28 : index, umin = 28 : index} 151acd10074SFelix Schneider %grid_dim_x0 = test.reflect_bounds %grid_dim_x : index 152acd10074SFelix Schneider %grid_dim_y0 = test.reflect_bounds %grid_dim_y : index 153acd10074SFelix Schneider %grid_dim_z0 = test.reflect_bounds %grid_dim_z : index 154be575c5dSKrzysztof Drewniak 155be575c5dSKrzysztof Drewniak %block_id_x = gpu.block_id x 156be575c5dSKrzysztof Drewniak %block_id_y = gpu.block_id y 157be575c5dSKrzysztof Drewniak %block_id_z = gpu.block_id z 158be575c5dSKrzysztof Drewniak 159be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 19 : index, smin = 0 : index, umax = 19 : index, umin = 0 : index} 160be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 23 : index, smin = 0 : index, umax = 23 : index, umin = 0 : index} 161be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 27 : index, smin = 0 : index, umax = 27 : index, umin = 0 : index} 162acd10074SFelix Schneider %block_id_x0 = test.reflect_bounds %block_id_x : index 163acd10074SFelix Schneider %block_id_y0 = test.reflect_bounds %block_id_y : index 164acd10074SFelix Schneider %block_id_z0 = test.reflect_bounds %block_id_z : index 165be575c5dSKrzysztof Drewniak 166be575c5dSKrzysztof Drewniak %block_dim_x = gpu.block_dim x 167be575c5dSKrzysztof Drewniak %block_dim_y = gpu.block_dim y 168be575c5dSKrzysztof Drewniak %block_dim_z = gpu.block_dim z 169be575c5dSKrzysztof Drewniak 170be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 8 : index, smin = 8 : index, umax = 8 : index, umin = 8 : index} 171be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 12 : index, smin = 12 : index, umax = 12 : index, umin = 12 : index} 172be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 16 : index, smin = 16 : index, umax = 16 : index, umin = 16 : index} 173acd10074SFelix Schneider %block_dim_x0 = test.reflect_bounds %block_dim_x : index 174acd10074SFelix Schneider %block_dim_y0 = test.reflect_bounds %block_dim_y : index 175acd10074SFelix Schneider %block_dim_z0 = test.reflect_bounds %block_dim_z : index 176be575c5dSKrzysztof Drewniak 177be575c5dSKrzysztof Drewniak %thread_id_x = gpu.thread_id x 178be575c5dSKrzysztof Drewniak %thread_id_y = gpu.thread_id y 179be575c5dSKrzysztof Drewniak %thread_id_z = gpu.thread_id z 180be575c5dSKrzysztof Drewniak 181be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 7 : index, smin = 0 : index, umax = 7 : index, umin = 0 : index} 182be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 11 : index, smin = 0 : index, umax = 11 : index, umin = 0 : index} 183be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 15 : index, smin = 0 : index, umax = 15 : index, umin = 0 : index} 184acd10074SFelix Schneider %thread_id_x0 = test.reflect_bounds %thread_id_x : index 185acd10074SFelix Schneider %thread_id_y0 = test.reflect_bounds %thread_id_y : index 186acd10074SFelix Schneider %thread_id_z0 = test.reflect_bounds %thread_id_z : index 187be575c5dSKrzysztof Drewniak 188be575c5dSKrzysztof Drewniak %global_id_x = gpu.global_id x 189be575c5dSKrzysztof Drewniak %global_id_y = gpu.global_id y 190be575c5dSKrzysztof Drewniak %global_id_z = gpu.global_id z 191be575c5dSKrzysztof Drewniak 192be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 159 : index, smin = 0 : index, umax = 159 : index, umin = 0 : index} 193be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 287 : index, smin = 0 : index, umax = 287 : index, umin = 0 : index} 194be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 447 : index, smin = 0 : index, umax = 447 : index, umin = 0 : index} 195acd10074SFelix Schneider %global_id_x0 = test.reflect_bounds %global_id_x : index 196acd10074SFelix Schneider %global_id_y0 = test.reflect_bounds %global_id_y : index 197acd10074SFelix Schneider %global_id_z0 = test.reflect_bounds %global_id_z : index 198be575c5dSKrzysztof Drewniak 199be575c5dSKrzysztof Drewniak %subgroup_size = gpu.subgroup_size : index 200be575c5dSKrzysztof Drewniak %lane_id = gpu.lane_id 201be575c5dSKrzysztof Drewniak %num_subgroups = gpu.num_subgroups : index 202be575c5dSKrzysztof Drewniak %subgroup_id = gpu.subgroup_id : index 203be575c5dSKrzysztof Drewniak 204be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 128 : index, smin = 1 : index, umax = 128 : index, umin = 1 : index} 205be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 127 : index, smin = 0 : index, umax = 127 : index, umin = 0 : index} 206be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 4294967295 : index, smin = 1 : index, umax = 4294967295 : index, umin = 1 : index} 207be575c5dSKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 4294967294 : index, smin = 0 : index, umax = 4294967294 : index, umin = 0 : index} 208acd10074SFelix Schneider %subgroup_size0 = test.reflect_bounds %subgroup_size : index 209acd10074SFelix Schneider %lane_id0 = test.reflect_bounds %lane_id : index 210acd10074SFelix Schneider %num_subgroups0 = test.reflect_bounds %num_subgroups : index 211acd10074SFelix Schneider %subgroup_id0 = test.reflect_bounds %subgroup_id : index 212be575c5dSKrzysztof Drewniak 213be575c5dSKrzysztof Drewniak gpu.return 214be575c5dSKrzysztof Drewniak } 215be575c5dSKrzysztof Drewniak } 216be575c5dSKrzysztof Drewniak} 217be575c5dSKrzysztof Drewniak 218*43fd4c49SKrzysztof Drewniak// ----- 219*43fd4c49SKrzysztof Drewniak 220*43fd4c49SKrzysztof Drewniak// CHECK-LABEL: func @annotated_kernel 221*43fd4c49SKrzysztof Drewniakmodule { 222*43fd4c49SKrzysztof Drewniak func.func @annotated_kernel() 223*43fd4c49SKrzysztof Drewniak attributes {gpu.known_block_size = array<i32: 8, 12, 16>, 224*43fd4c49SKrzysztof Drewniak gpu.known_grid_size = array<i32: 20, 24, 28>} { 225*43fd4c49SKrzysztof Drewniak 226*43fd4c49SKrzysztof Drewniak %block_id_x = gpu.block_id x 227*43fd4c49SKrzysztof Drewniak %block_id_y = gpu.block_id y 228*43fd4c49SKrzysztof Drewniak %block_id_z = gpu.block_id z 229*43fd4c49SKrzysztof Drewniak 230*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 19 : index, smin = 0 : index, umax = 19 : index, umin = 0 : index} 231*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 23 : index, smin = 0 : index, umax = 23 : index, umin = 0 : index} 232*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 27 : index, smin = 0 : index, umax = 27 : index, umin = 0 : index} 233*43fd4c49SKrzysztof Drewniak %block_id_x0 = test.reflect_bounds %block_id_x : index 234*43fd4c49SKrzysztof Drewniak %block_id_y0 = test.reflect_bounds %block_id_y : index 235*43fd4c49SKrzysztof Drewniak %block_id_z0 = test.reflect_bounds %block_id_z : index 236*43fd4c49SKrzysztof Drewniak 237*43fd4c49SKrzysztof Drewniak %thread_id_x = gpu.thread_id x 238*43fd4c49SKrzysztof Drewniak %thread_id_y = gpu.thread_id y 239*43fd4c49SKrzysztof Drewniak %thread_id_z = gpu.thread_id z 240*43fd4c49SKrzysztof Drewniak 241*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 7 : index, smin = 0 : index, umax = 7 : index, umin = 0 : index} 242*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 11 : index, smin = 0 : index, umax = 11 : index, umin = 0 : index} 243*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 15 : index, smin = 0 : index, umax = 15 : index, umin = 0 : index} 244*43fd4c49SKrzysztof Drewniak %thread_id_x0 = test.reflect_bounds %thread_id_x : index 245*43fd4c49SKrzysztof Drewniak %thread_id_y0 = test.reflect_bounds %thread_id_y : index 246*43fd4c49SKrzysztof Drewniak %thread_id_z0 = test.reflect_bounds %thread_id_z : index 247*43fd4c49SKrzysztof Drewniak 248*43fd4c49SKrzysztof Drewniak return 249*43fd4c49SKrzysztof Drewniak } 250*43fd4c49SKrzysztof Drewniak} 251*43fd4c49SKrzysztof Drewniak 252*43fd4c49SKrzysztof Drewniak// ----- 253*43fd4c49SKrzysztof Drewniak 254*43fd4c49SKrzysztof Drewniak// CHECK-LABEL: func @local_bounds_kernel 255*43fd4c49SKrzysztof Drewniakmodule attributes {gpu.container_module} { 256*43fd4c49SKrzysztof Drewniak gpu.module @gpu_module { 257*43fd4c49SKrzysztof Drewniak gpu.func @local_bounds_kernel() kernel { 258*43fd4c49SKrzysztof Drewniak 259*43fd4c49SKrzysztof Drewniak %grid_dim_x = gpu.grid_dim x upper_bound 20 260*43fd4c49SKrzysztof Drewniak %grid_dim_y = gpu.grid_dim y upper_bound 24 261*43fd4c49SKrzysztof Drewniak %grid_dim_z = gpu.grid_dim z upper_bound 28 262*43fd4c49SKrzysztof Drewniak 263*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 20 : index, smin = 1 : index, umax = 20 : index, umin = 1 : index} 264*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 24 : index, smin = 1 : index, umax = 24 : index, umin = 1 : index} 265*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 28 : index, smin = 1 : index, umax = 28 : index, umin = 1 : index} 266*43fd4c49SKrzysztof Drewniak %grid_dim_x0 = test.reflect_bounds %grid_dim_x : index 267*43fd4c49SKrzysztof Drewniak %grid_dim_y0 = test.reflect_bounds %grid_dim_y : index 268*43fd4c49SKrzysztof Drewniak %grid_dim_z0 = test.reflect_bounds %grid_dim_z : index 269*43fd4c49SKrzysztof Drewniak 270*43fd4c49SKrzysztof Drewniak %block_id_x = gpu.block_id x upper_bound 20 271*43fd4c49SKrzysztof Drewniak %block_id_y = gpu.block_id y upper_bound 24 272*43fd4c49SKrzysztof Drewniak %block_id_z = gpu.block_id z upper_bound 28 273*43fd4c49SKrzysztof Drewniak 274*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 19 : index, smin = 0 : index, umax = 19 : index, umin = 0 : index} 275*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 23 : index, smin = 0 : index, umax = 23 : index, umin = 0 : index} 276*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 27 : index, smin = 0 : index, umax = 27 : index, umin = 0 : index} 277*43fd4c49SKrzysztof Drewniak %block_id_x0 = test.reflect_bounds %block_id_x : index 278*43fd4c49SKrzysztof Drewniak %block_id_y0 = test.reflect_bounds %block_id_y : index 279*43fd4c49SKrzysztof Drewniak %block_id_z0 = test.reflect_bounds %block_id_z : index 280*43fd4c49SKrzysztof Drewniak 281*43fd4c49SKrzysztof Drewniak %block_dim_x = gpu.block_dim x upper_bound 8 282*43fd4c49SKrzysztof Drewniak %block_dim_y = gpu.block_dim y upper_bound 12 283*43fd4c49SKrzysztof Drewniak %block_dim_z = gpu.block_dim z upper_bound 16 284*43fd4c49SKrzysztof Drewniak 285*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 8 : index, smin = 1 : index, umax = 8 : index, umin = 1 : index} 286*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 12 : index, smin = 1 : index, umax = 12 : index, umin = 1 : index} 287*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 16 : index, smin = 1 : index, umax = 16 : index, umin = 1 : index} 288*43fd4c49SKrzysztof Drewniak %block_dim_x0 = test.reflect_bounds %block_dim_x : index 289*43fd4c49SKrzysztof Drewniak %block_dim_y0 = test.reflect_bounds %block_dim_y : index 290*43fd4c49SKrzysztof Drewniak %block_dim_z0 = test.reflect_bounds %block_dim_z : index 291*43fd4c49SKrzysztof Drewniak 292*43fd4c49SKrzysztof Drewniak %thread_id_x = gpu.thread_id x upper_bound 8 293*43fd4c49SKrzysztof Drewniak %thread_id_y = gpu.thread_id y upper_bound 12 294*43fd4c49SKrzysztof Drewniak %thread_id_z = gpu.thread_id z upper_bound 16 295*43fd4c49SKrzysztof Drewniak 296*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 7 : index, smin = 0 : index, umax = 7 : index, umin = 0 : index} 297*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 11 : index, smin = 0 : index, umax = 11 : index, umin = 0 : index} 298*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 15 : index, smin = 0 : index, umax = 15 : index, umin = 0 : index} 299*43fd4c49SKrzysztof Drewniak %thread_id_x0 = test.reflect_bounds %thread_id_x : index 300*43fd4c49SKrzysztof Drewniak %thread_id_y0 = test.reflect_bounds %thread_id_y : index 301*43fd4c49SKrzysztof Drewniak %thread_id_z0 = test.reflect_bounds %thread_id_z : index 302*43fd4c49SKrzysztof Drewniak 303*43fd4c49SKrzysztof Drewniak %global_id_x = gpu.global_id x upper_bound 160 304*43fd4c49SKrzysztof Drewniak %global_id_y = gpu.global_id y upper_bound 288 305*43fd4c49SKrzysztof Drewniak %global_id_z = gpu.global_id z upper_bound 448 306*43fd4c49SKrzysztof Drewniak 307*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 159 : index, smin = 0 : index, umax = 159 : index, umin = 0 : index} 308*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 287 : index, smin = 0 : index, umax = 287 : index, umin = 0 : index} 309*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 447 : index, smin = 0 : index, umax = 447 : index, umin = 0 : index} 310*43fd4c49SKrzysztof Drewniak %global_id_x0 = test.reflect_bounds %global_id_x : index 311*43fd4c49SKrzysztof Drewniak %global_id_y0 = test.reflect_bounds %global_id_y : index 312*43fd4c49SKrzysztof Drewniak %global_id_z0 = test.reflect_bounds %global_id_z : index 313*43fd4c49SKrzysztof Drewniak 314*43fd4c49SKrzysztof Drewniak %subgroup_size = gpu.subgroup_size upper_bound 32 : index 315*43fd4c49SKrzysztof Drewniak %subgroup_id = gpu.subgroup_id upper_bound 32 : index 316*43fd4c49SKrzysztof Drewniak %num_subgroups = gpu.num_subgroups upper_bound 8 : index 317*43fd4c49SKrzysztof Drewniak %lane_id = gpu.lane_id upper_bound 64 318*43fd4c49SKrzysztof Drewniak 319*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 32 : index, smin = 1 : index, umax = 32 : index, umin = 1 : index} 320*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 31 : index, smin = 0 : index, umax = 31 : index, umin = 0 : index} 321*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 8 : index, smin = 1 : index, umax = 8 : index, umin = 1 : index} 322*43fd4c49SKrzysztof Drewniak // CHECK: test.reflect_bounds {smax = 63 : index, smin = 0 : index, umax = 63 : index, umin = 0 : index} 323*43fd4c49SKrzysztof Drewniak %subgroup_size0 = test.reflect_bounds %subgroup_size : index 324*43fd4c49SKrzysztof Drewniak %subgroup_id0 = test.reflect_bounds %subgroup_id : index 325*43fd4c49SKrzysztof Drewniak %num_subgroups0 = test.reflect_bounds %num_subgroups : index 326*43fd4c49SKrzysztof Drewniak %lane_id0 = test.reflect_bounds %lane_id : index 327*43fd4c49SKrzysztof Drewniak 328*43fd4c49SKrzysztof Drewniak gpu.return 329*43fd4c49SKrzysztof Drewniak } 330*43fd4c49SKrzysztof Drewniak } 331*43fd4c49SKrzysztof Drewniak} 332