Custom cuda and metal kernels for system validation#274
Open
Luthaf wants to merge 4 commits into
Open
Conversation
c2584f3 to
607c96a
Compare
RMeli
reviewed
Jul 9, 2026
7d61507 to
d25d254
Compare
RMeli
reviewed
Jul 14, 2026
RMeli
left a comment
Member
There was a problem hiding this comment.
A few final comments, but probably missed some other things without tests... We can revisit once the Python bindings are available.
| }) | ||
| .map_err(|e| Error::Internal(format!("kernel launch (f32): {e}")))?; | ||
| } | ||
| } else { |
Member
There was a problem hiding this comment.
I missed this on the first pass, worth checking cell.dtype().bits == 64 explicitly?
Comment on lines
+68
to
+69
| // Safety: the cache lives for the lifetime of the process (Lazy static), | ||
| // so the reference is valid for 'static once initialized and never removed. |
Member
There was a problem hiding this comment.
I'm not very familiar with Rust, but from the documentation looks like HashMap can re-allocate. Is this taken into account?
Member
Author
There was a problem hiding this comment.
yep, we don't actually need a 'static value here, I simplified it!
|
|
||
| let values_buf = entry.device.new_buffer_with_data(values_ptr, values_bytes, opts); | ||
| let ref_buf = entry.device.new_buffer_with_data(ref_ptr, ref_bytes, opts); | ||
| let result_buf = entry.device.new_buffer(std::mem::size_of::<i32>() as u64, opts); |
Member
There was a problem hiding this comment.
In the CUDA version, the result buffer is initialized to 0. Here it doesn't seem to be initialized, is it?
This way we don't have to keep uploading small values to the device over and over again
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.
Add custom cuda and metal kernels for system validation. The intention is to add more kernels for unit conversion & any other work that needs to be done inside
mta_execute_model.No tests other than making sure the code compile for now, they will be added once we have Python bindings.
Contributor (creator of pull-request) checklist
Tests updated (for new features and bugfixes)?Issue referenced (for PRs that solve an issue)?Reviewer checklist
CHANGELOG updated with public API or any other important changes?