-
Notifications
You must be signed in to change notification settings - Fork 808
Open
Labels
bugBug, regression, crashBug, regression, crash
Milestone
Description
Description
DXC fails compilation when derivative operations are used in coalescing nodes.
According to the Work Graph specification, these are supported.
See Quad and derivative operation semantics.
Steps to Reproduce
The following is a trivial example demonstrating the error.
See Compiler Explorer.
Texture2D<float4> Src0 : register(t0);
Texture2D<float4> Src1 : register(t1);
SamplerState Samp : register(s0);
RWTexture2D<float4> Dst : register(u0);
struct NodeRecord
{
uint w, h;
};
[Shader("node")]
[NodeLaunch("coalescing")]
[NodeIsProgramEntry]
[NumThreads(8, 4, 1)]
[NodeID("EntryNode")]
void MyCoNode(
[MaxRecords(4)] GroupNodeInputRecords<NodeRecord> inputRecords,
uint3 GTid : SV_GroupThreadID )
{
for (uint i = 0; i < inputRecords.Count(); ++i)
{
float2 uv = (GTid.xy + 0.5) / float2(inputRecords[i].w, inputRecords[i].h);
float2 gdx = ddx(uv);
float2 gdy = ddy(uv);
float4 c0 = Src0.SampleGrad(Samp, uv, gdx, gdy); // explicit grad
float4 c1 = Src1.Sample(Samp, uv); // implicit grad
Dst[GTid.xy] = c0 * c1;
}
} Actual Behavior
Error messages output from DXC1.8.2306-preview.
warning: DXIL signing library (dxil.dll,libdxil.so) not found. Resulting DXIL will not be signed for use in release environments.
error: validation errors
<source>:23:22: error: Opcode DerivCoarseX not valid in shader model lib_6_8(node).
note: at '%30 = call float @dx.op.unary.f32(i32 83, float %28)' in block '#4' of function 'MyCoNode'.
<source>:24:22: error: Opcode DerivCoarseY not valid in shader model lib_6_8(node).
note: at '%32 = call float @dx.op.unary.f32(i32 84, float %28)' in block '#4' of function 'MyCoNode'.
<source>:26:21: error: Opcode Sample not valid in shader model lib_6_8(node).
note: at '%44 = call %dx.types.ResRet.f32 @dx.op.sample.f32(i32 60, %dx.types.Handle %43, %dx.types.Handle %36, float %27, float %28, float undef, float undef, i32 0, i32 0, i32 undef, float undef)' in block '#4' of function 'MyCoNode'.
Validation failed.
Compiler returned: 5
The following is one suggested change to address this issue:
- // Only broadcasting launch supports derivatives.
- if (Props.Node.LaunchType != DXIL::NodeLaunchType::Broadcasting)
- MaskForDeriv |= static_cast<uint32_t>(ConflictFlags::DerivLaunch);
- // Thread launch node has no group.
+ // Thread launch node has no group and does not support derivatives
- if (Props.Node.LaunchType == DXIL::NodeLaunchType::Thread)
+ if (Props.Node.LaunchType == DXIL::NodeLaunchType::Thread) {
+ MaskForDeriv |= static_cast<uint32_t>(ConflictFlags::DerivLaunch);
MaskForGroup |= static_cast<uint32_t>(ConflictFlags::RequiresGroup);
+ }Environment
- DXC version 1.8.2505
- Host Operating System Windows 11 Build 26100
Metadata
Metadata
Assignees
Labels
bugBug, regression, crashBug, regression, crash
Type
Projects
Status
Triaged