| | #include <torch/library.h> |
| |
|
| | #include "core/registration.h" |
| | #include "torch_binding.h" |
| |
|
| | TORCH_LIBRARY_EXPAND(TORCH_EXTENSION_NAME, ops) { |
| | |
| | |
| | ops.def( |
| | "cutlass_scaled_mm(Tensor! out, Tensor a," |
| | " Tensor b, Tensor a_scales," |
| | " Tensor b_scales, Tensor? bias) -> ()"); |
| | ops.impl("cutlass_scaled_mm", torch::kCUDA, &cutlass_scaled_mm); |
| | |
| | |
| | |
| | ops.def( |
| | "cutlass_scaled_mm_azp(Tensor! out, Tensor a," |
| | " Tensor b, Tensor a_scales," |
| | " Tensor b_scales, Tensor azp_adj," |
| | " Tensor? azp, Tensor? bias) -> ()"); |
| | ops.impl("cutlass_scaled_mm_azp", torch::kCUDA, &cutlass_scaled_mm_azp); |
| | |
| | |
| | |
| | ops.def("cutlass_scaled_mm_supports_fp8(int cuda_device_capability) -> bool"); |
| | ops.impl("cutlass_scaled_mm_supports_fp8", &cutlass_scaled_mm_supports_fp8); |
| |
|
| | |
| | ops.def( |
| | "static_scaled_fp8_quant(Tensor! result, Tensor input, Tensor scale) -> " |
| | "()"); |
| | ops.impl("static_scaled_fp8_quant", torch::kCUDA, &static_scaled_fp8_quant); |
| |
|
| | |
| | ops.def( |
| | "dynamic_scaled_fp8_quant(Tensor! result, Tensor input, Tensor! scale) " |
| | "-> " |
| | "()"); |
| | ops.impl("dynamic_scaled_fp8_quant", torch::kCUDA, &dynamic_scaled_fp8_quant); |
| |
|
| | |
| | ops.def( |
| | "dynamic_per_token_scaled_fp8_quant(Tensor! result, Tensor input, " |
| | "Tensor! scale, Tensor? scale_ub) -> " |
| | "()"); |
| | ops.impl("dynamic_per_token_scaled_fp8_quant", torch::kCUDA, |
| | &dynamic_per_token_scaled_fp8_quant); |
| |
|
| | |
| | ops.def( |
| | "static_scaled_int8_quant(Tensor! result, Tensor input, Tensor scale," |
| | "Tensor? azp) -> ()"); |
| | ops.impl("static_scaled_int8_quant", torch::kCUDA, &static_scaled_int8_quant); |
| |
|
| | |
| | ops.def( |
| | "dynamic_scaled_int8_quant(Tensor! result, Tensor input, Tensor! scale, " |
| | "Tensor!? azp) -> ()"); |
| | ops.impl("dynamic_scaled_int8_quant", torch::kCUDA, |
| | &dynamic_scaled_int8_quant); |
| |
|
| | |
| | ops.def( |
| | "fp8_marlin_gemm(Tensor a, Tensor b_q_weight, Tensor b_scales, " |
| | "Tensor! workspace, int num_bits, SymInt size_m, SymInt size_n, " |
| | "SymInt size_k) -> Tensor"); |
| |
|
| | |
| | ops.def( |
| | "awq_marlin_repack(Tensor b_q_weight, SymInt size_k, " |
| | "SymInt size_n, int num_bits) -> Tensor"); |
| |
|
| | |
| | ops.def( |
| | "gptq_marlin_gemm(Tensor a, Tensor b_q_weight, Tensor b_scales, " |
| | "Tensor b_zeros, Tensor g_idx, Tensor perm, Tensor workspace, " |
| | "int b_q_type, " |
| | "SymInt size_m, SymInt size_n, SymInt size_k, bool is_k_full, " |
| | "bool has_zp, bool use_fp32_reduce, bool is_zp_float) -> Tensor"); |
| |
|
| | |
| | ops.def( |
| | "gptq_marlin_repack(Tensor b_q_weight, Tensor perm, " |
| | "SymInt size_k, SymInt size_n, int num_bits) -> Tensor"); |
| |
|
| | |
| | ops.def( |
| | "marlin_gemm(Tensor a, Tensor b_q_weight, Tensor b_scales, " |
| | "Tensor! workspace, SymInt size_m, SymInt size_n, SymInt size_k) -> " |
| | "Tensor"); |
| |
|
| | |
| | ops.def( |
| | "gptq_marlin_24_gemm(Tensor a, Tensor b_q_weight, Tensor b_meta, " |
| | "Tensor b_scales, Tensor workspace, " |
| | "int b_q_type, " |
| | "SymInt size_m, SymInt size_n, SymInt size_k) -> Tensor"); |
| |
|
| | |
| | ops.def( |
| | "marlin_qqq_gemm(Tensor a, Tensor b_q_weight, " |
| | "Tensor s_tok, Tensor s_ch, Tensor s_group, " |
| | "Tensor! workspace, SymInt size_m, SymInt size_n, " |
| | "SymInt size_k) -> Tensor"); |
| | } |
| |
|
| | TORCH_LIBRARY_IMPL_EXPAND(TORCH_EXTENSION_NAME, CUDA, ops) { |
| | ops.impl("awq_marlin_repack", &awq_marlin_repack); |
| | ops.impl("fp8_marlin_gemm", &fp8_marlin_gemm); |
| | ops.impl("gptq_marlin_24_gemm", &gptq_marlin_24_gemm); |
| | ops.impl("gptq_marlin_gemm", &gptq_marlin_gemm); |
| | ops.impl("gptq_marlin_repack", &gptq_marlin_repack); |
| | ops.impl("marlin_gemm", &marlin_gemm); |
| | ops.impl("marlin_qqq_gemm", &marlin_qqq_gemm); |
| | } |
| |
|
| | TORCH_LIBRARY_IMPL_EXPAND(TORCH_EXTENSION_NAME, Meta, ops) { |
| | ops.impl("awq_marlin_repack", &awq_marlin_repack_meta); |
| | ops.impl("gptq_marlin_repack", &gptq_marlin_repack_meta); |
| | } |
| |
|
| | REGISTER_EXTENSION(TORCH_EXTENSION_NAME) |
| |
|