diff --git a/src/cuda/api/detail/marshalled_options.hpp b/src/cuda/api/detail/option_marshalling.hpp similarity index 52% rename from src/cuda/api/detail/marshalled_options.hpp rename to src/cuda/api/detail/option_marshalling.hpp index f617c055..d3167a7d 100644 --- a/src/cuda/api/detail/marshalled_options.hpp +++ b/src/cuda/api/detail/option_marshalling.hpp @@ -1,5 +1,5 @@ -#ifndef SRC_CUDA_API_DETAIL_MARSHALLED_OPTIONS_HPP_ -#define SRC_CUDA_API_DETAIL_MARSHALLED_OPTIONS_HPP_ +#ifndef SRC_CUDA_API_DETAIL_OPTION_MARSHALLING_HPP_ +#define SRC_CUDA_API_DETAIL_OPTION_MARSHALLING_HPP_ #include "../types.hpp" @@ -12,7 +12,7 @@ namespace cuda { -namespace rtc { +namespace marshalling { namespace detail_ { @@ -117,10 +117,82 @@ MarshalTarget& operator<<(MarshalTarget& mt, detail_::opt_start_t& op } return mt; } + + +// A partial specialization gadget +template +struct gadget { + /** + * Uses the streaming/left-shift operator (<<) to render a delimited sequence of + * command-line-argument-like options (with or without a value as relevant) + * into some target entity - which could be a buffer of chars or a more complex + * structure like @ref marshalled_options_t. + */ + static void process( + const CompilationOptions &opts, MarshalTarget &marshalled, Delimiter delimiter, + bool need_delimiter_after_last_option); +}; + + +template +void process( + const CompilationOptions& opts, MarshalTarget& marshalled, Delimiter delimiter, + bool need_delimiter_after_last_option = false) +{ + return detail_::gadget::process( + opts, marshalled, delimiter, need_delimiter_after_last_option); +} + } // namespace detail_ -} // namespace rtc +/** + * Finalize a compilation options "building" object into a structure passable to some of the + * CUDA JIT compilation APIs + * + * @tparam Kind The kind of JITable program options to render + * + * @return A structure of multiple strings, passable to various CUDA APIs, but no longer + * easy to modify and manipulate. + */ +template +inline detail_::marshalled_options_t marshal(const CompilationOptions& opts) +{ + using detail_::marshalled_options_t; + marshalled_options_t marshalled; + // TODO: Can we easily determine the max number of options here? + enum : bool { need_delimiter_after_last_option = true }; + marshalling::detail_::process(opts, marshalled, marshalled_options_t::advance_gadget{}, + need_delimiter_after_last_option); + return marshalled; +} + +/** + * Finalize a set of options into the form of a string appendable to a command-line + * + * @tparam Kind The kind of options to render + * + * @return a string made up of command-line options - switches and options with arguments, + * designated by single or double dashes. + * + * @note An implementation of a processor/renderer of individual options must be + * provided via detail_::process() for this function to be usable with any particular + * type of options. + * + */ +template +inline ::std::string render(const CompilationOptions& opts) +{ + ::std::ostringstream oss; + detail_::process(opts, oss, ' '); + if (oss.tellp() > 0) { + // Remove the last, excessive, delimiter + oss.seekp(-1,oss.cur); + } + return oss.str(); +} + +} // namespace marshalling } // namespace cuda -#endif /* SRC_CUDA_API_DETAIL_MARSHALLED_OPTIONS_HPP_ */ +#endif /* SRC_CUDA_API_DETAIL_OPTION_MARSHALLING_HPP_ */ diff --git a/src/cuda/rtc/compilation_options.hpp b/src/cuda/rtc/compilation_options.hpp index 74d46670..ae1c6352 100644 --- a/src/cuda/rtc/compilation_options.hpp +++ b/src/cuda/rtc/compilation_options.hpp @@ -8,7 +8,7 @@ #ifndef CUDA_API_WRAPPERS_RTC_COMPILATION_OPTIONS_HPP_ #define CUDA_API_WRAPPERS_RTC_COMPILATION_OPTIONS_HPP_ -#include "detail/marshalled_options.hpp" +#include "cuda/api/detail/option_marshalling.hpp" #include "../api/device_properties.hpp" #include "../api/device.hpp" @@ -167,8 +167,7 @@ class compilation_options_t; template <> class compilation_options_t final : public compilation_options_base_t, - public common_ptx_compilation_options_t -{ + public common_ptx_compilation_options_t { public: ///@cond using parent = compilation_options_base_t; @@ -532,251 +531,201 @@ class compilation_options_t final : } }; // compilation_options_t -namespace detail_ { +template +inline ::std::string render(const CompilationOptions& opts) +{ + return marshalling::render(opts); +} -template -struct opt_start_t { - bool ever_used; - Delimiter delimiter_; +} // namespace rtc - opt_start_t(Delimiter delimiter) : ever_used(false), delimiter_(delimiter){ } -}; +namespace marshalling { -template -MarshalTarget& operator<<(MarshalTarget& mt, detail_::opt_start_t& opt_start) -{ - if (not opt_start.ever_used) { - opt_start.ever_used = true; - } - else { - mt << opt_start.delimiter_; - } - return mt; -} +namespace detail_ { -/** - * Uses the streaming/left-shift operator (<<) to render a delimited sequence of - * command-line-argument-like options (with or without a value as relevant) - * into some target entity - which could be a buffer of chars or a more complex - * structure like @ref marshalled_options_t. - */ template -void process( - const compilation_options_t& opts, MarshalTarget& marshalled, Delimiter delimiter, - bool need_delimiter_after_last_option = false) -{ - detail_::opt_start_t opt_start { delimiter }; - // TODO: Consider taking an option to be verbose in specifying compilation flags, and setting option values - // even when they are the compiler defaults. - - // flags - if (opts.generate_relocatable_device_code) { marshalled << opt_start << "--compile-only"; } - if (opts.compile_as_tools_patch) { marshalled << opt_start << "--compile-as-tools-patch"; } - if (opts.generate_debug_info) { marshalled << opt_start << "--device-debug"; } - if (opts.generate_source_line_info) { marshalled << opt_start << "--generate-line-info"; } - if (opts.compile_extensible_whole_program) { marshalled << opt_start << "--extensible-whole-program"; } - if (not opts.use_fused_multiply_add) { marshalled << opt_start << "--fmad false"; } - if (opts.verbose) { marshalled << opt_start << "--verbose"; } - if (opts.dont_merge_basicblocks) { marshalled << opt_start << "--dont-merge-basicblocks"; } +struct gadget, MarshalTarget, Delimiter> { + static void process( + const rtc::compilation_options_t &opts, + MarshalTarget &marshalled, Delimiter delimiter, + bool need_delimiter_after_last_option) { - const auto& osw = opts.situation_warnings; - if (osw.double_precision_ops) { marshalled << opt_start << "--warn-on-double-precision-use"; } - if (osw.local_memory_use) { marshalled << opt_start << "--warn-on-local-memory-usage"; } - if (osw.registers_spill_to_local_memory) { marshalled << opt_start << "--warn-on-spills"; } - if (not osw.indeterminable_stack_size) { marshalled << opt_start << "--suppress-stack-size-warning"; } - if (osw.double_demotion) { marshalled << opt_start << "--suppress-double-demote-warning"; } - } - if (opts.disable_warnings) { marshalled << opt_start << "--disable-warnings"; } - if (opts.disable_optimizer_constants) { marshalled << opt_start << "--disable-optimizer-constants"; } + opt_start_t opt_start { delimiter }; + // TODO: Consider taking an option to be verbose in specifying compilation flags, and setting option values + // even when they are the compiler defaults. + + // flags + if (opts.generate_relocatable_device_code) { marshalled << opt_start << "--compile-only"; } + if (opts.compile_as_tools_patch) { marshalled << opt_start << "--compile-as-tools-patch"; } + if (opts.generate_debug_info) { marshalled << opt_start << "--device-debug"; } + if (opts.generate_source_line_info) { marshalled << opt_start << "--generate-line-info"; } + if (opts.compile_extensible_whole_program) { marshalled << opt_start << "--extensible-whole-program"; } + if (not opts.use_fused_multiply_add) { marshalled << opt_start << "--fmad false"; } + if (opts.verbose) { marshalled << opt_start << "--verbose"; } + if (opts.dont_merge_basicblocks) { marshalled << opt_start << "--dont-merge-basicblocks"; } + { + const auto& osw = opts.situation_warnings; + if (osw.double_precision_ops) { marshalled << opt_start << "--warn-on-double-precision-use"; } + if (osw.local_memory_use) { marshalled << opt_start << "--warn-on-local-memory-usage"; } + if (osw.registers_spill_to_local_memory) { marshalled << opt_start << "--warn-on-spills"; } + if (not osw.indeterminable_stack_size) { marshalled << opt_start << "--suppress-stack-size-warning"; } + if (osw.double_demotion) { marshalled << opt_start << "--suppress-double-demote-warning"; } + } + if (opts.disable_warnings) { marshalled << opt_start << "--disable-warnings"; } + if (opts.disable_optimizer_constants) { marshalled << opt_start << "--disable-optimizer-constants"; } - if (opts.return_at_end_of_kernel) { marshalled << opt_start << "--return-at-end"; } - if (opts.preserve_variable_relocations) { marshalled << opt_start << "--preserve-relocs"; } + if (opts.return_at_end_of_kernel) { marshalled << opt_start << "--return-at-end"; } + if (opts.preserve_variable_relocations) { marshalled << opt_start << "--preserve-relocs"; } - // Non-flag single-value options + // Non-flag single-value options - if (opts.optimization_level) { - marshalled << opt_start << "--opt-level" << opts.optimization_level.value(); - if (opts.optimization_level.value() < O2 - and opts.allow_expensive_optimizations_below_O2) - { - marshalled << opt_start << "--allow-expensive-optimizations"; + if (opts.optimization_level) { + marshalled << opt_start << "--opt-level" << opts.optimization_level.value(); + if (opts.optimization_level.value() < rtc::O2 + and opts.allow_expensive_optimizations_below_O2) + { + marshalled << opt_start << "--allow-expensive-optimizations"; + } } - } - if (opts.maximum_register_counts.kernel) { - marshalled << opt_start << "--maxrregcount " << opts.maximum_register_counts.kernel.value(); - } - if (opts.maximum_register_counts.device_function) { - marshalled << opt_start << "--device-function-maxrregcount " << opts.maximum_register_counts.device_function.value(); - } + if (opts.maximum_register_counts.kernel) { + marshalled << opt_start << "--maxrregcount " << opts.maximum_register_counts.kernel.value(); + } + if (opts.maximum_register_counts.device_function) { + marshalled << opt_start << "--device-function-maxrregcount " << opts.maximum_register_counts.device_function.value(); + } - { - const auto& ocm = opts.caching_modes; - if (ocm.default_.load) { marshalled << opt_start << "--def-load-cache " << ocm.default_.load.value(); } - if (ocm.default_.store) { marshalled << opt_start << "--def-store-cache " << ocm.default_.store.value(); } - if (ocm.forced.load) { marshalled << opt_start << "--force-load-cache " << ocm.forced.load.value(); } - if (ocm.forced.store) { marshalled << opt_start << "--force-store-cache " << ocm.forced.store.value(); } - } + { + const auto& ocm = opts.caching_modes; + if (ocm.default_.load) { marshalled << opt_start << "--def-load-cache " << ocm.default_.load.value(); } + if (ocm.default_.store) { marshalled << opt_start << "--def-store-cache " << ocm.default_.store.value(); } + if (ocm.forced.load) { marshalled << opt_start << "--force-load-cache " << ocm.forced.load.value(); } + if (ocm.forced.store) { marshalled << opt_start << "--force-store-cache " << ocm.forced.store.value(); } + } - // Multi-value options + // Multi-value options - for(const auto& target : opts.targets_) { - auto prefix = opts.parse_without_code_generation ? "compute" : "sm"; - marshalled << opt_start << "--gpu-name=" << prefix << '_' << target.as_combined_number(); - } + for(const auto& target : opts.targets_) { + auto prefix = opts.parse_without_code_generation ? "compute" : "sm"; + marshalled << opt_start << "--gpu-name=" << prefix << '_' << target.as_combined_number(); + } - if (not opts.mangled_entry_function_names.empty()) { - marshalled << opt_start << "--entry"; - bool first = true; - for (const auto &entry: opts.mangled_entry_function_names) { - if (first) { first = false; } - else { marshalled << ','; } - marshalled << entry; + if (not opts.mangled_entry_function_names.empty()) { + marshalled << opt_start << "--entry"; + bool first = true; + for (const auto &entry: opts.mangled_entry_function_names) { + if (first) { first = false; } + else { marshalled << ','; } + marshalled << entry; + } } - } - if (need_delimiter_after_last_option) { - marshalled << opt_start; // If no options were marshalled, this does nothing + if (need_delimiter_after_last_option) { + marshalled << opt_start; // If no options were marshalled, this does nothing + } } -} +}; template -void process( - const compilation_options_t& opts, MarshalTarget& marshalled, Delimiter delimiter, - bool need_delimiter_after_last_option = false) -{ - detail_::opt_start_t opt_start { delimiter }; - if (opts.generate_relocatable_device_code) { marshalled << opt_start << "--relocatable-device-code=true"; } - if (opts.compile_extensible_whole_program) { marshalled << opt_start << "--extensible-whole-program=true"; } - if (opts.generate_debug_info) { marshalled << opt_start << "--device-debug"; } - if (opts.generate_source_line_info) { marshalled << opt_start << "--generate-line-info"; } - if (opts.support_128bit_integers) { marshalled << opt_start << "--device-int128"; } - if (opts.indicate_function_inlining) { marshalled << opt_start << "--optimization-info=inline"; } - if (opts.compiler_self_identification) { marshalled << opt_start << "--version-ident=true"; } - if (not opts.builtin_initializer_list) { marshalled << opt_start << "--builtin-initializer-list=false"; } - if (not opts.source_dirs_in_include_path) { marshalled << opt_start << "--no-source-include "; } - if (opts.extra_device_vectorization) { marshalled << opt_start << "--extra-device-vectorization"; } - if (opts.disable_warnings) { marshalled << opt_start << "--disable-warnings"; } - if (opts.assume_restrict) { marshalled << opt_start << "--restrict"; } - if (opts.default_execution_space_is_device) { marshalled << opt_start << "--device-as-default-execution-space"; } - if (not opts.display_error_numbers) { marshalled << opt_start << "--no-display-error-number"; } - if (not opts.builtin_move_and_forward) { marshalled << opt_start << "--builtin-move-forward=false"; } - if (not opts.increase_stack_limit_to_max) { marshalled << opt_start << "--modify-stack-limit=false"; } - if (opts.link_time_optimization) { marshalled << opt_start << "--dlink-time-opt"; } - if (opts.use_fast_math) { marshalled << opt_start << "--use_fast_math"; } - else { - if (opts.flush_denormal_floats_to_zero) { marshalled << opt_start << "--ftz"; } - if (not opts.use_precise_square_root) { marshalled << opt_start << "--prec-sqrt=false"; } - if (not opts.use_precise_division) { marshalled << opt_start << "--prec-div=false"; } - if (not opts.use_fused_multiply_add) { marshalled << opt_start << "--fmad=false"; } - } - if (opts.optimize_device_code_in_debug_mode) { - marshalled << opt_start << "--dopt=on"; - } - if (not opts.ptxas.empty()) { - marshalled << opt_start << "--ptxas-options=" << opts.ptxas; +struct gadget, MarshalTarget, Delimiter> { + static void process( + const rtc::compilation_options_t& opts, MarshalTarget& marshalled, Delimiter delimiter, + bool need_delimiter_after_last_option) + { + opt_start_t opt_start { delimiter }; + if (opts.generate_relocatable_device_code) { marshalled << opt_start << "--relocatable-device-code=true"; } + if (opts.compile_extensible_whole_program) { marshalled << opt_start << "--extensible-whole-program=true"; } + if (opts.generate_debug_info) { marshalled << opt_start << "--device-debug"; } + if (opts.generate_source_line_info) { marshalled << opt_start << "--generate-line-info"; } + if (opts.support_128bit_integers) { marshalled << opt_start << "--device-int128"; } + if (opts.indicate_function_inlining) { marshalled << opt_start << "--optimization-info=inline"; } + if (opts.compiler_self_identification) { marshalled << opt_start << "--version-ident=true"; } + if (not opts.builtin_initializer_list) { marshalled << opt_start << "--builtin-initializer-list=false"; } + if (not opts.source_dirs_in_include_path) { marshalled << opt_start << "--no-source-include "; } + if (opts.extra_device_vectorization) { marshalled << opt_start << "--extra-device-vectorization"; } + if (opts.disable_warnings) { marshalled << opt_start << "--disable-warnings"; } + if (opts.assume_restrict) { marshalled << opt_start << "--restrict"; } + if (opts.default_execution_space_is_device) { marshalled << opt_start << "--device-as-default-execution-space"; } + if (not opts.display_error_numbers) { marshalled << opt_start << "--no-display-error-number"; } + if (not opts.builtin_move_and_forward) { marshalled << opt_start << "--builtin-move-forward=false"; } + if (not opts.increase_stack_limit_to_max) { marshalled << opt_start << "--modify-stack-limit=false"; } + if (opts.link_time_optimization) { marshalled << opt_start << "--dlink-time-opt"; } + if (opts.use_fast_math) { marshalled << opt_start << "--use_fast_math"; } + else { + if (opts.flush_denormal_floats_to_zero) { marshalled << opt_start << "--ftz"; } + if (not opts.use_precise_square_root) { marshalled << opt_start << "--prec-sqrt=false"; } + if (not opts.use_precise_division) { marshalled << opt_start << "--prec-div=false"; } + if (not opts.use_fused_multiply_add) { marshalled << opt_start << "--fmad=false"; } + } + if (opts.optimize_device_code_in_debug_mode) { + marshalled << opt_start << "--dopt=on"; + } + if (not opts.ptxas.empty()) { + marshalled << opt_start << "--ptxas-options=" << opts.ptxas; - } + } - if (opts.language_dialect) { - marshalled << opt_start << "--std=" << detail_::cpp_dialect_names[static_cast(opts.language_dialect.value())]; - } + if (opts.language_dialect) { + marshalled << opt_start << "--std=" << rtc::detail_::cpp_dialect_names[static_cast(opts.language_dialect.value())]; + } - if (opts.maximum_register_count) { - marshalled << opt_start << "--maxrregcount=" << opts.maximum_register_count.value(); - } + if (opts.maximum_register_count) { + marshalled << opt_start << "--maxrregcount=" << opts.maximum_register_count.value(); + } - // Multi-value options + // Multi-value options - for(const auto& target : opts.targets_) { -#if CUDA_VERSION < 11000 - marshalled << opt_start << "--gpu-architecture=compute_" << target.as_combined_number(); -#else - marshalled << opt_start << "--gpu-architecture=sm_" << target.as_combined_number(); -#endif - } + for(const auto& target : opts.targets_) { + #if CUDA_VERSION < 11000 + marshalled << opt_start << "--gpu-architecture=compute_" << target.as_combined_number(); + #else + marshalled << opt_start << "--gpu-architecture=sm_" << target.as_combined_number(); + #endif + } - for(const auto& def : opts.undefines) { - marshalled << opt_start << "-U" << def; - // Note: Could alternatively use "--undefine-macro=" instead of "-D" - } + for(const auto& def : opts.undefines) { + marshalled << opt_start << "-U" << def; + // Note: Could alternatively use "--undefine-macro=" instead of "-D" + } - for(const auto& def : opts.no_value_defines) { - marshalled << opt_start << "-D" << def; - // Note: Could alternatively use "--define-macro=" instead of "-D" - } + for(const auto& def : opts.no_value_defines) { + marshalled << opt_start << "-D" << def; + // Note: Could alternatively use "--define-macro=" instead of "-D" + } - for(const auto& def : opts.valued_defines) { - marshalled << opt_start << "-D" << def.first << '=' << def.second; - } + for(const auto& def : opts.valued_defines) { + marshalled << opt_start << "-D" << def.first << '=' << def.second; + } - for(const auto& path : opts.additional_include_paths) { - marshalled << opt_start << "--include-path=" << path; - } + for(const auto& path : opts.additional_include_paths) { + marshalled << opt_start << "--include-path=" << path; + } - for(const auto& preinclude_file : opts.preinclude_files) { - marshalled << opt_start << "--pre-include=" << preinclude_file; - } + for(const auto& preinclude_file : opts.preinclude_files) { + marshalled << opt_start << "--pre-include=" << preinclude_file; + } - for(const auto& override : opts.error_handling_overrides) { - marshalled - << opt_start << "--diag-" << error::detail_::option_name_part(override.second) - << '=' << override.first ; - } + for(const auto& override : opts.error_handling_overrides) { + marshalled + << opt_start << "--diag-" << rtc::error::detail_::option_name_part(override.second) + << '=' << override.first ; + } - for(const auto& extra_opt : opts.extra_options) { - marshalled << opt_start << extra_opt; - } + for(const auto& extra_opt : opts.extra_options) { + marshalled << opt_start << extra_opt; + } - if (need_delimiter_after_last_option) { - marshalled << opt_start; // If no options were marshalled, this does nothing + if (need_delimiter_after_last_option) { + marshalled << opt_start; // If no options were marshalled, this does nothing + } } -} - -/** - * Finalize a compilation options "building" object into a structure passable to some of the - * CUDA JIT compilation APIs - * - * @tparam Kind The kind of JITable program options to render - * - * @return A structure of multiple strings, passable to various CUDA APIs, but no longer - * easy to modify and manipulate. - */ -template -inline marshalled_options_t marshal(const compilation_options_t& opts) -{ - marshalled_options_t mo; - // TODO: Can we easily determine the max number of options here? - constexpr bool need_delimiter_after_last_option { true }; - detail_::process(opts, mo, marshalled_options_t::advance_gadget{}, need_delimiter_after_last_option); - return mo; -} +}; } // namespace detail_ -/** - * Finalize a set of compilation options into the form of a string appendable to a command-line - * - * @tparam Kind The kind of JITable program options to render - * - * @return a string made up of command-line options - switches and options with arguments, - * designated by single or double dashes. - */ -template -inline ::std::string render(const compilation_options_t& opts) -{ - ::std::ostringstream oss; - detail_::process(opts, oss, ' '); - if (oss.tellp() > 0) { - // Remove the last, excessive, delimiter - oss.seekp(-1,oss.cur); - } - return oss.str(); -} - -} // namespace rtc +} // namespace marshalling } // namespace cuda diff --git a/src/cuda/rtc/detail/marshalled_options.hpp b/src/cuda/rtc/detail/marshalled_options.hpp deleted file mode 100644 index 25b1dba7..00000000 --- a/src/cuda/rtc/detail/marshalled_options.hpp +++ /dev/null @@ -1,107 +0,0 @@ -#ifndef SRC_CUDA_API_DETAIL_MARSHALLED_OPTIONS_HPP_ -#define SRC_CUDA_API_DETAIL_MARSHALLED_OPTIONS_HPP_ - -#include "../types.hpp" - -#include -#include -#include -#include -#include -#include - -namespace cuda { - -namespace rtc { - -namespace detail_ { - -// These two structs are streamed to a marshalled options object (see below) -// to indicate the start of a new option or the conclusion of all options, -// respectively - -template struct opt_start_t; - -template -struct is_marshalling_control : ::std::false_type {}; - -/** - * This class is necessary for realizing everything we need from - * the marshalled options: Easy access using an array of pointers, - * for the C API - and RAIIness for convenience and safety when - * using the wrapper classes. - */ -class marshalled_options_t { -public: - using size_type = size_t; - - struct advance_gadget {}; /// triggers an advance() when streamed into an object of this class - - marshalled_options_t() - { - option_positions.push_back(0); - } - marshalled_options_t(size_type max_num_options) - { - option_positions.reserve(max_num_options); - option_positions.push_back(0); - } - - marshalled_options_t(const marshalled_options_t&) = delete; - marshalled_options_t(marshalled_options_t&&) = default; - -protected: - mutable ::std::ostringstream oss; - mutable ::std::string finalized {}; - ::std::vector option_positions; - // Offsets into the eventually-created options string. - // Note that the last offset is to a not-yet-existing option -public: - - bool empty() const { - return oss.tellp() == 0; - } - - template ::type>::value>> - marshalled_options_t& operator<<(T&& x) - { - oss << x; - return *this; - } - - marshalled_options_t& advance() - { - oss << '\0'; - option_positions.push_back(oss.tellp()); - return *this; - } - - ::std::vector option_ptrs() const { - finalized = oss.str(); - auto ptrs = ::std::vector(); - ptrs.reserve(option_positions.size()-1); - const char* start = finalized.data(); - ::std::transform(option_positions.cbegin(), option_positions.cend() - 1, ::std::back_inserter(ptrs), - [start] (size_type pos){ return start + pos; }); - return ptrs; - } -}; - -inline marshalled_options_t& operator<< (marshalled_options_t& mo, marshalled_options_t::advance_gadget) -{ - mo.advance(); - return mo; -} - -template<> struct is_marshalling_control : ::std::true_type {}; - -template -struct is_marshalling_control> : ::std::true_type {}; - -} // namespace detail_ - -} // namespace rtc - -} // namespace cuda - -#endif /* SRC_CUDA_API_DETAIL_MARSHALLED_OPTIONS_HPP_ */ diff --git a/src/cuda/rtc/program.hpp b/src/cuda/rtc/program.hpp index a46a7940..1a5b748c 100644 --- a/src/cuda/rtc/program.hpp +++ b/src/cuda/rtc/program.hpp @@ -552,7 +552,7 @@ class program_t : public program::detail_::base_t { if ((source_ == nullptr or *source_ == '\0') and options_.preinclude_files.empty()) { throw ::std::invalid_argument("Attempt to compile a CUDA program without any source code"); } - auto marshalled_options = detail_::marshal(options_); + auto marshalled_options = cuda::marshalling::marshal(options_); ::std::vector option_ptrs = marshalled_options.option_ptrs(); return program::detail_::compile( name_.c_str(), @@ -723,7 +723,7 @@ class program_t : public program::detail_::base_t { if (source_ == nullptr or *source_ == '\0') { throw ::std::invalid_argument("Attempt to compile a CUDA program without any source code"); } - auto marshalled_options = detail_::marshal(options_); + auto marshalled_options = cuda::marshalling::marshal(options_); ::std::vector option_ptrs = marshalled_options.option_ptrs(); return program::detail_::compile_ptx( name_.c_str(),