[PATCH] D119247: [NVPTX] Use align attribute for kernel pointer arg alignment

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 9 01:41:13 PST 2022


nikic added a comment.

In D119247#3305444 <https://reviews.llvm.org/D119247#3305444>, @tra wrote:

>> make use of alignment annotations added by the frontend.
>
> Does it mean that we now require explicit alignment annotation to generate reasonable code? What happens if alignment is not specified explicitly? Do we fall back to unaligned/naturally aligned/something else?

If the frontend does not add an explicit alignment annotation (and no alignment is inferred during optimization), then LLVM assumes that pointers are unaligned (alignment 1).



================
Comment at: llvm/test/CodeGen/NVPTX/nvcl-param-align.ll:7
+define void @foo(i64 %img, i64 %sampler, <5 x float>* align 32 %v) {
+; The parameter alignment is determined by the align attribute.
 ; CHECK: .param .u32 .ptr .align 32 foo_param_2
----------------
tra wrote:
> What's expected to happen if the alignment is not specified explicitly?
> 
> It may be worth adding a test case for that.
If no alignment is specified, then the default is 1. I've extended the test to check for this.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119247/new/

https://reviews.llvm.org/D119247



More information about the llvm-commits mailing list