Repository navigation
Conversation
Integrate exact upstream FlashML-org#135 semantics onto the current-main corrected ROCm composition while preserving FlashML-org#136. Temporary PR used only as a 3-way merge carrier.
9d5e3fc to
b794aa5
Compare
|
Confirming this from a second pair of R9700s ( We hit the pynccl break independently while trying to measure the collective through the engine's own # freetoken/kernel/pynccl.py:29-31
@functools.cache
def _load_nccl_module() -> Module:
# TODO(ROCm): NCCL -> RCCL migration for multi-GPU tensor parallelism on AMD.
return load_aot("pynccl", cuda_files=["pynccl.cu"], extra_ldflags=["-lnccl"])Two independent breaks in that one call: the vendored ⭐ Worth adding to the PR's rationale: the reason this sat unreported is The fallback performs fine — measuredSince the PR routes through
The back-to-back figure is the honest one — the host-synced arm charges ~30 µs of synchronisation the RCCL 2.30.4 chose direct peer-to-peer with no host staging, which we did not expect on this board: ⛔ These two cards have no XGMI — they are two hops apart through the AM5 root complex, on x8 gen5 ⇒ the fallback is not a degraded mode to apologise for. It is fast enough that a per-layer all-reduce One caveat on our numbers
Where we are, in case it is useful to your step 5We serve
PlatformAMD Radeon AI PRO R9700 x2 ( |
|
@lukascechovic Thanks for the detailed independent validation. Your observation about TP=1 masking the issue is correct: use_pynccl defaults to true, but enable_pynccl_distributed returns before loading or building PyNCCL when the TP size is one. I added an explicit regression test for that contract in f75a553. It verifies that the single-rank path stays on Gloo and does not probe the ROCm branch, initialize PyNCCL, or create a second process group. I also rechecked the communication tests locally on one R9700 (gfx1201) with PyTorch 2.13 nightly and ROCm 7.14:
The skipped case is the existing real two-rank RCCL test. I was limited to one GPU for this run, so I did not claim an independent two-GPU reproduction here. I agree that changing only -lnccl to -lrccl would not be a sufficient port: the current custom module also depends on NVIDIA headers, CUDA runtime APIs, and NCCL-specific APIs. Keeping this PR on the PyTorch nccl process-group path backed by RCCL is therefore the appropriately scoped fix. Your R9700 latency measurements are useful supporting microbenchmark evidence. I will keep the performance claim scoped accordingly: they demonstrate that the RCCL route is viable on that platform, but are not yet an end-to-end TP2 serving result until the model TP path itself is complete. |
|
Following up on the scoping you gave here — you're right that this thread's numbers were transport-only. No quality claim attached — we don't have a fidelity instrument on this box, which is exactly why the PlatformSame as above: AMD Radeon AI PRO R9700 x2 ( |
What: - Remove .agents/learnings and .plans/rocm-consolidation files from the branch. - Remove internal increment and plan-path references from source comments and public installation docs. - Keep implementation comments that explain correctness, ownership, profiler intent, source attribution, or ROCm safety behavior. - Clarify public ROCm documentation: gfx1100 has recorded serving smoke on ROCm 7.2.1; the ROCm 7.14.x container is a reference environment, and other target cells remain compile-only until physical serving evidence exists. Why: - Keep merge surface focused on code, tests, reproducibility tooling, and user-facing documentation. - Prevent private planning history, review workflow language, stale plan paths, and local process notes from entering the upstream repository. - Avoid presenting compile success or a reference container as cross-target serving or performance proof. Related upstream work informing this branch: - PR FlashML-org#132: portable ROCm/HIP foundation. - PR FlashML-org#133: TVM-FFI index/store portability. - PR FlashML-org#135: RCCL tensor-parallel communication. - PR FlashML-org#136: native GGUF ROCm build and Q4_0 kernels. - PR FlashML-org#137: earlier AMD serving bring-up. - PR FlashML-org#217: source-fork ROCm, Qwen3.5 GGUF, and performance experiments. - PR FlashML-org#241: gfx1150 build, JIT, Triton, and attention hardening. - PR FlashML-org#260: gfx1151 validation and fallback/build evidence. - PR FlashML-org#316: HIP graph-capture-safe expert copies. - PR FlashML-org#378: CPU/Hybrid MoE graph replay safety. - Local branch milestones: 436263f, 926c1e8, e1d1856, 8a70c7e, and e5fd30f. Evidence: - 170 focused tests passed after cleanup. - gfx1100 is the only target with end-to-end Qwen3.5 GGUF serving smoke recorded here. - Remaining matrix targets are compile-only; no new throughput claim is published without a matching A/B manifest.
f75a553 to
500763c
Compare
|
Dependency refresh (2026-09-16): rebased the three RCCL-specific commits onto the conflict-resolved #132 head |
- Add hip_compat.h shim mapping CUDA runtime API to HIP equivalents - Update pinned_tensor.cpp to compile under both nvcc and hipcc - Add ROCm detection in arch.py (is_rocm, get_rocm_gfx_arch, is_gfx11xx_family) - Guard NVIDIA arch checks to return None on ROCm - Skip nvcc version check in _toolchain.py when on ROCm - Add ROCm build path in setup.py (ROCM_HOME, amdhip64, --offload-arch) - Add _hip_cflags() in kernel/utils.py for JIT compilation on ROCm - Add is_rocm() and driver_hip_version() in backend.py - Add rocm-smi fallback in __main__.py for clangd generation - Add TODO(ROCm) for NCCL->RCCL, flashinfer/sgl_kernel ROCm builds, Triton autotune RDNA3 tuning, PDL equivalent, hiprtc JIT cache - Add AMD ROCm classifier in pyproject.toml
500763c to
3675d03
Compare
|
hi @jason-fxz @andy-yang-1 @zihaomu Thanks @zihaomu for tackling this — ROCm TP comm being broken is a real blocker, and routing the collectives through I hit the same wall independently and took a slightly different route. Sharing it as input rather than a competing change — happy to converge on whatever the maintainers prefer. My approach: keep a single unified I put it on a self-contained, rebased-on-
Unified-pynccl vs. torch-forked — the tradeoff
Correctness — the all_reduce test above, on 2×R9700 (gfx1201)
Benchmark —
|
| mode | pynccl (RCCL) | torch-nccl | ratio |
|---|---|---|---|
| eager | ~9 µs | ~26–33 µs | ~3× faster |
| CUDA-graph captured | ~12.4 µs | ~12.4 µs | ~equal |
Honest read: the eager 3× gap closes under CUDA-graph capture, and FreeToken captures the decode hot path — so for captured decode the two are effectively equal. The gap matters for un-captured / eager paths.
Either way: TP correctness validation we can contribute
Our TP weight-sharding work is comm-agnostic (goes through DistributedCommunicator), so it rides on #135's backend or ours interchangeably. Validated on RDNA + CUDA:
- Qwen3.5-9B dense TP=2 byte-identical to TP=1 (greedy); TP=4 coherent
- Qwen3.6-35B-A3B bf16 TP=4 / TP=8 coherent
- Qwen3.6-35B-A3B-FP8 TP=1(offload) == TP=2 == TP=4 byte-identical on 5 prompts
- Same run via
--disable-pynccl(thetorch.distributedpath) → also correct ⇒ confirms fix(rocm): route tensor parallel communication through RCCL #135's backend produces identical results - End-to-end fp8 35B-A3B TP=4 with pynccl on 4×R9700 → coherent output
- CUDA 2×4090: 9B TP=2 correct via both backends, byte-identical to ROCm
So whichever comm backend lands, we can supply a TP correctness matrix to go with it.
It'd be great to settle the comm direction sooner rather than later — our TP sharding work sits on top of it, so an early call unblocks the next steps for everyone. If the maintainers feel the unified-pynccl route is the better long-term fit, the pynccl-rccl-only branch is already rebased on main with a test, and I'm happy to open a standalone PR for it. Either way, glad to help test #135 on our R9700 boxes 🙂
Integrate FlashML-org#133, FlashML-org#134, FlashML-org#135, FlashML-org#378 and FlashML-org#491 before FlashML-org#587. Preserve the tested FlashML-org#378 handshake and runtime-only linkage, and retain the FlashML-org#134 installation document. Exclude CI and closed GGUF PR FlashML-org#136.
Use upstream FlashML-org#638 and FlashML-org#134; integrate incremental FlashML-org#135 and FlashML-org#378 plus the updated standalone FlashML-org#491 before FlashML-org#587. Retain the probed FlashML-org#378 handshake and upstream installation document.
|
Sharing a hardware-validated reference implementation/data point for anyone working on ROCm TP here — not proposing this as an autonomous upstream PR. I have a fork branch for Qwen3.8-Flash-Next TP=2 on 2× Radeon AI PRO R9700 (gfx1201) using the torch.distributed/RCCL path: https://github.com/TashaSkyUp/FreeToken/tree/draft/qwen4-tp-precision-r9700 The useful result for this thread is that the communication path itself is not the remaining correctness blocker. With a precision-stable TP profile applied symmetrically to TP1 and TP2, the current branch gets 100/100 exact greedy cross-TP text matches on the audited 1,024-token cohort (440 total responses across the full experiment). The earlier profile was only 77/100, so we traced the divergence to TP-sensitive arithmetic rather than RCCL transport. On the 60 short prompts with identical text/token count/finish reason across both modes:
Stack: Ubuntu 24.04.4, ROCm SDK 7.2.3 / HIP 7.2.53211, torch 2.14.1+rocm7.2, Triton 3.8.0, Qwen3.8-Flash-Next NVFP4, host offload, The detailed writeup, exact commands, frozen requests/results, and audit artifacts are here: For anyone implementing upstream: this suggests #135's torch/RCCL fallback is already sufficient for correct Qwen3.8 TP=2; the harder part is keeping TP1/TP2 arithmetic stable through the model-specific sharded attention/GDN/MoE paths. Happy for maintainers/contributors to reuse the measurements or implementation ideas from the fork. |
Summary
nccl, which the ROCm wheel implements through RCCL;-lnccllinker failure;Engine._init_communication().PyNCCL itself is deliberately bypassed, not ported to RCCL.
Incremental review scope
Relative to
zihaomu:feat/rocm-rdna3-rdna4-foundation:python/freetoken/engine/engine.pypython/freetoken/kernel/pynccl.pytests/engine/test_rocm_communication.pyDiff size: 151 additions, 2 deletions.
Dependency
Validation
gfx1201) GPUs, PyTorch2.11.0+rocm7.14.0, HIP7.14.60850;tests/engine/test_rocm_communication.py:4 passedwith both GPUs visible;Engine._init_communication()selected the defaultncclbackend (RCCL), created the CPUgloosubgroup, and produced all-reduce result3.0on both ranks;Known limitation
Full multi-GPU model serving with real weights is not claimed yet. The PR remains Draft until #132 establishes the common ROCm foundation.