This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Only allow global fp atomics with unsafe option
ClosedPublic

Authored by rampitec on May 12 2021, 11:41 AM.

Details

Summary

Previously we were allowing to use FP atomics without
-amdgpu-unsafe-fp-atomics option if a scope is less then
system. This is not safe just as well if we have UC memory.

This change only allows global and flat FP atomics with
the unsafe option. Consequentially that makes a check for
denorm mode redundant since we skip it with the unsafe
option and do not have a way to produce these instructions
without it anyway.

Diff Detail

Event Timeline

rampitec created this revision.May 12 2021, 11:41 AM
rampitec requested review of this revision.May 12 2021, 11:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 12 2021, 11:41 AM
Herald added a subscriber: wdng. · View Herald Transcript
t-tye added inline comments.May 12 2021, 12:06 PM
llvm/lib/Target/AMDGPU/SIISelLowering.cpp
12147–12153

Should the amdgpu-unsafe-fp-atomics also ally here too? If not should the attribute be named to reflect it only allies to global fp atomics?

rampitec added inline comments.May 12 2021, 12:09 PM
llvm/lib/Target/AMDGPU/SIISelLowering.cpp
12147–12153

This is LDS, so does not have the same problem with mtypes. We can skip denorms check, but that would be a separate patch.

rampitec updated this revision to Diff 344907.May 12 2021, 12:18 PM

Added tests for safe case.

rampitec marked an inline comment as done.May 12 2021, 1:48 PM
rampitec added inline comments.
llvm/lib/Target/AMDGPU/SIISelLowering.cpp
12147–12153
t-tye accepted this revision.May 12 2021, 7:54 PM

LGTM

Added @b-sumner to review.

This revision is now accepted and ready to land.May 12 2021, 7:54 PM

This looks good to me.

This revision was automatically updated to reflect the committed changes.