AMDGPUHSAMetadataStreamer currently assumes that pointer arguments without align attribute have ABI alignment of the pointee type. This is incompatible with opaque pointers, but also plain incorrect: Pointer arguments without explicit alignment have alignment 1. It is the responsibility of the frontent to add correct align annotations.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This change introduces the regression in OpenCL conformance test: basic - kernel_memory_alignment_local. Does it require any corresponding runtime changes?
clang does not do anything special for alignment of pointer type kernel arg. It assumes the pointee alignment is default 1. https://godbolt.org/z/xs195rKoW
Question is: What OpenCL spec says about kernel arg pointee alignment? @b-sumner @Anastasia
I doubt OpenCL spec requires alignment of pointer-type kernel argument. I suspect it is part of our own undocumented ABI. If we implement this in clang, it probably goes to TargetABIInfo.
I would suggest reverting this patch since it caused regressions. It should not be committed without corresponding clang change to maintain the ABI.
Yes it does, it requires natural alignment for all types which is what that conformance test is checking.
Agreed. OpenCL requires a alignof(T) to equal sizeof(T). There are vload/vstore functions to access vectors which are less aligned than their size.