Skip to content

force qwen35 to treat IGPU like a GPU so DSpark does not fall back to CPU - #88

Merged
khosravipasha merged 1 commit into
PrismML-Eng:prismfrom
thadreber-web:fix/qwen35-igpu-gdn-guard
Jul 20, 2026
Merged

khosravipasha merged 1 commit into
PrismML-Eng:prismfrom
thadreber-web:fix/qwen35-igpu-gdn-guard

Conversation

@thadreber-web

@thadreber-web thadreber-web commented Jul 18, 2026 •

Copy link
Copy Markdown

Overview

Fixes PrismML-Eng/Bonsai-demo#112

On unified-memory CUDA devices (e.g. DGX Spark GB10), the CUDA backend
reports device type IGPU, not GPU. The rows-mode guard in
build_layer_attn_linear (src/models/qwen35.cpp) only inspects GPU-type
devices, IGPU devices are skipped and the src[6] GDN variant (CPU/Metal
only) stays enabled. CUDA's supports_op then rejects it, the scheduler
moves the op to CPU, and the fused-GDN probe disables fused GDN for the
whole run - silently, with only two log warnings.

The fix makes IGPU be treated the same as GPU in the guard, matching how discrete
cards already behave.

Additional information

Measured this on a DGX Spark (GB10, sm_121, CUDA 13.2), Ternary-Bonsai-27B-Q2_0 +
dspark Q4_1 drafter, 512-token prompt, temperature 0, using the reproduction
command from the linked issue:

Config Decode tok/s
dspark, before fix 19.4
plain (no draft) 37.1
dspark, after fix 45.7

After the fix the CPU-assignment / "set to disabled" warnings are gone and
the ~2x speculative speedup from SPECULATIVE.md holds on this hardware.

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES - AI assisted with diagnosing the root cause and drafting this fix and description; I reviewed, tested, and rewrote it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Qwen3.5 device handling to prevent fused GDN from falling back to CPU on integrated CUDA GPUs.

Changes:

  • Treats IGPU devices like discrete GPUs in the rows-mode guard.
  • Preserves rows mode only for supported CPU/Metal configurations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@khosravipasha khosravipasha left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed the root cause in the code: GB10-class devices report GGML_BACKEND_DEVICE_TYPE_IGPU (ggml-cuda.cu integrated→IGPU), so the old != GPU guard skipped them and left the CPU/Metal-only src[6] rows variant enabled → CUDA rejects it → whole fused-GDN path falls to CPU. This fix is exactly right, and regression-free: Metal reports GPU (rows stays on), and discrete CUDA is an identical codepath before/after — only IGPU behavior changes, to the correct value. Builds clean. LGTM.

@khosravipasha
khosravipasha merged commit 7529fda into PrismML-Eng:prism Jul 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Speculative decoding (draft-dspark) silently falls back to CPU on DGX Spark / unified-memory CUDA devices — 2.35x slower than fixed

3 participants