[jit_kernel] Migrate cast (downcast_fp8) from sgl-kernel AOT to JIT (#19103)

This commit is contained in:
Johnsonms
2026-03-27 13:21:44 +08:00
committed by GitHub
parent c531be455e
commit 8a56a7b04d
6 changed files with 638 additions and 3 deletions
+5 -3
View File
@@ -1,4 +1,6 @@
#include "pytorch_extension_utils.h"
#include <ATen/cuda/CUDAContext.h>
#include "utils.h"
template <typename T>
struct ConvertToFP8 {
@@ -118,8 +120,8 @@ void downcast_fp8_impl(
int vec_size = 8;
dim3 block(std::min(int(dim) / vec_size, 1024));
const T max_fp8 = static_cast<T>(448.0f);
const T min_fp8 = static_cast<T>(-448.0f);
const T max_fp8 = static_cast<T>(FP8_E4M3_MAX);
const T min_fp8 = static_cast<T>(-FP8_E4M3_MAX);
fused_downcast_kernel<T><<<grid, block, 0, stream>>>(
static_cast<const T*>(k.data_ptr()),