Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
bedff71
Remove deprecated transform entry points
lamarrr Oct 27, 2026
0a5ccb7
Deprecate PTX binary operations in favor of transform
lamarrr Oct 27, 2026
fb8176a
Deprecate PTX binary operations and update copyright notices in bench…
lamarrr Oct 27, 2026
7fe292e
Refactor binary operation tests and update binaryop.pxd for improved …
lamarrr Oct 30, 2026
ea8c8f4
Merge branch 'main' into jit-ops-unify-2-deprecate-binary-ptx
lamarrr Oct 30, 2026
b3080ac
Refactor binary operation input and output handling to use std::array…
lamarrr Oct 31, 2026
daeeaf8
Add array header include to binaryop.cpp
lamarrr Oct 31, 2026
53b0b0f
Fix output initialization in binary operation to use uniform initiali…
lamarrr Nov 2, 2026
966eff2
Refactor JIT and PTX handling for improved performance and error prop…
lamarrr Nov 3, 2026
e6ed8b8
Merge remote-tracking branch 'upstream/main' into jit-ops-unify-2-dep…
lamarrr Nov 3, 2026
208d91f
Enhance header inclusions and clean up unused includes across multipl…
lamarrr Nov 4, 2026
5a0e59c
Merge remote-tracking branch 'upstream/main' into jit-ops-unify-2-dep…
lamarrr Nov 4, 2026
a667133
Update manually embedded target architecture to sm_75 across test files
lamarrr Nov 4, 2026
cd0ea04
Add missing testing main inclusion in PTX function tests
lamarrr Nov 4, 2026
8dcc84f
Merge branch 'main' into jit-ops-unify-2-deprecate-binary-ptx
lamarrr Nov 4, 2026
a0ce68f
Update target architecture from sm_75 to sm_70 across multiple PTX te…
lamarrr Nov 4, 2026
ff8ebc2
Merge branch 'jit-ops-unify-2-deprecate-binary-ptx' of https://github…
lamarrr Nov 4, 2026
e4493bb
Downgrade PTX version from 9.x to 6.3 in multiple test files for comp…
lamarrr Nov 4, 2026
40c60c1
Merge remote-tracking branch 'upstream/main' into jit-ops-unify-2-dep…
lamarrr Nov 4, 2026
c6827ac
Reorder include statements in transform.hpp for consistency
lamarrr Nov 5, 2026
e8b711e
Merge branch 'main' into jit-ops-unify-2-deprecate-binary-ptx
lamarrr Nov 5, 2026
ea86ef6
Refactor LTO binary type handling and add conversion function for RTC…
lamarrr Nov 5, 2026
4dccacc
Remove unnecessary blank line before get_linked_kernel function
lamarrr Nov 5, 2026
74a13b5
Merge branch 'main' into jit-ops-unify-2-deprecate-binary-ptx
lamarrr Nov 5, 2026
27c01a8
Merge branch 'main' into jit-ops-unify-2-deprecate-binary-ptx
lamarrr Nov 5, 2026
ac389a9
Refactor join filter template parameters and update UDF signature han…
lamarrr Nov 6, 2026
76dcad3
Merge remote-tracking branch 'upstream/main' into jit-ops-unify-2-dep…
lamarrr Nov 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -466,11 +466,6 @@ rtcx_embed_includes(
cudf/cpp/src/jit INCLUDE_DIRECTORIES cudf/cpp/src
)

rtcx_embed_includes(
cudf_cuda_embed SOURCE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/binaryop/jit DEST_DIRECTORY
cudf/cpp/src/binaryop/jit INCLUDE_DIRECTORIES cudf/cpp/src
)

rtcx_embed_includes(
cudf_cuda_embed SOURCE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/join/jit DEST_DIRECTORY
cudf/cpp/src/join/jit INCLUDE_DIRECTORIES cudf/cpp/src
Expand Down
15 changes: 14 additions & 1 deletion cpp/include/cudf/binaryop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,20 @@

#include <cudf/column/column.hpp>
#include <cudf/scalar/scalar.hpp>
#include <cudf/types.hpp>
#include <cudf/utilities/default_stream.hpp>
#include <cudf/utilities/export.hpp>
#include <cudf/utilities/memory_resource.hpp>
#include <cudf/utilities/traits.hpp>

#include <cuda/buffer>
#include <cuda/std/type_traits>
#include <cuda/stream>

#include <memory>
#include <string>
#include <type_traits>
#include <utility>

/**
* @file
Expand Down Expand Up @@ -333,6 +343,9 @@ std::unique_ptr<column> binary_operation(
* @brief Performs a binary operation between two columns using a
* user-defined PTX function.
*
* @deprecated in release 26.12 and will be removed in a future release. Use `cudf::transform`
* instead.
*
* The output contains the result of `op(lhs[i], rhs[i])` for all `0 <= i < lhs.size()`
*
* Regardless of the operator, the validity of the output value is the logical
Expand All @@ -352,7 +365,7 @@ std::unique_ptr<column> binary_operation(
* @throw cudf::logic_error if @p lhs and @p rhs dtypes aren't numeric
* @throw cudf::logic_error if @p output_type dtype isn't numeric
*/
std::unique_ptr<column> binary_operation(
[[deprecated("Use cudf::transform instead")]] std::unique_ptr<column> binary_operation(
Comment thread
lamarrr marked this conversation as resolved.
Resolved
column_view const& lhs,
column_view const& rhs,
std::string const& ptx,
Expand Down
5 changes: 3 additions & 2 deletions cpp/include/cudf/join/join.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <cstdint>
#include <memory>
#include <optional>
#include <string>
#include <utility>

/**
Expand Down Expand Up @@ -522,8 +523,8 @@ filter_join_indices_output_size(
* For both null-aware and non-null-aware predicates, the output value is uninitialized and must
* be set on every execution path.
* The remaining parameters correspond to columns in the left table followed by the right table.
* The CUDA function may return `cudf::errc` instead of `void` to report evaluation errors. PTX UDFs
* do not support returning errors.
* The CUDA function may return `cudf::errc` instead of `void` to report evaluation errors.
* PTX modules functions must return `cudf::errc` as a 32-bit integer status.
*
*
* @throw std::invalid_argument if join_kind is not INNER_JOIN, LEFT_JOIN, or FULL_JOIN.
Expand Down
12 changes: 10 additions & 2 deletions cpp/include/cudf/transform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@
#include <cudf/column/scalar_column_view.hpp>
#include <cudf/types.hpp>
#include <cudf/udf.hpp>
#include <cudf/utilities/default_stream.hpp>
#include <cudf/utilities/export.hpp>
#include <cudf/utilities/memory_resource.hpp>

#include <cuda/buffer>
#include <cuda/stream>

#include <cstdint>
#include <functional>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <utility>
#include <variant>
#include <vector>

Expand Down Expand Up @@ -237,6 +242,8 @@ struct transform_program {
* Computes:
* `(outputs[i]...) = UDF(inputs[i]...)`.
*
* PTX UDFs are linked as complete modules. The function must follow the CUDF UDF ABI.
*
* For both null-aware and non-null-aware UDFs, output values have the following initialization:
* - Fixed-width outputs have uninitialized values.
* - Mutable string outputs (`cuda::std::span<char>`, used with preallocated string offsets) contain
Expand Down Expand Up @@ -310,8 +317,9 @@ std::unique_ptr<table> transform(
* The size of the resulting column is the `row_size` if provided, otherwise it is inferred from
* the input and pre-allocated output columns.
*
* @param udf The LTO-IR fragment containing the transform function to apply. The UDF must
* be named `transform` and follow the CUDF UDF ABI
* @param udf The LTO-IR, FATBIN, or PTX fragment containing the transform function to
* apply. The UDF must follow the CUDF UDF ABI and be named `transform`. For PTX, the first function
* and references to it are renamed to `transform` before linking. PTX input must be null-terminated
* @param binary_type The type of the LTO binary provided in `udf`
* @param is_null_aware Signifies the UDF will receive row inputs as optional values
* @param user_data User-defined device data to pass to the UDF
Expand Down
3 changes: 2 additions & 1 deletion cpp/include/cudf/udf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ namespace CUDF_EXPORT cudf {
*/
enum class lto_binary_type : uint8_t {
LTO_IR, //< LTO-IR binary
FATBIN //< FATBIN binary
FATBIN, //< FATBIN binary
PTX //< Null-terminated PTX code string
};

/**
Expand Down
85 changes: 29 additions & 56 deletions cpp/src/binaryop/binaryop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,34 @@
*/

#include "compiled/binary_ops.hpp"
#include "jit/cache.hpp"
#include "jit/helpers.hpp"
#include "jit/parser.hpp"
#include "jit/util.hpp"

#include <cudf/binaryop.hpp>
#include <cudf/column/column_factories.hpp>
#include <cudf/detail/binaryop.hpp>
#include <cudf/detail/null_mask.hpp>
#include <cudf/detail/nvtx/ranges.hpp>
#include <cudf/replace.hpp>
#include <cudf/scalar/scalar.hpp>
#include <cudf/table/table.hpp>
#include <cudf/table/table_view.hpp>
#include <cudf/transform.hpp>
#include <cudf/types.hpp>
#include <cudf/utilities/error.hpp>
#include <cudf/utilities/traits.hpp>
#include <cudf/utilities/type_dispatcher.hpp>

#include <cuda/std/optional>
#include <cuda/stream>

#include <transform/checked_arithmetic.hpp>

#include <algorithm>
#include <array>
#include <cstdint>
#include <optional>
#include <span>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <utility>

namespace cudf {
namespace binops {
Expand Down Expand Up @@ -149,45 +153,6 @@ bool is_same_scale_necessary(binary_operator op)
op != binary_operator::MUL_OVERFLOW && op != binary_operator::DIV_OVERFLOW;
}

namespace jit {
void binary_operation(mutable_column_view& out,
column_view const& lhs,
column_view const& rhs,
std::string const& ptx,
cuda::stream_ref stream)
{
std::string const output_type_name = cudf::type_to_name(out.type());

std::string cuda_source =
cudf::jit::parse_single_function_ptx(ptx,
"GENERIC_BINARY_OP",
{
{0, output_type_name + " *"},
{1, cudf::type_to_name(lhs.type())},
{2, cudf::type_to_name(rhs.type())},
});

std::string kernel_reflection = rtcx::reflect_template("cudf::binops::jit::binary_op_kernel",
output_type_name,
cudf::type_to_name(lhs.type()),
cudf::type_to_name(rhs.type()),
"cudf::binops::jit::UserDefinedOp");

auto kernel = cudf::jit::get_udf_kernel(
"cudf/cpp/src/binaryop/jit/kernel.cu", kernel_reflection, cuda_source, {});
auto cfg = kernel.max_occupancy_config(0, 0);

kernel.launch_with({cfg.min_grid_size},
{cfg.block_size},
0,
stream,
static_cast<size_type>(out.size()),
cudf::jit::get_data_ptr(out),
cudf::jit::get_data_ptr(lhs),
cudf::jit::get_data_ptr(rhs));
}
} // namespace jit

// Compiled Binary operation
namespace compiled {

Expand Down Expand Up @@ -409,17 +374,25 @@ std::unique_ptr<column> binary_operation(column_view const& lhs,

CUDF_EXPECTS((lhs.size() == rhs.size()), "Column sizes don't match");

auto [new_mask, null_count] = cudf::detail::bitmask_and(table_view({lhs, rhs}), stream, mr);
auto out =
make_fixed_width_column(output_type, lhs.size(), std::move(new_mask), null_count, stream, mr);

// Check for 0 sized data
if (lhs.is_empty() or rhs.is_empty()) return out;

auto out_view = out->mutable_view();
binops::jit::binary_operation(out_view, lhs, rhs, ptx, stream);
out->set_null_count(cudf::detail::null_count(out_view.null_mask(), 0, out->size(), stream));
return out;
if (lhs.is_empty()) { return make_empty_column(output_type); }

std::array<transform_input, 2> inputs{lhs, rhs};
std::array<transform_output, 1> outputs{transform_output{.type = output_type}};

auto result =
cudf::transform_lto(std::span{reinterpret_cast<uint8_t const*>(ptx.data()), ptx.size()},
lto_binary_type::PTX,
null_aware::NO,
std::nullopt,
inputs,
outputs,
{},
std::nullopt,
stream,
mr.get_output_mr());

auto columns = result->release();
return std::move(columns.front());
}
} // namespace detail

Expand Down
87 changes: 0 additions & 87 deletions cpp/src/binaryop/jit/kernel.cu

This file was deleted.

13 changes: 13 additions & 0 deletions cpp/src/jit/cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,19 @@ rtcx::blob compile_fragment(char const* name,

} // namespace

rtcx::binary_type as_rtcx_binary_type(lto_binary_type type)
{
switch (type) {
case lto_binary_type::LTO_IR: return rtcx::binary_type::LTO_IR;
case lto_binary_type::FATBIN: return rtcx::binary_type::FATBIN;
case lto_binary_type::PTX: return rtcx::binary_type::PTX;
default:
CUDF_FAIL(
std::format("Unrecognized LTO binary type {} for LTO transform", static_cast<int>(type)),
std::invalid_argument);
}
}

kernel get_kernel(std::string const& name,
std::string const& source_file_id,
std::span<char const* const> header_include_names,
Expand Down
8 changes: 8 additions & 0 deletions cpp/src/jit/cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

#pragma once
#include <cudf/udf.hpp>
#include <cudf/utilities/export.hpp>

#include <cuda/stream>
Expand Down Expand Up @@ -72,6 +73,13 @@ struct [[nodiscard]] kernel {
}
};

/**
* @brief Converts an LTO binary type to the corresponding RTCX binary type
* @param type The LTO binary type to convert
* @return The corresponding RTCX binary type
*/
rtcx::binary_type as_rtcx_binary_type(lto_binary_type type);

/**
* @brief Gets a kernel from an embedded CUDA source file
* @param name Debug name for the kernel (used for caching and logging)
Expand Down
Loading
Loading