91 lines · plain
1// RUN: not mlir-opt %s --split-input-file -convert-amdgpu-to-rocdl=chipset=gfx942 2>&1 | FileCheck %s --check-prefix=GFX9422// RUN: mlir-opt %s --split-input-file -convert-amdgpu-to-rocdl=chipset=gfx950 | FileCheck %s --check-prefix=GFX9503 4#gpu_global_addrspace = 15#gpu_lds_addrspace = 36#amdgpu_fat_buffer_addrspace = 77 8// GFX950-LABEL: func @fat_buffer_load_to_rocdl_f969// GFX950-SAME: (%[[ARG0:.*]]: memref<128x72xf32, 7>)10func.func @fat_buffer_load_to_rocdl_f96(%global : memref<128x72xf32, #amdgpu_fat_buffer_addrspace>) {11 %c0 = arith.constant 0 : index12 %c12 = arith.constant 12 : index13 %c32 = arith.constant 32 : index14 %alloc = memref.alloc() : memref<64x64xf32, #gpu_lds_addrspace>15 // GFX950: %[[BUFFER_DESC:.*]] = builtin.unrealized_conversion_cast %[[ARG0]]16 17 // GFX950: %[[C0:.*]] = arith.constant 0 : index18 // GFX950: %[[IC0:.*]] = builtin.unrealized_conversion_cast %c0 : index to i6419 // GFX950: %[[C12:.*]] = arith.constant 12 : index20 // GFX950: %[[IC12:.*]] = builtin.unrealized_conversion_cast %[[C12]]21 // GFX950: %[[C32:.*]] = arith.constant 32 : index22 // GFX950: %[[IC32:.*]] = builtin.unrealized_conversion_cast %[[C32]]23 24 // GFX950: %[[ALLOC:.*]] = memref.alloc()25 // GFX950: %[[LDS_DESC:.*]] = builtin.unrealized_conversion_cast26 // GFX950: %[[GLOBAL_BASE:.*]] = llvm.extractvalue %[[BUFFER_DESC]][1]27 28 // GFX950: %[[C72:.*]] = llvm.mlir.constant(72 : index) : i6429 // GFX950: %[[MUL:.*]] = llvm.mul %[[IC12]], %[[C72]] : i6430 // GFX950: %[[SRC_OFFSET:.*]] = llvm.add %[[MUL]], %[[IC0]] : i6431 32 // GFX950: %[[GLOBAL_PTR:.*]] = llvm.getelementptr %[[GLOBAL_BASE]][%[[SRC_OFFSET]]]33 // GFX950: %[[LDS_BASE:.*]] = llvm.extractvalue %[[LDS_DESC]][1]34 35 // GFX950: %[[C64:.*]] = llvm.mlir.constant(64 : index) : i6436 // GFX950: %[[MUL_2:.*]] = llvm.mul %[[IC32]], %[[C64]] : i6437 // GFX950: %[[DST_OFFSET:.*]] = llvm.add %[[MUL_2]], %[[IC0]] : i6438 39 // GFX950: %[[LDS_PTR:.*]] = llvm.getelementptr %[[LDS_BASE]][%[[DST_OFFSET]]]40 // GFX950: rocdl.load.to.lds %[[GLOBAL_PTR]], %[[LDS_PTR]], 1241 // GFX942: error: 'amdgpu.gather_to_lds' op Gather to LDS instructions with 12-byte and 16-byte load widths are only supported on gfx95042 amdgpu.gather_to_lds %global[%c12, %c0], %alloc[%c32, %c0]43 : vector<16xf6E3M2FN>, memref<128x72xf32, #amdgpu_fat_buffer_addrspace>, memref<64x64xf32, #gpu_lds_addrspace>44 func.return45}46 47// -----48 49#gpu_global_addrspace = 150#gpu_lds_addrspace = 351#amdgpu_fat_buffer_addrspace = 752 53// GFX950-LABEL: func @fat_buffer_load_to_rocdl_f12854// GFX950-SAME: (%[[ARG0:.*]]: memref<128x72xf32, 7>)55func.func @fat_buffer_load_to_rocdl_f128(%global : memref<128x72xf32, #amdgpu_fat_buffer_addrspace>) {56 %c0 = arith.constant 0 : index57 %c12 = arith.constant 12 : index58 %c32 = arith.constant 32 : index59 %alloc = memref.alloc() : memref<64x64xf32, #gpu_lds_addrspace>60 // GFX950: %[[BUFFER_DESC:.*]] = builtin.unrealized_conversion_cast %[[ARG0]]61 62 // GFX950: %[[C0:.*]] = arith.constant 0 : index63 // GFX950: %[[IC0:.*]] = builtin.unrealized_conversion_cast %c0 : index to i6464 // GFX950: %[[C12:.*]] = arith.constant 12 : index65 // GFX950: %[[IC12:.*]] = builtin.unrealized_conversion_cast %[[C12]]66 // GFX950: %[[C32:.*]] = arith.constant 32 : index67 // GFX950: %[[IC32:.*]] = builtin.unrealized_conversion_cast %[[C32]]68 69 // GFX950: %[[ALLOC:.*]] = memref.alloc()70 // GFX950: %[[LDS_DESC:.*]] = builtin.unrealized_conversion_cast71 // GFX950: %[[GLOBAL_BASE:.*]] = llvm.extractvalue %[[BUFFER_DESC]][1]72 73 // GFX950: %[[C72:.*]] = llvm.mlir.constant(72 : index) : i6474 // GFX950: %[[MUL:.*]] = llvm.mul %[[IC12]], %[[C72]] : i6475 // GFX950: %[[SRC_OFFSET:.*]] = llvm.add %[[MUL]], %[[IC0]] : i6476 77 // GFX950: %[[GLOBAL_PTR:.*]] = llvm.getelementptr %[[GLOBAL_BASE]][%[[SRC_OFFSET]]]78 // GFX950: %[[LDS_BASE:.*]] = llvm.extractvalue %[[LDS_DESC]][1]79 80 // GFX950: %[[C64:.*]] = llvm.mlir.constant(64 : index) : i6481 // GFX950: %[[MUL_2:.*]] = llvm.mul %[[IC32]], %[[C64]] : i6482 // GFX950: %[[DST_OFFSET:.*]] = llvm.add %[[MUL_2]], %[[IC0]] : i6483 84 // GFX950: %[[LDS_PTR:.*]] = llvm.getelementptr %[[LDS_BASE]][%[[DST_OFFSET]]]85 // GFX950: rocdl.load.to.lds %[[GLOBAL_PTR]], %[[LDS_PTR]], 1686 // GFX942: error: 'amdgpu.gather_to_lds' op Gather to LDS instructions with 12-byte and 16-byte load widths are only supported on gfx95087 amdgpu.gather_to_lds %global[%c12, %c0], %alloc[%c32, %c0]88 : f128, memref<128x72xf32, #amdgpu_fat_buffer_addrspace>, memref<64x64xf32, #gpu_lds_addrspace>89 func.return90}91