Convolutions#
Classes | |
struct | miopenConvAlgoPerf_t |
Perf struct for forward, backward filter, or backward data algorithms. More... | |
struct | miopenConvSolution_t |
Performance struct for forward, backward filter, or backward data algorithms in immediate mode. More... | |
Functions | |
MIOPEN_DECLARE_OBJECT (miopenConvolutionDescriptor) | |
Creates the miopenConvolutionDescriptor_t type. More... | |
miopenStatus_t | miopenCreateConvolutionDescriptor (miopenConvolutionDescriptor_t *convDesc) |
Creates a convolution layer descriptor. More... | |
miopenStatus_t | miopenInitConvolutionDescriptor (miopenConvolutionDescriptor_t convDesc, miopenConvolutionMode_t c_mode, int pad_h, int pad_w, int stride_h, int stride_w, int dilation_h, int dilation_w) |
Creates a 2-D convolution layer descriptor. More... | |
miopenStatus_t | miopenInitConvolutionNdDescriptor (miopenConvolutionDescriptor_t convDesc, int spatialDim, const int *padA, const int *strideA, const int *dilationA, miopenConvolutionMode_t c_mode) |
Creates a N-dimensional convolution layer descriptor. More... | |
miopenStatus_t | miopenGetConvolutionSpatialDim (miopenConvolutionDescriptor_t convDesc, int *spatialDim) |
Retrieves the spatial dimension of a convolution layer descriptor. More... | |
miopenStatus_t | miopenGetConvolutionDescriptor (miopenConvolutionDescriptor_t convDesc, miopenConvolutionMode_t *c_mode, int *pad_h, int *pad_w, int *stride_h, int *stride_w, int *dilation_h, int *dilation_w) |
Retrieves a 2-D convolution layer descriptor's details. More... | |
miopenStatus_t | miopenGetConvolutionNdDescriptor (miopenConvolutionDescriptor_t convDesc, int requestedSpatialDim, int *spatialDim, int *padA, int *strideA, int *dilationA, miopenConvolutionMode_t *c_mode) |
Retrieves a N-dimensional convolution layer descriptor's details. More... | |
miopenStatus_t | miopenGetConvolutionGroupCount (miopenConvolutionDescriptor_t convDesc, int *groupCount) |
Get the number of groups to be used in Group/Depthwise convolution. More... | |
miopenStatus_t | miopenSetConvolutionGroupCount (miopenConvolutionDescriptor_t convDesc, int groupCount) |
Set the number of groups to be used in Group/Depthwise convolution. More... | |
miopenStatus_t | miopenSetTransposeConvOutputPadding (miopenConvolutionDescriptor_t convDesc, int adj_h, int adj_w) |
Set the output padding to be used in 2-D Transpose convolution. More... | |
miopenStatus_t | miopenSetTransposeConvNdOutputPadding (miopenConvolutionDescriptor_t convDesc, int spatialDim, const int *adjA) |
Set the output padding to be used in N-dimensional Transpose convolution. More... | |
miopenStatus_t | miopenGetConvolutionForwardOutputDim (miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t inputTensorDesc, const miopenTensorDescriptor_t filterDesc, int *n, int *c, int *h, int *w) |
Get the shape of a resulting 4-D tensor from a 2-D convolution. More... | |
miopenStatus_t | miopenGetConvolutionNdForwardOutputDim (miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t inputTensorDesc, const miopenTensorDescriptor_t filterDesc, int *nDim, int *outputTensorDimA) |
Get the shape of a resulting N-dimensional tensor from a (N-2)-dimensional convolution. More... | |
miopenStatus_t | miopenDestroyConvolutionDescriptor (miopenConvolutionDescriptor_t convDesc) |
Destroys the tensor descriptor object. More... | |
miopenStatus_t | miopenSetConvolutionAttribute (miopenConvolutionDescriptor_t convDesc, const miopenConvolutionAttrib_t attr, int value) |
Set the attribute of the convolution descriptor. More... | |
miopenStatus_t | miopenGetConvolutionAttribute (miopenConvolutionDescriptor_t convDesc, const miopenConvolutionAttrib_t attr, int *value) |
Get the attribute of the convolution descriptor. More... | |
miopenStatus_t | miopenConvolutionForwardGetSolutionCount (miopenHandle_t handle, const miopenTensorDescriptor_t wDesc, const miopenTensorDescriptor_t xDesc, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t yDesc, size_t *solutionCount) |
Query the maximum number of solutions applicable for the given input/output and weights tensor descriptor for Convolution in the Forward direction. More... | |
miopenStatus_t | miopenConvolutionForwardGetSolution (miopenHandle_t handle, const miopenTensorDescriptor_t wDesc, const miopenTensorDescriptor_t xDesc, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t yDesc, const size_t maxSolutionCount, size_t *solutionCount, miopenConvSolution_t *solutions) |
Query the applicable solutions for a convolution configuration described by input, output and convolution descriptors. More... | |
miopenStatus_t | miopenConvolutionForwardGetSolutionWorkspaceSize (miopenHandle_t handle, const miopenTensorDescriptor_t wDesc, const miopenTensorDescriptor_t xDesc, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t yDesc, const uint64_t solution_id, size_t *workSpaceSize) |
Returns the workspace size required for a particular solution id. More... | |
miopenStatus_t | miopenConvolutionForwardCompileSolution (miopenHandle_t handle, const miopenTensorDescriptor_t wDesc, const miopenTensorDescriptor_t xDesc, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t yDesc, const uint64_t solution_id) |
Compiles the solution provided by the user, this solution may be acquired by the miopenConvolutionForwardGetSolution API call above. Compiling the solution ensures that the first API call to miopenConvolutionForwardImmediate does not cause a compile. More... | |
miopenStatus_t | miopenConvolutionForwardImmediate (miopenHandle_t handle, const miopenTensorDescriptor_t wDesc, const void *w, const miopenTensorDescriptor_t xDesc, const void *x, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t yDesc, void *y, void *workSpace, size_t workSpaceSize, const uint64_t solution_id) |
Executes the Forward convolution operation based on the provided solution ID. More... | |
miopenStatus_t | miopenConvolutionBackwardDataGetSolutionCount (miopenHandle_t handle, const miopenTensorDescriptor_t dyDesc, const miopenTensorDescriptor_t wDesc, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t dxDesc, size_t *solutionCount) |
Query the maximum number of solutions applicable for the given input/output and weights tensor descriptor for backward Convolution w-r-t Data. More... | |
miopenStatus_t | miopenConvolutionBackwardDataGetSolution (miopenHandle_t handle, const miopenTensorDescriptor_t dyDesc, const miopenTensorDescriptor_t wDesc, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t dxDesc, const size_t maxSolutionCount, size_t *solutionCount, miopenConvSolution_t *solutions) |
Query the applicable solutions for a backward convolution w-r-t data as described by input, output and convolution descriptors. More... | |
miopenStatus_t | miopenConvolutionBackwardDataGetSolutionWorkspaceSize (miopenHandle_t handle, const miopenTensorDescriptor_t dyDesc, const miopenTensorDescriptor_t wDesc, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t dxDesc, const uint64_t solution_id, size_t *workSpaceSize) |
Returns the workspace size required for a particular solution id. More... | |
miopenStatus_t | miopenConvolutionBackwardDataCompileSolution (miopenHandle_t handle, const miopenTensorDescriptor_t dyDesc, const miopenTensorDescriptor_t wDesc, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t dxDesc, const uint64_t solution_id) |
Compiles the solution provided by the user, this solution may be acquired by the miopenConvolutionBackwardDataGetSolution API call above. Compiling the solution ensures that the first API call to miopenConvolutionBackwardDataImmediate does not cause a compile. More... | |
miopenStatus_t | miopenConvolutionBackwardDataImmediate (miopenHandle_t handle, const miopenTensorDescriptor_t dyDesc, const void *dy, const miopenTensorDescriptor_t wDesc, const void *w, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t dxDesc, void *dx, void *workSpace, size_t workSpaceSize, const uint64_t solution_id) |
Executes the Backward convolution w-r-t data operation based on the provided solution ID. More... | |
miopenStatus_t | miopenConvolutionBackwardWeightsGetSolutionCount (miopenHandle_t handle, const miopenTensorDescriptor_t dyDesc, const miopenTensorDescriptor_t xDesc, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t dwDesc, size_t *solutionCount) |
Query the maximum number of solutions applicable for the given input/output and weights tensor descriptor for backward Convolution w-r-t Weights. More... | |
miopenStatus_t | miopenConvolutionBackwardWeightsGetSolution (miopenHandle_t handle, const miopenTensorDescriptor_t dyDesc, const miopenTensorDescriptor_t xDesc, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t dwDesc, const size_t maxSolutionCount, size_t *solutionCount, miopenConvSolution_t *solutions) |
Query the applicable solutions for a backward convolution w-r-t weights as described by input, output and convolution descriptors. More... | |
miopenStatus_t | miopenConvolutionBackwardWeightsGetSolutionWorkspaceSize (miopenHandle_t handle, const miopenTensorDescriptor_t dyDesc, const miopenTensorDescriptor_t xDesc, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t dwDesc, const uint64_t solution_id, size_t *workSpaceSize) |
Returns the workspace size required for a particular solution id. More... | |
miopenStatus_t | miopenConvolutionBackwardWeightsCompileSolution (miopenHandle_t handle, const miopenTensorDescriptor_t dyDesc, const miopenTensorDescriptor_t xDesc, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t dwDesc, const uint64_t solution_id) |
Compiles the solution provided by the user, this solution may be acquired by the miopenConvolutionBackwardWeightsGetSolution API call above. Compiling the solution ensures that the first API call to miopenConvolutionBackwardWeightsImmediate does not cause a compile. More... | |
miopenStatus_t | miopenConvolutionBackwardWeightsImmediate (miopenHandle_t handle, const miopenTensorDescriptor_t dyDesc, const void *dy, const miopenTensorDescriptor_t xDesc, const void *x, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t dwDesc, void *dw, void *workSpace, size_t workSpaceSize, const uint64_t solution_id) |
Executes the Backward convolution w-r-t weights operation based on the provided solution ID. More... | |
miopenStatus_t | miopenConvolutionForwardGetWorkSpaceSize (miopenHandle_t handle, const miopenTensorDescriptor_t wDesc, const miopenTensorDescriptor_t xDesc, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t yDesc, size_t *workSpaceSize) |
Query the workspace size required for a forward convolution algorithm. More... | |
miopenStatus_t | miopenFindConvolutionForwardAlgorithm (miopenHandle_t handle, const miopenTensorDescriptor_t xDesc, const void *x, const miopenTensorDescriptor_t wDesc, const void *w, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t yDesc, void *y, const int requestAlgoCount, int *returnedAlgoCount, miopenConvAlgoPerf_t *perfResults, void *workSpace, size_t workSpaceSize, bool exhaustiveSearch) |
Search and run the forward convolutional algorithms and return a list of kernel times. More... | |
miopenStatus_t | miopenConvolutionForward (miopenHandle_t handle, const void *alpha, const miopenTensorDescriptor_t xDesc, const void *x, const miopenTensorDescriptor_t wDesc, const void *w, const miopenConvolutionDescriptor_t convDesc, miopenConvFwdAlgorithm_t algo, const void *beta, const miopenTensorDescriptor_t yDesc, void *y, void *workSpace, size_t workSpaceSize) |
Execute a forward convolution layer. More... | |
miopenStatus_t | miopenConvolutionForwardBias (miopenHandle_t handle, const void *alpha, const miopenTensorDescriptor_t bDesc, const void *b, const void *beta, const miopenTensorDescriptor_t yDesc, void *y) |
Calculate element-wise scale and shift of a tensor via a bias tensor. More... | |
miopenStatus_t | miopenConvolutionBackwardDataGetWorkSpaceSize (miopenHandle_t handle, const miopenTensorDescriptor_t dyDesc, const miopenTensorDescriptor_t wDesc, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t dxDesc, size_t *workSpaceSize) |
Query the workspace size required for a backward data convolution algorithm. More... | |
miopenStatus_t | miopenFindConvolutionBackwardDataAlgorithm (miopenHandle_t handle, const miopenTensorDescriptor_t dyDesc, const void *dy, const miopenTensorDescriptor_t wDesc, const void *w, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t dxDesc, void *dx, const int requestAlgoCount, int *returnedAlgoCount, miopenConvAlgoPerf_t *perfResults, void *workSpace, size_t workSpaceSize, bool exhaustiveSearch) |
Search and run the backwards data convolution algorithms and return a list of kernel times. More... | |
miopenStatus_t | miopenConvolutionBackwardData (miopenHandle_t handle, const void *alpha, const miopenTensorDescriptor_t dyDesc, const void *dy, const miopenTensorDescriptor_t wDesc, const void *w, const miopenConvolutionDescriptor_t convDesc, miopenConvBwdDataAlgorithm_t algo, const void *beta, const miopenTensorDescriptor_t dxDesc, void *dx, void *workSpace, size_t workSpaceSize) |
Execute a backward data convolution layer. More... | |
miopenStatus_t | miopenConvolutionBackwardWeightsGetWorkSpaceSize (miopenHandle_t handle, const miopenTensorDescriptor_t dyDesc, const miopenTensorDescriptor_t xDesc, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t dwDesc, size_t *workSpaceSize) |
Get the GPU memory required for the backward weights convolution algorithm. More... | |
miopenStatus_t | miopenFindConvolutionBackwardWeightsAlgorithm (miopenHandle_t handle, const miopenTensorDescriptor_t dyDesc, const void *dy, const miopenTensorDescriptor_t xDesc, const void *x, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t dwDesc, void *dw, const int requestAlgoCount, int *returnedAlgoCount, miopenConvAlgoPerf_t *perfResults, void *workSpace, size_t workSpaceSize, bool exhaustiveSearch) |
Search and run the backwards weights convolutional algorithms and return a list of kernel times. More... | |
miopenStatus_t | miopenConvolutionBackwardWeights (miopenHandle_t handle, const void *alpha, const miopenTensorDescriptor_t dyDesc, const void *dy, const miopenTensorDescriptor_t xDesc, const void *x, const miopenConvolutionDescriptor_t convDesc, miopenConvBwdWeightsAlgorithm_t algo, const void *beta, const miopenTensorDescriptor_t dwDesc, void *dw, void *workSpace, size_t workSpaceSize) |
Execute a backward weights convolution layer. More... | |
miopenStatus_t | miopenConvolutionBackwardBias (miopenHandle_t handle, const void *alpha, const miopenTensorDescriptor_t dyDesc, const void *dy, const void *beta, const miopenTensorDescriptor_t dbDesc, void *db) |
Calculates the gradient with respect to the bias. More... | |
Detailed Description
Enumeration Type Documentation
◆ miopenConvAlgorithm_t
Top-level convolutional algorithm mode
◆ miopenConvBwdDataAlgorithm_t
Convolutional algorithm mode for back propagation on data.
◆ miopenConvBwdWeightsAlgorithm_t
Convolutional algorithm mode for back propagation on weights.
◆ miopenConvFwdAlgorithm_t
Convolutional algorithm mode for forward propagation. MIOpen use cross-correlation for its convolution implementation.
◆ miopenConvolutionAttrib_t
Attribute for convolution descriptor, used for alternating the convolution behavior
◆ miopenConvolutionMode_t
Convolution mode selection for convolution layer preference.
Function Documentation
◆ MIOPEN_DECLARE_OBJECT()
MIOPEN_DECLARE_OBJECT | ( | miopenConvolutionDescriptor | ) |
Creates the miopenConvolutionDescriptor_t type.
Convolution descriptor is an object that allows the user to specify a layer's padding, stride, and dilation of the convolutional filter. Parameters must all be non-negative.
◆ miopenConvolutionBackwardBias()
miopenStatus_t miopenConvolutionBackwardBias | ( | miopenHandle_t | handle, |
const void * | alpha, | ||
const miopenTensorDescriptor_t | dyDesc, | ||
const void * | dy, | ||
const void * | beta, | ||
const miopenTensorDescriptor_t | dbDesc, | ||
void * | db | ||
) |
Calculates the gradient with respect to the bias.
Compute the convolution backwards gradient with respect to the bias tensor. The scaling parameter alpha (float) and shift parameter beta (float) are only supported for alpha = 1 and beta = 0.
- Parameters
-
handle MIOpen handle (input) alpha Floating point scaling factor, allocated on the host (input) dyDesc Tensor descriptor for data input tensor dy (input) dy Data delta tensor dy (input) beta Floating point shift factor, allocated on the host (input) dbDesc Tensor descriptor for input bias tensor db (input) db Bias delta tensor db (output)
- Returns
- miopenStatus_t
◆ miopenConvolutionBackwardData()
miopenStatus_t miopenConvolutionBackwardData | ( | miopenHandle_t | handle, |
const void * | alpha, | ||
const miopenTensorDescriptor_t | dyDesc, | ||
const void * | dy, | ||
const miopenTensorDescriptor_t | wDesc, | ||
const void * | w, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
miopenConvBwdDataAlgorithm_t | algo, | ||
const void * | beta, | ||
const miopenTensorDescriptor_t | dxDesc, | ||
void * | dx, | ||
void * | workSpace, | ||
size_t | workSpaceSize | ||
) |
Execute a backward data convolution layer.
Runs the backward data convolution layer based on the selected algorithm. The function miopenFindConvolutionBackwardDataAlgorithm() must have been executed previously to determine the required memory needed for the workspace and the best convolutional algorithm.
The backward data convolution is designed to accommodate both packed and non-packed tensor strides for multiple data types and dimensions across various platforms. This flexibility ensures optimal performance in handling diverse computational scenarios. To configure tensor parameters, including strides, users can utilize the APIs miopenSetTensorDescriptor() and miopenGetTensorDescriptor(). These APIs empower developers to seamlessly set and retrieve tensor information, facilitating a more intuitive and efficient workflow. The tensor strides are non-packed by default.
If using Group/Depthwise convolution mode, call miopenSetConvolutionGroupCount() before running this.
- Parameters
-
handle MIOpen handle (input) alpha Floating point scaling factor, allocated on the host (input) dyDesc Tensor descriptor for data input tensor dy (input) dy Data delta tensor dy (input) wDesc Tensor descriptor for weight tensor w (input) w Weights tensor w (input) convDesc Convolution layer descriptor (input) algo Algorithm selected (input) beta Floating point shift factor, allocated on the host (input) dxDesc Tensor descriptor for output data tensor dx (input) dx Data delta tensor dx (output) workSpace Pointer to workspace required for the search (input) workSpaceSize Size in bytes of the memory needed for find (input)
- Returns
- miopenStatus_t
◆ miopenConvolutionBackwardDataCompileSolution()
miopenStatus_t miopenConvolutionBackwardDataCompileSolution | ( | miopenHandle_t | handle, |
const miopenTensorDescriptor_t | dyDesc, | ||
const miopenTensorDescriptor_t | wDesc, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
const miopenTensorDescriptor_t | dxDesc, | ||
const uint64_t | solution_id | ||
) |
Compiles the solution provided by the user, this solution may be acquired by the miopenConvolutionBackwardDataGetSolution API call above. Compiling the solution ensures that the first API call to miopenConvolutionBackwardDataImmediate does not cause a compile.
This is an optional step and may be skipped if a slow first miopenConvolutionBackwardDataImmediate invocation is acceptable.
- Parameters
-
handle MIOpen handle (input) dyDesc Tensor descriptor for data input tensor dy (input) wDesc Tensor descriptor for weight tensor w (input) convDesc Convolution layer descriptor (input) dxDesc Tensor descriptor for output data tensor dx (input) solution_id ID of the solution to be compiled, as chosen by the user
- Returns
- miopenStatus_t
◆ miopenConvolutionBackwardDataGetSolution()
miopenStatus_t miopenConvolutionBackwardDataGetSolution | ( | miopenHandle_t | handle, |
const miopenTensorDescriptor_t | dyDesc, | ||
const miopenTensorDescriptor_t | wDesc, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
const miopenTensorDescriptor_t | dxDesc, | ||
const size_t | maxSolutionCount, | ||
size_t * | solutionCount, | ||
miopenConvSolution_t * | solutions | ||
) |
Query the applicable solutions for a backward convolution w-r-t data as described by input, output and convolution descriptors.
The returned solutions array is sorted in the order of decreasing performance. The returned solutions ns might be based on heuristics and for more consistent performance results the user the advised to run the Find step. The maximum length of the solutions array may be queried using miopenConvolutionBackwardDataGetSolutionCount
- Parameters
-
handle MIOpen handle (input) dyDesc Tensor descriptor for data input tensor dy (input) wDesc Tensor descriptor for weight tensor w (input) convDesc Convolution layer descriptor (input) dxDesc Tensor descriptor for output data tensor dx (input) maxSolutionCount The size of the solutions array passed in below (input) solutionCount The size of the solutions array returned (output) solutions A pointer to an array of type miopenConvSolution_t allocated by the user, filled in by MIOpen with applicable solutions. (output)
- Returns
- miopenStatus_t
◆ miopenConvolutionBackwardDataGetSolutionCount()
miopenStatus_t miopenConvolutionBackwardDataGetSolutionCount | ( | miopenHandle_t | handle, |
const miopenTensorDescriptor_t | dyDesc, | ||
const miopenTensorDescriptor_t | wDesc, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
const miopenTensorDescriptor_t | dxDesc, | ||
size_t * | solutionCount | ||
) |
Query the maximum number of solutions applicable for the given input/output and weights tensor descriptor for backward Convolution w-r-t Data.
This call returns the maximum number of applicable solutions for a the convolution problem, the number returned may be used to allocate the memory required for the miopenConvAlgoPert2_t which is required by miopenConvolutionBackwardDataGetSolution API calls.
- Parameters
-
handle MIOpen handle (input) dyDesc Tensor descriptor for data input tensor dy (input) wDesc Tensor descriptor for weight tensor w (input) convDesc Convolution layer descriptor (input) dxDesc Tensor descriptor for output data tensor dx (input) solutionCount Pointer to memory to return number of applicable solutions (output)
- Returns
- miopenStatus_t
◆ miopenConvolutionBackwardDataGetSolutionWorkspaceSize()
miopenStatus_t miopenConvolutionBackwardDataGetSolutionWorkspaceSize | ( | miopenHandle_t | handle, |
const miopenTensorDescriptor_t | dyDesc, | ||
const miopenTensorDescriptor_t | wDesc, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
const miopenTensorDescriptor_t | dxDesc, | ||
const uint64_t | solution_id, | ||
size_t * | workSpaceSize | ||
) |
Returns the workspace size required for a particular solution id.
This is an optional call for users who may have serialized the solution id and just need the workspace size for it. The same information is returned by the miopenConvolutionBackwardDataGetSolution as part of the miopenConvSolution_t struct.
- Parameters
-
handle MIOpen handle (input) dyDesc Tensor descriptor for data input tensor dy (input) wDesc Tensor descriptor for weight tensor w (input) convDesc Convolution layer descriptor (input) dxDesc Tensor descriptor for output data tensor dx (input) solution_id ID of the solution for which workspace size is required (input) workSpaceSize The size of the workspace (output)
- Returns
- miopenStatus_t
◆ miopenConvolutionBackwardDataGetWorkSpaceSize()
miopenStatus_t miopenConvolutionBackwardDataGetWorkSpaceSize | ( | miopenHandle_t | handle, |
const miopenTensorDescriptor_t | dyDesc, | ||
const miopenTensorDescriptor_t | wDesc, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
const miopenTensorDescriptor_t | dxDesc, | ||
size_t * | workSpaceSize | ||
) |
Query the workspace size required for a backward data convolution algorithm.
For given tensor and convolution descriptors, this function calculates and returns the minimum size of the workspace that must be provided to miopenFindConvolutionBackwardDataAlgorithm() in order for the latter to find the best candidate from the available backward data convolution algorithms.
WARNING: Providing smaller workspace may result in the selection of a slow convolution algorithm, and therefore affect library performance.
It should be assumed that the required workspace size is different for each convolution configuration. Therefore, typically this function should be called at least once for each convolution configuration used.
Since the convolution configuration is determined by tensor and convolution descriptors, the user should ensure that all descriptors contain complete information. For example, if Group/Depthwise convolution mode is used, then miopenSetConvolutionGroupCount() should be called before running this, and so on.
- Parameters
-
handle MIOpen handle (input) dyDesc Tensor descriptor for data input tensor dy (input) wDesc Tensor descriptor for weight tensor w (input) convDesc Convolution layer descriptor (input) dxDesc Tensor descriptor for output data tensor dx (input) workSpaceSize Size in bytes of the memory required (output)
- Returns
- miopenStatus_t
◆ miopenConvolutionBackwardDataImmediate()
miopenStatus_t miopenConvolutionBackwardDataImmediate | ( | miopenHandle_t | handle, |
const miopenTensorDescriptor_t | dyDesc, | ||
const void * | dy, | ||
const miopenTensorDescriptor_t | wDesc, | ||
const void * | w, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
const miopenTensorDescriptor_t | dxDesc, | ||
void * | dx, | ||
void * | workSpace, | ||
size_t | workSpaceSize, | ||
const uint64_t | solution_id | ||
) |
Executes the Backward convolution w-r-t data operation based on the provided solution ID.
- Parameters
-
handle MIOpen handle (input) dyDesc Tensor descriptor for data input tensor dy (input) dy Data delta tensor dy (input) wDesc Tensor descriptor for weight tensor w (input) w Weights tensor w (input) convDesc Convolution layer descriptor (input) dxDesc Tensor descriptor for output data tensor dx (input) dx Data delta tensor dx (output) workSpace Workspace tensor (input) workSpaceSize Size in bytes of the workspace memory pointed to by workSpace solution_id ID of the solution to be compiled, as chosen by the user
- Returns
- miopenStatus_t
◆ miopenConvolutionBackwardWeights()
miopenStatus_t miopenConvolutionBackwardWeights | ( | miopenHandle_t | handle, |
const void * | alpha, | ||
const miopenTensorDescriptor_t | dyDesc, | ||
const void * | dy, | ||
const miopenTensorDescriptor_t | xDesc, | ||
const void * | x, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
miopenConvBwdWeightsAlgorithm_t | algo, | ||
const void * | beta, | ||
const miopenTensorDescriptor_t | dwDesc, | ||
void * | dw, | ||
void * | workSpace, | ||
size_t | workSpaceSize | ||
) |
Execute a backward weights convolution layer.
Runs the backward weights convolution layer based on the selected algorithm. The function miopenFindConvolutionBackwardWeightsAlgorithm() must have been executed previously to determine the required memory needed for the workspace and the best convolutional algorithm.
The backward weights convolution is designed to accommodate both packed and non-packed tensor strides for multiple data types and dimensions across various platforms. This flexibility ensures optimal performance in handling diverse computational scenarios. To configure tensor parameters, including strides, users can utilize the APIs miopenSetTensorDescriptor() and miopenGetTensorDescriptor(). These APIs empower developers to seamlessly set and retrieve tensor information, facilitating a more intuitive and efficient workflow. The tensor strides are non-packed by default.
If using Group/Depthwise convolution mode, call miopenSetConvolutionGroupCount() before running this.
- Parameters
-
handle MIOpen handle (input) alpha Floating point scaling factor, allocated on the host (input) dyDesc Tensor descriptor for data tensor dy (input) dy Data delta tensor dy (input) xDesc Tensor descriptor for data tensor x (input) x Data tensor x (input) convDesc Convolution layer descriptor (input) algo Algorithm selected (input) beta Floating point shift factor, allocated on the host (input) dwDesc Tensor descriptor for weight tensor dw (input) dw Weights delta tensor dw (output) workSpace Pointer to workspace required for the search (input) workSpaceSize Size in bytes of the memory needed for find (input)
- Returns
- miopenStatus_t
◆ miopenConvolutionBackwardWeightsCompileSolution()
miopenStatus_t miopenConvolutionBackwardWeightsCompileSolution | ( | miopenHandle_t | handle, |
const miopenTensorDescriptor_t | dyDesc, | ||
const miopenTensorDescriptor_t | xDesc, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
const miopenTensorDescriptor_t | dwDesc, | ||
const uint64_t | solution_id | ||
) |
Compiles the solution provided by the user, this solution may be acquired by the miopenConvolutionBackwardWeightsGetSolution API call above. Compiling the solution ensures that the first API call to miopenConvolutionBackwardWeightsImmediate does not cause a compile.
This is an optional step and may be skipped if a slow first miopenConvolutionBackwardWeightsImmediate invocation is acceptable.
- Parameters
-
handle MIOpen handle (input) dyDesc Tensor descriptor for data tensor dy (input) xDesc Tensor descriptor for data tensor x (input) convDesc Convolution layer descriptor (input) dwDesc Tensor descriptor for weight tensor dw (input) solution_id ID of the solution to be compiled, as chosen by the user
- Returns
- miopenStatus_t
◆ miopenConvolutionBackwardWeightsGetSolution()
miopenStatus_t miopenConvolutionBackwardWeightsGetSolution | ( | miopenHandle_t | handle, |
const miopenTensorDescriptor_t | dyDesc, | ||
const miopenTensorDescriptor_t | xDesc, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
const miopenTensorDescriptor_t | dwDesc, | ||
const size_t | maxSolutionCount, | ||
size_t * | solutionCount, | ||
miopenConvSolution_t * | solutions | ||
) |
Query the applicable solutions for a backward convolution w-r-t weights as described by input, output and convolution descriptors.
The returned solutions array is sorted in the order of decreasing performance. The returned solutions might be based on heuristics and for more consistent performance results the user the advised to run the Find step. The maximum length of the solutions array may be queried using miopenConvolutionBackwardWeightsGetSolutionCount
- Parameters
-
handle MIOpen handle (input) dyDesc Tensor descriptor for data tensor dy (input) xDesc Tensor descriptor for data tensor x (input) convDesc Convolution layer descriptor (input) dwDesc Tensor descriptor for weight tensor dw (input) maxSolutionCount The size of the solutions array passed in below (input) solutionCount The size of the solutions array returned (output) solutions A pointer to an array of type miopenConvSolution_t allocated by the user, filled in by MIOpen with applicable solutions. (output)
- Returns
- miopenStatus_t
◆ miopenConvolutionBackwardWeightsGetSolutionCount()
miopenStatus_t miopenConvolutionBackwardWeightsGetSolutionCount | ( | miopenHandle_t | handle, |
const miopenTensorDescriptor_t | dyDesc, | ||
const miopenTensorDescriptor_t | xDesc, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
const miopenTensorDescriptor_t | dwDesc, | ||
size_t * | solutionCount | ||
) |
Query the maximum number of solutions applicable for the given input/output and weights tensor descriptor for backward Convolution w-r-t Weights.
This call returns the maximum number of applicable solutions for a the convolution problem, the number returned may be used to allocate the memory required for the miopenConvAlgoPert2_t which is required by miopenConvolutionBackwardWeightsGetSolution API calls.
- Parameters
-
handle MIOpen handle (input) dyDesc Tensor descriptor for data tensor dy (input) xDesc Tensor descriptor for data tensor x (input) convDesc Convolution layer descriptor (input) dwDesc Tensor descriptor for weight tensor dw (input) solutionCount Pointer to memory to return number of applicable solutions (output)
- Returns
- miopenStatus_t
◆ miopenConvolutionBackwardWeightsGetSolutionWorkspaceSize()
miopenStatus_t miopenConvolutionBackwardWeightsGetSolutionWorkspaceSize | ( | miopenHandle_t | handle, |
const miopenTensorDescriptor_t | dyDesc, | ||
const miopenTensorDescriptor_t | xDesc, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
const miopenTensorDescriptor_t | dwDesc, | ||
const uint64_t | solution_id, | ||
size_t * | workSpaceSize | ||
) |
Returns the workspace size required for a particular solution id.
This is an optional call for users who may have serialized the solution id and just need the workspace size for it. The same information is returned by the miopenConvolutionBackwardWeightsGetSolution as part of the miopenConvSolution_t struct.
- Parameters
-
handle MIOpen handle (input) dyDesc Tensor descriptor for data tensor dy (input) xDesc Tensor descriptor for data tensor x (input) convDesc Convolution layer descriptor (input) dwDesc Tensor descriptor for weight tensor dw (input) solution_id ID of the solution for which workspace size is required (input) workSpaceSize The size of the workspace (output)
- Returns
- miopenStatus_t
◆ miopenConvolutionBackwardWeightsGetWorkSpaceSize()
miopenStatus_t miopenConvolutionBackwardWeightsGetWorkSpaceSize | ( | miopenHandle_t | handle, |
const miopenTensorDescriptor_t | dyDesc, | ||
const miopenTensorDescriptor_t | xDesc, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
const miopenTensorDescriptor_t | dwDesc, | ||
size_t * | workSpaceSize | ||
) |
Get the GPU memory required for the backward weights convolution algorithm.
For given tensor and convolution descriptors, this function calculates and returns the minimum size of the workspace that must be provided to miopenFindConvolutionBackwardWeightsAlgorithm() in order for the latter to find the best candidate from the available backward weights convolution algorithms.
WARNING: Providing smaller workspace may result in the selection of a slow convolution algorithm, and therefore affect library performance.
It should be assumed that the required workspace size is different for each convolution configuration. Therefore, typically this function should be called at least once for each convolution configuration used.
Since the convolution configuration is determined by tensor and convolution descriptors, the user should ensure that all descriptors contain complete information. For example, if Group/Depthwise convolution mode is used, then miopenSetConvolutionGroupCount() should be called before running this, and so on.
- Parameters
-
handle MIOpen handle (input) dyDesc Tensor descriptor for data input tensor dy (input) xDesc Tensor descriptor for data tensor x (input) convDesc Convolution layer descriptor (input) dwDesc Tensor descriptor for output weights tensor dw (input) workSpaceSize Size in bytes of the memory required (output)
- Returns
- miopenStatus_t
◆ miopenConvolutionBackwardWeightsImmediate()
miopenStatus_t miopenConvolutionBackwardWeightsImmediate | ( | miopenHandle_t | handle, |
const miopenTensorDescriptor_t | dyDesc, | ||
const void * | dy, | ||
const miopenTensorDescriptor_t | xDesc, | ||
const void * | x, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
const miopenTensorDescriptor_t | dwDesc, | ||
void * | dw, | ||
void * | workSpace, | ||
size_t | workSpaceSize, | ||
const uint64_t | solution_id | ||
) |
Executes the Backward convolution w-r-t weights operation based on the provided solution ID.
- Parameters
-
handle MIOpen handle (input) dyDesc Tensor descriptor for data tensor dy (input) dy Data delta tensor dy (input) xDesc Tensor descriptor for data tensor x (input) x Data tensor x (input) convDesc Convolution layer descriptor (input) dwDesc Tensor descriptor for weight tensor dw (input) dw Weights delta tensor dw (output) workSpace Workspace tensor (input) workSpaceSize Size in bytes of the memory passed in, pointed to by workSpace pointer above solution_id ID of the solution to be compiled, as chosen by the user
- Returns
- miopenStatus_t
◆ miopenConvolutionForward()
miopenStatus_t miopenConvolutionForward | ( | miopenHandle_t | handle, |
const void * | alpha, | ||
const miopenTensorDescriptor_t | xDesc, | ||
const void * | x, | ||
const miopenTensorDescriptor_t | wDesc, | ||
const void * | w, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
miopenConvFwdAlgorithm_t | algo, | ||
const void * | beta, | ||
const miopenTensorDescriptor_t | yDesc, | ||
void * | y, | ||
void * | workSpace, | ||
size_t | workSpaceSize | ||
) |
Execute a forward convolution layer.
Runs the forward convolution layer based on the selected algorithm. The function miopenFindConvolutionForwardAlgorithm() must have been executed previously to determine the required memory needed for the workspace and the best convolutional algorithm. The scaling parameter alpha (float) and shift parameter beta (float) are only supported for alpha = 1 and beta = 0 in 2D. In 3D, these parameters can take other values.
The forward convolution is designed to accommodate both packed and non-packed tensor strides for multiple data types and dimensions across various platforms. This flexibility ensures optimal performance in handling diverse computational scenarios. To configure tensor parameters, including strides, users can utilize the APIs miopenSetTensorDescriptor() and miopenGetTensorDescriptor(). These APIs empower developers to seamlessly set and retrieve tensor information, facilitating a more intuitive and efficient workflow. The tensor strides are non-packed by default.
If using Group/Depthwise convolution mode, call miopenSetConvolutionGroupCount() before running this.
- Parameters
-
handle MIOpen handle (input) alpha Floating point scaling factor, allocated on the host (input) xDesc Tensor descriptor for data input tensor x (input) x Data tensor x (input) wDesc Tensor descriptor for weight tensor w (input) w Weights tensor w (inputs) convDesc Convolution layer descriptor (inputs) algo Algorithm selected (inputs) beta Floating point shift factor, allocated on the host (input) yDesc Tensor descriptor for output data tensor y (input) y Data tensor y (output) workSpace Pointer to workspace required (input) workSpaceSize Size in bytes of the memory determined by the find step (input)
- Returns
- miopenStatus_t
◆ miopenConvolutionForwardBias()
miopenStatus_t miopenConvolutionForwardBias | ( | miopenHandle_t | handle, |
const void * | alpha, | ||
const miopenTensorDescriptor_t | bDesc, | ||
const void * | b, | ||
const void * | beta, | ||
const miopenTensorDescriptor_t | yDesc, | ||
void * | y | ||
) |
Calculate element-wise scale and shift of a tensor via a bias tensor.
This function applies an element-wise bias to a data tensor from an input bias tensor. The scaling parameter alpha (float) and shift parameter beta (float) are only supported for alpha = 1 and beta = 0.
- Parameters
-
handle MIOpen handle (input) alpha Floating point scaling factor, allocated on the host (input) bDesc Tensor descriptor for bias tensor b (input) b Bias tensor b (input) beta Floating point shift factor, allocated on the host (input) yDesc Tensor descriptor for data tensor y (input) y Data tensor y (input and output)
- Returns
- miopenStatus_t
◆ miopenConvolutionForwardCompileSolution()
miopenStatus_t miopenConvolutionForwardCompileSolution | ( | miopenHandle_t | handle, |
const miopenTensorDescriptor_t | wDesc, | ||
const miopenTensorDescriptor_t | xDesc, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
const miopenTensorDescriptor_t | yDesc, | ||
const uint64_t | solution_id | ||
) |
Compiles the solution provided by the user, this solution may be acquired by the miopenConvolutionForwardGetSolution API call above. Compiling the solution ensures that the first API call to miopenConvolutionForwardImmediate does not cause a compile.
This is an optional step and may be skipped if a slow first miopenConvolutionForwardImmediate invocation is acceptable.
- Parameters
-
handle MIOpen handle (input) wDesc Tensor descriptor for weight tensor w (input) xDesc Tensor descriptor for input data tensor x (input) convDesc Convolution layer descriptor (input) yDesc Tensor descriptor for output data tensor y (input) solution_id ID of the solution to be compiled, as chosen by the user
- Returns
- miopenStatus_t
◆ miopenConvolutionForwardGetSolution()
miopenStatus_t miopenConvolutionForwardGetSolution | ( | miopenHandle_t | handle, |
const miopenTensorDescriptor_t | wDesc, | ||
const miopenTensorDescriptor_t | xDesc, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
const miopenTensorDescriptor_t | yDesc, | ||
const size_t | maxSolutionCount, | ||
size_t * | solutionCount, | ||
miopenConvSolution_t * | solutions | ||
) |
Query the applicable solutions for a convolution configuration described by input, output and convolution descriptors.
The returned solutions array is sorted in the order of decreasing performance. The returned solutions might be based on heuristics and for more consistent performance results the user the advised to run the Find step. The maximum length of the solutions array may be queried using miopenConvolutionForwardGetSolutionCount
- Parameters
-
handle MIOpen handle (input) wDesc Tensor descriptor for weight tensor w (input) xDesc Tensor descriptor for input data tensor x (input) convDesc Convolution layer descriptor (input) yDesc Tensor descriptor for output data tensor y (input) maxSolutionCount The size of the solutions array passed in below (input) solutionCount The size of the solutions array returned (output) solutions A pointer to an array of type miopenConvSolution_t allocated by the user, filled in by MIOpen with applicable solutions. (output)
- Returns
- miopenStatus_t
◆ miopenConvolutionForwardGetSolutionCount()
miopenStatus_t miopenConvolutionForwardGetSolutionCount | ( | miopenHandle_t | handle, |
const miopenTensorDescriptor_t | wDesc, | ||
const miopenTensorDescriptor_t | xDesc, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
const miopenTensorDescriptor_t | yDesc, | ||
size_t * | solutionCount | ||
) |
Query the maximum number of solutions applicable for the given input/output and weights tensor descriptor for Convolution in the Forward direction.
This call returns the maximum number of applicable solutions for a forward convolution problem. The solutionCount
returned may be used to allocate the memory required for the miopenConvAlgoPerf_t
which is required by miopenConvolutionGetSolution API calls.
- Parameters
-
handle MIOpen handle (input) wDesc Tensor descriptor for weight tensor w (input) xDesc Tensor descriptor for input data tensor x (input) convDesc Convolution layer descriptor (input) yDesc Tensor descriptor for output data tensor y (input) solutionCount Pointer to memory to return number of applicable solutions (output)
- Returns
- miopenStatus_t
◆ miopenConvolutionForwardGetSolutionWorkspaceSize()
miopenStatus_t miopenConvolutionForwardGetSolutionWorkspaceSize | ( | miopenHandle_t | handle, |
const miopenTensorDescriptor_t | wDesc, | ||
const miopenTensorDescriptor_t | xDesc, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
const miopenTensorDescriptor_t | yDesc, | ||
const uint64_t | solution_id, | ||
size_t * | workSpaceSize | ||
) |
Returns the workspace size required for a particular solution id.
This is an optional call for users who may have serialized the solution id and just need the workspace size for it. The same information is returned by the miopenConvolutionForwardGetSolution as part of the miopenConvSolution_t struct.
- Parameters
-
handle MIOpen handle (input) wDesc Tensor descriptor for weight tensor w (input) xDesc Tensor descriptor for input data tensor x (input) convDesc Convolution layer descriptor (input) yDesc Tensor descriptor for output data tensor y (input) solution_id ID of the solution for which workspace size is required (input) workSpaceSize The size of the workspace (output)
- Returns
- miopenStatus_t
◆ miopenConvolutionForwardGetWorkSpaceSize()
miopenStatus_t miopenConvolutionForwardGetWorkSpaceSize | ( | miopenHandle_t | handle, |
const miopenTensorDescriptor_t | wDesc, | ||
const miopenTensorDescriptor_t | xDesc, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
const miopenTensorDescriptor_t | yDesc, | ||
size_t * | workSpaceSize | ||
) |
Query the workspace size required for a forward convolution algorithm.
For given tensor and convolution descriptors, this function calculates and returns the minimum size of the workspace that must be provided to miopenFindConvolutionForwardAlgorithm() in order for the latter to find the best candidate from the available forward data convolution algorithms.
WARNING: Providing smaller workspace may result in the selection of a slow convolution algorithm, and therefore affect library performance.
It should be assumed that the required workspace size is different for each convolution configuration. Therefore, typically this function should be called at least once for each convolution configuration used.
Since the convolution configuration is determined by tensor and convolution descriptors, the user should ensure that all descriptors contain complete information. For example, if Group/Depthwise convolution mode is used, then miopenSetConvolutionGroupCount() should be called before running this, and so on.
- Parameters
-
handle MIOpen handle (input) wDesc Tensor descriptor for weight tensor w (input) xDesc Tensor descriptor for input data tensor x (input) convDesc Convolution layer descriptor (input) yDesc Tensor descriptor for output data tensor y (input) workSpaceSize Pointer to memory to return size in bytes (output)
- Returns
- miopenStatus_t
◆ miopenConvolutionForwardImmediate()
miopenStatus_t miopenConvolutionForwardImmediate | ( | miopenHandle_t | handle, |
const miopenTensorDescriptor_t | wDesc, | ||
const void * | w, | ||
const miopenTensorDescriptor_t | xDesc, | ||
const void * | x, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
const miopenTensorDescriptor_t | yDesc, | ||
void * | y, | ||
void * | workSpace, | ||
size_t | workSpaceSize, | ||
const uint64_t | solution_id | ||
) |
Executes the Forward convolution operation based on the provided solution ID.
Supported datatypes are fp32, fp16, bfp16, and int8
- Parameters
-
handle MIOpen handle (input) wDesc Tensor descriptor for weight tensor w (input) w Weights tensor w (input) xDesc Tensor descriptor for input data tensor x (input) x Data tensor x (input) convDesc Convolution layer descriptor (input) yDesc Tensor descriptor for output data tensor y (input) y Data tensor y (output) workSpace Workspace tensor (input) workSpaceSize Size of the memory in bytes pointed to by workSpace above solution_id ID of the solution to be compiled, as chosen by the user
- Returns
- miopenStatus_t
◆ miopenCreateConvolutionDescriptor()
miopenStatus_t miopenCreateConvolutionDescriptor | ( | miopenConvolutionDescriptor_t * | convDesc | ) |
Creates a convolution layer descriptor.
- Parameters
-
convDesc Convolution layer descriptor
- Returns
- miopenStatus_t
◆ miopenDestroyConvolutionDescriptor()
miopenStatus_t miopenDestroyConvolutionDescriptor | ( | miopenConvolutionDescriptor_t | convDesc | ) |
Destroys the tensor descriptor object.
- Parameters
-
convDesc Convolution tensor descriptor type (input)
- Returns
- miopenStatus_t
◆ miopenFindConvolutionBackwardDataAlgorithm()
miopenStatus_t miopenFindConvolutionBackwardDataAlgorithm | ( | miopenHandle_t | handle, |
const miopenTensorDescriptor_t | dyDesc, | ||
const void * | dy, | ||
const miopenTensorDescriptor_t | wDesc, | ||
const void * | w, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
const miopenTensorDescriptor_t | dxDesc, | ||
void * | dx, | ||
const int | requestAlgoCount, | ||
int * | returnedAlgoCount, | ||
miopenConvAlgoPerf_t * | perfResults, | ||
void * | workSpace, | ||
size_t | workSpaceSize, | ||
bool | exhaustiveSearch | ||
) |
Search and run the backwards data convolution algorithms and return a list of kernel times.
This function attempts all MIOpen backward data convolution algorithms, and outputs the performance metrics to a user-allocated array of type miopenConvAlgoPerf_t. These metrics are written in sorted fashion where the first element has the lowest compute time. This function is mandatory before using backwards convolutions. Users can chose the top-most algorithm if they only care about the fastest algorithm.
This function is mandatory before using miopenConvolutionBackwardData(). In order to execute this function, miopenConvolutionBackwardsDataGetWorkSpaceSize() must be run to determine the required memory for this search.
- If exhaustiveSearch == 0, MIOpen will look for the first kernel with a configuration match. If a configuration match is not found, a default configuration will be returned.
- If exhaustiveSearch == 1, MIOpen will look for the best kernel for the provided configuration. If a match is not found, an exhaustive search is performed by running individual algorithms.
If using Group/Depthwise convolution mode, call miopenSetConvolutionGroupCount() before running this.
- Parameters
-
handle MIOpen handle (input) dyDesc Tensor descriptor for data input tensor dy (input) dy Data delta tensor dy (input) wDesc Tensor descriptor for weight tensor w (input) w Weights tensor w (input) convDesc Convolution layer descriptor (input) dxDesc Tensor descriptor for output data tensor dx (input) dx Data delta tensor dx (input) requestAlgoCount Number of algorithms to return kernel times (input) returnedAlgoCount Pointer to number of algorithms returned (output) perfResults Pointer to union of best algorithm for forward and backwards (output) workSpace Pointer to workspace buffer (input). workSpaceSize Size in bytes of the workspace buffer (input). The buffer must be allocated on the device by the caller. The size of the buffer should be determined by calling miopenConvolutionBackwardDataGetWorkSpaceSize(), see its documentation for details. exhaustiveSearch A boolean to toggle a full search of all algorithms and configurations (input)
- Returns
- miopenStatus_t
◆ miopenFindConvolutionBackwardWeightsAlgorithm()
miopenStatus_t miopenFindConvolutionBackwardWeightsAlgorithm | ( | miopenHandle_t | handle, |
const miopenTensorDescriptor_t | dyDesc, | ||
const void * | dy, | ||
const miopenTensorDescriptor_t | xDesc, | ||
const void * | x, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
const miopenTensorDescriptor_t | dwDesc, | ||
void * | dw, | ||
const int | requestAlgoCount, | ||
int * | returnedAlgoCount, | ||
miopenConvAlgoPerf_t * | perfResults, | ||
void * | workSpace, | ||
size_t | workSpaceSize, | ||
bool | exhaustiveSearch | ||
) |
Search and run the backwards weights convolutional algorithms and return a list of kernel times.
This function attempts all MIOpen backward weights convolution algorithms, and outputs the performance metrics to a user-allocated array of type miopenConvAlgoPerf_t. These metrics are written in sorted fashion where the first element has the lowest compute time. This function is mandatory before using backwards weight convolutions. Users can chose the top-most algorithm if they only care about the fastest algorithm.
This function is mandatory before using miopenConvolutionBackwardWeights(). In order to execute this function, miopenConvolutionBackwardsWeightsGetWorkSpaceSize() must be run to determine the required memory for this search.
- If exhaustiveSearch == 0, MIOpen will look for the first kernel with a configuration match. If a configuration match is not found, a default configuration will be returned.
- If exhaustiveSearch == 1, MIOpen will look for the best kernel for the provided configuration. If a match is not found, an exhaustive search is performed by running individual algorithms.
If using Group/Depthwise convolution mode, call miopenSetConvolutionGroupCount() before running this.
- Parameters
-
handle MIOpen handle (input) dyDesc Tensor descriptor for data input tensor dy (input) dy Data delta tensor dy (input) xDesc Tensor descriptor for output data tensor x (input) x Data delta tensor dx (input) convDesc Convolution layer descriptor (input) dwDesc Tensor descriptor for weight tensor dw (input) dw Weights delta tensor dw (input) requestAlgoCount Number of algorithms to return kernel times (input) returnedAlgoCount Pointer to number of algorithms returned (output) perfResults Pointer to union of best algorithm for forward and backwards (output) workSpace Pointer to workspace buffer (input). workSpaceSize Size in bytes of the workspace buffer (input). The buffer must be allocated on the device by the caller. The size of the buffer should be determined by calling miopenConvolutionBackwardWeightsGetWorkSpaceSize(), see its documentation for details. exhaustiveSearch A boolean to toggle a full search of all algorithms and configurations (input)
- Returns
- miopenStatus_t
◆ miopenFindConvolutionForwardAlgorithm()
miopenStatus_t miopenFindConvolutionForwardAlgorithm | ( | miopenHandle_t | handle, |
const miopenTensorDescriptor_t | xDesc, | ||
const void * | x, | ||
const miopenTensorDescriptor_t | wDesc, | ||
const void * | w, | ||
const miopenConvolutionDescriptor_t | convDesc, | ||
const miopenTensorDescriptor_t | yDesc, | ||
void * | y, | ||
const int | requestAlgoCount, | ||
int * | returnedAlgoCount, | ||
miopenConvAlgoPerf_t * | perfResults, | ||
void * | workSpace, | ||
size_t | workSpaceSize, | ||
bool | exhaustiveSearch | ||
) |
Search and run the forward convolutional algorithms and return a list of kernel times.
This function attempts all MIOpen forward convolution algorithms based on the input configuration, and outputs performance metrics to a user-allocated array of type miopenConvAlgoPerf_t. These metrics are written in a sorted fashion where the first element has the lowest compute time. Users can chose the top-most algorithm if they only care about the fastest algorithm.
This function is mandatory before using miopenConvolutionForward(). In order to execute this function, miopenConvolutionForwardGetWorkSpaceSize() must be run to determine the required memory for this search.
- If exhaustiveSearch == 0, MIOpen will look for the first kernel with a configuration match. If a configuration match is not found, a default configuration will be returned.
- If exhaustiveSearch == 1, MIOpen will look for the best kernel for the provided configuration. If a match is not found, an exhaustive search is performed by running individual algorithms.
If using Group/Depthwise convolution mode, call miopenSetConvolutionGroupCount() before running this.
- Parameters
-
handle MIOpen handle (input) xDesc Tensor descriptor for data input tensor x (input) x Data tensor x (input) wDesc Tensor descriptor for weight tensor w (input) w Weights tensor w (input) convDesc Convolution layer descriptor (input) yDesc Tensor descriptor for output data tensor y (input) y Data tensor y (output) requestAlgoCount Number of algorithms to return kernel times (input) returnedAlgoCount Pointer to number of algorithms returned (output) perfResults Pointer to union of best algorithm for forward and backwards (input) workSpace Pointer to workspace buffer (input). workSpaceSize Size in bytes of the workspace buffer (input). The buffer must be allocated on the device by the caller. The size of the buffer should be determined by calling miopenConvolutionForwardGetWorkSpaceSize(), see its documentation for details. exhaustiveSearch A boolean to toggle a full search of all algorithms and configurations (input)
- Returns
- miopenStatus_t
◆ miopenGetConvolutionAttribute()
miopenStatus_t miopenGetConvolutionAttribute | ( | miopenConvolutionDescriptor_t | convDesc, |
const miopenConvolutionAttrib_t | attr, | ||
int * | value | ||
) |
Get the attribute of the convolution descriptor.
- Parameters
-
convDesc Convolution layer descriptor (input) attr Attribute of this convolution to get (input) value Value of this attribute (output)
◆ miopenGetConvolutionDescriptor()
miopenStatus_t miopenGetConvolutionDescriptor | ( | miopenConvolutionDescriptor_t | convDesc, |
miopenConvolutionMode_t * | c_mode, | ||
int * | pad_h, | ||
int * | pad_w, | ||
int * | stride_h, | ||
int * | stride_w, | ||
int * | dilation_h, | ||
int * | dilation_w | ||
) |
Retrieves a 2-D convolution layer descriptor's details.
For group/depthwise convolution dilation height and width, only a dilation value of 1 is supported.
- Parameters
-
convDesc Convolution layer descriptor (input) c_mode Convolutional mode (output) pad_h Height input data padding (output) pad_w Width input data padding (output) stride_h Stride for the height of input data (output) stride_w Stride for the width of input data (output) dilation_h Dilation height (output) dilation_w Dilation width (output)
- Returns
- miopenStatus_t
◆ miopenGetConvolutionForwardOutputDim()
miopenStatus_t miopenGetConvolutionForwardOutputDim | ( | miopenConvolutionDescriptor_t | convDesc, |
const miopenTensorDescriptor_t | inputTensorDesc, | ||
const miopenTensorDescriptor_t | filterDesc, | ||
int * | n, | ||
int * | c, | ||
int * | h, | ||
int * | w | ||
) |
Get the shape of a resulting 4-D tensor from a 2-D convolution.
This function returns the dimensions of the resulting 4D tensor of a 2D convolution, given the convolution descriptor, the input tensor descriptor and the filter descriptor. This function can help to setup the output tensor and allocate the proper amount of memory prior to launch the actual convolution.
- Parameters
-
convDesc Convolution layer descriptor (input) inputTensorDesc Input data tensor descriptor (input) filterDesc Weight descriptor (input) n Mini-batch size (output) c Number of channels (output) h Data height dimension size (output) w Data width dimension size (output)
- Returns
- miopenStatus_t
◆ miopenGetConvolutionGroupCount()
miopenStatus_t miopenGetConvolutionGroupCount | ( | miopenConvolutionDescriptor_t | convDesc, |
int * | groupCount | ||
) |
Get the number of groups to be used in Group/Depthwise convolution.
- Parameters
-
convDesc Convolution layer descriptor (input) groupCount Pointer to number of groups in group/depthwise convolution (output)
- Returns
- miopenStatus_t
◆ miopenGetConvolutionNdDescriptor()
miopenStatus_t miopenGetConvolutionNdDescriptor | ( | miopenConvolutionDescriptor_t | convDesc, |
int | requestedSpatialDim, | ||
int * | spatialDim, | ||
int * | padA, | ||
int * | strideA, | ||
int * | dilationA, | ||
miopenConvolutionMode_t * | c_mode | ||
) |
Retrieves a N-dimensional convolution layer descriptor's details.
- Parameters
-
convDesc Convolution layer descriptor (input) requestedSpatialDim Expected convolution spatial dimension (intput) spatialDim Convolutional spatial dimension (output) padA Array of input data padding (output) strideA Array of convolution stride (output) dilationA Array of convolution dilation (output) c_mode Convolutional mode (output)
- Returns
- miopenStatus_t
◆ miopenGetConvolutionNdForwardOutputDim()
miopenStatus_t miopenGetConvolutionNdForwardOutputDim | ( | miopenConvolutionDescriptor_t | convDesc, |
const miopenTensorDescriptor_t | inputTensorDesc, | ||
const miopenTensorDescriptor_t | filterDesc, | ||
int * | nDim, | ||
int * | outputTensorDimA | ||
) |
Get the shape of a resulting N-dimensional tensor from a (N-2)-dimensional convolution.
This function returns the dimensions of the resulting N-dimensional tensor of a (N-2)-dimensional convolution, given the convolution descriptor, the input tensor descriptor and the filter descriptor. It is used to setup the output tensor descriptor prior to executing the convolution layer.
- Parameters
-
convDesc Convolution layer descriptor (input) inputTensorDesc Input data tensor descriptor (input) filterDesc Weight descriptor (input) nDim Pointer to Output data tensor dimension (output) outputTensorDimA Array of Output data tensor length (output)
◆ miopenGetConvolutionSpatialDim()
miopenStatus_t miopenGetConvolutionSpatialDim | ( | miopenConvolutionDescriptor_t | convDesc, |
int * | spatialDim | ||
) |
Retrieves the spatial dimension of a convolution layer descriptor.
- Parameters
-
convDesc Convolution layer descriptor (input) spatialDim Spatial dimension of convolution descriptor (output)
- Returns
- miopenStatus_t
◆ miopenInitConvolutionDescriptor()
miopenStatus_t miopenInitConvolutionDescriptor | ( | miopenConvolutionDescriptor_t | convDesc, |
miopenConvolutionMode_t | c_mode, | ||
int | pad_h, | ||
int | pad_w, | ||
int | stride_h, | ||
int | stride_w, | ||
int | dilation_h, | ||
int | dilation_w | ||
) |
Creates a 2-D convolution layer descriptor.
For group/depthwise convolution dilation height and width, only a dilation value of 1 is supported.
- Parameters
-
convDesc Convolution layer descriptor (output) c_mode Convolutional mode (input) pad_h Height input data padding (input) pad_w Width input data padding (input) stride_h Stride for the height of input data (input) stride_w Stride for the width of input data (input) dilation_h Dilation height (input) dilation_w Dilation width (input)
- Returns
- miopenStatus_t
◆ miopenInitConvolutionNdDescriptor()
miopenStatus_t miopenInitConvolutionNdDescriptor | ( | miopenConvolutionDescriptor_t | convDesc, |
int | spatialDim, | ||
const int * | padA, | ||
const int * | strideA, | ||
const int * | dilationA, | ||
miopenConvolutionMode_t | c_mode | ||
) |
Creates a N-dimensional convolution layer descriptor.
- Parameters
-
convDesc Convolution layer descriptor (output) spatialDim Convolutional spatial dimension (input) padA Array of input data padding (input) strideA Array of convolution stride (input) dilationA Array of convolution dilation (input) c_mode Convolutional mode (input)
- Returns
- miopenStatus_t
◆ miopenSetConvolutionAttribute()
miopenStatus_t miopenSetConvolutionAttribute | ( | miopenConvolutionDescriptor_t | convDesc, |
const miopenConvolutionAttrib_t | attr, | ||
int | value | ||
) |
Set the attribute of the convolution descriptor.
- Parameters
-
convDesc Convolution layer descriptor (input) attr Attribute of this convolution to set (input) value Value of this attribute (input)
◆ miopenSetConvolutionGroupCount()
miopenStatus_t miopenSetConvolutionGroupCount | ( | miopenConvolutionDescriptor_t | convDesc, |
int | groupCount | ||
) |
Set the number of groups to be used in Group/Depthwise convolution.
Must be called before all computational APIs of group/depthwise convolution, it is preferable to call miopenInitConvolutionDescriptor() first, then miopenSetConvolutionGroupCount() to fully initialize group convolutions. Both Convolution Mode and Transpose Convolution Mode support group/depthwise convolution. To run depthwise convolution, set groupCount value equal to number of channels.
- Parameters
-
convDesc Convolution layer descriptor (output) groupCount number of groups, in depthwise conv using filter_number/channel_multiplier (input)
- Returns
- miopenStatus_t
◆ miopenSetTransposeConvNdOutputPadding()
miopenStatus_t miopenSetTransposeConvNdOutputPadding | ( | miopenConvolutionDescriptor_t | convDesc, |
int | spatialDim, | ||
const int * | adjA | ||
) |
Set the output padding to be used in N-dimensional Transpose convolution.
This function is optional for initialization of Transpose convolution. If applicable, it must be called before all computational APIs of Transpose convolution. It is preferable to call miopenInitConvolutionNdDescriptor() first, then miopenSetTransposeConvNdOutputPadding() to fully initialize transpose convolutions. Currently, 2-D and 3-D convolutions are supported.
- Parameters
-
convDesc Convolution layer descriptor (output) spatialDim Convolutional spatial dimension (input) adjA array of output padding for output data (input)
- Returns
- miopenStatus_t
◆ miopenSetTransposeConvOutputPadding()
miopenStatus_t miopenSetTransposeConvOutputPadding | ( | miopenConvolutionDescriptor_t | convDesc, |
int | adj_h, | ||
int | adj_w | ||
) |
Set the output padding to be used in 2-D Transpose convolution.
This function is optional for initialization of Transpose convolution. If applicable, it must be called before all computational APIs of Transpose convolution. It is preferable to call miopenInitConvolutionDescriptor() first, then miopenSetTransposeConvOutputPadding() to fully initialize transpose convolutions.
- Parameters
-
convDesc Convolution layer descriptor (output) adj_h output padding for the height of output data (input) adj_w output padding for the width of output data (input)
- Returns
- miopenStatus_t