interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / gpu / nvidia / driver / DEVICE.md

77 lines · 7447 bytes Raw Blame History Source

gpu/nvidia/driver: what the device side needs

client.om decides every driver command of the client's setup and teardown; it sends none. Each command is a dx_ effect. On the host gate fx.om answers the effects from a script and records them, and seqgate.om compares the record with the C oracle (README.md, "The sequence gate"). No device part that answers the effects with real ioctls exists yet, and nothing here has run on a GPU: the hardware tier is NOT_RUN.

This file says, for each effect and for each C function still marked device shell in coverage.tsv, what it needs from the machine, and which part of it the host can check.

The effects of client.om

The existing Omega GB10 client gpu/nvidia/native/nvrm/context.om already sends most of these commands for its single-channel client: nvalc (RM_ALLOC), nvctrl (RM_CONTROL), nvfree (RM_FREE), nvcpumap (map an RM object into the process), nvdrop, and the UVM calls of nvstart and nvchan. The request bytes are struct.om, wire.om, wire_pack.om, uvm_wire.om and uvm_map_wire.om.

EffectCommand on the deviceNeeds from the machineHost-checkable part, and where
dx_admit_openadmission of a new clientthe process's admission statethe decision is the caller's (nvrm_open ordering, client.om)
dx_slot, dx_recycletake and give back a per-client VA slotan atomic slot counter shared between clientsslot successor alloc_scalar.om (mode 0), cover policy.om nvrm_vcover
dx_fopen, dx_fcloseopen and close /dev/nvidiactl and /dev/nvidia-uvmthe device nodeswhich nodes, in which order, and when to close: client.om
dx_opendevopen /dev/nvidiaN and register the fd with the control fdthe device node; NV_ESC_REGISTER_FDclient.om (minor from the card table, card.om)
dx_alloc, dx_freeNV_ESC_RM_ALLOC, NV_ESC_RM_FREEthe RM; request bytes wire_pack.omhandles, classes, parents and request fields: client.om
dx_ctrlNV_ESC_RM_CONTROLthe RMcommand numbers and fields: client.om
dx_uvm, dx_uvmrawUVM ioctls (INITIALIZE, MM_INITIALIZE, REGISTER_GPU, REGISTER_GPU_VASPACE, REGISTER_CHANNEL and their unregisters)/dev/nvidia-uvmwhich call, with which fields, in which order: client.om; bytes uvm_wire.om
dx_ioctlNV_ESC_CARD_INFO on the control fdthe driver's card tablethe card choice card.om drv_card
dx_cardidx, dx_admit_card, dx_cardgetread the card table answerthe CARD_INFO answercard.om
dx_nsgetread one field of the last RM answerthe answer bytesfield layout struct.om
dx_selectpick the target SM, the discrete flag and the compute, GPFIFO and usermode classes from the RM's class listthe class list the RM returnedcard.om drv_select (gated)
dx_mapNV_ESC_RM_MAP_MEMORY plus mmap of the device node at a fixed addressthe RM and the kernel's mmapflags, target and size: client.om
dx_reserve, dx_dropreserve and release the CPU range (mmap PROT_NONE, munmap)the kernelsizes and order: client.om
dx_transfer, dx_finishhand a mapping to the client's mapping context, and close the contextcontext.om mapping statecontext.om
dx_vatake, dx_vareltake and release GPU VA inside the slotthe slot rangealloc.om (the release refusal faults the client: client.om cn_varel)
dx_uvmmap, dx_uvmfree, dx_dmaunmapUVM_CREATE_EXTERNAL_RANGE, UVM_MAP_EXTERNAL_ALLOCATION, UVM_FREE, the RM DMA unmap/dev/nvidia-uvm, the RMwhich to undo after a partial map: client.om cn_alloc and cn_free
dx_validatecheck an Ampere pushbuffer before it is publisheda CPU mapping of the pushbufferalloc_push.om with the amp_runtime policy
dx_publishwrite one GP entry and GPPut through the ring mappingthe mapped ring and USERDpolicy.om nvrm_gpentry; slot and put arithmetic client.om
dx_doorbellwrite the work-submit token to the usermode doorbellthe mapped usermode pagewhen a refusal faults the client: client.om cn_ring
dx_sleepwait before a retried compute-object allocationa clockthe retry decision policy.om nvrm_retry
dx_zerozero a new allocation through its CPU mappingthe CPU mappingsize: client.om
dx_errnothe last system error numberthe kernel's answernone

C functions still marked device shell

coverage.tsv has 29 such rows. Each one is the machine side of an effect above, a clock or barrier instruction, or a wrapper with no decision of its own.

C functionNeeds from the machineHost-checkable part
nvrm.c omega_gpu_live_markerthe context.om mapping token of a live allocationthe lookup itself is context.om
nvrm.c failwrites the message text into the clientwhich message: the code client.om returns (ER events, gated); the text is not compared
nvrm.c nv_ioctlthe ioctl system callnone
nvrm.c rm_alloc, rm_free, rm_control, dma_unmap_checkedthe RM ioctlsrequest bytes wire_pack.om; when each is sent client.om
nvrm.c uvm_free_checkedthe UVM_FREE ioctlwhen it is sent client.om
nvrm.c uvmthe UVM ioctlsbytes uvm_wire.om; when each is sent client.om
nvrm.c open_dev_fdopen and NV_ESC_REGISTER_FDclient.om (dx_opendev)
nvrm.c map_to_cpuRM_MAP_MEMORY and mmap at a fixed addressflags and size client.om (dx_map)
nvrm.c uvm_mapthe UVM range and map ioctlswhich to undo on a refusal, through the answer code: client.om cn_alloc
nvrm.c nvrm_userd_gpputthe address of GPPut inside the ring mappingthe offset is userd in the client state
cpu_barrier.h nvrm_cpu_barrier, nvrm_cpu_relaxthe barrier and yield instructionsnone
native_client.h nvrm_native_okstatus and result of a context callnone
native_client.h nvrm_file_open, nvrm_file_close, nvrm_rm_ioctl, nvrm_uvm_ioctl, nvrm_cpu_reserve, nvrm_cpu_map, nvrm_cpu_dropopen, close, ioctl, mmap and munmap through the contextthe context state machine context.om
nvrm_policy.h nvrm_om_callcalls the Omega policy unit from Cthe policy policy.om (gated elsewhere)
m16_gpu_wait.c real_now_ns, m16_native.c now_nsthe monotonic clockthe deadline arithmetic m16.om drv_wdur, drv_wend (gated)
m16_gpu_wait.c real_barrier, real_relaxbarrier and yield instructionsnone
m16_native.c m16_native_submit_methodscopies the caller's method words into the mapped pushbufferthe count bound m16.om drv_enqok (gated), then nvrm_enqueue and nvrm_ring, which are client.om cn_enqueue and cn_ring (gated)

To run it on the GPU

gpu/nvidia/driver/device.om now implements every dx_ effect of fx.om in pure seeded Omega using omc's checked Linux device words (fopen, fclose, devctl, devcall, uvmctl, mapnew, mapbind, mapdrop, mapget, mapset, cpufence, cpurelax, sleepns), composed with client.om in place of fx.om. gpu/nvidia/driver/device_test.om verifies the host-safe VA slot allocator, chip selection, invalid-fd fail-closed refusals, and cn_open unwind without opening /dev/nvidia*. Live execution on physical GB10 silicon under an authorized spark-window remains NOT_RUN.