@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / d8487ef557
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 15, 11:00 UTC

[ROCm]: Fix build from source failure with gcc14 and ROCm 6.3 (#13779)

Signed-off-by: Arjun Kathuria <arjun.kathuria8@gmail.com>

Arjun Kathuria committed May 13, 2025 at 09:06 UTC d8487ef557cd10647c2471adb6d04a707023f549
2 files changed +21 -3
csrc/quantization/compressed_tensors/int8_quant_kernels.cu
+14 -2
@@ -26,7 +26,13 @@ static inline __device__ int8_t float_to_int8_rn(float x) {
26 float dst = std::nearbyint(x);
27
28 // saturate
29 - dst = std::clamp(dst, i8_min, i8_max);
29 +
30 + // See https://github.com/pytorch/pytorch/issues/127666
31 + // See https://github.com/llvm/llvm-project/issues/95183
32 + // hip-clang std::clamp __glibcxx_assert_fail host function when building on
33 + // Arch/gcc14. The following replaces std::clamp usage with similar logic
34 + // dst = std::clamp(dst, i8_min, i8_max);
35 + dst = (dst < i8_min) ? i8_min : (dst > i8_max) ? i8_max : dst;
36 return static_cast<int8_t>(dst);
37 #else
38 // CUDA path
@@ -79,7 +85,13 @@ static inline __device__ int8_t int32_to_int8(int32_t x) {
85 static_cast<int32_t>(std::numeric_limits<int8_t>::max());
86
87 // saturate
82 - int32_t dst = std::clamp(x, i8_min, i8_max);
88 +
89 + // See https://github.com/pytorch/pytorch/issues/127666
90 + // See https://github.com/llvm/llvm-project/issues/95183
91 + // hip-clang std::clamp __glibcxx_assert_fail host function when building on
92 + // Arch/gcc14. The following replaces std::clamp usage with similar logic
93 + // int32_t dst = std::clamp(x, i8_min, i8_max);
94 + int32_t dst = (x < i8_min) ? i8_min : (x > i8_max) ? i8_max : x;
95 return static_cast<int8_t>(dst);
96 #else
97 // CUDA path
csrc/quantization/fused_kernels/quant_conversions.cuh
+7 -1
@@ -21,7 +21,13 @@ static __device__ __forceinline__ int8_t float_to_int8_rn(float const x) {
21 // round
22 float dst = std::nearbyint(x);
23 // saturate
24 - dst = std::clamp(dst, i8_min, i8_max);
24 +
25 + // See https://github.com/pytorch/pytorch/issues/127666
26 + // See https://github.com/llvm/llvm-project/issues/95183
27 + // hip-clang std::clamp __glibcxx_assert_fail host function when building on
28 + // Arch/gcc14. The following replaces std::clamp usage with similar logic
29 + // dst = std::clamp(dst, i8_min, i8_max);
30 + dst = (dst < i8_min) ? i8_min : (dst > i8_max) ? i8_max : dst;
31 return static_cast<int8_t>(dst);
32 #else
33 // CUDA path