Skip to content

[ET-VK] Name the int32 eq shader what the dispatcher asks for - #22507

Open
msluszniak wants to merge 2 commits into
pytorch:mainfrom
msluszniak:ms/vulkan-eq-int32-shader-name
Open

[ET-VK] Name the int32 eq shader what the dispatcher asks for#22507
msluszniak wants to merge 2 commits into
pytorch:mainfrom
msluszniak:ms/vulkan-eq-int32-shader-name

Conversation

@msluszniak

Copy link
Copy Markdown
Contributor

Fixes #22505.

add_binary_op_node builds its kernel name as "binary_" + op + storage + dtype, so an int32 aten.eq.Tensor looks for binary_eq_buffer_int32. The yaml declares that variant as binary_eq_int32_buffer, which generates shaders nothing references and leaves the name the dispatcher wants missing. The op is registered as supported, so the partitioner claims it and the model aborts at dispatch with "Could not find ShaderInfo with name binary_eq_buffer_int32".

Declaring it as a second binary_eq_* variant restricted to int32 fixes both the buffer and the texture path. The generated names do not collide with the half and float ones, and the exact comparison stays separate from the float path's epsilon compare.

No test is added because aten.eq.Tensor sits in a skip=True group in cases.py with a pre-existing correctness TODO. Verified on device instead: kokoro's synthesizer aborts at that shader lookup on main and gets past it with this change on an Adreno 840.

add_binary_op_node builds its kernel name as "binary_" + op + storage + dtype,
so an int32 aten.eq.Tensor looks for binary_eq_buffer_int32. The yaml instead
declares that variant as binary_eq_int32_buffer, which generates shaders
nothing ever references and leaves the name the dispatcher wants missing. The
op is registered as supported, so the partitioner claims it and the model then
aborts at dispatch with "Could not find ShaderInfo with name
binary_eq_buffer_int32".

Declare it as a second binary_eq_* variant restricted to int32 instead. The
generated names do not collide with the half and float ones, and the exact
comparison stays separate from the float path's epsilon compare.

Found by lowering kokoro's synthesizer, whose mask comparison runs on int32.
@msluszniak
msluszniak requested a review from SS-JIA as a code owner September 3, 2026 06:51
@pytorch-bot

pytorch-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/22507

Note: Links to docs will display an error until the docs builds have been completed.

⚠️ 16 Awaiting Approval

As of commit d0a9ba8 with merge base a6b115b (image):

AWAITING APPROVAL - The following workflows need approval before CI can run:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@sylvesterkaczmarek sylvesterkaczmarek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes a generator/dispatcher naming contract, which can be tested without enabling the skipped aten.eq.Tensor correctness case. Could we add a small registry/name-generation assertion for binary_eq_{buffer,texture}_int32? Otherwise the exact missing-shader regression remains unprotected.

Guards the naming contract the previous commit fixed, without touching the
skipped aten.eq.Tensor correctness case.

Two assertions. The first names binary_eq_buffer_int32 and
binary_eq_texture3d_int32 directly, so the exact regression is covered. The
second is the general form: every variant the two binary op templates generate
has to end in a storage suffix followed by a dtype suffix, because that is what
add_binary_op_node builds. Both suffix sets are parsed out of
ShaderNameUtils.cpp rather than restated, so adding a dtype there does not fail
the test.

Runs at codegen level with no built runtime and no GPU: the generator is loaded
by file path and only its variant names are inspected. Reverting the yaml fix
fails both assertions.
@msluszniak

Copy link
Copy Markdown
Contributor Author

Added backends/vulkan/test/test_vulkan_shader_names.py.

It asserts binary_eq_buffer_int32 and binary_eq_texture3d_int32 exist (the storage suffix is _texture3d, from add_storage_type_suffix), and also checks the general contract: every variant the binary_op_* templates generate has to end in a storage suffix followed by a dtype suffix, since that is what add_binary_op_node concatenates. Both suffix lists are parsed out of ShaderNameUtils.cpp rather than restated in the test, so adding a dtype there does not fail it.

It runs at codegen level with no GPU and no built runtime: the generator is loaded by file path, the same way backends/webgpu/test/test_wgsl_codegen.py does, and only variant names are inspected. Reverting the yaml change fails both assertions; the two broken names were the only ones out of 77 generated binary_* shaders that violated the invariant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ET-VK] aten.eq on int32 aborts: the generated shader name does not match the dispatcher's

3 participants