Handle

Handle types and functions.

miopenStatus_t

enum miopenStatus_t

Error codes that are returned by all MIOpen API calls.

Values:

enumerator miopenStatusSuccess

No errors

enumerator miopenStatusNotInitialized

Data not initialized.

enumerator miopenStatusInvalidValue

Incorrect variable value.

enumerator miopenStatusBadParm

Incorrect parameter detected.

enumerator miopenStatusAllocFailed

Memory allocation error.

enumerator miopenStatusInternalError

MIOpen failure.

enumerator miopenStatusNotImplemented

Use of unimplemented feature.

enumerator miopenStatusUnknownError

Unknown error occurred.

enumerator miopenStatusUnsupportedOp

Unsupported operator for fusion.

enumerator miopenStatusGpuOperationsSkipped

This is not an error.

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.

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.

The HIP side uses a hipStream_t type for the stream, while OpenCL will use a cl_command_queue.

Create a handle with a previously created accelerator command queue.

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

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

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

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

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