| /* | |
| * Copyright 2014-2023 NVIDIA Corporation. All rights reserved. | |
| * | |
| * NOTICE TO LICENSEE: | |
| * | |
| * This source code and/or documentation ("Licensed Deliverables") are | |
| * subject to NVIDIA intellectual property rights under U.S. and | |
| * international Copyright laws. | |
| * | |
| * These Licensed Deliverables contained herein is PROPRIETARY and | |
| * CONFIDENTIAL to NVIDIA and is being provided under the terms and | |
| * conditions of a form of NVIDIA software license agreement by and | |
| * between NVIDIA and Licensee ("License Agreement") or electronically | |
| * accepted by Licensee. Notwithstanding any terms or conditions to | |
| * the contrary in the License Agreement, reproduction or disclosure | |
| * of the Licensed Deliverables to any third party without the express | |
| * written consent of NVIDIA is prohibited. | |
| * | |
| * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE | |
| * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE | |
| * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS | |
| * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. | |
| * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED | |
| * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, | |
| * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. | |
| * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE | |
| * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY | |
| * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY | |
| * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | |
| * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS | |
| * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |
| * OF THESE LICENSED DELIVERABLES. | |
| * | |
| * U.S. Government End Users. These Licensed Deliverables are a | |
| * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT | |
| * 1995), consisting of "commercial computer software" and "commercial | |
| * computer software documentation" as such terms are used in 48 | |
| * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government | |
| * only as a commercial end item. Consistent with 48 C.F.R.12.212 and | |
| * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all | |
| * U.S. Government End Users acquire the Licensed Deliverables with | |
| * only those rights set forth herein. | |
| * | |
| * Any use of the Licensed Deliverables in individual and commercial | |
| * software must include, in the user documentation and internal | |
| * comments to the code, the above Disclaimer and U.S. Government End | |
| * Users Notice. | |
| */ | |
| /** | |
| * @file cudnn_adv.h | |
| * @brief cuDNN Advanced library - RNN, CTC loss, multi-head attention, and related operations. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| /* These version numbers are autogenerated, do not edit manually. */ | |
| extern "C" { | |
| /* BASIC RNN API */ | |
| /** | |
| * @brief RNN computation algorithm selection. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| typedef enum { | |
| CUDNN_RNN_ALGO_STANDARD = 0, /**< Standard cuBLASLt-based algorithm. @since cuDNN 9.0.0 */ | |
| CUDNN_RNN_ALGO_PERSIST_STATIC = 1, /**< Persistent kernel with static compilation. @since cuDNN 9.0.0 */ | |
| CUDNN_RNN_ALGO_PERSIST_DYNAMIC = 2, /**< Runtime-compiled persistent kernels via NVRTC. @since cuDNN 9.0.0 */ | |
| CUDNN_RNN_ALGO_PERSIST_STATIC_SMALL_H = 3, /**< Register-based approach for smaller hidden states. @since cuDNN 9.0.0 */ | |
| CUDNN_RNN_ALGO_COUNT = 4, /**< Number of RNN algorithms. @since cuDNN 9.0.0 */ | |
| } cudnnRNNAlgo_t; | |
| /** | |
| * @brief Specifies inference or training mode for RNN forward pass. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| typedef enum { | |
| CUDNN_FWD_MODE_INFERENCE = 0, /**< Inference mode. @since cuDNN 9.0.0 */ | |
| CUDNN_FWD_MODE_TRAINING = 1, /**< Training mode (reserves space for backward pass). @since cuDNN 9.0.0 */ | |
| } cudnnForwardMode_t; | |
| /** | |
| * @brief RNN cell type selection. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| typedef enum { | |
| CUDNN_RNN_RELU = 0, /**< Single-gate RNN cell with ReLU activation. @since cuDNN 9.0.0 */ | |
| CUDNN_RNN_TANH = 1, /**< Single-gate RNN cell with tanh activation. @since cuDNN 9.0.0 */ | |
| CUDNN_LSTM = 2, /**< Four-gate LSTM with optional recurrent projection and clipping. @since cuDNN 9.0.0 */ | |
| CUDNN_GRU = 3, /**< Three-gate GRU network. @since cuDNN 9.0.0 */ | |
| } cudnnRNNMode_t; | |
| /** | |
| * @brief Number of bias vectors used in RNN cell formulas. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| typedef enum { | |
| CUDNN_RNN_NO_BIAS = 0, /**< No biases used. @since cuDNN 9.0.0 */ | |
| CUDNN_RNN_SINGLE_INP_BIAS = 1, /**< One input bias in input GEMM. @since cuDNN 9.0.0 */ | |
| CUDNN_RNN_DOUBLE_BIAS = 2, /**< Two bias vectors (default). @since cuDNN 9.0.0 */ | |
| CUDNN_RNN_SINGLE_REC_BIAS = 3 /**< One recurrent bias in recurrent GEMM. @since cuDNN 9.0.0 */ | |
| } cudnnRNNBiasMode_t; | |
| /** | |
| * @brief RNN recurrence direction mode. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| typedef enum { | |
| CUDNN_UNIDIRECTIONAL = 0, /**< Single direction, first input to last. @since cuDNN 9.0.0 */ | |
| CUDNN_BIDIRECTIONAL = 1, /**< Both directions, outputs concatenated at each layer. @since cuDNN 9.0.0 */ | |
| } cudnnDirectionMode_t; | |
| /** | |
| * @brief RNN first layer input behavior. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| typedef enum { | |
| CUDNN_LINEAR_INPUT = 0, /**< Biased matrix multiplication at first layer. @since cuDNN 9.0.0 */ | |
| CUDNN_SKIP_INPUT = 1, /**< Fixed identity matrix at first layer (no operation). @since cuDNN 9.0.0 */ | |
| } cudnnRNNInputMode_t; | |
| /** | |
| * @brief LSTM cell clipping mode. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| typedef enum { | |
| CUDNN_RNN_CLIP_NONE = 0, /**< Disables LSTM cell clipping. @since cuDNN 9.0.0 */ | |
| CUDNN_RNN_CLIP_MINMAX = 1, /**< Enables LSTM cell clipping. @since cuDNN 9.0.0 */ | |
| } cudnnRNNClipMode_t; | |
| /** | |
| * @brief RNN data memory layout. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| typedef enum { | |
| CUDNN_RNN_DATA_LAYOUT_SEQ_MAJOR_UNPACKED = 0, /**< Padded, sequence-major layout. @since cuDNN 9.0.0 */ | |
| CUDNN_RNN_DATA_LAYOUT_SEQ_MAJOR_PACKED = 1, /**< Packed, sequence-major layout. @since cuDNN 9.0.0 */ | |
| CUDNN_RNN_DATA_LAYOUT_BATCH_MAJOR_UNPACKED = 2, /**< Padded, batch-major layout. @since cuDNN 9.0.0 */ | |
| } cudnnRNNDataLayout_t; | |
| /* For auxFlags in cudnnSetRNNDescriptor_v8() */ | |
| /** @brief Opaque RNN descriptor. @since cuDNN 9.0.0 */ | |
| struct cudnnRNNStruct; | |
| typedef struct cudnnRNNStruct *cudnnRNNDescriptor_t; | |
| /** @brief Opaque RNN data descriptor. @since cuDNN 9.0.0 */ | |
| struct cudnnRNNDataStruct; | |
| typedef struct cudnnRNNDataStruct *cudnnRNNDataDescriptor_t; | |
| /** | |
| * @brief Creates an RNN descriptor. | |
| * | |
| * @param[out] rnnDesc Pointer to the created RNN descriptor. | |
| * | |
| * @retval CUDNN_STATUS_SUCCESS Descriptor created successfully. | |
| * | |
| * @since cuDNN 9.0.0 | |
| * @see cudnnDestroyRNNDescriptor | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnCreateRNNDescriptor(cudnnRNNDescriptor_t *rnnDesc); | |
| /** | |
| * @brief Destroys an RNN descriptor. | |
| * | |
| * @param[in] rnnDesc RNN descriptor to destroy. | |
| * | |
| * @retval CUDNN_STATUS_SUCCESS Descriptor destroyed successfully. | |
| * | |
| * @since cuDNN 9.0.0 | |
| * @see cudnnCreateRNNDescriptor | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnDestroyRNNDescriptor(cudnnRNNDescriptor_t rnnDesc); | |
| /* | |
| * mathPrec in cudnnSetRNNDescriptor_v8() specifies compute precision. | |
| * Compute precision is further modified by mathType that sets the | |
| * preferred option for using NVIDIA Tensor Cores. dataType specify | |
| * input/output data type and weight/bias type. | |
| */ | |
| /** | |
| * @brief Configures an RNN descriptor with network parameters. | |
| * | |
| * @param[in,out] rnnDesc RNN descriptor to configure. | |
| * @param[in] algo RNN computation algorithm. | |
| * @param[in] cellMode RNN cell type (RELU, TANH, LSTM, GRU). | |
| * @param[in] biasMode Bias configuration. | |
| * @param[in] dirMode Unidirectional or bidirectional. | |
| * @param[in] inputMode First layer input behavior. | |
| * @param[in] dataType Input/output and weight data type. | |
| * @param[in] mathPrec Compute precision. | |
| * @param[in] mathType Tensor Core usage preference. | |
| * @param[in] inputSize Input vector size. | |
| * @param[in] hiddenSize Hidden state size. | |
| * @param[in] projSize Recurrent projection size (0 to disable). | |
| * @param[in] numLayers Number of stacked RNN layers. | |
| * @param[in] dropoutDesc Dropout descriptor for inter-layer dropout. | |
| * @param[in] auxFlags Auxiliary flags (e.g., CUDNN_RNN_PADDED_IO_ENABLED). | |
| * | |
| * @retval CUDNN_STATUS_SUCCESS Descriptor configured successfully. | |
| * @retval CUDNN_STATUS_BAD_PARAM Invalid parameter. | |
| * @retval CUDNN_STATUS_NOT_SUPPORTED Unsupported configuration. | |
| * | |
| * @since cuDNN 9.0.0 | |
| * @see cudnnGetRNNDescriptor_v8 | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnSetRNNDescriptor_v8(cudnnRNNDescriptor_t rnnDesc, | |
| cudnnRNNAlgo_t algo, | |
| cudnnRNNMode_t cellMode, | |
| cudnnRNNBiasMode_t biasMode, | |
| cudnnDirectionMode_t dirMode, | |
| cudnnRNNInputMode_t inputMode, | |
| cudnnDataType_t dataType, | |
| cudnnDataType_t mathPrec, | |
| cudnnMathType_t mathType, | |
| int32_t inputSize, | |
| int32_t hiddenSize, | |
| int32_t projSize, | |
| int32_t numLayers, | |
| cudnnDropoutDescriptor_t dropoutDesc, | |
| uint32_t auxFlags); | |
| /** | |
| * @brief Retrieves RNN descriptor parameters. | |
| * | |
| * @param[in] rnnDesc RNN descriptor to query. | |
| * @param[out] algo RNN algorithm. | |
| * @param[out] cellMode Cell type. | |
| * @param[out] biasMode Bias configuration. | |
| * @param[out] dirMode Direction mode. | |
| * @param[out] inputMode Input mode. | |
| * @param[out] dataType Data type. | |
| * @param[out] mathPrec Math precision. | |
| * @param[out] mathType Math type. | |
| * @param[out] inputSize Input size. | |
| * @param[out] hiddenSize Hidden size. | |
| * @param[out] projSize Projection size. | |
| * @param[out] numLayers Number of layers. | |
| * @param[out] dropoutDesc Dropout descriptor. | |
| * @param[out] auxFlags Auxiliary flags. | |
| * | |
| * @retval CUDNN_STATUS_SUCCESS Query succeeded. | |
| * | |
| * @since cuDNN 9.0.0 | |
| * @see cudnnSetRNNDescriptor_v8 | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnGetRNNDescriptor_v8(cudnnRNNDescriptor_t rnnDesc, | |
| cudnnRNNAlgo_t *algo, | |
| cudnnRNNMode_t *cellMode, | |
| cudnnRNNBiasMode_t *biasMode, | |
| cudnnDirectionMode_t *dirMode, | |
| cudnnRNNInputMode_t *inputMode, | |
| cudnnDataType_t *dataType, | |
| cudnnDataType_t *mathPrec, | |
| cudnnMathType_t *mathType, | |
| int32_t *inputSize, | |
| int32_t *hiddenSize, | |
| int32_t *projSize, | |
| int32_t *numLayers, | |
| cudnnDropoutDescriptor_t *dropoutDesc, | |
| uint32_t *auxFlags); | |
| /** | |
| * @brief Configures LSTM cell clipping parameters. | |
| * | |
| * @deprecated Since cuDNN 9.0.0. Use cudnnRNNSetClip_v9 instead. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI | |
| cudnnRNNSetClip_v8(cudnnRNNDescriptor_t rnnDesc, | |
| cudnnRNNClipMode_t clipMode, | |
| cudnnNanPropagation_t clipNanOpt, | |
| double lclip, | |
| double rclip); | |
| /** | |
| * @brief Configures LSTM cell clipping parameters. | |
| * | |
| * @param[in,out] rnnDesc RNN descriptor. | |
| * @param[in] clipMode Clipping mode (NONE or MINMAX). | |
| * @param[in] lclip Left (minimum) clipping value. | |
| * @param[in] rclip Right (maximum) clipping value. | |
| * | |
| * @retval CUDNN_STATUS_SUCCESS Clipping configured. | |
| * | |
| * @since cuDNN 9.0.0 | |
| * @see cudnnRNNGetClip_v9 | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnRNNSetClip_v9(cudnnRNNDescriptor_t rnnDesc, cudnnRNNClipMode_t clipMode, double lclip, double rclip); | |
| /** | |
| * @brief Retrieves LSTM cell clipping settings. | |
| * | |
| * @deprecated Since cuDNN 9.0.0. Use cudnnRNNGetClip_v9 instead. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI | |
| cudnnRNNGetClip_v8(cudnnRNNDescriptor_t rnnDesc, | |
| cudnnRNNClipMode_t *clipMode, | |
| cudnnNanPropagation_t *clipNanOpt, | |
| double *lclip, | |
| double *rclip); | |
| /** | |
| * @brief Retrieves LSTM cell clipping settings. | |
| * | |
| * @param[in] rnnDesc RNN descriptor. | |
| * @param[out] clipMode Clipping mode. | |
| * @param[out] lclip Left clipping value. | |
| * @param[out] rclip Right clipping value. | |
| * | |
| * @retval CUDNN_STATUS_SUCCESS Query succeeded. | |
| * | |
| * @since cuDNN 9.0.0 | |
| * @see cudnnRNNSetClip_v9 | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnRNNGetClip_v9(cudnnRNNDescriptor_t rnnDesc, cudnnRNNClipMode_t *clipMode, double *lclip, double *rclip); | |
| /** | |
| * @brief Compiles persistent RNN code using NVRTC for dynamic algorithm. | |
| * | |
| * @param[in] handle cuDNN handle. | |
| * @param[in] rnnDesc RNN descriptor (must use PERSIST_DYNAMIC algorithm). | |
| * @param[in] miniBatch Exact mini-batch size for compilation. | |
| * | |
| * @retval CUDNN_STATUS_SUCCESS Compilation succeeded. | |
| * @retval CUDNN_STATUS_NOT_SUPPORTED Unsupported configuration. | |
| * | |
| * @since cuDNN 9.0.0 | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnBuildRNNDynamic(cudnnHandle_t handle, cudnnRNNDescriptor_t rnnDesc, int miniBatch); | |
| /** | |
| * @brief Computes workspace and reserve space buffer sizes for RNN. | |
| * | |
| * @param[in] handle cuDNN handle. | |
| * @param[in] rnnDesc RNN descriptor. | |
| * @param[in] fwdMode Inference or training mode. | |
| * @param[in] xDesc Input data descriptor. | |
| * @param[out] workSpaceSize Required workspace size in bytes. | |
| * @param[out] reserveSpaceSize Required reserve space size in bytes (training only). | |
| * | |
| * @retval CUDNN_STATUS_SUCCESS Sizes computed successfully. | |
| * | |
| * @since cuDNN 9.0.0 | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnGetRNNTempSpaceSizes(cudnnHandle_t handle, | |
| cudnnRNNDescriptor_t rnnDesc, | |
| cudnnForwardMode_t fwdMode, | |
| cudnnRNNDataDescriptor_t xDesc, | |
| size_t *workSpaceSize, | |
| size_t *reserveSpaceSize); | |
| /** | |
| * @brief Reports required GPU memory for all RNN weight parameters. | |
| * | |
| * @param[in] handle cuDNN handle. | |
| * @param[in] rnnDesc RNN descriptor. | |
| * @param[out] weightSpaceSize Required weight space size in bytes. | |
| * | |
| * @retval CUDNN_STATUS_SUCCESS Size computed. | |
| * | |
| * @since cuDNN 9.0.0 | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnGetRNNWeightSpaceSize(cudnnHandle_t handle, cudnnRNNDescriptor_t rnnDesc, size_t *weightSpaceSize); | |
| /** | |
| * @brief Obtains start address and shape of RNN weight matrices and bias vectors. | |
| * | |
| * @param[in] handle cuDNN handle. | |
| * @param[in] rnnDesc RNN descriptor. | |
| * @param[in] pseudoLayer Pseudo-layer index (physical layer and direction). | |
| * @param[in] weightSpaceSize Total weight space size. | |
| * @param[in] weightSpace Pointer to weight space. | |
| * @param[in] linLayerID Linear layer ID within the RNN cell. | |
| * @param[out] mDesc Tensor descriptor for the weight matrix. | |
| * @param[out] mAddr Start address of the weight matrix. | |
| * @param[out] bDesc Tensor descriptor for the bias vector. | |
| * @param[out] bAddr Start address of the bias vector. | |
| * | |
| * @retval CUDNN_STATUS_SUCCESS Parameters retrieved. | |
| * | |
| * @since cuDNN 9.0.0 | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnGetRNNWeightParams(cudnnHandle_t handle, | |
| cudnnRNNDescriptor_t rnnDesc, | |
| int32_t pseudoLayer, | |
| size_t weightSpaceSize, | |
| const void *weightSpace, | |
| int32_t linLayerID, | |
| cudnnTensorDescriptor_t mDesc, | |
| void **mAddr, | |
| cudnnTensorDescriptor_t bDesc, | |
| void **bAddr); | |
| /** | |
| * @brief Creates an RNN data descriptor. | |
| * @param[out] rnnDataDesc Pointer to created descriptor. | |
| * @retval CUDNN_STATUS_SUCCESS Descriptor created. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnCreateRNNDataDescriptor(cudnnRNNDataDescriptor_t *rnnDataDesc); | |
| /** | |
| * @brief Destroys an RNN data descriptor. | |
| * @param[in] rnnDataDesc Descriptor to destroy. | |
| * @retval CUDNN_STATUS_SUCCESS Descriptor destroyed. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnDestroyRNNDataDescriptor(cudnnRNNDataDescriptor_t rnnDataDesc); | |
| /** | |
| * @brief Configures an RNN data descriptor with layout and sequence information. | |
| * | |
| * @param[in,out] rnnDataDesc RNN data descriptor. | |
| * @param[in] dataType Data type. | |
| * @param[in] layout Data layout (sequence-major or batch-major). | |
| * @param[in] maxSeqLength Maximum sequence length. | |
| * @param[in] batchSize Batch size. | |
| * @param[in] vectorSize Input vector size. | |
| * @param[in] seqLengthArray Length of each sequence in the batch. | |
| * @param[in,out] paddingFill Symbol for filling padding positions. | |
| * | |
| * @retval CUDNN_STATUS_SUCCESS Descriptor configured. | |
| * | |
| * @since cuDNN 9.0.0 | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnSetRNNDataDescriptor(cudnnRNNDataDescriptor_t rnnDataDesc, | |
| cudnnDataType_t dataType, | |
| cudnnRNNDataLayout_t layout, | |
| int maxSeqLength, | |
| int batchSize, | |
| int vectorSize, | |
| const int seqLengthArray[], /* length of each sequence in the batch */ | |
| void *paddingFill); /* symbol for filling padding position in output */ | |
| /** | |
| * @brief Retrieves RNN data descriptor parameters. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnGetRNNDataDescriptor(cudnnRNNDataDescriptor_t rnnDataDesc, | |
| cudnnDataType_t *dataType, | |
| cudnnRNNDataLayout_t *layout, | |
| int *maxSeqLength, | |
| int *batchSize, | |
| int *vectorSize, | |
| int arrayLengthRequested, | |
| int seqLengthArray[], | |
| void *paddingFill); | |
| /** | |
| * @brief Computes the forward pass of an RNN network. | |
| * | |
| * @param[in] handle cuDNN handle. | |
| * @param[in] rnnDesc RNN descriptor. | |
| * @param[in] fwdMode Inference or training mode. | |
| * @param[in] devSeqLengths Per-batch sequence lengths (device memory). | |
| * @param[in] xDesc Input data descriptor. | |
| * @param[in] x Input data pointer. | |
| * @param[in] yDesc Output data descriptor. | |
| * @param[out] y Output data pointer. | |
| * @param[in] hDesc Hidden state descriptor. | |
| * @param[in] hx Initial hidden state (NULL for zero). | |
| * @param[out] hy Final hidden state (NULL to discard). | |
| * @param[in] cDesc Cell state descriptor (LSTM only). | |
| * @param[in] cx Initial cell state (NULL for zero). | |
| * @param[out] cy Final cell state (NULL to discard). | |
| * @param[in] weightSpaceSize Weight space size in bytes. | |
| * @param[in] weightSpace Weight space pointer. | |
| * @param[in] workSpaceSize Workspace size in bytes. | |
| * @param[in,out] workSpace Workspace pointer. | |
| * @param[in] reserveSpaceSize Reserve space size (training only). | |
| * @param[in,out] reserveSpace Reserve space pointer (training only). | |
| * | |
| * @retval CUDNN_STATUS_SUCCESS Forward pass completed. | |
| * @retval CUDNN_STATUS_BAD_PARAM Invalid parameter. | |
| * @retval CUDNN_STATUS_EXECUTION_FAILED Execution failed. | |
| * | |
| * @since cuDNN 9.0.0 | |
| * @see cudnnRNNBackwardData_v8, cudnnRNNBackwardWeights_v8 | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnRNNForward(cudnnHandle_t handle, | |
| cudnnRNNDescriptor_t rnnDesc, | |
| cudnnForwardMode_t fwdMode, | |
| const int32_t devSeqLengths[], | |
| cudnnRNNDataDescriptor_t xDesc, | |
| const void *x, | |
| cudnnRNNDataDescriptor_t yDesc, | |
| void *y, | |
| cudnnTensorDescriptor_t hDesc, | |
| const void *hx, | |
| void *hy, | |
| cudnnTensorDescriptor_t cDesc, | |
| const void *cx, | |
| void *cy, | |
| size_t weightSpaceSize, | |
| const void *weightSpace, | |
| size_t workSpaceSize, | |
| void *workSpace, | |
| size_t reserveSpaceSize, | |
| void *reserveSpace); | |
| /* Sequence data descriptor */ | |
| /** | |
| * @brief Sequence data dimension indices. | |
| * @deprecated Since cuDNN 9.0.0. Use RNN data descriptors instead. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| typedef enum { | |
| CUDNN_SEQDATA_TIME_DIM = 0, /**< Time/sequence length dimension. @since cuDNN 9.0.0 */ | |
| CUDNN_SEQDATA_BATCH_DIM = 1, /**< Batch dimension. @since cuDNN 9.0.0 */ | |
| CUDNN_SEQDATA_BEAM_DIM = 2, /**< Beam dimension. @since cuDNN 9.0.0 */ | |
| CUDNN_SEQDATA_VECT_DIM = 3 /**< Vector dimension. @since cuDNN 9.0.0 */ | |
| } cudnnSeqDataAxis_t; | |
| /** @brief Opaque sequence data descriptor. @deprecated Since cuDNN 9.0.0. @since cuDNN 9.0.0 */ | |
| struct cudnnSeqDataStruct; | |
| typedef struct cudnnSeqDataStruct *cudnnSeqDataDescriptor_t CUDNN_DEPRECATED; | |
| /** | |
| * @brief Creates a sequence data descriptor. | |
| * @deprecated Since cuDNN 9.0.0. Use RNN data descriptors instead. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI | |
| cudnnCreateSeqDataDescriptor(cudnnSeqDataDescriptor_t *seqDataDesc); | |
| /** | |
| * @brief Destroys a sequence data descriptor. | |
| * @deprecated Since cuDNN 9.0.0. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI | |
| cudnnDestroySeqDataDescriptor(cudnnSeqDataDescriptor_t seqDataDesc); | |
| /** | |
| * @brief Configures a sequence data descriptor. | |
| * @deprecated Since cuDNN 9.0.0. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI | |
| cudnnSetSeqDataDescriptor(cudnnSeqDataDescriptor_t seqDataDesc, | |
| cudnnDataType_t dataType, | |
| int nbDims, | |
| const int dimA[], | |
| const cudnnSeqDataAxis_t axes[], | |
| size_t seqLengthArraySize, | |
| const int seqLengthArray[], | |
| void *paddingFill); | |
| /** | |
| * @brief Retrieves sequence data descriptor parameters. | |
| * @deprecated Since cuDNN 9.0.0. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI | |
| cudnnGetSeqDataDescriptor(const cudnnSeqDataDescriptor_t seqDataDesc, | |
| cudnnDataType_t *dataType, | |
| int *nbDims, | |
| int nbDimsRequested, | |
| int dimA[], | |
| cudnnSeqDataAxis_t axes[], | |
| size_t *seqLengthArraySize, | |
| size_t seqLengthSizeRequested, | |
| int seqLengthArray[], | |
| void *paddingFill); | |
| /* Multihead Attention */ | |
| /* | |
| * Multi-head attention options passed via 'attnMode' in cudnnSetAttnDescriptor(). | |
| * Use the bitwise OR operator to combine several settings listed below. Additional | |
| * minor options can be added here w/o changing or introducing new API functions. | |
| */ | |
| /** @brief Opaque multi-head attention descriptor. @deprecated Since cuDNN 9.0.0. @since cuDNN 9.0.0 */ | |
| struct cudnnAttnStruct; | |
| typedef struct cudnnAttnStruct *cudnnAttnDescriptor_t CUDNN_DEPRECATED; | |
| /** | |
| * @brief Creates a multi-head attention descriptor. | |
| * @deprecated Since cuDNN 9.0.0. Use graph API SDPA operations instead. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI | |
| cudnnCreateAttnDescriptor(cudnnAttnDescriptor_t *attnDesc); | |
| /** | |
| * @brief Destroys a multi-head attention descriptor. | |
| * @deprecated Since cuDNN 9.0.0. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI | |
| cudnnDestroyAttnDescriptor(cudnnAttnDescriptor_t attnDesc); | |
| /** | |
| * @brief Configures a multi-head attention descriptor. | |
| * @deprecated Since cuDNN 9.0.0. Use graph API SDPA operations instead. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI | |
| cudnnSetAttnDescriptor(cudnnAttnDescriptor_t attnDesc, | |
| unsigned attnMode, | |
| int nHeads, | |
| double smScaler, | |
| cudnnDataType_t dataType, | |
| cudnnDataType_t computePrec, | |
| cudnnMathType_t mathType, | |
| cudnnDropoutDescriptor_t attnDropoutDesc, | |
| cudnnDropoutDescriptor_t postDropoutDesc, | |
| int qSize, | |
| int kSize, | |
| int vSize, | |
| int qProjSize, | |
| int kProjSize, | |
| int vProjSize, | |
| int oProjSize, | |
| int qoMaxSeqLength, | |
| int kvMaxSeqLength, | |
| int maxBatchSize, | |
| int maxBeamSize); | |
| /** | |
| * @brief Retrieves multi-head attention descriptor parameters. | |
| * @deprecated Since cuDNN 9.0.0. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI | |
| cudnnGetAttnDescriptor(cudnnAttnDescriptor_t attnDesc, | |
| unsigned *attnMode, | |
| int *nHeads, | |
| double *smScaler, | |
| cudnnDataType_t *dataType, | |
| cudnnDataType_t *computePrec, | |
| cudnnMathType_t *mathType, | |
| cudnnDropoutDescriptor_t *attnDropoutDesc, | |
| cudnnDropoutDescriptor_t *postDropoutDesc, | |
| int *qSize, | |
| int *kSize, | |
| int *vSize, | |
| int *qProjSize, | |
| int *kProjSize, | |
| int *vProjSize, | |
| int *oProjSize, | |
| int *qoMaxSeqLength, | |
| int *kvMaxSeqLength, | |
| int *maxBatchSize, | |
| int *maxBeamSize); | |
| /** | |
| * @brief Computes weight, workspace, and reserve space sizes for multi-head attention. | |
| * @deprecated Since cuDNN 9.0.0. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI | |
| cudnnGetMultiHeadAttnBuffers(cudnnHandle_t handle, | |
| const cudnnAttnDescriptor_t attnDesc, | |
| size_t *weightSizeInBytes, | |
| size_t *workSpaceSizeInBytes, | |
| size_t *reserveSpaceSizeInBytes); | |
| /** | |
| * @brief Specifies weight/bias groups in multi-head attention layers. | |
| * @deprecated Since cuDNN 9.0.0. Use graph API SDPA operations instead. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| typedef enum { | |
| CUDNN_MH_ATTN_Q_WEIGHTS = 0, /**< Query projection weights. @since cuDNN 9.0.0 */ | |
| CUDNN_MH_ATTN_K_WEIGHTS = 1, /**< Key projection weights. @since cuDNN 9.0.0 */ | |
| CUDNN_MH_ATTN_V_WEIGHTS = 2, /**< Value projection weights. @since cuDNN 9.0.0 */ | |
| CUDNN_MH_ATTN_O_WEIGHTS = 3, /**< Output projection weights. @since cuDNN 9.0.0 */ | |
| CUDNN_MH_ATTN_Q_BIASES = 4, /**< Query projection biases. @since cuDNN 9.0.0 */ | |
| CUDNN_MH_ATTN_K_BIASES = 5, /**< Key projection biases. @since cuDNN 9.0.0 */ | |
| CUDNN_MH_ATTN_V_BIASES = 6, /**< Value projection biases. @since cuDNN 9.0.0 */ | |
| CUDNN_MH_ATTN_O_BIASES = 7, /**< Output projection biases. @since cuDNN 9.0.0 */ | |
| } cudnnMultiHeadAttnWeightKind_t; | |
| /** | |
| * @brief Obtains shape and start address of attention weight/bias tensors. | |
| * @deprecated Since cuDNN 9.0.0. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI | |
| cudnnGetMultiHeadAttnWeights(cudnnHandle_t handle, | |
| const cudnnAttnDescriptor_t attnDesc, | |
| cudnnMultiHeadAttnWeightKind_t wKind, | |
| size_t weightSizeInBytes, | |
| const void *weights, | |
| cudnnTensorDescriptor_t wDesc, | |
| void **wAddr); | |
| /** | |
| * @brief Computes multi-head attention forward pass. | |
| * @deprecated Since cuDNN 9.0.0. Use graph API SDPA operations instead. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI | |
| cudnnMultiHeadAttnForward(cudnnHandle_t handle, | |
| const cudnnAttnDescriptor_t attnDesc, | |
| int currIdx, | |
| const int loWinIdx[], | |
| const int hiWinIdx[], | |
| const int devSeqLengthsQO[], | |
| const int devSeqLengthsKV[], | |
| const cudnnSeqDataDescriptor_t qDesc, | |
| const void *queries, | |
| const void *residuals, | |
| const cudnnSeqDataDescriptor_t kDesc, | |
| const void *keys, | |
| const cudnnSeqDataDescriptor_t vDesc, | |
| const void *values, | |
| const cudnnSeqDataDescriptor_t oDesc, | |
| void *out, | |
| size_t weightSizeInBytes, | |
| const void *weights, | |
| size_t workSpaceSizeInBytes, | |
| void *workSpace, | |
| size_t reserveSpaceSizeInBytes, | |
| void *reserveSpace); | |
| /* | |
| * \brief Cross-library version checker. | |
| * This function is implemented differently in each sub-library. Each sublib | |
| * checks whether its own version matches that of its dependencies. | |
| * \returns CUDNN_STATUS_SUCCESS if the version check passes, | |
| * CUDNN_STATUS_SUBLIBRARY_VERSION_MISMATCH if the versions are inconsistent. | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnAdvVersionCheck(void); | |
| /** | |
| * @brief Weight gradient accumulation mode. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| typedef enum { | |
| CUDNN_WGRAD_MODE_ADD = 0, /**< Add partial gradients to existing buffer. @since cuDNN 9.0.0 */ | |
| CUDNN_WGRAD_MODE_SET = 1, /**< Overwrite buffer with partial gradients. @since cuDNN 9.0.0 */ | |
| } cudnnWgradMode_t; | |
| /** | |
| * @brief Computes RNN data gradients (backward pass with respect to inputs). | |
| * | |
| * @param[in] handle cuDNN handle. | |
| * @param[in] rnnDesc RNN descriptor. | |
| * @param[in] devSeqLengths Per-batch sequence lengths (device memory). | |
| * @param[in] yDesc Output data descriptor. | |
| * @param[in] y Forward output data. | |
| * @param[in] dy Output gradient data. | |
| * @param[in] xDesc Input data descriptor. | |
| * @param[out] dx Computed input gradient. | |
| * @param[in] hDesc Hidden state descriptor. | |
| * @param[in] hx Initial hidden state from forward pass. | |
| * @param[in] dhy Hidden state gradient (from upstream). | |
| * @param[out] dhx Computed initial hidden state gradient. | |
| * @param[in] cDesc Cell state descriptor (LSTM only). | |
| * @param[in] cx Initial cell state from forward pass. | |
| * @param[in] dcy Cell state gradient (from upstream). | |
| * @param[out] dcx Computed initial cell state gradient. | |
| * @param[in] weightSpaceSize Weight space size. | |
| * @param[in] weightSpace Weight space pointer. | |
| * @param[in] workSpaceSize Workspace size. | |
| * @param[in,out] workSpace Workspace pointer. | |
| * @param[in] reserveSpaceSize Reserve space size. | |
| * @param[in,out] reserveSpace Reserve space (from forward training pass). | |
| * | |
| * @retval CUDNN_STATUS_SUCCESS Backward data pass completed. | |
| * | |
| * @since cuDNN 9.0.0 | |
| * @see cudnnRNNForward, cudnnRNNBackwardWeights_v8 | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnRNNBackwardData_v8(cudnnHandle_t handle, | |
| cudnnRNNDescriptor_t rnnDesc, | |
| const int32_t devSeqLengths[], | |
| cudnnRNNDataDescriptor_t yDesc, | |
| const void *y, | |
| const void *dy, | |
| cudnnRNNDataDescriptor_t xDesc, | |
| void *dx, | |
| cudnnTensorDescriptor_t hDesc, | |
| const void *hx, | |
| const void *dhy, | |
| void *dhx, | |
| cudnnTensorDescriptor_t cDesc, | |
| const void *cx, | |
| const void *dcy, | |
| void *dcx, | |
| size_t weightSpaceSize, | |
| const void *weightSpace, | |
| size_t workSpaceSize, | |
| void *workSpace, | |
| size_t reserveSpaceSize, | |
| void *reserveSpace); | |
| /** | |
| * @brief Computes RNN weight gradients (backward pass with respect to parameters). | |
| * | |
| * @param[in] handle cuDNN handle. | |
| * @param[in] rnnDesc RNN descriptor. | |
| * @param[in] addGrad Accumulate (ADD) or overwrite (SET) gradients. | |
| * @param[in] devSeqLengths Per-batch sequence lengths (device memory). | |
| * @param[in] xDesc Input data descriptor. | |
| * @param[in] x Input data. | |
| * @param[in] hDesc Hidden state descriptor. | |
| * @param[in] hx Initial hidden state. | |
| * @param[in] yDesc Output data descriptor. | |
| * @param[in] y Forward output data. | |
| * @param[in] weightSpaceSize Weight space size. | |
| * @param[in,out] dweightSpace Computed weight gradients. | |
| * @param[in] workSpaceSize Workspace size. | |
| * @param[in,out] workSpace Workspace pointer. | |
| * @param[in] reserveSpaceSize Reserve space size. | |
| * @param[in,out] reserveSpace Reserve space (from forward training pass). | |
| * | |
| * @retval CUDNN_STATUS_SUCCESS Weight gradients computed. | |
| * | |
| * @since cuDNN 9.0.0 | |
| * @see cudnnRNNForward, cudnnRNNBackwardData_v8 | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnRNNBackwardWeights_v8(cudnnHandle_t handle, | |
| cudnnRNNDescriptor_t rnnDesc, | |
| cudnnWgradMode_t addGrad, | |
| const int32_t devSeqLengths[], | |
| cudnnRNNDataDescriptor_t xDesc, | |
| const void *x, | |
| cudnnTensorDescriptor_t hDesc, | |
| const void *hx, | |
| cudnnRNNDataDescriptor_t yDesc, | |
| const void *y, | |
| size_t weightSpaceSize, | |
| void *dweightSpace, | |
| size_t workSpaceSize, | |
| void *workSpace, | |
| size_t reserveSpaceSize, | |
| void *reserveSpace); | |
| /** | |
| * @brief Computes multi-head attention data gradients. | |
| * @deprecated Since cuDNN 9.0.0. Use graph API SDPA operations instead. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI | |
| cudnnMultiHeadAttnBackwardData(cudnnHandle_t handle, | |
| const cudnnAttnDescriptor_t attnDesc, | |
| const int loWinIdx[], | |
| const int hiWinIdx[], | |
| const int devSeqLengthsDQDO[], | |
| const int devSeqLengthsDKDV[], | |
| const cudnnSeqDataDescriptor_t doDesc, | |
| const void *dout, | |
| const cudnnSeqDataDescriptor_t dqDesc, | |
| void *dqueries, | |
| const void *queries, | |
| const cudnnSeqDataDescriptor_t dkDesc, | |
| void *dkeys, | |
| const void *keys, | |
| const cudnnSeqDataDescriptor_t dvDesc, | |
| void *dvalues, | |
| const void *values, | |
| size_t weightSizeInBytes, | |
| const void *weights, | |
| size_t workSpaceSizeInBytes, | |
| void *workSpace, | |
| size_t reserveSpaceSizeInBytes, | |
| void *reserveSpace); | |
| /** | |
| * @brief Computes multi-head attention weight gradients. | |
| * @deprecated Since cuDNN 9.0.0. Use graph API SDPA operations instead. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI | |
| cudnnMultiHeadAttnBackwardWeights(cudnnHandle_t handle, | |
| const cudnnAttnDescriptor_t attnDesc, | |
| cudnnWgradMode_t addGrad, | |
| const cudnnSeqDataDescriptor_t qDesc, | |
| const void *queries, | |
| const cudnnSeqDataDescriptor_t kDesc, | |
| const void *keys, | |
| const cudnnSeqDataDescriptor_t vDesc, | |
| const void *values, | |
| const cudnnSeqDataDescriptor_t doDesc, | |
| const void *dout, | |
| size_t weightSizeInBytes, | |
| const void *weights, | |
| void *dweights, | |
| size_t workSpaceSizeInBytes, | |
| void *workSpace, | |
| size_t reserveSpaceSizeInBytes, | |
| void *reserveSpace); | |
| /* | |
| * CTC (Connectionist Temporal Classification) loss descriptor create/destory/set/get functions | |
| */ | |
| /** | |
| * @brief Input normalization mode for loss functions. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| typedef enum { | |
| CUDNN_LOSS_NORMALIZATION_NONE = 0, /**< Input treated as normalized probability. @since cuDNN 9.0.0 */ | |
| CUDNN_LOSS_NORMALIZATION_SOFTMAX = 1, /**< Input treated as unnormalized activation (softmax applied). @since cuDNN 9.0.0 */ | |
| } cudnnLossNormalizationMode_t; | |
| /** | |
| * @brief Creates a CTC loss descriptor. | |
| * @param[out] ctcLossDesc Pointer to created descriptor. | |
| * @retval CUDNN_STATUS_SUCCESS Descriptor created. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnCreateCTCLossDescriptor(cudnnCTCLossDescriptor_t *ctcLossDesc); | |
| /** | |
| * @brief Configures a CTC loss descriptor with compute type. | |
| * @deprecated Since cuDNN 9.0.0. Use cudnnSetCTCLossDescriptor_v9 instead. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI | |
| cudnnSetCTCLossDescriptor(cudnnCTCLossDescriptor_t ctcLossDesc, cudnnDataType_t compType); | |
| /** | |
| * @brief Configures CTC loss with normalization mode. | |
| * @deprecated Since cuDNN 9.0.0. Use cudnnSetCTCLossDescriptor_v9 instead. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI | |
| cudnnSetCTCLossDescriptorEx(cudnnCTCLossDescriptor_t ctcLossDesc, | |
| cudnnDataType_t compType, | |
| cudnnLossNormalizationMode_t normMode, | |
| cudnnNanPropagation_t gradMode); | |
| /** | |
| * @brief Configures CTC loss with normalization, gradient mode, and max label length. | |
| * @deprecated Since cuDNN 9.0.0. Use cudnnSetCTCLossDescriptor_v9 instead. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI | |
| cudnnSetCTCLossDescriptor_v8(cudnnCTCLossDescriptor_t ctcLossDesc, | |
| cudnnDataType_t compType, | |
| cudnnLossNormalizationMode_t normMode, | |
| cudnnNanPropagation_t gradMode, | |
| int maxLabelLength); | |
| /** | |
| * @brief Configures CTC loss with normalization, CTC gradient mode, and max label length. | |
| * | |
| * @param[in,out] ctcLossDesc CTC loss descriptor. | |
| * @param[in] compType Compute data type. | |
| * @param[in] normMode Loss normalization mode. | |
| * @param[in] ctcGradMode Gradient mode for out-of-bounds samples. | |
| * @param[in] maxLabelLength Maximum label length. | |
| * | |
| * @retval CUDNN_STATUS_SUCCESS Descriptor configured. | |
| * | |
| * @since cuDNN 9.0.0 | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnSetCTCLossDescriptor_v9(cudnnCTCLossDescriptor_t ctcLossDesc, | |
| cudnnDataType_t compType, | |
| cudnnLossNormalizationMode_t normMode, | |
| cudnnCTCGradMode_t ctcGradMode, | |
| int maxLabelLength); | |
| /** | |
| * @brief Retrieves CTC loss compute type. | |
| * @deprecated Since cuDNN 9.0.0. Use cudnnGetCTCLossDescriptor_v9 instead. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI | |
| cudnnGetCTCLossDescriptor(cudnnCTCLossDescriptor_t ctcLossDesc, cudnnDataType_t *compType); | |
| /** | |
| * @brief Retrieves CTC loss extended parameters. | |
| * @deprecated Since cuDNN 9.0.0. Use cudnnGetCTCLossDescriptor_v9 instead. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI | |
| cudnnGetCTCLossDescriptorEx(cudnnCTCLossDescriptor_t ctcLossDesc, | |
| cudnnDataType_t *compType, | |
| cudnnLossNormalizationMode_t *normMode, | |
| cudnnNanPropagation_t *gradMode); | |
| /** | |
| * @brief Retrieves CTC loss v8 parameters. | |
| * @deprecated Since cuDNN 9.0.0. Use cudnnGetCTCLossDescriptor_v9 instead. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI | |
| cudnnGetCTCLossDescriptor_v8(cudnnCTCLossDescriptor_t ctcLossDesc, | |
| cudnnDataType_t *compType, | |
| cudnnLossNormalizationMode_t *normMode, | |
| cudnnNanPropagation_t *gradMode, | |
| int *maxLabelLength); | |
| /** | |
| * @brief Retrieves CTC loss v9 parameters. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnGetCTCLossDescriptor_v9(cudnnCTCLossDescriptor_t ctcLossDesc, | |
| cudnnDataType_t *compType, | |
| cudnnLossNormalizationMode_t *normMode, | |
| cudnnCTCGradMode_t *ctcGradMode, | |
| int *maxLabelLength); | |
| /** | |
| * @brief Destroys a CTC loss descriptor. | |
| * @param[in] ctcLossDesc Descriptor to destroy. | |
| * @retval CUDNN_STATUS_SUCCESS Descriptor destroyed. | |
| * @since cuDNN 9.0.0 | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnDestroyCTCLossDescriptor(cudnnCTCLossDescriptor_t ctcLossDesc); | |
| /** | |
| * @brief Computes CTC loss and gradients given probabilities and labels. | |
| * | |
| * Labels and sequence lengths are in CPU memory. For GPU-memory variant, use cudnnCTCLoss_v8. | |
| * | |
| * @param[in] handle cuDNN handle. | |
| * @param[in] probsDesc Tensor descriptor for probabilities (T x N x A). | |
| * @param[in] probs Probabilities after softmax (GPU memory). | |
| * @param[in] hostLabels Labels (CPU memory). | |
| * @param[in] hostLabelLengths Length of each label (CPU memory). | |
| * @param[in] hostInputLengths Timing step lengths per batch (CPU memory). | |
| * @param[out] costs CTC costs (GPU memory). | |
| * @param[in] gradientsDesc Tensor descriptor for gradients (T x N x A). | |
| * @param[out] gradients CTC gradients (GPU memory, NULL for costs only). | |
| * @param[in] algo CTC loss algorithm. | |
| * @param[in] ctcLossDesc CTC loss descriptor. | |
| * @param[in] workspace Workspace (GPU memory). | |
| * @param[in] workSpaceSizeInBytes Workspace size. | |
| * | |
| * @retval CUDNN_STATUS_SUCCESS CTC loss computed. | |
| * | |
| * @since cuDNN 9.0.0 | |
| * @see cudnnCTCLoss_v8, cudnnGetCTCLossWorkspaceSize | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnCTCLoss( | |
| cudnnHandle_t handle, | |
| const cudnnTensorDescriptor_t probsDesc, /* Tensor descriptor for probabilities, the dimensions are T,N,A (T is the | |
| timing steps, N is the mini batch size, A is the alphabet size) */ | |
| const void *probs, /* probabilities after softmax, in GPU memory */ | |
| const int hostLabels[], /* labels, in CPU memory */ | |
| const int hostLabelLengths[], /* the length of each label, in CPU memory */ | |
| const int hostInputLengths[], /* the lengths of timing steps in each batch, in CPU memory */ | |
| void *costs, /* the returned costs of CTC, in GPU memory */ | |
| const cudnnTensorDescriptor_t gradientsDesc, /* Tensor descriptor for gradients, the dimensions are T,N,A */ | |
| void *gradients, /* the returned CTC gradients, in GPU memory, to compute costs only, set it to NULL */ | |
| cudnnCTCLossAlgo_t algo, /* algorithm selected, supported now 0 and 1 */ | |
| cudnnCTCLossDescriptor_t ctcLossDesc, | |
| void *workspace, /* pointer to the workspace, in GPU memory */ | |
| size_t workSpaceSizeInBytes); /* size of the workspace */ | |
| /** | |
| * @brief Computes CTC loss and gradients (v8, supports CUDA graphs with GPU memory labels). | |
| * | |
| * Labels and sequence lengths are in GPU memory (unlike cudnnCTCLoss which uses CPU memory). | |
| * | |
| * @since cuDNN 9.0.0 | |
| * @see cudnnCTCLoss, cudnnGetCTCLossWorkspaceSize_v8 | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnCTCLoss_v8( | |
| cudnnHandle_t handle, | |
| cudnnCTCLossAlgo_t algo, /* algorithm selected, supported now 0 and 1 */ | |
| cudnnCTCLossDescriptor_t ctcLossDesc, | |
| const cudnnTensorDescriptor_t probsDesc, /* Tensor descriptor for probabilities, the dimensions are T,N,A (T is the | |
| timing steps, N is the mini batch size, A is the alphabet size) */ | |
| const void *probs, /* probabilities after softmax, in GPU memory */ | |
| const int labels[], /* labels, in GPU memory */ | |
| const int labelLengths[], /* the length of each label, in GPU memory */ | |
| const int inputLengths[], /* the lengths of timing steps in each batch, in GPU memory */ | |
| void *costs, /* the returned costs of CTC, in GPU memory */ | |
| const cudnnTensorDescriptor_t gradientsDesc, /* Tensor descriptor for gradients, the dimensions are T,N,A */ | |
| void *gradients, /* the returned CTC gradients, in GPU memory, to compute costs only, set it to NULL */ | |
| size_t workSpaceSizeInBytes, /* size of the workspace */ | |
| void *workspace); /* pointer to the workspace, in GPU memory */ | |
| /** | |
| * @brief Returns the GPU workspace size required for CTC loss computation. | |
| * @since cuDNN 9.0.0 | |
| * @see cudnnCTCLoss | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnGetCTCLossWorkspaceSize( | |
| cudnnHandle_t handle, | |
| const cudnnTensorDescriptor_t probsDesc, /* Tensor descriptor for probabilities, the dimensions are T,N,A (T is the | |
| timing steps, N is the mini batch size, A is the alphabet size) */ | |
| const cudnnTensorDescriptor_t gradientsDesc, /* Tensor descriptor for gradients, the | |
| dimensions are T,N,A. To compute costs | |
| only, set it to NULL */ | |
| const int *labels, /* labels, in CPU memory */ | |
| const int *labelLengths, /* the length of each label, in CPU memory */ | |
| const int *inputLengths, /* the lengths of timing steps in each batch, in CPU memory */ | |
| cudnnCTCLossAlgo_t algo, /* algorithm selected, supported now 0 and 1 */ | |
| cudnnCTCLossDescriptor_t ctcLossDesc, | |
| size_t *sizeInBytes); /* pointer to the returned workspace size */ | |
| /** | |
| * @brief Returns the GPU workspace size required for CTC loss v8 computation. | |
| * @since cuDNN 9.0.0 | |
| * @see cudnnCTCLoss_v8 | |
| */ | |
| cudnnStatus_t CUDNNWINAPI | |
| cudnnGetCTCLossWorkspaceSize_v8( | |
| cudnnHandle_t handle, | |
| cudnnCTCLossAlgo_t algo, /* algorithm selected, supported now 0 and 1 */ | |
| cudnnCTCLossDescriptor_t ctcLossDesc, | |
| const cudnnTensorDescriptor_t probsDesc, /* Tensor descriptor for probabilities, the dimensions are T,N,A (T is the | |
| timing steps, N is the mini batch size, A is the alphabet size) */ | |
| const cudnnTensorDescriptor_t gradientsDesc, /* Tensor descriptor for gradients, the | |
| dimensions are T,N,A. To compute costs | |
| only, set it to NULL */ | |
| size_t *sizeInBytes); /* pointer to the returned workspace size */ | |
| } | |