Skip to content

Fix cache results for -march=native, implied depfiles, side artefacts and unseen inputs - #1711

Merged
Yaraslaut merged 4 commits into
masterfrom
fix/cache-audit-native-depfile-flush
Nov 21, 2026
Merged

Yaraslaut merged 4 commits into
masterfrom
fix/cache-audit-native-depfile-flush

Conversation

@Yaraslaut

Copy link
Copy Markdown
Member

The next batch from the compile-cache audit filed as #1688–#1708. Each change closes a way the cache served a wrong or incomplete result, or one way its reports hid that. Stacked on #1687 (based on its branch); it retargets to master once #1687 merges.

Changes

What is missing (why this is a draft)

The full build and all three unit suites pass locally (FastCacheTest, fastcache-cc-tests, fastcache-compile-node-tests). Two of the 258 hygiene checks fail and are not fixed yet:

  • test-name-hygiene: the new case "-march=native is keyed by the CPU the driver resolves it to, and by nothing else" in src/apps/fastcache-cc/CacheKey_test.cpp starts with -, which Catch2 reads as an option. It needs renaming, e.g. "Naming -march=native keys the CPU the driver resolves it to".
  • table-totals: a table in .agent/rules/distributed-compilation.md (line ~1104) has no <!-- table-total: ... --> marker. This check fails only on this branch, so the cause sits in this branch's change to that file; it is not yet narrowed down.

Also not done:

🤖 Generated with Claude Code

https://claude.ai/code/session_01CnCkwgtUsaSM5HcgB3APNU

@Yaraslaut Yaraslaut added the type/bug Behaves incorrectly against its stated contract label Oct 17, 2026
@github-actions github-actions Bot added the area/launcher apps/fastcache-cc/ - the compiler launcher and its cache key label Oct 17, 2026
@Yaraslaut
Yaraslaut force-pushed the fix/key-line-structure-and-response-files branch from 6078948 to 5343191 Compare November 21, 2026 10:33
@Yaraslaut
Yaraslaut force-pushed the fix/cache-audit-native-depfile-flush branch from 249d14e to ae6e216 Compare November 21, 2026 10:43
@github-actions github-actions Bot removed the area/launcher apps/fastcache-cc/ - the compiler launcher and its cache key label Nov 21, 2026
@Yaraslaut
Yaraslaut marked this pull request as ready for review November 21, 2026 14:34
@Yaraslaut
Yaraslaut force-pushed the fix/key-line-structure-and-response-files branch from 5343191 to 73323cc Compare November 21, 2026 14:49
Base automatically changed from fix/key-line-structure-and-response-files to master November 21, 2026 15:42
Yaraslaut and others added 4 commits November 21, 2026 16:52
…ever dispatched (#1688)

The argument names no CPU, and the key held only its text: two machines passing
-march=native shared one key, so a shared cache could serve one CPU's object to
another (an AVX-512 object on a machine without it dies with SIGILL). A dispatched
compile was worse: the worker resolved native to its own CPU and the client stored that
object under its key.

The key now folds HostCpuKeyItem over the driver's -### listing of the unit's own line:
gcc's expanded -march=<cpu>, feature switches and --param cache sizes, clang's
-target-cpu, -tune-cpu and -target-feature values -- and none of the listing's paths, so
the same CPU under another install prefix still shares. A listing naming no target keeps
the compile uncached; a line naming native is refused for dispatch.

Closes #1688

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CnCkwgtUsaSM5HcgB3APNU
…ached (#1691)

A hit restores the object and the depfile and nothing else, but several GNU flags make
the compile write a second file: -gsplit-dwarf (.dwo), --coverage / -ftest-coverage
(.gcno), clang -ftime-trace (.json), -fstack-usage (.su), -save-temps, the -fdump-*
family, -fsave-optimization-record, -fcallgraph-info, -aux-info. After a hit the side
file was missing, or left over from another build -- a .dwo whose id the restored
skeleton does not match, a .gcno gcov rejects. Reproduced: the previous launcher cached
-gsplit-dwarf and --coverage compiles.

They are SideArtefacts rows now, so such a line is not cached and not dispatched, as the
rule for second-artefact compiles already said.

Closes #1691

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CnCkwgtUsaSM5HcgB3APNU
…irectory is not cached (#1692)

These flags make the compiler read a file that reaches neither the preprocessed text
nor the depfile, so the key could not see it change. Reproduced by the audit: gcc
-fprofile-use with and without its .gcda gave identical -E text and depfiles and
different objects -- one key, so every PGO build after a profile refresh was served the
object built from the old profile.

-fprofile-use, -fprofile-sample-use, -fauto-profile, -fprofile-instr-use, -fplugin,
-fpass-plugin, -specs and -B are SideArtefacts rows now, beside cl's /Yu, which is there
for the same reason. Generating a profile (-fprofile-generate) writes it at run time and
stays cacheable. Hashing the named files instead would let PGO builds cache; refusing is
the correct floor.

Closes #1692

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CnCkwgtUsaSM5HcgB3APNU
… Open work

Deferred work is an issue linked from the matching rulebook, never a residual in prose:
the launcher findings go to compile-cache.md (#1693-#1700, #1707's remainder, #1708),
the disk-tier ones to storage.md (#1690, #1702-#1705), and the protocol-surface and node
ones to distributed-compilation.md (#1701, #1706).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CnCkwgtUsaSM5HcgB3APNU
@Yaraslaut
Yaraslaut force-pushed the fix/cache-audit-native-depfile-flush branch from ae6e216 to 03652e2 Compare November 21, 2026 15:53
@github-actions github-actions Bot added the area/launcher apps/fastcache-cc/ - the compiler launcher and its cache key label Nov 21, 2026
@Yaraslaut
Yaraslaut merged commit a401af8 into master Nov 21, 2026
33 checks passed
@Yaraslaut
Yaraslaut deleted the fix/cache-audit-native-depfile-flush branch November 21, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/launcher apps/fastcache-cc/ - the compiler launcher and its cache key type/bug Behaves incorrectly against its stated contract

Projects

None yet

1 participant