This is an archive of the discontinued LLVM Phabricator instance.

[NVPTX] Fix poorly designed assertion introduced in D120129
ClosedPublic

Authored by kovdan01 on Mar 28 2022, 1:21 AM.

Details

Summary

NVPTXTargetLowering::getFunctionParamOptimizedAlign, which was introduces in
D120129, contained a poorly designed assertion checking that a function with
internal or private linkage is not a kernel. It relied on invariants that
were not actually guaranteed, and that resulted in compiler crash with some
CUDA versions (see discussion with @jdoerfert in D120129). This patch changes
that assertion and makes it use isKernelFunction which is designed exactly for
such checks. This patch also includes a test with IR that caused compiler crash
before.

Diff Detail

Event Timeline

kovdan01 created this revision.Mar 28 2022, 1:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 28 2022, 1:21 AM
kovdan01 requested review of this revision.Mar 28 2022, 1:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 28 2022, 1:21 AM
kovdan01 edited the summary of this revision. (Show Details)Mar 28 2022, 1:28 AM
jdoerfert accepted this revision.Mar 28 2022, 7:18 AM

LG, one nit.

(Also much cleaner, thanks)

llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
4266

Add some text, && "Expected kernels to have external linkage"), or similar.

This revision is now accepted and ready to land.Mar 28 2022, 7:18 AM
kovdan01 updated this revision to Diff 418583.Mar 28 2022, 7:36 AM
This revision was landed with ongoing or failed builds.Mar 28 2022, 7:37 AM
This revision was automatically updated to reflect the committed changes.

@jdoerfert Merged, hope your CI will be fixed. Could you please change "Changes requested" mark in D120129 when you verify that everything is OK? Just to make that revision closed again.

llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
4266

Ah, forgot that, thanks!