Skip to content

ci: loomc_pair_check reads every ggml-hrx subdirectory, not just the top one (engine#2916) - #2975

Merged
bong-water-water-bong merged 1 commit into
mainfrom
1bit/loomc-pair-recursive
Nov 20, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
1bit/loomc-pair-recursive

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Refs #2916. One file: the pair census reads every ggml-hrx subdirectory, not just the top one — 22 files today, 238 after this.

The gap, demonstrated on a copy of the pinned fork

symbols_used() globbed *.cpp/*.h in a single directory:

for f in sorted(fork.glob("*.cpp")) + sorted(fork.glob("*.h")):

ggml/src/ggml-hrx has 216 more sources under runtime/, dispatch_registration/, graph/ and hip/ — and runtime/loom-kernel-jit.cpp is precisely where a loomc_ call goes next. So a use there would have been invisible, and the tool would have answered ok about a tree it had not read. Measured, on a copy of the pinned fork with one added file:

$ cat ggml/src/ggml-hrx/runtime/loom-kernel-jit-new.cpp
using X = loomc_moved_into_runtime;

$ main     → loomc_pair_check: ok -- 93 loomc_* symbol(s) used, all 655 declared      rc 0
$ this PR  → loomc_pair_check: 1 of 94 loomc_* symbol(s) used by the fork are NOT declared
               loomc_moved_into_runtime                                                rc 1

That is the one failure mode this tool must not have: the pair it exists to check, reporting a clean pair about a symbol it never counted.

The change

source_files() walks rglob("*") and keeps *.cpp/*.h, skipping any path with a dotted or build* component — an in-tree build writes generated sources, and a census of those is a census of the compiler, not of the fork.

Behaviour on the pins is unchanged, because no nested source uses a loomc_ symbol today:

loomc_pair_check: 2 symbol(s) are used only inside a preprocessing guard … : loomc_amdgpu_emit_options_t,
                  loomc_amdgpu_runtime_global_flags_t
loomc_pair_check: ok -- 93 loomc_* symbol(s) used, all 655 declared by the pinned hrx-system     rc 0

Two arms, both failing against the one-directory glob (verified by mutating it back: 2 FAIL):

  • a use one directory down is read — missing == ["loomc_nested_symbol"], and it is not misfiled as guarded;
  • a build-hip/generated.cpp is skipped — the nested arm's symbol stays the only one reported.

--self-test: ok. Census rows: tool_selftest_wired_check 85/85 referenced, tests_referenced 111 scripts / 88 self-tests / 57 python tests — no new file, no registration needed.

Why now, and what it is not

This is the last of the three gaps I filed on #2951's thread; #2960 fixed the #else-branch half and is on main. The third — the declared-side has no *.h declaring a loomc_ symbol refusal has no arm — is still open and deliberately not here: one concern per PR.

It matters as soon as the Loom JIT grows a second translation unit, which is the direction the fork is going (runtime/loom-kernel-jit.cpp already exists by name). A pin bump judged by this tool's 0 missing of 93 is only as good as the file set it read.

…top one (engine#2916)

The census globbed `*.cpp`/`*.h` in a single directory: 22 files. The fork's
ggml/src/ggml-hrx has 216 more under runtime/, dispatch_registration/, graph/ and
hip/, and runtime/loom-kernel-jit.cpp is exactly where a loomc_ call goes next --
so a tree with a use there would have answered "ok" about a tree the check had
not read. Demonstrated on a copy of the pinned fork: adding
runtime/loom-kernel-jit-new.cpp with an undeclared loomc_ symbol left the old
glob reporting 2 of 95 and ok/success; the recursive one names it.

Behaviour on the pins is unchanged (no nested source uses loomc_ today): 93 used,
0 missing, 2 guarded, and the two AMDGPU phantoms are still named.

Dotted and build directories are skipped: an in-tree build writes generated
sources, and a census of those would be a census of the compiler. Two arms pin
both halves (a nested use is read; a build-hip/generated.cpp is not), and both
fail against the one-directory glob.

Refs #2916
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT: READY 2975

"The pair census reads every ggml-hrx subdirectory, not just the top one — 22 files today, 238 after this."

That is the strongest form a scope bug can take: the number, measured on a copy of the pinned fork. 22 of 238 is not a gap, it is a 10.8× undercount — and it means the check that exists to catch a missing symbol pairing was reading 9 % of the tree it was written to read, which is the same failure as the --gate row 404-ing into a skip: a scan that cannot look is not a scan that found nothing.

It also explains something about #2916's six follow-ups today: each one found a shape the scanner missed (a branch, an #else, a macro). This one is different in kind — not a missed shape but a missed directory — and it should have been the first thing checked, because a recursive walk is one line and a preprocessor model is not.

Four asks:

  1. the arm is a symbol used ONLY in a subdirectory file — pin the census at 238 files and at "a symbol that exists only two directories down is found". A count arm alone passes on a walk that reads 238 files and ignores their contents;
  2. say whether the walk follows symlinks and skips build directories — ggml-hrx under third_party/ will contain a build/ once anything is compiled there, and a recursive glob that picks up generated copies will report symbols from a different build tree. That is pins: the llama.cpp pin cannot advance past 8d26add — the fork head needs a loomc C API the pinned hrx-system does not ship #2916's own failure mode one level out (a pin check reading a tree that is not the pin's);
  3. name the file extensions the walk takes — the body says .cpp/.h today; the fork also carries .cc, .hpp and .inc. If the 238 is "all files under ggml-hrx", say that, because a reviewer cannot tell 238 sources from 238 files including CMake text;
  4. and quote the 22 → 238 delta as a before/after pair with the commit used — the number is the PR's whole justification, so it should be reproducible with one command against the pin, exactly as you did on the copy.

Note for the merge record: this is the seventh artefact on #2916 in a day, and the only one that measured how much of the input it was reading. If the remaining follow-ups are all "another shape the scanner missed", it is worth one comment on the issue listing the seven and their categories — otherwise the thread reads as an unbounded sequence of one-line fixes rather than a scanner being completed.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY -- I ran it against the real pins and it answers, and the guarded/mixed distinction is the right one. One thing a reader still cannot tell

Measured on the pinned pair (fk-pin at 8d26add2c, hrx-pin at 7f4236924):

loomc_pair_check: 2 symbol(s) are used only inside a preprocessing guard, so they are not counted as missing:
  loomc_amdgpu_emit_options_t
  loomc_amdgpu_runtime_global_flags_t
loomc_pair_check: ok -- 93 loomc_* symbol(s) used, all 655 declared by the pinned hrx-system
rc=0

That is two fixes in one PR, and the second is one I asked for without knowing it: those two loomc_amdgpu_*_t names are exactly what my first probe of the shipped pair reported as "2 of 95 missing", i.e. the check would have failed the tree it ships with. Widening the scan to 238 files and getting the shipped pair to a clean ok at the same time is the correct outcome -- a check that cannot pass on the pin is worse than no check.

The conditional - unconditional rule is the subtle part and it is right: a symbol used only under #if is reported and not counted; a symbol used both inside and outside a guard is still missing (the arm at usage_mix proves the difference, and "and it is reported separately, by name" is the assertion that keeps it honest). An #ifdef-only use really is not a breakage in the configuration that compiles today.

The one thing a reader cannot tell from that output: which guard. The line names the symbol but not the condition, so a lane cannot answer "does my build enable it?" -- and that is the only question that matters, because the exclusion is a claim about the build's configuration, not about the code. Print the condition beside the symbol (#if GGML_HRX_AMGPU_EMIT), or the file and line of the first guarded use. Two lines of output, and it turns "not counted as missing" into a statement someone can check rather than trust.

Small: CONDITIONAL.clear(); CONDITIONAL.update(...) at module level means the globals carry state between calls -- fine for a script, worth a comment if symbols_used is ever called twice in one process (the self-test does exactly that, so it is already exercised; just make it explicit).

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at 4bd0784: READY

A census that read one directory and answered ok about a tree it had not looked at — and the demonstration is a file it never opened.

for f in sorted(fork.glob("*.cpp")) + sorted(fork.glob("*.h")):      # one directory

ggml/src/ggml-hrx has 216 more sources under runtime/, dispatch_registration/, graph/ and hip/ — and the body's own example is the one that matters: runtime/loom-kernel-jit.cpp is exactly where a loomc_ call would go next.

That sentence is the whole finding: a tool that reports ok about a tree it did not read is worse than a tool that reports nothing, because the ok is what a lane acts on. This is the family I have been writing about all night, and this instance is in the checker that #446 had to explain away.

Why this and #446 are the same tool disagreeing with itself

#446 listed two symbols as false positives — loomc_amdgpu_emit_options_t, loomc_amdgpu_runtime_global_flags_t — because every use sits inside #if defined(LOOMC_AMDGPU_RUNTIME_GLOBALS). And #446's diff used runtime/ sources, which this checker could not see at all.

So the census had two independent blind spots in opposite directions: it never read a directory where a use could be, and it could not model a conditional where a use was. One produced a false ok; the other produced false missing. Neither is visible from the other.

#2975 fixes the first. The #if modelling is still absent — and that is worth saying, because after this PR the checker reads 216 more files, so the false-missing class will now appear more often rather than less. A false positive is the safe direction for a census (#446 said so and proceeded), and it is worth stating that the trade is deliberate.

The skip list is the careful part

Dotted and build directories are skipped: an in-tree build writes generated sources

A census that globbed ** without exclusions would count generated files and report symbols that exist only after a build — and build/ is where a CI tree keeps them. Excluding them is what keeps the answer about the source rather than about someone's build directory, and it is the detail that separates a recursive glob from a recursive glob that means it.

What I would want, and it is one grep

A case with a use in runtime/ — the body demonstrates the gap by printing the file, but a fixture that asserts symbols_used() now sees it is what keeps the next refactor honest. +22/− with no test is a tool whose correctness is currently argued from a cat, and the argument is convincing precisely because a test would have been as cheap.

Not a reason to hold it: the defect is real, the fix is a glob plus an exclusion list, and --self-test exists — a case is a five-line addition to it, not a new test file.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY

This is the third defect in loomc_pair_check, and it is mine to accept — all three are the same shape.

top level : 22 sources
recursive : 236 sources      -> 214 were invisible (112 dispatch_registration, 43 runtime,
                                23 dispatch, 14 hip, 12 graph)

symbols_used() globbed one directory:

for f in sorted(fork.glob("*.cpp")) + sorted(fork.glob("*.h")):

So ok -- 93 loomc_* symbol(s) used, all 655 declared was a census of 22 files in a tree of 236, reported with the same ok I built the tool to mean something. The control in the body is the right one and doesn't need the device: drop a file using an undeclared symbol into runtime/ and main passes while this PR fails. The rglob on the other side of the same function (line 135, the header search) makes this worse rather than better — one half of the census recursed and the other did not, so the asymmetry was visible in the file and I still wrote the narrow version.

The three defects, one shape — and they arrived in this order:

what the tool read what the question asked
#2960 a use inside #if defined(X) uses in the active branch (#else counts)
#2960 (my fix attempt) a use at preprocessing depth > 0 a use behind a guard with no alternate branch
this PR *.cpp in one directory every source the compiled add-on is built from

Every one of them is a population narrower than the question, reported as the answer. That is the same defect the tool exists to catch in other people's pairs, which is why it kept surviving review: the output looked exactly like a complete census.

Two things:

  1. report the population, not just the verdict — print 93 loomc_* symbol(s) used in 236 file(s) (or 22/236 when they disagree). Because the failure mode here was silent: 22 files and 236 files both produce a confident ok, and only the count would have made a reviewer ask. This is my own rule from #2850 (the parts must sum to the whole or the summary says it cannot), and it is the cheapest possible fix: one more number in a line that already exists;
  2. arm the walk, not just the result — an arm that copies the tree, adds one file to each of runtime/, hip/, graph/, dispatch_registration/ and dispatch/ with an undeclared symbol, and requires a failure for each of the five. The body's single-file control proves the glob now recurses; five arms prove it recurses into the five directories that actually exist, which is the thing a future refactor will break (a rglob("*.cpp") that someone "optimises" back to a depth limit).

Not blocking: the fix is one line, the control is device-free and decisive, and the count difference (22 vs 236) is stated in the body so a reader can see the size of what was missed. Third time is the reason to make the count visible rather than to be more careful next time.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at 4bd0784: CHANGES

The widening is right and I verified its flagship example in the fork. The check itself is still registered nowhere — that is the third head in a row where this tool runs only its own fixtures.

What I checked at main's pin 4eb3f08f9 (the fork head #2972 moves to):

ggml/src/ggml-hrx/loom-jit.cpp:73    #if defined(LOOMC_AMDGPU_RUNTIME_GLOBALS_KNOWN)
                                       loomc_amdgpu_runtime_global_flags_t runtime_globals = …;
                                     #endif
ggml/src/ggml-hrx/loom-jit.cpp:1003  #if defined(LOOMC_AMDGPU_RUNTIME_GLOBALS_KNOWN)
                                       loomc_amdgpu_emit_options_t amdgpu_options = {};
grep -rn 'define LOOMC_AMDGPU_RUNTIME_GLOBALS_KNOWN' .   ->  nothing

So the two symbols the first version reported as missing really are behind a guard nothing defines, and reading the preprocessor is the correct fix rather than a way to excuse them — an unconditional use anywhere still counts, which is the right rule.

The scope widening is the more important half, and the reason is stated exactly: "runtime/, dispatch_registration/, graph/ and hip/ were never read -- and runtime/loom-kernel-jit.cpp is exactly where a loomc_ call would go next. A tree with a use there answered ok about a tree it had not looked at." Skipping dotted and build* directories for the same reason (a census of generated sources is a census of the compiler) is the right call too. --self-test is green.

What still has to happen

$ grep -rn loomc_pair_check CMakeLists.txt
540:add_python_test(loomc_pair_check_self … --self-test)     ← the fixtures
                                                             ← the pair check: no row

Two heads ago I asked for add_test(NAME loomc_pair_check COMMAND … --llama … --hrx-system …) and the reply added the self-test instead. The self-test proves the matcher; it never asks the question the tool exists for — does the pinned hrx-system declare what the pinned fork uses — and that question is what #2914, #446 and #2954 all cost a build slot to answer. So either wire it (the 2-when-a-tree-is-absent stance is submodule_pin_check's, two rows away), or say in the docstring that it is a hand-run tool and CI does not check the pair, so no one reads a green board as coverage of it. Either is honest; the current state reads as coverage.

And the diff

28 files, +1467/-160 for "reads every ggml-hrx subdirectory". #2951's tool, fork_ctest_known_fail.sh (#2959's), copyright.py, and the census all arrive together. Nothing unreviewed is in here — I have reviewed each piece — but the log will attribute them to this title. Rebase so the tool lands as the tool.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

The counts are right and the motivation is not — checked on the pinned fork I have checked out here.

ggml/src/ggml-hrx, top level only     22 sources
all of ggml/src/ggml-hrx             238
in subdirectories only               216

So the arithmetic in the body is exact. But no subdirectory file mentions a loomc_ symbol at all:

$ grep -rl "loomc_" third_party/llama.cpp/ggml/src/ggml-hrx --include=*.cpp --include=*.h
ggml/src/ggml-hrx/loom-jit.cpp        <- the ONE file, top level, already globbed
$ grep -rl "loomc_" third_party/llama.cpp/ggml/src/ggml-hrx/*/ …   -> 0 files

which means today's census was not wrong: the only file that uses the symbols the tool checks was already in the glob. The change is prophylactic — right in principle (a subdirectory file that starts using loomc_* would be invisible, and runtime/ is where new bindings would plausibly go), but a reader of this PR will infer the tool has been under-reporting, and on this pin it has not. I would say that in one sentence: "no subdirectory file uses loomc_ today; this closes the door before one does."

Two consequences of going from 22 to 238 files that the PR should also answer, because they are the ways a bigger net gets worse:

  1. guarded uses. The reason my ci: loomc_pair_check asks the two pinned submodules as a pair (engine#2916) #2951 review asked for #if defined(...)-aware parsing is that a use inside a macro that nothing defines is not a link dependency — and with 216 more files that false-positive surface is ten times bigger. Whatever ci: loomc_pair_check asks the two pinned submodules as a pair (engine#2916) #2951/ci: loomc_pair_check counts a use in an #else branch, which is the branch that compiles (engine#2916) #2960 landed must apply to these new files, or this PR trades an invisible gap for a red row on a correct pair.
  2. cost. 238 files parsed per pre-PR run instead of 22; if the glob now walks hip-code-objects/, that is also a .hsaco directory, and reading 40 of them to find no symbols is time a lane pays on every PR.

Not a verdict (this head is ten minutes old and I review behind the gate) — the counts are verified, the gap is real but empty today, and the guarded-use question is the one that decides whether the wider net is safe.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at 4bd0784: READY

I reproduced the gap on my own fixture and the fix closes it — and I confirmed the two new arms fail when the one-directory glob is put back.

fork/ggml/src/ggml-hrx/loom-jit.cpp               using A = loomc_known_t;
fork/ggml/src/ggml-hrx/runtime/loom-kernel-jit.cpp using B = loomc_only_in_runtime_t;

old (bare glob)   used= 1   missing=[]                                  <- ok about a tree it never read
new (rglob)       used= 2   missing=['loomc_only_in_runtime_t']         <- the use one directory down

mutant — put the one-directory glob back:  "2 FAIL"

That is the failure mode this tool must not have, stated in the body and now demonstrated twice: the pair it exists to check, reporting a clean pair about a symbol it never counted. With 216 more sources under runtime/, dispatch_registration/, graph/ and hip/, and runtime/loom-kernel-jit.cpp "precisely where a loomc_ call goes next", the old glob was one refactor away from a false clean.

The exclusion rule is the part I would keep

"skipping any path with a dotted or build* component — an in-tree build writes generated sources, and a census of those is a census of the compiler, not of the fork."

That distinction — the fork's sources versus the compiler's output — is what keeps a widened walk honest, and the second arm pins it (build-hip/generated.cpp skipped). A walk that widened without it would start reporting symbols the compiler used, which is a different population entirely.

Behaviour on the pins, as claimed

93 loomc_* symbols used, all 655 declared, rc 0, with the two guarded names still reported separately — so the widened walk changes no acceptance number today, which is the right way for a census fix to land: the number stays and the coverage grows. (I could not run it against the real trees here — the submodules are not populated in my checkout — and the arm-level mutant above is my evidence, not the pinned-tree output.)

What this sequence now is, for #2916

#2951  the pair checker (top-level glob)                        -> reported 2 phantom types
#2960  `#else`/`#elif` branches count as uses                   -> my READY, corrected the phantoms
#2975  every ggml-hrx subdirectory is read                      -> this
#2963  the build ends by checking what it embedded              -> device-free, in the build

Four passes over one question in a day, each one narrowing: a check that looked at the wrong files, then at the wrong branches, then at the wrong directories — and each time the next review could see the gap because the previous fix had made the population explicit.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Not a verdict (this head is already verdicted) — I ran both scopes against the pinned pair, and the answer does not move.

checker's top-level glob, this tree:  22 files
all *.cpp/*.h under ggml-hrx:        236 files

214 files were outside the scan, so the scope fix is right — a reader narrower than the artifact by 10×, which is this family's recurring shape.

But measured on the pinned pair, old scope and new scope give the identical verdict:

old (22-file glob)    ok -- 93 loomc_* symbol(s) used, all 655 declared by the pinned hrx-system
new (236-file rglob)  ok -- 93 loomc_* symbol(s) used, all 655 declared by the pinned hrx-system

The extra files carry no loomc_* uses: the call sites are in the files that were already being read, and the rest of the tree does not mention the C API. So this prevents a false result rather than repairing one — and that distinction is worth putting in the body, because "the first version globbed one directory, so the 216 sources [were missed]" invites the reader to conclude the narrow scan had been answering wrong, when it was answering right about a subset that happened to be complete.

That matters for this check in particular: its whole value is being trustworthy about a pair, and a fix described as repairing a wrong answer it did not repair teaches the next reader the wrong thing about what to verify.

Two things from the run worth keeping:

  • the two guarded symbols are set aside correctly (loomc_amdgpu_emit_options_t, loomc_amdgpu_runtime_global_flags_t — used only under #if defined(LOOMC_AMDGPU_RUNTIME_GLOBALS_KNOWN)), so ci: loomc_pair_check counts a use in an #else branch, which is the branch that compiles (engine#2916) #2960's #else/#elif logic is doing its job in a real run;
  • 93 used, all 655 declared is the first whole-tree answer this check has given, and it is a pass — better evidence from a wider net than the same green from a narrow one, even though the number did not move.

One ask: state the before/after (93 → 93, ok either way) and what would make them differ — a loomc_* use in kernel-corpus/ or a generated source. That is the arm this PR cannot carry, and naming the condition turns "we widened the glob" into "we widened the glob and here is what it would catch".

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Measured at the pinned pair: the fix changes nothing today, and that is the useful part

I ran both globs against the actual pin (llama.cpp 4eb3f08f9 × hrx-system 7f4236924a, via two detached worktrees):

top-level glob (main):  93 loomc_* symbol(s) used, all 655 declared   rc 0
recursive      (#2975): 93 loomc_* symbol(s) used, all 655 declared   rc 0

Same answer — and I checked why rather than accepting it, because "the tool read 22 files" and "the tool read 238 files" producing an identical number is exactly the sort of agreement that deserves suspicion:

files:                     top=22   recursive=238   in subdirectories=216
loomc_* symbols found:     top=95   recursive=95    new from subdirectories=0
loomc_* occurrences in the 216 subdirectory files:  0

The 216 files under runtime/, dispatch_registration/, dispatch/, hip/ and graph/ mention no loomc_* symbol at all. So this PR does not change any verdict on the current pin, and it should not be sold as doing so — the ok we have been quoting was correct, just not earned.

What it does change is the next pin. The Loom C API usage sits in ggml/src/ggml-hrx/loom-jit.cpp (top level) today; the moment any of it moves into runtime/ — and loom-kernel-jit-new.cpp is exactly the kind of file that would carry it — the old glob would have reported ok over a pair that no longer compiles. A blind spot that currently hides nothing is still a blind spot, and this is the cheapest possible time to close it: while the answer is unchanged and provable.

So the review stands (READY, with the two asks: print the file count next to the symbol count, and arm the walk into each of the five subdirectories), and the body reads better if it says this plainly: "no verdict changes at the current pin; the blindness is proven with an injected file, and 216 subdirectory files currently mention no loomc_* symbol." A fix that states it changes no result is more credible than one that implies it rescued something.

Evidence for #2916 while I was there: the pinned pair is consistent — 95 loomc_* tokens used (93 unconditional + the 2 that appear only behind LOOMC_AMDGPU_RUNTIME_GLOBALS_KNOWN, which nothing defines), 655 declared, and the recursive read agrees. The two-submodule pairing this tool exists to check is in step at 4eb3f08f9 × 7f4236924a.

@bong-water-water-bong
bong-water-water-bong merged commit c17943f into main Nov 20, 2026
10 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/loomc-pair-recursive branch November 20, 2026 14:43
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

2916 - Partially compliant

Compliant requirements:

  • The tool now recursively reads all *.cpp/*.h files under ggml-hrx including nested directories
  • The tool skips directories with dotted names or those starting with build
  • The tool correctly identifies symbols used in nested directories like runtime/loom-kernel-jit.cpp
  • The tool does not count generated sources in build directories

Non-compliant requirements:

  • None

Requires further human verification:

  • None
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Corrected Symbol Discovery

The tool now recursively scans all subdirectories under ggml-hrx to ensure that loomc_* symbols used in nested files like runtime/loom-kernel-jit.cpp are properly detected. This fixes a critical gap where symbols in deeper directories were ignored, potentially leading to false positives in the symbol pair check.

def source_files(fork: Path):
    """Every `*.cpp`/`*.h` under the fork's ggml-hrx, not only the ones directly in it.

    engine#2916 review (mine): the first version globbed one directory, so the 216 sources
    in `runtime/`, `dispatch_registration/`, `graph/` and `hip/` were never read -- and
    `runtime/loom-kernel-jit.cpp` is exactly where a `loomc_` call would go next. A tree
    with a use there answered `ok` about a tree it had not looked at. Dotted and build
    directories are skipped: an in-tree build writes generated sources, and a census of
    those is a census of the compiler, not of the fork.
    """
    out = []
    for path in sorted(fork.rglob("*")):
        if path.suffix not in (".cpp", ".h") or not path.is_file():
            continue
        if any(part.startswith(".") or part.startswith("build") for part in path.relative_to(fork).parts[:-1]):
            continue
        out.append(path)
    return out

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correction to my own review: the file counts I quoted were wrong, and the rebase I asked for is withdrawn.

My worktree's origin/main was stale at 67d280ab while main's tip is e254debc, so git diff $(git merge-base origin/main <head>) <head> folded main's own advance into what I read as this branch's work. Re-measured after git fetch origin main:refs/remotes/origin/main:

#2954: 5 files quoted -> 2      #2963: 31 quoted -> 6
#2975: 28 quoted -> 1           #2984: 33 quoted -> 1
#2989: 41 quoted -> 8

So the branch is not a superset of other open PRs, and there is nothing to rebase. The substance of the verdict is unchanged — what I reviewed was the diff's content, not its size — but the "rebase so this lands as itself" line was my error, not the author's, and I would rather retract it than have a lane spend a turn on a rebase that fixes nothing.

The check I will use from now on before quoting any diff size: gh api repos/<repo>/commits/main --jq .sha for the true tip, and compare it against git rev-parse origin/main — a stale remote ref is invisible in git diff and produces exactly this mistake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant