未验证 提交 ab2004bb 编写于 作者: L Liu-xiandong 提交者: GitHub

[cherry-pick]fix cusparse compile bug in CUDA11.2, test=release/2.2 (#36913)

* fix cusparse compile bug in CUDA11.2, test=develop

* fix bug
上级 dcadc256
...@@ -97,7 +97,7 @@ if (WITH_GPU OR WITH_ROCM) ...@@ -97,7 +97,7 @@ if (WITH_GPU OR WITH_ROCM)
endif() endif()
op_library(sync_batch_norm_op) op_library(sync_batch_norm_op)
file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(sync_batch_norm);\n") file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(sync_batch_norm);\n")
if ((NOT WIN32) AND (NOT WITH_ROCM) AND (NOT PADDLE_WITH_ARM) AND (NOT ${CMAKE_CUDA_COMPILER_VERSION} VERSION_LESS 11.2) ) if ((NOT WIN32) AND (NOT WITH_ROCM) AND (NOT PADDLE_WITH_ARM) AND (NOT ${CMAKE_CUDA_COMPILER_VERSION} VERSION_LESS 11.3) )
op_library(sparse_attention_op) op_library(sparse_attention_op)
file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(sparse_attention);\n") file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(sparse_attention);\n")
endif() endif()
......
...@@ -56,8 +56,8 @@ extern void *cusparse_dso_handle; ...@@ -56,8 +56,8 @@ extern void *cusparse_dso_handle;
CUSPARSE_ROUTINE_EACH(DECLARE_DYNAMIC_LOAD_CUSPARSE_WRAP); CUSPARSE_ROUTINE_EACH(DECLARE_DYNAMIC_LOAD_CUSPARSE_WRAP);
// APIs available after CUDA 11.2 // APIs available after CUDA 11.3
#if CUDA_VERSION >= 11020 #if CUDA_VERSION >= 11030
#define CUSPARSE_ROUTINE_EACH_R2(__macro) \ #define CUSPARSE_ROUTINE_EACH_R2(__macro) \
__macro(cusparseSDDMM_bufferSize); \ __macro(cusparseSDDMM_bufferSize); \
__macro(cusparseSDDMM_preprocess); \ __macro(cusparseSDDMM_preprocess); \
......
...@@ -128,8 +128,8 @@ def init_csr_format(batch_size, num_heads, rows, blocksize): ...@@ -128,8 +128,8 @@ def init_csr_format(batch_size, num_heads, rows, blocksize):
@unittest.skipIf( @unittest.skipIf(
not core.is_compiled_with_cuda() or get_cuda_version() < 11020, not core.is_compiled_with_cuda() or get_cuda_version() < 11030,
"core is not compiled with CUDA and cuda version need larger than or equal to 11.2" "core is not compiled with CUDA and cuda version need larger than or equal to 11.3"
) )
class TestSparseAttentionOp(OpTest): class TestSparseAttentionOp(OpTest):
def config(self): def config(self):
...@@ -190,8 +190,8 @@ class TestSparseAttentionOpShapeTest(TestSparseAttentionOp): ...@@ -190,8 +190,8 @@ class TestSparseAttentionOpShapeTest(TestSparseAttentionOp):
@unittest.skipIf( @unittest.skipIf(
not core.is_compiled_with_cuda() or get_cuda_version() < 11020, not core.is_compiled_with_cuda() or get_cuda_version() < 11030,
"core is not compiled with CUDA and cuda version need larger than or equal to 11.2" "core is not compiled with CUDA and cuda version need larger than or equal to 11.3"
) )
class TestSparseAttentionAPI(unittest.TestCase): class TestSparseAttentionAPI(unittest.TestCase):
def setUp(self): def setUp(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册