Handle

Handle types and functions.

miopenStatus_t

enum miopenStatus_t

Error codes that are returned by all MIOpen API calls.

Values:

miopenStatusSuccess = 0

No errors

miopenStatusNotInitialized = 1

Data not initialized.

miopenStatusInvalidValue = 2

Incorrect variable value.

miopenStatusBadParm = 3

Incorrect parameter detected.

miopenStatusAllocFailed = 4

Memory allocation error.

miopenStatusInternalError = 5

MIOpen failure.

miopenStatusNotImplemented = 6

Use of unimplemented feature.

miopenStatusUnknownError = 7

Unknown error occurred.

miopenStatusUnsupportedOp = 8

Unsupported operator for fusion.

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.

Return
miopenStatus_t
Parameters
  • handle: A pointer to a MIOpen handle type (output)

miopenCreateWithStream

miopenStatus_t miopenCreateWithStream(miopenHandle_t *handle, miopenAcceleratorQueue_t stream)

Create a MIOpen handle with an accelerator stream.

The HIP side returns a hipStream_t type for the stream, while OpenCL will return a cl_command_queue.

Create a handle with a previously created accelerator command queue.

Return
miopenStatus_t
Parameters
  • handle: A pointer to a MIOpen handle type (input)
  • stream: An accelerator queue type (output)

miopenDestroy

miopenStatus_t miopenDestroy(miopenHandle_t handle)

Destroys the MIOpen handle.

This is called when breaking down the MIOpen environment.

Return
miopenStatus_t
Parameters
  • handle: MIOpen handle (input)

miopenSetStream

miopenStatus_t miopenSetStream(miopenHandle_t handle, miopenAcceleratorQueue_t streamID)

Set accelerator command queue previously created.

Set a command queue for an accelerator device

Return
miopenStatus_t
Parameters
  • handle: MIOpen handle (input)
  • streamID: An accelerator queue type (input)

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

Return
miopenStatus_t
Parameters
  • handle: MIOpen handle (input)
  • streamID: Pointer to a accelerator queue type (output)

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.

Return
miopenStatus_t
Parameters
  • handle: MIOpen handle (input)
  • time: Pointer to a float type to contain kernel time in milliseconds (output)

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.

Return
miopenStatus_t
Parameters
  • handle: MIOpen handle (input)
  • enable: Boolean to toggle profiling (input)