Skip to main content

register

op

op(name: StringLiteral, priority: Int)

This decorator registers a given mojo function as being an implementation of an operation.

For instance:

import max
@max.register.op("mo.add")
fn my_op[...](...):

registers my_op as an implementation of mo.add.

Args:

  • name (StringLiteral): The name of the op to register.
  • priority (Int): The priority of the op.

elementwise

elementwise()

This decorator marks a kernel as being elementwise. This implies the kernel represents a lambda to be executed in the inner loop of an elementwise function.

For instance:

@max.register.op("mo.add")
@max.register.elementwise()
fn my_add[...](x: SIMD[...], y: SIMD[...]) -> SIMD[...]: