Skip to content

Commit f082a08

Browse files
authored
Merge pull request #12 from damyanp/copilot/resolve-merge-conflicts
Resolve merge conflicts for microsoft/DirectXShaderCompiler PR microsoft#8291
2 parents e589de4 + fbb8408 commit f082a08

30 files changed

Lines changed: 946 additions & 119 deletions

external/SPIRV-Tools

Submodule SPIRV-Tools updated 113 files

include/dxc/DXIL/DxilConstants.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ enum class ComponentType : uint32_t {
183183
PackedU8x32 = 18,
184184

185185
// BEGIN NEW FOR SM 6.9
186-
U8 = 19,
187-
I8 = 20,
186+
I8 = 19,
187+
U8 = 20,
188188
F8_E4M3 = 21,
189189
F8_E5M2 = 22,
190190
// END

include/dxc/DXIL/DxilInstructions.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10376,7 +10376,7 @@ struct DxilInst_LinAlgMatrixLoadFromDescriptor {
1037610376
// Validation support
1037710377
bool isAllowed() const { return true; }
1037810378
bool isArgumentListValid() const {
10379-
if (5 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
10379+
if (6 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
1038010380
return false;
1038110381
return true;
1038210382
}
@@ -10388,6 +10388,7 @@ struct DxilInst_LinAlgMatrixLoadFromDescriptor {
1038810388
arg_offset = 2,
1038910389
arg_stride = 3,
1039010390
arg_layout = 4,
10391+
arg_align = 5,
1039110392
};
1039210393
// Accessors
1039310394
llvm::Value *get_handle() const { return Instr->getOperand(1); }
@@ -10398,6 +10399,8 @@ struct DxilInst_LinAlgMatrixLoadFromDescriptor {
1039810399
void set_stride(llvm::Value *val) { Instr->setOperand(3, val); }
1039910400
llvm::Value *get_layout() const { return Instr->getOperand(4); }
1040010401
void set_layout(llvm::Value *val) { Instr->setOperand(4, val); }
10402+
llvm::Value *get_align() const { return Instr->getOperand(5); }
10403+
void set_align(llvm::Value *val) { Instr->setOperand(5, val); }
1040110404
};
1040210405

1040310406
/// This instruction fills a matrix with data from a groupshared array
@@ -10575,7 +10578,7 @@ struct DxilInst_LinAlgMatrixStoreToDescriptor {
1057510578
// Validation support
1057610579
bool isAllowed() const { return true; }
1057710580
bool isArgumentListValid() const {
10578-
if (6 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
10581+
if (7 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
1057910582
return false;
1058010583
return true;
1058110584
}
@@ -10588,6 +10591,7 @@ struct DxilInst_LinAlgMatrixStoreToDescriptor {
1058810591
arg_offset = 3,
1058910592
arg_stride = 4,
1059010593
arg_layout = 5,
10594+
arg_align = 6,
1059110595
};
1059210596
// Accessors
1059310597
llvm::Value *get_matrix() const { return Instr->getOperand(1); }
@@ -10600,6 +10604,8 @@ struct DxilInst_LinAlgMatrixStoreToDescriptor {
1060010604
void set_stride(llvm::Value *val) { Instr->setOperand(4, val); }
1060110605
llvm::Value *get_layout() const { return Instr->getOperand(5); }
1060210606
void set_layout(llvm::Value *val) { Instr->setOperand(5, val); }
10607+
llvm::Value *get_align() const { return Instr->getOperand(6); }
10608+
void set_align(llvm::Value *val) { Instr->setOperand(6, val); }
1060310609
};
1060410610

1060510611
/// This instruction stores a matrix to groupshared memory
@@ -10812,7 +10818,7 @@ struct DxilInst_LinAlgMatrixAccumulateToDescriptor {
1081210818
// Validation support
1081310819
bool isAllowed() const { return true; }
1081410820
bool isArgumentListValid() const {
10815-
if (6 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
10821+
if (7 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
1081610822
return false;
1081710823
return true;
1081810824
}
@@ -10825,6 +10831,7 @@ struct DxilInst_LinAlgMatrixAccumulateToDescriptor {
1082510831
arg_offset = 3,
1082610832
arg_stride = 4,
1082710833
arg_layout = 5,
10834+
arg_align = 6,
1082810835
};
1082910836
// Accessors
1083010837
llvm::Value *get_matrix() const { return Instr->getOperand(1); }
@@ -10837,6 +10844,8 @@ struct DxilInst_LinAlgMatrixAccumulateToDescriptor {
1083710844
void set_stride(llvm::Value *val) { Instr->setOperand(4, val); }
1083810845
llvm::Value *get_layout() const { return Instr->getOperand(5); }
1083910846
void set_layout(llvm::Value *val) { Instr->setOperand(5, val); }
10847+
llvm::Value *get_align() const { return Instr->getOperand(6); }
10848+
void set_align(llvm::Value *val) { Instr->setOperand(6, val); }
1084010849
};
1084110850

1084210851
/// This instruction accumulates a matrix to groupshared memory

lib/DXIL/DxilOperations.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6563,6 +6563,7 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) {
65636563
A(pI32);
65646564
A(pI32);
65656565
A(pI32);
6566+
A(pI32);
65666567
break;
65676568
case OpCode::LinAlgMatrixLoadFromMemory:
65686569
A(EXT(0));
@@ -6604,6 +6605,7 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) {
66046605
A(pI32);
66056606
A(pI32);
66066607
A(pI32);
6608+
A(pI32);
66076609
break;
66086610
case OpCode::LinAlgMatrixStoreToMemory:
66096611
A(pV);
@@ -6654,6 +6656,7 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) {
66546656
A(pI32);
66556657
A(pI32);
66566658
A(pI32);
6659+
A(pI32);
66576660
break;
66586661
case OpCode::LinAlgMatrixAccumulateToMemory:
66596662
A(pV);

lib/HLSL/HLOperationLower.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6750,12 +6750,13 @@ Value *TranslateLinAlgMatrixAccumStoreToDescriptor(
67506750
Value *Offset = CI->getArgOperand(3);
67516751
Value *Stride = CI->getArgOperand(4);
67526752
Value *Layout = CI->getArgOperand(5);
6753+
Value *Align = CI->getArgOperand(6);
67536754

67546755
Constant *OpArg = HlslOp->GetU32Const((unsigned)OpCode);
67556756
Function *DxilFunc = HlslOp->GetOpFunc(OpCode, Matrix->getType());
67566757

6757-
return Builder.CreateCall(DxilFunc,
6758-
{OpArg, Matrix, ResHandle, Offset, Stride, Layout});
6758+
return Builder.CreateCall(
6759+
DxilFunc, {OpArg, Matrix, ResHandle, Offset, Stride, Layout, Align});
67596760
}
67606761

67616762
Value *TranslateLinAlgMatVecMul(CallInst *CI, IntrinsicOp IOP,
@@ -6831,12 +6832,13 @@ Value *TranslateLinAlgMatrixLoadFromDescriptor(
68316832
Value *Offset = CI->getArgOperand(3);
68326833
Value *Stride = CI->getArgOperand(4);
68336834
Value *Layout = CI->getArgOperand(5);
6835+
Value *Align = CI->getArgOperand(6);
68346836

68356837
Constant *OpArg = HlslOp->GetU32Const((unsigned)OpCode);
68366838
Function *DxilFunc = HlslOp->GetOpFunc(OpCode, MatrixType);
68376839

6838-
Value *Matrix =
6839-
Builder.CreateCall(DxilFunc, {OpArg, ResHandle, Offset, Stride, Layout});
6840+
Value *Matrix = Builder.CreateCall(
6841+
DxilFunc, {OpArg, ResHandle, Offset, Stride, Layout, Align});
68406842
Builder.CreateStore(Matrix, MatrixPtr);
68416843

68426844
return nullptr;

tools/clang/lib/SPIRV/SpirvEmitter.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8045,7 +8045,10 @@ SpirvInstruction *SpirvEmitter::createVectorSplat(const Expr *scalarExpr,
80458045
// Should find a more meaningful one.
80468046
if (auto *constVal = dyn_cast<SpirvConstant>(scalarVal)) {
80478047
llvm::SmallVector<SpirvConstant *, 4> elements(size_t(size), constVal);
8048-
const bool isSpecConst = constVal->getopcode() == spv::Op::OpSpecConstant;
8048+
const bool isSpecConst =
8049+
constVal->getopcode() == spv::Op::OpSpecConstant ||
8050+
constVal->getopcode() == spv::Op::OpSpecConstantFalse ||
8051+
constVal->getopcode() == spv::Op::OpSpecConstantTrue;
80498052
auto *value =
80508053
spvBuilder.getConstantComposite(vecType, elements, isSpecConst);
80518054
if (!value)

tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixaccumulatetodescriptor/nominal.hlsl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ void main() {
99
// CHECK-LABEL: define void @main()
1010

1111
// CHECK: call void @dx.op.linAlgMatrixAccumulateToDescriptor.mC4M5N4U1S2(i32 -2147483621,
12-
// CHECK-SAME: %dx.types.LinAlgMatrixC4M5N4U1S2 {{.*}}, %dx.types.Handle %{{.*}}, i32 5, i32 5, i32 5)
13-
// CHECK-SAME: ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout)
12+
// CHECK-SAME: %dx.types.LinAlgMatrixC4M5N4U1S2 {{.*}}, %dx.types.Handle %{{.*}}, i32 5, i32 5, i32 5, i32 4)
13+
// CHECK-SAME: ; LinAlgMatrixAccumulateToDescriptor(matrix,handle,offset,stride,layout,align)
1414

15-
// CHECK2: call void @"dx.hl.op..void (i32, %dx.types.LinAlgMatrixC4M5N4U1S2, %dx.types.Handle, i32, i32, i32)"
16-
// CHECK2-SAME: (i32 419, %dx.types.LinAlgMatrixC4M5N4U1S2 {{.*}}, %dx.types.Handle {{.*}}, i32 5, i32 5, i32 5)
15+
// CHECK2: call void @"dx.hl.op..void (i32, %dx.types.LinAlgMatrixC4M5N4U1S2, %dx.types.Handle, i32, i32, i32, i32)"
16+
// CHECK2-SAME: (i32 419, %dx.types.LinAlgMatrixC4M5N4U1S2 {{.*}}, %dx.types.Handle {{.*}}, i32 5, i32 5, i32 5, i32 4)
1717
__builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(4, 5, 4, 1, 2)]] mat;
18-
__builtin_LinAlg_MatrixAccumulateToDescriptor(mat, outbuf, 5, 5, 5);
18+
__builtin_LinAlg_MatrixAccumulateToDescriptor(mat, outbuf, 5, 5, 5, 4);
1919
}

tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixloadfromdescriptor/nominal.hlsl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ void main() {
99
// CHECK-LABEL: define void @main()
1010

1111
// CHECK: %{{.*}} = call %dx.types.LinAlgMatrixC1M1N1U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC1M1N1U0S0
12-
// CHECK-SAME: (i32 -2147483634, %dx.types.Handle %{{.*}}, i32 0, i32 0, i32 0)
13-
// CHECK-SAME: ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout)
12+
// CHECK-SAME: (i32 -2147483634, %dx.types.Handle %{{.*}}, i32 0, i32 0, i32 0, i32 4)
13+
// CHECK-SAME: ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align)
1414

15-
// CHECK2: call void @"dx.hl.op..void (i32, %dx.types.LinAlgMatrixC1M1N1U0S0*, %dx.types.Handle, i32, i32, i32)
16-
// CHECK2-SAME: "(i32 410, %dx.types.LinAlgMatrixC1M1N1U0S0* %mat, %dx.types.Handle {{.*}}, i32 0, i32 0, i32 0)
15+
// CHECK2: call void @"dx.hl.op..void (i32, %dx.types.LinAlgMatrixC1M1N1U0S0*, %dx.types.Handle, i32, i32, i32, i32)
16+
// CHECK2-SAME: "(i32 410, %dx.types.LinAlgMatrixC1M1N1U0S0* %mat, %dx.types.Handle {{.*}}, i32 0, i32 0, i32 0, i32 4)
1717
__builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(1, 1, 1, 0, 0)]] mat;
18-
__builtin_LinAlg_MatrixLoadFromDescriptor(mat, inbuf, 0, 0, 0);
18+
__builtin_LinAlg_MatrixLoadFromDescriptor(mat, inbuf, 0, 0, 0, 4);
1919
}

tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixstoretodescriptor/nominal.hlsl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ void main() {
99
// CHECK-LABEL: define void @main()
1010

1111
// CHECK: call void @dx.op.linAlgMatrixStoreToDescriptor.mC4M5N4U1S2(i32 -2147483628,
12-
// CHECK-SAME: %dx.types.LinAlgMatrixC4M5N4U1S2 {{.*}}, %dx.types.Handle %{{.*}}, i32 1, i32 1, i32 0)
13-
// CHECK-SAME: ; LinAlgMatrixStoreToDescriptor(matrix,handle,offset,stride,layout)
12+
// CHECK-SAME: %dx.types.LinAlgMatrixC4M5N4U1S2 {{.*}}, %dx.types.Handle %{{.*}}, i32 1, i32 1, i32 0, i32 4)
13+
// CHECK-SAME: ; LinAlgMatrixStoreToDescriptor(matrix,handle,offset,stride,layout,align)
1414

15-
// CHECK2: call void @"dx.hl.op..void (i32, %dx.types.LinAlgMatrixC4M5N4U1S2, %dx.types.Handle, i32, i32, i32)
16-
// CHECK2-SAME: "(i32 413, %dx.types.LinAlgMatrixC4M5N4U1S2 {{.*}}, %dx.types.Handle {{.*}}, i32 1, i32 1, i32 0)
15+
// CHECK2: call void @"dx.hl.op..void (i32, %dx.types.LinAlgMatrixC4M5N4U1S2, %dx.types.Handle, i32, i32, i32, i32)
16+
// CHECK2-SAME: "(i32 413, %dx.types.LinAlgMatrixC4M5N4U1S2 {{.*}}, %dx.types.Handle {{.*}}, i32 1, i32 1, i32 0, i32 4)
1717
__builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(4, 5, 4, 1, 2)]] mat1;
18-
__builtin_LinAlg_MatrixStoreToDescriptor(mat1, outbuf, 1, 1, 0);
18+
__builtin_LinAlg_MatrixStoreToDescriptor(mat1, outbuf, 1, 1, 0, 4);
1919
}

0 commit comments

Comments
 (0)