Skip to content

Isolate inference caches across llama native recipes - #212

Merged
i386 merged 2 commits into
mainfrom
fix/inference-native-cache-isolation
Nov 26, 2026
Merged

i386 merged 2 commits into
mainfrom
fix/inference-native-cache-isolation

Conversation

@i386

@i386 i386 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Original problem

Inference qualification for the llama upgrade failed during linking, before any model request: kimi-k2.cpp.o referenced the old common_peg_arena::add_parser variant while the upgraded parser defines the new variant. See PR #201 and the failed qualification run.

Maintainers need to switch native pins without sharing incompatible bundled objects through reusable build caches.

Diagnostics

The executable cache includes the source commit. Its Cargo dependency directory explicitly excluded that commit and contained no native source-recipe input. Old and new native recipes could therefore share the same Cargo target. The compiler cache was also shared with no explicit native recipe input. Earlier forced compiler rebuilds in separate Cargo namespaces succeeded.

The failure establishes incompatible native objects at link time. The original failed workspaces have since been cleaned; a later job overwrote the shared archive. This does not establish which cache layer first supplied the stale object.

Fix

  • Hash tracked upstream/patch queues, the FFI crate, native preparation/build scripts and Just recipes into both executable and Cargo dependency cache identities.
  • Give sccache that same recipe as an explicit hashed extra file, retaining any caller-supplied extra files. Native recipes cannot reuse legacy compiler entries, including through a configured remote backend.
  • Move executable and Cargo caches to v2, so existing suspect entries cannot satisfy a new build. Compiler caching stays enabled and the complete subprocess environment remains inherited.
  • Record the Cargo dependency key in the build receipt for diagnosis. Rust-only changes outside the native build inputs continue to reuse compatible dependencies.

Compatibility

No runtime, ABI, model, wire or public CLI changes. Old cache entries are left intact and become unused by this build path. The first build of a native recipe repopulates caches.

Validation

  • just inference-contracts: passed, including three new offline cache regression cases.

  • just automation-contracts: passed.

  • git diff --check: passed.

  • Native JY old → new → old builds (job_38h9bm3pkxkfmns, spark-000907): passed. Old 8954f194: 214s; new 5bacb7c8: 228s; return to old: 106s. The return deliberately missed the executable cache while retaining Cargo/compiler caches. Its CLI SHA-256 exactly matched the initial old build. The dependency keys separated old/new recipes and returned to the original old key. Both executables also passed --help after each build. These timings describe this rehearsal, not a performance claim.

  • Automatic Spark qualification on infrastructure head cf1b5b9a: all seven configurations passed, including Flash Next standalone/split. Protected PR checks is successful; repository review approval remains required. Recover llama.cpp upgrade to 5bacb7c8 and fix runtime regressions #201 contains this fix for its separate current-head qualification.

  • A second source-only control (job_gfrd6p91w26r6zv, spark-000945) also passed old → new → old, forcing an executable-cache miss at every step. Both pins used the identical Cargo lockfile (20de18005663…) and all build inputs except source SHA/native recipe matched. Old/new recipe hashes differed; the return reproduced the original dependency key and CLI hash. This directly exercises recipe isolation without a dependency-version change. The warm return recorded normal cache reuse with zero forced recaches.

Acceptance criteria

  • I ran the relevant local checks, or explained why they do not apply.
  • I agree to license my contributions under the Apache License, Version 2.0.

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 31 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6bb98919-6069-412d-8707-7c4f5857a836
Commits

Reviewing files that changed from the base of the PR and between 6531cce and cf1b5b9.

Files selected for processing: 3

  • ci/automation.just
  • scripts/inference-build.py
  • scripts/tests/inference_build.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@michaelneale

Copy link
Copy Markdown
Contributor

similar to #209 ??

@github-actions

Copy link
Copy Markdown

Skippy Lab Qualification: Passed

Commit: cf1b5b9a55883cd83b99c02be38534e417254c3d · PR smoke · Workflow and timings · Saved evidence

Native Spark lab qualification.

Latest successful main: run 45030840757, attempt 1, commit a1f80b28222a47fdbe3befaa5aba628afdec2363. Comparison unavailable: workload inputs changed or could not be verified.

Configuration Outcome Prefill tok/s Prefill vs main Decode tok/s Decode vs main Actions Lab record
qwen35-4b-standalone Passed 574.2 Unavailable 63.1 Unavailable Logs job_mqfatppftx4yknn
qwen3-coder-30b-a3b-standalone Passed 211.4 Unavailable 63.0 Unavailable Logs job_7463jrcjdhpyf2s
qwen3-coder-30b-a3b-split Passed 252.8 Unavailable 27.8 Unavailable Logs job_cktcb2mhvc8c5wb
qwen36-35b-a3b-standalone Passed 234.5 Unavailable 50.9 Unavailable Logs job_jxc597vr7jfb0bg
qwen36-35b-a3b-split Passed 133.9 Unavailable 25.9 Unavailable Logs job_n9zzc2pvsa3g5jx
qwen38-flash-next-standalone Passed 117.5 Unavailable 28.6 Unavailable Logs job_jp859gapzhbb5pe
qwen38-flash-next-split Passed 66.6 Unavailable 13.4 Unavailable Logs job_788q9nsgf05atq8

TPS describes the first response of each of three short scored smoke cases at concurrency 1; deterministic repeats are excluded. Each rate is total tokens / total server-reported phase time, not an average of request rates. Prefill excludes cached prompt tokens. These short samples include startup/warmup effects and are not sustained benchmarks or controlled speedup comparisons. Missing or invalid timings show as Unavailable.

Deltas use unrounded rates from matching PR-profile smoke receipts on the latest successful main run, including the nightly smoke evidence. Positive means faster. Changed workload inputs, different serving host classes, unequal phase token counts or missing evidence show Unavailable. Physical Spark placement and runtime conditions can differ; deltas are descriptive, not controlled speedup claims.

Smoke checks cover GPU startup, deterministic endpoint repeats and bounded streaming. They do not establish an AgentX performance score. Nightly history and saved performance baselines are published separately; a saved baseline can be older than the latest successful main run used here. The lab retains native results and logs. GitHub evidence copies expire after 30 days.

@michaelneale michaelneale left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is ok pending @jaredwy thoughts.

@i386
i386 merged commit f5777ac into main Nov 26, 2026
65 checks passed
@i386
i386 deleted the fix/inference-native-cache-isolation branch November 26, 2026 00:49
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.

2 participants