Skip to content

Studio diffusion probe cache: key persisted verdicts on the installed GPU driver - #18574

Merged
danielhanchen merged 1 commit into
mainfrom
fix-recheck-verdict-driver
Nov 20, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix-recheck-verdict-driver

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

#18156 made INT8 attention verdicts persist across processes, keyed by the shared probe-cache fingerprint (torch, CUDA, driver, card). The quant probe verdicts use that same fingerprint. The driver part comes from torch._C._cuda_getDriverVersion, and no current torch build has that function (2.12.1+cu130, 2.13.0, 2.14.1+cu130 checked). So the fingerprint always records driver=None. After a driver update, a passing persisted INT8 attention verdict is still adopted with only a launch warm-up, a negative one skips even that, and the quant verdicts are reused the same way.

Change

fingerprint() now reads the driver itself, once per process and without creating a CUDA context:

  • NVIDIA: the kernel module version from /proc/driver/nvidia/version, or if that file is missing (WSL, some containers, Windows) the name, size and mtime of the driver library this process loaded (libcuda.so* from /proc/self/maps, or System32\nvcuda.dll). cuDriverGetVersion is added when it answers.
  • ROCm: the existing _rocm_driver_version() from diffusion_attention (HIP driver version, plus the amdgpu module version or kernel release).

If no driver identity can be read, fingerprint() returns None. Then nothing is stored or adopted and the probes run fresh, as they did before persistence. Every namespace built on fingerprint() gets this fix. Existing cache entries were keyed with driver=None, so each one misses once and is probed again on the first start after the update.

Tests

tests/test_diffusion_probe_cache_driver.py (CPU only; the card, the proc file and the driver library are faked):

  • a driver update changes the fingerprint key
  • a verdict stored under one driver is not adopted under another, for both Namespace and load/store
  • an unreadable driver stores and admits nothing
  • the same driver still reuses the verdict
  • ROCm keys on the HIP driver identity and refuses one it could not read

On main, 4 of the 5 fail. The same-driver reuse case passes on both, as it should. With this change, all 5 pass. The existing probe-cache users (test_diffusion_int8_attention_persisted.py, test_diffusion_transformer_quant.py, test_early_quant_probe.py, test_diffusion_probe_overlap.py, test_diffusion_cold_start.py, test_diffusion_early_probe_prewarm.py, test_diffusion_compat_preflight.py, test_diffusion_rocm_tag_detect.py and one more block test) fail the same 36 test IDs on main and with this change. The 35 in test_diffusion_compat_preflight.py come from gguf not being installed in the test venv; the remaining one, in test_diffusion_cold_start.py, fails identically on main. There are no new failures.

Not proven

  • Not run on a real GPU. The NVIDIA reader was checked by hand on a Linux host (cuda13010,nvrm590.48.01). The WSL, Windows and ROCm readers were exercised only through fakes.
  • We have not measured whether a particular driver update actually changes INT8 attention numerics. This change only makes sure such an update is noticed.
  • The library-identity fallback keys on file metadata, so reinstalling the same driver also causes one re-probe.

… GPU driver

torch has no _cuda_getDriverVersion, so the fingerprint always recorded driver=None and a driver update
never invalidated a persisted quant or INT8 attention verdict. Read the driver without a CUDA context
(NVIDIA kernel module version, else the loaded driver library identity, plus cuDriverGetVersion; on ROCm
the HIP and amdgpu driver versions), once per process. When no driver identity can be read, nothing is
persisted or adopted and the probes run fresh.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T05:41:02.670177Z 8bc06f8 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 8bc06f8a51

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 2d1f865 into main Nov 20, 2026
@danielhanchen
danielhanchen deleted the fix-recheck-verdict-driver branch November 20, 2026 07:36
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