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 9, 17:06 UTC
[Refactor] Rename `gptq_marlin` to `marlin` to match MoE (#32952)
Signed-off-by: mgoin <mgoin64@gmail.com>
Michael Goin committed
Jan 23, 2026 at 16:48 UTC
4561f13985e86ea15c9c672fbcfa28f12530e3e5
24 files changed
+40
-40
CMakeLists.txt
+9
-9
@@ -377,7 +377,7 @@ if(VLLM_GPU_LANG STREQUAL "CUDA")
377
# preselected input type pairs and schedules.
378
# Generate sources:
379
set(MARLIN_GEN_SCRIPT
380
- ${CMAKE_CURRENT_SOURCE_DIR}/csrc/quantization/gptq_marlin/generate_kernels.py)
380
+ ${CMAKE_CURRENT_SOURCE_DIR}/csrc/quantization/marlin/generate_kernels.py)
381
file(MD5 ${MARLIN_GEN_SCRIPT} MARLIN_GEN_SCRIPT_HASH)
382
list(JOIN CUDA_ARCHS "," CUDA_ARCHS_STR)
383
set(MARLIN_GEN_SCRIPT_HASH_AND_ARCH "${MARLIN_GEN_SCRIPT_HASH}(ARCH:${CUDA_ARCHS_STR})")
@@ -412,7 +412,7 @@ if(VLLM_GPU_LANG STREQUAL "CUDA")
412
endif()
413
414
if (MARLIN_ARCHS)
415
- file(GLOB MARLIN_TEMPLATE_KERNEL_SRC "csrc/quantization/gptq_marlin/sm80_kernel_*_float16.cu")
415
+ file(GLOB MARLIN_TEMPLATE_KERNEL_SRC "csrc/quantization/marlin/sm80_kernel_*_float16.cu")
416
set_gencode_flags_for_srcs(
417
SRCS "${MARLIN_TEMPLATE_KERNEL_SRC}"
418
CUDA_ARCHS "${MARLIN_ARCHS}")
@@ -422,7 +422,7 @@ if(VLLM_GPU_LANG STREQUAL "CUDA")
422
endif()
423
list(APPEND VLLM_EXT_SRC ${MARLIN_TEMPLATE_KERNEL_SRC})
424
425
- file(GLOB MARLIN_TEMPLATE_BF16_KERNEL_SRC "csrc/quantization/gptq_marlin/sm80_kernel_*_bfloat16.cu")
425
+ file(GLOB MARLIN_TEMPLATE_BF16_KERNEL_SRC "csrc/quantization/marlin/sm80_kernel_*_bfloat16.cu")
426
set_gencode_flags_for_srcs(
427
SRCS "${MARLIN_TEMPLATE_BF16_KERNEL_SRC}"
428
CUDA_ARCHS "${MARLIN_BF16_ARCHS}")
@@ -434,7 +434,7 @@ if(VLLM_GPU_LANG STREQUAL "CUDA")
434
endif()
435
436
if (MARLIN_SM75_ARCHS)
437
- file(GLOB MARLIN_TEMPLATE_SM75_KERNEL_SRC "csrc/quantization/gptq_marlin/sm75_kernel_*.cu")
437
+ file(GLOB MARLIN_TEMPLATE_SM75_KERNEL_SRC "csrc/quantization/marlin/sm75_kernel_*.cu")
438
set_gencode_flags_for_srcs(
439
SRCS "${MARLIN_TEMPLATE_SM75_KERNEL_SRC}"
440
CUDA_ARCHS "${MARLIN_SM75_ARCHS}")
@@ -446,7 +446,7 @@ if(VLLM_GPU_LANG STREQUAL "CUDA")
446
endif()
447
448
if (MARLIN_FP8_ARCHS)
449
- file(GLOB MARLIN_TEMPLATE_FP8_KERNEL_SRC "csrc/quantization/gptq_marlin/sm89_kernel_*.cu")
449
+ file(GLOB MARLIN_TEMPLATE_FP8_KERNEL_SRC "csrc/quantization/marlin/sm89_kernel_*.cu")
450
set_gencode_flags_for_srcs(
451
SRCS "${MARLIN_TEMPLATE_FP8_KERNEL_SRC}"
452
CUDA_ARCHS "${MARLIN_FP8_ARCHS}")
@@ -459,10 +459,10 @@ if(VLLM_GPU_LANG STREQUAL "CUDA")
459
460
set(MARLIN_SRCS
461
"csrc/quantization/marlin/sparse/marlin_24_cuda_kernel.cu"
462
- "csrc/quantization/gptq_marlin/gptq_marlin.cu"
463
- "csrc/quantization/gptq_marlin/marlin_int4_fp8_preprocess.cu"
464
- "csrc/quantization/gptq_marlin/gptq_marlin_repack.cu"
465
- "csrc/quantization/gptq_marlin/awq_marlin_repack.cu")
462
+ "csrc/quantization/marlin/marlin.cu"
463
+ "csrc/quantization/marlin/marlin_int4_fp8_preprocess.cu"
464
+ "csrc/quantization/marlin/gptq_marlin_repack.cu"
465
+ "csrc/quantization/marlin/awq_marlin_repack.cu")
466
set_gencode_flags_for_srcs(
467
SRCS "${MARLIN_SRCS}"
468
CUDA_ARCHS "${MARLIN_OTHER_ARCHS}")
benchmarks/kernels/benchmark_machete.py
+1
-1
@@ -231,7 +231,7 @@ def marlin_create_bench_fn(bt: BenchmarkTensors) -> Callable:
231
assert bt.w_tok_s is None
232
assert bt.group_size is not None
233
234
- fn = lambda: ops.gptq_marlin_gemm(
234
+ fn = lambda: ops.marlin_gemm(
235
a=bt.a,
236
c=None,
237
b_q_weight=w_q,
benchmarks/kernels/benchmark_marlin.py
+5
-5
@@ -239,7 +239,7 @@ def bench_run(
239
"sm_version": sm_version,
240
"CUBLAS_M_THRESHOLD": CUBLAS_M_THRESHOLD,
241
# Kernels
242
- "gptq_marlin_gemm": ops.gptq_marlin_gemm,
242
+ "marlin_gemm": ops.marlin_gemm,
243
"gptq_marlin_24_gemm": ops.gptq_marlin_24_gemm,
244
"gptq_marlin_repack": ops.gptq_marlin_repack,
245
"allspark_w8a16_gemm": ops.allspark_w8a16_gemm,
@@ -263,21 +263,21 @@ def bench_run(
263
264
results.append(
265
benchmark.Timer(
266
- stmt="output = gptq_marlin_gemm(a, None, marlin_q_w, marlin_s, None, marlin_s2, marlin_zp, marlin_g_idx, marlin_sort_indices, marlin_workspace.scratch, quant_type, size_m, size_n, size_k, is_k_full, False, False, False)", # noqa: E501
266
+ stmt="output = marlin_gemm(a, None, marlin_q_w, marlin_s, None, marlin_s2, marlin_zp, marlin_g_idx, marlin_sort_indices, marlin_workspace.scratch, quant_type, size_m, size_n, size_k, is_k_full, False, False, False)", # noqa: E501
267
globals=globals,
268
label=label,
269
sub_label=sub_label,
270
- description="gptq_marlin_gemm",
270
+ description="marlin_gemm",
271
).blocked_autorange(min_run_time=min_run_time)
272
)
273
274
results.append(
275
benchmark.Timer(
276
- stmt="output = gptq_marlin_gemm(a, None, marlin_q_w, marlin_s, None, marlin_s2, marlin_zp, marlin_g_idx, marlin_sort_indices, marlin_workspace.scratch, quant_type, size_m, size_n, size_k, is_k_full, False, True, False)", # noqa: E501
276
+ stmt="output = marlin_gemm(a, None, marlin_q_w, marlin_s, None, marlin_s2, marlin_zp, marlin_g_idx, marlin_sort_indices, marlin_workspace.scratch, quant_type, size_m, size_n, size_k, is_k_full, False, True, False)", # noqa: E501
277
globals=globals,
278
label=label,
279
sub_label=sub_label,
280
- description="gptq_marlin_gemm_fp32",
280
+ description="marlin_gemm_fp32",
281
).blocked_autorange(min_run_time=min_run_time)
282
)
283
csrc/moe/marlin_moe_wna16/kernel.h
+2
-2
@@ -3,8 +3,8 @@
3
#define MARLIN_NAMESPACE_NAME marlin_moe_wna16
4
#endif
5
6
-#include "quantization/gptq_marlin/marlin.cuh"
7
-#include "quantization/gptq_marlin/marlin_dtypes.cuh"
6
+#include "quantization/marlin/marlin.cuh"
7
+#include "quantization/marlin/marlin_dtypes.cuh"
8
#include "core/scalar_type.hpp"
9
10
#define MARLIN_KERNEL_PARAMS \
csrc/moe/marlin_moe_wna16/marlin_template.h
+4
-4
@@ -23,10 +23,10 @@
23
#define MARLIN_NAMESPACE_NAME marlin_moe_wna16
24
#endif
25
26
-#include "quantization/gptq_marlin/marlin.cuh"
27
-#include "quantization/gptq_marlin/marlin_dtypes.cuh"
28
-#include "quantization/gptq_marlin/dequant.h"
29
-#include "quantization/gptq_marlin/marlin_mma.h"
26
+#include "quantization/marlin/marlin.cuh"
27
+#include "quantization/marlin/marlin_dtypes.cuh"
28
+#include "quantization/marlin/dequant.h"
29
+#include "quantization/marlin/marlin_mma.h"
30
#include "core/scalar_type.hpp"
31
32
#define STATIC_ASSERT_SCALAR_TYPE_VALID(scalar_t) \
csrc/quantization/gptq_allspark/allspark_utils.cuh
+1
-1
@@ -7,7 +7,7 @@
7
#include <cuda_fp16.h>
8
#include <cuda_bf16.h>
9
#include <iostream>
10
-#include "../gptq_marlin/marlin_dtypes.cuh"
10
+#include "../marlin/marlin_dtypes.cuh"
11
using marlin::MarlinScalarType2;
12
13
namespace allspark {
csrc/quantization/marlin/.gitignore
renamed
csrc/quantization/marlin/awq_marlin_repack.cu
renamed
csrc/quantization/marlin/dequant.h
renamed
csrc/quantization/marlin/generate_kernels.py
renamed
csrc/quantization/marlin/gptq_marlin_repack.cu
renamed
csrc/quantization/marlin/kernel.h
renamed
csrc/quantization/marlin/marlin.cu
renamed
+3
-3
@@ -46,7 +46,7 @@ __global__ void permute_cols_kernel(int4 const* __restrict__ a_int4_ptr,
46
47
} // namespace marlin
48
49
-torch::Tensor gptq_marlin_gemm(
49
+torch::Tensor marlin_gemm(
50
torch::Tensor& a, std::optional<torch::Tensor> c_or_none,
51
torch::Tensor& b_q_weight,
52
std::optional<torch::Tensor> const& b_bias_or_none, torch::Tensor& b_scales,
@@ -528,7 +528,7 @@ void marlin_mm(const void* A, const void* B, void* C, void* C_tmp, void* b_bias,
528
529
} // namespace marlin
530
531
-torch::Tensor gptq_marlin_gemm(
531
+torch::Tensor marlin_gemm(
532
torch::Tensor& a, std::optional<torch::Tensor> c_or_none,
533
torch::Tensor& b_q_weight,
534
std::optional<torch::Tensor> const& b_bias_or_none, torch::Tensor& b_scales,
@@ -856,5 +856,5 @@ torch::Tensor gptq_marlin_gemm(
856
#endif
857
858
TORCH_LIBRARY_IMPL_EXPAND(TORCH_EXTENSION_NAME, CUDA, m) {
859
- m.impl("gptq_marlin_gemm", &gptq_marlin_gemm);
859
+ m.impl("marlin_gemm", &marlin_gemm);
860
}
csrc/quantization/marlin/marlin.cuh
renamed
csrc/quantization/marlin/marlin_dtypes.cuh
renamed
csrc/quantization/marlin/marlin_int4_fp8_preprocess.cu
renamed
csrc/quantization/marlin/marlin_mma.h
renamed
csrc/quantization/marlin/marlin_template.h
renamed
csrc/torch_bindings.cpp
+2
-2
@@ -303,9 +303,9 @@ TORCH_LIBRARY_EXPAND(TORCH_EXTENSION_NAME, ops) {
303
ops.def("permute_cols(Tensor A, Tensor perm) -> Tensor");
304
ops.impl("permute_cols", torch::kCUDA, &permute_cols);
305
306
- // gptq_marlin Optimized Quantized GEMM for GPTQ.
306
+ // Marlin Optimized Quantized GEMM (supports GPTQ, AWQ, FP8, NVFP4, MXFP4).
307
ops.def(
308
- "gptq_marlin_gemm(Tensor a, Tensor? c_or_none, Tensor b_q_weight, "
308
+ "marlin_gemm(Tensor a, Tensor? c_or_none, Tensor b_q_weight, "
309
"Tensor? b_bias_or_none,Tensor b_scales, "
310
"Tensor? a_scales, Tensor? global_scale, Tensor? b_zeros_or_none, "
311
"Tensor? "
tests/kernels/quantization/test_marlin_gemm.py
+5
-5
@@ -59,7 +59,7 @@ if current_platform.is_rocm():
59
pytest.skip(
60
"These tests require gptq_marlin_repack,"
61
"marlin_int4_fp8_preprocess, gptq_marlin_24_gemm,"
62
- "or gptq_marlin_gemm which are not supported on ROCm.",
62
+ "or marlin_gemm which are not supported on ROCm.",
63
allow_module_level=True,
64
)
65
@@ -417,7 +417,7 @@ def marlin_generate_valid_test_cases():
417
),
418
marlin_generate_valid_test_cases(),
419
)
420
-def test_gptq_marlin_gemm(
420
+def test_marlin_gemm(
421
a_type,
422
b_type,
423
c_type,
@@ -511,7 +511,7 @@ def test_gptq_marlin_gemm(
511
512
output = torch.empty((size_m, size_n), dtype=dtype, device=a_input.device)
513
514
- output = ops.gptq_marlin_gemm(
514
+ output = ops.marlin_gemm(
515
a_input,
516
output,
517
marlin_q_w,
@@ -646,7 +646,7 @@ def test_marlin_gemm_subset_input():
646
marlin_zp = marlin_make_empty_g_idx(marlin_s.device)
647
workspace = marlin_make_workspace_new(a_input.device)
648
649
- output = ops.gptq_marlin_gemm(
649
+ output = ops.marlin_gemm(
650
a_input,
651
None,
652
marlin_q_w,
@@ -695,7 +695,7 @@ def test_marlin_gemm_with_bias(size_m):
695
marlin_zp = marlin_make_empty_g_idx(marlin_s.device)
696
workspace = marlin_make_workspace_new(a_input.device)
697
698
- output = ops.gptq_marlin_gemm(
698
+ output = ops.marlin_gemm(
699
a_input,
700
None,
701
marlin_q_w,
vllm/_custom_ops.py
+4
-4
@@ -591,8 +591,8 @@ if hasattr(torch.ops._C, "gptq_marlin_24_gemm"):
591
) -> torch.Tensor:
592
return torch.empty((size_m, size_n), device=a.device, dtype=a.dtype)
593
594
- @register_fake("_C::gptq_marlin_gemm")
595
- def _gptq_marlin_gemm_fake(
594
+ @register_fake("_C::marlin_gemm")
595
+ def _marlin_gemm_fake(
596
a: torch.Tensor,
597
c: torch.Tensor | None,
598
b_q_weight: torch.Tensor,
@@ -1312,7 +1312,7 @@ def marlin_int4_fp8_preprocess(
1312
return torch.ops._C.marlin_int4_fp8_preprocess(qweight, qzeros_or_none, inplace)
1313
1314
1315
-def gptq_marlin_gemm(
1315
+def marlin_gemm(
1316
a: torch.Tensor,
1317
c: torch.Tensor | None,
1318
b_q_weight: torch.Tensor,
@@ -1333,7 +1333,7 @@ def gptq_marlin_gemm(
1333
use_fp32_reduce: bool = False,
1334
is_zp_float: bool = False,
1335
) -> torch.Tensor:
1336
- return torch.ops._C.gptq_marlin_gemm(
1336
+ return torch.ops._C.marlin_gemm(
1337
a,
1338
c,
1339
b_q_weight,
vllm/model_executor/layers/quantization/utils/marlin_utils.py
+2
-2
@@ -563,7 +563,7 @@ def apply_gptq_marlin_linear(
563
564
reshaped_x, a_scales = marlin_quant_input(reshaped_x, input_dtype)
565
566
- output = ops.gptq_marlin_gemm(
566
+ output = ops.marlin_gemm(
567
reshaped_x,
568
None,
569
weight,
@@ -628,7 +628,7 @@ def apply_awq_marlin_linear(
628
)
629
reshaped_x, a_scales = marlin_quant_input(reshaped_x, input_dtype)
630
631
- output = ops.gptq_marlin_gemm(
631
+ output = ops.marlin_gemm(
632
reshaped_x,
633
None,
634
weight,
vllm/model_executor/layers/quantization/utils/marlin_utils_fp4.py
+1
-1
@@ -121,7 +121,7 @@ def apply_fp4_marlin_linear(
121
122
inputs, a_scales = marlin_quant_input(inputs, torch.float8_e4m3fn)
123
124
- output = ops.gptq_marlin_gemm(
124
+ output = ops.marlin_gemm(
125
a=inputs,
126
c=None,
127
b_q_weight=weight,
vllm/model_executor/layers/quantization/utils/marlin_utils_fp8.py
+1
-1
@@ -66,7 +66,7 @@ def apply_fp8_marlin_linear(
66
# inputs, a_scales = marlin_quant_input(inputs, torch.float8_e4m3fn)
67
raise RuntimeError("Marlin W8A8 is not supported.")
68
69
- output = ops.gptq_marlin_gemm(
69
+ output = ops.marlin_gemm(
70
a=inputs,
71
c=None,
72
b_q_weight=weight,