Skip to content

Commit

Permalink
Release notes for cudnn-frontend 1.5.2: (#86)
Browse files Browse the repository at this point in the history
[Enhancement] Allows stride value of 0 indicating repetition of tensor in those dimensions.
  • Loading branch information
Anerudhan authored Jun 25, 2024
1 parent aa3abd4 commit 98ca4e1
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 32 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.17)

project(cudnn_frontend VERSION 1.5.1)
project(cudnn_frontend VERSION 1.5.2)

option(CUDNN_FRONTEND_SKIP_JSON_LIB "Defines whether FE should not include nlohmann/json.hpp." OFF)
option(CUDNN_FRONTEND_BUILD_SAMPLES "Defines if samples are built or not." ON)
Expand Down
2 changes: 1 addition & 1 deletion include/cudnn_frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@

#define CUDNN_FRONTEND_MAJOR_VERSION 1
#define CUDNN_FRONTEND_MINOR_VERSION 5
#define CUDNN_FRONTEND_PATCH_VERSION 1
#define CUDNN_FRONTEND_PATCH_VERSION 2
#define CUDNN_FRONTEND_VERSION \
((CUDNN_FRONTEND_MAJOR_VERSION * 10000) + (CUDNN_FRONTEND_MINOR_VERSION * 100) + CUDNN_FRONTEND_PATCH_VERSION)

Expand Down
66 changes: 38 additions & 28 deletions include/cudnn_frontend/node/scaled_dot_product_flash_attention.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,25 @@ class SDPANode : public NodeCRTP<SDPANode> {

// check that Q, K, V, O tensors has been assigned
// check that dim and strides has been assigned and last stride is 1
#define CUDNN_FE_SDPA_VALIDATE_DIM_STRIDE(port, port_map) \
{ \
std::shared_ptr<Tensor_attributes> tensor_ptr = port_map.at(port); \
RETURN_CUDNN_FRONTEND_ERROR_IF(tensor_ptr->get_dim().size() != 4, \
error_code_t::ATTRIBUTE_NOT_SET, \
"The dim for " + std::string(#port) + " is invalid"); \
RETURN_CUDNN_FRONTEND_ERROR_IF(tensor_ptr->get_stride().size() != 4, \
error_code_t::ATTRIBUTE_NOT_SET, \
"The stride for " + std::string(#port) + " is invalid"); \
RETURN_CUDNN_FRONTEND_ERROR_IF( \
tensor_ptr->get_stride()[3] != 1, \
error_code_t::GRAPH_NOT_SUPPORTED, \
"The stride for the last dimension corresponding to the embedding size per head should be 1 for " + \
std::string(#port)); \
#define CUDNN_FE_SDPA_VALIDATE_DIM_STRIDE(port, port_map) \
{ \
std::shared_ptr<Tensor_attributes> tensor_ptr = port_map.at(port); \
RETURN_CUDNN_FRONTEND_ERROR_IF(tensor_ptr->get_dim().size() != 4, \
error_code_t::ATTRIBUTE_NOT_SET, \
"The dim for " + std::string(#port) + " is invalid"); \
RETURN_CUDNN_FRONTEND_ERROR_IF(tensor_ptr->get_stride().size() != 4, \
error_code_t::ATTRIBUTE_NOT_SET, \
"The stride for " + std::string(#port) + " is invalid"); \
RETURN_CUDNN_FRONTEND_ERROR_IF( \
tensor_ptr->get_stride()[3] != 1, \
error_code_t::GRAPH_NOT_SUPPORTED, \
"The stride for the last dimension corresponding to the embedding size per head should be 1 for " + \
std::string(#port)); \
RETURN_CUDNN_FRONTEND_ERROR_IF( \
tensor_ptr->get_stride()[2] == 0, \
error_code_t::GRAPH_NOT_SUPPORTED, \
"The stride for the dimension corresponding to the sequence lengths per head should not be 0 for " + \
std::string(#port)); \
}

CUDNN_FE_VALIDATE_INPUT_TENSOR(input_names::Q);
Expand Down Expand Up @@ -681,20 +686,25 @@ class SDPABackwardNode : public NodeCRTP<SDPABackwardNode> {

// check that Q, K, V, O, stats, dO, dQ, dK, dV tensors has been assigned
// check that dim and strides has been assigned and last stride is 1
#define CUDNN_FE_SDPA_VALIDATE_DIM_STRIDE(port, port_map) \
{ \
std::shared_ptr<Tensor_attributes> tensor_ptr = port_map.at(port); \
RETURN_CUDNN_FRONTEND_ERROR_IF(tensor_ptr->get_dim().size() != 4, \
error_code_t::ATTRIBUTE_NOT_SET, \
"The dim for " + std::string(#port) + " is invalid"); \
RETURN_CUDNN_FRONTEND_ERROR_IF(tensor_ptr->get_stride().size() != 4, \
error_code_t::ATTRIBUTE_NOT_SET, \
"The stride for " + std::string(#port) + " is invalid"); \
RETURN_CUDNN_FRONTEND_ERROR_IF( \
tensor_ptr->get_stride()[3] != 1, \
error_code_t::GRAPH_NOT_SUPPORTED, \
"The stride for the last dimension corresponding to the embedding size per head should be 1 for " + \
std::string(#port)); \
#define CUDNN_FE_SDPA_VALIDATE_DIM_STRIDE(port, port_map) \
{ \
std::shared_ptr<Tensor_attributes> tensor_ptr = port_map.at(port); \
RETURN_CUDNN_FRONTEND_ERROR_IF(tensor_ptr->get_dim().size() != 4, \
error_code_t::ATTRIBUTE_NOT_SET, \
"The dim for " + std::string(#port) + " is invalid"); \
RETURN_CUDNN_FRONTEND_ERROR_IF(tensor_ptr->get_stride().size() != 4, \
error_code_t::ATTRIBUTE_NOT_SET, \
"The stride for " + std::string(#port) + " is invalid"); \
RETURN_CUDNN_FRONTEND_ERROR_IF( \
tensor_ptr->get_stride()[3] != 1, \
error_code_t::GRAPH_NOT_SUPPORTED, \
"The stride for the last dimension corresponding to the embedding size per head should be 1 for " + \
std::string(#port)); \
RETURN_CUDNN_FRONTEND_ERROR_IF( \
tensor_ptr->get_stride()[2] == 0, \
error_code_t::GRAPH_NOT_SUPPORTED, \
"The stride for the dimension corresponding to the sequence lengths per head should not be 0 for " + \
std::string(#port)); \
}

CUDNN_FE_VALIDATE_INPUT_TENSOR(input_names::Q);
Expand Down
2 changes: 1 addition & 1 deletion include/cudnn_frontend_Tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ class TensorBuilder_v8 {
"CUDNN_BACKEND_TENSOR_DESCRIPTOR: Check and Set the CUDNN_ATTR_TENSOR_UNIQUE_ID as a valid value");
return std::move(m_tensor);
}
if (m_tensor.btensor_strA[0] <= 0) {
if (m_tensor.btensor_strA[0] < 0) {
set_error_and_throw_exception(
&m_tensor,
CUDNN_STATUS_BAD_PARAM,
Expand Down
2 changes: 1 addition & 1 deletion python/cudnn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

from .datatypes import _library_type, _is_torch_tensor

__version__ = "1.5.1"
__version__ = "1.5.2"


def _tensor(
Expand Down

0 comments on commit 98ca4e1

Please sign in to comment.