[llvm] [RFC][AMDGPU] Enable simple aggregate types for kernel argument preload (PR #176458)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 21 06:18:52 PST 2026


================
@@ -0,0 +1,432 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
+; RUN: opt -mtriple=amdgcn-amd-amdhsa -mcpu=gfx942 -passes='amdgpu-attributor,amdgpu-preload-kernel-arguments,function(amdgpu-lower-kernel-arguments)' -amdgpu-kernarg-preload=0 -S < %s | FileCheck -check-prefix=NO-PRELOAD %s
+; RUN: opt -mtriple=amdgcn-amd-amdhsa -mcpu=gfx942 -passes='amdgpu-attributor,amdgpu-preload-kernel-arguments,function(amdgpu-lower-kernel-arguments)' -amdgpu-kernarg-preload-count=3 -S < %s | FileCheck -check-prefix=PRELOAD-3 %s
+
+; Test preloading of aggregate types (structs and arrays) without pointers.
+
+%struct.SimplePair = type { i32, i32 }
+%struct.ThreeInts = type { i32, i32, i32 }
+%struct.MixedPair = type { i32, float }
+%struct.Nested = type { %struct.SimplePair, i32 }
+%struct.DeeplyNested = type { %struct.Nested, float }
+%struct.WithPointer = type { i32, ptr addrspace(1) }
+%struct.NestedWithPointer = type { %struct.SimplePair, ptr addrspace(1) }
+%struct.DeeplyNestedWithPointer = type { %struct.Nested, ptr addrspace(1) }
+%struct.ArrayInStruct = type { [4 x i32] }
+
+; Simple struct with two i32 fields - should be preloaded
+define amdgpu_kernel void @test_preload_struct_simple(%struct.SimplePair %arg, ptr addrspace(1) %out) {
----------------
arsenm wrote:

Yes, that's the problem 

https://github.com/llvm/llvm-project/pull/176458


More information about the llvm-commits mailing list