Skip to main content
Log in

Python class

KernelLibrary

KernelLibrary

class max.graph.KernelLibrary(context: ~max._mlir._mlir_libs._site_initialize.<locals>.Context, paths: list[pathlib.Path] = [])

add_path()

add_path(path: Path)

library_paths()

library_paths() → list[pathlib.Path]

load_paths()

load_paths(context: ~max._mlir._mlir_libs._site_initialize.<locals>.Context, custom_extensions: ~collections.abc.Iterable[~pathlib.Path])

Load the custom operations from provided library paths.

Performs additional “smart” library loading logic for custom operation libraries in additional formats. The loading logic supports the following formats:

  • Compiled Mojo binary packages with .mojopkg extension
  • Mojo source directory with custom operations

The loaded libraries are added to the current kernel library.

  • Parameters:

    • context – The MLIR context for loading MLIR operations
    • custom_extensions – File paths to the custom operation libraries

verify_custom_op()

verify_custom_op(custom_op: Operation)