Skip to content

triton-kernels: make matmul_ogs_torch usable off CUDA and with default round_x - #1076

Draft
jiqing-feng wants to merge 1 commit into
huggingface:mainfrom
jiqing-feng:triton-kernels-matmul-ogs-torch
Draft

triton-kernels: make matmul_ogs_torch usable off CUDA and with default round_x#1076
jiqing-feng wants to merge 1 commit into
huggingface:mainfrom
jiqing-feng:triton-kernels-matmul-ogs-torch

Conversation

@jiqing-feng

@jiqing-feng jiqing-feng commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Two bugs in the reference implementation, both hit with the documented defaults:

  • device defaulted to the string "cuda", so the internal
    torch.arange(lo, hi, device=device) raised "Torch not compiled with CUDA
    enabled" on a build without CUDA. Default to x.device, which is the same
    device on CUDA and therefore a no-op there. The annotation is widened to
    match what the parameter now accepts.

  • the fallback round_x = lambda x: x takes one argument, but the call site
    passes two (round_x(x[batch, idx, :], torch.arange(lo, hi))), so any caller
    that does not supply round_x got a TypeError regardless of backend.

Validation

matmul_ogs_torch now runs with defaults and is usable as a reference to check
matmul_ogs against. Checked on Intel Arc Pro B60, torch 2.13.0+xpu; the
round_x arity bug is backend independent.

@github-actions github-actions Bot added the chore Version bumps, releases, misc maintenance label Aug 13, 2026
@jiqing-feng
jiqing-feng force-pushed the triton-kernels-matmul-ogs-torch branch from 6dccdf9 to 59b9527 Compare August 13, 2026 07:25
…t round_x

Two bugs in the reference implementation, both hit as soon as it is called
with the documented defaults:

- `device` defaulted to the string "cuda", so the internal
  `torch.arange(lo, hi, device=device)` raised "Torch not compiled with
  CUDA enabled" on an XPU-only build. Default to `x.device` instead, which
  is the same device on CUDA and therefore a no-op there.

- the fallback `round_x = lambda x: x` takes one argument but the call site
  passes two (`round_x(x[batch, idx, :], torch.arange(lo, hi))`), so any
  caller that does not supply `round_x` got a TypeError regardless of
  backend.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Version bumps, releases, misc maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant