User-defined Functions#
- group User-defined Functions
Typedefs
-
using lto_fragments = std::span<lto_fragment const>#
Device modules linked into a JIT kernel.
Enums
Functions
- compiled_fragment compile_cuda_to_lto_ir(
- char const *source_code,
- std::span<char const*const> include_names,
- std::span<char const*const> includes,
- std::span<char const*const> include_paths,
- bool use_pch = true
Compiles CUDA device source into an owning LTO IR fragment.
Compiled fragments are cached by source, in-memory headers, ordered include paths and PCH use.
Filesystem headers and their dependencies must remain unchanged while caches may be reused; use versioned include paths when changing filesystem dependencies.
When PCH is enabled, headers used to build it must remain unchanged while it may be reused. Place changing headers after
#pragma nv_hdrstopor disable PCH.- Parameters:
source_code – Null-terminated CUDA source
include_names – Null-terminated names of additional in-memory headers
includes – Matching null-terminated header contents
include_paths – Filesystem header directories, searched before bundled header directories
use_pch – Enable automatic precompiled headers on supported NVRTC versions
- Throws:
std::invalid_argument – for mismatched header spans
std::runtime_error – if compilation fails
- Returns:
Shared ownership of the compiled bytes
-
struct lto_fragment#
- #include <cudf/udf.hpp>
A compiled device module to link into a JIT kernel.
A module may define multiple functions and reference functions in other modules. Keep its bytes alive until evaluation completes or a reusable transform program has been constructed.
Public Members
-
lto_binary_type type = lto_binary_type::LTO_IR#
Binary format of the module.
-
std::span<uint8_t const> data = {}#
The module’s bytes.
-
lto_binary_type type = lto_binary_type::LTO_IR#
-
struct compiled_fragment#
- #include <cudf/udf.hpp>
Shares ownership of compiled device code; copies retain the same storage.
Byte views do not own storage. Keep an owner alive while passing a view to an LTO API.
Public Functions
-
lto_fragment view() const noexcept#
Returns a non-owning view of the compiled fragment.
- Returns:
Non-owning view of the compiled fragment
-
lto_fragment view() const noexcept#
-
using lto_fragments = std::span<lto_fragment const>#