Per-program-point compiler state: active set + scope kind + split.
| 376 | |
| 377 | @dataclass(frozen=True) |
| 378 | class ExecContext: |
| 379 | """Per-program-point compiler state: active set + scope kind + split.""" |
| 380 | |
| 381 | A: ActiveSet |
| 382 | scope_kind: str |
| 383 | inter: dict[str, AxisRange] |
| 384 | intra: dict[str, AxisRange] |
| 385 | |
| 386 | @staticmethod |
| 387 | def at_kernel_entry(*, lane_ext: int = 32, warp_ext: int, cta_ext: int = 1) -> ExecContext: |
| 388 | A = initial_A(lane_ext=lane_ext, warp_ext=warp_ext, cta_ext=cta_ext) |
| 389 | split = scope_switch(A, KERNEL) |
| 390 | return ExecContext(A=A, scope_kind=KERNEL, inter=split.inter, intra=split.intra) |
| 391 | |
| 392 | def with_filter(self, binding: LaneBinding, lo: int, hi: int) -> ExecContext: |
| 393 | new_A = filter_narrow(self.A, binding, lo, hi) |
| 394 | split = scope_switch(new_A, self.scope_kind) |
| 395 | return ExecContext( |
| 396 | A=new_A, scope_kind=self.scope_kind, inter=split.inter, intra=split.intra |
| 397 | ) |
| 398 | |
| 399 | def with_cta_axis_modulo(self, axis: str, modulus: int, residue: int) -> ExecContext: |
| 400 | new_A = filter_modulo(self.A, axis, modulus, residue) |
| 401 | split = scope_switch(new_A, self.scope_kind) |
| 402 | return ExecContext( |
| 403 | A=new_A, scope_kind=self.scope_kind, inter=split.inter, intra=split.intra |
| 404 | ) |
| 405 | |
| 406 | def with_scope_switch(self, scope_kind: str) -> ExecContext: |
| 407 | split = scope_switch(self.A, scope_kind) |
| 408 | return ExecContext(A=self.A, scope_kind=scope_kind, inter=split.inter, intra=split.intra) |
no outgoing calls
no test coverage detected
searching dependent graphs…