This is an archive of the discontinued LLVM Phabricator instance.

[NVPTX] Support float <-> 2 x half bitcasts
ClosedPublic

Authored by jchlanda on Apr 21 2022, 6:54 AM.

Details

Summary

Make sure NVPTX backend can handle bitcasting between float and <2 x half> types.

This was discovered through: https://github.com/intel/llvm/issues/5969
I'm not suggesting that such bitcasts make much sense, but it feels like the compiler should not hard crash on them.

Diff Detail

Event Timeline

jchlanda created this revision.Apr 21 2022, 6:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2022, 6:54 AM
jchlanda requested review of this revision.Apr 21 2022, 6:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2022, 6:54 AM
tra accepted this revision.Apr 21 2022, 11:20 AM

Thank you for the fix.

The source code which triggered this issue is full of type-puns, but I guess the user should be allowed to shoot one's foot if they really want to. I can only wish them good luck if LLVM/ptxas or hardware decides to flush fp32 value to zero if the bitpattern created by two fp16 values results in a denormal fp32. The funny thing is that their data is originally stored as an array of scalars. They didn't have to use float as an intermediate value.

This revision is now accepted and ready to land.Apr 21 2022, 11:20 AM

@tra would you be so kind and merge it in for me please?

This revision was automatically updated to reflect the committed changes.