Public Member Functions | List of all members
cudf::transform_program Struct Reference

A reusable transform program that retains a JIT-compiled kernel. More...

#include <cudf/transform.hpp>

Public Member Functions

 transform_program (std::string const &udf, udf_source_type source_type, null_aware is_null_aware, std::optional< void * > user_data, std::span< transform_input const > inputs, std::span< transform_output const > outputs, std::span< std::unique_ptr< column > const > string_offsets)
 Constructs a reusable program by deriving specifications from transform arguments. More...
 
 transform_program (std::string const &udf, udf_source_type source_type, null_aware is_null_aware, std::optional< void * > user_data, std::span< transform_input_spec const > inputs, std::span< transform_output_spec const > outputs)
 Constructs a reusable program from explicit input and output specifications. More...
 
 transform_program (table_view const &table, std::span< std::reference_wrapper< ast::expression const > const > expressions, cuda::stream_ref stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 Constructs a reusable program for an AST expression. More...
 
 transform_program (transform_program &&other)
 Move constructor for transform_program. More...
 
transform_programoperator= (transform_program &&other)
 Move assignment operator for transform_program. More...
 
 transform_program (transform_program const &)=delete
 Deleted copy constructor.
 
transform_programoperator= (transform_program const &)=delete
 Deleted copy assignment.
 
 ~transform_program ()
 Destructor.
 
std::unique_ptr< tablerun (std::span< transform_input const > inputs, std::span< transform_output const > outputs, std::vector< std::unique_ptr< column >> &&string_offsets, std::optional< size_type > row_size, cuda::stream_ref stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 Runs the transform program on the given inputs and outputs. More...
 
std::unique_ptr< tablerun (table_view const &table, cuda::stream_ref stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 Evaluates the AST expressions used to construct this program on a table. More...
 

Detailed Description

A reusable transform program that retains a JIT-compiled kernel.

Construction retrieves the kernel for the UDF and the supplied input and output specifications. Subsequent calls to run reuse that kernel. Runtime inputs and outputs must be compatible with the specifications used at construction.

Definition at line 125 of file transform.hpp.

Constructor & Destructor Documentation

◆ transform_program() [1/4]

cudf::transform_program::transform_program ( std::string const &  udf,
udf_source_type  source_type,
null_aware  is_null_aware,
std::optional< void * >  user_data,
std::span< transform_input const >  inputs,
std::span< transform_output const >  outputs,
std::span< std::unique_ptr< column > const >  string_offsets 
)

Constructs a reusable program by deriving specifications from transform arguments.

The UDF kernel is retrieved during construction and retained for subsequent calls to run. The input and output objects are inspected only to derive their specifications and are not retained.

Parameters
udfThe PTX or CUDA source for the transform UDF
source_typeThe source type of udf
is_null_awareWhether the UDF receives row inputs as optional values
user_dataUser-defined device data, not owned by the program, retained and passed to the UDF by run
inputsInputs from which to derive the input specifications
outputsOutputs from which to derive the output type and nullability specifications
string_offsetsOptional string offsets used to determine each string output representation

◆ transform_program() [2/4]

cudf::transform_program::transform_program ( std::string const &  udf,
udf_source_type  source_type,
null_aware  is_null_aware,
std::optional< void * >  user_data,
std::span< transform_input_spec const >  inputs,
std::span< transform_output_spec const >  outputs 
)

Constructs a reusable program from explicit input and output specifications.

This overload enables composition without requiring concrete columns when the program is created. The UDF kernel is retrieved during construction and retained for subsequent calls to run.

Parameters
udfThe PTX or CUDA source for the transform UDF
source_typeThe source type of udf
is_null_awareWhether the UDF receives row inputs as optional values
user_dataUser-defined device data, not owned by the program, retained and passed to the UDF by run
inputsSpecifications of the transform inputs
outputsSpecifications of the transform outputs

◆ transform_program() [3/4]

cudf::transform_program::transform_program ( table_view const &  table,
std::span< std::reference_wrapper< ast::expression const > const >  expressions,
cuda::stream_ref  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

Constructs a reusable program for an AST expression.

The expression is lowered and its kernel is retrieved during construction. Literal values are retained by the program, while column inputs are rebound to the table passed to run.

Parameters
tableA table whose schema is used to lower the expression and retrieve its kernel
expressionsThe AST expressions to lower and construct the program from
streamCUDA stream used for device memory operations during construction
mrDevice memory resource used for device memory allocations during construction

◆ transform_program() [4/4]

cudf::transform_program::transform_program ( transform_program &&  other)

Move constructor for transform_program.

Parameters
otherThe transform_program to move from

Member Function Documentation

◆ operator=()

transform_program& cudf::transform_program::operator= ( transform_program &&  other)

Move assignment operator for transform_program.

Parameters
otherThe transform_program to move from
Returns
A reference to the current transform_program

◆ run() [1/2]

std::unique_ptr<table> cudf::transform_program::run ( std::span< transform_input const >  inputs,
std::span< transform_output const >  outputs,
std::vector< std::unique_ptr< column >> &&  string_offsets,
std::optional< size_type row_size,
cuda::stream_ref  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

Runs the transform program on the given inputs and outputs.

Exceptions
std::invalid_argumentif the inputs, outputs, or string offsets are not compatible with the specifications used to construct the program
Parameters
inputsThe inputs to the transform program
outputsThe outputs of the transform program
string_offsetsFor string output columns, the offsets can be pre-allocated and passed in to prevent overhead of compacting string views into run-end strings column.
row_sizeThe row size of the transform operation. If not provided, it will be inferred from the inputs.
streamCUDA stream used for device memory operations and kernel launches
mrDevice memory resource used to allocate the returned column's device memory
Returns
A table containing the columns resulting from applying the transform function to every element of the input according to the output specifications

◆ run() [2/2]

std::unique_ptr<table> cudf::transform_program::run ( table_view const &  table,
cuda::stream_ref  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

Evaluates the AST expressions used to construct this program on a table.

Exceptions
std::invalid_argumentif the table is not compatible with the specifications used to construct the program
Parameters
tableThe table used for expression evaluation
streamCUDA stream used for device memory operations and kernel launches
mrDevice memory resource used to allocate the returned column device memory
Returns
The table resulting from evaluating the expression

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