Skip to content

Commit

Permalink
[dawn][d3d] Use returned workgroup info for IR path
Browse files Browse the repository at this point in the history
Update Dawn's D3D backends to use the workgroup information returned
by the Tint HLSL backend, instead of getting it from the inspector.

This is in preparation for moving more transforms into the IR backend.

Bug: 380043961
Change-Id: Iceef5f90e5e2a4393a5ec84d37f3a21ed388f1f0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/219474
Reviewed-by: Antonio Maiorano <[email protected]>
Commit-Queue: James Price <[email protected]>
  • Loading branch information
jrprice authored and Dawn LUCI CQ committed Dec 13, 2024
1 parent 49631b5 commit 6c6c6dc
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/dawn/native/d3d/ShaderUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,6 @@ MaybeError TranslateToHLSL(d3d::HlslCompilationRequest r,
&transformOutputs, nullptr));
}

// Validate workgroup size after program runs transforms.
if (r.stage == SingleShaderStage::Compute) {
Extent3D _;
DAWN_TRY_ASSIGN(_, ValidateComputeStageWorkgroupSize(transformedProgram,
kRemappedEntryPointName, r.limits));
}

bool usesVertexIndex = false;
bool usesInstanceIndex = false;
if (r.stage == SingleShaderStage::Vertex) {
Expand All @@ -277,7 +270,25 @@ MaybeError TranslateToHLSL(d3d::HlslCompilationRequest r,
ir.Failure().reason.Str());

result = tint::hlsl::writer::Generate(ir.Get(), r.tintOptions);

// Workgroup validation has to come after `Generate` because it may require overrides to
// have been substituted.
if (r.stage == SingleShaderStage::Compute) {
// Validate workgroup size and workgroup storage size.
Extent3D _;
DAWN_TRY_ASSIGN(
_, ValidateComputeStageWorkgroupSize(
result->workgroup_info.x, result->workgroup_info.y, result->workgroup_info.z,
result->workgroup_info.storage_size, r.limits));
}
} else {
// Validate workgroup size after program runs transforms.
if (r.stage == SingleShaderStage::Compute) {
Extent3D _;
DAWN_TRY_ASSIGN(_, ValidateComputeStageWorkgroupSize(
transformedProgram, kRemappedEntryPointName, r.limits));
}

result = tint::hlsl::writer::Generate(transformedProgram, r.tintOptions);
}

Expand Down

0 comments on commit 6c6c6dc

Please sign in to comment.