1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use MegakernelWorkItem;
/// ROADMAP C3 substrate: shared prologue extraction.
///
/// Returns the length of the longest identical prefix shared by every
/// item in `arm_prologues`. The dispatcher uses this to extract a
/// single shared prologue at the top of the megakernel instead of
/// running the same prologue ops once per arm - saves N-1 redundant
/// prologue executions when N arms agree on the first K ops.
///
/// Returns `0` when:
/// - `arm_prologues` is empty,
/// - any prologue is empty (no shared work to extract), or
/// - the very first MegakernelWorkItem differs across arms.
///
/// `MegakernelWorkItem` derives `PartialEq` so equality is structural over
/// `(op_handle, input_handle, output_handle, param)`.