This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Add more expressive sched_barrier controls
ClosedPublic

Authored by kerbowa on Jun 6 2022, 8:57 AM.

Details

Summary

The sched_barrier builtin allow the scheduler's behavior to be shaped by users
when very specific codegen is needed in order to create highly optimized code.
This patch adds more granular control over the types of instructions that are
allowed to be reordered with respect to one or multiple sched_barriers. A mask
is used to specify groups of instructions that should be allowed to be scheduled
around a sched_barrier. The details about this mask may be used can be found in
llvm/include/llvm/IR/IntrinsicsAMDGPU.td.

Diff Detail

Event Timeline

kerbowa created this revision.Jun 6 2022, 8:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 6 2022, 8:57 AM
kerbowa requested review of this revision.Jun 6 2022, 8:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 6 2022, 8:57 AM

Any post-RA specific tests?

llvm/lib/Target/AMDGPU/AMDGPUMFMAIGroupLP.cpp
0

As is this is useful w/o MFMA too.

0

... and it should not probably read 'MFMA' here too, just like as in the file and class name.

1

Typo: regeion

7

This sounds pretty dangerous, at least for non-artifical edges.

llvm/lib/Target/AMDGPU/SIInstructions.td
2446 ↗(On Diff #434503)

Drop it from the change.

kerbowa updated this revision to Diff 436261.Jun 12 2022, 5:23 PM
kerbowa marked 3 inline comments as done.

Address comments.

kerbowa added inline comments.Jun 12 2022, 5:25 PM
llvm/lib/Target/AMDGPU/AMDGPUMFMAIGroupLP.cpp
7

Ya. Although I do not think the DAG builder should rely on the sched_barrier having side effects.

kerbowa updated this revision to Diff 436262.Jun 12 2022, 5:28 PM

Fix cl options.

kerbowa updated this revision to Diff 436264.Jun 12 2022, 5:37 PM

Fix test after name change.

rampitec accepted this revision.Jun 13 2022, 1:07 PM

Well, given edges are only removed from the sched_barrier I guess it is OK.
LGTM.

This revision is now accepted and ready to land.Jun 13 2022, 1:07 PM

Thanks for addressing the post-commit requests in D125997. LGTM

This revision was landed with ongoing or failed builds.Jun 14 2022, 10:24 PM
This revision was automatically updated to reflect the committed changes.
llvm/test/CodeGen/AMDGPU/sched-barrier-pre-RA.mir