Skip to content

[SUPA] Add Biren SUPA device detection and SRT platform support - #41214

Open
Dashener2 wants to merge 1 commit into
sgl-project:mainfrom
Dashener2:supa-platform
Open

Dashener2 wants to merge 1 commit into
sgl-project:mainfrom
Dashener2:supa-platform

Conversation

@Dashener2

@Dashener2 Dashener2 commented Sep 25, 2026 •

Copy link
Copy Markdown

Add first-class detection and a platform scaffold for Biren SUPA (BR-series)
accelerators. SUPA is exposed to PyTorch as the supa PrivateUse1 backend
once the vendor torch_br plugin is imported.

  • utils/common.py: add is_supa() and wire it into get_device,
    get_device_count, get_device_name, get_device_core_count,
    get_device_capability
  • platforms/supa.py: SupaDeviceMixin + SupaSRTPlatform (SCCL
    distributed backend, device and memory queries), registered as an in-tree
    SRT platform fallback
  • platforms/__init__.py: detect SUPA when no platform plugin activates
  • check_env.py: add SUPAEnv reporting devices, brcc and brsmi versions
  • tests: add SUPA platform unit tests and cover the new fallback

Motivation

Biren SUPA (BR-series) accelerators are currently usable only through an
out-of-tree monkey-patch package. This PR is the first step towards in-tree
support: it teaches SGLang how to detect the supa PrivateUse1 backend and
registers a minimal SupaSRTPlatform, so device selection, memory queries and
environment diagnostics work without vendor patches. It provides the
foundation for follow-up PRs (attention backend, KV pool, graph runner,
communicator, CI).

Modifications

  • python/sglang/srt/utils/common.py
    • Add cached is_supa() detection (imports torch_br on demand; returns
      False when absent).
    • Wire SUPA into get_device, get_device_count, get_device_name,
      get_device_core_count and get_device_capability, and add SUPA to the
      "no accelerator" error message.
  • python/sglang/srt/platforms/supa.py (new)
    • SupaDeviceMixin: device identity (supa), memory/device queries via
      torch.supa, sccl distributed backend, capability from device
      properties.
    • SupaSRTPlatform: in-tree platform scaffold with conservative capability
      defaults.
  • python/sglang/srt/platforms/__init__.py
    • Add _is_supa_available() and SUPA as an auto-discovery fallback.
  • python/sglang/check_env.py
    • Add SUPAEnv: device list/capabilities, SUPA_PATH/FULLSTACK_HOME,
      brcc version, brsmi --version driver info and brsmi topo -m
      topology.
  • Tests
    • New test/registered/unit/platforms/test_supa_platform.py (12 cases,
      mock-based so it runs on CPU CI).
    • Extend the existing base-fallback discovery test to account for the new
      SUPA branch.

Accuracy Tests

N/A — this PR only adds device detection and a platform scaffold. No model
computation, kernels or forward code are modified.

Speed Tests and Profiling

N/A — no inference path is changed.

Checklist

Verified on 8x Biren166M (BR1xx, SUPA 1.12, torch 2.9 + torch_br):
python -m sglang.check_env reports 8 devices with compute capability 10.4,
BRCC/brsmi driver 1.12 and the topology matrix; the 12 new unit tests pass and
ruff format/ruff check are clean.


CI States

Latest PR Test (Base): ❌ Run #36100460183
Latest PR Test (Extra): ❌ Run #36100460117
Latest PR Test (AMD ROCm 10): ❌ Run #36100460167

@Dashener2

Copy link
Copy Markdown
Author

@sglang Merge Oncall could you please add the run-ci label to trigger CI? Thanks!

@Dashener2

Copy link
Copy Markdown
Author

/tag-and-rerun-ci

Add first-class detection and a platform scaffold for Biren SUPA
(BR-series) accelerators. SUPA is exposed to PyTorch as the `supa`
PrivateUse1 backend once the vendor `torch_br` plugin is imported.

- utils/common.py: add is_supa() and wire it into get_device,
  get_device_count, get_device_name, get_device_core_count and
  get_device_capability
- platforms/supa.py: SupaDeviceMixin + SupaSRTPlatform (SCCL
  distributed backend, device and memory queries), registered as an
  in-tree SRT platform fallback
- platforms/__init__.py: detect SUPA when no platform plugin activates
- check_env.py: add SUPAEnv reporting devices, brcc and brsmi versions
- tests: add SUPA platform unit tests and cover the new fallback

Signed-off-by: Max <129373179+Dashener2@users.noreply.github.com>
@Dashener2

Copy link
Copy Markdown
Author

@merrymercy could you add the run-ci label to this PR so CI can run?
It's a new Biren SUPA platform (python/sglang/srt/platforms/supa.py +
device detection in srt/utils/common.py). Thanks!

@Dashener2

Copy link
Copy Markdown
Author

Hi @merrymercy, would you mind taking a look at this PR when you have a moment?

This is the first step towards in-tree Biren SUPA (BR-series) support. Currently SUPA accelerators are only usable through an out-of-tree monkey-patch package; this PR teaches SGLang how to detect the supa PrivateUse1 backend (via the vendor torch_br plugin) and registers a minimal SupaSRTPlatform, so device selection, memory queries and check_env diagnostics work without vendor patches.

It's detection + platform scaffold only — no model computation, kernels, or forward code are touched. The 12 new unit tests are mock-based and run on CPU CI. Verified locally on 8x Biren166M (SUPA 1.12, torch 2.9 + torch_br).

Happy to address any feedback. Thanks!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant