Skip to content

Commit f4b54f7

Browse files
authored
[AMDGPU] Add documentation for scheduler intrinsics (#69854)
Adding sched_barrier, sched_group_barrier, and iglp_opt.
1 parent 94202e7 commit f4b54f7

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

llvm/docs/AMDGPUUsage.rst

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,59 @@ The AMDGPU backend implements the following LLVM IR intrinsics.
10981098
with the fifth i32 operand. The i1 sixth operand is used to clamp
10991099
the output. The i1s preceding the vector operands decide the signedness.
11001100

1101+
llvm.amdgcn.sched_barrier Controls the types of instructions that may be allowed to cross the intrinsic
1102+
during instruction scheduling. The parameter is a mask for the instruction types
1103+
that can cross the intrinsic.
1104+
1105+
- 0x0000: No instructions may be scheduled across sched_barrier.
1106+
- 0x0001: All, non-memory, non-side-effect producing instructions may be
1107+
scheduled across sched_barrier, *i.e.* allow ALU instructions to pass.
1108+
- 0x0002: VALU instructions may be scheduled across sched_barrier.
1109+
- 0x0004: SALU instructions may be scheduled across sched_barrier.
1110+
- 0x0008: MFMA/WMMA instructions may be scheduled across sched_barrier.
1111+
- 0x0010: All VMEM instructions may be scheduled across sched_barrier.
1112+
- 0x0020: VMEM read instructions may be scheduled across sched_barrier.
1113+
- 0x0040: VMEM write instructions may be scheduled across sched_barrier.
1114+
- 0x0080: All DS instructions may be scheduled across sched_barrier.
1115+
- 0x0100: All DS read instructions may be scheduled accoss sched_barrier.
1116+
- 0x0200: All DS write instructions may be scheduled across sched_barrier.
1117+
1118+
llvm.amdgcn.sched_group_barrier Creates schedule groups with specific properties to create custom scheduling
1119+
pipelines. The ordering between groups is enforced by the instruction scheduler.
1120+
The intrinsic applies to the code that preceeds the intrinsic. The intrinsic
1121+
takes three values that control the behavior of the schedule groups.
1122+
1123+
- Mask : Classify instruction groups using the llvm.amdgcn.sched_barrier mask values.
1124+
- Size : The number of instructions that are in the group.
1125+
- SyncID : Order is enforced between groups with matching values.
1126+
1127+
The mask can include multiple instruction types. It is undefined behavior to set
1128+
values beyond the range of valid masks.
1129+
1130+
Combining multiple sched_group_barrier intrinsics enables an ordering of specific
1131+
instruction types during instruction scheduling. For example, the following enforces
1132+
a sequence of 1 VMEM read, followed by 1 VALU instruction, followed by 5 MFMA
1133+
instructions.
1134+
1135+
| ``// 1 VMEM read``
1136+
| ``__builtin_amdgcn_sched_group_barrier(32, 1, 0)``
1137+
| ``// 1 VALU``
1138+
| ``__builtin_amdgcn_sched_group_barrier(2, 1, 0)``
1139+
| ``// 5 MFMA``
1140+
| ``__builtin_amdgcn_sched_group_barrier(8, 5, 0)``
1141+
1142+
llvm.amdgcn.iglp_opt An **experimental** intrinsic for instruction group level parallelism. The intrinsic
1143+
implements predefined intruction scheduling orderings. The intrinsic applies to the
1144+
surrounding scheduling region. The intrinsic takes a value that specifies the
1145+
strategy. The compiler implements two strategies.
1146+
1147+
0. Interleave DS and MFMA instructions for small GEMM kernels.
1148+
1. Interleave DS and MFMA instructions for single wave small GEMM kernels.
1149+
1150+
Only one iglp_opt intrinsic may be used in a scheduling region. The iglp_opt intrinsic
1151+
cannot be combined with sched_barrier or sched_group_barrier.
1152+
1153+
The iglp_opt strategy implementations are subject to change.
11011154

11021155
============================================== ==========================================================
11031156

0 commit comments

Comments
 (0)