Skip to content

spark-runtime: make the kernel-audit dedupe exact, not hash-only (#73 follow-up) - #92

Merged
AzeezIsh merged 1 commit into
mainfrom
fix/kernel-audit-exact-dedupe
Sep 26, 2026
Merged

AzeezIsh merged 1 commit into
mainfrom
fix/kernel-audit-exact-dedupe

Conversation

@AzeezIsh

Copy link
Copy Markdown
Contributor

Stacked on #82 (base fix/host-heap-growth-73). Retarget to main once #82 merges.

A review of #82 pointed out that its kernel-audit dedupe keyed on a bare u64 DefaultHasher value. A collision between two distinct (module, func, loaded) triples would silently drop a row from the audit, and the boot kernel gate reads that audit. The chance is negligible, but the gate is a correctness guard, so this change makes the dedupe exact:

  • seen now maps each hash to the indices of the rows that carry it;
  • a hit requires the full triple to match;
  • hits still allocate nothing;
  • the hash is computed before taking the lock.

audit_rows() and late_miss behave as before.

  • fmt, clippy -p spark-runtime --tests, typos. The new pure test hash_collision_keeps_distinct_triples_and_dedupes_exact_hits compiles here.
  • cargo test -p spark-runtime kernel_audit on the CUDA host.

Follow-up to the #82 dedupe, prompted by a review. seen was a
HashSet<u64> of DefaultHasher keys, so a collision between two distinct
(module, func, loaded) triples would silently drop the second from the
audit, and the boot kernel gate reads that audit. seen now maps each hash
to the row indices carrying it, and a hit requires an exact triple match.
A collision appends, and hits stay allocation-free. The hash is now
computed before taking the mutex that audit_rows also holds.
insert_row takes the hash as a parameter, so a test can stage a
collision.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@AzeezIsh
AzeezIsh changed the base branch from fix/host-heap-growth-73 to main September 26, 2026 11:19
@AzeezIsh
AzeezIsh merged commit c2808e2 into main Sep 26, 2026
21 of 22 checks passed
@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Merged. CI cargo test --workspace ran the new collision test hash_collision_keeps_distinct_triples_and_dedupes_exact_hits and passed. The change only touches audit bookkeeping: rows are still deduped exactly as before, a hash collision can no longer drop a row, and the hit path still allocates nothing.

AzeezIsh added a commit that referenced this pull request Sep 26, 2026
qsa_score_tc / qsa_attn_tc{,2,3} / moe_persist_marker are lazy
try_kernel probes introduced by main's #90/#92 campaign; none is built
for gfx1151. Without declarations the new boot kernel gate fails the
serve with '5 unresolved kernel lookup(s)'.

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@AzeezIsh
AzeezIsh deleted the fix/kernel-audit-exact-dedupe branch September 29, 2026 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant