[LLVMdev] [NVPTX] llc -march=nvptx64 -mcpu=sm_20 generates invalid zero align for device function params

Dmitry N. Mikushin maemarcus at gmail.com
Fri Nov 9 05:17:51 PST 2012


Hi Duncan,

You're right, global variables use preferred alignment. And - yes,
preferred alignment in this case is bigger: 8 instead of 4. NVIDIA's
prop. compiler gives 4. However, since CUDA 5.0 ptx modules are
linkable with each other, I think alignments for externally visible
functions and data should all follow ABI rules.

Is there a guide on making tests? I have ~5 pending patches never
accepted simply because I'm not familiar with LLVM test system :-/

- D.

2012/11/9 Duncan Sands <baldrick at free.fr>:
> Hi Dmitry,
>
>
>> I'm attaching a patch that should fix the issue mentioned above. It
>>
>> simply makes the same check seen in the same file for global
>> variables:
>>
>>    emitPTXAddressSpace(PTy->getAddressSpace(), O);
>>    if (GVar->getAlignment() == 0)
>>      O << " .align " << (int) TD->getPrefTypeAlignment(ETy);
>>    else
>>      O << " .align " << GVar->getAlignment();
>
>
> it's not quite the same because your patch uses the ABI alignment, while
> in this snippet it is the preferred alignment (which is usually the same
> as the ABI alignment, but may be bigger).
>
>
>> Could you please review and commit? Do you think it needs a test case?
>
>
> Yes, it needs a testcase.
>
> Ciao, Duncan.
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev



More information about the llvm-dev mailing list