This is an archive of the discontinued LLVM Phabricator instance.

[NVPTX] Correctly lower extending loads for fp16 vectors.
ClosedPublic

Authored by tra on Jun 21 2023, 3:37 PM.

Diff Detail

Event Timeline

tra created this revision.Jun 21 2023, 3:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 21 2023, 3:37 PM
tra published this revision for review.Jun 21 2023, 3:56 PM
tra added a reviewer: jlebar.
Herald added a project: Restricted Project. · View Herald TranscriptJun 21 2023, 3:56 PM
nirvedhmeshram added inline comments.
llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp
3605

I would like to understand how this is safe, since for target nodes we will always get IsSigned = false . Could there be cases where we would actually need a signed convert?

tra added inline comments.Jun 21 2023, 6:10 PM
llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp
3605

Good point.
I'm pretty sure we have not run into any case like these, because in such a case we'd skip extending the types and would end up with the same error we're dealing with now.
Integers appear to follow a somewhat different code path and do not try to do extending load in one instruction.

However, I do not know it for sure, so I'll update the patch to keep behavior for integers unchanged.

llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp
3605

I did confirm same example works if it is i16/i32 instead of f16/f32 . So I am okay either way.

tra updated this revision to Diff 533781.Jun 22 2023, 2:17 PM

Preserve behavior for lowering integer vectors.

tra added a reviewer: bkramer.Jun 22 2023, 2:32 PM
tra updated this revision to Diff 533801.Jun 22 2023, 3:17 PM

Fixed an error in lowering extending vector loads.

We were bailing out due to comparing the alignment of *extended* type, instead
of the type we're actually loading and that resulted in unnecessary vector
splitting.

tra updated this revision to Diff 533802.Jun 22 2023, 3:26 PM

Added more tests for vector loads w/ small alignment.

tra edited the summary of this revision. (Show Details)Jun 22 2023, 3:27 PM
bkramer accepted this revision.Jun 23 2023, 4:42 AM
This revision is now accepted and ready to land.Jun 23 2023, 4:42 AM
This revision was automatically updated to reflect the committed changes.