wai-ops: the reference crate and conformance vectors for wai-ops/1 (D2a) #206
Loading…
Reference in a new issue
No description provided.
Delete branch "wai/d2a-operators-crate"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds
wai/wai-ops, the reference crate forwai-ops/1, together with its conformance corpuswai/ops-conformance/, an independent checkerwai/tools/wai_ops_check.py, and thewai-ops.ymlworkflow. This is phase D2a of the integer operator set.Stacked on #202. The branch starts at #202's head, so until #202 merges this diff also shows the
integer-operators.mdtext. Merge #202 first.What lands
wai/wai-opsisno_stdwithallocand has no dependencies. It contains:xint, a 512-bit integer that saturates as §8.1 requires;json, with the canonical writer of §8.5;graph, which parses and writesWHG1(load steps 1–6), plusLoaded;plan, the load-time and run-time plans;interp, every graph operator of §5;stage, E1–E13;lower, the six lowerings of §13.Load step 8 (the bounds pass and verdict) is not built yet; it comes with the certifier. In the default build, step 8 refuses every graph. The interpreter runs only a
Loadedgraph, and onlygraph::loadmakes one, so the default build decodes nothing. Theuncertifiedswitch skips step 8 and is enabled only by the tests, the conformance tool and its browser-engine build.wai/ops-conformance/, written bywai-ops vectors gen, contains:certificates/index.json.The README now points to §14.1 for every field. It also lists what waits for step 8.
wai/tools/wai_ops_check.pyuses the Python standard library only and shares no code withwai-ops. It:load(steps 1–8) andprofiles, from its own bounds pass and verdict;wai-ops.ymlruns these legs:vectors verify;vectors verify;Review findings and what changed
Fourteen findings. Thirteen are fixed in full. The fourteenth (the checker, #6) is fixed except for its step-8 vectors, which wait for step 8 (see "Not in this PR"). Text fixes are on #202, and code fixes are here.
The
atof an E8 refusal named the wrong position. Only theinstep set the position, so a refusal in a position'soutstep (insgm, the flush after an escape) named the lastinof its group. Theoutstep now sets the position too, in the crate and in the checker.mans_decode/sgm/40goes fromat=11toat=10. §14.1 now definesatfor a flush that belongs to no single position. The review's E8 fuzz, rerun on this binary, shows 0atmismatches in 12,000 cases. With the fix reverted, one seed alone shows 45.E9's 32-bit form overflowed near the i32 limits. The text now states the condition under which it fits. In the code,
residual_step_i32checks that condition in debug builds, and two tests cover the limits. There are also 32 newresidual_stepvectors at the i32 limits.E12's widths were wrong. The text now says every value fits i50; the earlier claim was 47 bits. Three new
rate_predictvectors sit at the i16 extremes with rates near 2^32.Exactness-boundary vectors were missing. Those that depend on load step 8 cannot be written until step 8 exists. The README now lists them as deferred, so the corpus no longer appears to cover them (see "Not in this PR").
§13.2 and ReLU inputs. The crate and the checker now follow the text: a tensor that a ReLU reads, other than the network's input, is
derived. The checker'sx_recordwas rewritten from the §13.2 wording. This regenerated:h_sgraphs of the int_hyper set7aceaa1a…and of the int_mlicpp sets07e1835d…and7ef44f3b…;lower_whm1andlower_wmb1vectors.No output changes. With the old rule restored, the checker fails all three graphs.
The checker did not check
profiles, step 8 or the lowering vectors. It now has a bounds pass and verdict written from §8.1–§8.5, with saturation at every primitive. It runs step 8 and recomputesprofiles, which agree with all 1,599 tags and with Appendix C for every committed set. Each lowering vector's graph must now equal its re-lowered role. §14.1 (#202) now states the rule that a refused load lists both profiles.atwas defined only in the README. It is now normative in §14.1, and the corpus follows it (see 1).Some refusal codes were unstated. §5E now states that a broken condition is refused with
model_mismatchbefore any symbol, and lists the exceptions. E8 is reworded. No vector changes, because the corpus already gave these codes.Input value checks had no stated place. §4 step 4 now applies each input's policy first. The existing
run/order/10pins this: with the check moved into step 1, that vector fails.Some vector fields were defined only in the README. The operand, mode and layout table is now normative in §14.1, including the predictors' fields and their CHW layouts.
Gaps that only the crate settled. Each is now in the text and has a vector that a different reading fails:
cout·uh·uwelements is capped;max_elems;m_bytesandg_bytesare 4 or 8.Eleven checker mutations, one for each reading, each fail on exactly one new line.
subpos_mergenow caps its sides before its shape rule, as §4 says. No input within the caps can tell the two orders apart.Step 8 could be bypassed.
runnow takes&Loaded.compile_fail(E0308) doc test shows that an unloaded lowered graph does not compile as an argument torun. The review's bypass now fails to compile, andgraph::loadof the same bytes returnsLoad(8).tests/step8.rsruns in every build.The
paths:filter missed the goldens' digest file. Both filter lists now takewai/neural-conformance/**. The repo's matcher now says True forsha256.json.The tests never ran on a 32-bit target. The wasip2 leg now runs
cargo testunder wasmtime in both builds. The native default build runscargo test, so the step-8 and doc tests run.Not in this PR
The vectors that need load step 8:
sigmoidandeluat −2^63;rqwhoseqpasses 64 bits whileyfits;lut16or acheckrange refused by the bounds pass;graphs/load.jsonl.The plan places them in D2b with the certifier. The checker already runs step 8, so they are checked as soon as they land.
A checker written by a session that has read only the text. The original checker was written after the crate, in the same session. The review found two places where it copied the crate: E8's positions and the ReLU rule. Both are now rewritten from the text. The bounds pass was written from §8, starting from a pass the review wrote from §8 alone. The session that made these fixes had read the crate, so the text-only checker the plan calls for is still owed before D2a closes.
Exit tests
All of these ran at this head:
cargo test --locked(default build): 13 unit tests, the step-8 test, and 2 doc tests;cargo test --locked --features uncertified, in debug and release: 13 unit tests, 6 goldens (3 ignored), the step-8 test, and 2 doc tests;wai-ops vectors verify ..: 53 vector files, 2,794 vectors, 17 sets re-lowered, 93 files regenerated, every byte equal.cargo testbuilds pass, andvectors verifypasses.Falsification
Each fix was committed before it was falsified.
vectors verifyfails onmans_decode.jsonlline 41, and the checker fails without itsoutposition.residual_form_condition_is_tightfails.profilestag;acc32parameter conditions;checkpolicies againstacc32;igdnonce;rq.pasacc.runtaking aGraph(12). Thecompile_faildoc test fails ("compiled successfully").Checks run
check-public-names.shandcheck-comparative-prose.shwere run one file at a time on every changed text-bearing file and on this body. All were clean.check-no-vanity-metrics.sh,check-wai-section-refs.pyandcheck-workflow-concurrency.shwere clean.wai-ops,ops-conformance,wai_ops_check.pyorwai-ops.yml.🤖 Generated with Claude Code
profilestooprofilesrecomputed, lowering vectors tied to their roles 8aff0cb5d6