Repository navigation
tools: set-diff and check-int-twins take a row's file name from manifest.py - #186
Conversation
…est.py manifest.dump_file_name forms `<stem>.<occurrence>[.input][.logical].<ext>`, the name the dumpers give a row's file, as dump_file_name in crates/refset does; the stem is the manifest name with every `/`, `\` and space made `_`. set-diff.py's stem and check-int-twins.py's safe_name held the stem rule each, and three call sites built the rest of the name by hand; all of them now call manifest.dump_file_name. The manifest self-test pins the full name for an input's logical twin whose name has all three characters, and for a tensor's flat f32 file.
There was a problem hiding this comment.
Verdict: CLEAN: The shared naming function preserves existing file names, and its callers preserve validation.
Checked
Duplicates: 1 new function checked; the Python copies are removed. Rust and C++ use the same naming rule.
Complexity: no Rust functions changed. The caller changes remove local naming logic.
Silent failure: 2 suffix fallbacks followed through all callers. Invalid twin kinds and layouts produce failures before file reads; other callers supply valid values. The helper matches the replaced Python expressions.
Tests: fixed expected names at tools/bloomery/manifest.py:209 would fail if slash, backslash or space replacement were dropped, either suffix were dropped, suffix order were reversed, or occurrence were incremented.
Gates: no existing pin, threshold or test removed or relaxed. The PR reports FAIL-first and naming mutations for the added assertions.
Escape catalog: no matching pattern. Only tools change; no inference hot path is touched.
Notes
Dryer and crapper did not run because no Rust file changed.
The PR reports all three self-tests pass. Validation checked the source; those runs were not independently repeated.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
The review is done and the contribution check passed, so I'm merging this. |
What and why
Closes #136.
A reference set's files are named
<stem>.<occurrence>[.input][.logical].<ext>, where the stem is the manifest name with every/,\and space made_. On the Python side,tools/ref/set-diff.py(stem) andtools/ref/check-int-twins.py(safe_name) each held the stem rule, and three call sites built the rest of the name by hand. This PR addsdump_file_nametotools/bloomery/manifest.py, the Python side's one reader of reference sets, and all three call sites use it. It takes the same arguments in the same order asdump_file_nameincrates/refset/src/ik.rs, which forms the same names on the Rust side.Code shape
manifest.py.stemandsafe_nameare deleted, and nothing else called them.tools/check-comments.shis clean.cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up. Not applicable: no Rust file is touched, so I did not run them.Duplication found or removed (
path:line):tools/ref/set-diff.py:52andtools/ref/check-int-twins.py:71, and the hand-built names attools/ref/set-diff.py:79,tools/ref/check-int-twins.py:122(check_set) andtools/ref/check-int-twins.py:209(write_set).crates/refset/src/ik.rs:90(dump_stem) and:99(dump_file_name). These are already the single Rust owner.crates/gpu-gates/src/lib.rsonly re-exportsdump_stem.safe_namein the four dumpers that write the files,tools/ref/dump_ref.cpp:149,tools/ref/dump_draft.cpp:100,tools/ref/dump_mtp.cpp:121andtools/ref/clefvis/dump_mtmd.cpp:200. Three of their builds record the sha256 of their one.cpp(build-dump.sh:17,build-dump-mtp.sh:57,clefvis/build-clefvis.sh:42), anddump.sh,dump-mtp.shandclefvis/clefvis.shrefuse a binary whose record does not match its source.dump_draft's record names its ik build and patch, not the.cpp. A shared header would sit outside that record, so movingsafe_nameinto one means changing those build records and checks as well. That is left for a separate change.dump_file_namegives the same names as the code it replaces. I compared it with the old check-int-twins and set-diff compositions on about 5,000 names (a/b\c d, an empty string,x// y,attn_norm-0 (view), and random strings of/,\, spaces, tabs, dots, dashes, brackets and non-ASCII characters), with two occurrences, both kinds, both layouts and the three extensions: 120,096 file names, all equal. The C++ copies replace bytes where the Python one replaces code points. Every byte of a multi-byte UTF-8 sequence is 0x80 or above, so none equals/,\or a space, and both give the same names.What I ran
On 355fd59:
The manifest self-test pins the rule with fixed expected names:
attn_q_k_v-0.(view).0.input.logical.i32for an input's logical twin whose name has a slash, a backslash and a space, andl_out-3.2.f32for a tensor's flat f32 file. Beforedump_file_nameexisted, this test failed with aNameError. I then broke the function five ways (no space rule, no backslash rule, no.input, no.logical,.logicalbefore.input), and the manifest self-test failed for each one. The check-int-twins self-test writes and reads its set through the same function, so it shows that the calls resolve, not that the rule is right.bash tools/check-recipes.shexited 0 on the commit before the review fixes (e39f5f6e, on 3d750af;check-recipes: 54 tool self-tests ok). Its tool self-test list includes the three Python self-tests above. After the fixes and the rebase onto 15838a4, which changes onlydocs/contrib/dgx-spark.md, I reran those three self-tests, not the full script.Hardware (if the change is for a machine)
Not a machine-specific change.
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.