Skip to content

engram, qdot: two hw tests on aarch64 read O_DIRECT from libc and name a CPU without row lanes - #43

Merged
midagedev merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-arm-tests
Oct 11, 2026
Merged

midagedev merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-arm-tests

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

What and why

Part of #13. Two hw tests are red on a DGX Spark (aarch64) because of the tests themselves; #38's description lists
both among the fixture-tier reds that are not an input. The engram test checks the fdinfo flags against x86_64's
O_DIRECT value, and the qdot lane refusal test fails unnamed on a CPU without row lanes.

  • hw_engram_open_direct_reads_the_files_bytes masks the flags with 0o40000, which is O_DIRECT on x86_64. On
    aarch64 O_DIRECT is 0o200000 (0o40000 is O_DIRECTORY there), so the clause is red on a handle that carries the
    flag: flags 2600000 is O_CLOEXEC | O_LARGEFILE | O_DIRECT. It now masks with libc::O_DIRECT, the constant
    crates/engram/src/direct.rs opens the file with.
  • hw_lanes_refuse_bad_shapes asserts pack_lanes's shape refusals. On a CPU without row lanes every shape is refused
    as NoLanes first, so the first shape clause (k = 100) fails as a bare assert_eq. The test now asserts
    has_lanes(Q4_K) first, as assert_lanes_match does, so on such a CPU it is red with a message that names the CPU.
    It stays red there; it does not skip.

On x86_64 libc::O_DIRECT is 0o40000 and the box's CPU has the lanes, so neither test changes on the box.

Code shape

  • No second copy. The engram test reads the flag from the same libc constant the reader opens with, instead of
    its own copy of the x86_64 value.
  • Model code holds only architecture facts. Test files only.
  • Dead code is gone.
  • No silent failure. The lane test's red on a CPU without lanes now names its cause.
  • Comments state what is true now. No comment changed.
  • No relaxed gate. The engram clause asserts the same flag; the lane test gains one assert in front of its
    clauses.
  • cargo fmt and cargo clippy are clean on what I touched; the lint count did not go up.

Duplication found or removed (path:line), or "none": the literal 0o40000 at crates/engram/tests/engram.rs:776
was an x86_64-only copy of libc::O_DIRECT.

What I ran

On a Mac, on this commit (on aa6df234). mac-static cross-lints the x86_64 Linux build, these two test files
included:

just mac-static upstream/main
mac-static: fmt-check rc 0 in 3 s
mac-static: lint rc 0 in 1 s
mac-static: check-recipes rc 0 in 477 s
mac-static: ok

(the other steps rc 0 too, each line cut after its time; the lint step counts 41 warnings, the ratchet's 41).

For the aarch64 side, clippy on the DGX Spark in the dev container, on aa6df234 and on this commit:

cargo clippy --release -p bloomery-engram -p bloomery-qdot --tests

Both trees print the same diagnostics, none in crates/engram/tests/engram.rs or crates/qdot/tests/qdot.rs.

FAIL-first on the DGX Spark, in the dev container, each recipe's tools/gate.sh line at the tree root
(bash tools/gate.sh --release -p bloomery-engram --lib --test engram -- --include-ignored --nocapture and
bash tools/gate.sh --release -p bloomery-qdot --test qdot -- --include-ignored --nocapture). Both gates exit 101 on
both trees, for the reds below:

engram lib engram tests qdot tests
aa6df234 18 of 18 4 of 11 24 of 62
this commit 18 of 18 5 of 11 24 of 62

On aa6df234:

thread 'hw_engram_open_direct_reads_the_files_bytes' (403) panicked at crates/engram/tests/engram.rs:775:5:
assertion `left != right` failed: the handle carries O_DIRECT: flags 2600000
  left: 0
 right: 0
thread 'hw_lanes_refuse_bad_shapes' (169) panicked at crates/qdot/tests/qdot.rs:5694:9:
assertion `left == right` failed
  left: Err(NoLanes(Q4_K))
 right: Err(UnalignedK { k: 100, gran: 256 })

On this commit:

test hw_engram_open_direct_reads_the_files_bytes ... ok
thread 'hw_lanes_refuse_bad_shapes' (170) panicked at crates/qdot/tests/qdot.rs:5685:5:
Q4_K has no row lanes on this CPU: every shape would be refused as NoLanes

The other reds are the same names on both trees. In engram, five miss the V4.1 engram table under /models, and
hw_engram_expert_stack_evicts_and_reads_back finds 2 of 7 pages still in the page cache after an eviction; I have not
found the cause of that one, and this change does not touch it. In qdot, 24 of the 38 reds are inputs that run did not
have or could not read (model files, and reference dumps at the default $BLOOMERY_DATA, which the container's user
could not read), 13 are clauses already named for a CPU without the AVX2 kernels, and the last is
hw_lanes_refuse_bad_shapes, now named the same way.

I could not run either gate on x86_64. There libc::O_DIRECT is the old literal and has_lanes(Q4_K) holds, so both
tests should read as before; that run is yours.

Hardware (if the change is for a machine)

DGX Spark: nvidia-smi --query-gpu=name,driver_version --format=csv prints NVIDIA GB10, 595.84. CPU: 20 cores
(10 Cortex-X925, 10 Cortex-A725), MemTotal 127,599,376 kB. Ubuntu 24.04.5 LTS, kernel 6.17.0-1032-nvidia. The gates
and clippy ran in the dev container (CUDA 13.3.1, LLVM 21.1.8, nightly-2026-08-28) with LC_ALL=C.

…e a CPU without row lanes

- engram: hw_engram_open_direct_reads_the_files_bytes masked the fdinfo flags with 0o40000, which is O_DIRECT on x86_64.
  On aarch64 O_DIRECT is 0o200000 (0o40000 is O_DIRECTORY there), so the clause was red on a handle that carries the
  flag (flags 2600000: O_CLOEXEC, O_LARGEFILE, O_DIRECT). It masks with libc::O_DIRECT, the flag
  crates/engram/src/direct.rs opens with.
- qdot: hw_lanes_refuse_bad_shapes asserted its refusals on a CPU without row lanes, where pack_lanes refuses every
  shape as NoLanes first, so the first shape clause was red as an unnamed assert_eq (NoLanes(Q4_K) against
  UnalignedK { k: 100, gran: 256 }). It asserts has_lanes(Q4_K) first, as assert_lanes_match does, so the red names the
  CPU.
On x86_64 libc::O_DIRECT is 0o40000 and the box's CPU has the lanes, so neither test changes there.
FAIL-first on a DGX Spark (aarch64, GB10): before, gate-engram passed 22 of 29 with the O_DIRECT clause red and
gate-qdot's lane refusal clause red unnamed; after, 23 of 29 and the clause green, and the lane refusal red by name. The
other reds there are the same on both trees: inputs that machine does not have or cannot read, clauses already named for
a CPU without the AVX2 kernels, and one engram page-cache eviction red this change does not touch.
@midagedev

Copy link
Copy Markdown
Owner

Thanks — clear fix, and the box (x86_64) sees no change. It lands right after the 0.3.0 tag tonight: I run its gates (qdot, engram) on top of the release tree, then merge it here.

@midagedev
midagedev merged commit 5efca4b into midagedev:main Oct 11, 2026
1 check passed
@juliankang4 juliankang4 added the host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset label Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants