Mojo struct
GroupedAdvanceContext
@register_passable(trivial)
struct GroupedAdvanceContext[work_origin: MutOrigin, idx_origin: MutOrigin]
Context manager that returns current work and advances on exit.
This follows the same pattern as the working kernel's WaitAndAdvanceContext:
- Pre-compute next work during construction
- enter returns current work for processing
- exit assigns pre-computed next work and updates linear index
Usage: with work_iter.next() as current: # Process current work # After: work_iter.work_info updated to next work
Fields
- work_info_ptr (
Pointer[GroupedWorkInfo, work_origin]): - linear_idx_ptr (
Pointer[UInt32, idx_origin]): - next_work (
GroupedWorkInfo): - next_linear_idx (
UInt32):
Implemented traits
AnyType,
Copyable,
ImplicitlyCopyable,
ImplicitlyDestructible,
Movable,
RegisterPassable,
TrivialRegisterPassable
comptime members
__copyinit__is_trivial
comptime __copyinit__is_trivial = True
__del__is_trivial
comptime __del__is_trivial = True
__moveinit__is_trivial
comptime __moveinit__is_trivial = True
Methods
__init__
__init__(work_info_ptr: Pointer[GroupedWorkInfo, work_origin], linear_idx_ptr: Pointer[UInt32, idx_origin], next_work: GroupedWorkInfo, next_linear_idx: UInt32) -> Self
__enter__
__exit__
__exit__(mut self)
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!