-
Notifications
You must be signed in to change notification settings - Fork 335
Closed
Labels
wgslWebGPU Shading Language IssuesWebGPU Shading Language Issues
Milestone
Description
Both DXC and FXC fail to compile when they detect infinite loops.
Given this simple wgsl shader:
[[stage(compute), workgroup_size(1)]]
fn main() {
loop {}
}
Using tint to compile and validate with DXC:
$ out/build/x64-Debug/tint.exe ./infinite_loop.wgsl --validate --format hlsl
[numthreads(1, 1, 1)]
void main() {
[loop] while (true) {
}
return;
}
error: validation errors
Function: main: error: Loop must have break. Use /Zi for source location.
Validation failed.
And compiling and validating with FXC:
$ out/build/x64-Debug/tint.exe ./infinite_loop.wgsl --validate --format hlsl --fxc
[numthreads(1, 1, 1)]
void main() {
[loop] while (true) {
}
return;
}
C:\src\tint\Shader@0x00000276FDD4F920(3,10-21): warning X3557: loop doesn't seem to do anything, consider removing [loop]
C:\src\tint\Shader@0x00000276FDD4F920(3,10-21): warning X3551: infinite loop detected - loop writes no values
C:\src\tint\Shader@0x00000276FDD4F920(3,17-20): error X3696: infinite loop detected - loop never exits
As part of behaviour analysis, we can detect infinite loops. I think we should forbid them, and emit a compile error when they are detected.
kvark
Metadata
Metadata
Assignees
Labels
wgslWebGPU Shading Language IssuesWebGPU Shading Language Issues