[llvm] [AMDGPU] Split struct kernel arguments (PR #133786)
Yaxun Liu via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 22 06:48:05 PST 2026
================
@@ -357,17 +357,38 @@ void MetadataStreamerMsgPackV4::emitKernelArg(const Argument &Arg,
Align ArgAlign;
std::tie(ArgTy, ArgAlign) = getArgumentTypeAlign(Arg, DL);
+ // Assuming the argument is not split from struct-type argument by default,
+ // unless we find it in function attribute amdgpu-argument-mapping.
+ unsigned OriginalArgIndex = ~0U;
+ uint64_t OriginalArgOffset = 0;
+ Attribute Attr =
+ Func->getAttributes().getParamAttr(ArgNo, "amdgpu-original-arg");
+ if (Attr.isValid()) {
+ StringRef MappingStr = Attr.getValueAsString();
+ SmallVector<StringRef, 2> Elements;
+ MappingStr.split(Elements, ':');
+ if (Elements.size() == 2) {
+ if (Elements[0].getAsInteger(10, OriginalArgIndex))
+ report_fatal_error(
----------------
yxsamliu wrote:
Done. Replaced `report_fatal_error` with an assert plus graceful fallback. The assert catches malformed attributes during development (assertions-enabled builds), while release builds silently ignore invalid attributes and fall back to default values (no original arg mapping).
https://github.com/llvm/llvm-project/pull/133786
More information about the llvm-commits
mailing list