[PATCH] D122734: [CUDA][HIP] Fix mangling number for local struct
Artem Belevich via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 12 14:41:58 PDT 2022
tra added inline comments.
================
Comment at: clang/lib/AST/ASTContext.cpp:11760-11763
+ auto Cutoff = [](unsigned V) { return V > 1 ? V : 1; };
+ if (CUDANameMangleCtx.MangleDeviceNameInHostCompilation)
+ return Cutoff(Res >> 16);
+ return Cutoff(Res & 0xffff);
----------------
I think we should change the `MangleNumbers` instead to use uin64_t or, perhaps `unsigned[2]` or even `struct{ unsigned host; unsigned device;}`.
Reducing the max number of anything to just 64K will be prone to failing sooner or later.
================
Comment at: clang/test/CodeGenCUDA/struct-mangling-number.cu:25
+// CHECK: define amdgpu_kernel void @[[KERN:_Z6kernelIZN4TestIiE3runEvE2OpEvv]](
+// CHECK: @{{.*}} = {{.*}}c"[[KERN]]\00"
+
----------------
Using HOST/DEV prefixes would work better, IMO to tell what's expected to happen where.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122734/new/
https://reviews.llvm.org/D122734
More information about the cfe-commits
mailing list