Skip to content

Commit 6e4852c

Browse files
authored
[CI/Build] Suppress divide-by-zero and missing return statement warnings (#7001)
1 parent 8571ac4 commit 6e4852c

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

csrc/attention/dtype_bfloat16.cuh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ inline __device__ float2 bf1622float2(const __nv_bfloat162 val) {
9494
#else
9595
return __bfloat1622float2(val);
9696
#endif
97+
__builtin_unreachable(); // Suppress missing return statement warning
9798
}
9899

99100
inline __device__ __nv_bfloat162 bf162bf162(const __nv_bfloat16 val) {
@@ -102,6 +103,7 @@ inline __device__ __nv_bfloat162 bf162bf162(const __nv_bfloat16 val) {
102103
#else
103104
return __bfloat162bfloat162(val);
104105
#endif
106+
__builtin_unreachable(); // Suppress missing return statement warning
105107
}
106108

107109
// Vector addition.
@@ -115,6 +117,7 @@ inline __device__ __nv_bfloat16 add(__nv_bfloat16 a, __nv_bfloat16 b) {
115117
return __hadd(a, b);
116118
#endif
117119
#endif
120+
__builtin_unreachable(); // Suppress missing return statement warning
118121
}
119122

120123
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) {
123126
#else
124127
return __hadd2(a, b);
125128
#endif
129+
__builtin_unreachable(); // Suppress missing return statement warning
126130
}
127131

128132
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) {
170174
#else
171175
return __hmul(a, b);
172176
#endif
177+
__builtin_unreachable(); // Suppress missing return statement warning
173178
}
174179

175180
template <>
@@ -179,6 +184,7 @@ inline __device__ __nv_bfloat162 mul(__nv_bfloat162 a, __nv_bfloat162 b) {
179184
#else
180185
return __hmul2(a, b);
181186
#endif
187+
__builtin_unreachable(); // Suppress missing return statement warning
182188
}
183189

184190
template <>
@@ -289,6 +295,7 @@ inline __device__ __nv_bfloat162 fma(__nv_bfloat162 a, __nv_bfloat162 b,
289295
#else
290296
return __hfma2(a, b, c);
291297
#endif
298+
__builtin_unreachable(); // Suppress missing return statement warning
292299
}
293300

294301
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,
298305
#else
299306
return __hfma2(bf162bf162(a), b, c);
300307
#endif
308+
__builtin_unreachable(); // Suppress missing return statement warning
301309
}
302310

303311
inline __device__ bf16_4_t fma(bf16_4_t a, bf16_4_t b, bf16_4_t c) {

csrc/quantization/awq/dequantize.cuh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ __device__ uint4 dequantize_s4_to_fp16x2(uint32_t const& source) {
9595

9696
return result;
9797
#endif
98+
__builtin_unreachable(); // Suppress missing return statement warning
9899
}
99100

100101
} // namespace awq

csrc/quantization/fp8/nvidia/quant_utils.cuh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ __inline__ __device__ uint8_t scaled_vec_conversion<uint8_t, __nv_bfloat16>(
475475
__NV_SATFINITE, fp8_type);
476476
return (uint8_t)res;
477477
#endif
478+
__builtin_unreachable(); // Suppress missing return statement warning
478479
}
479480

480481
// float -> fp8
@@ -508,7 +509,7 @@ __inline__ __device__ Tout convert(const Tin& x) {
508509
}
509510
#endif
510511
assert(false);
511-
return {}; // Squash missing return statement warning
512+
__builtin_unreachable(); // Suppress missing return statement warning
512513
}
513514

514515
template <typename Tout, typename Tin, Fp8KVCacheDataType kv_dt>
@@ -521,7 +522,7 @@ __inline__ __device__ Tout scaled_convert(const Tin& x, const float scale) {
521522
}
522523
#endif
523524
assert(false);
524-
return {}; // Squash missing return statement warning
525+
__builtin_unreachable(); // Suppress missing return statement warning
525526
}
526527

527528
// The following macro is used to dispatch the conversion function based on

csrc/quantization/gptq_marlin/gptq_marlin.cu

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,12 +1130,12 @@ __global__ void Marlin(
11301130
};
11311131

11321132
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);
11381137

1138+
if constexpr (has_zp) {
11391139
int pipe = full_pipe % stages;
11401140

11411141
if constexpr (group_blocks == -1) {
@@ -1161,7 +1161,13 @@ __global__ void Marlin(
11611161
cur_k += k_iter_size * (k % b_sh_wr_iters);
11621162

11631163
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
11651171

11661172
int4* sh_zp_stage = sh_zp + zp_sh_stage * pipe;
11671173

0 commit comments

Comments
 (0)