From c472f61bb0fed9773398f5dc250ce1858483ade8 Mon Sep 17 00:00:00 2001 From: Eyal Rozenberg Date: Thu, 20 Apr 2023 23:01:50 +0300 Subject: [PATCH] Fixes #499: Not building surface-reference- and texture-reference-related wrapper code with CUDA 12.x and later, due to deprecation Note: Made a related addition to `README.md` --- README.md | 1 + src/cuda/api/module.hpp | 2 ++ src/cuda/api/multi_wrapper_impls/module.hpp | 2 ++ 3 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 39d187d7..747cc5f9 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,7 @@ Finally, if you've started using the library in a publicly-available (FOSS or co Most, but not all, API calls in the Runtime, Driver, NVTX and NVRTC are covered by these wrappers. Specifically, the following are missing: * Execution graph management +* CUDA 12.x "texture objects", "surface objects" and "tensor objects" (textures and texture references, introduced in earlier CUDA versions, are supported) * Interoperability with OpenGL, Direct3D, EGL, VDAPU. Support for textures, arrays and surfaces exists, but is partial: Not all relevant API functions are covered. diff --git a/src/cuda/api/module.hpp b/src/cuda/api/module.hpp index e9afc094..fd6bf9dc 100644 --- a/src/cuda/api/module.hpp +++ b/src/cuda/api/module.hpp @@ -138,8 +138,10 @@ class module_t { // TODO: Implement a surface reference and texture reference class rather than these raw pointers. +#if CUDA_VERSION <= 12000 CUsurfref get_surface(const char* name) const; CUtexref get_texture_reference(const char* name) const; +#endif protected: // constructors diff --git a/src/cuda/api/multi_wrapper_impls/module.hpp b/src/cuda/api/multi_wrapper_impls/module.hpp index d30e2e0a..e55230c0 100644 --- a/src/cuda/api/multi_wrapper_impls/module.hpp +++ b/src/cuda/api/multi_wrapper_impls/module.hpp @@ -124,6 +124,7 @@ inline module_t load_from_file( inline context_t module_t::context() const { return context::detail_::from_handle(context_handle_); } inline device_t module_t::device() const { return device::get(context::detail_::get_device_id(context_handle_)); } +#if CUDA_VERSION <= 12000 inline CUsurfref module_t::get_surface(const char* name) const { context::current::detail_::scoped_override_t set_context_for_this_scope(context_handle_); @@ -143,6 +144,7 @@ inline CUtexref module_t::get_texture_reference(const char* name) const + module::detail_::identify(*this)); return raw_texture_reference; } +#endif } // namespace cuda