Fix Metal preamble generation for paths with spaces#2
Open
aramdov wants to merge 1 commit intoPrismML-Eng:prismfrom
Open
Fix Metal preamble generation for paths with spaces#2aramdov wants to merge 1 commit intoPrismML-Eng:prismfrom
aramdov wants to merge 1 commit intoPrismML-Eng:prismfrom
Conversation
|
thx man |
Collaborator
|
Thanks for the fix, is the more of mlx issue or issue with demo? Or in https://github.com/PrismML-Eng/Bonsai-demo. Can keep the PR open here too if its helping others. Our plan is to merge our changes to the main MLX so this fork won't be needed long term. |
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.
Summary
mlx/backend/metal/make_compiled_preamble.shparsedxcrun metal -Houtput using shell word splitting.That breaks when header paths contain spaces, for example a checkout located under a path like
Software Projects.The generated preamble then omits real dependencies and produces truncated fake header paths. At runtime this shows up as Metal JIT compilation failures with errors such as:
unknown type name 'bfloat16_t'unknown type name 'complex64_t'use of undeclared identifier 'offset_neg_idx'Root cause
The script previously expanded the compiler output with shell word splitting, which does not preserve one dependency record per line.
Fix
-Hdepth + pathwhile preserving embedded spacesValidation
I reproduced this with a local checkout under a path containing spaces. Before the fix, the generated preamble contained broken path fragments instead of real headers. After the fix, the generated preamble correctly includes dependencies such as:
mlx/backend/metal/kernels/bf16.hmlx/backend/metal/kernels/bf16_math.hmlx/backend/metal/kernels/complex.hand the downstream MLX inference path succeeds again.