Commit 9e0773f6 authored by Catheriany's avatar Catheriany
Browse files

issue/312: 沐曦BF16编译问题

parent a19efb54
...@@ -60,4 +60,9 @@ __forceinline__ __device__ __half ...@@ -60,4 +60,9 @@ __forceinline__ __device__ __half
exp_(const __half x) { exp_(const __half x) {
return hexp(x); return hexp(x);
} }
__forceinline__ __device__ __hpcc_bfloat16;
exp_(const __hpcc_bfloat16; x) {
return hexp(x);
}
#endif #endif
...@@ -107,6 +107,11 @@ struct CudaTval<fp16_t> { ...@@ -107,6 +107,11 @@ struct CudaTval<fp16_t> {
using Type = half; using Type = half;
}; };
template <>
struct CudaTval<bf16_t> {
using Type = __hpcc_bfloat16;
};
// ↑↑↑ 通过特化将 fp16_t 转换为 half // ↑↑↑ 通过特化将 fp16_t 转换为 half
// ↓↓↓ 用于采样过程的小型 kernel // ↓↓↓ 用于采样过程的小型 kernel
......
...@@ -34,15 +34,16 @@ infiniStatus_t Descriptor::create( ...@@ -34,15 +34,16 @@ infiniStatus_t Descriptor::create(
workspace_size = workspace_result.take(); \ workspace_size = workspace_result.take(); \
} break } break
#define CASE_I(CASE, Tidx) \ #define CASE_I(CASE, Tidx) \
case CASE: \ case CASE: \
switch (info.dt_p) { \ switch (info.dt_p) { \
CASE_P(INFINI_DTYPE_F16, Tidx, half); \ CASE_P(INFINI_DTYPE_F16, Tidx, half); \
CASE_P(INFINI_DTYPE_F32, Tidx, float); \ CASE_P(INFINI_DTYPE_BF16, Tidx, __hpcc_bfloat16); \
CASE_P(INFINI_DTYPE_F64, Tidx, double); \ CASE_P(INFINI_DTYPE_F32, Tidx, float); \
default: \ CASE_P(INFINI_DTYPE_F64, Tidx, double); \
abort(); \ default: \
} \ abort(); \
} \
break break
switch (info.dt_i) { switch (info.dt_i) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment