Retrospective: M9a (triad_count against ESCHER-GPU)#
Status: done on the branch m9a-triad-count (all five steps; ready for the pull request). M9a is the first half of PLAN 11.3’s
M9 row: triad_count exact against ESCHER-GPU@abcf9b2 on the sequential, OpenMP and CUDA
backends, the independent oracle, the conformance kit and the mutations, and the paper gates
(the Nsight Systems peak included); M9b follows with experimental::count_local_patterns,
Python, the CLI, the docs and the freeze. It runs in five steps, and each step adds its section
here. Release 0.3.0 = M8a + M8b + M9a + M9b (PLAN Appendix F; the split is the author’s decision
D2).
The author’s decisions for M9 (2026-10-15; recorded in GOVERNANCE.md’s approvals log by step
1). D1: the gated Nsight Systems peak is the peak of live device allocations (cudaMalloc +
cudaMallocAsync, kind Device) over the whole timed process, on coauth_b50k_s1, syn1m_b50k_s1 and
syn2m_b50k_s1, port / A <= 1.05; the footprint is reported, not gated. D2: the M9a / M9b split.
D3: the host backends are incremental host engines (an untuned transliteration of A’s wedge
engine), testing::triad_reference the independent oracle. D5: the committed test-data budget is
1.25 MB, at most about 16 KB of make-test counts. D4 and D6-D10 are taken on the plan’s defaults,
pending the author’s confirmation at the 0.3.0 release.
Step 1: the reference side (regions-goldens-crosscheck)#
What was built#
Commit |
What |
|---|---|
|
First commit of the branch: |
|
the author’s M9 decisions in GOVERNANCE.md; |
|
|
|
the set |
|
|
|
|
Results: the set exported twice from two fresh patched copies with byte-identical manifests
(300 cases, 367.7 MB); every case’s --check run agrees; generators::legacy reproduces all 12
synthetic inputs; A agrees with its own CPU reference on all 90 cross-check runs, whose counts
equal the goldens’ (parity/results/M9a.md section 1). Nothing was found against the original.
Deviations from the plan and the step’s text (each with the same intent)#
The branch starts at
origin/main9cde147, not atm8b-hypergraph65a62c9: the author had merged PR #15 (M8b) when M9a started, so the step’s own rule applies (“if origin/main already contains PR #15’s merge, branch from origin/main instead”). The frozen-path diff of the acceptance (git diff 65a62c9 -- cpp/include/dyng/{hypergraph,update.hpp,core, graph}) is empty on9cde147too.The unpatched counts of an export come from its own fresh copy. The export patch keeps A’s Makefile-built executables unchanged as
parity_export/orig/<exe>before it installs the recording twins (ADR 0036); each of the two exports counts with its copy’s originals, so the double export compares two independent builds of A end to end. The persistent unpatched copy (the performance baseline) is the one the cross-check runs, and its counts equal the goldens’ on all 90 runs, so both builds print the same counts.update.addincludesidentify_affected. The step namesupdate.add = count_plus + finalize, butupdatecontainsidentify_affected(A builds the inserted keys’ frontier insideupdate.add), and the three sub-rows should add up to the gated row on both sides.full_countmaps totriad_count.compute, the stage the framework emits for the wholecompute()call (hook_stages::compute); the sketch’striad_count.countis the aggregate count inside it. A’sinit.full_countincludes allocating and reading back its bins, so the whole call is the matching scope (the step asked to use the framework’s name and record it).One
.dgbper batch.to-dgbwrites one file with all batches; the acceptance asks for the SHA-256 of each batch’s file, so the exporter splits the file into valid one-record.dgbfiles (batch<N>.dgb, header count 1, CRC recomputed; dyng’sBatchReaderreads them). The SHA-256 in the records is that of the uncompressed file; the stored files are zstd-compressed.Case names use the size labels of the gate cases (
coauth_b50k_s1,syn1m_b5k_s3,syn2m_b200k_s2,syn100k_b20_s1), as M8a’s sets and the acceptance’s gate rows name them;info.jsonmaps the labels to the sizes. make-test’s groups aretest/<NN>-<label>.make-test’s seven input-rejection invocations are not cases (they print no counts). The 60 counting invocations are checked against M8a’s set, invocation by invocation.
The
--checkrun of a case is its count run plus--check. The suite’s own--referenceis exercised by the cross-check, which runs every make-test case with--check --reference(also the cases the suite runs with--referenceonly).The region loader is stricter: it refuses an unknown key of a region (a misspelt
per_bachwould otherwise be silently ignored) and a repeated region name; a region with only aport_report(the process wall time) counts as naming its port side. All existing maps load unchanged.No batches-only recorder mode was added: the recorder’s existing batches mode records coauth-DBLP in about 15 s per run (alone), and its exit record already carries
inserted_keys.The legacy-generator proof runs through the Python binding (
dyng.generators.legacy. escher_hypergraph_arrays+dyng.io.write_hypergraph), which calls the C++ generator; no new C++ tool was needed, so this step changed no C++ code.bench_suite.pyknows triad_count’s region map (REGION_MAPS,MAP_KEYS) but not yet a harness tool (TOOLS):perf_ab.py triad_countarrives in step 2, and a suite file naming it before then would not validate.certify.pylists the triad set without a verdict until it has replays. A golden set without replay records fails every certificate (golden_parity), and the triad replays arrive with the port; until M9a step 5 makes them required from the 0.3 series, atriad_countset without replays is listed withpassed = None(shown as “listed”), and a replay record, once there, is judged as usual. The 0.1 / 0.2 certificate tests pass unchanged.The author’s M9 decisions were recorded in this step (GOVERNANCE.md, plan.md, roadmap), as the first step of the milestone.
Machine time#
What |
Time |
|---|---|
Double export (two copies built, two exports at once, 3 groups each, GPU 1, shared lock) |
62 min wall (06:28-07:30); 10,569 s / 10,472 s of group time; coauth 61%, syn2m 23% |
Cross-check (90 runs, 2 at a time) |
about 4 min wall, 401.7 s of run time; coauth main’s CPU reference 143.5 s (time box 2 h) |
Development exports (subsets, the existing patched copy) and the first coauth reference run |
about 10 min |
|
16 s |
Notes for step 2 (oracle, replay harness, driver, pre-reads)#
Reading the set (
$DYNG_SCRATCH/goldens/triad_count/escher_gpu;triad_goldens.py):cases/<group>/group.jsonhas the input name, the vertex count (vertices, A’s maxVertexId: pass it ashypergraph_read_options::num_vertices), the H2Vpayload_capacityforcapacity_policy::escher_gpu(capacity)(0 everywhere buttest/01-smoke: 4096), and the batch filesbatch<N>.dgb.zst(decompress withzstd -dc; flagsdeleted_membersandexpected_ids, ids = A’s keys - 1).cases/<group>/<exe>.jsonhasfull_count, and per batchdelta,counts_after,deletions,insertionsandbatch_sha256. Inputs:inputs/<name>.json+inputs/<name>.hg.zst(A’s loaded rows,index_base1), coauth-DBLP from$DYNG_SCRATCH/datasets/hyper/coauth.hg(identical bytes).Coverage:
triad_goldens.coverage_cases(backend)(andcompare.py triad_count --list --backend B) gives the cases per backend: cuda 300, sequential 120, openmp 142.compare.py triad_counttoday verifies (--verify) and lists (--list); step 2 adds the replay modes and counters intriad_goldens.compare_main. Do not change the export functions without exporting again (export --twice): the committed manifest was produced by903b3aa’s exporter.Driver names the map expects:
update_ms,full_count_ms,total_ms,load_ms,generate_ms(driver timers, A’s--timingJSON format), stagestriad_count.update,triad_count.compute,driver.total,driver.batch.generate,io.read_hypergraph,hypergraph.build,hypergraph.upload.Memory points for store_memory:
group.jsondevice_bytesholds A’sdeviceBytes()after the build and after every batch for every group (coauth_b50k_s1: 1,922,784,204 after the build, as M8a’s trace).For step 5:
certify.golden_suitesliststriad_countsets without replays as “not yet required” (deviation 13); the step-5 rule (required from (0,3), all backends per the coverage table, both modes) replaces that branch.bench_suite.TOOLSneedstriad_countonceperf_ab.py triad_countexists.make-test stdout (
cases/test/*/<exe>.stdout) is A’s unpatched stdout, for M9b’s CLI; the hosted-CI exact-parity test of D5 may commit at most about 16 KB of these counts (trackedcpp/tests/datais 998,934 bytes; the 1.25 MB budget and its check inci/check.share not in place yet).
Step 2: the oracle, the replays, the driver, the pre-reads (oracle-harness-driver-prereads)#
GO for step 3. The oracle reproduces ESCHER-GPU (A) exactly on all 423 go/no-go case replays,
by key and by content, on the sequential, openmp and cuda containers; the driver draws A’s batches
byte for byte; both pre-read targets are met (end to end and memory); the boost lock does not
hold on the synthetic cases, so their gates run at base (parity/results/M9a.md section 2).
What was built#
Commit |
What |
|---|---|
|
|
|
|
|
|
|
|
|
two template parameter names for clang-tidy’s naming rules; the mutation-point test reads the oracle’s hook |
|
|
Deviations from the plan and the step’s text (each with the same intent)#
The oracle’s API is wider than one function. Besides
triad_reference(...)it hastriad_reference_all(the requested patterns from one line graph, so a replay counts all four with one rebuild), the class-map functions (so the tests can show the map is the permutation orbits) and its owntriad_patternenumeration (it may not includedyng/triad_count.hpp). Its errors arestd::invalid_argument/std::bad_alloc, likerebuild_line_graph’s.The class representatives are the canonical (smallest) ids of the orbits, so a test can prove that the list is a list of orbit representatives; “classes with fewer than two intersecting pairs” counts a pair as intersecting when its pairwise-only region or the triple region is non-empty (A’s table agrees on all 128 ids).
The single-triad
.hgfiles are not committed. The C++ test builds the 30 triples itself; the recordM9a-oracle-singles-escher_gpu.jsonkeeps their lines and SHA-256 (the test-data budget of D5 is left to the make-test counts of a later step).The tool reports, the script judges.
dyng_triad_replaywrites the counts, ids, integrity and resolution facts as JSON; the comparison with the goldens, the coverage table, the records and the planted defects are inparity/triad_replay.py(asdyng_hypergraph_ids/hypergraph_ids.pydo). The planted defects are a--plantoption of the harness, each tested to fail; the comparison also checks every batch file’s SHA-256 against the golden’s.The go/no-go runs the syn1m seed-1 grid on sequential and coauth_b50k_s1/type1 on sequential with
--no-coverage: the step asks for them, the coverage table (D6) does not list them.The oracle evaluation is reused between the two modes when their live lists are equal (the oracle is a function of the list); a differing state is evaluated again.
The driver’s own additions:
--dump-batches FILE(the batch-hash proof; never in a timed run),apply_msas the per-batch timer of--no-count(the region map’supdate_msis the counted update of step 3),driver.totalbesidetotal_ms, the stagedriver.batch.generatefrom ascoped_stage, and the stageio.read_hypergraphfor a file input (a synthetic input’s load isload_msonly).--referenceand an alignment other than A’s default 4 are refused.perf_ab.py triad_count run --probe: the gate harness repeats a contaminated round and gives up after 2 x rounds rejections without a record; the clock probe needs the record of every round (whether the lock held per side), so--probekeeps the rounds.hypergraph_perf.memory_by_rangegained the footprint figures (additive keys: the held bytes at their peak and at the live peak, and their ranges); M8b’s records are unchanged.The oracle mutation is shown detected by its CTest (the mutant copy of the tests fails 4 of 8);
parity/mutate.pylists it in the suitetriad_reference, whose run builds a wholeparity-cudacopy and belongs to the mutation campaign of step 5 (criterion 11).bench_suite.TOOLSknowstriad_count(perf_ab.triad_count, executabledyng-compat-escher), step 1’s deviation 12 resolved; the suites are step 5’s.The records were re-run from the committed code: the oracle, the replays, the draws and the memory pre-read from
1e6e933, the timed pre-reads from729bb79(a later commit renamed two template parameters only); an earlier set of the same runs from the working tree gave the same verdicts and is not kept. A record’s commit+dirtymeans only the records and docs were uncommitted.
Machine time#
What |
Time |
|---|---|
go/no-go oracle replays (423 case replays in 9 runs; GPU 1 and the CPUs, shared lock) |
about 20 min wall per full set (sum of group times: cuda 726 s, openmp 736 s, sequential 966 s); run twice (working tree, then the committed code) |
|
under 1 min |
|
under 1 min |
memory pre-read (3 cases x 2 processes under nsys, plus the plain runs) |
about 5 min, twice |
end-to-end pre-read (5 rounds x 2 cases, base lock, exclusive, plus 4 API traces) |
about 3 min, twice |
boost probe (3 rounds x 2 cases) |
about 2 min, twice (the first attempt gave up before |
|
about 35 min |
Notes for step 3 (the CUDA port)#
Budgets (internal margin targets from 2.4, not tolerances): end to end, the counting may cost at most A’s
init.full_count + sum(update.subtract + update.add)plus 892 ms on coauth_b50k_s1 and 109 ms on syn1m_b50k_s1; memory, the triad bytes live duringhypergraph.applyat most 120.6 MiB (coauth_b50k_s1), 45.1 MiB (syn1m_b50k_s1) and 88.4 MiB (syn2m_b50k_s1).The syn gates run at base (the boost probe does not hold; ADR 0021’s rule).
--counter algorithmis the stub incpp/tests/parity/escher/triad_replay.cpp(make_counter): a counter class withbuild()(compute),apply()(dyng::updatewith the triad results; it must return the summary),counts()(baseline + deltas; also compare with a freshcompute()), andlaunches()(the launch counters per mode and shape, criterion 9).The driver’s counting path:
run()intools/compat/escher/escher_run.cppexits 2 without--no-count; step 3 adds compute (full_count_ms), the update (update_ms, between device synchronizations, the batch a host batch), A’s count lines, and the port’s NVTX batch rangetriad_count.update(triad_perf.PORT_BATCH_RANGE). The memory reading’s batch range follows.The host syncs of the port’s apply alone are 16-19 per batch (
cudaStreamSynchronize), A’s update with counting 90-96: the budget for the triad stages is the difference.The footprint between batches is the pool’s reserve (1.63-1.69 x A’s held bytes; reported, flagged above 1.05, not gated).
Step 3: the CUDA port, the API and the early gate reading (cuda-port-api-early-gate)#
GO for step 4. ESCHER-GPU’s wedge engine is ported by a reproducible transplant and six
mechanical classes, each replayed exactly; the Op form (c6) leaves the counting kernels’ machine
code identical; triad_count on cuda is exact on all 300 golden cases by key and by content; the
driver prints A’s stdout byte for byte; the early gate reading meets every margin target (update
<= 1.011, full count <= 1.003, end to end <= 0.984; the Nsight Systems peak <= 1.0015)
(parity/results/M9a.md section 3). Nothing needs the author but the new public names (ADR 0052,
D9).
What was built#
Commit |
What |
|---|---|
|
|
|
c1: the transplant ( |
|
the test CMakeLists that c1 formatted by mistake, restored |
|
c2 errors, c3 memory, c4 streams, c5 registration and counters, c6 the Op form ( |
|
the host recount on the engine’s operations |
|
the engine’s per-call state without a heap allocation; compute()’s own offsets; the tests (host and cuda) and the kit for the four patterns |
|
the driver’s |
|
the kit’s type suites in their own translation unit (a GCC 12 false positive under |
(the records commit) |
|
Deviations from the plan and the step’s text (each with the same intent)#
The transplant commit carries the infrastructure (as M8b’s
3b73335): the replay after c1 needs the API, the problem and the glue. The transplanted files are the generated transplant (transplant.py --check --rev 645d6dc: identical). c1 also ran clang-format over the triad test CMakeLists by mistake;58b0895restored it (no history was rewritten).The counters stay classes in c1 (behind a shim of A’s driver interface, a manual hunk) and become
count_full()/count_phase()in c3: their only state was device memory, which c3 moves to the workspace. The subtract and add bins are kept apart from c3 on; at c1-c2 the stats’triads_removed/triads_addedwere split from the net delta (transitional; the replays check counts only).The frontier is built by a kernel from c3 on (the deleted ids uploaded once; the inserted ids from the applied record’s device copy), not A’s host flag vector; type 1 builds no flags (its key kernel never reads them). Type 1’s full count runs over the h2v view’s keys, types 2 and 3 over the line graph’s (A’s
numHyperedgeKeys); at c1-c5 the glue gave every pattern the h2v view’s key count (the same results: the rows above the bound are empty).c6’s bins handle tests the bin’s sign only: testing the upper bound too cost one instruction per triangle in MotifOp’s hot loop, against the c6 rule (machine code equal to c5’s). M9b’s user operations may take a handle that tests both.
The host recount uses the engine’s operations (
860fb1b), not the scaffold’s placeholder nor a copy of the set primitives: still a recount (fallback_used), as the step asks. Itstriads_removed/triads_addedare every triad before and after (ADR 0052 section 2.3), so the kit’s cross-backend counters are the frontier sizes and the deltas until step 4.stats::deltaandmax_binsare in the header (the sketch’s open question 1, PLAN 5.5’sst.delta);count(bin)throws outside[0, num_bins()); the vertex limit of the classifying merge is refused bycompute()(h_motif, type 3) rather than counted (ADR 0052 section 2.5). The new names await the author (D9).compute()’s offsets have scratch arrays of their own, released when it returns: released from the update’s arrays, an update after a compute() reserved again and C8 failed. The engine’s per-call state lives in the problem (a
newper update was a host allocation C8 counts).The kit runs the four patterns as four suites: h_motif under the registered tag, the types under test-only tags with the manifest’s registry entry (C0 reads the entry); their suites are in a second translation unit (GCC 12 -O3 with
_FORTIFY_SOURCE=3reported a false-Wnonnullinstd::vector’s assignment with all four in one).The compat tools need
triad_countin the build (the root CMakeLists):dyng-compat-escher runcounts with it, so a build of a subset of the algorithms leaves the compat tools out, as it already did without mosp.The driver prints A’s
printHypergraphParamslines for a synthetic input (A prints them inside its load stage), so its whole stdout is A’s.The memory reading ran on all three gate cases (the step names coauth_b50k_s1): the tight syn1m budget of step 2 is checked too.
No container fix and no profiling were needed: every margin target was met at the first reading, so
cpp/src/hypergraphis unchanged and no ADR 0024 bar is due.The CBST source rules cover
cpp/src/algorithms/triad_countfrom c4 on (CTesttriad_count_source_rules; the script takesSOURCE_SUBDIRS).A manifest says whether its Python module exists (
python = false, experimental only;091e667): the Python registry listedtriad_countfrom the scaffold on, and the uniform-contract test of the Python layer importeddyng.triad_count, which M9b writes. The scaffold templates start withpython = false, since they generate no bindings.dyng_triad_replay_testsnow checks the algorithm counter against the oracle on its own case (a7a53cc); the case that the counter is not available stays for builds without triad_count.
Machine time#
What |
Time |
|---|---|
per-commit replays (make-test, syn1m_b50k_s1, coauth_b50k_s1; c2-c6 twice each: before the commit and recorded after it; c1 once from a worktree) |
about 75 s each, 15 min in all; the c1 worktree build and replay 6 min |
the full cuda parity (300 cases, both modes, recount per batch; GPU 1, 3 jobs) |
40 min wall (7,107 s of group time) |
host make-test replays (dev build, both modes) |
sequential 8 min, openmp 1.3 min |
the kit: host (dev) / cuda (dev-cuda) |
8.4 min / 2.4 min |
|
3 min, 12 min |
early timing reading (5 rounds x 2 cases, GPU 0 exclusive) and memory reading (3 cases under nsys, GPU 1) |
2.7 min and 1.4 min |
builds: parity-cuda (full), dev-cuda, sanitize-cuda, the fortified cpu-only build, Clang 18 syntax over 373 files |
about 40 min in all (much of it shared with the parity run) |
|
about 3.5 h, all 20 steps passed (one earlier run stopped by me after the replay test change) |
|
28 min, 2 min, 1.5 min |
Notes for step 4 (the incremental host engines)#
The operations are host-compilable (
engine/count_ops.hpp,motif_ops.hpp,stathyper_ops.hpp,sets.hpp); the host full mode ishost_count.hpp. The frontier mode is the same loop over the frontier keys with all neighbours fromloc[f], closingk > bthroughout[b], and the predicates ofengine/ownership.hpp(min_member_skips_wedge,min_member_skips_closing); the flags coverviews.h2h.max_key + 1keys.The deleted frontier is
normalized_->deletions(begin_update keeps it); the inserted oneapplied.record.inserted_ids(host). count(-) must run incount(old)(it is a no-op on the host backends now) and count(+) incount(new)withcomputing_false; finalize then callsapply_delta(minus, plus, stats)like cuda, andfallback_usedbecomes false.Then add
triads_removed/triads_addedto the kit’sdeterministic()and drop the host branch ofTriadCount.UpdatesMatchTheOracleAndTheirStats(the oracle’sremoved()/added()then apply on every backend);ABinThatWouldGoNegativePoisonsTheResulttoo.The host replays of the coverage table (sequential: make-test + the syn100k grid; openmp at 1 and 8 threads: also the syn1m s1 grid and coauth_b50k_s1 types 1-2) take
--counter algorithm.
Notes for step 5 (gates, mutations, suites, certificate)#
The early readings: coauth_b50k_s1 update 0.949-0.980, full count 0.999, end to end 0.942; syn1m_b50k_s1 update 0.872-1.011, full count 1.003, end to end 0.984; nsys peak 1.0010-1.0015. syn1m’s
update.subtractis 1.015-1.027 of A’s (inside update, which is gated).Mutation points:
engine/ownership.hpp(the two filters:triad_skip_frontier_filter_b/_k, shared with the host engine of step 4),apply_deltaand the phases’ sign (triad_wrong_bin_sign),triad_cuda_identify_affected/ the host’s inserted frontier (triad_inserted_requested_ids),count_full’s type-1 key bound and the host’snum_sources(triad_type1_unbounded_keys).cpp/src/hypergraphis unchanged: no ADR 0024 bar.The records of this step that a certificate could read are in
parity/results(the cuda parity recordM9a-parity-cuda-escher_gpu.jsonis the replay record format of compare.py, compacted).
Step 4: the incremental host engines, the kit and the mutations (host-engine-kit-mutations)#
GO for step 5. The sequential and OpenMP backends of triad_count are incremental (the
author’s decision D3): the host engine transliterates ESCHER-GPU’s wedge engine with the CUDA
engine’s operations and exactly-once predicates and runs through operators::count_delta, which
enters cpp/src/operators with triangle_delta as its other user. The host backends are exact
against ESCHER-GPU on their coverage table by key and by content (OpenMP identical at 1 and 8
threads), every backend’s stats match the oracle’s phases, the kit passes on all three backends,
and the five triad mutations plus cbst_unfill_drops_last are detected on both engines
(parity/results/M9a.md section 4).
What was built#
Commit |
What |
|---|---|
|
|
|
the host engine ( |
|
the mutation CTests |
|
D5: |
|
|
(the records commit) |
ADRs 0054 and 0055, GOVERNANCE.md, |
Deviations from the plan and the step’s text (each with the same intent)#
count_delta has two entry points (
count_delta, signed;count_owned, unsigned): the full count of compute() keeps the unsigned 2^64 - 1 limit of the public contract, while a phase of an update is limited to 2^63 - 1 per bin on the host (signed bins; the documentedcapacity_error). The step names onlycount_delta.triangle_delta is count_delta’s second user (the plan’s table names it; the tutorial algorithms count for the rule of two): its engine’s
count_ownedbecamecount_delta(..., sign, ...). cycle_count is not moved (it needs an ADR 0024 timing bar; the step takes no timed readings) anddevice_frontieris not promoted (ADR 0055).A static partition dealt in chunks (chunks of 64 sources dealt to the threads in turn), not contiguous ranges: still static and independent of the schedule; the per-thread bins are on each thread’s stack and stored to the workspace for the thread-order sum.
The host engine records launch counters too (passes and early outs per mode and shape), so
KernelPathsAndEarlyOutsruns on every backend;triad_launch_countersnames passes.A frontier id outside the h2v view is an
internal_error(a cheap host check of every frontier id), added whentriad_inserted_requested_idscrashed the host suite instead of failing it; it never fires on valid input.A new hand case (the bound goes down in the batch that deletes the top ids) was needed for
triad_type1_unbounded_keys: with the bound going down later, the rows past it are already empty and the mutation reads zeros.The mutation hooks sit in the host-engine commit (
779dcfd, inert without their defines); the commit after it adds the CTests and the mutate.py suite.cbst_unfill_drops_lastagainst the triad suite is the CTesttriad_count.mutation.cuda.cbst_unfill_drops_lastand the mutate.py entrycbst_unfill_drops_last_triad(a second name for the same define in the suite triad_count).The kit’s OpenMP thread count is a trait (
test_traits::kit_openmp_threads, default 4; triad_count 8):resources_fortakes the case type. Other algorithms’ kits are unchanged.D5 is carried out in this step (the step allowed it “only if the author raises the budget”, which D5 did on 2026-10-15): the fixture holds the synthetic make-test groups (01, 03, 07, 12; 3,737 bytes); the file-input groups run on stand-ins against the oracle (A’s awk inputs are not reproduced). The hosted test runs types 1 and 2 on the syn100k groups and every pattern on the small ones; the triangle patterns on the heavy groups are a
parity/slowtest (5 min in Release).parity/mutate.pylooked for test executables incpp/testsonly (the triad suites are incpp/tests/algorithms/triad_count): fixed inc8b6e68after its first run reported the control as a failed build.The host parity records were re-run from the committed build (
c8b6e68): the first runs used the uncommitted tree and recorded the old HEAD. The openmp 1-thread run of that first pass was stopped and only the rerun counts.Sanitizers on the triad, operator and triangle tests (
ctest -L 'triad_count|operators|triangle_delta'in each sanitizer preset), not every CPU test;tsan-openmpwith R020’s local Clang 18 wrapper (recreated; it adds the rpath only when linking) and the conda Archer.gpu_local ran its
buildandtriadsteps only, plus compute-sanitizer memcheck on the triad and operator CUDA tests andctest -L 'operators|triad_count|triangle_delta'on dev-cuda; the full gpu_local run is step 5’s.
Machine time#
What |
Time |
|---|---|
host parity at |
15, 10 and 32 min wall; the first pass from the uncommitted tree about the same |
|
about 60 min (one aborted first run of 10 min) |
|
about 60 min, concurrent with the sanitizers and the mutations |
sanitizer presets (builds and the triad tests): asan, tsan, tsan-openmp |
about 25, 15 and 20 min |
gpu_local |
about 75 min |
dev, dev-cuda, parity-cuda builds and the kits |
about 40 min |
Notes for step 5 (gates, mutations, suites, certificate)#
certify.py’s interim rule (step 1) can now require the triad replays of all three backends per the coverage table, both modes: the records areM9a-parity-cuda-escher_gpu.json(step 3) andM9a-parity-{sequential,openmp8,openmp1}-escher_gpu.json(this step).The mutation record
M9a-mutate-triad_count.jsonis the triad part of the 0.3 mutation evidence;ctest -L mutationcovers the same mutations in every build.Nothing changed in
cpp/src/hypergraphor the CUDA kernels’ machine code: the step-3 gate readings stand; no ADR 0024 bar is due.
Step 5: the gates, the ESCHER suites and the 0.3 certificate (gates-suites-certificate)#
M9a is complete; nothing stops at a gate. Every gated row is within its bar against
ESCHER-GPU@abcf9b2 re-measured in the same session: the timing gates 45 / 45 (update per batch
0.858-1.028, full count 0.999-1.002, end to end 0.941-0.987; coauth-DBLP 11 rounds and syn1M /
syn2M 21 rounds, all at the base lock), the memory gates 11 / 11 (store accounting 1.0000 at every
gated point, the Nsight Systems peak 1.0010-1.0015). The final replays are exact on the coverage
table, the two ESCHER suites validate and pass, and the dry 0.3 certificate of triad_count
passes recheck_gates (parity/results/M9a.md section 5). No C++ changed in this step.
What was built#
Commit |
What |
|---|---|
|
|
|
|
|
|
|
|
|
the memory rows from the peaks’ bytes (found by the dry run), the compacted records drop the per-round stage timers |
(the records commit) |
ADR 0056 and its GOVERNANCE line, |
Deviations from the plan and the step’s text (each with the same intent)#
The gates ran from
4036351, the final parity replays from the build of7a2393f/4036351: the same library (git diff 7a2393f 4036351 -- cpp tools cmake CMakeLists.txt CMakePresets.jsonis empty); the commits after4036351change only Python, YAML and records. The certificate’s rule (the library scope) is what makes them the release’s readings.The suites’ split is ours (ADR 0056 section 2): ESCHER-GPU’s repository does not tell ESCHER’s readings from ESCHER+’s. The tkde suite’s “batch sizes” reading is a memory reading (coauth 100K and 200K), so that the timing reading of the same batch sizes, in the ipdps suite, is not run twice.
The ungated sub-stages are suite metrics row by row (
update.subtract[b1]…), because a per-batch region’s rows are its metric names (ADR 0048 section 1.5);tkde26_escher_pluslists only the memory metrics: a suite gates timing only where it has a gated run reading (bench_suite.validate).A contamination audit was added (ADR 0056 section 4: load average above 16 or procs_blocked above 4 at a side’s start or end, or a foreign GPU process, flags a gated reading, which the summary refuses). No reading was flagged; the monitor repeated two rounds.
The triad bytes during
hypergraph.applyare measured, not estimated: the difference of the peaks insidehypergraph.applyof the counting port and of a third, non-counting run of the same process (2.8 / 1.4 / 2.4 MiB).The store gate on the synthetic inputs reads A’s two print points, the values the golden recording and A’s own
[memory]print agree on; the middle points are recorded (equal).write --dry-run <algorithm>is how the dry certificate marks the other suites, golden sets, checks and fixtures as outside it; it refuses a results directory insidebenchmarks/results/.The dry run found a harness bug and it was fixed before the records were summarized again: the summary had put the record’s byte ratio next to MiB rounded to 0.1, so
recheck_gatescould not recompute thedevice_memoryrows. No reading was repeated (the records hold the bytes).The committed fixture of A’s make-test counts is listed in
fixtures.toml(step 4 had committed it without the entry), so a certificate reports it with its hosted test.The compacted records drop the per-round stage timers of triad_count (every row keeps its samples), to keep the committed records small (about 0.8 MB with the dry certificate).
The kernel reading is per batch and phase (12 launches of each process after the full count’s 2), recorded, not gated; the step’s “11 rounds” are kept.
The mutation campaign ran the suites triad_count, cbst, hypergraph and kit as the step asks;
triad_reference(step 2’s oracle mutation) is shown by its CTest in every build.The ADR index (
docs/adr/README.md) gains the rows of ADRs 0054 and 0055, which step 4 left out, beside 0056’s.The step was resumed after a pause (the orchestrator stopped it at about 03:10 UTC on 2026-10-16, at its end): the gate readings, committed code and records were kept (they were measured on the step’s final library code);
ci/gpu_local.sh, started at7f65284before the pause, ran to completion and is used as it is (nothing but docs and records changed after7f65284); the records were committed after the resume, with section 5.7-5.8 ofparity/results/M9a.md(the checks and the acceptance criteria one by one).
Measurements and checks#
Check |
Tree |
Result |
|---|---|---|
the timing gates ( |
|
45 / 45 within, 0.858-1.028 (results 5.1); no audit flag (5.2) |
the memory gates ( |
|
11 / 11 within: store 1.0000, nsys peak 1.0010-1.0015 (5.4) |
recorded readings: default clocks, 100K / 200K batches, types 1-3, the kernels (ncu), SASS, the M8b maintain reading |
|
5.3 (kernels 1.001-1.006; SASS as step 4; maintain 0.814 / 0.851) |
the final replays ( |
|
cuda 300/300, sequential 120/120, openmp 142/142 at 8 and at 1 thread (identical) (5.5) |
the dry 0.3 certificate ( |
|
PASSED (after the fix of deviation 8); fails with a gate row or a replay removed (5.6) |
|
|
control passed, 17 / 17 detected (the five triad mutations and cbst_unfill_drops_last on the triad suite, 7 CBST, 3 hypergraph, the kit’s planted bug); |
|
|
all checks passed: cpu-only 1,244 / 1,244, dev 1,277 / 1,277, consumer, tidy, reuse, provenance, testdata (1,002,671 of 1,250,000 bytes), regen, harness, python, api, scaffold (80 + 3 + 54 + 41), docs, pre-commit |
sanitizers, |
|
asan (ASan + UBSan) 247 / 247; tsan-openmp (Clang 18 + Archer) 247 / 247 (the |
a fresh clone of |
clone |
cpu-only with |
Clang 18 |
|
401 files, 0 failures |
|
|
all 20 steps passed ( |
frozen headers: |
HEAD |
empty (both) |
|
HEAD |
empty: no ADR 0024 bar due |
ESCHER-GPU’s working tree ( |
empty |
Machine time#
What |
Time |
|---|---|
the final replays: cuda (3 jobs), sequential (6), openmp 8 threads (3), openmp 1 thread (10) |
36, 11, 9 and 26 min wall (GPU 1 and the host, shared lock, concurrent) |
the gate readings (both suites, the kernels, the maintain reading; exclusive lock on GPU 0, memory on GPU 1) |
22:57-00:15 UTC (78 min, after waiting 32 min for the replays’ shared locks) |
|
41 min (19:15-19:56 CDT) |
|
about 70 min, 60 min and 25 min |
|
3 h 50 min (19:18-23:08 CDT; started one minute after |
The review fixes (2026-10-20)#
Independent reviewers confirmed 26 findings against fe9c56c (four lenses: parity and ownership,
gates and memory protocol, GPU robustness and sanitizers, integration and records). All are
fixed in this branch; none needed a frozen header, a relaxed gate or a changed protocol, and no
stop condition was met. The library changed (ADR 0057, the scratch headroom, the host model’s
growth), so the replays and every gate reading were taken again on the final library
(parity/results/M9a.md section 6): exact on the whole coverage table, the timing gates 45 / 45
(update per batch 0.853-1.019), the memory gates 11 / 11 (store 1.0000, the Nsight Systems peak
1.0015-1.0021), the dry 0.3 certificate passed over the new records, and the step-5 records are
now refused by it (stale library, no count guard on the memory runs).
The findings and their fixes#
# |
Finding (severity) |
Fix |
|---|---|---|
1, 14 |
type 1: C(|e|, 3) in signed 64-bit, wrong from 2,097,152 members (UB on the host, a wrapped value and a poisoned update on cuda; the oracle wrapped from 2,642,246) (blocker / high) |
|
2 |
no overflow detection on cuda (a type-1 total past 2^64 - 1 wrapped) (medium) |
|
3, 15 |
type-2 / type-3 products in signed 64-bit and unchecked sums on every backend and in the oracle (medium / high) |
|
16 |
the signed phase bins refused a valid update of 2^63 or more triads of a bin (internal_error on cuda, a false capacity_error on the host) (medium) |
|
17 |
the frontier flags reserved exactly: a free and a malloc in count(-) of nearly every batch (criterion 7) (medium) |
|
18 |
the update guarantee left out a failure inside the commit (medium) |
|
4 |
the golden set hashed the GPU (recipe, raw-trace digest) and |
|
5 |
the comparator never compared what the container deleted with A’s batch (low) |
|
6 |
the oracle’s isolation check ran |
|
7 |
certify.py accepted a 0.3 summary missing one case’s gated row (high) |
|
8 |
the medians and |
|
9 |
the host-model asymmetry of the gated update (medium) |
|
10 |
|
|
11 |
the memory readings had no count guard (medium) |
|
12 |
the protocol fields of the triad records were not validated (low) |
|
13, 23 |
ADR 0056 named records that do not exist; the 5-round re-take in a quiet window (low) |
|
19 |
the build impact was not recorded (low) |
recorded below (ci-cuda13 at |
20 |
the triad tests were likely to push the hosted cpu and sanitizer jobs past 60 minutes (high) |
|
21 |
D4, D6-D10 (and D11) missing from GOVERNANCE.md’s Open decisions (medium) |
|
22 |
the names of ADRs 0049 and 0051 accepted under delegation (medium) |
|
24 |
ADR 0052 still described recounting host backends (low) |
|
25 |
the compile-fail test matched any diagnostic naming |
|
26 |
a stale comment above |
|
Deviations (each with the same intent)#
M9a criterion 6’s “Device bins are signed 64-bit, with minus and plus kept apart” becomes (ADR 0057): the device bins are unsigned 64-bit magnitudes, minus and plus kept apart, the signs recorded and applied in
apply_delta; a bin that would go negative still raises internal_error and poisons the result. The signed bins could not hold a valid phase of 2^63 or more triads.ESCHER-GPU has the same overflows (
Choose3Op,Type2Op,Type3Op, plainatomicAdds): dynG is exact where A wraps or is undefined. No golden case comes near the limits (coauth’s largest hyperedge has 280 members), so the parity stays exact; the deviation from A is recorded here and in ADR 0057.The machine code of the counting kernels changed (
M9a-review-sass-escher_gpu.json): count_wedges identical to A; keys152 -> 288 instructions, pairs 456 -> 512, triangles 512 -> 576 (the checked arithmetic); triangles 536 -> 560 (step 5: 552; motif_op’s per-triangle adds stay unchecked, ADR 0057 section 1, the global flush is carry-tested). The gated h_motif kernels read 1.002-1.006 of A under ncu (step 5: 1.001-1.006). StatHyper types 1-3 stay below A on coauth (update 0.72-0.96). The triad conformance kit left the hosted sanitizer jobs (label
slow): under ASan and TSan-OpenMP its four C2 cases had not finished after 13 minutes in a hosted-runner emulation. It still runs in the hostedcpu.ymljobs, inci/check.sh, and under both sanitizers locally at each milestone (as here: 258 / 258 each).The reviewers’ “re-take two 5-round readings in a quiet window” was met by taking every reading again in full (the gated ones at 11 and 21 rounds), because the library had changed.
Notes#
The host model in the gated update (D12, for the author). The gate compares the library’s
updatewith A’supdate, as approved; A’s timer contains its host model (1.5-2 ms a batch, 7-13 ms where its vector grows), the port’s driver keeps its host model after its timer. The driver’s host model (escher_host_model::apply: it validates, sorts and copies each inserted row) costs 5.7-6.6 ms a batch (11-18 ms where the vector grows), so the reportedupdate_with_host_modelrow reaches 1.057-1.061 on three syn2m rows at the base lock (1.070 on syn2m b2 at default clocks), while the library-only comparison (A’s update minus its untimed in-maintain time against the port’s update) is at most 1.031. Nothing in the gate changed; a cheaper driver host model (it sorts rows that the generator already gives sorted) is a library change (cpp/src/generators) that would make every reading stale again, so it is left for the author’s decision rather than made at the end of the review.The footprint between batches is 1.63-1.80x A’s held bytes (D11, unchanged in kind; the scratch headroom adds 1.4 MiB at most to the triad bytes during the apply: 4.2 / 2.1 / 3.6 MiB against 2.8 / 1.4 / 2.4).
Build impact (finding 19)#
The compile-only ci-cuda13 preset (CUDA 13.1, release architectures, every instantiation and
mutant), built from git archive copies at the M9a base 9cde147 and at the review’s library
(e015a12), -j 28 on the shared machine (load 40-95, so the step times are upper bounds;
CPU-minutes are the sums of .ninja_log step times):
|
M9a (review fixes) |
|
|---|---|---|
wall |
355 s |
314 s |
CPU-minutes, the whole preset (885 / 1,032 steps) |
153.8 |
138.3 |
of which the six triad host mutants and cbst_unfill_drops_last’s copy (one architecture each) |
- |
12.4 |
of which the triad library units ( |
- |
1.8 |
|
40,244,088 / 39,149,600 B |
41,659,800 / 40,516,800 B (+3.5 %) |
The two totals differ by less than the machine’s noise (the base build ran at a higher load);
what M9a adds is about 14 CPU-minutes, inside the hosted cuda-build’s 120-minute timeout. The
plugin wheels are built and measured in M9b’s packaging step; at +3.5 % of libdyng they stay far
below the 90 MB budget (M8b: dyng-cu13 8.19 MB, dyng-cu12 8.27 MB).
Hosted-CI margins (finding 20)#
ctest -L cpu on 4 jobs pinned to 4 hardware threads of the loaded machine (a hosted-runner
emulation; the hosted jobs also build first): dev preset (Debug) 1,280 / 1,280 in 703 s; asan and
tsan-openmp with -LE slow (what sanitizers.yml runs after 13f305e) 1,139 / 1,139 in 515 s
and 981 s. Before 13f305e the asan run was stopped after 821 s with the kit’s C2 cases still
running. The 60-minute job timeouts keep their margin; no timeout was raised.
Checks of the review fixes#
Check |
Tree |
Result |
|---|---|---|
the replays ( |
|
cuda 300/300, sequential 120/120, openmp 142/142 at 8 and 1 threads (identical), both modes |
the gate readings (both suites, the kernels, the maintain reading) |
|
timing 45 / 45 within (0.853-1.019, 0.998-1.003, 0.915-0.983), memory 11 / 11 (1.0000; 1.0015-1.0021); the dry 0.3 certificate PASSED |
|
|
control passed, 17 / 17 detected ( |
|
|
every step passed but provenance (and pre-commit’s provenance hook): the new |
|
|
all 20 steps passed in 3 h 43 min: |
ASan + UBSan and TSan-OpenMP (Clang 18 + Archer), |
the final library (built at 16:30 after |
258 / 258 each (the host limits tests included) |
hosted-CI emulation, |
dev, asan, tsan-openmp |
1,280 / 1,280 in 703 s; 1,139 / 1,139 in 515 s and 981 s ( |
Clang 18 |
|
420 files, 0 failures |
cpu-only with |
|
built without warnings |
frozen headers against |
HEAD |
empty (no ADR 0024 bar due) |
ESCHER-GPU’s working tree |
|
|
signatures |
|
every commit SSH-signed ( |
Machine time#
What |
Time |
|---|---|
the replays (cuda 3 jobs, sequential 6, openmp 8 threads 3, then 1 thread 10) |
36, 15, 13 and 30 min wall (concurrent, the shared lock) |
the gate readings (both suites, the kernels, the maintain reading) |
18:48-19:43 CDT (55 min, exclusive lock on GPU 0; memory on GPU 1) |
the golden export twice (two fresh patched copies, GPUs 1 and 0) |
ended 17:41 CDT (a first attempt failed when a concurrent rebuild replaced libdyng under it, and was run again) |
the build impact (two ci-cuda13 builds) |
12 min |
|
34 min, 45 min and 3 h 43 min (19:47-23:31 CDT) |
The milestone#
Deviations of M9a from PLAN 6.4.6, 4.6 and 11.3 (the milestone)#
PLAN 6.4.6: the parity runs by content and by key on every backend from the start (the M8 id parity held); the coverage per backend is the plan’s default (D6, pending the author); the gates are read against A re-measured in the same session, never against the README’s figures (which are recorded as
paper_reference); the paper’s coauth gate is read per batch (update[b1..b3]) rather than as one figure; the device memory is read twice, as store accounting (2026-10-07) and as the Nsight Systems peak (D1). The open bins 21-26 stay 0 (verified on every golden). Theexperimental::count_local_patternsexposure and its tutorial are M9b’s (D2).PLAN 4.6: the host backends are incremental host engines, not recount-based references (D3, ADR 0054); the independent oracle is
testing::triad_reference.PLAN 11.3: M9 runs as M9a and M9b (D2);
triad_countstays experimental and not frozen until M9b (D4); the 0.3 certificate’s plumbing (both suites, the triad replays from 0.3) is in M9a, the release’s certificate itself at 0.3.0.
Effort#
M9a’s five steps ran on 2026-10-15 (CDT), from the region map (step 1, early morning) to this
step’s records (evening): one day of wall-clock time for the milestone, against the plan’s
re-baselined “M9 in 3-5 days plus the review and fix steps” (M8b’s retrospective). Machine time
dominated the later steps: the golden export (62 min), the replays (about 1.5 h per full set of
backends), the mutation campaigns (about 1 h in step 4, 41 min here), ci/gpu_local.sh
(about 3.5 h in step 3, 3 h 50 min here) and the gate readings (78 min). The review fixes took
one more day (2026-10-20), most of it machine time: the replays, the golden export twice, every
gate reading again and the final checks (“The review fixes” above).
Ready-to-paste pull request summary#
## M9a: triad_count exact against ESCHER-GPU, with its gates (0.3)
`triad_count` (experimental; `<dyng/triad_count.hpp>`): ESCHER-GPU@abcf9b2's 30-bin h-motif
counts and StatHyper's triad types 1-3, kept exact under hyperedge batches on the sequential,
OpenMP and CUDA backends (PLAN 6.4.6; the author's decisions D1-D3 and D5 of 2026-10-15).
**Parity (exact).** The golden set `triad_count_escher_gpu` (PLAN 6.4.6's grid of 240 cases plus
ESCHER-GPU's `make test`, 300 cases, exported twice with identical manifests; ESCHER-GPU agrees
with its own CPU reference on 90 runs) replays exactly by key and by content: cuda 300/300,
sequential 120/120, OpenMP 142/142 at 1 and 8 threads (identical). An independent oracle
(`dyng::testing::triad_reference`, its own class map) reproduces ESCHER-GPU everywhere and checks
every backend's stats. Kit (C1-C12 but C4) on every backend; the five triad mutations of PLAN 8.4
and cbst_unfill_drops_last detected on both engines. Counts are exact up to 2^64 - 1 on every
backend and refused past it with capacity_error (ADR 0057; ESCHER-GPU's StatHyper arithmetic
overflows from 2,097,152 members per hyperedge, found by the review).
**The CUDA port** is a reproducible transplant of ESCHER-GPU's wedge engine in six mechanical
commits; count_wedges' machine code equals ESCHER-GPU's, the h-motif triangle kernel adds an error
word and a carry-tested flush (+24 instructions), the StatHyper kernels checked arithmetic.
**The host engines** are incremental (D3), through `operators::count_delta` (ADR 0055).
**Gates** (against ESCHER-GPU re-measured in the same session, base clock lock, GPU 0, exclusive
lock; `benchmarks/paper/ipdps26_escher.yaml`, `tkde26_escher_plus.yaml`):
| | coauth-DBLP 50K s1-s3 (11 rounds) | syn1M / syn2M 50K s1-s3 (21 rounds) | bar |
|---|---|---|---|
| update, each of 3 batches | 0.949-0.971 | 0.853-1.019 | 1.05 |
| full count | 0.998-0.999 | 1.002-1.003 | 1.05 |
| end to end | 0.915-0.916 | 0.967-0.983 | 1.10 |
| store accounting (every gated point) | 1.0000 | 1.0000 | 1.05 |
| Nsight Systems peak of live allocations (D1) | 1.0015 | 1.0021 / 1.0017 | 1.05 |
Read on the final library, after the review fixes (`parity/results/M9a.md` section 6). Host
synchronizations per batch 19-22 against ESCHER-GPU's 90-96. The footprint between batches (the
stream-ordered pool's reserve, 1.63-1.69x) is reported, not gated (D1). Reported beside the update
gate: ESCHER-GPU's update contains its host model and the port's driver keeps its own after the
timer; with the driver's host model added the port is up to 1.061x on three syn2m rows (D12).
**Certificate.** From 0.3 `parity/certify.py` requires both ESCHER suites (the store rows
rechecked point by point) and the triad replays of every backend of the coverage table by key and
by content, every gated row of every case with its medians recomputed from the samples, and the
protocol fields; the dry 0.3 certificate of `triad_count` passes
(`parity/results/M9a-review-gates/`).
**Checks** (at the final library, after the review fixes). `ci/check.sh` all passed; `ci/gpu_local.sh` all 20 steps passed on GPU 1 (819 GPU tests; memcheck, synccheck and initcheck on the triad CUDA tests and a coauth batch; racecheck on C1, C11, C12 and the make-test replays); ASan/UBSan and
TSan-OpenMP on the triad tests; a fresh clone (CPU-only fortified, CUDA); Clang 18 syntax;
frozen headers unchanged (`git diff 65a62c9 -- cpp/include/dyng/{hypergraph,update.hpp,core,graph}`
empty); the mutation campaign 17 / 17 detected.
**For the author**: D4 and D6-D10 are taken on the plan's defaults pending the 0.3.0 release
(GOVERNANCE.md); the new public names (D9: ADRs 0049, 0051, 0052); D11, whether a later release
trims the pool between updates; D12, the host model in the gated update. ADRs 0048-0057. Records: `parity/results/M9a.md`,
`docs/developer/retrospectives/M9a.md`. M9b (count_local_patterns, Python, the CLI, the freeze)
follows on a stacked branch. Merge with a merge commit.
🤖 Generated with [Claude Code](https://claude.com/claude-code)