Repository navigation
[BUG] Fix Torch fallback for CPU tensors - #8251
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
WAITING ON AUTHORPR Self-ReviewRevision Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision. Questions to answer in the PR description
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
|
this fix looks right to me, well done |
03230c0 to
9293689
Compare
9293689 to
215fdee
Compare
Keep main's CPU Torch fallback and FP32 CPU accumulation from #8251, using the existing shared architecture helper inside the guarded lookup. Retain #8099's rejection of borrowed OPUS rows on gfx1250-strict. The eager launch body is unchanged. CPU source-body checks cover 48 numerical/out-buffer cases against main and a Torch reference, the CPU eager decline, invalid output dtype, and architecture error propagation. Provider interface/contracts: 145 passed with GPUs hidden. Black, Ruff and diff-check pass. No new GPU or performance run.
Fixes the first issue in #8176.
Problem
Since #6937,
_gemm_a16w16(the bf16/fp16tgemm.mmpath) looks up the arch / CU count from the input's device before the tuned-config lookup. For a CPU tensor this raises: RuntimeError: OPUS GEMM requires a GPU tensor; got device cpu Before #6937, a CPU input found no tuned row and fell back to Torch.Fix
For non-CUDA inputs, skip the device and tuned-config lookups and use the existing Torch solution, restoring the pre-#6937 behavior. CUDA inputs are unchanged. On CPU,
torch.mm(out_dtype=)is unsupported, so the operands are cast tootypefirst; e.g. bf16 inputs withotype=float32still return fp32.Test
CPU bf16/fp16/fp32 inputs (2D and 3D, with/without bias,
out=,otype=float32) matchF.linear; GPU inputs still use the tuned dispatch.