[AMD] Enable gfx1250 sgl-kernel builds (#32466)
Co-authored-by: Lianmin Zheng <lianminzheng@gmail.com>
This commit is contained in:
co-authored by
Lianmin Zheng
parent
18e6c61c21
commit
b38caebf09
@@ -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(
|
__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");
|
int32x4_t srsrc, int32_t voffset, int32_t soffset, int32_t aux) __asm("llvm.amdgcn.raw.buffer.load.v4i32");
|
||||||
|
|
||||||
__quickreduce_device_inline__ static void
|
__quickreduce_device_inline__ static void
|
||||||
buffer_store_dwordx4(int32x4_t data, int32x4_t srsrc, int32_t voffset, int32_t soffset, int32_t aux) __asm(
|
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");
|
"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) {
|
__quickreduce_device_inline__ static void set_fp16_ovfl(bool const value) {
|
||||||
#if defined(__gfx942__)
|
#if defined(__gfx942__)
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ if torch.cuda.is_available():
|
|||||||
else:
|
else:
|
||||||
print(f"Warning: torch.cuda not available. Using default target: {amdgpu_target}")
|
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(
|
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)
|
sys.exit(1)
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ fp8_macro = (
|
|||||||
# Dynamic shared-memory budget for the TopK kernels.
|
# Dynamic shared-memory budget for the TopK kernels.
|
||||||
# - gfx942 (MI300/MI325): LDS is typically 64KB per workgroup -> keep dynamic smem <= ~48KB
|
# - gfx942 (MI300/MI325): LDS is typically 64KB per workgroup -> keep dynamic smem <= ~48KB
|
||||||
# (leaves room for static shared allocations in the kernel).
|
# (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
|
topk_dynamic_smem_bytes = 48 * 1024 if amdgpu_target == "gfx942" else 32 * 1024 * 4
|
||||||
|
|
||||||
hipcc_flags = [
|
hipcc_flags = [
|
||||||
@@ -126,5 +126,4 @@ setup(
|
|||||||
package_dir={"": "python"},
|
package_dir={"": "python"},
|
||||||
ext_modules=ext_modules,
|
ext_modules=ext_modules,
|
||||||
cmdclass={"build_ext": BuildExtension.with_options(use_ninja=True)},
|
cmdclass={"build_ext": BuildExtension.with_options(use_ninja=True)},
|
||||||
options={"bdist_wheel": {"py_limited_api": "cp39"}},
|
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user