Module Ir.Hip_timing_phase

Pure HIP timing-queue SIMD-pair phase decoder, extracted from Hip_backend so that rotations, unread-sentinel rejection, and uneven-split declines are pinned in the regular cc test suite without hipjit or GPU hardware (test/operations/hip_timing_phase, gh-ocannl-2533).

val unread_sentinel : Unsigned.uint32

Value pre-filled into the mapped host buffer before launching the phase probe (0xFFFFFFFF). Any element retaining this value after the probe wait fails decoding.

val padding : Unsigned.uint32 array -> int option

padding ids decodes one full cycle of HW_ID1 values (register 23, SIMD id in bits 9:8, pair parity in bit 8 = 0x100) recorded across workgroups = Array.length ids workgroups on a workgroups / 2-WGP queue.

Returns Some pad with 0 <= pad < workgroups when workgroups is positive and even, every entry differs from unread_sentinel, and the entries form a single cyclic rotation of workgroups / 2 even-pair entries followed by workgroups / 2 odd-pair entries, where pad is the odd-to-even transition index (the number of padding workgroups needed to reach clean phase 0). Returns None for empty or odd-length arrays, any unread sentinel, uniform parity, or any uneven or multi-transition split.

val parity_string : Unsigned.uint32 array -> string

Compact per-workgroup SIMD-pair parity summary: '0' for even pair, '1' for odd pair, and '?' for unread_sentinel.

val ids_hex : Unsigned.uint32 array -> string

Comma-separated 0x%08lx formatting of raw HW_ID1 readings for diagnostics.

type probe_event = {
  1. ids : Unsigned.uint32 array;
  2. padding : int option;
}

One decoded hardware phase probe: the raw HW_ID1 cycle read from mapped host memory and the decoder's padding decision (Some 0 = already aligned, Some pad with pad > 0 = pad by pad workgroups, None = unrecognized decline). Returned by Backend_intf.Device.align_timing_queue and published with Autotune.timing_call / Autotune.timing_call_raised at call exit.