What is the recommended way of importing MAX kernels from source instead of importing the versions installed by pixi?
To hack on them directly, our Bazel build system is what you’ll want to use to compile the kernel modules. For example, to build the nn
module within a local modular
checkout:
./bazelw build //max/kernels/src/nn
and then to run unit tests against modifications in that module:
./bazelw test //max/kernels/test/nn:all
I know at least for a custom-build Mojo standard library you can then use the following environment variable to tell Mojo to use that new library:
export MODULAR_MOJO_MAX_IMPORT_PATH=[path]/modular/bazel-bin/
but I’m not 100% sure that this will also work for kernel modules, or if you’ll need to use a -I [path]
to import the new kernel modules.
I’ll note that currently the MAX graph compiler does not recognize these newly-built libraries, and can only use the kernel modules in the form that they are in the MAX package. We’re checking on how we can get the graph compiler to also use locally-built versions of the Mojo standard library and kernel libraries.
@BradLarson Thank you! As soon as I managed to update the mojo version in my pixi environment to the latest one this worked like a charm by including
export MODULAR_MOJO_MAX_IMPORT_PATH=[path]/modular/bazel-bin/