ggml
[Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685)
Brought by drakestapleton
ggml / src / ggml-cuda / vendors / musa.h
| 1 | #pragma once |
| 2 | |
| 3 | #include <musa_runtime.h> |
| 4 | #include <musa.h> |
| 5 | #include <mublas.h> |
| 6 | #include <musa_bf16.h> |
| 7 | #include <musa_fp16.h> |
| 8 | |
| 9 | #ifdef __MUSA_ARCH__ |
| 10 | #define __CUDA_ARCH__ 1300 // GGML_CUDA_CC_RUBIN |
| 11 | #endif // __MUSA_ARCH__ |
| 12 | |
| 13 | #define CUBLAS_COMPUTE_16F CUDA_R_16F |
| 14 | #define CUBLAS_COMPUTE_32F CUDA_R_32F |
| 15 | #define CUBLAS_COMPUTE_32F_FAST_16F MUBLAS_COMPUTE_32F_FAST_16F |
| 16 | #define CUBLAS_GEMM_DEFAULT MUBLAS_GEMM_DEFAULT |
| 17 | #define CUBLAS_GEMM_DEFAULT_TENSOR_OP MUBLAS_GEMM_DEFAULT |
| 18 | #define CUBLAS_OP_N MUBLAS_OP_N |
| 19 | #define CUBLAS_OP_T MUBLAS_OP_T |
| 20 | #define CUBLAS_DEFAULT_MATH MUBLAS_DEFAULT_MATH |
| 21 | #define CUBLAS_SIDE_RIGHT MUBLAS_SIDE_RIGHT |
| 22 | #define CUBLAS_FILL_MODE_UPPER MUBLAS_FILL_MODE_UPPER |
| 23 | #define CUBLAS_DIAG_NON_UNIT MUBLAS_DIAG_NON_UNIT |
| 24 | #define CUBLAS_STATUS_SUCCESS MUBLAS_STATUS_SUCCESS |
| 25 | #define CUBLAS_TF32_TENSOR_OP_MATH MUBLAS_TENSOR_OP_MATH |
| 26 | #define CUDA_R_16F MUSA_R_16F |
| 27 | #define CUDA_R_16BF MUSA_R_16BF |
| 28 | #define CUDA_R_32F MUSA_R_32F |
| 29 | #define cublasStrsmBatched mublasStrsmBatched |
| 30 | #define cublasComputeType_t cudaDataType_t |
| 31 | #define cublasCreate mublasCreate |
| 32 | #define cublasDestroy mublasDestroy |
| 33 | #define cublasGemmEx mublasGemmEx |
| 34 | #define cublasGemmBatchedEx mublasGemmBatchedEx |
| 35 | #define cublasGemmStridedBatchedEx mublasGemmStridedBatchedEx |
| 36 | #define cublasHandle_t mublasHandle_t |
| 37 | #define cublasSetMathMode mublasSetMathMode |
| 38 | #define cublasSetStream mublasSetStream |
| 39 | #define cublasSgemm mublasSgemm |
| 40 | #define cublasSgemmBatched mublasSgemmBatched |
| 41 | #define cublasSgemmStridedBatched mublasSgemmStridedBatched |
| 42 | #define cublasStatus_t mublasStatus_t |
| 43 | #define cublasOperation_t mublasOperation_t |
| 44 | #define cublasGetStatusString mublasGetStatusString |
| 45 | #define cudaDataType_t musaDataType_t |
| 46 | #define cudaDeviceCanAccessPeer musaDeviceCanAccessPeer |
| 47 | #define cudaDeviceDisablePeerAccess musaDeviceDisablePeerAccess |
| 48 | #define cudaDeviceEnablePeerAccess musaDeviceEnablePeerAccess |
| 49 | #define cudaDeviceGetPCIBusId musaDeviceGetPCIBusId |
| 50 | #define cudaDeviceProp musaDeviceProp |
| 51 | #define cudaDeviceSynchronize musaDeviceSynchronize |
| 52 | #define cudaDeviceGetAttribute musaDeviceGetAttribute |
| 53 | #define cudaError_t musaError_t |
| 54 | #define cudaErrorMemoryAllocation musaErrorMemoryAllocation |
| 55 | #define cudaErrorPeerAccessAlreadyEnabled musaErrorPeerAccessAlreadyEnabled |
| 56 | #define cudaErrorPeerAccessNotEnabled musaErrorPeerAccessNotEnabled |
| 57 | #define cudaEventCreateWithFlags musaEventCreateWithFlags |
| 58 | #define cudaEventDisableTiming musaEventDisableTiming |
| 59 | #define cudaEventRecord musaEventRecord |
| 60 | #define cudaEventSynchronize musaEventSynchronize |
| 61 | #define cudaEvent_t musaEvent_t |
| 62 | #define cudaEventDestroy musaEventDestroy |
| 63 | #define cudaFree musaFree |
| 64 | #define cudaFreeHost musaFreeHost |
| 65 | #define cudaGetDevice musaGetDevice |
| 66 | #define cudaGetDeviceCount musaGetDeviceCount |
| 67 | #define cudaGetDeviceProperties musaGetDeviceProperties |
| 68 | #define cudaGetErrorString musaGetErrorString |
| 69 | #define cudaGetLastError musaGetLastError |
| 70 | #define cudaHostRegister musaHostRegister |
| 71 | #define cudaHostRegisterPortable musaHostRegisterPortable |
| 72 | #define cudaHostRegisterReadOnly musaHostRegisterReadOnly |
| 73 | #define cudaHostUnregister musaHostUnregister |
| 74 | #define cudaLaunchCooperativeKernel musaLaunchCooperativeKernel |
| 75 | #define cudaLaunchHostFunc musaLaunchHostFunc |
| 76 | #define cudaMalloc musaMalloc |
| 77 | #define cudaMallocHost musaMallocHost |
| 78 | #define cudaMallocManaged musaMallocManaged |
| 79 | #define cudaMemcpy musaMemcpy |
| 80 | #define cudaMemcpyAsync musaMemcpyAsync |
| 81 | #define cudaMemcpyPeerAsync musaMemcpyPeerAsync |
| 82 | #define cudaMemcpy2DAsync musaMemcpy2DAsync |
| 83 | #define cudaMemcpyDeviceToDevice musaMemcpyDeviceToDevice |
| 84 | #define cudaMemcpyDeviceToHost musaMemcpyDeviceToHost |
| 85 | #define cudaMemcpyHostToDevice musaMemcpyHostToDevice |
| 86 | #define cudaMemcpyKind musaMemcpyKind |
| 87 | #define cudaMemset musaMemset |
| 88 | #define cudaMemsetAsync musaMemsetAsync |
| 89 | #define cudaMemGetInfo musaMemGetInfo |
| 90 | #define cudaOccupancyMaxPotentialBlockSize musaOccupancyMaxPotentialBlockSize |
| 91 | #define cudaSetDevice musaSetDevice |
| 92 | #define cudaStreamCreateWithFlags musaStreamCreateWithFlags |
| 93 | #define cudaStreamDestroy musaStreamDestroy |
| 94 | #define cudaStreamFireAndForget musaStreamFireAndForget |
| 95 | #define cudaStreamNonBlocking musaStreamNonBlocking |
| 96 | #define cudaStreamPerThread musaStreamPerThread |
| 97 | #define cudaStreamSynchronize musaStreamSynchronize |
| 98 | #define cudaStreamWaitEvent musaStreamWaitEvent |
| 99 | #define cudaStream_t musaStream_t |
| 100 | #define cudaSuccess musaSuccess |
| 101 | |
| 102 | // Additional mappings for MUSA virtual memory pool |
| 103 | #define CU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTED MU_DEVICE_ATTRIBUTE_VIRTUAL_ADDRESS_MANAGEMENT_SUPPORTED |
| 104 | #define CU_MEM_ACCESS_FLAGS_PROT_READWRITE MU_MEM_ACCESS_FLAGS_PROT_READWRITE |
| 105 | #define CU_MEM_ALLOC_GRANULARITY_RECOMMENDED MU_MEM_ALLOC_GRANULARITY_RECOMMENDED |
| 106 | #define CU_MEM_ALLOCATION_TYPE_PINNED MU_MEM_ALLOCATION_TYPE_PINNED |
| 107 | #define CU_MEM_LOCATION_TYPE_DEVICE MU_MEM_LOCATION_TYPE_DEVICE |
| 108 | #define CUdevice MUdevice |
| 109 | #define CUdeviceptr MUdeviceptr |
| 110 | #define CUmemAccessDesc MUmemAccessDesc |
| 111 | #define CUmemAllocationProp MUmemAllocationProp |
| 112 | #define CUmemGenericAllocationHandle MUmemGenericAllocationHandle |
| 113 | #define cuDeviceGet muDeviceGet |
| 114 | #define cuDeviceGetAttribute muDeviceGetAttribute |
| 115 | #define cuMemAddressFree muMemAddressFree |
| 116 | #define cuMemAddressReserve muMemAddressReserve |
| 117 | #define cuMemCreate muMemCreate |
| 118 | #define cuMemGetAllocationGranularity muMemGetAllocationGranularity |
| 119 | #define cuMemMap muMemMap |
| 120 | #define cuMemRelease muMemRelease |
| 121 | #define cuMemSetAccess muMemSetAccess |
| 122 | #define cuMemUnmap muMemUnmap |
| 123 | #define cudaDevAttrCooperativeLaunch musaDevAttrCooperativeLaunch |
| 124 | #define cudaFuncAttributeMaxDynamicSharedMemorySize musaFuncAttributeMaxDynamicSharedMemorySize |
| 125 | #define cudaFuncSetAttribute musaFuncSetAttribute |
| 126 | #define cudaMemcpy3DPeerParms musaMemcpy3DPeerParms |
| 127 | #define make_cudaExtent make_musaExtent |
| 128 | #define make_cudaPitchedPtr make_musaPitchedPtr |
| 129 | |
| 130 | // Additional mappings for MUSA graphs |
| 131 | #define CUDA_SUCCESS MUSA_SUCCESS |
| 132 | #define CUresult MUresult |
| 133 | #define cuGetErrorString muGetErrorString |
| 134 | #define cudaErrorGraphExecUpdateFailure musaErrorGraphExecUpdateFailure |
| 135 | #define cudaErrorInvalidDeviceFunction musaErrorInvalidDeviceFunction |
| 136 | #define cudaGraphDestroy musaGraphDestroy |
| 137 | #define cudaGraphExecDestroy musaGraphExecDestroy |
| 138 | #define cudaGraphExec_t musaGraphExec_t |
| 139 | #define cudaGraphExecUpdate musaGraphExecUpdate |
| 140 | #define cudaGraphExecUpdateResult musaGraphExecUpdateResult |
| 141 | #define cudaGraphGetNodes musaGraphGetNodes |
| 142 | #define cudaGraphInstantiate musaGraphInstantiate |
| 143 | #define cudaGraphKernelNodeGetParams musaGraphKernelNodeGetParams |
| 144 | #define cudaGraphKernelNodeSetParams musaGraphKernelNodeSetParams |
| 145 | #define cudaGraphLaunch musaGraphLaunch |
| 146 | #define cudaGraphNodeGetType musaGraphNodeGetType |
| 147 | #define cudaGraphNode_t musaGraphNode_t |
| 148 | #define cudaGraphNodeType musaGraphNodeType |
| 149 | #define cudaGraphNodeTypeKernel musaGraphNodeTypeKernel |
| 150 | #define cudaGraph_t musaGraph_t |
| 151 | #define cudaKernelNodeParams musaKernelNodeParams |
| 152 | #define cudaStreamCaptureModeRelaxed musaStreamCaptureModeRelaxed |
| 153 | #define cudaStreamBeginCapture musaStreamBeginCapture |
| 154 | #define cudaStreamEndCapture musaStreamEndCapture |
| 155 | #define cudaStreamCaptureStatus musaStreamCaptureStatus |
| 156 | #define cudaStreamCaptureStatusNone musaStreamCaptureStatusNone |
| 157 | #define cudaStreamIsCapturing musaStreamIsCapturing |
| 158 | #define cudaOccupancyMaxActiveBlocksPerMultiprocessor musaOccupancyMaxActiveBlocksPerMultiprocessor |
| 159 | |
| 160 | typedef __mt_bfloat16 nv_bfloat16; |
| 161 | typedef __mt_bfloat162 nv_bfloat162; |