From af4f271c2625df4fdf15cea361422bc0fbba265e 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 + examples/other/array_management.cu | 1 - src/cuda/api/module.hpp | 2 ++ src/cuda/api/multi_wrapper_impls/module.hpp | 2 ++ 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d79b4c2e..a81be5d0 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/examples/other/array_management.cu b/examples/other/array_management.cu index c886d700..53774fa9 100644 --- a/examples/other/array_management.cu +++ b/examples/other/array_management.cu @@ -3,7 +3,6 @@ #include #include #include -#include using cuda::size_t; diff --git a/src/cuda/api/module.hpp b/src/cuda/api/module.hpp index 8451c477..2b20affc 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..ce025a48 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