Skip to content

Add a Mojo solution for PMPP v2 vectoradd - #177

Merged
msaroufim merged 4 commits into
mainfrom
mojo-vectoradd-solution
Nov 23, 2026
Merged

msaroufim merged 4 commits into
mainfrom
mojo-vectoradd-solution

Conversation

@msaroufim

@msaroufim msaroufim commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

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 default DeviceContext queue. That is a blocking CUDA stream, ordered with the PyTorch default stream the PMPP v2 eval uses. It also uses a plain import instead of importlib, so KernelGuard classifies it as valid.

It depends on gpu-mode/kernelbot#536, which installs max==26.7.0 in the Modal image.

Verified on the gpu-mode Modal account, through the kernelbot API with KernelGuard enabled:

GPU test leaderboard ranked score
H100 pass 836 µs
B200 pass 848 µs
A100 pass 1194 µs
L4 pass 6746 µs

Not covered:

  • Evals that run custom_kernel on a side stream or inside a CUDA graph won't see this kernel.
  • PMPP v2 profile mode passes its check but produces no NCU report. I believe that's because the PMPP v2 eval has no custom_kernel NVTX range, so it would affect every solution, but I didn't confirm that with another solution.

msaroufim and others added 4 commits November 23, 2026 01:18
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.
@msaroufim
msaroufim merged commit 4c06b02 into main Nov 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant