Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java: Make ColumnVector.fromViewWithContiguousAllocation public #16784

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Changes from all commits
Commits
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
8 changes: 7 additions & 1 deletion java/src/main/java/ai/rapids/cudf/ColumnVector.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,13 @@ static long initViewHandle(DType type, int numRows, int nullCount,
od, vd, nullCount, numRows, childHandles);
}

static ColumnVector fromViewWithContiguousAllocation(long columnViewAddress, DeviceMemoryBuffer buffer) {
/**
* Creates a ColumnVector from a native column_view using a contiguous device allocation.
*
* @param columnViewAddress address of the native column_view
* @param buffer device buffer containing the data referenced by the column view
*/
public static ColumnVector fromViewWithContiguousAllocation(long columnViewAddress, DeviceMemoryBuffer buffer) {
Comment on lines +222 to +227
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the role that a "contiguous allocation" plays here? I see that it is just creating a ColumnVector from device buffer and nothing else, so not sure what I'm missing here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Contiguous allocation meaning all of the underlying buffers from this column view (i.e.: validity, offsets, data, and recursively from child columns) comes from this single buffer. Normally these things are allocated separately and thus are not from a single buffer. The way contiguous tables work in Java is that we build up ColumnVector instances from views (zero-copy, so not like column vs. column_view in native) that reference the underlying buffer (i.e.: via incRefCount). The buffer is then closed, decrementing the refcount, but it stays allocated because of all the columns referencing it. When the last column referencing the buffer is finally closed, the buffer is closed when its refcount goes to zero.

So we need the buffer in this method for the reference semantics, and that buffer is the contiguous allocation holding this column (and probably others).

return new ColumnVector(columnViewAddress, buffer);
}

Expand Down
Loading