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
bencher_iter_custom
def bencher_iter_custom[kernel_launch_fn: def(DeviceContext) raises capturing thin -> None](mut self_: Bencher, ctx: DeviceContext)
Times a target GPU function with custom number of iterations via DeviceContext ctx.
Parameters:
- βkernel_launch_fn (
def(DeviceContext) raises capturing thin -> None): The target GPU kernel launch function to benchmark.
Args:
- βself_ (
Bencher): The bencher state. - βctx (
DeviceContext): The GPU DeviceContext for launching kernel.
def bencher_iter_custom[FuncType: def(DeviceContext) raises -> None](mut self_: Bencher, ref func: FuncType, ctx: DeviceContext)
Times a target GPU closure with custom number of iterations via DeviceContext ctx.
Notes:
This overload is intentionally separate from the parametric
iter_custom[kernel_launch_fn](ctx) form. Nested launch closures that
capture benchmark-local state are closure values, and the current
closure typing rules do not let those values compose with a
def(DeviceContext) raises capturing[_] compile-time parameter while
preserving their capture object. This value-taking overload forwards
the closure to DeviceContext.execution_time() so FuncType carries
the captured state.
Parameters:
- βFuncType (
def(DeviceContext) raises -> None): The target GPU kernel launch closure type.
Args:
- βself_ (
Bencher): The bencher state. - βfunc (
FuncType): The closure carrying the captured state of the kernel launch. - βctx (
DeviceContext): The GPU DeviceContext for launching kernel.
def bencher_iter_custom[kernel_launch_fn: def(DeviceContext, Int) raises capturing thin -> None](mut self_: Bencher, ctx: DeviceContext)
Times a target GPU function with custom number of iterations via DeviceContext ctx.
Parameters:
- βkernel_launch_fn (
def(DeviceContext, Int) raises capturing thin -> None): The target GPU kernel launch function to benchmark.
Args:
- βself_ (
Bencher): The bencher state. - βctx (
DeviceContext): The GPU DeviceContext for launching kernel.
def bencher_iter_custom[FuncType: def(DeviceContext, Int) raises -> None](mut self_: Bencher, ref func: FuncType, ctx: DeviceContext)
Times a target GPU closure with custom number of iterations via DeviceContext ctx.
Notes:
This overload is intentionally separate from the parametric
iter_custom[kernel_launch_fn](ctx) form. Nested launch closures that
capture benchmark-local state are closure values, and the current
closure typing rules do not let those values compose with a
def(DeviceContext, Int) raises capturing[_] compile-time parameter
while preserving their capture object. This value-taking overload
forwards the closure to DeviceContext.execution_time_iter() so
FuncType carries the captured state.
Parameters:
- βFuncType (
def(DeviceContext, Int) raises -> None): The target GPU kernel launch closure type.
Args:
- βself_ (
Bencher): The bencher state. - βfunc (
FuncType): The closure carrying the captured state of the kernel launch. - βctx (
DeviceContext): The GPU DeviceContext for launching kernel.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!