forked from microsoft/DirectXShaderCompiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to set the max id (microsoft#6654)
Vulkan implementation can have different limits on the maximum value used as an id in a SPIR-V binary. SPIRV-Tools generall assumes this limit is 0x3FFFFF because all implementations must support at least that value for an id. Since many implementations can support larger values, the tools allows an option that will set a different limit. This commit add an option to DXC to do the same. Fixes microsoft#6636
- Loading branch information
Showing
5 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// RUN: not %dxc -T cs_6_0 -E main %s -spirv -fspv-max-id 30 2>&1 | FileCheck %s --check-prefix=CHECK-30 | ||
// RUN: %dxc -T cs_6_0 -E main %s -spirv -fspv-max-id 400 2>&1 | FileCheck %s --check-prefix=CHECK-400 | ||
|
||
// With a lower limit, there will be an ID overflow in the optimizer. Note that | ||
// the error message can vary depending on where the optimizer fails. This test | ||
// is low enough to fail as early as possible leading to a consistent error | ||
// message. | ||
// CHECK-30: fatal error: failed to optimize SPIR-V: ID overflow. Try running compact-ids. | ||
|
||
// With a larger limit, the test case can compile successfully. | ||
// CHECK-400: Bound: 204 | ||
|
||
|
||
RWStructuredBuffer<int> data; | ||
|
||
[numthreads(1,1,1)] | ||
void main(uint3 id : SV_DispatchThreadID) | ||
{ | ||
[[unroll]] | ||
for( int i = 0; i < 64; i++ ) { | ||
data[i] = i; | ||
} | ||
} |