This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Add option -munsafe-fp-atomics
ClosedPublic

Authored by yaxunl on Nov 16 2020, 8:15 AM.

Details

Summary

Add an option -munsafe-fp-atomics for AMDGPU target.

When enabled, clang adds function attribute "amdgpu-unsafe-fp-atomics"
to any functions for amdgpu target. This allows amdgpu backend to use
unsafe fp atomic instructions in these functions.

Diff Detail

Event Timeline

yaxunl created this revision.Nov 16 2020, 8:15 AM
yaxunl requested review of this revision.Nov 16 2020, 8:15 AM
tra accepted this revision.Nov 16 2020, 9:35 AM

LGTM.

Patch description could use a pointer to more details about the unsafe atomics.

clang/include/clang/Basic/TargetOptions.h
78

I'm curious -- what does unsafe mean here?

This revision is now accepted and ready to land.Nov 16 2020, 9:35 AM
yaxunl marked an inline comment as done.Nov 16 2020, 10:17 AM
yaxunl added inline comments.
clang/include/clang/Basic/TargetOptions.h
78

unsafe means it does not follow requirements of other floating point options, e.g. it may flush denormals even if other fp options requires denormals not flushed. This allows user to relax fp restrictions on fp atomic instructions without relaxing fp requirements on other instructions.

This revision was automatically updated to reflect the committed changes.
yaxunl marked an inline comment as done.
Herald added a project: Restricted Project. · View Herald TranscriptNov 16 2020, 6:53 PM