fix: add ceil_div + DEVICE_INLINE to device_utils.cuh

ceil_div<T> was in xllm utils.h (removed for glog).
DEVICE_INLINE macro also moved to shared header.
This commit is contained in:
claude
2026-08-14 11:11:15 +00:00
parent 302aa9608a
commit 3d816cd18d
2 changed files with 14 additions and 4 deletions

View File

@@ -25,10 +25,6 @@ limitations under the License.
#include "device_utils.cuh"
#ifndef DEVICE_INLINE
#define DEVICE_INLINE __device__ __forceinline__
#define HOST_DEVICE_INLINE __host__ __device__ __forceinline__
#endif
namespace xllm::kernel::cuda {

View File

@@ -115,6 +115,20 @@ struct TopkConstants {
} // namespace xllm::kernel::cuda
// ============================================================================
// Portable macros and utilities (from xllm/core/kernels/cuda/utils.h)
// ============================================================================
#ifndef DEVICE_INLINE
#define DEVICE_INLINE __device__ __forceinline__
#define HOST_DEVICE_INLINE __host__ __device__ __forceinline__
#endif
template <typename T>
HOST_DEVICE_INLINE constexpr std::enable_if_t<std::is_integral_v<T>, T>
ceil_div(T a, T b) {
return (a + b - 1) / b;
}
// ============================================================================
// Dispatch macros (from xllm/core/kernels/cuda/utils.h)
// These wrap AT_DISPATCH_SWITCH for float16/bfloat16/float32 dispatch.