MUSA Driver API Reference
1. Introduction
The MUSA Driver API is the low-level mu* interface for applications and libraries that need direct control over devices, contexts, modules, memory, streams, events, graphs, and interoperability objects.
This reference describes the MUSA Driver APIs supported in MUSA SDK 5.2.0. Use it as the compatibility reference for the functions, types, structures, fields, constants, and result values documented here.
Note: Some Driver API declarations may appear in the headers but are not described in this reference. These declarations are experimental in MUSA SDK 5.2.0 and are provided for reference only.
2. Using the Driver API
Start with the Runtime API when you want the application-level musa* interface. Use this Driver reference when you need lower-level mu* control, or when a Runtime entry points to a Driver-level object or equivalent.
Driver API use depends on initialization and context state. Review Initialization, Primary Context Management, and Context Management before allocating memory, loading modules, launching work, or sharing resources across APIs.
Synchronization behavior, asynchronous error reporting, object lifetime, and thread-safety constraints are documented in the function entries. For Stream Management, Event Management, Memory Management, Execution Control, and Graph Management APIs, read the Returns and Note sections before relying on host-side completion or object sharing.
Use Version Management for Driver version checks and Driver Entry Point Access to resolve Driver symbols dynamically.
3. Modules
The API reference is organized by capability module.
Module List
- 3.1 Error Handling
- 3.2 Initialization
- 3.3 Version Management
- 3.4 Device Management
- 3.5 Device Management [DEPRECATED]
- 3.6 Primary Context Management
- 3.7 Context Management
- 3.8 Context Management [DEPRECATED]
- 3.9 Module Management
- 3.10 Module Management [DEPRECATED]
- 3.11 Library Management
- 3.12 Memory Management
- 3.13 Virtual Memory Management
- 3.14 Stream Ordered Memory Allocator
- 3.15 Unified Addressing
- 3.16 Stream Management
- 3.17 Event Management
- 3.18 External Resource Interoperability
- 3.19 Stream Memory Operations
- 3.20 Execution Control
- 3.21 Execution Control [DEPRECATED]
- 3.22 Graph Management
- 3.23 Occupancy
- 3.24 Texture Reference Management [DEPRECATED]
- 3.25 Surface Reference Management [DEPRECATED]
- 3.26 Texture Object Management
- 3.27 Surface Object Management
- 3.28 Tensor Map Object Management
- 3.29 Peer Context Memory Access
- 3.30 Graphics Interoperability
- 3.31 Driver Entry Point Access
- 3.32 Memory Atomic Management
- 3.33 Coredump Attributes Control API
- 3.34 Green Contexts
- 3.35 Error Log Management
- 3.36 OpenGL Interoperability
- 3.37 Profiler Control
3.1 Error Handling
muGetErrorString
MUresult muGetErrorString(MUresult error, const char **pStr)
Description
- Gets the string description of an error code.
- Sets *pStr to the address of a NULL-terminated string description of the error code error. If the error code is not recognized, MUSA_ERROR_INVALID_VALUE will be returned and *pStr will be set to the NULL address.
Parameters
error(MUresult): Error code to convert to stringpStr(const char **): Address of the string pointer.
Returns
- MUSA_SUCCESS, MUSA_ERROR_INVALID_VALUE
See also
- MUresult, musaGetErrorString
muGetErrorName
MUresult muGetErrorName(MUresult error, const char **pStr)
Description
- Gets the string representation of an error code enum name.
- Sets *pStr to the address of a NULL-terminated string representation of the name of the enum error code error. If the error code is not recognized, MUSA_ERROR_INVALID_VALUE will be returned and *pStr will be set to the NULL address.
Parameters
error(MUresult): Error code to convert to stringpStr(const char **): Address of the string pointer.
Returns
- MUSA_SUCCESS, MUSA_ERROR_INVALID_VALUE
See also
- MUresult, musaGetErrorName
3.2 Initialization
muInit
MUresult muInit(unsigned int Flags)
Description
- Initialize the MUSA driver API Initializes the driver API and must be called before any other function from the driver API in the current process. Currently, the Flags parameter must be 0. If muInit() has not been called, any function from the driver API will return MUSA_ERROR_NOT_INITIALIZED.
- Note: muInit preloads various libraries needed for JIT compilation. To opt-out of this behavior, set the environment variable MUSA_FORCE_PRELOAD_LIBRARIES=0. MUSA will lazily load JIT libraries as needed. To disable JIT entirely, set the environment variable MUSA_DISABLE_JIT=1.
Parameters
Flags(unsigned int): Initialization flag for MUSA.
Returns
- MUSA_SUCCESS, MUSA_ERROR_INVALID_VALUE, MUSA_ERROR_INVALID_DEVICE, MUSA_ERROR_SYSTEM_DRIVER_MISMATCH, MUSA_ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE
Note
- This function may also return error codes from previous, asynchronous launches.
3.3 Version Management
muDriverGetVersion
MUresult muDriverGetVersion(int *driverVersion)
Description
- Returns the latest MUSA version supported by driver.
- Returns in *driverVersion the version of MUSA supported by the driver. The version is returned as (1000 major + 10 minor). For example, MUSA 9.2 would be represented by 9020.
- This function automatically returns MUSA_ERROR_INVALID_VALUE if driverVersion is NULL.
Parameters
driverVersion(int *): Returns the MUSA driver version
Returns
- MUSA_SUCCESS, MUSA_ERROR_INVALID_VALUE
Note
- This function may also return error codes from previous, asynchronous launches.
See also