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

[MISC] Remove unused variableds in C++ (#19609)

Signed-off-by: Lu Fang <lufang@fb.com>

Lu Fang committed Jun 16, 2025 at 11:05 UTC c6703d1e0d488a09dc76562c7335306f0f3486c0
6 files changed +2 -39
csrc/attention/paged_attention_v1.cu
+1 -4
@@ -65,9 +65,6 @@ void paged_attention_v1_launcher(
65 int kv_block_stride = key_cache.stride(0);
66 int kv_head_stride = key_cache.stride(1);
67
68 - [[maybe_unused]] int thread_group_size = MAX(WARP_SIZE / BLOCK_SIZE, 1);
69 - assert(head_size % thread_group_size == 0);
70 -
68 // NOTE: alibi_slopes is optional.
69 const float* alibi_slopes_ptr =
70 alibi_slopes
@@ -193,4 +190,4 @@ void paged_attention_v1(
190 #undef WARP_SIZE
191 #undef MAX
192 #undef MIN
196 -#undef DIVIDE_ROUND_UP
\ No newline at end of file
193 +#undef DIVIDE_ROUND_UP
csrc/attention/paged_attention_v2.cu
+1 -4
@@ -66,9 +66,6 @@ void paged_attention_v2_launcher(
66 int kv_block_stride = key_cache.stride(0);
67 int kv_head_stride = key_cache.stride(1);
68
69 - [[maybe_unused]] int thread_group_size = MAX(WARP_SIZE / BLOCK_SIZE, 1);
70 - assert(head_size % thread_group_size == 0);
71 -
69 // NOTE: alibi_slopes is optional.
70 const float* alibi_slopes_ptr =
71 alibi_slopes
@@ -203,4 +200,4 @@ void paged_attention_v2(
200 #undef WARP_SIZE
201 #undef MAX
202 #undef MIN
206 -#undef DIVIDE_ROUND_UP
\ No newline at end of file
203 +#undef DIVIDE_ROUND_UP
csrc/prepare_inputs/advance_step.cu
-1
@@ -274,7 +274,6 @@ void advance_step_flashinfer(
274 cudaDeviceGetAttribute(&blocks, cudaDevAttrMultiProcessorCount, dev);
275 cudaDeviceGetAttribute(&threads, cudaDevAttrMaxThreadsPerBlock, dev);
276
277 - [[maybe_unused]] int block_tables_stride = block_tables.stride(0);
277 TORCH_CHECK((blocks * threads > num_queries),
278 "multi-step: not enough threads to map to num_queries = ",
279 num_queries, " block_tables.stride(0) = ", block_tables.stride(0),
csrc/quantization/fp8/amd/quant_utils.cuh
-2
@@ -446,8 +446,6 @@ scaled_vec_conversion<uint16_t, uint8_t>(const uint8_t& a, float scale) {
446 template <>
447 __inline__ __device__ uint32_t
448 scaled_vec_conversion<uint32_t, uint16_t>(const uint16_t& a, float scale) {
449 - [[maybe_unused]] __half2_raw h2r =
450 - __hip_cvt_fp8x2_to_halfraw2(a, fp8_type::__default_interpret);
449 union {
450 __half2_raw h2r;
451 uint32_t ui32;
csrc/quantization/gptq/q_gemm.cu
-8
@@ -206,8 +206,6 @@ __global__ void gemm_half_q_half_gptq_4bit_kernel(
206 auto offset_m = blockIdx.y * m_count;
207 auto offset_k = blockIdx.z * BLOCK_KN_SIZE;
208
209 - [[maybe_unused]] int end_n = min(offset_n + BLOCK_KN_SIZE * 4, size_n);
210 - [[maybe_unused]] int end_m = min(offset_m + m_count, size_m);
209 int end_k = min(offset_k + BLOCK_KN_SIZE, size_k);
210
211 int n = offset_n + t * 4;
@@ -344,8 +342,6 @@ __global__ void gemm_half_q_half_gptq_2bit_kernel(
342 auto offset_m = blockIdx.y * m_count;
343 auto offset_k = blockIdx.z * BLOCK_KN_SIZE;
344
347 - [[maybe_unused]] int end_n = min(offset_n + BLOCK_KN_SIZE * 4, size_n);
348 - [[maybe_unused]] int end_m = min(offset_m + m_count, size_m);
345 int end_k = min(offset_k + BLOCK_KN_SIZE, size_k);
346
347 int n = offset_n + t * 4;
@@ -465,8 +461,6 @@ __global__ void gemm_half_q_half_gptq_3bit_kernel(
461 auto offset_m = blockIdx.y * m_count;
462 auto offset_k = blockIdx.z * BLOCK_KN_SIZE;
463
468 - [[maybe_unused]] int end_n = min(offset_n + BLOCK_KN_SIZE * 4, size_n);
469 - [[maybe_unused]] int end_m = min(offset_m + m_count, size_m);
464 int end_k = min(offset_k + BLOCK_KN_SIZE, size_k);
465
466 int n = offset_n + t * 4;
@@ -593,8 +587,6 @@ __global__ void gemm_half_q_half_gptq_8bit_kernel(
587 auto offset_m = blockIdx.y * m_count;
588 auto offset_k = blockIdx.z * BLOCK_KN_SIZE;
589
596 - [[maybe_unused]] int end_n = min(offset_n + BLOCK_KN_SIZE * 4, size_n);
597 - [[maybe_unused]] int end_m = min(offset_m + m_count, size_m);
590 int end_k = min(offset_k + BLOCK_KN_SIZE, size_k);
591
592 int n = offset_n + t * 4;
csrc/rocm/attention.cu
-20
@@ -136,11 +136,6 @@ __device__ __forceinline__ T from_float(const float& inp) {
136
137 template <typename T>
138 __device__ __forceinline__ _B16x4 from_floatx4(const floatx4& inp) {
139 - [[maybe_unused]] union tmpcvt {
140 - uint16_t u;
141 - _Float16 f;
142 - __hip_bfloat16 b;
143 - } t16;
139 _B16x4 ret;
140 if constexpr (std::is_same<T, _Float16>::value) {
141 union h2cvt {
@@ -169,11 +164,6 @@ __device__ __forceinline__ _B16x4 from_floatx4(const floatx4& inp) {
164 template <typename T>
165 __device__ __forceinline__ _B16x4 addx4(const _B16x4& inp1,
166 const _B16x4& inp2) {
172 - [[maybe_unused]] union tmpcvt {
173 - uint16_t u;
174 - _Float16 f;
175 - __hip_bfloat16 b;
176 - } t1, t2, res;
167 _B16x4 ret;
168 if constexpr (std::is_same<T, _Float16>::value) {
169 union h2cvt {
@@ -325,8 +315,6 @@ __launch_bounds__(NUM_THREADS, 5) void paged_attention_ll4mi_QKV_mfma16_kernel(
315
316 constexpr int GQA_RATIO4 = DIVIDE_ROUND_UP(GQA_RATIO, 4);
317
328 - [[maybe_unused]] __shared__ float shared_qk_max[NWARPS][16 + 1];
329 - [[maybe_unused]] __shared__ float shared_exp_sum[NWARPS][16 + 1];
318 // shared_logits is used for multiple purposes
319 __shared__ _B16x4 shared_logits[NWARPS][4][16][4];
320
@@ -444,8 +432,6 @@ __launch_bounds__(NUM_THREADS, 5) void paged_attention_ll4mi_QKV_mfma16_kernel(
432 const cache_t* k_ptr2 = k_ptr + kblock_number * kv_block_stride;
433 const int klocal_token_idx =
434 TOKENS_PER_WARP * warpid + token_depth * 16 + lane16id;
447 - [[maybe_unused]] const int kglobal_token_idx =
448 - partition_start_token_idx + klocal_token_idx;
435 const int kphysical_block_offset = klocal_token_idx % BLOCK_SIZE;
436 const cache_t* k_ptr3 = k_ptr2 + kphysical_block_offset * KX;
437
@@ -1309,9 +1295,7 @@ __launch_bounds__(NUM_THREADS) void paged_attention_ll4mi_reduce_kernel(
1295
1296 const int context_len = context_lens[seq_idx];
1297 const int num_partitions = DIVIDE_ROUND_UP(context_len, PARTITION_SIZE);
1312 - [[maybe_unused]] constexpr int NUM_WARPS = NUM_THREADS / WARP_SIZE;
1298 const auto warpid = threadIdx.x / WARP_SIZE;
1314 - [[maybe_unused]] const auto laneid = threadIdx.x % WARP_SIZE;
1299
1300 __shared__ float shared_global_exp_sum;
1301 // max num partitions supported is warp_size * NPAR_LOOPS
@@ -2080,9 +2064,7 @@ __launch_bounds__(NUM_THREADS) void paged_attention_ll4mi_reduce_kernel(
2064
2065 const int context_len = context_lens[seq_idx];
2066 const int num_partitions = DIVIDE_ROUND_UP(context_len, PARTITION_SIZE);
2083 - [[maybe_unused]] constexpr int NUM_WARPS = NUM_THREADS / WARP_SIZE;
2067 const int warpid = threadIdx.x / WARP_SIZE;
2085 - [[maybe_unused]] const int laneid = threadIdx.x % WARP_SIZE;
2068
2069 __shared__ float shared_global_exp_sum;
2070 // max num partitions supported is warp_size * NPAR_LOOPS
@@ -2816,9 +2798,7 @@ __launch_bounds__(NUM_THREADS) void paged_attention_ll4mi_reduce_kernel(
2798
2799 const int context_len = context_lens[seq_idx];
2800 const int num_partitions = DIVIDE_ROUND_UP(context_len, PARTITION_SIZE);
2819 - [[maybe_unused]] constexpr int NUM_WARPS = NUM_THREADS / WARP_SIZE;
2801 const int warpid = threadIdx.x / WARP_SIZE;
2821 - [[maybe_unused]] const int laneid = threadIdx.x % WARP_SIZE;
2802
2803 __shared__ float shared_global_exp_sum;
2804 // max num partitions supported is warp_size * NPAR_LOOPS