diff --git a/python/sglang/jit_kernel/csrc/elementwise/activation.cuh b/python/sglang/jit_kernel/csrc/elementwise/activation.cuh index 19ac69f0f..f6626ee1e 100644 --- a/python/sglang/jit_kernel/csrc/elementwise/activation.cuh +++ b/python/sglang/jit_kernel/csrc/elementwise/activation.cuh @@ -86,21 +86,22 @@ struct ActivationKernel { static constexpr auto kVecSize = device::kMaxVecBytes / sizeof(T); static constexpr auto kBlockSize = 256u; + using kernel_fn_t = decltype(&act_and_mul_kernel); + template - static constexpr auto activation_kernel = act_and_mul_kernel; + static constexpr kernel_fn_t activation_kernel = act_and_mul_kernel; static_assert(device::kMaxVecBytes % sizeof(T) == 0, "unsupported data type"); template - static auto select_kernel(const std::string& type) - -> decltype(ActivationKernel::template activation_kernel) { + static kernel_fn_t select_kernel(const std::string& type) { using namespace host; if (type == "silu") { - return ActivationKernel::template activation_kernel; + return activation_kernel; } else if (type == "gelu") { - return ActivationKernel::template activation_kernel; + return activation_kernel; } else if (type == "gelu_tanh") { - return ActivationKernel::template activation_kernel; + return activation_kernel; } else { Panic("unsupported activation type: ", type); } @@ -130,7 +131,7 @@ struct ActivationKernel { .with_device(device_) .verify(input); - const auto hidden_size = D_out.unwrap(); + const auto hidden_size = static_cast(D_out.unwrap()); const auto num_tokens = static_cast(N.unwrap()); const auto device = device_.unwrap(); if (num_tokens == 0) return;