Merged
Conversation
ef736b6 to
2beb48b
Compare
Breaking changes in Mojo 26 require updates across all starter.mojo files: - stdlib imports must be fully qualified (std.gpu, std.memory, std.math) - gpu.id module removed; block_dim/block_idx/thread_idx now live in std.gpu - UnsafePointer requires an explicit origin; use MutAnyOrigin for pointers crossing the @export C ABI boundary - ctx.enqueue_function[kernel](...) parametric form removed; kernels must first be compiled via ctx.compile_function[kernel, kernel]() and then passed as a runtime arg to ctx.enqueue_function(kernel, ...) - def no longer auto-raises in Mojo 26, so @export functions that call raising APIs (DeviceContext, enqueue_function, synchronize) are now declared as `fn solve(...) raises` instead of `def solve(...)` Verified by compiling several starters (vector_add, 1d_convolution, reduction) against Mojo 26.2 on a Tesla T4 via the accelerated runner. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2beb48b to
9a52c18
Compare
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
UnsafePointer, GPU kernel launch, and raising semantics. All existingstarter.mojofiles were broken under 26.2; this updates them so they compile cleanly again.leetgpu-infrabumpsmodular==26.2.0inDockerfile.acceleratedandMOJO: "26.2"inlanguage_version.go.Breaking changes addressed
from gpu.host import …→from std.gpu.host import …, and similarly formemory,math.gpu.idmodule removed —block_dim,block_idx,thread_idxnow import fromstd.gpudirectly.UnsafePointerrequires an origin —UnsafePointer[Float32]→UnsafePointer[Float32, MutAnyOrigin].MutAnyOriginis a builtin (no import needed). This is required because@exportcan't be applied to parametric functions, so we can't...-unbind the origin parameter.enqueue_function[kernel](...)removed — kernels must be compiled first viactx.compile_function[kernel, kernel]()and then passed as a runtime arg toctx.enqueue_function(kernel, …). The kernel is passed twice as a comptime parameter (once asfunc, once assignature_func).defno longer auto-raises in Mojo 26 —DeviceContext(),enqueue_function, andsynchronizeall raise, sosolveis now declared asfn solve(...) raisesinstead ofdef solve(...).@export+raisesis allowed and propagates exceptions across the C ABI as expected.Example diff (vector_add)
Test plan
vector_addstarter against Mojo 26.2 via accelerated runner on Tesla T4 — compiles, test-case-failed as expected for an empty-kernel starter.9_1d_convolutionstarter (multi-linedef solve(...)signature, parameter namedkernel) — compiles.medium/4_reductionstarter (pass-only body, no kernel scaffold) — compiles.🤖 Generated with Claude Code