← Back to Pull requests

[core] Log where and on which driver a device was lost #11172

Closed
unknown closed this pull request without merging on Nov 29, 2026 23:20 UTC
View on GitHub
unknown unknown commented on Nov 29, 2026 22:09 UTC
Author

Connections

Split out of #11135, as requested there by @bherbruck, so the logging can land and be backported on its own. It changes no behaviour.

Description

When a backend error loses a device, the device-lost callback usually says only "Unexpected error variant (driver implementation is at fault)" or "Device is lost". A user log then can't tell which operation failed, with which native result, or on which driver.

This logs one error when the device is lost, with:

  • the location in wgpu-core that reported the loss, carried through handle_hal_error with #[track_caller],

  • the adapter name, backend, PCI vendor and device IDs, and driver name and version.
  • The Vulkan backend also logs the VkResult of an error it did not expect, which DeviceError::Unexpected cannot carry. DX12 and Metal already log their native error at that point.

    The message passed to the device-lost callback is unchanged, because it can reach web content. The log line fires only for the first loss of a device.

    Testing

  • macOS: cargo fmt and cargo clippy --all-targets --all-features are clean.

  • Mali-G52 MC2 (Arm Vulkan driver, Android 10), as part of #11135: a render pass that loses the device on this driver (the layout bug #11133 works around). Both runs end in the deno_webgpu panic and hang that #11134 fixes; the difference is the ERROR line, which points at the fence wait in Device::maintain. The PCI IDs were added after this run.
  • !A lost device, before and after: the new log line

    Squash or Rebase?

    One commit.

    LLM Use?

    Claude Code wrote the code and this description at my direction, and ran the device testing in #11135.

    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.

  • Commits are logically scoped and individually reviewable.

  • The PR description has enough context to understand the motivation and solution implemented.

  • (If applicable) WebGPU implementations built with wgpu may be affected behaviorally.

  • (If applicable) Validation and feature gates are in place to confine behavioral changes.

  • (If applicable) Tests demonstrate the validation and altered logic works.

  • This PR was automatically created by an Agent.

  • The description was automatically written by an Agent.
  • Diff: 318 lines (+238 / -80) across 3 files Reviewer: kpreid Review duration: 70m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 318 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.345
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #11172"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.4% (MEDIUM) · Higher = larger blast radius
    40.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.0% · Safe to merge
    16.0%
    Repository