[Mlir-commits] [mlir] [mlir][amdgpu] Add tensor load store operations (PR #170918)
Ivan Butygin
llvmlistbot at llvm.org
Wed Dec 17 06:53:53 PST 2025
================
@@ -3306,6 +3327,24 @@ void mlir::populateAMDGPUTypeAndAttributeConversions(
Type i32 = IntegerType::get(type.getContext(), 32);
return typeConverter.convertType(VectorType::get(4, i32));
});
+ typeConverter.addConversion(
+ [&](TDMDescriptorType type,
+ SmallVectorImpl<Type> &result) -> std::optional<LogicalResult> {
+ Type i32 = IntegerType::get(type.getContext(), 32);
+ Type v4i32 = typeConverter.convertType(VectorType::get(4, i32));
+ Type v8i32 = typeConverter.convertType(VectorType::get(8, i32));
+ llvm::append_values(result, v4i32, v8i32, v4i32, v4i32);
+ return success();
+ });
+
+ auto addUnrealizedCast = [](OpBuilder &builder, TypeRange types,
+ ValueRange inputs,
+ Location loc) -> SmallVector<Value> {
+ auto cast = UnrealizedConversionCastOp::create(builder, loc, types, inputs);
+ return cast.getResults();
+ };
+
+ typeConverter.addTargetMaterialization(addUnrealizedCast);
----------------
Hardcode84 wrote:
This part broke ROCM integration tests:
```
******************** TEST 'MLIR :: Integration/GPU/ROCM/vecadd.mlir' FAILED ********************
Exit Code: 2
Command Output (stdout):
--
# RUN: at line 1
/home/vano/llvm/llvm-build/bin/mlir-opt /home/vano/llvm/llvm-project/mlir/test/Integration/GPU/ROCM/vecadd.mlir | /home/vano/llvm/llvm-build/bin/mlir-opt -convert-scf-to-cf | /home/vano/llvm/llvm-build/bin/mlir-opt -gpu-kernel-outlining | /home/vano/llvm/llvm-build/bin/mlir-opt -pass-pipeline='builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-rocdl{use-bare-ptr-memref-call-conv=true}),rocdl-attach-target{chip=gfx1100})' | /home/vano/llvm/llvm-build/bin/mlir-opt -gpu-to-llvm=use-bare-pointers-for-kernels=true -reconcile-unrealized-casts -gpu-module-to-binary | /home/vano/llvm/llvm-build/bin/mlir-runner --shared-libs=/home/vano/llvm/llvm-build/lib/libmlir_rocm_runtime.so --shared-libs=/home/vano/llvm/llvm-build/lib/libmlir_runner_utils.so --entry-point-result=void | /home/vano/llvm/llvm-build/bin/FileCheck /home/vano/llvm/llvm-project/mlir/test/Integration/GPU/ROCM/vecadd.mlir
# executed command: /home/vano/llvm/llvm-build/bin/mlir-opt /home/vano/llvm/llvm-project/mlir/test/Integration/GPU/ROCM/vecadd.mlir
# executed command: /home/vano/llvm/llvm-build/bin/mlir-opt -convert-scf-to-cf
# executed command: /home/vano/llvm/llvm-build/bin/mlir-opt -gpu-kernel-outlining
# executed command: /home/vano/llvm/llvm-build/bin/mlir-opt '-pass-pipeline=builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-rocdl{use-bare-ptr-memref-call-conv=true}),rocdl-attach-target{chip=gfx1100})'
# executed command: /home/vano/llvm/llvm-build/bin/mlir-opt -gpu-to-llvm=use-bare-pointers-for-kernels=true -reconcile-unrealized-casts -gpu-module-to-binary
# .---command stderr------------
# | <stdin>:11:12: error: LLVM Translation failed for operation: builtin.unrealized_conversion_cast
# | %0 = builtin.unrealized_conversion_cast %arg2 : !llvm.ptr to !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
# | ^
# | <stdin>:11:12: note: see current operation: %0 = "builtin.unrealized_conversion_cast"(%arg2) : (!llvm.ptr) -> !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
# | <stdin>:9:3: error: Failed creating the llvm::Module.
# | gpu.module @vecadd_kernel [#rocdl.target<chip = "gfx1100">] attributes {llvm.data_layout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9"} {
# | ^
```
https://github.com/llvm/llvm-project/pull/170918
More information about the Mlir-commits
mailing list