Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions docs/DXIL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2129,12 +2129,13 @@ FLOW.CALLLIMIT Subroutines can nest up to 32 levels d
FLOW.DEADLOOP Loop must have break
FLOW.NORECUSION Recursion is not permitted
FLOW.REDUCIBLE Execution flow must be reducible
INSTR.ALLOWED TODO - Instructions must be of an allowed type
INSTR.ALLOWED Instructions must be of an allowed type
INSTR.BARRIERMODEFORNONCS sync in a non-Compute Shader must only sync UAV (sync_uglobal)
INSTR.BARRIERMODENOMEMORY sync must include some form of memory barrier - _u (UAV) and/or _g (Thread Group Shared Memory). Only _t (thread group sync) is optional.
INSTR.BARRIERMODEUSELESSUGROUP sync can't specify both _ugroup and _uglobal. If both are needed, just specify _uglobal.
INSTR.BUFFERUPDATECOUNTERONUAV BufferUpdateCounter valid only on UAV
INSTR.CALLOLOAD Call to DXIL intrinsic must match overload signature
INSTR.CANNOTPULLPOSITION pull-model evaluation of position disallowed
INSTR.CBUFFERCLASSFORCBUFFERHANDLE Expect Cbuffer for CBufferLoad handle
INSTR.CBUFFEROUTOFBOUND Cbuffer access out of bound
INSTR.COORDINATECOUNTFORRAWTYPEDBUF raw/typed buffer don't need 2 coordinates
Expand All @@ -2144,7 +2145,6 @@ INSTR.DXILSTRUCTUSER Dxil struct types should only used by
INSTR.DXILSTRUCTUSEROUTOFBOUND Index out of bound when extract value from dxil struct types
INSTR.ERR_ALIAS_ARRAY_INDEX_OUT_OF_BOUNDS TODO - ERR_ALIAS_ARRAY_INDEX_OUT_OF_BOUNDS
INSTR.ERR_ATTRIBUTE_PARAM_SIDE_EFFECT TODO - expressions with side effects are illegal as attribute parameters for root signature
INSTR.ERR_CANT_PULL_POSITION TODO - %0 does not support pull-model evaluation of position
INSTR.ERR_GUARANTEED_RACE_CONDITION_GSM TODO - race condition writing to shared memory detected, consider making this write conditional.
INSTR.ERR_GUARANTEED_RACE_CONDITION_UAV TODO - race condition writing to shared resource detected, consider making this write conditional.
INSTR.ERR_LOOP_CONDITION_OUT_OF_BOUNDS TODO - cannot unroll loop with an out-of-bounds array reference in the condition
Expand Down Expand Up @@ -2172,10 +2172,9 @@ INSTR.NOUDIVBYZERO TODO - No unsigned integer division by
INSTR.OFFSETONUAVLOAD uav load don't support offset
INSTR.OLOAD DXIL intrinsic overload must be valid
INSTR.ONLYONEALLOCCONSUME RWStructuredBuffers may increment or decrement their counters, but not both.
INSTR.OPCODE TODO - DXIL intrinsic must have a valid constant opcode
INSTR.OPCODERESERVED TODO - Instructions must not reference reserved opcodes
INSTR.OPCODERESERVED Instructions must not reference reserved opcodes
INSTR.OPCODERESTYPE TODO - DXIL intrinsic operating on a resource must be of the correct type
INSTR.OPCONST TODO - DXIL intrinsic requires an immediate constant operand
INSTR.OPCONST DXIL intrinsic requires an immediate constant operand
INSTR.OPCONSTRANGE TODO - Constant values must be in-range for operation
INSTR.OPERANDRANGE TODO - DXIL intrinsic operand must be within defined range
INSTR.PTRAREA TODO - Pointer must refer to a defined area
Expand Down Expand Up @@ -2220,17 +2219,16 @@ META.INTERPMODEVALID Interpolation mode must be valid
META.INVALIDCONTROLFLOWHINT Invalid control flow hint
META.KNOWN Named metadata should be known
META.MAXTESSFACTOR Hull Shader MaxTessFactor must be [%0..%1]. %2 specified
META.NOREGISTEROVERLAP TODO - User-defined variable locations cannot overlap
META.NOSEMANTICOVERLAP Semantics must not overlap
META.REQUIRED TODO - Required metadata missing
META.SEMAKINDVALID Semantic kind must be valid
META.SEMANTICCOMPTYPE %0 must be %1
META.SEMANTICLEN TODO - Semantic length must be at least 1 and at most 64
META.SEMANTICLEN Semantic length must be at least 1 and at most 64
META.SIGNATURECOMPTYPE signature %0 specifies unrecognized or invalid component type
META.SIGNATUREOUTOFRANGE signature %0 is out of range at row %1 col %2 size %3.
META.SIGNATUREOVERLAP signature %0 use overlaped address at row %1 col %2 size %3.
META.STRUCTBUFALIGNMENT TODO - structured buffer element size must be a multiple of %u bytes in %s (actual size %u bytes)
META.STRUCTBUFALIGNMENTOUTOFBOUND TODO - structured buffer elements cannot be larger than %u bytes in %s (actual size %u bytes)
META.STRUCTBUFALIGNMENT StructuredBuffer stride not aligned
META.STRUCTBUFALIGNMENTOUTOFBOUND StructuredBuffer stride out of bounds
META.TARGET Target triple must be 'dxil-ms-dx'
META.TESSELLATOROUTPUTPRIMITIVE Invalid Tessellator Output Primitive specified. Must be point, line, triangleCW or triangleCCW.
META.TESSELLATORPARTITION Invalid Tessellator Partitioning specified. Must be integer, pow2, fractional_odd or fractional_even.
Expand All @@ -2249,7 +2247,6 @@ SM.DOMAINLOCATIONIDXOOB DomainLocation component index out of
SM.DSINPUTCONTROLPOINTCOUNTRANGE DS input control point count must be [0..%0]. %1 specified
SM.ERR_BIND_RESOURCE_RANGE_OVERFLOW TODO - ERR_BIND_RESOURCE_RANGE_OVERFLOW
SM.ERR_DUPLICATE_CBUFFER_BANK TODO - ERR_DUPLICATE_CBUFFER_BANK
SM.ERR_GEN_SEMANTIC_TOO_LONG TODO - Semantic length is limited to 64 characters
SM.ERR_MAX_CBUFFER_EXCEEDED TODO - The maximum number of constant buffer slots is exceeded for a library (slot index=%u, max slots=%u)
SM.ERR_MAX_CONST_EXCEEDED TODO - ERR_MAX_CONST_EXCEEDED
SM.ERR_MAX_SAMPLER_EXCEEDED TODO - The maximum number of sampler slots is exceeded for a library (slot index=%u, max slots=%u)
Expand Down Expand Up @@ -2294,7 +2291,6 @@ SM.ROVONLYINPS RasterizerOrdered objects are only all
SM.SAMPLECOUNTONLYON2DMS Only Texture2DMS/2DMSArray could has sample count
SM.SEMANTIC Semantic must be defined in target shader model
SM.STREAMINDEXRANGE Stream index (%0) must between 0 and %1
SM.STRUCTBUFMUSTBE4BYTESALIGN Structured buffer stride should 4 byte align
SM.TESSFACTORFORDOMAIN Required TessFactor for domain not found declared anywhere in Patch Constant data
SM.TESSFACTORSIZEMATCHDOMAIN TessFactor size mismatch the domain.
SM.THREADGROUPCHANNELRANGE Declared Thread Group %0 size %1 outside valid range [%2..%3]
Expand Down
34 changes: 1 addition & 33 deletions include/dxc/HLSL/DxilConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ namespace DXIL {
const unsigned kMaxD3D11SamplerCount = 16;
const unsigned kMaxD3D11CBufferCount = 14;
const unsigned kMaxCBufferSize = 4096;
const unsigned kMaxStructBufferStride = 2048;
const unsigned kMaxD3D10UAVCount = 8;
const unsigned kMaxD3D10CS4UAVCount = 1;
const unsigned kMaxD3D11UAVCount = 64;
Expand Down Expand Up @@ -90,39 +91,6 @@ namespace DXIL {
const float kMaxMipLodBias = 15.99f;
const float kMinMipLodBias = -16.0f;

const unsigned kCS_4_X_BUCKET00_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 256;
const unsigned kCS_4_X_BUCKET00_MAX_NUM_THREADS_PER_GROUP = 64;
const unsigned kCS_4_X_BUCKET01_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 240;
const unsigned kCS_4_X_BUCKET01_MAX_NUM_THREADS_PER_GROUP = 68;
const unsigned kCS_4_X_BUCKET02_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 224;
const unsigned kCS_4_X_BUCKET02_MAX_NUM_THREADS_PER_GROUP = 72;
const unsigned kCS_4_X_BUCKET03_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 208;
const unsigned kCS_4_X_BUCKET03_MAX_NUM_THREADS_PER_GROUP = 76;
const unsigned kCS_4_X_BUCKET04_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 192;
const unsigned kCS_4_X_BUCKET04_MAX_NUM_THREADS_PER_GROUP = 84;
const unsigned kCS_4_X_BUCKET05_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 176;
const unsigned kCS_4_X_BUCKET05_MAX_NUM_THREADS_PER_GROUP = 92;
const unsigned kCS_4_X_BUCKET06_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 160;
const unsigned kCS_4_X_BUCKET06_MAX_NUM_THREADS_PER_GROUP = 100;
const unsigned kCS_4_X_BUCKET07_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 144;
const unsigned kCS_4_X_BUCKET07_MAX_NUM_THREADS_PER_GROUP = 112;
const unsigned kCS_4_X_BUCKET08_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 128;
const unsigned kCS_4_X_BUCKET08_MAX_NUM_THREADS_PER_GROUP = 128;
const unsigned kCS_4_X_BUCKET09_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 112;
const unsigned kCS_4_X_BUCKET09_MAX_NUM_THREADS_PER_GROUP = 144;
const unsigned kCS_4_X_BUCKET10_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 96;
const unsigned kCS_4_X_BUCKET10_MAX_NUM_THREADS_PER_GROUP = 168;
const unsigned kCS_4_X_BUCKET11_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 80;
const unsigned kCS_4_X_BUCKET11_MAX_NUM_THREADS_PER_GROUP = 204;
const unsigned kCS_4_X_BUCKET12_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 64;
const unsigned kCS_4_X_BUCKET12_MAX_NUM_THREADS_PER_GROUP = 256;
const unsigned kCS_4_X_BUCKET13_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 48;
const unsigned kCS_4_X_BUCKET13_MAX_NUM_THREADS_PER_GROUP = 340;
const unsigned kCS_4_X_BUCKET14_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 32;
const unsigned kCS_4_X_BUCKET14_MAX_NUM_THREADS_PER_GROUP = 512;
const unsigned kCS_4_X_BUCKET15_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = 16;
const unsigned kCS_4_X_BUCKET15_MAX_NUM_THREADS_PER_GROUP = 768;

enum class ComponentType : uint8_t {
Invalid = 0,
I1, I16, U16, I32, U32, I64, U64,
Expand Down
18 changes: 7 additions & 11 deletions include/dxc/HLSL/DxilValidation.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,22 @@ enum class ValidationRule : unsigned {
DeclUsedInternal, // Internal declaration must be used

// Instruction
InstrAllowed, // TODO - Instructions must be of an allowed type
InstrAllowed, // Instructions must be of an allowed type
InstrBarrierModeForNonCS, // sync in a non-Compute Shader must only sync UAV (sync_uglobal)
InstrBarrierModeNoMemory, // sync must include some form of memory barrier - _u (UAV) and/or _g (Thread Group Shared Memory). Only _t (thread group sync) is optional.
InstrBarrierModeUselessUGroup, // sync can't specify both _ugroup and _uglobal. If both are needed, just specify _uglobal.
InstrBufferUpdateCounterOnUAV, // BufferUpdateCounter valid only on UAV
InstrCBufferClassForCBufferHandle, // Expect Cbuffer for CBufferLoad handle
InstrCBufferOutOfBound, // Cbuffer access out of bound
InstrCallOload, // Call to DXIL intrinsic must match overload signature
InstrCannotPullPosition, // pull-model evaluation of position disallowed
InstrCoordinateCountForRawTypedBuf, // raw/typed buffer don't need 2 coordinates
InstrCoordinateCountForStructBuf, // structured buffer require 2 coordinates
InstrDeterminateDerivative, // gradient operation uses a value that may not be defined for all pixels (in UAV loads can not participate in gradient operations)
InstrDxilStructUser, // Dxil struct types should only used by ExtractValue
InstrDxilStructUserOutOfBound, // Index out of bound when extract value from dxil struct types
InstrERR_ALIAS_ARRAY_INDEX_OUT_OF_BOUNDS, // TODO - ERR_ALIAS_ARRAY_INDEX_OUT_OF_BOUNDS
InstrERR_ATTRIBUTE_PARAM_SIDE_EFFECT, // TODO - expressions with side effects are illegal as attribute parameters for root signature
InstrERR_CANT_PULL_POSITION, // TODO - %0 does not support pull-model evaluation of position
InstrERR_GUARANTEED_RACE_CONDITION_GSM, // TODO - race condition writing to shared memory detected, consider making this write conditional.
InstrERR_GUARANTEED_RACE_CONDITION_UAV, // TODO - race condition writing to shared resource detected, consider making this write conditional.
InstrERR_LOOP_CONDITION_OUT_OF_BOUNDS, // TODO - cannot unroll loop with an out-of-bounds array reference in the condition
Expand Down Expand Up @@ -79,10 +79,9 @@ enum class ValidationRule : unsigned {
InstrOffsetOnUAVLoad, // uav load don't support offset
InstrOload, // DXIL intrinsic overload must be valid
InstrOnlyOneAllocConsume, // RWStructuredBuffers may increment or decrement their counters, but not both.
InstrOpCode, // TODO - DXIL intrinsic must have a valid constant opcode
InstrOpCodeResType, // TODO - DXIL intrinsic operating on a resource must be of the correct type
InstrOpCodeReserved, // TODO - Instructions must not reference reserved opcodes
InstrOpConst, // TODO - DXIL intrinsic requires an immediate constant operand
InstrOpCodeReserved, // Instructions must not reference reserved opcodes
InstrOpConst, // DXIL intrinsic requires an immediate constant operand
InstrOpConstRange, // TODO - Constant values must be in-range for operation
InstrOperandRange, // TODO - DXIL intrinsic operand must be within defined range
InstrPtrArea, // TODO - Pointer must refer to a defined area
Expand Down Expand Up @@ -129,17 +128,16 @@ enum class ValidationRule : unsigned {
MetaInvalidControlFlowHint, // Invalid control flow hint
MetaKnown, // Named metadata should be known
MetaMaxTessFactor, // Hull Shader MaxTessFactor must be [%0..%1]. %2 specified
MetaNoRegisterOverlap, // TODO - User-defined variable locations cannot overlap
MetaNoSemanticOverlap, // Semantics must not overlap
MetaRequired, // TODO - Required metadata missing
MetaSemaKindValid, // Semantic kind must be valid
MetaSemanticCompType, // %0 must be %1
MetaSemanticLen, // TODO - Semantic length must be at least 1 and at most 64
MetaSemanticLen, // Semantic length must be at least 1 and at most 64
MetaSignatureCompType, // signature %0 specifies unrecognized or invalid component type
MetaSignatureOutOfRange, // signature %0 is out of range at row %1 col %2 size %3.
MetaSignatureOverlap, // signature %0 use overlaped address at row %1 col %2 size %3.
MetaStructBufAlignment, // TODO - structured buffer element size must be a multiple of %u bytes in %s (actual size %u bytes)
MetaStructBufAlignmentOutOfBound, // TODO - structured buffer elements cannot be larger than %u bytes in %s (actual size %u bytes)
MetaStructBufAlignment, // StructuredBuffer stride not aligned
MetaStructBufAlignmentOutOfBound, // StructuredBuffer stride out of bounds
MetaTarget, // Target triple must be 'dxil-ms-dx'
MetaTessellatorOutputPrimitive, // Invalid Tessellator Output Primitive specified. Must be point, line, triangleCW or triangleCCW.
MetaTessellatorPartition, // Invalid Tessellator Partitioning specified. Must be integer, pow2, fractional_odd or fractional_even.
Expand Down Expand Up @@ -167,7 +165,6 @@ enum class ValidationRule : unsigned {
SmDomainLocationIdxOOB, // DomainLocation component index out of bounds for the domain.
SmERR_BIND_RESOURCE_RANGE_OVERFLOW, // TODO - ERR_BIND_RESOURCE_RANGE_OVERFLOW
SmERR_DUPLICATE_CBUFFER_BANK, // TODO - ERR_DUPLICATE_CBUFFER_BANK
SmERR_GEN_SEMANTIC_TOO_LONG, // TODO - Semantic length is limited to 64 characters
SmERR_MAX_CBUFFER_EXCEEDED, // TODO - The maximum number of constant buffer slots is exceeded for a library (slot index=%u, max slots=%u)
SmERR_MAX_CONST_EXCEEDED, // TODO - ERR_MAX_CONST_EXCEEDED
SmERR_MAX_SAMPLER_EXCEEDED, // TODO - The maximum number of sampler slots is exceeded for a library (slot index=%u, max slots=%u)
Expand Down Expand Up @@ -212,7 +209,6 @@ enum class ValidationRule : unsigned {
SmSampleCountOnlyOn2DMS, // Only Texture2DMS/2DMSArray could has sample count
SmSemantic, // Semantic must be defined in target shader model
SmStreamIndexRange, // Stream index (%0) must between 0 and %1
SmStructBufMustBe4BytesAlign, // Structured buffer stride should 4 byte align
SmTessFactorForDomain, // Required TessFactor for domain not found declared anywhere in Patch Constant data
SmTessFactorSizeMatchDomain, // TessFactor size mismatch the domain.
SmThreadGroupChannelRange, // Declared Thread Group %0 size %1 outside valid range [%2..%3]
Expand Down
5 changes: 1 addition & 4 deletions lib/HLSL/DxilGenerationPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,10 +541,7 @@ void DxilGenerationPass::ProcessArgument(Function *func,
// If this was an inout param, do the output side first
if (isInout) {
DXASSERT(!isPatchConstantFunction,
"Patch Constant function should not have inout param"); // TODO:
// validate
// in front
// end
"Patch Constant function should not have inout param");
m_inoutArgSet.insert(&arg);
ProcessArgument(func, funcAnnotation, arg, isPatchConstantFunction,
/*forceOut*/ true, hasClipPlane);
Expand Down
Loading