Repository navigation
Sanitize '-' in make_template_hash for metal kernel - #4584
Merged
zcbenz merged 2 commits intoOct 2, 2026
Merged
Conversation
…ints Negative int template args produced a '-' in the generated kernel name, which is not a valid C++ identifier and broke Metal compilation (ml-explore#4579). Signed-off-by: GokayAI <60583610+gokay-ai@users.noreply.github.com>
zcbenz
force-pushed
the
fix/metal-kernel-negative-template-hash
branch
from
October 2, 2026 04:34
1cc40e4 to
e407096
Compare
zcbenz
approved these changes
Oct 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #4579.
make_template_hashonly rewrote<,>, and,. A negative int template arg (e.g.("V", -1)) put a literal-into the generated Metal kernel name, which is not a valid C++ identifier, so compilation failed withUnable to build metal library from source.Fix
Treat
-like the other sanitized characters (replace with_).Test
Added
test_custom_metal_kernel_negative_template_int(Metal-only) using the issue repro. Couldn't run Metal on this Linux box — please check CI / Apple Silicon.Thanks!