This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Mark all relevant VOP1 instructions rematerializable
ClosedPublic

Authored by rampitec on Jul 13 2021, 10:58 AM.

Diff Detail

Event Timeline

rampitec created this revision.Jul 13 2021, 10:58 AM
rampitec requested review of this revision.Jul 13 2021, 10:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2021, 10:58 AM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm added inline comments.Jul 13 2021, 4:53 PM
llvm/lib/Target/AMDGPU/VOP1Instructions.td
361

I think we need a nofpexcept flag check for most of these FP ops

rampitec added inline comments.Jul 13 2021, 5:12 PM
llvm/lib/Target/AMDGPU/VOP1Instructions.td
361

Do we realy raise anything? I suppose at maximum we will get SNaN, but that can be remated. On practice have you seen a signaling scenario anywhere?

arsenm added inline comments.Jul 13 2021, 5:13 PM
llvm/lib/Target/AMDGPU/VOP1Instructions.td
361

It's not enabled anywhere but the hardware does support it. You just need to check MI::mayRaiseFPException

rampitec added inline comments.Jul 13 2021, 5:21 PM
llvm/lib/Target/AMDGPU/VOP1Instructions.td
361

If I just check it these will never be remated, there is no even a point to mark them. If the check will include something like "exceptions enabled for the functuon and may raise", then it makes more sense. But since we don't enable it I doubt I can write such check. Maybe just leave a TODO?

rampitec added inline comments.Jul 13 2021, 5:24 PM
llvm/lib/Target/AMDGPU/VOP1Instructions.td
361

I can even add a stub areFPEcxeptionsEnabled() returning false in the MFI, and check it. One day we will write something into that stub.

arsenm added inline comments.Jul 13 2021, 5:26 PM
llvm/lib/Target/AMDGPU/VOP1Instructions.td
361

You don't need to track a function level property. The regular non-constrained FP operations imply nofpexcept. You just need to check MI::mayRaiseFPException

rampitec added inline comments.Jul 13 2021, 5:28 PM
llvm/lib/Target/AMDGPU/VOP1Instructions.td
361

Ack.

rampitec updated this revision to Diff 358659.Jul 14 2021, 10:18 AM
rampitec marked 3 inline comments as done.

Added check for mayRaiseFPException().

llvm/lib/Target/AMDGPU/VOP1Instructions.td
361

Note that we do not always set nofpexcept even though we have it disabled. Selection could be improved.

rampitec updated this revision to Diff 359155.Jul 15 2021, 3:56 PM

Dropped 16 bit dst opcodes.

Could also use a test around an implicit def of $mode

Could also use a test around an implicit def of $mode

The test does exist: test_no_remat_v_cvt_i32_f64_e32_mode_def

arsenm accepted this revision.Jul 21 2021, 1:56 PM
This revision is now accepted and ready to land.Jul 21 2021, 1:56 PM
This revision was landed with ongoing or failed builds.Jul 21 2021, 2:05 PM
This revision was automatically updated to reflect the committed changes.