Skip to content

Commit 1b0746f

Browse files
committed
review comments
- add check for "convergencectrl" token in hlsl -> spirv intrinsic - correct the execution scope of the spirv instruction, add description - fix typo
1 parent e8c5dba commit 1b0746f

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

clang/test/CodeGenHLSL/builtins/WaveReadLaneAt.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
int test_int(int expr, uint idx) {
1212
// CHECK-SPIRV: %[[#entry_tok:]] = call token @llvm.experimental.convergence.entry()
1313

14-
// CHECK-SPIRV: %[[RET:.*]] = call [[TY:.*]] @llvm.spv.wave.read.lane.at.i32([[TY]] %[[#]], i32 %[[#]])
14+
// CHECK-SPIRV: %[[RET:.*]] = call [[TY:.*]] @llvm.spv.wave.read.lane.at.i32([[TY]] %[[#]], i32 %[[#]]) [ "convergencectrl"(token %[[#entry_tok]]) ]
1515
// CHECK-DXIL: %[[RET:.*]] = call [[TY:.*]] @llvm.dx.wave.read.lane.at.i32([[TY]] %[[#]], i32 %[[#]])
1616

1717
// CHECK: ret [[TY]] %[[RET]]
@@ -27,7 +27,7 @@ int test_int(int expr, uint idx) {
2727
float4 test_floatv4(float4 expr, uint idx) {
2828
// CHECK-SPIRV: %[[#entry_tok1:]] = call token @llvm.experimental.convergence.entry()
2929

30-
// CHECK-SPIRV: %[[RET1:.*]] = call [[TY1:.*]] @llvm.spv.wave.read.lane.at.v4f32([[TY1]] %[[#]], i32 %[[#]])
30+
// CHECK-SPIRV: %[[RET1:.*]] = call [[TY1:.*]] @llvm.spv.wave.read.lane.at.v4f32([[TY1]] %[[#]], i32 %[[#]]) [ "convergencectrl"(token %[[#entry_tok1]]) ]
3131
// CHECK-DXIL: %[[RET1:.*]] = call [[TY1:.*]] @llvm.dx.wave.read.lane.at.v4f32([[TY1]] %[[#]], i32 %[[#]])
3232

3333
// CHECK: ret [[TY1]] %[[RET1]]

llvm/lib/Target/DirectX/DXIL.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ def WaveIsFirstLane : DXILOp<110, waveIsFirstLane> {
802802
let attributes = [Attributes<DXIL1_0, [ReadNone]>];
803803
}
804804

805-
def WaveReadLaneAt: DXILOp<117, waveIsFirstLane> {
805+
def WaveReadLaneAt: DXILOp<117, waveReadLaneAt> {
806806
let Doc = "returns the value from the specified lane";
807807
let LLVMIntrinsic = int_dx_wave_read_lane_at;
808808
let arguments = [OverloadTy, Int32Ty];

llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2658,15 +2658,16 @@ bool SPIRVInstructionSelector::selectIntrinsic(Register ResVReg,
26582658
assert(I.getOperand(2).isReg());
26592659
assert(I.getOperand(3).isReg());
26602660

2661-
// Defines the execution scope currently 2 for group, see scope table
2661+
// IntTy is used to define the execution scope, set to 3 to denote a
2662+
// cross-lane interaction equivalent to a SPIR-V subgroup.
26622663
SPIRVType *IntTy = GR.getOrCreateSPIRVIntegerType(32, I, TII);
26632664
return BuildMI(BB, I, I.getDebugLoc(),
26642665
TII.get(SPIRV::OpGroupNonUniformShuffle))
26652666
.addDef(ResVReg)
26662667
.addUse(GR.getSPIRVTypeID(ResType))
26672668
.addUse(I.getOperand(2).getReg())
26682669
.addUse(I.getOperand(3).getReg())
2669-
.addUse(GR.getOrCreateConstInt(2, I, IntTy, TII));
2670+
.addUse(GR.getOrCreateConstInt(3, I, IntTy, TII));
26702671
}
26712672
case Intrinsic::spv_step:
26722673
return selectStep(ResVReg, ResType, I);

llvm/test/CodeGen/SPIRV/hlsl-intrinsics/WaveReadLaneAt.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
; Test lowering to spir-v backend
55

66
; CHECK-DAG: %[[#uint:]] = OpTypeInt 32 0
7-
; CHECK-DAG: %[[#scope:]] = OpConstant %[[#uint]] 2
7+
; CHECK-DAG: %[[#scope:]] = OpConstant %[[#uint]] 3
88
; CHECK-DAG: %[[#f32:]] = OpTypeFloat 32
99
; CHECK-DAG: %[[#expr:]] = OpFunctionParameter %[[#f32]]
1010
; CHECK-DAG: %[[#idx:]] = OpFunctionParameter %[[#uint]]

0 commit comments

Comments
 (0)