From b035a46506c2cb4e460709129444daac505a3fa9 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Tue, 15 Feb 2022 10:54:10 -0600 Subject: [PATCH] Wrap cuFuncSetAttribute, add more CU_FUNC_ATTRIBUTE_... constants --- src/cpp/cuda.hpp | 9 +++++++++ src/wrapper/wrap_cudadrv.cpp | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/cpp/cuda.hpp b/src/cpp/cuda.hpp index 21cb219c..2099a2ed 100644 --- a/src/cpp/cuda.hpp +++ b/src/cpp/cuda.hpp @@ -1419,6 +1419,15 @@ namespace pycuda } #endif + // 10.0+ is a guess +#if CUDAPP_CUDA_VERSION >= 10000 + void set_attribute(CUfunction_attribute attr, int value) const + { + CUDAPP_CALL_GUARDED_WITH_TRACE_INFO( + cuFuncSetAttribute, (m_function, attr, value), m_symbol); + } +#endif + #if CUDAPP_CUDA_VERSION >= 3000 && defined(CUDAPP_POST_30_BETA) void set_cache_config(CUfunc_cache fc) { diff --git a/src/wrapper/wrap_cudadrv.cpp b/src/wrapper/wrap_cudadrv.cpp index 6d95edad..e16d777d 100644 --- a/src/wrapper/wrap_cudadrv.cpp +++ b/src/wrapper/wrap_cudadrv.cpp @@ -974,6 +974,13 @@ BOOST_PYTHON_MODULE(_driver) #if CUDAPP_CUDA_VERSION >= 3000 && defined(CUDAPP_POST_30_BETA) .value("PTX_VERSION", CU_FUNC_ATTRIBUTE_PTX_VERSION) .value("BINARY_VERSION", CU_FUNC_ATTRIBUTE_BINARY_VERSION) +#endif +#if CUDAPP_CUDA_VERSION >= 10000 /* guessed */ + .value("CACHE_MODE_CA", CU_FUNC_ATTRIBUTE_CACHE_MODE_CA) + .value("MAX_DYNAMIC_SHARED_SIZE_BYTES", + CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES) + .value("CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT", + CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT) #endif .value("MAX", CU_FUNC_ATTRIBUTE_MAX) ; @@ -1281,6 +1288,9 @@ BOOST_PYTHON_MODULE(_driver) #if CUDAPP_CUDA_VERSION >= 2020 .DEF_SIMPLE_METHOD(get_attribute) #endif +#if CUDAPP_CUDA_VERSION >= 10000 + .DEF_SIMPLE_METHOD(set_attribute) +#endif #if CUDAPP_CUDA_VERSION >= 3000 && defined(CUDAPP_POST_30_BETA) .DEF_SIMPLE_METHOD(set_cache_config) #endif -- GitLab