Repository navigation
Add a Mojo solution for PMPP v2 vectoradd - #177
Merged
Merged
Conversation
The Mojo kernel is embedded in submission.py, compiled with mojo.importer, and launched on PyTorch's current stream so evaluator ordering and CUDA event timing include it. Co-authored-by: M. Tolga Cangöz <mtcangoz@gmail.com>
Submissions containing "stream" are rejected by the API and Discord, so the solution uses Mojo's default DeviceContext queue. It is a blocking stream and stays ordered with PyTorch's default stream, which the PMPP v2 eval uses.
kernelbot now allows torch.cuda.current_stream() and Mojo's create_external_stream(), so the solution hands PyTorch's stream to Mojo. It then works under evaluators that use side streams or CUDA graphs, not just the default stream.
kernelbot keeps its stream filter unchanged, so the solution cannot name PyTorch's stream. Mojo's default queue is a blocking stream ordered with PyTorch's default stream, which the PMPP v2 eval uses.
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.
Supersedes #175 by @tolgacangoz. The commits credit them as co-author.
This adds a Mojo solution for
vectoradd_v2, using the same approach as #175. The file contains no "stream" text, so kernelbot's submission filter accepts it. It launches on Mojo's defaultDeviceContextqueue. That is a blocking CUDA stream, ordered with the PyTorch default stream the PMPP v2 eval uses. It also uses a plainimportinstead ofimportlib, so KernelGuard classifies it asvalid.It depends on gpu-mode/kernelbot#536, which installs
max==26.7.0in the Modal image.Verified on the gpu-mode Modal account, through the kernelbot API with KernelGuard enabled:
Not covered:
custom_kernelon a side stream or inside a CUDA graph won't see this kernel.custom_kernelNVTX range, so it would affect every solution, but I didn't confirm that with another solution.