Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1a72ba8bf77d563fdea605f49b1e233c04859976
https://github.com/WebKit/WebKit/commit/1a72ba8bf77d563fdea605f49b1e233c04859976
Author: Jure Triglav <[email protected]>
Date: 2026-09-26 (Sat, 26 Sep 2026)
Changed paths:
M Source/WebGPU/WGSL/CompilationScope.cpp
M Source/WebGPU/WGSL/CompilationScope.h
M Source/WebGPU/WGSL/WGSLShaderModule.h
M Tools/TestWebKitAPI/Tests/WGSL/MetalGenerationTests.cpp
Log Message:
-----------
Pipelines from an already-used GPUShaderModule always miss the Metal shader
cache: MSL gains another __wgslMin clamp on every build
https://bugs.webkit.org/show_bug.cgi?id=325378
Reviewed by Mike Wyrzykowski.
306636@main moved the bounds clamp for fixed-size and override-sized arrays
into an override validation, which calls replace() from generate(). Nothing
removed the override validations registered by prepare(), and CompilationScope
only rolled back replacements and the AST builder. So every prepare() on a
module appended another validation for each array access, and every later
generate() ran all of them.
As a result, each pipeline created from an already-used GPUShaderModule
wrapped every such index in one more __wgslMin(). Its MSL differed from every
previous compilation and always missed the Metal shader cache. A fresh module
with the same source reproduced the first compilation's MSL and hit the cache.
The validation list and the nesting also grew for as long as the module was
reused.
Roll back override validations in CompilationScope, the same way as
replacements. The validations a prepare() registers stay alive through that
compilation's generate(), because the prepare scope is owned by the
PrepareResult. Validations registered during staticCheck() are not affected.
Test: Tools/TestWebKitAPI/Tests/WGSL/MetalGenerationTests.cpp
* Source/WebGPU/WGSL/CompilationScope.cpp:
(WGSL::CompilationScope::CompilationScope):
(WGSL::CompilationScope::~CompilationScope):
* Source/WebGPU/WGSL/CompilationScope.h:
* Source/WebGPU/WGSL/WGSLShaderModule.h:
(WGSL::ShaderModule::currentOverrideValidationsSize const):
(WGSL::ShaderModule::revertOverrideValidations):
* Tools/TestWebKitAPI/Tests/WGSL/MetalGenerationTests.cpp:
(TestWGSLAPI::TEST(WGSLMetalGenerationTests,
RepeatedGenerationIsDeterministic)):
Canonical link: https://commits.webkit.org/321998@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications