For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo function
dual_elementwise
def dual_elementwise[func_0: def[width: Int, alignment: Int = Int(1)](Coord[**?]) capturing thin -> None, func_1: def[width: Int, alignment: Int = Int(1)](Coord[**?]) capturing thin -> None, simd_width: Int, *, target: StringSlice[ImmStaticOrigin] = StringSlice("gpu"), _trace_description: StringSlice[ImmStaticOrigin] = StringSlice("dual_elementwise")](shape_0: Coord, shape_1: Coord, context: DeviceContext)
Executes two elementwise functions over their respective shapes in a single GPU kernel launch. Each thread processes elements from both shapes, fusing two independent elementwise passes into one.
Parameters:
- βfunc_0 (
def[width: Int, alignment: Int = Int(1)](Coord[**?]) capturing thin -> None): The first body function. - βfunc_1 (
def[width: Int, alignment: Int = Int(1)](Coord[**?]) capturing thin -> None): The second body function. - βsimd_width (
Int): The SIMD vector width to use. - βtarget (
StringSlice[ImmStaticOrigin]): The target to run on (must be GPU). - β_trace_description (
StringSlice[ImmStaticOrigin]): Description of the trace.
Args:
- βshape_0 (
Coord): The shape for the first function. - βshape_1 (
Coord): The shape for the second function. - βcontext (
DeviceContext): The device context to use.
Raises:
If the operation fails.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!