onnxruntime
4d308dac - [WebGPU] Supply fused activation parameters to Conv/MatMul as uniforms (#32116)

Commit
29 days ago
[WebGPU] Supply fused activation parameters to Conv/MatMul as uniforms (#32116) ### Description Moves fused-activation parameters (LeakyRelu alpha, Clip min/max, HardSigmoid alpha/beta) out of the generated WGSL and into uniforms, for the seven activation kinds that already exist (None, Relu, Sigmoid, Clip, HardSigmoid, LeakyRelu, Tanh). Shader text now depends only on the activation kind, so Activation::ToString() no longer emits parameter values and models that vary a parameter reuse the cached pipeline. Activation uniforms occupy fixed trailing slots in each program's uniform list, appended last so definitions and values stay index-aligned. Tests (9 new): ActivationCacheKeyTest.ParametersDoNotAffectTheKey - the cache-key invariant directly. WebGpuSmallMatMulConvSharesPipelineAcrossParameterValues - two different HardSigmoid alphas share one pipeline and still produce different results. WebGpuConv{Relu,LeakyRelu,HardSigmoid,Clip}FusionMatchesUnfusedResults - execution parity against the unfused graph, since this PR changes runtime behaviour for the parameterized kinds. WebGpuIm2ColConv{Relu,LeakyRelu,HardSigmoid}FusionMatchesUnfusedResults - the same for the im2col path. Golden fixture updates reflect this PR's own template edit. ### Motivation and Context Parameters were baked into the generated WGSL as literals, so every distinct parameter value produced different shader text and therefore a separate shader compile and a separate pipeline. A model with several LeakyRelu slopes paid a compile per slope. Stacked on #32048 --------- Authored-by: Ananya Anand <t-anaanand@microsoft.com>
Author
Parents
Loading