Skip to main content

Mojo function

elementwise

elementwise[: origin.set, //, func: fn[Int, Int](IndexList[$1]) capturing -> None, simd_width: Int, *, use_blocking_impl: Bool = 0, target: StringLiteral = "cpu", trace_description: StringLiteral = ""](shape: Int)

Executes func[width, rank](indices), possibly as sub-tasks, for a suitable combination of width and indices so as to cover shape. Returns when all sub-tasks have completed.

Parameters:

  • func (fn[Int, Int](IndexList[$1]) capturing -> None): The body function.
  • simd_width (Int): The SIMD vector width to use.
  • use_blocking_impl (Bool): Do not invoke the function using asychronous calls.
  • target (StringLiteral): The target to run on.
  • trace_description (StringLiteral): Description of the trace.

Args:

  • shape (Int): The shape of the buffer.

elementwise[: origin.set, rank: Int, //, func: fn[Int, Int](IndexList[$1]) capturing -> None, simd_width: Int, *, use_blocking_impl: Bool = 0, target: StringLiteral = "cpu", trace_description: StringLiteral = ""](shape: IndexList[rank, element_bitwidth=element_bitwidth, unsigned=unsigned])

Executes func[width, rank](indices), possibly as sub-tasks, for a suitable combination of width and indices so as to cover shape. Returns when all sub-tasks have completed.

Parameters:

  • rank (Int): The rank of the buffer.
  • func (fn[Int, Int](IndexList[$1]) capturing -> None): The body function.
  • simd_width (Int): The SIMD vector width to use.
  • use_blocking_impl (Bool): Do not invoke the function using asychronous calls.
  • target (StringLiteral): The target to run on.
  • trace_description (StringLiteral): Description of the trace.

Args:

  • shape (IndexList[rank, element_bitwidth=element_bitwidth, unsigned=unsigned]): The shape of the buffer.

elementwise[: origin.set, //, func: fn[Int, Int](IndexList[$1]) capturing -> None, simd_width: Int, *, use_blocking_impl: Bool = 0, target: StringLiteral = "cpu", trace_description: StringLiteral = ""](shape: Int, context: DeviceContextV2)

Executes func[width, rank](indices), possibly as sub-tasks, for a suitable combination of width and indices so as to cover shape. Returns when all sub-tasks have completed.

Parameters:

  • func (fn[Int, Int](IndexList[$1]) capturing -> None): The body function.
  • simd_width (Int): The SIMD vector width to use.
  • use_blocking_impl (Bool): Do not invoke the function using asychronous calls.
  • target (StringLiteral): The target to run on.
  • trace_description (StringLiteral): Description of the trace.

Args:

  • shape (Int): The shape of the buffer.
  • context (DeviceContextV2): The device context to use.

elementwise[: origin.set, rank: Int, //, func: fn[Int, Int](IndexList[$1]) capturing -> None, simd_width: Int, *, use_blocking_impl: Bool = 0, target: StringLiteral = "cpu", trace_description: StringLiteral = ""](shape: IndexList[rank, element_bitwidth=element_bitwidth, unsigned=unsigned], context: DeviceContextV2)

Executes func[width, rank](indices), possibly as sub-tasks, for a suitable combination of width and indices so as to cover shape. Returns when all sub-tasks have completed.

Parameters:

  • rank (Int): The rank of the buffer.
  • func (fn[Int, Int](IndexList[$1]) capturing -> None): The body function.
  • simd_width (Int): The SIMD vector width to use.
  • use_blocking_impl (Bool): Do not invoke the function using asychronous calls.
  • target (StringLiteral): The target to run on.
  • trace_description (StringLiteral): Description of the trace.

Args:

  • shape (IndexList[rank, element_bitwidth=element_bitwidth, unsigned=unsigned]): The shape of the buffer.
  • context (DeviceContextV2): The device context to use.

elementwise[: origin.set, rank: Int, //, func: fn[Int, Int](IndexList[$1]) capturing -> None, simd_width: Int, *, use_blocking_impl: Bool = 0, target: StringLiteral = "cpu", trace_description: StringLiteral = ""](shape: IndexList[rank, element_bitwidth=element_bitwidth, unsigned=unsigned], context: MojoCallContextPtr)

Executes func[width, rank](indices), possibly as sub-tasks, for a suitable combination of width and indices so as to cover shape. Returns when all sub-tasks have completed.

Parameters:

  • rank (Int): The rank of the buffer.
  • func (fn[Int, Int](IndexList[$1]) capturing -> None): The body function.
  • simd_width (Int): The SIMD vector width to use.
  • use_blocking_impl (Bool): Do not invoke the function using asychronous calls.
  • target (StringLiteral): The target to run on.
  • trace_description (StringLiteral): Description of the trace.

Args:

  • shape (IndexList[rank, element_bitwidth=element_bitwidth, unsigned=unsigned]): The shape of the buffer.
  • context (MojoCallContextPtr): The device context to use.