NEW 266882
Web Inspector: No errors reported in console when unimplemented WGSL radians() function is used in compute shader
https://bugs.webkit.org/show_bug.cgi?id=266882
Summary Web Inspector: No errors reported in console when unimplemented WGSL radians(...
Umar
Reported 2023-12-25 11:52:00 PST
Created attachment 469200 [details] Screenshot showing Safari TP running with the unpatched version of my code I was testing out my project (https://github.com/umar-ahmed/webgpu-pathtracer/) on Safari Technical Preview 185 with the WebGPU feature flag enabled. However, when I loaded it up, I was met with a black screen and no errors in the console. Using `git bisect`, I was able to narrow down the issue to the use of the radians() function in my WGSL compute shader, which doesn't seem to be supported on this build of Safari (but is supported in Chrome Version 121.0.6167.16 (Official Build) beta (arm64), which I was using to develop). This was the patch that I applied to resolve the issue: https://github.com/umar-ahmed/webgpu-pathtracer/commit/8fdfe37cbb3c38e856feba19275eb023a70b2ff7. I'm filing this bug as a Web Inspector bug instead of a WebGPU bug because I'm not sure if radians() is supposed to be implemented yet in Safari. If it is, then this bug can be recategorized. But my immediate concern was that I got no compiler/runtime warning when the shader was executed.
Attachments
Screenshot showing Safari TP running with the unpatched version of my code (325.96 KB, image/png)
2023-12-25 11:52 PST, Umar
no flags
WGSL source which generates the error (10.84 KB, text/plain)
2023-12-27 10:52 PST, Mike Wyrzykowski
no flags
Radar WebKit Bug Importer
Comment 1 2023-12-25 18:29:07 PST
Mike Wyrzykowski
Comment 2 2023-12-27 10:31:55 PST
My reading of the specification per https://gpuweb.github.io/gpuweb/#dom-gpudevice-createshadermodule is that getCompilationInfo should return any error messages, see https://gpuweb.github.io/gpuweb/#dom-gpushadermodule-getcompilationinfo as opposed to reporting warnings / errors in alternative means Does shaderModule.getCompilationInfo() return anything useful when you use radians here? My understanding is shader compilation errors should be reported via that mechanism
Mike Wyrzykowski
Comment 3 2023-12-27 10:33:59 PST
MSL compilation error: Error Domain=MTLLibraryErrorDomain Code=3 "program_source:181:26: error: use of undeclared identifier 'radians' float local46 = tan((radians(parameter18.field2) / 2.)); ^ program_source:578:55: error: use of undeclared identifier 'radians' float local88 = (global7.field6.field4 / tan((radians(global7.field6.field2) * 0.5))); ^ " UserInfo={NSLocalizedDescription=program_source:181:26: error: use of undeclared identifier 'radians' float local46 = tan((radians(parameter18.field2) / 2.)); ^ program_source:578:55: error: use of undeclared identifier 'radians' float local88 = (global7.field6.field4 / tan((radians(global7.field6.field2) * 0.5)));
Mike Wyrzykowski
Comment 4 2023-12-27 10:38:10 PST
shaderModule.getCompilationInfo won't return anything useful here because we think radians is a MSL function but it is not
Mike Wyrzykowski
Comment 5 2023-12-27 10:52:57 PST
Created attachment 469220 [details] WGSL source which generates the error Attaching source which generates the MSL error
Umar
Comment 6 2023-12-28 13:13:50 PST
(In reply to Mike Wyrzykowski from comment #2) > My reading of the specification per > https://gpuweb.github.io/gpuweb/#dom-gpudevice-createshadermodule is that > getCompilationInfo should return any error messages, see > https://gpuweb.github.io/gpuweb/#dom-gpushadermodule-getcompilationinfo as > opposed to reporting warnings / errors in alternative means > > > Does shaderModule.getCompilationInfo() return anything useful when you use > radians here? My understanding is shader compilation errors should be > reported via that mechanism I'm not seeing any messages when I look at the GPUCompilationInfo object resolved from that method. If I use some other undefined function like `someRandomFunction`, it will output GPUCompilationMessage with `message = "unresolved call target 'someRandomFunction'"` as expected, but not for `radians()`.
Mike Wyrzykowski
Comment 7 2023-12-28 13:22:43 PST
My apologies, I commented above but shaderModule.getCompilationInfo won't return anything useful here because we assumed radians is a MSL function but it is not. This will be corrected in the near future.
Tadeu Zagallo
Comment 8 2023-12-29 10:14:28 PST
I'm fixing this as part of https://bugs.webkit.org/show_bug.cgi?id=266931. The reason I created a new bug is that it should fix all the numeric built-in functions, not just radians.
Note You need to log in before you can comment on or make changes to this bug.