code wiki / (root) / nx_tensor_placement.nx

nx_tensor_placement.nx

buildroot/runtime/nx_tensor_placement.nx

10636 B288 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind librarytopic tensor
docsdependenciesstructsconstsfunctions

about

nx_tensor_placement.nx -- multi-tier tensor home with promote/demote lifecycle. Per CARDINAL [[feedback-conductor-heterogeneous-compute-no-second-class- resources]]: REFUSES CUDA's VRAM-funnel model. Tensors are first-class multi-tier objects that live where they make sense; the substrate (not the user) routes them between tiers based on cost. V1 ships the placement record (where + how big + last-touched), tier classification + promotion/demotion gates, and aggregate accounting for the dispatcher's cost model.

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_tier.nx nx_tensor_placement.nx nx_companion_compose_test.nx nx_tensor_placement_test.nx

imports: nx_syscalls.nxnx_tier.nx

imported by: nx_companion_compose_test.nxnx_tensor_placement_test.nx

structs

43struct NxTensorPlacement
55struct NxPlacementRegistry

consts

20const NX_TP_TIER_VRAM_HOT: nx_int = 0 // GPU memory, active compute
21const NX_TP_TIER_VRAM_WARM: nx_int = 1 // GPU memory, idle
22const NX_TP_TIER_RAM_HOT: nx_int = 2 // CPU RAM, active
23const NX_TP_TIER_RAM_WARM: nx_int = 3 // CPU RAM, idle
24const NX_TP_TIER_NVME_MMAP: nx_int = 4 // mmap'd file (cold but local)
25const NX_TP_TIER_SSD_FILE: nx_int = 5
26const NX_TP_TIER_HDD_FILE: nx_int = 6
27const NX_TP_TIER_NETWORK_PEER: nx_int = 7 // colder than disk
28const NX_TP_TIER_N: nx_int = 8
32const NX_TP_V_OK: nx_int = 0
33const NX_TP_V_PROMOTED: nx_int = 1
34const NX_TP_V_DEMOTED: nx_int = 2
35const NX_TP_V_NO_BUDGET: nx_int = 3 // target tier exceeded budget
36const NX_TP_V_REFUSED_HOTLOCK: nx_int = 4 // tensor pinned to current tier
37const NX_TP_V_INVALID: nx_int = 5
38const NX_TP_V_NULL: nx_int = 6
39const NX_TP_V_N: nx_int = 7
53const NX_TP_P_BYTES: nx_int = 56
67const NX_TP_BYTES: nx_int = 64

functions

71func nx_tp_tier_is_valid(t: nx_int) -> nx_int
77func nx_tp_v_is_valid(v: nx_int) -> nx_int
called by 1: main
83func nx_tp_tier_is_gpu(t: nx_int) -> nx_int
called by 1: main
89func nx_tp_tier_is_cpu_memory(t: nx_int) -> nx_int
called by 1: main
95func nx_tp_tier_is_cold(t: nx_int) -> nx_int
called by 1: main
105func nx_tp_new(capacity: nx_int,
called by 2: mainmain calls 1: sys_mmap
125func _tp_at(r: *NxPlacementRegistry, idx: nx_int) -> *NxTensorPlacement
132func nx_tp_register(r: *NxPlacementRegistry,
called by 2: mainmain calls 1: nx_tp_tier_is_valid
155func nx_tp_find(r: *NxPlacementRegistry, tensor_id: nx_int) -> *NxTensorPlacement
168func nx_tp_pin(r: *NxPlacementRegistry, tensor_id: nx_int) -> nx_int
called by 1: main calls 1: nx_tp_find
176func nx_tp_unpin(r: *NxPlacementRegistry, tensor_id: nx_int) -> nx_int
called by 1: main calls 1: nx_tp_find
186func nx_tp_bytes_in_tier(r: *NxPlacementRegistry, tier: nx_int) -> nx_size
198func nx_tp_count_in_tier(r: *NxPlacementRegistry, tier: nx_int) -> nx_int
called by 2: mainmain calls 1: _tp_at
210func _tp_budget_for_tier(r: *NxPlacementRegistry, tier: nx_int) -> nx_size
222func nx_tp_touch(r: *NxPlacementRegistry, tensor_id: nx_int, now_us: nx_size) -> nx_int
called by 1: main calls 1: nx_tp_find
237func nx_tp_promote(r: *NxPlacementRegistry,
256func nx_tp_demote(r: *NxPlacementRegistry,
called by 1: main calls 2: nx_tp_tier_is_validnx_tp_find
275func nx_tp_tier_pressure_q10(r: *NxPlacementRegistry, tier: nx_int) -> nx_int