From f28d14749c65817e6bb39a243b0c0b5cfdebf875 Mon Sep 17 00:00:00 2001 From: "Mads R. B. Kristensen" Date: Mon, 22 Aug 2022 12:47:43 +0200 Subject: [PATCH] Revert "column_view: add owner" This reverts commit 9da6b5b6b015cef9fa14cca7eee5b449c88a7ed9. --- cpp/include/cudf/column/column_view.hpp | 23 +++--------- cpp/src/column/column_view.cpp | 17 ++++----- .../cudf/cudf/_lib/cpp/column/column_view.pxd | 35 +++---------------- 3 files changed, 14 insertions(+), 61 deletions(-) diff --git a/cpp/include/cudf/column/column_view.hpp b/cpp/include/cudf/column/column_view.hpp index f7ecb0baf89..217f88e67f9 100644 --- a/cpp/include/cudf/column/column_view.hpp +++ b/cpp/include/cudf/column/column_view.hpp @@ -22,7 +22,6 @@ #include #include -#include #include #include @@ -240,8 +239,6 @@ class column_view_base { mutable size_type _null_count{}; ///< The number of null elements size_type _offset{}; ///< Index position of the first element. ///< Enables zero-copy slicing - std::shared_ptr _owner; ///< Pointer to the owner (if any) of the device - ///< memory allocation. column_view_base() = default; ~column_view_base() = default; @@ -285,19 +282,15 @@ class column_view_base { * @param data Pointer to device memory containing the column elements * @param null_mask Optional, pointer to device memory containing the null * indicator bitmask - * @param null_count Optional, the number of null elements + * @param null_count Optional, the number of null elements. * @param offset optional, index of the first element - * @param owner optional, object to which the lifetime of the device memory - * allocation is tied. If provided, a reference to this object is kept until - * destruction */ column_view_base(data_type type, size_type size, void const* data, bitmask_type const* null_mask = nullptr, size_type null_count = UNKNOWN_NULL_COUNT, - size_type offset = 0, - std::shared_ptr owner = nullptr); + size_type offset = 0); }; class mutable_column_view_base : public column_view_base { @@ -383,9 +376,6 @@ class column_view : public detail::column_view_base { * @param offset optional, index of the first element * @param children optional, depending on the element type, child columns may * contain additional data - * @param owner optional, object to which the lifetime of the device memory - * allocation is tied. If provided, a reference to this object is kept until - * destruction */ column_view(data_type type, size_type size, @@ -393,8 +383,7 @@ class column_view : public detail::column_view_base { bitmask_type const* null_mask = nullptr, size_type null_count = UNKNOWN_NULL_COUNT, size_type offset = 0, - std::vector const& children = {}, - std::shared_ptr owner = nullptr); + std::vector const& children = {}); /** * @brief Returns the specified child @@ -542,9 +531,6 @@ class mutable_column_view : public detail::column_view_base { * @param offset optional, index of the first element * @param children optional, depending on the element type, child columns may * contain additional data - * @param owner optional, object to which the lifetime of the device memory - * allocation is tied. If provided, a reference to this object is kept until - * destruction */ mutable_column_view(data_type type, size_type size, @@ -552,8 +538,7 @@ class mutable_column_view : public detail::column_view_base { bitmask_type* null_mask = nullptr, size_type null_count = cudf::UNKNOWN_NULL_COUNT, size_type offset = 0, - std::vector const& children = {}, - std::shared_ptr owner = nullptr); + std::vector const& children = {}); /** * @brief Returns pointer to the base device memory allocation casted to diff --git a/cpp/src/column/column_view.cpp b/cpp/src/column/column_view.cpp index c2c72080dd6..2ff088a3f20 100644 --- a/cpp/src/column/column_view.cpp +++ b/cpp/src/column/column_view.cpp @@ -36,15 +36,13 @@ column_view_base::column_view_base(data_type type, void const* data, bitmask_type const* null_mask, size_type null_count, - size_type offset, - std::shared_ptr owner) + size_type offset) : _type{type}, _size{size}, _data{data}, _null_mask{null_mask}, _null_count{null_count}, - _offset{offset}, - _owner{owner} + _offset{offset} { CUDF_EXPECTS(size >= 0, "Column size cannot be negative."); @@ -145,10 +143,8 @@ column_view::column_view(data_type type, bitmask_type const* null_mask, size_type null_count, size_type offset, - std::vector const& children, - std::shared_ptr owner) - : detail::column_view_base{type, size, data, null_mask, null_count, offset, owner}, - _children{children} + std::vector const& children) + : detail::column_view_base{type, size, data, null_mask, null_count, offset}, _children{children} { if (type.id() == type_id::EMPTY) { CUDF_EXPECTS(num_children() == 0, "EMPTY column cannot have children."); @@ -162,9 +158,8 @@ mutable_column_view::mutable_column_view(data_type type, bitmask_type* null_mask, size_type null_count, size_type offset, - std::vector const& children, - std::shared_ptr owner) - : detail::column_view_base{type, size, data, null_mask, null_count, offset, owner}, + std::vector const& children) + : detail::column_view_base{type, size, data, null_mask, null_count, offset}, mutable_children{children} { if (type.id() == type_id::EMPTY) { diff --git a/python/cudf/cudf/_lib/cpp/column/column_view.pxd b/python/cudf/cudf/_lib/cpp/column/column_view.pxd index e9256e4fe01..39c1c958531 100644 --- a/python/cudf/cudf/_lib/cpp/column/column_view.pxd +++ b/python/cudf/cudf/_lib/cpp/column/column_view.pxd @@ -1,7 +1,6 @@ -# Copyright (c) 2020-2022, NVIDIA CORPORATION. +# Copyright (c) 2020, NVIDIA CORPORATION. from libcpp cimport bool -from libcpp.memory cimport shared_ptr from libcpp.vector cimport vector from cudf._lib.cpp.types cimport bitmask_type, data_type, size_type @@ -55,17 +54,6 @@ cdef extern from "cudf/column/column_view.hpp" namespace "cudf" nogil: vector[column_view] children ) except + - column_view( - data_type type, - size_type size, - const void* data, - const bitmask_type* null_mask, - size_type null_count, - size_type offset, - vector[column_view] children, - shared_ptr[void] owner - ) except + - const T* data[T]() except + const T* head[T]() except + const bitmask_type* null_mask() except + @@ -114,24 +102,9 @@ cdef extern from "cudf/column/column_view.hpp" namespace "cudf" nogil: ) except + mutable_column_view( - data_type type, - size_type size, - const void* data, - const bitmask_type* null_mask, - size_type null_count, - size_type offset, - vector[mutable_column_view] children - ) except + - - mutable_column_view( - data_type type, - size_type size, - const void* data, - const bitmask_type* null_mask, - size_type null_count, - size_type offset, - vector[mutable_column_view] children, - shared_ptr[void] owner + data_type type, size_type size, const void* data, + const bitmask_type* null_mask, size_type null_count, + size_type offset, vector[mutable_column_view] children ) except + T* data[T]() except +