Actionable errors for invalid backend names; don't corrupt backend state on failed selection #3658
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 395 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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.358
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3658"
general
weight: 0.35
giordano
Addresses the
AssertionError: No functional client was found.part of #2072.Problem
After the lazy backend-initialization refactor, requesting a backend name that doesn't match a registered platform name (e.g.
set_default_backend("CPU")instead of"cpu", or"rocm"when the selected artifact has no ROCm support) reachesRegistration.initialize_backendswith a filter that matches nothing and trips an unconditional assertion. On unmodifiedmain(CPU only):| Scenario | Result |
|---|---|
|
set_default_backend("CPU")|AssertionError: No functional client was found.||
set_default_backend("rocm")on a non-rocm artifact | same misleading assertion || fresh session, first call
set_default_backend("gpu")without a GPU backend | assertion and state left withinitialized = true+ null default client → every later op fails withAssertionError: Client is null||
set_default_backend("gpu")thenXLA.client("cpu")| default client silently flipped to CPU (default recomputed from the newly-initialized subset only) || client re-init fails in
update_global_state!| freed client left instate.clients|Changes
XLA.client(::String)validates the name up front and throws anArgumentErrorthat names the requested backend, lists the backends valid in this session, suggests the right name on a case-only mismatch, and points at the configuration docs when a GPU backend isn't registered because of the selectedReactant_jllartifact. Names stay case-sensitive.client("gpu")/client(name)say precisely why there is no client (not registered vs. initialization failed) instead of a bareKeyError.Registration.initialize_backendsno longer asserts; it recomputes the default only when there is none or the current default was freed/re-created, across all live clients; and itdelete!s a client from the dict before freeing it.XLA.default_backend()falls back to initializing not-yet-attempted backends if a filtered initialization left no default, and errors clearly otherwise.test/core/backend_selection.jl.After