[WebGPU] Regenerate WGSL in-tree golden fixtures to match current templates - #32115
Conversation
The in-tree golden test compares the entire generated tree against committed fixtures, so it fails on main today: subgroup_matrix_gemm_8x16x16, subgroup_matrix_matmul_8x16x16 and subgroup_matrix_matmul_pad_b were added or rewritten without regenerating the goldens. The generator emits one globally numbered string table, so new literals shift every downstream __str_N index. That accounts for the churn in im2col_matmul.h, oihw_to_ohwi.h and pad.h, which are unchanged once the indices are normalized. Before: Ran 87 tests, FAILED (failures=2) After: Ran 87 tests, OK Generated with: UPDATE_WGSL_GOLDEN=1 python tools/python/wgsl_template/test/run_tests.py Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Edward Chen (@edgchen1), could you help add the Python WGSL template tests as a required CI check for changes to WebGPU Some background: the in-tree golden test was introduced on June 16, 2026, in PR #28355 ("Add python implementation for wgsl-gen"). It generates C++ from the real WebGPU templates using both Subsequent PRs #29592, #29749, #29813, and #29893 added or rewrote subgroup-matrix templates without regenerating those snapshots. As a result, Existing WebGPU build and kernel tests did not catch the stale snapshots because The check is lightweight--87 tests complete in under a second locally: python tools\python\wgsl_template\test\run_tests.pyIdeally, it should run when files under |
The previous regeneration updated the per-template generated headers but
not the aggregate index.h, so generated/nn/im2col_matmul.h referenced
params.param_activation_kind against a struct that did not declare it.
Regenerated with the canonical command documented in test_in_tree_smoke.py:
UPDATE_WGSL_GOLDEN=1 python wgsl_template/test/run_tests.py
Only index.h changed in each variant. index_impl.h, string_table.h and
every file under generated/ were already byte-identical to the generator
output, so the earlier regeneration was correct apart from this one file.
Of the 60 added lines per variant, one is the missing
param_activation_kind member; the other 59 are declarations for the three
math/subgroup_matrix_* templates, which have been on main since 56598d6
without their goldens ever being regenerated. Their generated/math/*.h
bodies are deliberately left out here: they are supplied by microsoft#32115, which
fixes that pre-existing drift on its own. The in-tree golden smoke test
therefore still reports a file-set difference for those three headers
until microsoft#32115 lands, but no longer reports any content mismatch.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…factor
The uniforms refactor and the im2col fusion change were landing together, but
they are different kinds of change. Moving activation parameters into uniforms
preserves existing behaviour for kernels that already ran. Enabling fusion on
the im2col path removes a `// TODO: Support fuse` guard and makes a different
kernel run for real fused NHWC convolutions.
That second change cannot be exercised anywhere available. Im2ColMatMulProgram
requires an adapter reporting vendor "intel" and architecture "xe-2lpg",
"xe-2hpg", "xe-3lpg" or "xe-3lpg-xs" -- Lunar Lake, Battlemage or Panther Lake.
No ORT CI agent has one, and no machine available during development does
either, so its three parity tests GTEST_SKIP everywhere. It deserves its own
review rather than riding along with a behaviour-preserving refactor.
Reverted to their state on main:
nn/im2col_matmul.cc
nn/im2col_matmul.h
nn/im2col_matmul.wgsl.template
conv.cc keeps its four activation-uniform hunks but reverts the three that were
only there to carry the Activation into the im2col path: both
CanApplyIm2ColMatMulProgram call sites go back to passing
`activation_.activation_kind_ != ActivationKind::None`, and
ApplyIm2ColMatMulProgram loses its activation argument. Reverting the three
im2col files without these would not compile.
graph_transform_test.cc loses RunWebGpuIm2ColActivationParity, its three tests,
and `#include <fstream>`, which this branch added solely for that helper's
profile reader.
fuse_utils.h loses the comment claiming ActivationKind values are mirrored by
im2col_matmul.wgsl.template, which is no longer true here. Everything else it
gained is still required: WEBGPU_PROGRAM_ACTIVATION_UNIFORM_VARIABLES is used by
six programs, and AppendActivationUniformsData is called at eight sites.
Goldens regenerated with the canonical command:
UPDATE_WGSL_GOLDEN=1 python wgsl_template/test/run_tests.py
Beyond the expected im2col_matmul.h churn, this renumbers __str_N indices in
static-cpp/generated/tensor/{pad,oihw_to_ohwi}.h, because the six activation
string fragments left the shared string table and every later index shifts down
by six. static-cpp-literal is unaffected there since it embeds its strings. The
index_impl.h change is the content-hash comment on the im2col include.
The generated/math/subgroup_matrix_*.h bodies remain deliberately absent; they
are supplied by microsoft#32115. The in-tree golden smoke test therefore still reports a
file-set difference for those three headers, and no content mismatch.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This branch adds param_quick_gelu_unit_alpha to the im2col_matmul template but did not regenerate the aggregate index.h, and it is based on the pre-fix microsoft#32116 commit, so index.h was also still missing param_activation_kind. generated/nn/im2col_matmul.h referenced both against a struct that declared neither. Regenerated with the canonical command documented in test_in_tree_smoke.py: UPDATE_WGSL_GOLDEN=1 python wgsl_template/test/run_tests.py Only index.h changed in each variant. index_impl.h, string_table.h and every file under generated/ were already byte-identical to the generator output, so the earlier regeneration was correct apart from this one file. Of the 61 added lines per variant, two are the missing param_activation_kind and param_quick_gelu_unit_alpha members; the other 59 are declarations for the three math/subgroup_matrix_* templates, which land in microsoft#32115. The bulky generated/math/*.h bodies are deliberately left out so this PR does not duplicate that payload; index.h is a single aggregate file and cannot be split, matching the precedent set on microsoft#32116. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Description
Regenerates the WGSL in-tree golden fixtures. No production code changes; every file
touched lives under onnxruntime/test/in_tree_golden/.
Generated with:
UPDATE_WGSL_GOLDEN=1 python tools/python/wgsl_template/test/run_tests.py
Before: Ran 87 tests, FAILED (failures=2)
After: Ran 87 tests, OK
Three fixtures are new or rewritten: subgroup_matrix_gemm_8x16x16,
subgroup_matrix_matmul_8x16x16, subgroup_matrix_matmul_pad_b. The remaining churn in
im2col_matmul.h, oihw_to_ohwi.h, pad.h and string_table.h is index renumbering: the
generator emits one globally numbered string table, so adding literals shifts every
downstream __str_N index. Those files are unchanged once the indices are normalized.
Motivation and Context
The in-tree golden test compares the whole generated tree against committed fixtures, so it
fails on main today. The subgroup-matrix templates were added or rewritten without
regenerating the goldens.