From 4d93bc35c9f4a1b470ced63392f640feddf7789b Mon Sep 17 00:00:00 2001 From: Chris Leonard Date: Tue, 2 Jun 2026 11:09:52 -0400 Subject: [PATCH] Migrate header files to torch stable abi (#44013) --- .pre-commit-config.yaml | 2 +- csrc/{ => libtorch_stable}/async_util.cuh | 0 .../epilogue/broadcast_load_epilogue_c2x.hpp | 0 .../epilogue/scaled_mm_epilogues_c2x.hpp | 2 +- csrc/libtorch_stable/fused_qknorm_rope_kernel.cu | 2 +- csrc/{ => libtorch_stable}/launch_bounds_utils.h | 0 csrc/{ => libtorch_stable}/persistent_topk.cuh | 0 .../fp4/activation_nvfp4_quant_fusion_kernels.cu | 2 +- .../quantization/fp4/mxfp4_experts_quant.cu | 2 +- .../quantization/fp4/nvfp4_experts_quant.cu | 2 +- .../quantization/fp4/nvfp4_quant_kernels.cu | 2 +- .../quantization/gguf/dequantize.cuh | 0 .../quantization/gguf/ggml-common.h | 0 .../quantization/gguf/gguf_kernel.cu | 13 +++++-------- .../{ => libtorch_stable}/quantization/gguf/mmq.cuh | 0 .../quantization/gguf/mmvq.cuh | 0 .../quantization/gguf/vecdotq.cuh | 0 csrc/libtorch_stable/topk.cu | 2 +- 18 files changed, 13 insertions(+), 16 deletions(-) rename csrc/{ => libtorch_stable}/async_util.cuh (100%) rename csrc/{ => libtorch_stable}/cutlass_extensions/epilogue/broadcast_load_epilogue_c2x.hpp (100%) rename csrc/{ => libtorch_stable}/launch_bounds_utils.h (100%) rename csrc/{ => libtorch_stable}/persistent_topk.cuh (100%) rename csrc/{ => libtorch_stable}/quantization/gguf/dequantize.cuh (100%) rename csrc/{ => libtorch_stable}/quantization/gguf/ggml-common.h (100%) rename csrc/{ => libtorch_stable}/quantization/gguf/mmq.cuh (100%) rename csrc/{ => libtorch_stable}/quantization/gguf/mmvq.cuh (100%) rename csrc/{ => libtorch_stable}/quantization/gguf/vecdotq.cuh (100%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 05625e8f66..c11a80683f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,7 +21,7 @@ repos: rev: v21.1.2 hooks: - id: clang-format - exclude: 'csrc/(moe/topk_softmax_kernels.cu|quantization/gguf/(ggml-common.h|dequantize.cuh|vecdotq.cuh|mmq.cuh|mmvq.cuh))|vllm/third_party/.*' + exclude: 'csrc/(moe/topk_softmax_kernels.cu|libtorch_stable/quantization/gguf/(ggml-common.h|dequantize.cuh|vecdotq.cuh|mmq.cuh|mmvq.cuh))|vllm/third_party/.*' types_or: [c++, cuda] args: [--style=file, --verbose] - repo: https://github.com/DavidAnson/markdownlint-cli2 diff --git a/csrc/async_util.cuh b/csrc/libtorch_stable/async_util.cuh similarity index 100% rename from csrc/async_util.cuh rename to csrc/libtorch_stable/async_util.cuh diff --git a/csrc/cutlass_extensions/epilogue/broadcast_load_epilogue_c2x.hpp b/csrc/libtorch_stable/cutlass_extensions/epilogue/broadcast_load_epilogue_c2x.hpp similarity index 100% rename from csrc/cutlass_extensions/epilogue/broadcast_load_epilogue_c2x.hpp rename to csrc/libtorch_stable/cutlass_extensions/epilogue/broadcast_load_epilogue_c2x.hpp diff --git a/csrc/libtorch_stable/cutlass_extensions/epilogue/scaled_mm_epilogues_c2x.hpp b/csrc/libtorch_stable/cutlass_extensions/epilogue/scaled_mm_epilogues_c2x.hpp index f6737a73d4..6091cbc5e9 100644 --- a/csrc/libtorch_stable/cutlass_extensions/epilogue/scaled_mm_epilogues_c2x.hpp +++ b/csrc/libtorch_stable/cutlass_extensions/epilogue/scaled_mm_epilogues_c2x.hpp @@ -2,7 +2,7 @@ #include -#include "cutlass_extensions/epilogue/broadcast_load_epilogue_c2x.hpp" +#include "broadcast_load_epilogue_c2x.hpp" /* This file defines custom epilogues for fusing channel scales, token scales, diff --git a/csrc/libtorch_stable/fused_qknorm_rope_kernel.cu b/csrc/libtorch_stable/fused_qknorm_rope_kernel.cu index bcf0ae5854..c9b7ee9e4e 100644 --- a/csrc/libtorch_stable/fused_qknorm_rope_kernel.cu +++ b/csrc/libtorch_stable/fused_qknorm_rope_kernel.cu @@ -20,7 +20,7 @@ #include "torch_utils.h" -#include "../async_util.cuh" +#include "async_util.cuh" #include "../cuda_compat.h" #include "../type_convert.cuh" #include "dispatch_utils.h" diff --git a/csrc/launch_bounds_utils.h b/csrc/libtorch_stable/launch_bounds_utils.h similarity index 100% rename from csrc/launch_bounds_utils.h rename to csrc/libtorch_stable/launch_bounds_utils.h diff --git a/csrc/persistent_topk.cuh b/csrc/libtorch_stable/persistent_topk.cuh similarity index 100% rename from csrc/persistent_topk.cuh rename to csrc/libtorch_stable/persistent_topk.cuh diff --git a/csrc/libtorch_stable/quantization/fp4/activation_nvfp4_quant_fusion_kernels.cu b/csrc/libtorch_stable/quantization/fp4/activation_nvfp4_quant_fusion_kernels.cu index d0cafa0c6d..6238a27191 100644 --- a/csrc/libtorch_stable/quantization/fp4/activation_nvfp4_quant_fusion_kernels.cu +++ b/csrc/libtorch_stable/quantization/fp4/activation_nvfp4_quant_fusion_kernels.cu @@ -25,7 +25,7 @@ #include #include "cuda_utils.h" -#include "launch_bounds_utils.h" +#include "libtorch_stable/launch_bounds_utils.h" // Define before including nvfp4_utils.cuh so the header // can use this macro during compilation. diff --git a/csrc/libtorch_stable/quantization/fp4/mxfp4_experts_quant.cu b/csrc/libtorch_stable/quantization/fp4/mxfp4_experts_quant.cu index ae4f4829d9..062f601865 100644 --- a/csrc/libtorch_stable/quantization/fp4/mxfp4_experts_quant.cu +++ b/csrc/libtorch_stable/quantization/fp4/mxfp4_experts_quant.cu @@ -34,7 +34,7 @@ static_assert(CVT_FP4_ELTS_PER_THREAD == 16, "MXFP4 experts quant requires PACK16 mode (CUDA >= 12.9)"); -#include "launch_bounds_utils.h" +#include "libtorch_stable/launch_bounds_utils.h" namespace vllm { diff --git a/csrc/libtorch_stable/quantization/fp4/nvfp4_experts_quant.cu b/csrc/libtorch_stable/quantization/fp4/nvfp4_experts_quant.cu index 8f2b4405cf..92b139b7e4 100644 --- a/csrc/libtorch_stable/quantization/fp4/nvfp4_experts_quant.cu +++ b/csrc/libtorch_stable/quantization/fp4/nvfp4_experts_quant.cu @@ -26,7 +26,7 @@ #include "cuda_utils.h" #include "nvfp4_utils.cuh" -#include "launch_bounds_utils.h" +#include "libtorch_stable/launch_bounds_utils.h" namespace vllm { diff --git a/csrc/libtorch_stable/quantization/fp4/nvfp4_quant_kernels.cu b/csrc/libtorch_stable/quantization/fp4/nvfp4_quant_kernels.cu index ccefe29402..f7c965dbc1 100644 --- a/csrc/libtorch_stable/quantization/fp4/nvfp4_quant_kernels.cu +++ b/csrc/libtorch_stable/quantization/fp4/nvfp4_quant_kernels.cu @@ -26,7 +26,7 @@ #include "../../cuda_vec_utils.cuh" #include "cuda_utils.h" -#include "launch_bounds_utils.h" +#include "libtorch_stable/launch_bounds_utils.h" // Define before including nvfp4_utils.cuh so the header // can use this macro during compilation. diff --git a/csrc/quantization/gguf/dequantize.cuh b/csrc/libtorch_stable/quantization/gguf/dequantize.cuh similarity index 100% rename from csrc/quantization/gguf/dequantize.cuh rename to csrc/libtorch_stable/quantization/gguf/dequantize.cuh diff --git a/csrc/quantization/gguf/ggml-common.h b/csrc/libtorch_stable/quantization/gguf/ggml-common.h similarity index 100% rename from csrc/quantization/gguf/ggml-common.h rename to csrc/libtorch_stable/quantization/gguf/ggml-common.h diff --git a/csrc/libtorch_stable/quantization/gguf/gguf_kernel.cu b/csrc/libtorch_stable/quantization/gguf/gguf_kernel.cu index 0fdfcafab8..2a56d7a18f 100644 --- a/csrc/libtorch_stable/quantization/gguf/gguf_kernel.cu +++ b/csrc/libtorch_stable/quantization/gguf/gguf_kernel.cu @@ -7,14 +7,11 @@ #include -// NOTE: These headers are intentionally kept in csrc/quantization/gguf/ (not -// moved to libtorch_stable) to avoid unnecessary reformatting that would break -// git rename detection and pollute blame history. -#include "../../../quantization/gguf/ggml-common.h" -#include "../../../quantization/gguf/vecdotq.cuh" -#include "../../../quantization/gguf/dequantize.cuh" -#include "../../../quantization/gguf/mmvq.cuh" -#include "../../../quantization/gguf/mmq.cuh" +#include "ggml-common.h" +#include "vecdotq.cuh" +#include "dequantize.cuh" +#include "mmvq.cuh" +#include "mmq.cuh" #include "moe.cuh" #include "moe_vec.cuh" diff --git a/csrc/quantization/gguf/mmq.cuh b/csrc/libtorch_stable/quantization/gguf/mmq.cuh similarity index 100% rename from csrc/quantization/gguf/mmq.cuh rename to csrc/libtorch_stable/quantization/gguf/mmq.cuh diff --git a/csrc/quantization/gguf/mmvq.cuh b/csrc/libtorch_stable/quantization/gguf/mmvq.cuh similarity index 100% rename from csrc/quantization/gguf/mmvq.cuh rename to csrc/libtorch_stable/quantization/gguf/mmvq.cuh diff --git a/csrc/quantization/gguf/vecdotq.cuh b/csrc/libtorch_stable/quantization/gguf/vecdotq.cuh similarity index 100% rename from csrc/quantization/gguf/vecdotq.cuh rename to csrc/libtorch_stable/quantization/gguf/vecdotq.cuh diff --git a/csrc/libtorch_stable/topk.cu b/csrc/libtorch_stable/topk.cu index 15af18118f..7656ba8cf8 100644 --- a/csrc/libtorch_stable/topk.cu +++ b/csrc/libtorch_stable/topk.cu @@ -7,7 +7,7 @@ #include "torch_utils.h" #ifndef USE_ROCM - #include "../persistent_topk.cuh" + #include "persistent_topk.cuh" #endif namespace {