diff --git a/.github/workflows/pr-test-amd-rocm720.yml b/.github/workflows/pr-test-amd-rocm720.yml index e9d83d2e1..7df6e3251 100644 --- a/.github/workflows/pr-test-amd-rocm720.yml +++ b/.github/workflows/pr-test-amd-rocm720.yml @@ -898,7 +898,7 @@ jobs: fail-fast: false matrix: runner: [linux-mi325-8gpu-sglang] - part: [0, 1, 2] + part: [0, 1, 2, 3] runs-on: ${{matrix.runner}} steps: - name: Checkout code @@ -925,7 +925,7 @@ jobs: - name: Run test timeout-minutes: 120 run: | - bash scripts/ci/amd/amd_ci_exec.sh -w "/sglang-checkout/test" python3 run_suite.py --hw amd --suite stage-c-test-large-8-gpu-amd --auto-partition-id ${{ matrix.part }} --auto-partition-size 3 --timeout-per-file 5400 ${{ needs.check-changes.outputs.continue_on_error == 'true' && '--continue-on-error' || '' }} + bash scripts/ci/amd/amd_ci_exec.sh -w "/sglang-checkout/test" python3 run_suite.py --hw amd --suite stage-c-test-large-8-gpu-amd --auto-partition-id ${{ matrix.part }} --auto-partition-size 4 --timeout-per-file 5400 ${{ (github.event_name == 'schedule' || inputs.continue_on_error) && '--continue-on-error' || '' }} stage-c-test-large-8-gpu-amd-mi35x-rocm720: needs: [check-changes] diff --git a/.github/workflows/pr-test-amd.yml b/.github/workflows/pr-test-amd.yml index 08f67b88c..69123f488 100644 --- a/.github/workflows/pr-test-amd.yml +++ b/.github/workflows/pr-test-amd.yml @@ -997,7 +997,7 @@ jobs: - name: Run test timeout-minutes: 120 run: | - bash scripts/ci/amd/amd_ci_exec.sh -w "/sglang-checkout/test" python3 run_suite.py --hw amd --suite stage-c-test-large-8-gpu-amd --auto-partition-id ${{ matrix.part }} --auto-partition-size 3 --timeout-per-file 5400 ${{ needs.check-changes.outputs.continue_on_error == 'true' && '--continue-on-error' || '' }} + bash scripts/ci/amd/amd_ci_exec.sh -w "/sglang-checkout/test" python3 run_suite.py --hw amd --suite stage-c-test-large-8-gpu-amd --auto-partition-id ${{ matrix.part }} --auto-partition-size 4 --timeout-per-file 5400 ${{ needs.check-changes.outputs.continue_on_error == 'true' && '--continue-on-error' || '' }} stage-c-test-large-8-gpu-amd-mi35x: needs: [check-changes, call-gate, wait-for-stage-b-amd] diff --git a/python/sglang/srt/layers/attention/triton_backend.py b/python/sglang/srt/layers/attention/triton_backend.py index 01c27f3e8..f280f8b9f 100644 --- a/python/sglang/srt/layers/attention/triton_backend.py +++ b/python/sglang/srt/layers/attention/triton_backend.py @@ -22,10 +22,12 @@ from sglang.srt.utils import ( get_device_core_count, get_int_env_var, is_cuda, + is_gfx942_supported, next_power_of_2, ) _is_cuda = is_cuda() +_is_gfx942 = is_gfx942_supported() if _is_cuda: from sgl_kernel.utils import is_arch_support_pdl @@ -163,6 +165,15 @@ class TritonAttnBackend(AttentionBackend): self.device_core_count, self.max_context_len, ) + if _is_gfx942: + # gfx942 (MI300X / MI325X) has 304 CUs, so #20479's next_power_of_2(sm_count) + # rounds up to 512 — twice MI355X's natural cap of 256 — and the persistent + # cuda_graph_attn_logits fp32 buffer hits ~4 GiB on Kimi-K2.6 (v_head_dim=512), + # faulting in ROCm CUDA graph replay + # (https://github.com/sgl-project/sglang/actions/runs/25513282022/job/74877480809). + # Pin the cap at 256 so gfx942 matches the gfx950 (MI355X) behavior that we + # already validated end-to-end. + self.max_kv_splits = min(self.max_kv_splits, 256) if _is_cuda: self.use_pdl = is_arch_support_pdl() else: diff --git a/python/sglang/srt/utils/common.py b/python/sglang/srt/utils/common.py index bdf496316..85f576ac2 100644 --- a/python/sglang/srt/utils/common.py +++ b/python/sglang/srt/utils/common.py @@ -3656,6 +3656,18 @@ def is_gfx95_supported(): return False +@lru_cache(maxsize=1) +def is_gfx942_supported(): + """ + Returns whether the current platform is AMD CDNA3 (gfx942 — MI300X / MI325X). + """ + if torch.version.hip: + gcn_arch = torch.cuda.get_device_properties(0).gcnArchName + return any(gfx in gcn_arch for gfx in ["gfx942"]) + else: + return False + + def get_hip_version(): if torch.version.hip: return tuple(map(int, torch.version.hip.split("-")[0].split("."))) diff --git a/test/registered/amd/test_kimi_k2_instruct.py b/test/registered/amd/test_kimi_k2_instruct.py index 896d3b154..bb2c57c3d 100644 --- a/test/registered/amd/test_kimi_k2_instruct.py +++ b/test/registered/amd/test_kimi_k2_instruct.py @@ -63,7 +63,7 @@ class TestKimiK2Instruct0905(CustomTestCase): num_shots=8, data_path=None, num_questions=1319, - parallel=1319, + parallel=512, max_new_tokens=512, host="http://127.0.0.1", port=int(self.base_url.split(":")[-1]),