Skip to content

Commit

Permalink
Fixes #499: Not building surface-reference- and texture-reference-rel…
Browse files Browse the repository at this point in the history
…ated wrapper code with CUDA 12.x and later, due to deprecation

Note: Made a related addition to `README.md`
  • Loading branch information
eyalroz authored and Eyal Rozenberg committed May 11, 2023
1 parent 3a3e44b commit af4f271
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion examples/other/array_management.cu
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <iostream>
#include <iomanip>
#include <numeric>
#include <limits>

using cuda::size_t;

Expand Down
2 changes: 2 additions & 0 deletions src/cuda/api/module.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/cuda/api/multi_wrapper_impls/module.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_);
Expand All @@ -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
Expand Down

0 comments on commit af4f271

Please sign in to comment.