diff --git a/python/sglang/kernels/aot/csrc/allreduce/quick_all_reduce_base.h b/python/sglang/kernels/aot/csrc/allreduce/quick_all_reduce_base.h index 759b28f38..c22a7fb3e 100644 --- a/python/sglang/kernels/aot/csrc/allreduce/quick_all_reduce_base.h +++ b/python/sglang/kernels/aot/csrc/allreduce/quick_all_reduce_base.h @@ -77,12 +77,23 @@ union BufferResource { }; }; +// llvm.amdgcn.raw.buffer.* instructions do not exist on RDNA4 (gfx12). +// QuickReduce remains runtime-disabled on gfx1250; these stubs only allow the +// shared ROCm extension to compile for that target. +#if !defined(__gfx1250__) __quickreduce_device_inline__ static int32x4_t buffer_load_dwordx4( int32x4_t srsrc, int32_t voffset, int32_t soffset, int32_t aux) __asm("llvm.amdgcn.raw.buffer.load.v4i32"); __quickreduce_device_inline__ static void buffer_store_dwordx4(int32x4_t data, int32x4_t srsrc, int32_t voffset, int32_t soffset, int32_t aux) __asm( "llvm.amdgcn.raw.buffer.store.v4i32"); +#else +__quickreduce_device_inline__ static int32x4_t +buffer_load_dwordx4(int32x4_t srsrc, int32_t voffset, int32_t soffset, int32_t aux) {} + +__quickreduce_device_inline__ static void +buffer_store_dwordx4(int32x4_t data, int32x4_t srsrc, int32_t voffset, int32_t soffset, int32_t aux) {} +#endif __quickreduce_device_inline__ static void set_fp16_ovfl(bool const value) { #if defined(__gfx942__) diff --git a/python/sglang/kernels/aot/setup_rocm.py b/python/sglang/kernels/aot/setup_rocm.py index 9762787aa..289683910 100644 --- a/python/sglang/kernels/aot/setup_rocm.py +++ b/python/sglang/kernels/aot/setup_rocm.py @@ -74,9 +74,9 @@ if torch.cuda.is_available(): else: print(f"Warning: torch.cuda not available. Using default target: {amdgpu_target}") -if amdgpu_target not in ["gfx942", "gfx950"]: +if amdgpu_target not in ["gfx942", "gfx950", "gfx1250"]: print( - f"Warning: Unsupported GPU architecture detected '{amdgpu_target}'. Expected 'gfx942' or 'gfx950'." + f"Warning: Unsupported GPU architecture detected '{amdgpu_target}'. Expected 'gfx942', 'gfx950', or 'gfx1250'." ) sys.exit(1) @@ -87,7 +87,7 @@ fp8_macro = ( # Dynamic shared-memory budget for the TopK kernels. # - gfx942 (MI300/MI325): LDS is typically 64KB per workgroup -> keep dynamic smem <= ~48KB # (leaves room for static shared allocations in the kernel). -# - gfx95x (MI350): LDS is larger (e.g. 160KB per CU) -> allow the original 128KB dynamic smem. +# - gfx95x (MI350) and gfx1250: LDS is larger -> allow the original 128KB dynamic smem. topk_dynamic_smem_bytes = 48 * 1024 if amdgpu_target == "gfx942" else 32 * 1024 * 4 hipcc_flags = [ @@ -126,5 +126,4 @@ setup( package_dir={"": "python"}, ext_modules=ext_modules, cmdclass={"build_ext": BuildExtension.with_options(use_ninja=True)}, - options={"bdist_wheel": {"py_limited_api": "cp39"}}, )