Skip to content

Commit 7f86d74

Browse files
authored
Merge 'release-1.8.2505' to 'staging-sm6.9' (#7461)
Merge 'release-1.8.2505' to 'staging-sm6.9'. No conflicts.
2 parents 21d37a4 + cd01d67 commit 7f86d74

File tree

85 files changed

+8051
-1198
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+8051
-1198
lines changed

docs/DXIL.rst

Lines changed: 293 additions & 290 deletions
Large diffs are not rendered by default.

docs/SPIR-V.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4227,7 +4227,7 @@ codegen for Vulkan:
42274227
- ``-fvk-use-dx-layout``: Uses DirectX layout rules for resources.
42284228
- ``-fvk-invert-y``: Negates (additively inverts) SV_Position.y before writing
42294229
to stage output. Used to accommodate the difference between Vulkan's
4230-
coordinate system and DirectX's. Only allowed in VS/DS/GS.
4230+
coordinate system and DirectX's. Only allowed in VS/DS/GS/MS/Lib.
42314231
- ``-fvk-use-dx-position-w``: Reciprocates (multiplicatively inverts)
42324232
SV_Position.w after reading from stage input. Used to accommodate the
42334233
difference between Vulkan DirectX: the w component of SV_Position in PS is

include/dxc/DXIL/DxilConstants.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,6 +1583,10 @@ const unsigned kMSStoreOutputColOpIdx = 3;
15831583
const unsigned kMSStoreOutputVIdxOpIdx = 4;
15841584
const unsigned kMSStoreOutputValOpIdx = 5;
15851585

1586+
// HitObject::MakeMiss
1587+
const unsigned kHitObjectMakeMiss_RayDescOpIdx = 3;
1588+
const unsigned kHitObjectMakeMiss_NumOp = 11;
1589+
15861590
// HitObject::TraceRay
15871591
const unsigned kHitObjectTraceRay_RayDescOpIdx = 7;
15881592
const unsigned kHitObjectTraceRay_PayloadOpIdx = 15;
@@ -1609,6 +1613,7 @@ const unsigned kMatVecMulAddIsOutputUnsignedIdx = 15;
16091613
// Outer Product Accumulate
16101614
const unsigned kOuterProdAccMatrixInterpretation = 5;
16111615
const unsigned kOuterProdAccMatrixLayout = 6;
1616+
const unsigned kOuterProdAccMatrixStride = 7;
16121617

16131618
// TODO: add operand index for all the OpCodeClass.
16141619
} // namespace OperandIndex

include/dxc/HLSL/HLOperations.h

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,12 @@ const unsigned kAnnotateHandleResourceTypeOpIdx = 3;
396396

397397
// TraceRay.
398398
const unsigned kTraceRayRayDescOpIdx = 7;
399-
const unsigned kTraceRayPayLoadOpIdx = 8;
399+
// kTraceRayPayloadPreOpIdx is before flattening the RayDesc
400+
const unsigned kTraceRayPayloadPreOpIdx = 8;
401+
// kTraceRayPayloadOpIdx is after flattening the RayDesc
402+
const unsigned kTraceRayPayloadOpIdx = 11;
403+
const unsigned kTraceRay_PreNumOp = 9;
404+
const unsigned kTraceRay_NumOp = 12;
400405

401406
// AllocateRayQuery
402407
const unsigned kAllocateRayQueryRayFlagsIdx = 1;
@@ -407,6 +412,10 @@ const unsigned kCallShaderPayloadOpIdx = 2;
407412

408413
// TraceRayInline.
409414
const unsigned kTraceRayInlineRayDescOpIdx = 5;
415+
// kTraceRayInlinePayloadPreOpIdx is before flattening the RayDesc
416+
const unsigned kTraceRayInlinePayloadPreOpIdx = 6;
417+
// kTraceRayInlinePayloadOpIdx is after flattening the RayDesc
418+
const unsigned kTraceRayInlinePayloadOpIdx = 9;
410419

411420
// ReportIntersection.
412421
const unsigned kReportIntersectionAttributeOpIdx = 3;
@@ -435,11 +444,19 @@ const unsigned kAnnotateNodeRecordHandleNodeRecordPropIdx = 2;
435444

436445
// HitObject::MakeMiss
437446
const unsigned kHitObjectMakeMiss_NumOp = 8;
438-
const unsigned kHitObjectMakeMissRayDescOpIdx = 4;
447+
const unsigned kHitObjectMakeMiss_RayDescOpIdx = 4;
439448

440449
// HitObject::TraceRay
441450
const unsigned kHitObjectTraceRay_RayDescOpIdx = 8;
442-
const unsigned kHitObjectTraceRay_NumOp = 10;
451+
// kHitObjectTraceRay_PayloadPreOpIdx is before flattening the RayDesc
452+
const unsigned kHitObjectTraceRay_PayloadPreOpIdx = 9;
453+
// kHitObjectTraceRay_PayloadOpIdx is after flattening the RayDesc
454+
const unsigned kHitObjectTraceRay_PayloadOpIdx = 12;
455+
const unsigned kHitObjectTraceRay_PreNumOp = 10;
456+
const unsigned kHitObjectTraceRay_NumOp = 13;
457+
458+
// HitObject::Invoke
459+
const unsigned kHitObjectInvoke_PayloadOpIdx = 2;
443460

444461
// HitObject::FromRayQuery
445462
const unsigned kHitObjectFromRayQuery_WithAttrs_AttributeOpIdx = 4;

include/dxc/Support/HLSLOptions.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def fvk_bind_register : MultiArg<["-"], "fvk-bind-register", 4>, MetaVarName<"<t
368368
HelpText<"Specify Vulkan descriptor set and binding for a specific register">;
369369
def vkbr : MultiArg<["-"], "vkbr", 4>, Flags<[CoreOption, DriverOption]>, Alias<fvk_bind_register>;
370370
def fvk_invert_y: Flag<["-"], "fvk-invert-y">, Group<spirv_Group>, Flags<[CoreOption, DriverOption]>,
371-
HelpText<"Negate SV_Position.y before writing to stage output in VS/DS/GS to accommodate Vulkan's coordinate system">;
371+
HelpText<"Negate SV_Position.y before writing to stage output in VS/DS/GS/MS/Lib to accommodate Vulkan's coordinate system">;
372372
def fvk_use_dx_position_w: Flag<["-"], "fvk-use-dx-position-w">, Group<spirv_Group>, Flags<[CoreOption, DriverOption]>,
373373
HelpText<"Reciprocate SV_Position.w after reading from stage input in PS to accommodate the difference between Vulkan and DirectX">;
374374
def fvk_support_nonzero_base_instance: Flag<["-"], "fvk-support-nonzero-base-instance">, Group<spirv_Group>, Flags<[CoreOption, DriverOption]>,

include/dxc/dxcapi.internal.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,15 @@ enum LEGAL_INTRINSIC_COMPTYPES {
133133
LICOMPTYPE_HIT_OBJECT = 51,
134134
LICOMPTYPE_RAY_QUERY = 52,
135135

136+
LICOMPTYPE_LINALG = 53, // f32, partial-precision-f32, f16,
137+
// i32, i16, u32, u16,
138+
// int8_4packed, uint8_4packed
139+
136140
#ifdef ENABLE_SPIRV_CODEGEN
137-
LICOMPTYPE_VK_BUFFER_POINTER = 53,
138-
LICOMPTYPE_COUNT = 54
141+
LICOMPTYPE_VK_BUFFER_POINTER = 54,
142+
LICOMPTYPE_COUNT = 55
139143
#else
140-
LICOMPTYPE_COUNT = 53
144+
LICOMPTYPE_COUNT = 54
141145
#endif
142146
};
143147

lib/DxilValidation/DxilValidation.cpp

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ ValidateSignatureAccess(Instruction *I, DxilSignature &Sig, Value *SigId,
165165

166166
static DxilResourceProperties GetResourceFromHandle(Value *Handle,
167167
ValidationContext &ValCtx) {
168-
if (!isa<CallInst>(Handle)) {
168+
CallInst *HandleCall = dyn_cast<CallInst>(Handle);
169+
if (!HandleCall) {
169170
if (Instruction *I = dyn_cast<Instruction>(Handle))
170171
ValCtx.EmitInstrError(I, ValidationRule::InstrHandleNotFromCreateHandle);
171172
else
@@ -175,10 +176,13 @@ static DxilResourceProperties GetResourceFromHandle(Value *Handle,
175176
}
176177

177178
DxilResourceProperties RP = ValCtx.GetResourceFromVal(Handle);
178-
if (RP.getResourceClass() == DXIL::ResourceClass::Invalid) {
179+
if (RP.getResourceClass() == DXIL::ResourceClass::Invalid)
179180
ValCtx.EmitInstrError(cast<CallInst>(Handle),
180181
ValidationRule::InstrHandleNotFromCreateHandle);
181-
}
182+
if (RP.Basic.IsReorderCoherent &&
183+
!ValCtx.DxilMod.GetShaderModel()->IsSM69Plus())
184+
ValCtx.EmitInstrError(HandleCall,
185+
ValidationRule::InstrReorderCoherentRequiresSM69);
182186

183187
return RP;
184188
}
@@ -1229,6 +1233,32 @@ static void ValidateImmOperandsForOuterProdAcc(CallInst *CI,
12291233
{"MatrixLayout"});
12301234
return;
12311235
}
1236+
ConstantInt *ML = cast<ConstantInt>(MatrixLayout);
1237+
uint64_t MLValue = ML->getLimitedValue();
1238+
if (MLValue !=
1239+
static_cast<unsigned>(DXIL::LinalgMatrixLayout::OuterProductOptimal))
1240+
ValCtx.EmitInstrFormatError(
1241+
CI,
1242+
ValidationRule::
1243+
InstrLinalgInvalidMatrixLayoutValueForOuterProductAccumulate,
1244+
{GetMatrixLayoutStr(MLValue),
1245+
GetMatrixLayoutStr(static_cast<unsigned>(
1246+
DXIL::LinalgMatrixLayout::OuterProductOptimal))});
1247+
1248+
llvm::Value *MatrixStride =
1249+
CI->getOperand(DXIL::OperandIndex::kOuterProdAccMatrixStride);
1250+
if (!llvm::isa<llvm::Constant>(MatrixStride)) {
1251+
ValCtx.EmitInstrError(
1252+
CI, ValidationRule::InstrLinalgMatrixStrideZeroForOptimalLayouts);
1253+
return;
1254+
}
1255+
ConstantInt *MS = cast<ConstantInt>(MatrixStride);
1256+
uint64_t MSValue = MS->getLimitedValue();
1257+
if (MSValue != 0) {
1258+
ValCtx.EmitInstrError(
1259+
CI, ValidationRule::InstrLinalgMatrixStrideZeroForOptimalLayouts);
1260+
return;
1261+
}
12321262
}
12331263

12341264
// Validate the type-defined mask compared to the store value mask which
@@ -4182,6 +4212,9 @@ static void ValidateResourceOverlap(
41824212

41834213
static void ValidateResource(hlsl::DxilResource &Res,
41844214
ValidationContext &ValCtx) {
4215+
if (Res.IsReorderCoherent() && !ValCtx.DxilMod.GetShaderModel()->IsSM69Plus())
4216+
ValCtx.EmitResourceError(&Res,
4217+
ValidationRule::InstrReorderCoherentRequiresSM69);
41854218
switch (Res.GetKind()) {
41864219
case DXIL::ResourceKind::RawBuffer:
41874220
case DXIL::ResourceKind::TypedBuffer:
@@ -4413,10 +4446,13 @@ static void ValidateResources(ValidationContext &ValCtx) {
44134446
ValCtx.EmitResourceError(Uav.get(),
44144447
ValidationRule::SmCounterOnlyOnStructBuf);
44154448
}
4416-
if (Uav->HasCounter() && Uav->IsGloballyCoherent())
4417-
ValCtx.EmitResourceFormatError(Uav.get(),
4418-
ValidationRule::MetaGlcNotOnAppendConsume,
4419-
{ValCtx.GetResourceName(Uav.get())});
4449+
const bool UavIsCoherent =
4450+
Uav->IsGloballyCoherent() || Uav->IsReorderCoherent();
4451+
if (Uav->HasCounter() && UavIsCoherent) {
4452+
StringRef Prefix = Uav->IsGloballyCoherent() ? "globally" : "reorder";
4453+
ValCtx.EmitResourceFormatError(
4454+
Uav.get(), ValidationRule::MetaCoherenceNotOnAppendConsume, {Prefix});
4455+
}
44204456

44214457
ValidateResource(*Uav, ValCtx);
44224458
ValidateResourceOverlap(*Uav, UavAllocator, ValCtx);

0 commit comments

Comments
 (0)