Handle#
Typedefs | |
| typedef void *(* | miopenAllocatorFunction) (void *context, size_t sizeBytes) |
| Custom allocator function. More... | |
| typedef void(* | miopenDeallocatorFunction) (void *context, void *memory) |
| Custom deallocator function. More... | |
Enumerations | |
| enum | miopenStatus_t { miopenStatusSuccess = 0 , miopenStatusNotInitialized = 1 , miopenStatusInvalidValue = 2 , miopenStatusBadParm = 3 , miopenStatusAllocFailed = 4 , miopenStatusInternalError = 5 , miopenStatusNotImplemented = 6 , miopenStatusUnknownError = 7 , miopenStatusUnsupportedOp = 8 , miopenStatusGpuOperationsSkipped = 9 , miopenStatusVersionMismatch = 10 } |
| enum | miopenMathType_t { miopenMathDefault = 0 , miopenMathPedantic } |
| enum | miopenF8RoundingMode_t { miopenF8RoundingModeStandard = 0 , miopenF8RoundingModeStochastic = 1 } |
| enum | miopenTuningPolicy_t { miopenTuningPolicyNone = 1 , miopenTuningPolicyDbUpdate = 2 , miopenTuningPolicySearch , miopenTuningPolicySearchDbUpdate = 4 , miopenTuningPolicyDbClean = 5 } |
Functions | |
| MIOPEN_DECLARE_OBJECT (miopenHandle) | |
| Creates the miopenHandle_t type. More... | |
| const char * | miopenGetErrorString (miopenStatus_t error) |
| Get character string for an error code. More... | |
| miopenStatus_t | miopenGetVersion (size_t *major, size_t *minor, size_t *patch) |
| Method to return version of MIOpen. More... | |
| miopenStatus_t | miopenCreate (miopenHandle_t *handle) |
| Method to create the MIOpen handle object. More... | |
| miopenStatus_t | miopenCreateWithStream (miopenHandle_t *handle, miopenAcceleratorQueue_t stream) |
| Create a MIOpen handle with an accelerator stream. More... | |
| miopenStatus_t | miopenDestroy (miopenHandle_t handle) |
| Destroys the MIOpen handle. More... | |
| miopenStatus_t | miopenSetStream (miopenHandle_t handle, miopenAcceleratorQueue_t streamID) |
| Set accelerator command queue previously created. More... | |
| miopenStatus_t | miopenGetStream (miopenHandle_t handle, miopenAcceleratorQueue_t *streamID) |
| Get the previously created accelerator command queue. More... | |
| miopenStatus_t | miopenSetAllocator (miopenHandle_t handle, miopenAllocatorFunction allocator, miopenDeallocatorFunction deallocator, void *allocatorContext) |
| Set allocator for previously created miopenHandle. More... | |
| miopenStatus_t | miopenGetKernelTime (miopenHandle_t handle, float *time) |
| Get time for last kernel launched. More... | |
| miopenStatus_t | miopenEnableProfiling (miopenHandle_t handle, bool enable) |
| Enable profiling to retrieve kernel time. More... | |
| miopenStatus_t | miopenSetTuningPolicy (miopenHandle_t handle, miopenTuningPolicy_t newValue) |
| Update tuning policy for a specific handle. API alternative for MIOPEN_FIND_ENFORCE environment variable. More... | |
| miopenStatus_t | miopenGetTuningPolicy (miopenHandle_t handle, miopenTuningPolicy_t *value) |
| Get tuning policy from a handle. More... | |
| miopenStatus_t | miopenGetLastForwardedError (miopenStatus_t *forwardedStatus) |
| Gets the status of this thread's last call if it was forwarded to hipDNN and failed. More... | |
Detailed Description
Typedef Documentation
◆ miopenAllocatorFunction
| typedef void*(* miopenAllocatorFunction) (void *context, size_t sizeBytes) |
Custom allocator function.
This function allow for user-defined custom allocator
- Parameters
-
context A pointer a context (input) sizeBytes Number of bytes to allocate (input)
◆ miopenDeallocatorFunction
| typedef void(* miopenDeallocatorFunction) (void *context, void *memory) |
Custom deallocator function.
This function allow for user-defined custom deallocation function
- Parameters
-
context A pointer context (input) memory A pointer allocated memory (input)
Enumeration Type Documentation
◆ miopenF8RoundingMode_t
◆ miopenMathType_t
| enum miopenMathType_t |
◆ miopenStatus_t
| enum miopenStatus_t |
Error codes that are returned by all MIOpen API calls.
◆ miopenTuningPolicy_t
| enum miopenTuningPolicy_t |
Tuning policy for MIOpen Find-related calls. Supports the following policies of MIOPEN_FIND_ENFORCE:
- None: Do not enforce anything.
- DbUpdate: Do not skip auto-tune even if PerfDb already contains optimized values.
- Search: Search the database first; if no record is found, tune and update the database.
- SearchDbUpdate: Combination of Search and DbUpdate.
- DbClean: Remove existing entry, do not tune. Note: TuningPolicy has higher priority over MIOPEN_FIND_ENFORCE.
Function Documentation
◆ MIOPEN_DECLARE_OBJECT()
| MIOPEN_DECLARE_OBJECT | ( | miopenHandle | ) |
Creates the miopenHandle_t type.
◆ miopenCreate()
| miopenStatus_t miopenCreate | ( | miopenHandle_t * | handle | ) |
Method to create the MIOpen handle object.
This function creates a MIOpen handle. This is called at the very start to initialize the MIOpen environment.
- Note
- When MIOpen is built with Composable Kernel support, the first handle created for a given GPU architecture in a process loads the CK dynamic library.
- Parameters
-
handle A pointer to a MIOpen handle type (output)
- Returns
- miopenStatus_t
◆ miopenCreateWithStream()
| miopenStatus_t miopenCreateWithStream | ( | miopenHandle_t * | handle, |
| miopenAcceleratorQueue_t | stream | ||
| ) |
Create a MIOpen handle with an accelerator stream.
Create a handle with a previously created accelerator stream.
The HIP backend uses a hipStream_t type for the stream.
- Note
- When MIOpen is built with Composable Kernel support, the first handle created for a given GPU architecture in a process loads the CK dynamic library.
- Parameters
-
handle A pointer to a MIOpen handle type (output) stream An accelerator queue type (input)
- Returns
- miopenStatus_t
◆ miopenDestroy()
| miopenStatus_t miopenDestroy | ( | miopenHandle_t | handle | ) |
Destroys the MIOpen handle.
This is called when breaking down the MIOpen environment.
- Parameters
-
handle MIOpen handle (input)
- Returns
- miopenStatus_t
◆ miopenEnableProfiling()
| miopenStatus_t miopenEnableProfiling | ( | miopenHandle_t | handle, |
| bool | enable | ||
| ) |
Enable profiling to retrieve kernel time.
Enable or disable kernel profiling. This profiling is only for kernel time.
- Parameters
-
handle MIOpen handle (input) enable Boolean to toggle profiling (input)
- Returns
- miopenStatus_t
◆ miopenGetErrorString()
| const char* miopenGetErrorString | ( | miopenStatus_t | error | ) |
Get character string for an error code.
A function which returns a NULL terminated character string of the error code.
- Parameters
-
error miopenStatus_t type error status (input)
- Returns
- errorString
◆ miopenGetKernelTime()
| miopenStatus_t miopenGetKernelTime | ( | miopenHandle_t | handle, |
| float * | time | ||
| ) |
Get time for last kernel launched.
This function is used only when profiling mode has been enabled. Kernel timings are based on the MIOpen handle and is not thread-safe. In order to use multi-threaded profiling, create an MIOpen handle for each concurrent thread.
- Parameters
-
handle MIOpen handle (input) time Pointer to a float type to contain kernel time in milliseconds (output)
- Returns
- miopenStatus_t
◆ miopenGetLastForwardedError()
| miopenStatus_t miopenGetLastForwardedError | ( | miopenStatus_t * | forwardedStatus | ) |
Gets the status of this thread's last call if it was forwarded to hipDNN and failed.
A call that MIOpen hands to hipDNN can fail with the same status MIOpen itself would return. If the most recent MIOpen call on the calling thread was forwarded to hipDNN and failed, forwardedStatus receives that call's status; otherwise it receives miopenStatusSuccess. Calling this function or miopenGetErrorString does not change the answer.
Available only in MIOpen builds configured with MIOPEN_ENABLE_HIPDNN_WRAPPER=ON.
- Parameters
-
forwardedStatus Status of the failed forwarded call, or miopenStatusSuccess (output)
- Returns
- miopenStatusSuccess, or miopenStatusBadParm if forwardedStatus is NULL
◆ miopenGetStream()
| miopenStatus_t miopenGetStream | ( | miopenHandle_t | handle, |
| miopenAcceleratorQueue_t * | streamID | ||
| ) |
Get the previously created accelerator command queue.
Creates a command queue for an accelerator device
- Parameters
-
handle MIOpen handle (input) streamID Pointer to a accelerator queue type (output)
- Returns
- miopenStatus_t
◆ miopenGetTuningPolicy()
| miopenStatus_t miopenGetTuningPolicy | ( | miopenHandle_t | handle, |
| miopenTuningPolicy_t * | value | ||
| ) |
Get tuning policy from a handle.
- Parameters
-
[in] handle MIOpen Handle to fetch value from [in] value Would be set to the current tuning policy value. Must not be null
- Returns
- miopenStatus_t
◆ miopenGetVersion()
| miopenStatus_t miopenGetVersion | ( | size_t * | major, |
| size_t * | minor, | ||
| size_t * | patch | ||
| ) |
Method to return version of MIOpen.
The output values of this call follow from the versioning format major.minor.patch
Pointers that are NULL will be ignored.
- Parameters
-
major Major version number (output) minor Minor version number (output) patch Patch version number (output)
- Returns
- miopenStatus_t
◆ miopenSetAllocator()
| miopenStatus_t miopenSetAllocator | ( | miopenHandle_t | handle, |
| miopenAllocatorFunction | allocator, | ||
| miopenDeallocatorFunction | deallocator, | ||
| void * | allocatorContext | ||
| ) |
Set allocator for previously created miopenHandle.
Set a command queue for an accelerator device
- Parameters
-
handle MIOpen handle allocator A callback function MIOpen will use for internal memory allocations. The provided callback function should allocate device memory with requested size and return a pointer to this memory. Passing 0 will restore the default MIOpen allocator and deallocator. deallocator A callback function MIOpen will use to for internal memory deallocation. The provided callback function should free the specified memory pointer allocatorContext User-specified pointer which is passed to allocatoranddeallocatorThis allows the callback function to access state set by the caller to this function, for example a stateful heap allocator or a c++ class.
- Returns
- miopenStatus_t
◆ miopenSetStream()
| miopenStatus_t miopenSetStream | ( | miopenHandle_t | handle, |
| miopenAcceleratorQueue_t | streamID | ||
| ) |
Set accelerator command queue previously created.
Set a command queue for an accelerator device
- Parameters
-
handle MIOpen handle (input) streamID An accelerator queue type (input)
- Returns
- miopenStatus_t
◆ miopenSetTuningPolicy()
| miopenStatus_t miopenSetTuningPolicy | ( | miopenHandle_t | handle, |
| miopenTuningPolicy_t | newValue | ||
| ) |
Update tuning policy for a specific handle. API alternative for MIOPEN_FIND_ENFORCE environment variable.
- Parameters
-
[in] handle MIOpen Handle to update [in] newValue New tuning policy value. Default value is miopenTuningPolicyNone
- Returns
- miopenStatus_t