@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 4b7869d6bc
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 4, 18:45 UTC

[ROCm] Add gfx1102/gfx1103 support (#40037)

Signed-off-by: Matthias Gehre <matthias.gehre@amd.com>

Matthias Gehre committed Apr 23, 2026 at 10:32 UTC 4b7869d6bc64f5b124e2403891b4c2e29713bbf5
3 files changed +21 -35
CMakeLists.txt
+1 -1
@@ -37,7 +37,7 @@ install(CODE "set(CMAKE_INSTALL_LOCAL_ONLY TRUE)" ALL_COMPONENTS)
37 set(PYTHON_SUPPORTED_VERSIONS "3.10" "3.11" "3.12" "3.13")
38
39 # Supported AMD GPU architectures.
40 -set(HIP_SUPPORTED_ARCHS "gfx906;gfx908;gfx90a;gfx942;gfx950;gfx1030;gfx1100;gfx1101;gfx1150;gfx1151;gfx1152;gfx1153;gfx1200;gfx1201")
40 +set(HIP_SUPPORTED_ARCHS "gfx906;gfx908;gfx90a;gfx942;gfx950;gfx1030;gfx1100;gfx1101;gfx1102;gfx1103;gfx1150;gfx1151;gfx1152;gfx1153;gfx1200;gfx1201")
41
42 # ROCm installation prefix. Default to /opt/rocm but allow override via
43 # -DROCM_PATH=/your/rocm/path when invoking cmake.
csrc/rocm/attention.cu
+2 -11
@@ -40,15 +40,6 @@ using __hip_fp8_e5m2 = __hip_fp8_e5m2_fnuz;
40 #define __HIP__FP8MFMA__
41 #endif
42
43 -#if defined(__HIPCC__) && (defined(__gfx1100__) || defined(__gfx1101__) || \
44 - defined(__gfx1150__) || defined(__gfx1151__))
45 - #define __HIP__GFX11__
46 -#endif
47 -
48 -#if defined(__HIPCC__) && (defined(__gfx1200__) || defined(__gfx1201__))
49 - #define __HIP__GFX12__
50 -#endif
51 -
43 #if defined(NDEBUG)
44 #undef NDEBUG
45 #include <assert.h>
@@ -1629,7 +1620,7 @@ __launch_bounds__(NUM_THREADS) void paged_attention_ll4mi_reduce_kernel(
1620 }
1621 }
1622
1632 -#elif defined(__HIP__GFX11__)
1623 +#elif defined(__GFX11__)
1624
1625 using floatx8 = __attribute__((__vector_size__(8 * sizeof(float)))) float;
1626
@@ -2388,7 +2379,7 @@ __launch_bounds__(NUM_THREADS) void paged_attention_ll4mi_reduce_kernel(
2379 out_ptr[threadIdx.x] = from_float<scalar_t>(acc);
2380 }
2381
2391 -#elif defined(__HIP__GFX12__)
2382 +#elif defined(__GFX12__)
2383
2384 using floatx8 = __attribute__((__vector_size__(8 * sizeof(float)))) float;
2385
csrc/rocm/skinny_gemms.cu
+18 -23
@@ -26,16 +26,11 @@
26 #define __HIP__GFX9__
27 #endif
28
29 -#if defined(__HIPCC__) && \
30 - (defined(__gfx1100__) || defined(__gfx1101__) || defined(__gfx1150__) || \
31 - defined(__gfx1151__) || defined(__gfx1200__) || defined(__gfx1201__))
29 +// Combined RDNA macro (gfx11 + gfx12) - both use 32-wide wavefronts
30 +#if defined(__GFX11__) || defined(__GFX12__)
31 #define __HIP__GFX1X__
32 #endif
33
35 -#if defined(__HIPCC__) && (defined(__gfx1200__) || defined(__gfx1201__))
36 - #define __HIP__GFX12__
37 -#endif
38 -
34 #if defined(__HIPCC__) && (defined(__gfx942__) || defined(__gfx950__))
35 #define __HIP__MI3XX__
36 #endif
@@ -1845,7 +1840,7 @@ torch::Tensor wvSplitKrc(const at::Tensor& in_a, const at::Tensor& in_b,
1840 return out_c;
1841 }
1842
1848 -#if defined(__HIP__MI3XX__) || defined(__HIP__GFX12__)
1843 +#if defined(__HIP__MI3XX__) || defined(__GFX12__)
1844 template <typename scalar_t, typename fp8_t, int THRDS, int YTILE, int WvPrGrp,
1845 int A_CHUNK, int UNRL, int N>
1846 __global__ void __launch_bounds__(WvPrGrp* THRDS)
@@ -1893,7 +1888,7 @@ __global__ void __launch_bounds__(WvPrGrp* THRDS)
1888 float sB = *s_B;
1889
1890 while (m < M) {
1896 - #ifdef __HIP__GFX12__
1891 + #ifdef __GFX12__
1892 // gfx12: per-lane scalar accumulation via v_dot4_f32_fp8_fp8
1893 float sum[N][YTILE] = {};
1894 #else
@@ -1931,7 +1926,7 @@ __global__ void __launch_bounds__(WvPrGrp* THRDS)
1926 #pragma unroll
1927 for (uint32_t k2 = 0; k2 < UNRL; k2++) {
1928 for (uint32_t n = 0; n < N; n++) {
1934 - #ifdef __HIP__GFX12__
1929 + #ifdef __GFX12__
1930 // gfx12: 4 x dot4 per A_CHUNK=16 bytes (4 FP8 per dot4)
1931 for (int y = 0; y < YTILE; ++y) {
1932 #pragma unroll
@@ -1955,7 +1950,7 @@ __global__ void __launch_bounds__(WvPrGrp* THRDS)
1950 }
1951
1952 // Final reduction
1958 - #ifdef __HIP__GFX12__
1953 + #ifdef __GFX12__
1954 // gfx12 wave32: DPP row_shr within 16-lane rows + cross-row shuffle
1955 for (int n = 0; n < N; n++) {
1956 for (int y = 0; y < YTILE; y++) {
@@ -1993,7 +1988,7 @@ __global__ void __launch_bounds__(WvPrGrp* THRDS)
1988 #endif
1989
1990 const bool writeback_lane =
1996 - #ifdef __HIP__GFX12__
1991 + #ifdef __GFX12__
1992 threadIdx.x == (THRDS - 1);
1993 #else
1994 threadIdx.x == 0;
@@ -2009,7 +2004,7 @@ __global__ void __launch_bounds__(WvPrGrp* THRDS)
2004 for (int n = 0; n < N; n++) {
2005 for (int y = 0; y < YTILE; y++) {
2006 if (y + m >= M) break; // To avoid mem access fault.
2012 - #ifdef __HIP__GFX12__
2007 + #ifdef __GFX12__
2008 float result = sum[n][y] * sA * sB;
2009 #else
2010 float result = sum[n][y][0] * sA * sB;
@@ -2027,7 +2022,7 @@ __global__ void __launch_bounds__(WvPrGrp* THRDS)
2022 m += CuCount * _WvPrGrp * YTILE;
2023 }
2024 }
2030 -#else // !defined(__HIP__MI3XX__) && !defined(__HIP__GFX12__)
2025 +#else // !defined(__HIP__MI3XX__) && !defined(__GFX12__)
2026 template <typename scalar_t, typename fp8_t, int THRDS, int YTILE, int WvPrGrp,
2027 int A_CHUNK, int UNRL, int N>
2028 __global__ void wvSplitKQ_hf_sml_(const int K, const int Kap, const int Kbp,
@@ -2039,9 +2034,9 @@ __global__ void wvSplitKQ_hf_sml_(const int K, const int Kap, const int Kbp,
2034 const int _WvPrGrp, const int CuCount) {
2035 UNREACHABLE_CODE
2036 }
2042 -#endif // defined(__HIP__MI3XX__) || defined(__HIP__GFX12__)
2037 +#endif // defined(__HIP__MI3XX__) || defined(__GFX12__)
2038
2044 -#if defined(__HIP__MI3XX__) || defined(__HIP__GFX12__)
2039 +#if defined(__HIP__MI3XX__) || defined(__GFX12__)
2040 template <typename scalar_t, typename fp8_t, int THRDS, int YTILE, int WvPrGrp,
2041 int A_CHUNK, int UNRL, int N>
2042 __global__ void __launch_bounds__(WvPrGrp* THRDS)
@@ -2088,7 +2083,7 @@ __global__ void __launch_bounds__(WvPrGrp* THRDS)
2083 float sB = *s_B;
2084
2085 while (m < M) {
2091 - #ifdef __HIP__GFX12__
2086 + #ifdef __GFX12__
2087 // gfx12: per-lane scalar accumulation via v_dot4_f32_fp8_fp8
2088 float sum[N][YTILE] = {};
2089 #else
@@ -2128,7 +2123,7 @@ __global__ void __launch_bounds__(WvPrGrp* THRDS)
2123 #pragma unroll
2124 for (uint32_t k2 = 0; k2 < UNRL; k2++) {
2125 for (uint32_t n = 0; n < N; n++) {
2131 - #ifdef __HIP__GFX12__
2126 + #ifdef __GFX12__
2127 // gfx12: 4 x dot4 per A_CHUNK=16 bytes (4 FP8 per dot4)
2128 for (int y = 0; y < YTILE; ++y) {
2129 #pragma unroll
@@ -2152,7 +2147,7 @@ __global__ void __launch_bounds__(WvPrGrp* THRDS)
2147 }
2148
2149 // Final reduction
2155 - #ifdef __HIP__GFX12__
2150 + #ifdef __GFX12__
2151 // gfx12 wave32: DPP row_shr within 16-lane rows + cross-row shuffle
2152 for (int n = 0; n < N; n++) {
2153 for (int y = 0; y < YTILE; y++) {
@@ -2190,7 +2185,7 @@ __global__ void __launch_bounds__(WvPrGrp* THRDS)
2185 #endif
2186
2187 const bool writeback_lane =
2193 - #ifdef __HIP__GFX12__
2188 + #ifdef __GFX12__
2189 threadIdx.x == (THRDS - 1);
2190 #else
2191 threadIdx.x == 0;
@@ -2206,7 +2201,7 @@ __global__ void __launch_bounds__(WvPrGrp* THRDS)
2201 for (int n = 0; n < N; n++) {
2202 for (int y = 0; y < YTILE; y++) {
2203 if (y + m >= M) break; // To avoid mem access fault.
2209 - #ifdef __HIP__GFX12__
2204 + #ifdef __GFX12__
2205 float result = sum[n][y] * sA * sB;
2206 #else
2207 float result = sum[n][y][0] * sA * sB;
@@ -2224,7 +2219,7 @@ __global__ void __launch_bounds__(WvPrGrp* THRDS)
2219 m += CuCount * _WvPrGrp * YTILE;
2220 }
2221 }
2227 -#else // !defined(__HIP__MI3XX__) && !defined(__HIP__GFX12__)
2222 +#else // !defined(__HIP__MI3XX__) && !defined(__GFX12__)
2223 template <typename scalar_t, typename fp8_t, int THRDS, int YTILE, int WvPrGrp,
2224 int A_CHUNK, int UNRL, int N>
2225 __global__ void wvSplitKQ_hf_(const int K, const int Kap, const int Kbp,
@@ -2236,7 +2231,7 @@ __global__ void wvSplitKQ_hf_(const int K, const int Kap, const int Kbp,
2231 const int CuCount) {
2232 UNREACHABLE_CODE
2233 }
2239 -#endif // defined(__HIP__MI3XX__) || defined(__HIP__GFX12__)
2234 +#endif // defined(__HIP__MI3XX__) || defined(__GFX12__)
2235
2236 void wvSplitKQ(const at::Tensor& in_b, const at::Tensor& in_a,
2237 const std::optional<at::Tensor>& in_bias, at::Tensor& out_c,