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
[Kernel] Remove unused variables in awq/gemm_kernels.cu (#6908)
Tyler Michael Smith committed
Jul 29, 2024 at 20:01 UTC
aae6d36f7ebec2476f7a29ec72c91d7424bb66de
1 file changed
-23
csrc/quantization/awq/gemm_kernels.cu
-23
@@ -17,14 +17,6 @@ Shang and Dang, Xingyu and Han, Song}, journal={arXiv}, year={2023}
17
namespace vllm {
18
namespace awq {
19
20
-// Pack two half values.
21
-static inline __device__ __host__ unsigned __pack_half2(const half x,
22
- const half y) {
23
- unsigned v0 = *((unsigned short*)&x);
24
- unsigned v1 = *((unsigned short*)&y);
25
- return (v1 << 16) | v0;
26
-}
27
-
20
template <int N>
21
__global__ void __launch_bounds__(64)
22
gemm_forward_4bit_cuda_m16nXk32(int G, int split_k_iters,
@@ -42,11 +34,7 @@ __global__ void __launch_bounds__(64)
34
__shared__ half A_shared[16 * (32 + 8)];
35
__shared__ half B_shared[32 * (N + 8)];
36
45
- __shared__ half scaling_factors_shared[N];
46
- __shared__ half zeros_shared[N];
47
-
37
int j_factors1 = ((OC + N - 1) / N);
49
- int blockIdx_x = 0;
38
int blockIdx_y = blockIdx.x % ((M + 16 - 1) / 16 * j_factors1);
39
int blockIdx_z = blockIdx.x / ((M + 16 - 1) / 16 * j_factors1);
40
@@ -60,7 +48,6 @@ __global__ void __launch_bounds__(64)
48
49
static constexpr int row_stride_warp = 32 * 8 / 32;
50
static constexpr int row_stride = 2 * 32 * 8 / N;
63
- bool ld_zero_flag = (threadIdx.y * 32 + threadIdx.x) * 8 < N;
51
// TODO: Haotian: blockIdx_y / j_factors1 in A loading to support bsz > 16
52
bool ld_A_flag =
53
(blockIdx_y / j_factors1 * 16 + threadIdx.y * row_stride_warp +
@@ -145,11 +132,7 @@ __global__ void __launch_bounds__(64)
132
uint32_t B_loaded =
133
*(uint32_t*)(B_ptr_local + ax0_ax1_fused_0 * row_stride * (OC / 8));
134
uint4 B_loaded_fp16 = dequantize_s4_to_fp16x2(B_loaded);
148
- // uint4 B_loaded_zero = *(uint4*)(zeros_shared + (threadIdx.x % (cta_N /
149
- // 8)) * 8);
135
151
- // uint4 B_loaded_scale = *(uint4*)(scaling_factors_shared + (threadIdx.x
152
- // % (cta_N / 8)) * 8);
136
// - zero and * scale
137
// TODO (Haotian): can save 4 assembly instructions if sormulate as deq =
138
// q * scale - zero * scale.
@@ -367,17 +350,11 @@ __global__ void __launch_bounds__(64)
350
__global__ void __launch_bounds__(64)
351
dequantize_weights(int* __restrict__ B, half* __restrict__ scaling_factors,
352
int* __restrict__ zeros, half* __restrict__ C, int G) {
370
- int j_factors1 = 4;
371
- int row_stride2 = 4;
372
- int split_k_iters = 1;
353
static constexpr uint32_t ZERO = 0x0;
354
half B_shared[32 * (128 + 8)];
355
356
half* B_shared_ptr2 = B_shared;
357
378
- half B_shared_warp[32];
379
- int OC = 512;
380
-
358
int N = blockDim.x * gridDim.x; // 2
359
int col = (blockIdx.x * blockDim.x + threadIdx.x);
360
int row = blockIdx.y * blockDim.y + threadIdx.y;