As part of D120129 we started to assert if an nvvm.annotation had a
nullptr as a first component. That is however happening with OpenMP
offload and older CUDA versions, e.g., CUDA 11.0.2, while newer ones,
e.g., 11.4.0 work fine. There is no need to require a non-null value
so let's keep things working for old codes.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks @jdoerfert! I was going to implement a fix for that, but have not managed to do it yet. See a couple of inline comments below.
llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp | ||
---|---|---|
4273 | In D120129, you added a comment containing the following piece of IR: !nvvm.annotations = !{!8, !9, !8, !10, !10, !10, !10, !11, !11, !10} !8 = !{null, !"align", i32 8} !9 = !{null, !"align", i32 8, !"align", i32 65544, !"align", i32 131080} !10 = !{null, !"align", i32 16} !11 = !{null, !"align", i32 16, !"align", i32 65552, !"align", i32 131088} According to that, one piece of metadata can contain more than 3 operands. I was unable to find a piece of code where we create such piece of metadata. I even was ubable to find code that adds align info to nvvm.annotations. All that I have found – NVPTXTargetCodeGenInfo::addNVVMMetadata and similar/duplicating code, that creates a piece of metadata consisting of 3 operands. So, I can’t state for sure without seeing code responsible for that, but given your IR above, a question arises: shouldn’t we change this assert? | |
llvm/test/CodeGen/NVPTX/param-vectorize-device.ll | ||
803 | I think that we should add a comment explaining what is the purpose of these lines. It might be unclear out of the context of the revision. See ; Section X - checking that... comments above. |
llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp | ||
---|---|---|
4268–4296 | During investigation, discovered a nice function bool isKernelFunction(const Function &); in NVPTXUtilities. It does the same thing (with going inside metadata) but correctly in its implementation. So I suppose that we can replace the whole ifndef block with a single asserion: assert(!isKernelFunction(*F)); Also, if we use an already existing function instead of reinventing a wheel, looks like there is no need in altering tests. |
In D120129, you added a comment containing the following piece of IR:
According to that, one piece of metadata can contain more than 3 operands. I was unable to find a piece of code where we create such piece of metadata. I even was ubable to find code that adds align info to nvvm.annotations. All that I have found – NVPTXTargetCodeGenInfo::addNVVMMetadata and similar/duplicating code, that creates a piece of metadata consisting of 3 operands. So, I can’t state for sure without seeing code responsible for that, but given your IR above, a question arises: shouldn’t we change this assert?