GraphAPI#
Functions | |
miopenStatus_t | miopenBackendCreateDescriptor (miopenBackendDescriptorType_t descriptorType, miopenBackendDescriptor_t *descriptor) |
Backend descriptor. More... | |
miopenStatus_t | miopenBackendSetAttribute (miopenBackendDescriptor_t descriptor, miopenBackendAttributeName_t attributeName, miopenBackendAttributeType_t attributeType, int64_t elementCount, void *arrayOfElements) |
Sets an attribute of a descriptor. More... | |
miopenStatus_t | miopenBackendFinalize (miopenBackendDescriptor_t descriptor) |
Finalizes a backend descriptor. More... | |
miopenStatus_t | miopenBackendGetAttribute (miopenBackendDescriptor_t descriptor, miopenBackendAttributeName_t attributeName, miopenBackendAttributeType_t attributeType, int64_t requestedElementCount, int64_t *elementCount, void *arrayOfElements) |
Retrieves backend descriptor's attribute. More... | |
miopenStatus_t | miopenBackendExecute (miopenHandle_t handle, miopenBackendDescriptor_t executionPlan, miopenBackendDescriptor_t variantPack) |
Executes a graph. More... | |
miopenStatus_t | miopenBackendDestroyDescriptor (miopenBackendDescriptor_t descriptor) |
Destroys an instance of miopenBackendDescriptor_t. More... | |
miopenStatus_t | miopenBackendInitialize (miopenBackendDescriptor_t descriptor, miopenBackendDescriptorType_t descriptorType, size_t sizeInBytes) |
Repurposes an instance of miopenBackendDescriptor_t. More... | |
Detailed Description
Enumeration Type Documentation
◆ miopenAlphaBetaCase_t
◆ miopenBackendAttributeName_t
Backend Descriptor's Attribute.
An enumerated type that indicates the backend descriptor attributes that can be set or get using miopenBackendSetAttribute() and miopenBackendGetAttribute() functions. The backend descriptor to which an attribute belongs is identified by the prefix of the attribute name.
◆ miopenBackendAttributeType_t
Data type of an attribute of a backend descriptor.
Specifies the data type of an attribute of a backend descriptor. It is used to specify the type of data pointed to by the void *arrayOfElements argument of miopenBackendSetAttribute() and miopenBackendGetAttribute()
◆ miopenBackendDescriptorType_t
Descriptor type.
An enumerated type that indicates the type of backend descriptors. Users create a backend descriptor of a particular type by passing a value from this enumerate to the miopenBackendCreateDescriptor() function.
◆ miopenBackendHeurMode_t
◆ miopenPointwiseMode_t
Intended poinwise math operation for a pointwise operation descriptor.
An enumerated type to indicate the intended pointwise math operation in the backend pointwise operation descriptor
◆ miopenRngDistribution_t
Function Documentation
◆ miopenBackendCreateDescriptor()
miopenStatus_t miopenBackendCreateDescriptor | ( | miopenBackendDescriptorType_t | descriptorType, |
miopenBackendDescriptor_t * | descriptor | ||
) |
Backend descriptor.
A typedef void pointer to one of many opaque descriptor structures. The type of structure that it points to is determined by the argument when allocating the memory for the opaque structure using miopenBackendCreateDescriptor().
Attributes of a descriptor can be set using miopenBackendSetAttribute(). After all required attributes of a descriptor are set, the descriptor can be finalized by miopenBackendFinalize(). From a finalized descriptor, one can query its queryable attributes using miopenBackendGetAttribute(). Finally, the memory allocated for a descriptor can be freed using miopenBackendDestroyDescriptor().
Creates a backend descriptor
Allocates memory for a given descriptorType at the location pointed by the descriptor
- Parameters
-
[in] descriptorType One among the enumerated miopenBackendDescriptorType_t [out] descriptor Pointer to a descriptor
- Return values
-
miopenStatusSuccess The creation was successful miopenStatusUnsupportedOp Creating a descriptor of a given type is not supported miopenStatusAllocFailed The memory allocation failed miopenStatusUnknownError The error information was not gathered
◆ miopenBackendDestroyDescriptor()
miopenStatus_t miopenBackendDestroyDescriptor | ( | miopenBackendDescriptor_t | descriptor | ) |
Destroys an instance of miopenBackendDescriptor_t.
Destroys instances of miopenBackendDescriptor_t that were previously created using miopenBackendCreateDescriptor(). The value pointed by the descriptor will be undefined after the memory is free and done.
Undefined Behavior if the descriptor was altered between the 'Create' and 'Destroy Descriptor'
- Parameters
-
[in] descriptor Instance of miopenBackendDescriptor_t previously created by miopenBackendCreateDescriptor()
- Return values
-
miopenStatusSuccess The memory was destroyed successfully miopenStatusAllocFailed The destruction of memory failed miopenStatusUnknownError The error information was not gathered
◆ miopenBackendExecute()
miopenStatus_t miopenBackendExecute | ( | miopenHandle_t | handle, |
miopenBackendDescriptor_t | executionPlan, | ||
miopenBackendDescriptor_t | variantPack | ||
) |
Executes a graph.
Executes the given Engine Configuration Plan on the VariantPack and the finalized ExecutionPlan on the data. The data and the working space are encapsulated in the VariantPack
- Parameters
-
[in] handle An instance of miopenHandle_t [in] executionPlan Descriptor of the finalized ExecutionPlan [in] variantPack Descriptor of the finalized VariantPack consisting of: - Data pointer for each non-virtual pointer of the operation set in the execution plan.
- Pointer to user-allocated workspace in global memory at least as large as the size queried
- Return values
-
miopenStatusSuccess The ExecutionPlan was executed successfully miopenStatusBadParm An incorrect or inconsistent value is encountered. For example, a required data pointer is invalid miopenStatusInternalError Some internal errors were encountered miopenStatusUnknownError The error information was not gathered
◆ miopenBackendFinalize()
miopenStatus_t miopenBackendFinalize | ( | miopenBackendDescriptor_t | descriptor | ) |
Finalizes a backend descriptor.
Finalizes the memory pointed to by the descriptor. The type of finalization is done depending on the descriptorType argument with which the descriptor was created using miopenBackendCreateDescriptor() or initialized using miopenBackendInitialize().
- Parameters
-
[in] descriptor Instance of miopenBackendDescriptor_t to finalize
- Return values
-
miopenStatusSuccess The descriptor was finalized successfully miopenStatusBadParm Invalid descriptor attribute values or combination thereof is encountered miopenStatusUnsupportedOp Descriptor attribute values or combinations therefore not supported by the current version miopenStatusInternalError Some internal errors are encountered miopenStatusUnknownError The error information was not gathered
◆ miopenBackendGetAttribute()
miopenStatus_t miopenBackendGetAttribute | ( | miopenBackendDescriptor_t | descriptor, |
miopenBackendAttributeName_t | attributeName, | ||
miopenBackendAttributeType_t | attributeType, | ||
int64_t | requestedElementCount, | ||
int64_t * | elementCount, | ||
void * | arrayOfElements | ||
) |
Retrieves backend descriptor's attribute.
This function retrieves the values of an attribute of a descriptor. attributeName is the name of the attribute whose value is requested. attributeType is the type of attribute. requestsedElementCount is the number of elements to be potentially retrieved. The number of elements for the requested attribute is stored in elementCount. The retrieved values are stored in arrayOfElements. When the attribute is expected to have a single value, arrayOfElements can be pointer to the output value. This function will return miopenStatusNotInitialized if the descriptor has not been successfully finalized using miopenBackendFinalize()
- Parameters
-
[in] descriptor Instance of miopenBackendDescriptor_t whose attribute to retrieve [in] attributeName The name of the attribute being get from the descriptor [in] attributeType The type of attribute [in] requestedElementCount Number of elements to output to arrayOfElements [out] elementCount Output pointer for the number of elements the descriptor attribute has. Note that miopenBackendGetAttribute() will only write the least of this and requestedElementCount elements to arrayOfElements [out] arrayOfElements Array of elements of the datatype of the attributeType. The data type of the attributeType is listed in the mapping table of miopenBackendAttributeType_t
- Return values
-
miopenStatusSuccess The attributeName was retrieved from the descriptor successfully miopenStatusBadParm One or more invalid or inconsistent argument values were encountered. Some examples include: - attributeName is not a valid attribute for the descriptor.
- attributeType is not one of the valid types for the attribute.
miopenStatusNotInitialized The descriptor has not been successfully finalized using miopenBackendFinalize() miopenStatusUnknownError The error information was not gathered
◆ miopenBackendInitialize()
miopenStatus_t miopenBackendInitialize | ( | miopenBackendDescriptor_t | descriptor, |
miopenBackendDescriptorType_t | descriptorType, | ||
size_t | sizeInBytes | ||
) |
Repurposes an instance of miopenBackendDescriptor_t.
Repurposes a pre-allocated memory pointed to by a descriptor of size sizeInByte to a backend descriptor of type descriptorType. The finalized state of the descriptor is set to false.
- Parameters
-
[in] descriptor Instance of miopenBackendDescriptor_t to be initialized [in] descriptorType Enumerated value for the type miopenBackendDescriptorType_t [in] sizeInBytes Size of memory pointed to by descriptor
- Return values
-
miopenStatusSuccess The memory was initialized successfully miopenStatusBadParm An invalid or inconsistent argument value is encountered. Some examples include: - descriptor is a nullptr
- sizeInBytes is less than the size required by the descriptor type
miopenStatusUnknownError The error information was not gathered
◆ miopenBackendSetAttribute()
miopenStatus_t miopenBackendSetAttribute | ( | miopenBackendDescriptor_t | descriptor, |
miopenBackendAttributeName_t | attributeName, | ||
miopenBackendAttributeType_t | attributeType, | ||
int64_t | elementCount, | ||
void * | arrayOfElements | ||
) |
Sets an attribute of a descriptor.
This function sets an attribute of a descriptor to values provided as a pointer. Returns miopenStatusUnsupportedOp if the descriptor is already successfully finalized using miopenBackendFinalize().
- Parameters
-
[in] descriptor Instance of miopenBackendDescriptor_t whose attribute is being set [in] attributeName The name of the attribute being set on the descriptor [in] attributeType The type of attribute [in] elementCount Number of elements being set [in] arrayOfElements The starting location for an array from where to read the values from. The elements of the array are expected to be of the datatype of the attributeType. The datatype of the attributeType is listed in the mapping table of miopenBackendAttributeType_t.
- Return values
-
miopenStatusSuccess The attributeName was set to the descriptor miopenStatusNotInitialized The backend descriptor pointed to by the descriptor is already in the finalized state miopenStatusBadParm The function is called with arguments that correspond to invalid values. Some examples include: - attributeName is not a settable attribute of descriptor.
- attributeType is incorrect for this attributeName.
- elemCount value is unexpected.
- arrayOfElements contains values invalid for the attributeType.
miopenStatusUnsupportedOp The values to which the attributes are being set are not supported by the current version miopenStatusUnknownError The error information was not gathered