diff --git a/src/cuda/api/library.hpp b/src/cuda/api/library.hpp index 26f4294c..0b8d93e6 100644 --- a/src/cuda/api/library.hpp +++ b/src/cuda/api/library.hpp @@ -264,7 +264,7 @@ library_t create( bool code_is_preserved = false) { handle_t new_lib_handle; - auto raw_link_opts = marshal(link_options); + auto raw_link_opts = link::detail_::marshal(link_options); struct { detail_::option_t options[1]; void* values[1]; @@ -272,7 +272,7 @@ library_t create( } raw_opts = { { CU_LIBRARY_BINARY_IS_PRESERVED }, { &code_is_preserved }, 1 }; auto status = creator( &new_lib_handle, data_source, - const_cast(raw_link_opts.options()), + const_cast(raw_link_opts.options()), const_cast(raw_link_opts.values()), raw_link_opts.count(), raw_opts.options, raw_opts.values, raw_opts.count ); diff --git a/src/cuda/api/link.hpp b/src/cuda/api/link.hpp index f2686b31..ef55571e 100644 --- a/src/cuda/api/link.hpp +++ b/src/cuda/api/link.hpp @@ -118,7 +118,7 @@ class link_t { // TODO: Replace this with methods which take wrapper classes. void add(link::input::image_t image, const link::options_t &ptx_compilation_options = {}) const { - auto marshalled_options = marshal(ptx_compilation_options); + auto marshalled_options = link::detail_::marshal(ptx_compilation_options); auto status = cuLinkAddData( handle_, static_cast(image.type), @@ -126,7 +126,7 @@ class link_t { image.size(), image.name, marshalled_options.count(), - const_cast(marshalled_options.options()), + const_cast(marshalled_options.options()), const_cast(marshalled_options.values()) ); throw_if_error_lazy(status, @@ -136,13 +136,13 @@ class link_t { void add_file(link::input::file_t file_input, const link::options_t &options) const { - auto marshalled_options = marshal(options); + auto marshalled_options = link::detail_::marshal(options); auto status = cuLinkAddFile( handle_, static_cast(file_input.type), file_input.path, marshalled_options.count(), - const_cast(marshalled_options.options()), + const_cast(marshalled_options.options()), const_cast(marshalled_options.values()) ); throw_if_error_lazy(status, @@ -222,10 +222,10 @@ namespace link { inline link_t create(const link::options_t &options = link::options_t{}) { handle_t new_link_handle; - auto marshalled_options = marshal(options); + auto marshalled_options = link::detail_::marshal(options); auto status = cuLinkCreate( marshalled_options.count(), - const_cast(marshalled_options.options()), + const_cast(marshalled_options.options()), const_cast(marshalled_options.values()), &new_link_handle ); diff --git a/src/cuda/api/link_options.hpp b/src/cuda/api/link_options.hpp index 56bad9e8..eaa7f47b 100644 --- a/src/cuda/api/link_options.hpp +++ b/src/cuda/api/link_options.hpp @@ -26,6 +26,8 @@ enum fallback_strategy_for_binary_code_t { prefer_using_compatible_binary = 1, }; +namespace detail_ { + using option_t = CUjit_option; struct marshalled_options_t { @@ -87,6 +89,8 @@ struct marshalled_options_t { const void * const * values() const { return value_buffer.data(); } }; +} // namespace detail_ + struct options_t final : public rtc::common_ptx_compilation_options_t { // Note: The sizes are used as parameters too. @@ -116,6 +120,8 @@ struct options_t final : public rtc::common_ptx_compilation_options_t { }; +namespace detail_ { + inline marshalled_options_t marshal(const options_t& link_options) { marshalled_options_t marshalled{}; @@ -177,6 +183,8 @@ inline marshalled_options_t marshal(const options_t& link_options) return marshalled; } +} // namespace detail_ + // TODO: Compiler "output options": // // threads per block targeted diff --git a/src/cuda/api/multi_wrapper_impls/module.hpp b/src/cuda/api/multi_wrapper_impls/module.hpp index bb2b0c0e..eb281544 100644 --- a/src/cuda/api/multi_wrapper_impls/module.hpp +++ b/src/cuda/api/multi_wrapper_impls/module.hpp @@ -75,12 +75,12 @@ inline module_t create(const context_t& context, const void* module_data, const { auto creator_function = [&link_options](handle_t& new_module_handle, const void* module_data_) { - auto marshalled_options = marshal(link_options); + auto marshalled_options = link::detail_::marshal(link_options); return cuModuleLoadDataEx( &new_module_handle, module_data_, marshalled_options.count(), - const_cast(marshalled_options.options()), + const_cast(marshalled_options.options()), const_cast(marshalled_options.values()) ); };