Skip to content

fix(metal): Cache Intel workgroup-size compiler probes - #10743

Open
ITJamie wants to merge 2 commits into
gfx-rs:trunkfrom
ITJamie:codex/intel-metal-probe-cache
Open

ITJamie wants to merge 2 commits into
gfx-rs:trunkfrom
ITJamie:codex/intel-metal-probe-cache

Conversation

@ITJamie

@ITJamie ITJamie commented Oct 26, 2026 •

Copy link
Copy Markdown

Connections

Depends on #10731. Fixes #10742.

Description

Repeated adapter enumeration reruns the Intel workgroup-size compiler probe. On an OCLP Intel Iris Pro Mac, subsequent rejected probes take about 30.5 seconds each, making renderer recovery very slow.

Cache completed results per GPU registry ID and selected MSL version for the lifetime of the process. Concurrent requests for the same key share one probe; incomplete probes and devices without a usable registry ID are retried. The existing compiler workaround and shader bounds checks remain enabled.

This branch contains #10731's prerequisite commit plus one cache commit. The cache is the separate follow-up; rebase onto trunk after the prerequisite lands.

Testing

  • Formatting, strict all-target/all-feature wgpu-hal Clippy, and four cache unit tests: passed. Tests cover both result values, GPU/MSL isolation, incomplete/unidentified retries, and concurrent requests.
  • Apple M4 Max: full cargo xtask test ran 1,144 tests: 1,140 passed, four failed, six skipped. Failures are listed below; this is not a clean full-suite pass. No trunk baseline or CTS run.
  • MacBookPro11,5, OCLP macOS 15.8.1, Intel Iris Pro: the equivalent cache prototype on the 30.0.1 backport reduced repeat enumeration from ~30.5 s to ~2 ms. Eight enumerations with a retained Intel device took 0.8 s total. All 83 unchanged PdfCraft package tests passed together, including pipeline-error recovery. wgpu internal indirect-call validation stayed enabled; incompatible external Metal validation layers were disabled per process.
  • The Intel measurements used the backport prototype, not this development branch. Native unpatched Intel macOS and Hackintosh systems remain untested; the patched compiler's underlying delay is not diagnosed. An Apple M4 enumeration smoke check also passed.
Validation failures and corrections

The four remaining full-suite failures:

  • wgpu_gpu::subgroup_operations::subgroup_operations: expected-backend-failure mismatch on Apple M4 Max; not baseline-validated.
  • wgpu_gpu::passthrough::all_passthrough_shaders_binary and all_passthrough_shaders_source: missing DXC.
  • wgpu_gpu::passthrough::metallib_passthrough_shader: missing offline metal/metallib tools.

An earlier full run had six additional missing-SPIR-V-tool failures: snapshots::convert_snapshots_spv, snapshots::convert_snapshots_wgsl, and spirv_debug_info::{embedded_nul_at_word_boundary, clean_label_validates, embedded_nul_in_file_name, embedded_nul_in_source_code}. All six passed after adding the already-installed tools to PATH.

Initial targeted checks caught a missing test Vec import, formatting, optional-value propagation, and std imports that should use core/alloc; these were corrected before the final checks.

Squash or Rebase?

Keep the cache change as one commit after #10731 lands, rebased onto trunk.

LLM Use?

An AI coding agent investigated the stall, wrote the cache and tests, ran validation, and wrote this description at the contributor's explicit request. Contributor review and ownership are still required; the self-review checkbox is intentionally unchecked.

Checklist

  • I self-reviewed and fully understand this PR.
  • CHANGELOG.md entries for the user-facing effects of this change are present.
  • The PR is minimal, and doesn't make sense to land as multiple PRs (cache follow-up; prerequisite is fix(metal): Work around legacy Intel compute compiler failures #10731).
  • Commits are logically scoped and individually reviewable.
  • The PR description has enough context to understand the motivation and solution implemented.
  • Tests demonstrate the altered logic works.
  • This PR was automatically created by an Agent.
  • The description was automatically written by an Agent.

Reuse completed probe results per GPU registry ID and MSL version to
avoid repeated compiler stalls during adapter enumeration. Retry
incomplete probes and unidentified devices, and deduplicate concurrent
requests without holding the global cache lock during compilation.

Add coverage for reuse, key isolation, retries, and concurrent requests.

Fixes gfx-rs#10742. Depends on gfx-rs#10731.
AI assistance: implementation, tests, validation, and description prepared
with an AI coding agent at the contributor's request.
@ITJamie
ITJamie force-pushed the codex/intel-metal-probe-cache branch from aabd656 to 6a851c4 Compare October 26, 2026 20:17
@ITJamie
ITJamie marked this pull request as ready for review October 26, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To triage

Development

Successfully merging this pull request may close these issues.

Metal: repeated Intel workgroup-size probes stall adapter enumeration on OCLP

1 participant