cuda-api-wrappers
Thin C++-flavored wrappers for the CUDA Runtime API
cuda::rtc::compilation_output_t< cuda_cpp > Class Template Reference

Output of CUDA C++ code JIT-compilation. More...

#include <compilation_output.hpp>

Inheritance diagram for cuda::rtc::compilation_output_t< cuda_cpp >:
Collaboration diagram for cuda::rtc::compilation_output_t< cuda_cpp >:

Public Types

using parent = compilation_output_base_t< cuda_cpp >
 
- Public Types inherited from cuda::rtc::compilation_output_base_t< cuda_cpp >
using handle_type = program::handle_t< source_kind >
 
using status_type = status_t< source_kind >
 

Public Member Functions

span< char > ptx (span< char > buffer) const
 Obtain a (nul-terminated) copy of the PTX result of the last compilation. More...
 
unique_span< char > ptx () const
 Obtain a copy of the PTX resulting from the program compilation. More...
 
bool has_ptx () const
 
const char * get_mangling_of (const char *unmangled_name) const
 Obtain the mangled/lowered form of an expression registered earlier, after the compilation. More...
 
const char * get_mangling_of (const ::std::string &unmangled_name) const
 Obtain the mangled/lowered form of an expression registered earlier, after the compilation. More...
 
- Public Member Functions inherited from cuda::rtc::compilation_output_base_t< cuda_cpp >
bool succeeded () const
 
bool failed () const
 
 operator bool () const
 
const ::std::string & program_name () const
 
handle_type program_handle () const
 
span< char > log (span< char > buffer) const
 Write a copy of the program compilation log into a user-provided buffer. More...
 
unique_span< char > log () const
 Obtain a copy of the compilation log. More...
 
 compilation_output_base_t (compilation_output_base_t &&other) noexcept
 
compilation_output_base_toperator= (const compilation_output_base_t &other)=delete
 
compilation_output_base_toperator= (compilation_output_base_t &&other)=delete
 

Additional Inherited Members

- Static Public Attributes inherited from cuda::rtc::compilation_output_base_t< cuda_cpp >
static constexpr const source_kind_t source_kind
 

Detailed Description

template<>
class cuda::rtc::compilation_output_t< cuda_cpp >

Output of CUDA C++ code JIT-compilation.

Member Function Documentation

◆ get_mangling_of() [1/2]

const char* cuda::rtc::compilation_output_t< cuda_cpp >::get_mangling_of ( const char *  unmangled_name) const
inline

Obtain the mangled/lowered form of an expression registered earlier, after the compilation.

Parameters
unmangled_nameA name of a __global__ or __device__ function or variable.
Returns
The mangled name (which can actually be used for invoking kernels, moving data etc.). The memory is owned by the NVRTC program and will be released when it is destroyed.

◆ get_mangling_of() [2/2]

const char* cuda::rtc::compilation_output_t< cuda_cpp >::get_mangling_of ( const ::std::string &  unmangled_name) const
inline

Obtain the mangled/lowered form of an expression registered earlier, after the compilation.

Parameters
unmangled_nameA name of a __global__ or __device__ function or variable.
Returns
The mangled name (which can actually be used for invoking kernels, moving data etc.). The memory is owned by the NVRTC program and will be released when it is destroyed.

◆ has_ptx()

bool cuda::rtc::compilation_output_t< cuda_cpp >::has_ptx ( ) const
inline
Returns
true if the program has been successfully compiled, with the result containing PTX code

◆ ptx() [1/2]

span<char> cuda::rtc::compilation_output_t< cuda_cpp >::ptx ( span< char >  buffer) const
inline

Obtain a (nul-terminated) copy of the PTX result of the last compilation.

Note
the PTX may be missing in cases such as compilation failure or link-time optimization compilation.
This will fail if the program has never been compiled. Write a copy of the PTX resulting from the compilation into a user-provided buffer
Parameters
[in,out]bufferA writable buffer large enough to contain the compiled program's PTX code.
Returns
The sub-buffer, starting at the beginning of buffer, containing exactly the compiled program's PTX (i.e. sized down to fit the contents)
Note
This will throw if the program has never been compiled, or if the buffer is not large enough to contain the compiled PTX code.

◆ ptx() [2/2]

unique_span<char> cuda::rtc::compilation_output_t< cuda_cpp >::ptx ( ) const
inline

Obtain a copy of the PTX resulting from the program compilation.

Returns
an owning container with a nul-terminated copy of the PTX code
Note
This will fail if the program compilation has not produced any PTX

The documentation for this class was generated from the following file: