M
Modular10mo ago
massimim

JIT compilation in Mojo

Hi, Mojo parameters are an extremely powerful tool in the language. Does Mojo also provide (or will provide) JIT compilation mechanisms to convert runtime variables into parameters?
3 Replies
sora
sora10mo ago
You said the following in the other thread:
other DLS in Python uses JIT compilation to "transform" a runtime variable into something that can be used as a compile-time variable.
Could you give an (Python) example to clarify what do you mean by transforming runtime variable into compile time variable?
Nick!
Nick!10mo ago
convert runtime variables into parameters
I suspect you're conflating parameters with AoT compilation. As of today's Mojo, parameters can only be assigned a value during AoT compilation, but in a future version of Mojo (not any time soon), it might be possible to assign parameters at runtime, in which case yes, some form of compilation-at-runtime would need to occur, to specialize a type or a function to its parameter values. I wouldn't expect the compiler to ever convert arguments into parameters, though.
massimim
massimimOP10mo ago
Yeah exactly. I was referring to some capabilities in Python extensions like JAX and Warp, where runtime variables can be annotated as a compile-time expression for a GPU kernel. Thank you for the answer.
Want results from more Discord servers?
Add your server