code wiki / _hdl_build / nx_gpu_sync.nx

nx_gpu_sync.nx

buildroot/runtime/_hdl_build/nx_gpu_sync.nx

4438 B81 linesdepth 3pulls 3 transitivereach 3 importersview sourcekind librarytopic gpu
docsdependenciesstructsconstsfunctions

about

nx_gpu_sync.nx -- the sovereign GPU FENCE over the dxg door (gpu GP7, the fence half of "fences and barriers"). A monotonic timeline fence the CPU can signal and wait on, as ONE composed primitive over the nx_dxg shim: gpu_sync_fence creates a MONITORED_FENCE sync object on the device, signals it to 1 and then to 2, and waits for 2 -- a round trip that only completes when the signals advanced the real fence. It returns 0 on the round trip, a NEGATIVE code naming the stage that refused, and leaves the sync-object handle in outso[0] so a caller that wants the fence for real work keeps it. PROVENANCE: the ABI and the round-trip were measured LIVE on the RTX 5080 by the R4g candidate gate (_offc/cand__gpu_dxg_syncobj_gate, size-swept ioctl codes, type-99 refused, three tampers rejected) and sat unpromoted for weeks. Folded here so the estate has ONE fence primitive and ONE gate over it (nx_gpu_sync_gate). The BARRIER half of GP7 (a barrier a recorded list carries between a write and a read) is NOT here: it needs a command list the dxg door can execute, which the raw channel cannot carry without a vendor UMD (gpu.plan GP5 lesson row, 2026-09-02). This file is the fence; the board says which half. SCOPE: /dev/dxg only (WSL2 GPU-PV). No third party in the run path: raw ioctls through nx_syscalls. license_tier: ORIGINAL No hw writes (Rule 26): sync objects are per-process kernel state, never persistent.

dependencies 2 imports · 3 importers

nx_syscalls.nx nx_dxg.nx nx_gpu_sync.nx nx_gpu_mem.nx nx_gpu_mem_gate.nx nx_gpu_sync_gate.nx

imports: nx_syscalls.nxnx_dxg.nx

imported by: nx_gpu_mem.nxnx_gpu_mem_gate.nxnx_gpu_sync_gate.nx

structs

none

consts

20const GS_ERR_CREATE: i64 = 0 - 1 // the create ioctl refused or returned no object
21const GS_ERR_SIGNAL1: i64 = 0 - 2 // the first CPU signal refused
22const GS_ERR_SIGNAL2: i64 = 0 - 3 // the second CPU signal refused
23const GS_ERR_WAIT: i64 = 0 - 4 // the synchronous wait did not complete cleanly
24const GS_FENCE_STEP1: i64 = 1
25const GS_FENCE_STEP2: i64 = 2
40const GS_ERR_ENUM: i64 = 0 - 11
41const GS_ERR_NODISC: i64 = 0 - 12
42const GS_ERR_OPEN: i64 = 0 - 13
43const GS_ERR_DEVICE: i64 = 0 - 14
44const GS_ADAPTER_ROW: i64 = 20
45const GS_QTYPE_FLAGS: i64 = 15

functions

28func gpu_sync_fence(fd: i64, device: i64, outso: *i64, outfva: *i64) -> i64
47func gpu_sync_open(fd: i64, outah: *i64, outdev: *i64) -> i64
76func gpu_sync_device(fd: i64, outdev: *i64) -> i64