Shaders precompile instead of compiling on the fly#83
Merged
moven0831 merged 2 commits intozkmopro:feat/example-ios-appfrom Jun 5, 2025
Merged
Conversation
…le combined metallib
yaroslavyaroslav
commented
Jun 4, 2025
| let constants = get_or_calc_constants(config.num_limbs, config.log_limb_size); | ||
|
|
||
| // Pre-write constants to avoid doing it on every shader execution | ||
| write_constants( |
Collaborator
Author
There was a problem hiding this comment.
@moven0831 please check if this function call can be deleted here.
… use precompiled Metal library instead Closes: zkmopro#77
8bee13f to
76925b1
Compare
moven0831
approved these changes
Jun 5, 2025
Collaborator
moven0831
left a comment
There was a problem hiding this comment.
overall works great to boost an executable iOS app after some local patches about the metal_msm.rs.
for pbpr stages, we need a dummy u32 for params_buf encoding to align with the Metal's 16-byte style uint3. if not, the error goes like
validateComputeFunctionArguments:1683: failed assertion 'Compute Function(bpr_stage_1): argument params[0] from buffer(6) with offset(0) and length(12) has space for 12 bytes, but argument has a length(16).'
| use std::collections::HashMap; | ||
| use std::sync::Mutex; | ||
| // Embed the precompiled Metal library | ||
| include!(concat!(env!("OUT_DIR"), "/built_shaders.rs")); |
Collaborator
There was a problem hiding this comment.
this pattern works well for the ultimate metal_msm execution but fail the current cargo test since some of the unit tests still relies on the compiling-on-the-fly pattern
Collaborator
|
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.
Closes: #77