intellikit
intellikit copied to clipboard
Kerncap docs misdescribe kernarg metadata, Triton language detection, and validation tolerances
docs/tools/kerncap.md and kerncap/README.md describe three kerncap behaviors that don't match the code. Review on #205 caught the same mistakes in the kerncap-isolate skill, which had copied them from these docs. #205 fixes the skill; these docs still need fixing.
1. Argument layout lives in metadata.json, not dispatch.json
- Where:
docs/tools/kerncap.md:327sayscapture/dispatch.jsoncontains the "kernarg layout". - Actual:
dispatch.jsonrecords only the totalkernarg_size(src/kerncap.hip:1469). The per-argument layout is written tocapture/metadata.jsonaskernarg_slots(src/kerncap.hip:1395, read bykerncap/reproducer.py:823).
2. Omitting --source-dir for Triton requires --language triton
- Where:
docs/tools/kerncap.md:226says kerncap can fall back to compile-shim source snapshots when--source-diris omitted. - Actual: the language is only auto-detected when
source_diris given (run_extractinkerncap/extract.py), and the compile shim that writes the snapshots is only installed whenlanguage == "triton"(kerncap/capturer.py:59). Without--language triton, extraction takes the plain HIP path and records no snapshots.
3. Tolerances don't apply to default (VA-faithful) captures
- Where:
- "Validate …
np.allcloseagainst captured reference":docs/tools/kerncap.md:25,kerncap/README.md:20 - Triton
--tolerance 1e-3 --rtol 1e-2examples:docs/tools/kerncap.md:175-176,193-194,kerncap/README.md:127-128 - "use
kerncap validate --tolerance <atol>to relax the threshold":docs/tools/kerncap.md:349
- "Validate …
- Actual: any capture with
capture/dispatch.json(HIP, and Triton with the default HSA backend) is validated by_validate_replay()(kerncap/validator.py:144). It never receives the tolerances;_compare_replay_outputs()compares raw bytes.--tolerance/--rtolonly affect legacy captures withoutdispatch.json, such as--triton-backend python.
Suggested fix
Update the passages above to match the code. For #3, describe validation as byte-exact by default and present tolerances as legacy-only.