nx_interrupt_broker.nx
buildroot/runtime/nx_interrupt_broker.nx
about
nx_interrupt_broker.nx -- sub-50ms preemption between concurrent generators.
Per CARDINAL [[feedback-parallel-companion-multimodal-dnd-real-time]]:
when the operator presses a button mid-image-gen, the substrate must
preempt the long-running compute (save checkpoint + yield) so the
click-response (game action, system event) lands inside 50ms. V1
ships the preemption verdict + checkpoint discipline + deadline
tracking that the dispatcher/conductor obeys.
V1 ships: interrupt request enum, deadline class enum, preemption
decision (yield / continue / refuse) with reasoned verdict, checkpoint
log, deadline-miss accounting.
dependencies 2 imports · 6 importers
imports: nx_syscalls.nxnx_tier.nx
imported by: nx_bench_companion.nxnx_bench_companion_test.nxnx_companion_compose_test.nxnx_interrupt_broker_test.nxnx_session.nxnx_session_test.nx
structs
| 49 | struct NxInterruptRequest |
| 63 | struct NxRunningOp |
| 74 | struct NxInterruptBroker |
consts
| 19 | const NX_IB_KIND_OPERATOR_INPUT: nx_int = 0 // operator clicked / typed |
| 20 | const NX_IB_KIND_REALTIME_DEADLINE: nx_int = 1 // audio frame deadline |
| 21 | const NX_IB_KIND_RESOURCE_PRESSURE: nx_int = 2 // VRAM about to OOM |
| 22 | const NX_IB_KIND_PEER_REQUEST: nx_int = 3 // mesh peer needs response |
| 23 | const NX_IB_KIND_HEALTH_SIGNAL: nx_int = 4 // operator health alarm |
| 24 | const NX_IB_KIND_FAMILY_PRESENCE: nx_int = 5 // child entered room |
| 25 | const NX_IB_KIND_SCHEDULED_TICK: nx_int = 6 // low-priority cron |
| 26 | const NX_IB_KIND_N: nx_int = 7 |
| 30 | const NX_IB_DL_INSTANT: nx_int = 0 // <= 10 ms |
| 31 | const NX_IB_DL_REALTIME: nx_int = 1 // <= 50 ms |
| 32 | const NX_IB_DL_INTERACTIVE: nx_int = 2 // <= 200 ms |
| 33 | const NX_IB_DL_RESPONSIVE: nx_int = 3 // <= 1 s |
| 34 | const NX_IB_DL_BACKGROUND: nx_int = 4 // best-effort |
| 35 | const NX_IB_DL_N: nx_int = 5 |
| 39 | const NX_IB_V_YIELD: nx_int = 0 // running op must yield |
| 40 | const NX_IB_V_CONTINUE: nx_int = 1 // running op may continue |
| 41 | const NX_IB_V_REFUSED_CRITICAL: nx_int = 2 // running op cannot yield (mid-attention) |
| 42 | const NX_IB_V_DEADLINE_MISSED: nx_int = 3 // already past deadline |
| 43 | const NX_IB_V_INVALID: nx_int = 4 |
| 44 | const NX_IB_V_NULL: nx_int = 5 |
| 45 | const NX_IB_V_N: nx_int = 6 |
| 59 | const NX_IB_R_BYTES: nx_int = 56 |
| 72 | const NX_IB_OP_BYTES: nx_int = 48 |
| 83 | const NX_IB_BYTES: nx_int = 40 |
functions
| 87 | func nx_ib_kind_is_valid(k: nx_int) -> nx_int |
| 93 | func nx_ib_dl_is_valid(d: nx_int) -> nx_int |
| 99 | func nx_ib_v_is_valid(v: nx_int) -> nx_int called by 1: main |
| 106 | func nx_ib_dl_window_us(d: nx_int) -> nx_size |
| 115 | func nx_ib_kind_is_critical(k: nx_int) -> nx_int |
| 124 | func nx_ib_new(capacity: nx_int) -> *NxInterruptBroker |
| 137 | func _ib_req_at(b: *NxInterruptBroker, idx: nx_int) -> *NxInterruptRequest |
| 146 | func nx_ib_file(b: *NxInterruptBroker, |
| 172 | func nx_ib_arbitrate(b: *NxInterruptBroker, |
| 227 | func nx_ib_resolve(b: *NxInterruptBroker, request_id: nx_int) -> nx_int |
| 260 | func nx_ib_op_new(op_id: nx_int, |
| 279 | func nx_ib_pending_count(b: *NxInterruptBroker) -> nx_int called by 1: main |
| 284 | func nx_ib_deadline_misses(b: *NxInterruptBroker) -> nx_int |
| 289 | func nx_ib_grants(b: *NxInterruptBroker) -> nx_int |
| 294 | func nx_ib_refusals(b: *NxInterruptBroker) -> nx_int |