Skip to content

Commit 5ef588b

Browse files
committed
test
1 parent 6232cee commit 5ef588b

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

ggml/src/ggml-cuda/convert.cu

+4
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,11 @@ static __global__ void convert_unary(const void * __restrict__ vx, dst_t * __res
580580
const src_t * x = (const src_t *) vx;
581581

582582
if constexpr (std::is_same_v<src_t, nv_bfloat16>) {
583+
#if defined(GGML_USE_HIP) && defined(__HIP_PLATFORM_AMD__)
584+
y[i] = (float)x[i];
585+
#else
583586
y[i] = __bfloat162float(x[i]);
587+
#endif
584588
} else if constexpr (std::is_same_v<dst_t, nv_bfloat16> && std::is_same_v<src_t, half>) {
585589
y[i] = (float)x[i];
586590
} else {

ggml/src/ggml-cuda/vendors/hip.h

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#define CUBLAS_STATUS_SUCCESS HIPBLAS_STATUS_SUCCESS
2121
#define CUBLAS_TF32_TENSOR_OP_MATH 0
2222
#define CUDA_R_16F HIPBLAS_R_16F
23+
#define CUDA_R_16BF HIPBLAS_R_16BF
2324
#define CUDA_R_32F HIPBLAS_R_32F
2425
#define CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED hipDeviceAttributeVirtualMemoryManagementSupported
2526
#define CU_MEM_ALLOC_GRANULARITY_RECOMMENDED hipMemAllocationGranularityRecommended

ggml/src/ggml-cuda/vendors/musa.h

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#define CUBLAS_STATUS_SUCCESS MUBLAS_STATUS_SUCCESS
1616
#define CUBLAS_TF32_TENSOR_OP_MATH MUBLAS_MATH_MODE_DEFAULT
1717
#define CUDA_R_16F MUSA_R_16F
18+
#define CUDA_R_16BF MUSA_R_16BF
1819
#define CUDA_R_32F MUSA_R_32F
1920
#define cublasComputeType_t cudaDataType_t
2021
#define cublasCreate mublasCreate

0 commit comments

Comments
 (0)