This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][GlobalISel] Eliminate barrier if workgroup size is not greater than wavefront size
ClosedPublic

Authored by foad on Aug 26 2020, 4:16 AM.

Details

Summary

If a workgroup size is known to be not greater than wavefront size
the s_barrier instruction is not needed since all threads are guaranteed
to come to the same point at the same time.

This is the same optimization that was implemented for SelectionDAG in
D31731.

Diff Detail

Event Timeline

foad created this revision.Aug 26 2020, 4:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 26 2020, 4:16 AM
foad requested review of this revision.Aug 26 2020, 4:16 AM
arsenm accepted this revision.Aug 26 2020, 5:40 AM

This could be a pattern predicate but I guess it's not important

llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
1426

There's no real reason to check the opt level but I guess it does this already

This revision is now accepted and ready to land.Aug 26 2020, 5:40 AM