Skip to content

Pipelines the driver fails to compile are retried; a failing pipeline names itself - #262

Merged
proggeramlug merged 1 commit into
mainfrom
fix/pipeline-compile-retry
Nov 24, 2026
Merged

proggeramlug merged 1 commit into
mainfrom
fix/pipeline-compile-retry

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Why

A tvOS game (App Review's Apple TV HD, A8, 2 GB, tvOS 26.6.1) aborted at launch in a bloom-pipeline-warm thread: LazyRenderPipeline → create_render_pipeline → wgpu's default_error_handler panic. The crash report names neither the pipeline nor the error. One of the two logs carries the kernel note mach_vm_allocate_kernel failed within call to vm_map_enter; under memory pressure the system can stop Metal's compiler service mid-compile, which fails the pipeline with an internal error. The tvOS simulator (Apple2 limits) and an Apple TV 4K don't reproduce it.

What

  • lazy_pipeline.rs: each lazy render/compute pipeline is created inside error scopes (create_checked). Scopes are thread-local, so a prewarm thread only catches its own pipeline's errors.
    • internal / out-of-memory error → logged and retried, up to 4 attempts (100, 200, 300 ms apart)
    • validation error, or a compile that keeps failing → panic with the pipeline's label and wgpu's message
    • web: unchanged (scopes resolve asynchronously there; errors stay with the device's handler)
  • prewarm: one worker thread on tvOS, so one compile is in flight at a time.

Tests

  • cargo test --lib lazy_pipeline: 5 pass, 2 new (a valid pipeline builds through the scopes; an invalid one panics with its name).
  • Chesslings on the tvOS 26.5 simulator and an Apple TV 4K (tvOS 27.2): all 17 prewarmed pipelines build, frames render.

Summary by CodeRabbit

  • Bug Fixes
    • Native render and compute pipeline creation now reports validation errors immediately with the pipeline name. Other pipeline errors are retried before a final error is reported.
  • Performance
    • Pipeline prewarming now limits the number of workers based on platform, available parallelism, and queued work.

… names itself

On a 2 GB Apple TV HD (A8) a game aborted at launch in a bloom-pipeline-warm
thread: wgpu's default error handler panicked in create_render_pipeline, and
the crash report gave neither the pipeline nor the error. One of the logs had
the kernel note that a VM allocation failed: under memory pressure the system
can stop Metal's compiler service in the middle of a compile.

Each lazy pipeline is now created inside error scopes (thread-local, so a
prewarm thread catches only its own pipeline's errors). An internal or
out-of-memory error is retried up to 4 times; a validation error, or a
compile that keeps failing, panics with the pipeline's label and wgpu's
message. The web keeps the device's handler (its scopes resolve async).
Prewarming on tvOS uses one thread, so one compile is in flight at a time.
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Native render and compute pipeline creation now uses checked error scopes, with validation errors reported immediately and internal or out-of-memory errors retried. Wasm creation remains direct. Prewarming now uses target-specific worker caps, and native tests cover pipeline creation.

Changes: Pipeline Creation and Prewarming

Layer / File(s) Summary
Checked pipeline creation
native/shared/src/renderer/lazy_pipeline.rs
Native creation reports validation errors with the pipeline label and retries internal or out-of-memory errors up to four times. Render and compute constructors use this path. Native tests cover valid creation and a named panic for an invalid entry point.
Prewarm worker limits
native/shared/src/renderer/lazy_pipeline.rs
Prewarming caps workers at one on tvOS and eight on other targets. Available parallelism and queue length also limit the worker count.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Merge Risk: Minimal · up to 16dd2

Native pipeline creation now retries transient driver compile failures and panics with the pipeline's name on persistent or validation errors. No merge-blocking issue was found. Memory-pressure recovery on constrained devices was not independently exercised.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two main changes: pipelines that fail to compile are retried, and a failing pipeline names itself in its panic. The changeset matches both: lazy_pipeline.rs wraps creation in error…
Description check Passed The description follows the template's main structure. It gives a clear motivation and a 'What' section that explains the change. It includes a Tests section with the commands run and the platforms te…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the two main changes: pipelines that fail to compile are retried, and a failing pipeline names itself in its panic. The changeset matches both: lazy_pipeline.rs wraps creation in error scopes, retries internal/OOM errors up to four attempts, and panics with the pipeline label and wgpu message. The title omits the tvOS prewarm worker cap, which is a secondary change. The title is 82 characters, slightly long but still one clear sentence.

Full details: Description check

Explanation

The description follows the template's main structure. It gives a clear motivation and a 'What' section that explains the change. It includes a Tests section with the commands run and the platforms tested. It lacks the template's Summary heading and the checklist, including ci-check.sh, the second platform checkbox, the visual regression item, and the docs item. It also has no Notes for reviewers section. The Summary content exists under a Why heading, so the core information is present.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • 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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: eafba074-b72d-4396-820c-e862b2c7a950
Commits

Reviewing files that changed from the base of the PR and between 36ecb25 and 16dd246.

Files selected for processing: 1

  • native/shared/src/renderer/lazy_pipeline.rs

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

@proggeramlug
proggeramlug merged commit 2572dfd into main Nov 24, 2026
38 of 48 checks passed
@proggeramlug
proggeramlug deleted the fix/pipeline-compile-retry branch November 24, 2026 14:38
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