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

Run the corrected pure Omega two-Spark FP32 AllReduce experiment

open 6da26256650acf9b opened 2026-11-20 by z6MktvMGgxSZ19NQ...

1 commit · 8 files · 46384 bytes. Base f926452ad0ba999e1134c64b2a35f132edfed6ad. Applied head cfd23046e170b3bd8063702f2a5527750345650f: the last commit this forge's own git am made on the base. It is in no repository; the owner applies the patch by hand.

Two-Spark researchers can run a deterministic TP=2 FP32 collective on two preconfigured direct RoCE links using Omega for both the Linux uverbs rank and the mapped queue hot path. The rank exchanges endpoint setup over a private duplex channel. Transfers use one signalled RDMA_WRITE per rail, followed by ready and consumed epoch notifications. Includes an AArch64 host fixture, topology lookup launcher and hardware runbook.

Source head 290e4d263ecb503d399f2e458fb0130c231fe5df. The following commands ran on AArch64 Linux with device nodes hidden for the host fixture.

```sh
sh seed/omega-from-seed.sh
cat native/connectx7/tp2.om native/connectx7/host.om | seed/out/omc > cx7-host
cat native/connectx7/tp2.om native/connectx7/rank.om | seed/out/omc > cx7-rank
chmod +x cx7-host cx7-rank
bwrap --ro-bind / / --dev /dev strace -qq ./cx7-host
```

Seed fixpoint 210c52566e782cf15ece6e478d45bfb67f1ad338f29e41546dad9b6c4f85b54c. Host exit 0. Trace had exec, six anonymous setup mappings, then exit(0). Wrong lkey, early inbox reuse and stale CQ consumer DB mutants exited 24, 65 and 48. An offline command-frame oracle exercised both rank handshakes through RTS. The archive rebuilt both executables byte-for-byte. Repository checks `tests/gates/run.sh evidence-immutable` and `tests/gates/run.sh zero-disk-secrets` passed.

The standalone hardware candidate targets the Linux mlx5 legacy write ABI on 4 KiB AArch64 hosts. Actual ConnectX-7 acceptance, GPU-buffer visibility and an NCCL comparison remain NOT_RUN. The researcher should return both correctness results and per-rail counters.


This corrected proposal supersedes 4225f49569820ac9. CQE v0 QP creation supplies MLX5_IB_DEFAULT_UIDX at offset 96. The shipped rank's device-free --self-test exercised a terminal CQE and reported rail 0, opcode 13, syndrome 19, vendor syndrome 37, then exited 0. Changing that field to zero made the self-test exit 71. Both rank outputs are captured separately by the researcher procedure.

Interplane proposal-store base f926452ad0ba999e1134c64b2a35f132edfed6ad differs from public Git base fd135e8708061cdd0d1209b1820c61d31c6f1861. The eight changed paths contain the same feature and credits. Every native/connectx7 file is byte-identical on proposal head 9afda9b0219ee86bb9f3c772d6f410cae2a5c415 and public staging head 290e4d263ecb503d399f2e458fb0130c231fe5df. The proposal compiler rebuilt both executables byte-for-byte. Public staging branch codex/cx7-tp2-omega.

Researcher archive SHA-256 7e4d1e078db5c1c3cdf18f17b1b4ec02f7fcdcf5dec55ac7ebcabde124d01ff5. Hardware acceptance and GPU visibility are pending a two-Spark researcher run.

Apply it

git checkout -b patch-6da26256650acf9b f926452ad0ba999e1134c64b2a35f132edfed6ad
curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/6da26256650acf9b.patch | git am

Raw patch (mbox) · Diff

Signature

The author's key did:key:z6MktvMGgxSZ19NQkrvXG6aRzjbFA1yBa2KJmmA9pSTJCiEZ signed this statement with ssh-keygen -Y sign -n interplane-patch; the forge checked the signature before it kept the patch. The lines are: format, repository, base, SHA-256 of the mbox, SHA-256 of the title, a line feed and the description.

interplane-patch 1
drakestapleton/omega-mv
f926452ad0ba999e1134c64b2a35f132edfed6ad
cc20995a82a11b9fec1a3fb0459afd7cd880b8cdbf3a23c42a934d590445e1f3
172a0f48b75632196d8fa23a41ba4a1b1131e884fcbaf5f8661d74b5e605389c
-----BEGIN SSH SIGNATURE-----
U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAg1vQ1KtWtuW5PISxEahQt4AgcBw
syuwQ4l2Qd7RBTSZ4AAAAQaW50ZXJwbGFuZS1wYXRjaAAAAAAAAAAGc2hhNTEyAAAAUwAA
AAtzc2gtZWQyNTUxOQAAAEAiDD0X0j5EOEC8G+3sQhhdrl3IPDcMZbTIUOcm90DOsDZ4uy
WJKYZIulgYZMvMypcShapM54IIIShKWUi9JpoJ
-----END SSH SIGNATURE-----

Changes

diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index a83ffa8a1e65bb2fb839aae41eaa51717a567d90..a478982097013ac05001d86d6e28c2439358a46d 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -376,3 +376,4 @@ Update this table in the same commit as the work it credits.
 | Codex (under Drake Stapleton's direction) | Rewrote lexical scope destruction in Omega, including nested borrow closure, conditional owner release, arena escape and pool teardown. |
 | Codex (under Drake Stapleton's direction) | Converted OSC handle provenance, stale read/write/free decisions, branch snapshots and loop settlement to seeded Omega. |
 | Codex (under Drake Stapleton's direction) | Converted OSC owner and borrow snapshots, rollback of fresh borrows, branch joins and move replay to seeded Omega. |
+| Codex (under Drake Stapleton’s direction) | Implemented the pure Omega dual-rail mlx5 TP=2 FP32 AllReduce with its Linux uverbs research runner and two-rank AArch64 host fixture in `native/connectx7/`. |
diff --git a/FOLDERS.md b/FOLDERS.md
index d7c28d8721ad6a4fafccfff89b35df248e1af268..b0ef1d6c3e019f7f6dd155bd60c2dd04bd29bd74 100644
--- a/FOLDERS.md
+++ b/FOLDERS.md
@@ -205,6 +205,10 @@ Handwritten .om units of omega-mv that are not part of the seed ladder: the ORIG
 
 Bounded native .om reverse-mode tape (rank 2, f32, 32 nodes) over M20 metadata-v1; E1-tile reductions and C M21 accumulation order (#664, not qualified)
 
+## `native/connectx7/`
+
+Seeded Omega TP=2 FP32 AllReduce over two preconfigured mlx5 RC rails, with a device-free host fixture, an experimental Linux uverbs rank executable, and a two-Spark researcher runbook.
+
 ## `native/orig4/`
 
 ORIG-4 shadow advice for the matvec arm chooser (omega-mv#731, spec/shadow-advice-v0.md): shadow.om advisor unit, shadowmain.om entry, orig4.pin, immutable ORIG-2 candidate images. Default off; advice only, never a decision.
diff --git a/native/connectx7/README.md b/native/connectx7/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..00da05f55db8f869d62358c90540b7145a17f557
--- /dev/null
+++ b/native/connectx7/README.md
@@ -0,0 +1,39 @@
+# Two-Spark FP32 AllReduce
+
+`tp2.om` is a seeded OM-2 data path for two ranks with two reliable-connected mlx5 queue pairs per rank. Both ranks split an activation on the same FP32 element boundary. The first rail gets the extra element when the length is odd. Each sends its half-stripes directly from the registered activation into the peer's registered inbox. Both CPUs sum rank 0 plus rank 1 in place. The only CPU copy of tensor data in the hot path is the local reduction's pair of 256-byte scratch tiles and the result writeback.
+
+For each rail, Omega encodes a signalled, single-SGE RDMA_WRITE in one 64-byte WQEBB. It publishes the producer DB record, then writes the first eight descriptor bytes to the alternating private BlueFlame doorbell halves. The device fetches the descriptor from the SQ. Ordered `mapset` provides AArch64 barriers around both stores. Polling reads the ownership byte, issues a CPU fence after acquisition, checks CQE format, opcode, SQ number and WQE counter, and publishes the CQ consumer DB. This implementation keeps one signalled write in flight per rail.
+
+For a two-Spark hardware run, use the packaged rank executable and the [researcher runbook](RESEARCHER.md).
+
+## Cold-path handoff
+
+The caller supplies live resources in the **same Omega process and mapping context**. Linux mlx5 remains responsible for pinning, translation, QP setup and UAR mapping. The experimental `rank.om` executable performs this setup using the Linux uverbs write ABI. Its first hardware run and the Blackwell buffer integration are outstanding. An integer address from a different process cannot stand in for an Omega mapping handle.
+
+- Set up two exclusively owned RTS RC QPs to the other rank, one through each cable. Choose different PCIe domains as well as different physical ports. On the documented topology, `rocep1s0f0` and `roceP2p1s0f1` are one such pair. Verify the route and port correspondence on both hosts. [DGX Spark networking](https://docs.nvidia.com/dgx/dgx-spark/spark-clustering.html)
+- Hand over fresh SQs, private doorbell apertures and dedicated polled send CQs with standard, uncompressed 64- or 128-byte entries. Disable WQE signatures. Only this polling thread may post, poll or use either UAR. The two rails may have the same QPN in different device namespaces. [mlx5 posting](https://github.com/linux-rdma/rdma-core/blob/v58.0/providers/mlx5/qp.c) and [mlx5 CQ polling](https://github.com/linux-rdma/rdma-core/blob/v58.0/providers/mlx5/cq.c)
+- In each `CxQueue`, supply live read/write handles and byte offsets for `sq/sqoff`, `cq/cqoff`, `db[0]/dboff[0]` (send producer record) and `db[1]/dboff[1]` (CQ set-CI record). Supply the WQEBB count, physical CQ slot count, CQE stride, local QPN, and `bf/bfoff/half` from the provider. Both doorbell halves must be mapped. Start `pi`, `ci` and `busy` at zero, BF on its first half, and all CQEs initialized invalid. The adapter must verify the full mapping spans and exclusive ownership before handoff.
+- Allocate one pinned, CPU-readable/writable arena per rank with ordinary ordered, coherent host DMA and aligned, indivisible four-byte notification writes. Register **the same pages** in both rails' protection domains for remote writes. Disable relaxed-ordering registration. Set `CxRank.arena` to the mapping handle and `capacity` to the common FP32 element capacity. Set each rail's `localva/lkey` and `peerva/rkey` to its actual registered IOVA/key pair. An IOVA may differ from the process address. Set each `limit` to the negotiated maximum single-message byte count.
+- The arena contains `capacity * 4` activation bytes, the same size inbox, then five aligned little-endian uint32 words in order: outbound epoch, incoming ready on rails 0 and 1, incoming acknowledgment on rails 0 and 1. Initialize the five words, rank epoch and active state to zero **once** before admitting either endpoint. Keep the layout fixed for the QPs' lifetime. Set `rankid` to 0 or 1. Both peers must agree on capacity, element count, FP32 representation and collective sequence.
+- For GPU-produced inputs, independently register or map these exact pages for the GPU and establish GPU producer completion and system visibility before starting. After the collective, establish visibility for the consuming kernel using the supported driver contract. Shared physical LPDDR5X alone does not establish these properties.
+
+## Calling the collective
+
+Concatenate `tp2.om` and the caller, then compile the combined source with seeded `omc`. Call `cxBegin rank left right elements` once per epoch. It returns 0 on admission and -1 on refusal. Repeatedly call `cxProgress rank left right` with the same objects. Return 0 means pending, 1 means the local result is available and this rank may begin its next collective, and -1 means idle or failed. A CQ failure latches the rank in a failed state and retains the offending CQE. Quiesce both peers and reconstruct resources on a terminal failure or timeout. Never replay a partially posted epoch onto the same queues. Reinitialize the session before the 32-bit epoch would repeat.
+
+On each rail, data writes precede a separate epoch write into the peer's ready word. An observed peer-ready word and retired local sends permit reduction. The receiver then writes its acknowledgment, permitting its peer to reuse that inbox. The two rails make independent progress. Empty stripes still participate in the handshake. The caller owns deadlines and cancellation and can insert `cpurelax` between progress calls.
+
+## Host check
+
+From the repository root on AArch64 Linux:
+
+```sh
+sh seed/omega-from-seed.sh
+cat native/connectx7/tp2.om native/connectx7/host.om | seed/out/omc > /tmp/cx7-host
+chmod +x /tmp/cx7-host
+strace -qq /tmp/cx7-host
+```
+
+Success is exit 0. The trace contains exec, six anonymous setup mappings and exit. The fixture decodes posted wire bytes, checks both doorbell halves, copies data between the two rank arenas and produces matching CQEs. It exercises delayed delivery, inbox reuse, empty/odd/even lengths, multiple chunks, guard elements, SQ/CQ wrap, owner mismatch, error CQEs, wrong QPN, wrong counter and compressed format.
+
+**Hardware qualification — NOT_RUN.** This host fixture cannot establish device acceptance, coherent GPU/NIC access to the same pages or link throughput. For a two-Spark qualification, record per-port traffic, a bitwise result check on a GPU-produced and GPU-consumed activation, and end-to-end time against NCCL with the same tensor, topology and synchronization boundaries.
diff --git a/native/connectx7/RESEARCHER.md b/native/connectx7/RESEARCHER.md
new file mode 100644
index 0000000000000000000000000000000000000000..1651e57b00d4d4f34b1f35bbddbe4982e672b84a
--- /dev/null
+++ b/native/connectx7/RESEARCHER.md
@@ -0,0 +1,58 @@
+# Run the two-Spark transport experiment
+
+**Result sought:** two ConnectX-7 queue pairs complete a bidirectional FP32 AllReduce across two direct cables, and both ranks verify every result bit. The supplied rank fills and checks a CPU-pinned arena on each host. GPU producer/consumer visibility requires the separate experiment below.
+
+## Before the first run
+
+Use two AArch64 DGX Sparks with two 200 Gb/s cables, a 4 KiB host page, active RoCEv2 routes on opposite physical ports and PCIe domains, and an operator-approved hardware window. The rank supports ConnectX-7 PCI device ID 0x1021, standard CQE v0, private alternating UARs, and Linux uverbs legacy write commands. It requires permission to open both uverbs devices and enough locked memory for the arena and both queue sets. It needs no CUDA, NCCL, libibverbs or libmlx5 in userspace. The kernel mlx5 drivers remain dependencies.
+
+On each machine unpack the same archive into a user-owned directory. From its root:
+
+```sh
+sha256sum -c SHA256SUMS
+./cx7-host && echo 'PASS device-free fixture'
+./cx7-rank --self-test    # injects one CQ error and must finish with PASS
+getconf PAGESIZE
+ulimit -l
+ibdev2netdev
+show_gids
+```
+
+Select one active **RoCE v2** GID index for `rocep1s0f0` (left port, PCI domain 0) and one for `roceP2p1s0f1` (right port, domain 2) **on each host**. Choose GIDs for the configured addresses on the corresponding direct links. Match left-to-left and right-to-right cables for this launcher. Verify link state, cable rate and routing independently. Keep those four indices for the command below. [NVIDIA port correspondence](https://docs.nvidia.com/dgx/dgx-spark/spark-clustering.html)
+
+To rebuild both static executables from the included Omega source and compiler:
+
+```sh
+cat tp2.om host.om | ./omc > cx7-host.rebuilt
+cat tp2.om rank.om | ./omc > cx7-rank.rebuilt
+cmp cx7-host cx7-host.rebuilt && cmp cx7-rank cx7-rank.rebuilt
+```
+
+## Run one collective
+
+Install `socat` on rank 0 and use an existing SSH login to rank 1. The example assumes the archive contents are in `~/cx7-lab` on both machines. Replace `spark-peer` and all four GID indices with the values for this setup. Run from Bash on rank 0. SSH carries only endpoint setup and synchronization. The Omega executable posts the tensor transfers through the NIC queues.
+
+```bash
+cd ~/cx7-lab
+peer=spark-peer
+left0=3; right0=3
+left1=3; right1=3
+elements=4097
+logs=$(mktemp -d)
+socat "SYSTEM:timeout 90 ./run-rank.sh 0 $elements $left0 $right0 2>$logs/rank0" \
+      "SYSTEM:ssh -T -o BatchMode=yes $peer timeout 90 ./cx7-lab/run-rank.sh 1 $elements $left1 $right1 2>$logs/rank1"
+cat "$logs/rank0" "$logs/rank1"
+grep -Eq "^CX7 PASS host-pinned FP32 rank=0 elements=$elements elapsed_ns=[0-9]+$" "$logs/rank0" &&
+grep -Eq "^CX7 PASS host-pinned FP32 rank=1 elements=$elements elapsed_ns=[0-9]+$" "$logs/rank1" &&
+echo 'PASS both ranks'
+```
+
+Record both rank lines. Each time spans admission through remote acknowledgments. Initialization, final checking and SSH barriers lie outside that interval. The run uses one signalled write in flight per physical rail and reduces in CPU tiles. Use a fresh pair of processes after any timeout or error. Exit stages 10–17 cover context, identity, port, PD and MR setup. Stages 18–22 cover CQ, QP and UAR setup, 23–25 cover INIT/RTR/RTS and 26–30 cover peer exchange. Exit 32 reports the rail, opcode, format, WQE counter, SOP/QPN and error syndromes for a failed CQE and 33 reports the first incorrect element. Report the stage and signed kernel result or offending index. Permission, memlock, ABI, GID and path-MTU problems can surface before posting.
+
+## Evidence to return
+
+Record the archive digest, source commit, firmware, kernel, cable rates, selected Ethernet/RoCE devices and PCIe domains. Keep live endpoint records and MR keys inside the private control channel. Run empty, single-element, odd and representative production-size tensors. On an otherwise idle fabric, collect each selected port's `port_xmit_data` and `port_rcv_data` before and after the run from `/sys/class/infiniband/DEVICE/ports/1/counters/`. Save both times and both correctness verdicts. A successful host fixture alone establishes no hardware result.
+
+For a throughput comparison, repeat each shape, retain the distribution and report the slower rank. Distinguish per-rank useful FP32 bytes from summed interface counters. Run the installed NCCL baseline at the same sizes, dtype, rank count, routes and synchronization boundaries. Report its memory path and warm-up separately.
+
+For the unified GPU-buffer claim, integrate `tp2.om` with the Blackwell launcher's supported pinned-page registration and producer/consumer fences. Have the GPU write a known activation directly into the MR, retire that producer before `cxBegin`, then have the GPU consume and verify the in-place result after `cxProgress` returns 1. Record the CPU mapping, GPU registration and both NIC registrations as referring to the same allocation, without publishing live keys. Repeat with changing activation patterns. The supplied standalone binary exercises the host-pinned NIC transport only.
diff --git a/native/connectx7/host.om b/native/connectx7/host.om
new file mode 100644
index 0000000000000000000000000000000000000000..fa62dff7f16c033060985de3f3b34b915ec9808c
--- /dev/null
+++ b/native/connectx7/host.om
@@ -0,0 +1,293 @@
+note Device-free oracle. Each simulated HCA fetches wire bytes and owns an independent consumer counter.
+fn testCheck ok bool code int to void
+if not ok
+exit code
+end
+end
+
+fn testMap to long
+h = mapnew -1 0 4096 3 34
+testCheck gt h 0 10
+ret h
+end
+
+fn testQueue q edit CxQueue number uint stride ulong to void
+h = testMap
+put q sq h
+put q cq h
+put q db 0 h
+put q db 1 h
+put q bf h
+put q dboff 0 16
+put q dboff 1 20
+put q qpn number
+put q stride stride
+note Device WQ consumer and producer DB begin near 16-bit roll-over.
+put q pi 65534
+put q ci 0xfffffe
+status = mapset h 0 8 65534
+status = mapset h 16 4 0xfeff0000
+b = new uchar 64 0
+put b 63 0xf0
+for i ulong 2
+pos = add get q cqoff mul i stride
+status = mapwrite h add pos sub stride 64 b 0 64
+end
+end
+
+fn testRank a edit CxRank other view CxRank to void
+for rail ulong 2
+put a localva rail add mapaddr get a arena mul rail 4096
+put a peerva rail add mapaddr get other arena mul rail 4096
+put a lkey rail add add uint 0x11223300 uint rail uint get a rankid
+put a rkey rail add add uint 0xaabbcc00 uint rail uint get other rankid
+end
+end
+
+fn testBE b view uchar 64 offset ulong size ulong to ulong
+v = ulong 0
+for i ulong size
+v = or shl v 8 ulong get b add offset i
+end
+ret v
+end
+
+fn testPayload w view uchar 64 a view CxRank peer view CxRank rail ulong to void
+bytes = testBE w 32 4
+src = sub testBE w 40 8 get a localva rail
+dst = sub testBE w 16 8 get a peerva rail
+testCheck eq testBE w 36 4 ulong get a lkey rail 24
+testCheck eq testBE w 24 4 ulong get a rkey rail 25
+testCheck le bytes ulong get a limit rail 26
+note Independent oracle accepts only the advertised peer inbox or the rail's own ready/ack word.
+flags = mul get a capacity 8
+if eq src flags
+ready = add add flags 4 mul rail 4
+testCheck and eq bytes 4 or eq dst ready eq dst add ready 8 27
+else
+testCheck eq dst add mul get a capacity 4 src 28
+testCheck ge src get a start rail 29
+testCheck le add src bytes get a finish rail 30
+end
+buf = new uchar 256 0
+n = mapread get a arena src buf 0 bytes
+n = mapwrite get peer arena dst buf 0 bytes
+end
+
+fn testCqe q view CxQueue seq ulong to void
+b = new uchar 64 0
+qnum = get q qpn
+put b 56 8
+put b 57 uchar and shr qnum 16 255
+put b 58 uchar and shr qnum 8 255
+put b 59 uchar and qnum 255
+put b 60 uchar and shr seq 8 255
+put b 61 uchar and seq 255
+ci = add ulong 0xfffffe sub seq 65534
+put b 63 uchar and div ci 2 1
+stride = get q stride
+base = add get q cqoff mul rem ci 2 stride
+n = mapwrite get q cq add base sub stride 64 b 0 64
+end
+
+fn testFetch q view CxQueue w edit uchar 64 seq ulong to void
+h = get q sq
+pos = add get q sqoff mul rem seq 2 64
+n = mapread h pos w 0 64
+testCheck eq testBE w 0 4 or shl and seq 0xffff 8 8 20
+testCheck eq testBE w 4 4 or shl ulong get q qpn 8 3 21
+testCheck eq get w 11 8 22
+door = add get q bfoff mul rem seq 2 get q half
+testCheck eq mapget h door 8 mapget h pos 8 23
+for i ulong 64
+if or and ge i 8 lt i 11 and ge i 12 lt i 16
+testCheck eq get w i 0 31
+end
+if or and ge i 28 lt i 32 ge i 48
+testCheck eq get w i 0 31
+end
+end
+end
+
+fn testHca q view CxQueue a view CxRank peer view CxRank rail ulong to void
+h = get q sq
+seq = mapget h 0 8
+db = new uchar 64 0
+n = mapread h 16 db 0 4
+posted = testBE db 0 4
+if eq posted and seq 0xffff
+ret
+end
+testCheck eq posted and add seq 1 0xffff 19
+w = new uchar 64 0
+testFetch q w seq
+testPayload w a peer rail
+testCqe q seq
+n = mapset h 0 8 add seq 1
+end
+
+fn testFill a view CxRank factor f32 to void
+for i ulong get a capacity
+value = mul f32 add i 1 factor
+s = mapset get a arena mul i 4 4 ulong bitcast uint value
+end
+end
+fn testSum a view CxRank elements ulong factor f32 to void
+for i ulong get a capacity
+scale = factor
+if lt i elements
+scale = 11.0f32
+end
+ref = mul f32 add i 1 scale
+v = mapget get a arena mul i 4 4
+testCheck eq v ulong bitcast uint ref 35
+end
+end
+
+fn testLoop a edit CxRank b edit CxRank al edit CxQueue ar edit CxQueue bl edit CxQueue br edit CxQueue to void
+for tick ulong 1000
+if eq get a active 1
+st = cxProgress a al ar
+testCheck ge st 0 40
+end
+if eq get b active 1
+st = cxProgress b bl br
+testCheck ge st 0 41
+end
+testHca al a b 0
+testHca bl b a 0
+if gt tick 12
+testHca ar a b 1
+testHca br b a 1
+else
+testCheck and eq get a active 1 eq get b active 1 42
+end
+if and eq get a active 0 eq get b active 0
+ret
+end
+end
+exit 43
+end
+
+note Withhold one remote acknowledgment while delivering its local send completion.
+note The other rank can finish. This rank must retain its old epoch until the delayed word arrives.
+fn testAck a edit CxRank b edit CxRank al edit CxQueue ar edit CxQueue bl edit CxQueue br edit CxQueue to void
+testCheck eq cxBegin a al ar 0 0 60
+testCheck eq cxBegin b bl br 0 0 61
+for tick ulong 40
+if eq get a active 1
+st = cxProgress a al ar
+testCheck ge st 0 62
+end
+if eq get b active 1
+st = cxProgress b bl br
+testCheck ge st 0 63
+end
+testHca al a b 0
+testHca ar a b 1
+testHca bl b a 0
+testHca br b a 1
+if eq get b phase 1 2
+offset = add mul get a capacity 8 16
+rc = mapset get a arena offset 4 ulong sub get a epoch 1
+end
+end
+testCheck eq get b active 0 64
+testCheck eq get a active 1 65
+testCheck eq cxBegin a al ar 1 -1 66
+testCheck eq cxBegin b bl br 1 0 67
+st = cxProgress b bl br
+testCheck eq st 0 68
+testHca bl b a 0
+testHca br b a 1
+offset = add mul get a capacity 8 16
+rc = mapset get a arena offset 4 ulong get a epoch
+testCheck eq cxProgress a al ar 1 69
+testCheck eq cxBegin a al ar 1 0 70
+testLoop a b al ar bl br
+end
+
+fn testDb q view CxQueue to void
+b = new uchar 64 0
+n = mapread get q db 1 get q dboff 1 b 0 4
+testCheck eq testBE b 0 4 and get q ci 0xffffff 48
+end
+
+fn testBad q edit CxQueue a view CxRank kind int to void
+rc = cxPost q a 0 0 0 4
+testCheck eq rc 0 50
+testCheck eq cxPost q a 0 0 0 4 -1 51
+seq = sub get q pi 1
+testCqe q seq
+pos = cxCqePos q
+b = new uchar 64 0
+n = mapread get q cq pos b 0 64
+tag = get b 63
+put b 63 xor tag 1
+n = mapwrite get q cq pos b 0 64
+testCheck eq cxPoll q 0 52
+put b 63 tag
+if eq kind 0
+put b 63 or tag 0xd0
+end
+if eq kind 1
+put b 59 xor get b 59 1
+end
+if eq kind 2
+put b 61 xor get b 61 1
+end
+if eq kind 3
+put b 63 or tag 12
+end
+n = mapwrite get q cq pos b 0 64
+testCheck eq cxPoll q -1 53
+testCheck eq get q busy -1 54
+end
+
+fn main to int
+a = new CxRank 0 135 0 0 0 0 132 0 0 0 0 0 0 0
+b = new CxRank 0 135 0 0 0 0 132 1 0 0 0 0 0 0
+al = new CxQueue 0 64 2 0 256 2 64 0 0 0 640 256 0 0 0 0
+ar = new CxQueue 0 64 2 0 256 2 64 0 0 0 640 256 0 0 0 0
+bl = new CxQueue 0 64 2 0 256 2 64 0 0 0 640 256 0 0 0 0
+br = new CxQueue 0 64 2 0 256 2 64 0 0 0 640 256 0 0 0 0
+testQueue al 0x123456 64
+testQueue ar 0x234567 128
+testQueue bl 0x345678 128
+testQueue br 0x456789 64
+put a arena testMap
+put b arena testMap
+testRank a b
+testRank b a
+testCheck eq cxBegin a al ar 136 -1 11
+put a peerva 1 0xfffffffffffffffc
+testCheck eq cxBegin a al ar 5 -1 16
+testRank a b
+put ar stride 32
+testCheck eq cxBegin a al ar 5 -1 12
+put ar stride 128
+for run ulong 5
+elements = run
+if eq run 3
+elements = ulong 135
+end
+testFill a 1.0f32
+testFill b 10.0f32
+testCheck eq cxBegin a al ar elements 0 13
+testCheck eq cxBegin a al ar elements -1 14
+testCheck eq cxBegin b bl br elements 0 15
+testLoop a b al ar bl br
+testSum a elements 1.0f32
+testSum b elements 10.0f32
+end
+testAck a b al ar bl br
+testDb al
+testDb ar
+testDb bl
+testDb br
+testBad al a 0
+testBad ar a 1
+testBad bl b 2
+testBad br b 3
+ret 0
+end
diff --git a/native/connectx7/rank.om b/native/connectx7/rank.om
new file mode 100644
index 0000000000000000000000000000000000000000..b8305512d5fb0da7e2859130aecb95169b700075
--- /dev/null
+++ b/native/connectx7/rank.om
@@ -0,0 +1,615 @@
+note SPDX-License-Identifier: AGPL-3.0-only
+note Linux AArch64, 4 KiB pages, ConnectX-7 legacy write-command uAPI. One context per rail.
+note Commands include the 8-byte ib_uverbs_cmd_hdr. Payload offsets follow rdma/ib_user_verbs.h and mlx5-abi.h.
+global cxCmd uchar 256
+global cxReply long 1
+global cxFd int 2
+global cxPd uint 2
+global cxQph uint 2
+global cxCqh uint 2
+global cxBfsize uint 2
+global cxBfcount uint 2
+global cxGidIndex uchar 2
+global cxHello uchar 96
+global cxPeer uchar 96
+text cxAux "/proc/self/auxv"
+text cxPrefix "/dev/infiniband/uverbs"
+text cxUsage "usage: cx7-rank RANK ELEMENTS LEFT_UVERBS LEFT_GID_INDEX LEFT_GID RIGHT_UVERBS RIGHT_GID_INDEX RIGHT_GID\n"
+text cxSelf "--self-test"
+text cxTestPass "CX7 PASS device-free rank checks\n"
+text cxCqFail "CX7 CQ error rail="
+text cxOpcode " opcode="
+text cxVendor " vendor_syndrome="
+text cxSyndrome " syndrome="
+text cxFormat " format="
+text cxCounter " wqe_counter="
+text cxReported " sop_qpn="
+text cxFail "CX7 FAIL stage="
+text cxErr " kernel_result="
+text cxNl "\n"
+text cxPass "CX7 PASS host-pinned FP32 rank="
+text cxElems " elements="
+text cxTime " elapsed_ns="
+
+fn cxPrint v ulong to void
+b = new uchar 20 0
+i = ulong 20
+while true
+i = sub i 1
+put b i uchar add rem v 10 48
+v = div v 10
+if eq v 0
+break
+end
+end
+n = write 2 b i sub 20 i
+end
+
+fn cxFailAt code int result long to void
+n = write 2 cxFail 0 len cxFail
+cxPrint ulong code
+n = write 2 cxErr 0 len cxErr
+b = new uchar 1 45
+if lt result 0
+n = write 2 b 0 1
+cxPrint ulong neg result
+else
+cxPrint ulong result
+end
+n = write 2 cxNl 0 1
+exit code
+end
+
+fn cxNumber arg ulong largest ulong to ulong
+b = new uchar 20 0
+n = argread arg b 0 20
+if le n 0
+cxFailAt 2 n
+end
+v = ulong 0
+for i ulong ulong n
+c = get b i
+if or lt c 48 gt c 57
+cxFailAt 2 0
+end
+digit = sub ulong c 48
+if gt digit largest
+cxFailAt 2 0
+end
+if gt v div sub largest digit 10
+cxFailAt 2 0
+end
+v = add mul v 10 digit
+end
+ret v
+end
+
+fn cxCheckPage to void
+fd = fopen cxAux 0 len cxAux 0 0
+if lt fd 0
+cxFailAt 5 long fd
+end
+pair = new uchar 16 0
+while true
+n = read int fd pair 0 16
+if ne n 16
+cxFailAt 5 n
+end
+if eq get pair 0 6
+if or ne get pair 8 0 ne get pair 9 16
+cxFailAt 5 0
+end
+for i ulong 6
+if ne get pair add 10 i 0
+cxFailAt 5 0
+end
+end
+break
+end
+if eq get pair 0 0
+cxFailAt 5 1
+end
+end
+rc = fclose int fd
+end
+
+fn cxOpen arg ulong to int
+b = new uchar 64 0
+for i ulong len cxPrefix
+put b i get cxPrefix i
+end
+idx = cxNumber arg 0xffffffff
+n = argread arg b len cxPrefix sub 64 len cxPrefix
+if le n 0
+cxFailAt 2 n
+end
+fd = fopen b 0 add len cxPrefix ulong n 2 0
+if lt fd 0
+cxFailAt 3 long fd
+end
+ret int fd
+end
+
+fn cxMem size ulong to long
+h = mapnew -1 0 size 3 34
+if le h 0
+cxFailAt 4 h
+end
+ret h
+end
+
+fn cxPut offset ulong value ulong bytes ulong to void
+for i ulong bytes
+put cxCmd add offset i uchar and shr value mul i 8 255
+end
+end
+
+fn cxHdr opcode uint bytes ulong answer ulong to void
+for i ulong 256
+put cxCmd i 0
+end
+cxPut 0 ulong opcode 4
+cxPut 4 div bytes 4 2
+cxPut 6 div answer 4 2
+if ne answer 0
+cxPut 8 mapaddr get cxReply 0 8
+n = mapwrite get cxReply 0 0 cxCmd 16 answer
+end
+end
+
+fn cxSubmit rail ulong bytes ulong stage int to void
+n = write get cxFd rail cxCmd 0 bytes
+if ne n long bytes
+cxFailAt stage n
+end
+end
+
+fn cxR32 pos ulong to uint
+ret uint mapget get cxReply 0 pos 4
+end
+fn cxR8 pos ulong to uchar
+b = new uchar 1 0
+n = mapread get cxReply 0 pos b 0 1
+ret get b 0
+end
+
+fn cxHelloPut offset ulong value ulong bytes ulong to void
+for i ulong bytes
+put cxHello add offset i uchar and shr value mul i 8 255
+end
+end
+fn cxPeerGet offset ulong bytes ulong to ulong
+v = ulong 0
+for i ulong bytes
+v = or v shl ulong get cxPeer add offset i mul i 8
+end
+ret v
+end
+
+fn cxHex c uchar to uchar
+if and ge c 48 le c 57
+ret sub c 48
+end
+c = or c 32
+if and ge c 97 le c 102
+ret sub c 87
+end
+cxFailAt 2 long c
+ret 0
+end
+
+fn cxGid arg ulong rail ulong to void
+b = new uchar 39 0
+n = argread arg b 0 39
+if ne n 39
+cxFailAt 2 n
+end
+base = add 32 mul rail 40
+nonzero = uchar 0
+for i ulong 16
+pos = add mul i 2 div i 2
+if and gt i 0 eq rem i 2 0
+if ne get b sub pos 1 58
+cxFailAt 2 0
+end
+end
+v = or shl cxHex get b pos 4 cxHex get b add pos 1
+put cxHello add base i v
+nonzero = or nonzero v
+end
+if eq nonzero 0
+cxFailAt 2 0
+end
+end
+
+fn cxContext rail ulong to void
+cxHdr 0 48 80
+cxPut 16 8 4
+cxPut 20 4 4
+cxSubmit rail 48 10
+put cxBfsize rail cxR32 12
+put cxBfcount rail cxR32 16
+if or eq get cxBfcount rail 0 ne cxR8 52 0
+cxFailAt 11 0
+end
+if or ne cxR32 64 12 ne cxR32 68 1
+cxFailAt 11 1
+end
+cxHdr 1 16 176
+cxSubmit rail 16 12
+if or ne cxR32 40 0x15b3 ne cxR32 44 0x1021
+cxFailAt 13 0
+end
+end
+
+fn cxRegister a edit CxRank rail ulong to void
+cell = add 16 mul rail 40
+cxHdr 2 24 40
+cxPut 16 1 1
+cxSubmit rail 24 14
+if or ne cxR8 26 4 ne cxR8 37 2
+cxFailAt 15 0
+end
+if ge uint get cxGidIndex rail cxR32 16
+cxFailAt 15 1
+end
+mtu = cxR8 28
+if or lt mtu 1 gt mtu 5
+cxFailAt 15 2
+end
+cxHelloPut add cell 32 ulong mtu 1
+put a limit rail cxR32 4
+cxHelloPut add cell 36 ulong get a limit rail 4
+cxHdr 3 16 8
+cxSubmit rail 16 16
+put cxPd rail cxR32 0
+addr = mapaddr get a arena
+cxHdr 9 48 12
+cxPut 16 addr 8
+cxPut 24 add mul get a capacity 8 20 8
+cxPut 32 addr 8
+cxPut 40 ulong get cxPd rail 4
+cxPut 44 3 4
+cxSubmit rail 48 17
+put a localva rail addr
+put a lkey rail cxR32 4
+cxHelloPut cell addr 8
+cxHelloPut add cell 8 ulong cxR32 8 4
+end
+
+fn cxCreateCq q edit CxQueue rail ulong to void
+put q cq cxMem 4096
+put q db 1 cxMem 4096
+b = new uchar 64 0
+put b 63 0xf0
+for i ulong 64
+n = mapwrite get q cq mul i 64 b 0 64
+end
+cxHdr 18 72 16
+cxPut 24 63 4
+cxPut 32 0xffffffff 4
+cxPut 40 mapaddr get q cq 8
+cxPut 48 mapaddr get q db 1 8
+cxPut 56 64 4
+cxSubmit rail 72 18
+if ne cxR32 4 63
+cxFailAt 19 long cxR32 4
+end
+put cxCqh rail cxR32 0
+end
+
+fn cxMapUar q edit CxQueue rail ulong index uint to void
+size = ulong get cxBfsize rail
+if or eq index 0 ge div ulong index 4 div ulong get cxBfcount rail 2
+cxFailAt 21 long index
+end
+if ge rem index 4 2
+cxFailAt 21 long index
+end
+if or lt size 16 ne rem size 16 0
+cxFailAt 21 long size
+end
+off = add ulong 0x800 mul ulong rem index 4 size
+if gt add off size 4096
+cxFailAt 21 long size
+end
+page = mul div ulong index 4 4096
+h = mapnew get cxFd rail page 4096 3 1
+if le h 0
+cxFailAt 22 h
+end
+put q bf h
+put q bfoff off
+put q half div size 2
+end
+
+fn cxCreateQp q edit CxQueue rail ulong to void
+put q sq cxMem 4096
+put q db 0 cxMem 4096
+put q dboff 0 4
+cxCreateFrame q rail
+cxSubmit rail 120 20
+put cxQph rail cxR32 0
+put q qpn cxR32 4
+cxMapUar q rail cxR32 32
+cell = add 16 mul rail 40
+cxHelloPut add cell 12 ulong get q qpn 4
+end
+
+fn cxCreateFrame q view CxQueue rail ulong to void
+cxHdr 24 120 72
+cxPut 24 ulong get cxPd rail 4
+cxPut 28 ulong get cxCqh rail 4
+cxPut 32 ulong get cxCqh rail 4
+cxPut 40 1 4
+cxPut 48 1 4
+cxPut 61 2 1
+cxPut 64 mapaddr get q sq 8
+cxPut 72 mapaddr get q db 0 8
+cxPut 80 64 4
+note With CQE v0 the full mlx5 create_qp payload must carry MLX5_IB_DEFAULT_UIDX.
+cxPut 96 0xffffff 4
+end
+
+fn cxModify rail ulong state uint to void
+cxHdr 26 120 0
+cxPut 72 ulong get cxQph rail 4
+cxPut 104 ulong state 1
+cell = add 16 mul rail 40
+if eq state 1
+cxPut 76 0x39 4
+cxPut 96 2 4
+cxPut 112 1 1
+end
+if eq state 2
+cxPut 76 0x129181 4
+for i ulong 16
+put cxCmd add 8 i get cxPeer add add cell 16 i
+end
+cxPut 32 ulong get cxGidIndex rail 1
+cxPut 33 64 1
+cxPut 38 1 1
+cxPut 39 1 1
+cxPut 84 cxPeerGet add cell 33 3 4
+cxPut 92 cxPeerGet add cell 12 4 4
+mtu = get cxHello add cell 32
+other = get cxPeer add cell 32
+if lt other mtu
+mtu = other
+end
+cxPut 106 ulong mtu 1
+cxPut 111 12 1
+end
+if eq state 3
+cxPut 76 0x12e01 4
+psn = ulong 0
+for i ulong 3
+psn = or psn shl ulong get cxHello add add cell 33 i mul i 8
+end
+cxPut 88 psn 4
+cxPut 113 14 1
+cxPut 114 7 1
+cxPut 115 7 1
+end
+cxSubmit rail 120 add int state 22
+end
+
+fn cxExchange size ulong to void
+pos = ulong 0
+while lt pos size
+n = write 1 cxHello pos sub size pos
+if le n 0
+cxFailAt 26 n
+end
+pos = add pos ulong n
+end
+pos = ulong 0
+while lt pos size
+n = read 0 cxPeer pos sub size pos
+if le n 0
+cxFailAt 27 n
+end
+pos = add pos ulong n
+end
+end
+
+fn cxJoin a edit CxRank rail ulong to void
+cell = add 16 mul rail 40
+mtu = get cxPeer add cell 32
+qpn = cxPeerGet add cell 12 4
+if or eq qpn 0 gt qpn 0xffffff
+cxFailAt 28 1
+end
+if or lt mtu 1 gt mtu 5
+cxFailAt 28 2
+end
+put a peerva rail cxPeerGet cell 8
+put a rkey rail uint cxPeerGet add cell 8 4
+other = uint cxPeerGet add cell 36 4
+if lt other get a limit rail
+put a limit rail other
+end
+cxModify rail 2
+cxModify rail 3
+end
+
+fn cxSetup a edit CxRank q edit CxQueue rail ulong arg ulong to void
+put cxGidIndex rail uchar cxNumber add arg 1 255
+cxGid add arg 2 rail
+put cxFd rail cxOpen arg
+cxContext rail
+cxRegister a rail
+cxCreateCq q rail
+cxCreateQp q rail
+cxModify rail 1
+n = random cxHello add 49 mul rail 40 3 0
+if ne n 3
+cxFailAt 29 n
+end
+end
+
+fn cxSignal marker uchar to void
+put cxHello 0 marker
+cxExchange 1
+if ne get cxPeer 0 marker
+cxFailAt 30 0
+end
+end
+
+fn cxValue i ulong to f32
+ret f32 add rem i 251 1
+end
+
+fn cxReportCqe q view CxQueue rail ulong to void
+if ne get q busy -1
+ret
+end
+b = new uchar 64 0
+n = mapread get q cq cxCqePos q b 0 64
+n = write 2 cxCqFail 0 len cxCqFail
+cxPrint rail
+n = write 2 cxOpcode 0 len cxOpcode
+opcode = shr get b 63 4
+cxPrint ulong opcode
+n = write 2 cxFormat 0 len cxFormat
+cxPrint ulong and shr get b 63 2 3
+n = write 2 cxCounter 0 len cxCounter
+cxPrint or shl ulong get b 60 8 ulong get b 61
+n = write 2 cxReported 0 len cxReported
+word = ulong 0
+for i ulong 4
+word = or shl word 8 ulong get b add 56 i
+end
+cxPrint word
+if or eq opcode 13 eq opcode 14
+n = write 2 cxSyndrome 0 len cxSyndrome
+cxPrint ulong get b 55
+n = write 2 cxVendor 0 len cxVendor
+cxPrint ulong get b 54
+end
+n = write 2 cxNl 0 1
+end
+
+fn cxRankCheck to int
+a = new CxRank 0 0 0 0 0 0 4 0 1 1 0 0 0 0
+q = new CxQueue 0 0 64 0 0 64 64 0 0 0 0 0 100 1 0 1
+other = new CxQueue 0 0 64 0 0 64 64 0 0 0 0 0 101 0 0 0
+put cxReply 0 cxMem 4096
+put q sq cxMem 4096
+put q db 0 cxMem 4096
+cxCreateFrame q 0
+if or ne get cxCmd 96 255 ne get cxCmd 97 255
+ret 71
+end
+if or ne get cxCmd 98 255 ne get cxCmd 99 0
+ret 71
+end
+b = new uchar 64 0
+put b 54 37
+put b 55 19
+put b 63 0xd0
+put q cq cxMem 4096
+n = mapwrite get q cq 0 b 0 64
+if ne cxProgress a q other -1
+ret 72
+end
+if or ne get q busy -1 ne get a active -1
+ret 73
+end
+cxReportCqe q 0
+n = write 2 cxTestPass 0 len cxTestPass
+ret 0
+end
+
+fn cxRun a edit CxRank left edit CxQueue right edit CxQueue to void
+factor = f32 add get a rankid 1
+for i ulong get a capacity
+bits = bitcast uint mul cxValue i factor
+s = mapset get a arena mul i 4 4 ulong bits
+end
+cxSignal 0x91
+started = monons
+if ne cxBegin a left right get a capacity 0
+cxFailAt 31 0
+end
+while true
+st = cxProgress a left right
+if lt st 0
+cxReportCqe left 0
+cxReportCqe right 1
+exit 32
+end
+if eq st 1
+break
+end
+cpurelax
+end
+elapsed = sub monons started
+for i ulong get a capacity
+val = mapget get a arena mul i 4 4
+expected = bitcast uint mul cxValue i 3.0f32
+if ne val ulong expected
+cxFailAt 33 long i
+end
+end
+cxSignal 0xa2
+n = write 2 cxPass 0 len cxPass
+cxPrint ulong get a rankid
+n = write 2 cxElems 0 len cxElems
+cxPrint get a capacity
+n = write 2 cxTime 0 len cxTime
+cxPrint ulong elapsed
+n = write 2 cxNl 0 1
+end
+
+fn main to int
+arg = new uchar 11 0
+if eq argcnt 2
+if eq argread 1 arg 0 11 long len cxSelf
+match = true
+for i ulong len cxSelf
+if ne get arg i get cxSelf i
+match = false
+end
+end
+if match
+ret cxRankCheck
+end
+end
+end
+if ne argcnt 9
+n = write 2 cxUsage 0 len cxUsage
+ret 2
+end
+a = new CxRank 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+left = new CxQueue 0 0 64 0 0 64 64 0 0 0 0 0 0 0 0 0
+right = new CxQueue 0 0 64 0 0 64 64 0 0 0 0 0 0 0 0 0
+cxCheckPage
+put a rankid int cxNumber 1 1
+count = cxNumber 2 div sub ulong 0x7fffffffffffffff 20 8
+put a capacity count
+if eq cxNumber 3 0xffffffff cxNumber 6 0xffffffff
+cxFailAt 2 1
+end
+put a arena cxMem add mul count 8 20
+put cxReply 0 cxMem 4096
+cxHelloPut 0 0x31375043 4
+cxHelloPut 4 ulong get a rankid 4
+cxHelloPut 8 count 8
+cxSetup a left 0 3
+cxSetup a right 1 6
+cxExchange 96
+if ne cxPeerGet 0 4 0x31375043
+cxFailAt 28 3
+end
+if ne cxPeerGet 4 4 ulong sub int 1 get a rankid
+cxFailAt 28 4
+end
+if ne cxPeerGet 8 8 count
+cxFailAt 28 5
+end
+cxJoin a 0
+cxJoin a 1
+cxRun a left right
+ret 0
+end
diff --git a/native/connectx7/run-rank.sh b/native/connectx7/run-rank.sh
new file mode 100755
index 0000000000000000000000000000000000000000..265be751961c128df818d861c9d81111f32b0c90
--- /dev/null
+++ b/native/connectx7/run-rank.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+# Research launch glue: resolve the two Linux device nodes and selected RoCEv2 GIDs.
+# stdin/stdout belong to the Omega rank's binary control channel. Diagnostics go to stderr.
+set -eu
+if [[ $# != 4 ]]; then
+    echo "usage: run-rank.sh RANK ELEMENTS LEFT_GID_INDEX RIGHT_GID_INDEX" >&2
+    exit 2
+fi
+dir=$(cd -- "$(dirname -- "$0")" && pwd)
+rank=$1
+elements=$2
+args=()
+resolve() {
+    local device=$1 index=$2 candidate ibdev type gid
+    [[ $index =~ ^[0-9]+$ ]] || { echo "invalid GID index" >&2; return 2; }
+    for candidate in /sys/class/infiniband_verbs/uverbs*/ibdev; do
+        [[ -r $candidate ]] || continue
+        read -r ibdev < "$candidate"
+        [[ $ibdev == "$device" ]] || continue
+        local port=/sys/class/infiniband/"$device"/ports/1
+        read -r type < "$port/gid_attrs/types/$index"
+        read -r gid < "$port/gids/$index"
+        [[ $type == "RoCE v2" ]] || { echo "$device index $index is $type" >&2; return 2; }
+        local node=${candidate%/ibdev}
+        args+=("${node##*uverbs}" "$index" "$gid")
+        return 0
+    done
+    echo "No uverbs node for $device" >&2
+    return 2
+}
+resolve rocep1s0f0 "$3"
+resolve roceP2p1s0f1 "$4"
+exec "$dir/cx7-rank" "$rank" "$elements" "${args[@]}"
diff --git a/native/connectx7/tp2.om b/native/connectx7/tp2.om
new file mode 100644
index 0000000000000000000000000000000000000000..2568b7a3f1b418aac0980473a4f1ae0c74f6a30e
--- /dev/null
+++ b/native/connectx7/tp2.om
@@ -0,0 +1,399 @@
+note SPDX-License-Identifier: AGPL-3.0-only
+om2
+layout CxWrite 64
+field opidx uint at 0 big
+field qpds uint at 4 big
+field flags uchar at 11 little
+field dst ulong at 16 big
+field rkey uint at 24 big
+field count uint at 32 big
+field lkey uint at 36 big
+field src ulong at 40 big
+end
+layout CxHead 64
+field word ulong at 0 little
+end
+layout CxCqe 64
+field sopqpn uint at 56 big
+field counter ushort at 60 big
+field opown uchar at 63 little
+end
+layout CxBe32 4
+field number uint at 0 big
+end
+layout CxLe32 4
+field number uint at 0 little
+end
+layout CxTile 256
+field bits uint 64 at 0 little
+end
+struct CxQueue sq long sqoff ulong sqcnt ulong cq long cqoff ulong cqcnt ulong stride ulong db long 2 dboff ulong 2 bf long bfoff ulong half ulong qpn uint pi ulong ci ulong busy int end
+struct CxRank arena long capacity ulong localva ulong 2 peerva ulong 2 lkey uint 2 rkey uint 2 limit uint 2 rankid int epoch uint active int phase int 2 start ulong 2 finish ulong 2 cursor ulong 2 end
+
+const CX_PAYLOAD int 0
+const CX_WAIT_READY int 1
+const CX_WAIT_ACK int 2
+const CX_DONE int 3
+const CX_REDUCE int 4
+
+fn cxPowerTwo x ulong to bool
+ret and ne x 0 eq and x sub x 1 0
+end
+
+fn cxFits base ulong size ulong to bool
+ret le size sub ulong 0xffffffffffffffff base
+end
+
+fn cxQueueValid q view CxQueue to bool
+if or le get q sq 0 le get q cq 0
+ret false
+end
+if or le get q db 0 0 le get q db 1 0
+ret false
+end
+if or le get q bf 0 gt get q qpn 0xffffff
+ret false
+end
+if or eq get q qpn 0 ne get q busy 0
+ret false
+end
+if or not cxPowerTwo get q sqcnt not cxPowerTwo get q cqcnt
+ret false
+end
+if and ne get q stride 64 ne get q stride 128
+ret false
+end
+if gt get q sqcnt div ulong 0xffffffffffffffff 64
+ret false
+end
+if gt get q cqcnt div ulong 0xffffffffffffffff get q stride
+ret false
+end
+if or ne and get q sqoff 63 0 ne and get q cqoff 63 0
+ret false
+end
+if or ne and get q dboff 0 3 0 ne and get q dboff 1 3 0
+ret false
+end
+if or ne and get q bfoff 7 0 ne and get q half 7 0
+ret false
+end
+if lt get q half 8
+ret false
+end
+if not cxFits get q bfoff get q half
+ret false
+end
+if not cxFits add get q bfoff get q half 8
+ret false
+end
+if not cxFits get q sqoff mul get q sqcnt 64
+ret false
+end
+ret cxFits get q cqoff mul get q cqcnt get q stride
+end
+
+fn cxNativeDb n uint to ulong
+b = new uchar 4 0
+cxPackDb b n
+ret cxReadDb b
+end
+fn cxPackDb b edit CxBe32 n uint to void
+put b number n
+end
+fn cxReadDb b view CxLe32 to ulong
+ret ulong get b number
+end
+
+fn cxControl w edit CxWrite q view CxQueue to void
+idx = uint and get q pi 0xffff
+put w opidx or shl idx 8 8
+put w qpds or shl get q qpn 8 3
+put w flags 8
+end
+
+fn cxSegment w edit CxWrite a view CxRank rail ulong src ulong dst ulong bytes uint to void
+put w src add get a localva rail src
+put w dst add get a peerva rail dst
+put w lkey get a lkey rail
+put w rkey get a rkey rail
+put w count bytes
+end
+
+note Private helper. One outstanding signalled RDMA write per exclusively owned SQ.
+fn cxPost q edit CxQueue a view CxRank rail ulong src ulong dst ulong bytes uint to int
+extent = add mul get a capacity 8 20
+if or ne get q busy 0 eq bytes 0
+ret -1
+end
+if or gt src extent gt dst extent
+ret -1
+end
+if or gt ulong bytes sub extent src gt ulong bytes sub extent dst
+ret -1
+end
+if or gt bytes get a limit rail gt bytes 0x7fffffff
+ret -1
+end
+w = new uchar 64 0
+cxControl w q
+cxSegment w a rail src dst bytes
+cxPublish q w
+ret 0
+end
+
+fn cxPublish q edit CxQueue w view CxWrite to void
+pi = get q pi
+slot = and pi sub get q sqcnt 1
+pos = add get q sqoff mul slot 64
+sq = get q sq
+copied = mapwrite sq pos w 0 64
+cxRing q cxHeader w
+end
+
+fn cxHeader w view CxHead to ulong
+ret get w word
+end
+
+fn cxRing q edit CxQueue header ulong to void
+pi = get q pi
+nextpi = add pi 1
+dbval = cxNativeDb uint and nextpi 0xffff
+status = mapset get q db 0 get q dboff 0 4 dbval
+bfpos = add get q bfoff mul and pi 1 get q half
+status = mapset get q bf bfpos 8 header
+put q pi nextpi
+put q busy 1
+end
+
+fn cxMatch c view CxCqe q view CxQueue to bool
+if ne and get c opown 0xfc 0
+ret false
+end
+expected = or shl uint 8 24 get q qpn
+if ne get c sopqpn expected
+ret false
+end
+ret eq ulong get c counter and sub get q pi 1 0xffff
+end
+
+note 0 pending, 1 retired, -1 terminal. A failed CQE stays available for diagnosis.
+fn cxPoll q edit CxQueue to int
+if ne get q busy 1
+ret -1
+end
+pos = cxCqePos q
+ci = get q ci
+count = get q cqcnt
+cq = get q cq
+b = new uchar 64 0
+n = mapread cq add pos 63 b 63 1
+tag = get b 63
+if eq shr tag 4 15
+ret 0
+end
+owner = and ulong tag 1
+if ne owner and div ci count 1
+ret 0
+end
+cpufence
+n = mapread cq pos b 0 64
+if not cxMatch b q
+put q busy -1
+ret -1
+end
+cxRetire q
+ret 1
+end
+
+fn cxCqePos q view CxQueue to ulong
+ci = get q ci
+count = get q cqcnt
+slot = and ci sub count 1
+stride = get q stride
+pos = add get q cqoff mul slot stride
+pos = add pos sub stride 64
+ret pos
+end
+
+fn cxRetire q edit CxQueue to void
+ci = get q ci
+nextci = add ci 1
+db = get q db 1
+dboff = get q dboff 1
+dbval = cxNativeDb uint and nextci 0xffffff
+status = mapset db dboff 4 dbval
+put q ci nextci
+put q busy 0
+end
+
+note Arena: activation and inbox of capacity FP32 each, then epoch, ready[2], ack[2].
+fn cxBegin a edit CxRank left view CxQueue right view CxQueue elements ulong to int
+if or ne get a active 0 gt elements get a capacity
+ret -1
+end
+if or lt get a rankid 0 gt get a rankid 1
+ret -1
+end
+if or le get a arena 0 eq get a epoch 0xffffffff
+ret -1
+end
+if or not cxQueueValid left not cxQueueValid right
+ret -1
+end
+if not cxArenaValid a
+ret -1
+end
+cxStart a elements
+ret 0
+end
+
+fn cxArenaValid a view CxRank to bool
+cap = get a capacity
+if gt cap div sub ulong 0xffffffffffffffff 20 8
+ret false
+end
+extent = add mul cap 8 20
+for rail ulong 2
+if or not cxFits get a localva rail extent not cxFits get a peerva rail extent
+ret false
+end
+if or ne and get a localva rail 3 0 ne and get a peerva rail 3 0
+ret false
+end
+if lt get a limit rail 4
+ret false
+end
+end
+ret true
+end
+
+fn cxStart a edit CxRank elements ulong to void
+cap = get a capacity
+split = mul add div elements 2 rem elements 2 4
+put a start 0 0
+put a finish 0 split
+put a start 1 split
+put a finish 1 mul elements 4
+for rail ulong 2
+put a cursor rail get a start rail
+put a phase rail CX_PAYLOAD
+end
+epoch = add get a epoch 1
+put a epoch epoch
+status = mapset get a arena mul cap 8 4 ulong epoch
+put a active 1
+end
+
+fn cxAddTile local edit CxTile peer view CxTile count ulong rankid int to void
+for i ulong count
+x = bitcast f32 get local bits i
+y = bitcast f32 get peer bits i
+if eq rankid 0
+put local bits i bitcast uint add x y
+else
+put local bits i bitcast uint add y x
+end
+end
+end
+
+fn cxReduceTile a edit CxRank rail ulong to void
+local = new uchar 256 0
+peer = new uchar 256 0
+pos = get a cursor rail
+stop = get a finish rail
+arena = get a arena
+inbox = mul get a capacity 4
+size = sub stop pos
+if gt size 256
+size = ulong 256
+end
+copied = mapread arena pos local 0 size
+copied = mapread arena add inbox pos peer 0 size
+cxAddTile local peer div size 4 get a rankid
+copied = mapwrite arena pos local 0 size
+put a cursor rail add pos size
+end
+
+note Progress exactly one rail; each notification follows its payload on that rail's RC QP.
+fn cxAdvance a edit CxRank q edit CxQueue rail ulong to int
+if ne get q busy 0
+completion = cxPoll q
+if le completion 0
+ret completion
+end
+end
+phase = get a phase rail
+flags = mul get a capacity 8
+ready = add add flags 4 mul rail 4
+ack = add ready 8
+if eq phase CX_PAYLOAD
+pos = get a cursor rail
+size = sub get a finish rail pos
+if gt size 0
+limit = ulong and get a limit rail 0xfffffffc
+if gt limit 0x7ffffffc
+limit = ulong 0x7ffffffc
+end
+if gt size limit
+size = limit
+end
+dst = add mul get a capacity 4 pos
+rc = cxPost q a rail pos dst uint size
+if eq rc 0
+put a cursor rail add pos size
+end
+ret rc
+end
+rc = cxPost q a rail flags ready 4
+if eq rc 0
+put a phase rail CX_WAIT_READY
+end
+ret rc
+end
+epoch = ulong get a epoch
+if eq phase CX_WAIT_READY
+if ne mapget get a arena ready 4 epoch
+ret 0
+end
+put a cursor rail get a start rail
+put a phase rail CX_REDUCE
+end
+if eq get a phase rail CX_REDUCE
+if lt get a cursor rail get a finish rail
+cxReduceTile a rail
+ret 0
+end
+rc = cxPost q a rail flags ack 4
+if eq rc 0
+put a phase rail CX_WAIT_ACK
+end
+ret rc
+end
+if eq phase CX_WAIT_ACK
+if eq mapget get a arena ack 4 epoch
+put a phase rail CX_DONE
+end
+end
+ret 0
+end
+
+note Public entry. 0 pending, 1 result consumable, -1 terminal or idle.
+fn cxProgress a edit CxRank left edit CxQueue right edit CxQueue to int
+if ne get a active 1
+ret -1
+end
+if lt cxAdvance a left 0 0
+put a active -1
+ret -1
+end
+if lt cxAdvance a right 1 0
+put a active -1
+ret -1
+end
+if and eq get a phase 0 CX_DONE eq get a phase 1 CX_DONE
+put a active 0
+ret 1
+end
+ret 0
+end