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 16, 19:30 UTC
[CI/Build] Suppress divide-by-zero and missing return statement warnings (#7001)
Tyler Michael Smith committed
Aug 5, 2024 at 16:00 UTC
6e4852ce28ad57dc440067778464ac61e0621899
4 files changed
+24
-8
csrc/attention/dtype_bfloat16.cuh
+8
@@ -94,6 +94,7 @@ inline __device__ float2 bf1622float2(const __nv_bfloat162 val) {
94
#else
95
return __bfloat1622float2(val);
96
#endif
97
+ __builtin_unreachable(); // Suppress missing return statement warning
98
}
99
100
inline __device__ __nv_bfloat162 bf162bf162(const __nv_bfloat16 val) {
@@ -102,6 +103,7 @@ inline __device__ __nv_bfloat162 bf162bf162(const __nv_bfloat16 val) {
103
#else
104
return __bfloat162bfloat162(val);
105
#endif
106
+ __builtin_unreachable(); // Suppress missing return statement warning
107
}
108
109
// Vector addition.
@@ -115,6 +117,7 @@ inline __device__ __nv_bfloat16 add(__nv_bfloat16 a, __nv_bfloat16 b) {
117
return __hadd(a, b);
118
#endif
119
#endif
120
+ __builtin_unreachable(); // Suppress missing return statement warning
121
}
122
123
inline __device__ __nv_bfloat162 add(__nv_bfloat162 a, __nv_bfloat162 b) {
@@ -123,6 +126,7 @@ inline __device__ __nv_bfloat162 add(__nv_bfloat162 a, __nv_bfloat162 b) {
126
#else
127
return __hadd2(a, b);
128
#endif
129
+ __builtin_unreachable(); // Suppress missing return statement warning
130
}
131
132
inline __device__ bf16_4_t add(bf16_4_t a, bf16_4_t b) {
@@ -170,6 +174,7 @@ inline __device__ __nv_bfloat16 mul(__nv_bfloat16 a, __nv_bfloat16 b) {
174
#else
175
return __hmul(a, b);
176
#endif
177
+ __builtin_unreachable(); // Suppress missing return statement warning
178
}
179
180
template <>
@@ -179,6 +184,7 @@ inline __device__ __nv_bfloat162 mul(__nv_bfloat162 a, __nv_bfloat162 b) {
184
#else
185
return __hmul2(a, b);
186
#endif
187
+ __builtin_unreachable(); // Suppress missing return statement warning
188
}
189
190
template <>
@@ -289,6 +295,7 @@ inline __device__ __nv_bfloat162 fma(__nv_bfloat162 a, __nv_bfloat162 b,
295
#else
296
return __hfma2(a, b, c);
297
#endif
298
+ __builtin_unreachable(); // Suppress missing return statement warning
299
}
300
301
inline __device__ __nv_bfloat162 fma(__nv_bfloat16 a, __nv_bfloat162 b,
@@ -298,6 +305,7 @@ inline __device__ __nv_bfloat162 fma(__nv_bfloat16 a, __nv_bfloat162 b,
305
#else
306
return __hfma2(bf162bf162(a), b, c);
307
#endif
308
+ __builtin_unreachable(); // Suppress missing return statement warning
309
}
310
311
inline __device__ bf16_4_t fma(bf16_4_t a, bf16_4_t b, bf16_4_t c) {
csrc/quantization/awq/dequantize.cuh
+1
@@ -95,6 +95,7 @@ __device__ uint4 dequantize_s4_to_fp16x2(uint32_t const& source) {
95
96
return result;
97
#endif
98
+ __builtin_unreachable(); // Suppress missing return statement warning
99
}
100
101
} // namespace awq
csrc/quantization/fp8/nvidia/quant_utils.cuh
+3
-2
@@ -475,6 +475,7 @@ __inline__ __device__ uint8_t scaled_vec_conversion<uint8_t, __nv_bfloat16>(
475
__NV_SATFINITE, fp8_type);
476
return (uint8_t)res;
477
#endif
478
+ __builtin_unreachable(); // Suppress missing return statement warning
479
}
480
481
// float -> fp8
@@ -508,7 +509,7 @@ __inline__ __device__ Tout convert(const Tin& x) {
509
}
510
#endif
511
assert(false);
511
- return {}; // Squash missing return statement warning
512
+ __builtin_unreachable(); // Suppress missing return statement warning
513
}
514
515
template <typename Tout, typename Tin, Fp8KVCacheDataType kv_dt>
@@ -521,7 +522,7 @@ __inline__ __device__ Tout scaled_convert(const Tin& x, const float scale) {
522
}
523
#endif
524
assert(false);
524
- return {}; // Squash missing return statement warning
525
+ __builtin_unreachable(); // Suppress missing return statement warning
526
}
527
528
// The following macro is used to dispatch the conversion function based on
csrc/quantization/gptq_marlin/gptq_marlin.cu
+12
-6
@@ -1130,12 +1130,12 @@ __global__ void Marlin(
1130
};
1131
1132
auto fetch_zp_to_registers = [&](int k, int full_pipe) {
1133
- if constexpr (has_zp) {
1134
- // This code does not handle group_blocks == 0,
1135
- // which signifies act_order.
1136
- // has_zp implies AWQ, which doesn't have act_order,
1137
- static_assert(group_blocks != 0);
1133
+ // This code does not handle group_blocks == 0,
1134
+ // which signifies act_order.
1135
+ // has_zp implies AWQ, which doesn't have act_order,
1136
+ static_assert(!has_zp || group_blocks != 0);
1137
1138
+ if constexpr (has_zp) {
1139
int pipe = full_pipe % stages;
1140
1141
if constexpr (group_blocks == -1) {
@@ -1161,7 +1161,13 @@ __global__ void Marlin(
1161
cur_k += k_iter_size * (k % b_sh_wr_iters);
1162
1163
int k_blocks = cur_k / 16;
1164
- int cur_group_id = k_blocks / group_blocks;
1164
+ int cur_group_id = 0;
1165
+
1166
+ // Suppress bogus and persistent divide-by-zero warning
1167
+ #pragma nv_diagnostic push
1168
+ #pragma nv_diag_suppress divide_by_zero
1169
+ cur_group_id = k_blocks / group_blocks;
1170
+ #pragma nv_diagnostic pop
1171
1172
int4* sh_zp_stage = sh_zp + zp_sh_stage * pipe;
1173