Skip to content

Remove rmm::device_buffer forward declaration from types.hpp - #23373

Merged
rapids-bot[bot] merged 2 commits into
NVIDIA:release/26.08from
davidwendt:remove-rmm-buffer-forward-declare
Jul 21, 2026
Merged

Remove rmm::device_buffer forward declaration from types.hpp#23373
rapids-bot[bot] merged 2 commits into
NVIDIA:release/26.08from
davidwendt:remove-rmm-buffer-forward-declare

Conversation

@davidwendt

Copy link
Copy Markdown
Contributor

Description

Fixes build error introduced by an RMM change. The forward declaration in types.hpp is not actually needed and removing it fixes the build errors.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@davidwendt davidwendt self-assigned this Jul 21, 2026
@davidwendt davidwendt added the 3 - Ready for Review Ready for review by team label Jul 21, 2026
@davidwendt
davidwendt requested a review from a team as a code owner July 21, 2026 16:58
@davidwendt davidwendt added libcudf Affects libcudf (C++/CUDA) code. improvement Improvement / enhancement to an existing function labels Jul 21, 2026
@davidwendt
davidwendt requested review from misiugodfrey and vyasr July 21, 2026 16:58
@davidwendt davidwendt added the non-breaking Non-breaking change label Jul 21, 2026
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds Java CUDA/architecture build automation, a stack-aware timeout wrapper for Polars tests, a masked numeric cast fix, related pandas testing updates, and removes an unused RMM forward declaration.

Changes

Java build pipeline

Layer / File(s) Summary
Java build scripts and CI orchestration
java/ci/*, .github/workflows/build.yaml, dependencies.yaml, java/pom.xml
Builds static libcudf and classifier-specific Java JARs for CUDA and architecture matrices, assembles Maven artifacts, and documents local and CI workflows.

Timeout-aware Polars testing

Layer / File(s) Summary
Timeout stack capture and test integration
ci/timeout_with_stack.py, ci/run_cudf_polars_*.sh, ci/test_wheel_cudf_polars.sh, conda/environments/*, python/cudf_polars/*
Adds process-tree stack capture and termination, replaces pytest timeout settings, and enables fail-fast test execution.

Masked dtype behavior

Layer / File(s) Summary
Non-mutating equivalent casts
python/cudf/cudf/core/column/numerical.py, python/cudf/cudf/tests/series/methods/test_astype.py, python/cudf/cudf/pandas/scripts/pandas-testing-plugin.py
Equivalent masked casts return new column wrappers, normalize nullable float NaNs, and update regression and pandas compatibility mappings.

Types header cleanup

Layer / File(s) Summary
Remove device buffer forward declaration
cpp/include/cudf/types.hpp
Removes the rmm::device_buffer forward declaration preceding the cudf namespace.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

Suggested labels: bug

Suggested reviewers: bdice, misiugodfrey, vyasr

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately and specifically summarizes the main change: removing the unnecessary rmm::device_buffer forward declaration from types.hpp.
Description check ✅ Passed The description is directly related to the change and correctly explains the build error fix and the removal of the unused forward declaration.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@davidwendt
davidwendt requested a review from bdice July 21, 2026 17:00
@davidwendt
davidwendt force-pushed the remove-rmm-buffer-forward-declare branch from b4809c5 to cfa473a Compare July 21, 2026 17:11
@davidwendt
davidwendt requested review from a team as code owners July 21, 2026 17:11
@github-actions github-actions Bot added Python Affects Python cuDF API. Java Affects Java cuDF API. cudf.pandas Issues specific to cudf.pandas cudf-polars Issues specific to cudf-polars labels Jul 21, 2026
@davidwendt
davidwendt changed the base branch from main to release/26.08 July 21, 2026 17:12
@GPUtester GPUtester moved this to In Progress in cuDF Python Jul 21, 2026
@davidwendt
davidwendt removed request for a team July 21, 2026 17:12
@robertmaynard

Copy link
Copy Markdown
Contributor

Hmm this is unfortunate. I guess this means that with rmm now adding the ABI version to the namespaces any forward declarations will also have to explicitly ABI-version the namespace they place those declarations in as well. Did we make rmm expose the current ABI namespace in a macro that is consumable by other projects? If we could put it in a standalone header that has nothing but that one line it would be safe to include in consuming projects, I think?

Yes we have access to the macros. So the forward dec will look like:

#include <rmm/detail/export.hpp>
RMM_NAMESPACE_BEGIN
class device_buffer;
RMM_NAMESPACE_END

@davidwendt

Copy link
Copy Markdown
Contributor Author

pre-commit.ci run

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (2)
ci/timeout_with_stack.py (1)

210-238: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Use psutil.wait_procs instead of sequential per-child waits.

terminate_process_tree waits on each child one at a time (child.wait(timeout=3) in a loop), so worst-case wait time scales with the number of children (up to 3s * N). psutil.wait_procs(children, timeout=3) waits on the whole list concurrently and returns (gone, alive), letting you kill only the processes that are actually still alive.

♻️ Proposed refactor
     try:
         parent = psutil.Process(pid)
         children = parent.children(recursive=True)

         # Terminate children first
         for child in children:
             with suppress(psutil.NoSuchProcess):
                 child.terminate()

-        # Create a copy of children list
-        terminated_children = list(children)
-
-        # Wait for all children to terminate
-        for child in terminated_children:
-            with suppress(psutil.TimeoutExpired):
-                child.wait(timeout=3)
-
-        # Kill any remaining children
-        for child in terminated_children:
-            with suppress(psutil.NoSuchProcess):
-                child.kill()
+        # Wait for all children concurrently, then kill any stragglers
+        _, alive = psutil.wait_procs(children, timeout=3)
+        for child in alive:
+            with suppress(psutil.NoSuchProcess):
+                child.kill()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ci/timeout_with_stack.py` around lines 210 - 238, Update
terminate_process_tree to replace the sequential terminated_children child.wait
loop with psutil.wait_procs(children, timeout=3), capturing its gone and alive
results; retain the existing termination flow, but kill only the processes
returned in alive while preserving suppression of processes that no longer
exist.
dependencies.yaml (1)

648-658: 📐 Maintainability & Code Quality | 🔵 Trivial

Consider sharing the boost/maven/openjdk trio with test_java via anchors.

boost, maven, and openjdk=8.* are duplicated verbatim in the existing test_java group (Line 1040-1042) and this new build_java group. This file already uses YAML anchors (e.g. &cmake_ver, &pandas) for shared packages elsewhere — doing the same here would prevent version drift between the two toolchains.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@dependencies.yaml` around lines 648 - 658, Deduplicate the shared boost,
maven, and openjdk=8.* entries between build_java and test_java using YAML
anchors and aliases, following the existing anchor conventions in
dependencies.yaml. Keep cuda-profiler-api and make specific to build_java, while
preserving the current package versions and group contents.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ci/run_cudf_polars_pytests.sh`:
- Line 1: Restore per-test timeout protection alongside the whole-run timeout:
add a compatible pytest-timeout setting for cudf_polars via the pyproject
configuration and retain the 240-second timeout for the vendored polars
invocation in run_cudf_polars_polars_tests.sh. Keep the 3600-second
timeout_with_stack.py wrapper, ensuring individual hangs are terminated well
before the overall timeout.

In `@python/cudf/cudf/core/column/numerical.py`:
- Around line 914-930: Update the equivalent-dtype cast path in
ColumnBase.astype, including the nullable-extension branch around
NumericalColumn and ColumnBase.create, so copy=True produces independent storage
rather than a wrapper over self.plc_column. Apply copy handling after all cast
paths or deep-copy the newly created result, while preserving the existing
NaN-to-null conversion behavior.

In `@python/cudf/cudf/tests/series/methods/test_astype.py`:
- Around line 1631-1652: Expand the parametrization for
test_astype_masked_equivalent_dtype_no_source_mutation to include empty,
all-null/all-NaN, single-element, and mixed numeric inputs, covering both
supported source dtypes where applicable. Preserve assertions for source dtype
immutability, equivalent masked result dtype, and pandas-equivalent values,
including NaN normalization.

---

Nitpick comments:
In `@ci/timeout_with_stack.py`:
- Around line 210-238: Update terminate_process_tree to replace the sequential
terminated_children child.wait loop with psutil.wait_procs(children, timeout=3),
capturing its gone and alive results; retain the existing termination flow, but
kill only the processes returned in alive while preserving suppression of
processes that no longer exist.

In `@dependencies.yaml`:
- Around line 648-658: Deduplicate the shared boost, maven, and openjdk=8.*
entries between build_java and test_java using YAML anchors and aliases,
following the existing anchor conventions in dependencies.yaml. Keep
cuda-profiler-api and make specific to build_java, while preserving the current
package versions and group contents.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 99dc10eb-f4a3-4747-9185-35369d3fe2be

📥 Commits

Reviewing files that changed from the base of the PR and between b4809c5 and cfa473a.

📒 Files selected for processing (28)
  • .github/workflows/build.yaml
  • ci/run_cudf_polars_polars_tests.sh
  • ci/run_cudf_polars_pytests.sh
  • ci/test_wheel_cudf_polars.sh
  • ci/timeout_with_stack.py
  • conda/environments/all_cuda-129_arch-aarch64.yaml
  • conda/environments/all_cuda-129_arch-x86_64.yaml
  • conda/environments/all_cuda-133_arch-aarch64.yaml
  • conda/environments/all_cuda-133_arch-x86_64.yaml
  • cpp/include/cudf/types.hpp
  • dependencies.yaml
  • java/ci/README.md
  • java/ci/argparse.sh
  • java/ci/assemble_maven_repo.sh
  • java/ci/build_cudf_java_jar.sh
  • java/ci/build_cudf_java_jar_in_container.sh
  • java/ci/build_static_libcudf.sh
  • java/ci/build_static_libcudf_in_container.sh
  • java/ci/test_java_build_local.sh
  • java/pom.xml
  • python/cudf/cudf/core/column/numerical.py
  • python/cudf/cudf/pandas/scripts/pandas-testing-plugin.py
  • python/cudf/cudf/tests/series/methods/test_astype.py
  • python/cudf_polars/pyproject.toml
  • python/cudf_polars/tests/conftest.py
  • python/cudf_polars/tests/expressions/test_rolling.py
  • python/cudf_polars/tests/streaming/test_scan.py
  • python/cudf_polars/tests/streaming/test_sort.py
💤 Files with no reviewable changes (6)
  • python/cudf_polars/tests/conftest.py
  • python/cudf_polars/tests/expressions/test_rolling.py
  • python/cudf_polars/tests/streaming/test_sort.py
  • cpp/include/cudf/types.hpp
  • python/cudf/cudf/pandas/scripts/pandas-testing-plugin.py
  • python/cudf_polars/tests/streaming/test_scan.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 3

🧹 Nitpick comments (2)
ci/timeout_with_stack.py (1)

210-238: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Use psutil.wait_procs instead of sequential per-child waits.

terminate_process_tree waits on each child one at a time (child.wait(timeout=3) in a loop), so worst-case wait time scales with the number of children (up to 3s * N). psutil.wait_procs(children, timeout=3) waits on the whole list concurrently and returns (gone, alive), letting you kill only the processes that are actually still alive.

♻️ Proposed refactor
     try:
         parent = psutil.Process(pid)
         children = parent.children(recursive=True)

         # Terminate children first
         for child in children:
             with suppress(psutil.NoSuchProcess):
                 child.terminate()

-        # Create a copy of children list
-        terminated_children = list(children)
-
-        # Wait for all children to terminate
-        for child in terminated_children:
-            with suppress(psutil.TimeoutExpired):
-                child.wait(timeout=3)
-
-        # Kill any remaining children
-        for child in terminated_children:
-            with suppress(psutil.NoSuchProcess):
-                child.kill()
+        # Wait for all children concurrently, then kill any stragglers
+        _, alive = psutil.wait_procs(children, timeout=3)
+        for child in alive:
+            with suppress(psutil.NoSuchProcess):
+                child.kill()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ci/timeout_with_stack.py` around lines 210 - 238, Update
terminate_process_tree to replace the sequential terminated_children child.wait
loop with psutil.wait_procs(children, timeout=3), capturing its gone and alive
results; retain the existing termination flow, but kill only the processes
returned in alive while preserving suppression of processes that no longer
exist.
dependencies.yaml (1)

648-658: 📐 Maintainability & Code Quality | 🔵 Trivial

Consider sharing the boost/maven/openjdk trio with test_java via anchors.

boost, maven, and openjdk=8.* are duplicated verbatim in the existing test_java group (Line 1040-1042) and this new build_java group. This file already uses YAML anchors (e.g. &cmake_ver, &pandas) for shared packages elsewhere — doing the same here would prevent version drift between the two toolchains.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@dependencies.yaml` around lines 648 - 658, Deduplicate the shared boost,
maven, and openjdk=8.* entries between build_java and test_java using YAML
anchors and aliases, following the existing anchor conventions in
dependencies.yaml. Keep cuda-profiler-api and make specific to build_java, while
preserving the current package versions and group contents.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ci/run_cudf_polars_pytests.sh`:
- Line 1: Restore per-test timeout protection alongside the whole-run timeout:
add a compatible pytest-timeout setting for cudf_polars via the pyproject
configuration and retain the 240-second timeout for the vendored polars
invocation in run_cudf_polars_polars_tests.sh. Keep the 3600-second
timeout_with_stack.py wrapper, ensuring individual hangs are terminated well
before the overall timeout.

In `@python/cudf/cudf/core/column/numerical.py`:
- Around line 914-930: Update the equivalent-dtype cast path in
ColumnBase.astype, including the nullable-extension branch around
NumericalColumn and ColumnBase.create, so copy=True produces independent storage
rather than a wrapper over self.plc_column. Apply copy handling after all cast
paths or deep-copy the newly created result, while preserving the existing
NaN-to-null conversion behavior.

In `@python/cudf/cudf/tests/series/methods/test_astype.py`:
- Around line 1631-1652: Expand the parametrization for
test_astype_masked_equivalent_dtype_no_source_mutation to include empty,
all-null/all-NaN, single-element, and mixed numeric inputs, covering both
supported source dtypes where applicable. Preserve assertions for source dtype
immutability, equivalent masked result dtype, and pandas-equivalent values,
including NaN normalization.

---

Nitpick comments:
In `@ci/timeout_with_stack.py`:
- Around line 210-238: Update terminate_process_tree to replace the sequential
terminated_children child.wait loop with psutil.wait_procs(children, timeout=3),
capturing its gone and alive results; retain the existing termination flow, but
kill only the processes returned in alive while preserving suppression of
processes that no longer exist.

In `@dependencies.yaml`:
- Around line 648-658: Deduplicate the shared boost, maven, and openjdk=8.*
entries between build_java and test_java using YAML anchors and aliases,
following the existing anchor conventions in dependencies.yaml. Keep
cuda-profiler-api and make specific to build_java, while preserving the current
package versions and group contents.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 99dc10eb-f4a3-4747-9185-35369d3fe2be

📥 Commits

Reviewing files that changed from the base of the PR and between b4809c5 and cfa473a.

📒 Files selected for processing (28)
  • .github/workflows/build.yaml
  • ci/run_cudf_polars_polars_tests.sh
  • ci/run_cudf_polars_pytests.sh
  • ci/test_wheel_cudf_polars.sh
  • ci/timeout_with_stack.py
  • conda/environments/all_cuda-129_arch-aarch64.yaml
  • conda/environments/all_cuda-129_arch-x86_64.yaml
  • conda/environments/all_cuda-133_arch-aarch64.yaml
  • conda/environments/all_cuda-133_arch-x86_64.yaml
  • cpp/include/cudf/types.hpp
  • dependencies.yaml
  • java/ci/README.md
  • java/ci/argparse.sh
  • java/ci/assemble_maven_repo.sh
  • java/ci/build_cudf_java_jar.sh
  • java/ci/build_cudf_java_jar_in_container.sh
  • java/ci/build_static_libcudf.sh
  • java/ci/build_static_libcudf_in_container.sh
  • java/ci/test_java_build_local.sh
  • java/pom.xml
  • python/cudf/cudf/core/column/numerical.py
  • python/cudf/cudf/pandas/scripts/pandas-testing-plugin.py
  • python/cudf/cudf/tests/series/methods/test_astype.py
  • python/cudf_polars/pyproject.toml
  • python/cudf_polars/tests/conftest.py
  • python/cudf_polars/tests/expressions/test_rolling.py
  • python/cudf_polars/tests/streaming/test_scan.py
  • python/cudf_polars/tests/streaming/test_sort.py
💤 Files with no reviewable changes (6)
  • python/cudf_polars/tests/conftest.py
  • python/cudf_polars/tests/expressions/test_rolling.py
  • python/cudf_polars/tests/streaming/test_sort.py
  • cpp/include/cudf/types.hpp
  • python/cudf/cudf/pandas/scripts/pandas-testing-plugin.py
  • python/cudf_polars/tests/streaming/test_scan.py
🛑 Comments failed to post (3)
ci/run_cudf_polars_pytests.sh (1)

1-1: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Per-test timeout granularity is replaced by a single whole-run timeout — confirm this trade-off is intended. All three sites share one root cause: pytest-timeout (45s per test in cudf_polars, 240s per test in the vendored polars suite) is dropped in favor of wrapping the entire pytest invocation in timeout_with_stack.py with a flat 3600s budget. A hang or pathological slowdown in any single test (especially under -n 4/--dist=worksteal, where it may not even be the first test to run) will now take up to an hour to be caught instead of tens of seconds, and -x only helps once a test actually fails/errors, not while it's hanging.

  • ci/run_cudf_polars_pytests.sh#L9-14: confirm the loss of per-test timeout is acceptable for cudf_polars tests, or consider keeping a pytest-timeout value (even a generous one) alongside the wrapper so individual hangs are still caught well before the 3600s ceiling.
  • ci/run_cudf_polars_polars_tests.sh#L65-99: same concern for the vendored polars suite, which previously enforced a 240s per-test ceiling via --timeout=240.
  • python/cudf_polars/pyproject.toml#L91-94: this is where the per-test timeout = 45 ini option is deleted; if per-test timeouts are kept, this is the config to restore (at a value compatible with running under the wrapper).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ci/run_cudf_polars_pytests.sh` at line 1, Restore per-test timeout protection
alongside the whole-run timeout: add a compatible pytest-timeout setting for
cudf_polars via the pyproject configuration and retain the 240-second timeout
for the vendored polars invocation in run_cudf_polars_polars_tests.sh. Keep the
3600-second timeout_with_stack.py wrapper, ensuring individual hangs are
terminated well before the overall timeout.
python/cudf/cudf/core/column/numerical.py (1)

914-930: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate the relevant implementations and surrounding context.
git ls-files 'python/cudf/cudf/core/column/*.py' 'python/cudf/cudf/core/column/*.pyx' | sed -n '1,200p'

echo '--- numerical.py outline ---'
ast-grep outline python/cudf/cudf/core/column/numerical.py --view expanded || true

echo '--- ColumnBase.astype references ---'
rg -n "def astype|astype\(" python/cudf/cudf/core/column -g '*.py' -g '*.pyx'

echo '--- ColumnBase.create references ---'
rg -n "def create|`@classmethod`\s+def create|ColumnBase\.create" python/cudf/cudf/core/column -g '*.py' -g '*.pyx'

echo '--- relevant slice of numerical.py ---'
sed -n '880,960p' python/cudf/cudf/core/column/numerical.py

echo '--- relevant slice of columnbase.py ---'
sed -n '1,260p' python/cudf/cudf/core/column/column.py

echo '--- deeper slice around astype in columnbase.py ---'
rg -n -A40 -B20 "def astype" python/cudf/cudf/core/column/column.py

Repository: rapidsai/cudf

Length of output: 46545


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- rest of ColumnBase.astype ---'
sed -n '2345,2395p' python/cudf/cudf/core/column/column.py

echo '--- ColumnBase.create implementation ---'
sed -n '930,1035p' python/cudf/cudf/core/column/column.py

echo '--- copy helpers / access semantics ---'
rg -n -A30 -B20 "copy=True|copy: bool|deep.*copy|plc_column.copy|self is result|result is self" python/cudf/cudf/core/column/column.py python/cudf/cudf/core/column/numerical.py

Repository: rapidsai/cudf

Length of output: 15229


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- astype docstrings / copy semantics ---'
sed -n '2298,2360p' python/cudf/cudf/core/column/column.py

echo '--- search for copy=True handling in astype-like APIs ---'
rg -n -A8 -B8 "astype\(.*copy: bool|copy=True|copy and result is self|return result.copy\(deep=copy\)" python/cudf/cudf/core/column -g '*.py'

echo '--- search for any tests or comments about astype(copy=...) ---'
rg -n "astype\(.*copy=|copy=True.*astype|equivalent.*dtype|shared storage|copy-on-write" python/cudf -g '*.py' -g '*.pyx'

Repository: rapidsai/cudf

Length of output: 11986


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- relevant Series/DataFrame astype docs / implementation ---'
rg -n -A20 -B10 "def astype\(.*copy=|copy-on-write|astype\(..., copy=False\)|astype\(dtype=.*copy=" python/cudf/cudf/core/indexed_frame.py python/cudf/cudf/core/frame.py python/cudf/cudf/core/index.py -g '*.py'

echo '--- the astype test that mentions equivalent masked dtype ---'
sed -n '1628,1675p' python/cudf/cudf/tests/series/methods/test_astype.py

echo '--- copy-on-write buffer semantics ---'
rg -n -A20 -B10 "copy-on-write|deep copy|shared data|write.*copy" python/cudf/cudf/core/buffer python/cudf/cudf/core/column -g '*.py'

Repository: rapidsai/cudf

Length of output: 34192


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- public astype docs ---'
rg -n -A18 -B8 "def astype\(|copy : bool|copy-on-write|Returns a new object" python/cudf/cudf/core/indexed_frame.py python/cudf/cudf/core/frame.py python/cudf/cudf/core/index.py -g '*.py'

echo '--- astype call sites in indexed_frame.py ---'
rg -n -A12 -B8 "\.astype\(.*copy=" python/cudf/cudf/core/indexed_frame.py -g '*.py'

echo '--- any dtype-equivalent cast tests with copy=True ---'
rg -n "equivalent dtype|masked dtype|copy=True" python/cudf/cudf/tests/series/methods/test_astype.py python/cudf/cudf/tests/dataframe/methods/test_astype.py python/cudf/cudf/tests/indexes/index/methods/test_astype.py -g '*.py'

Repository: rapidsai/cudf

Length of output: 44744


Honor copy=True for equivalent dtype casts. In python/cudf/cudf/core/column/numerical.py, this short-circuit builds a new wrapper over the same buffers, but ColumnBase.astype only deep-copies when result is self. That leaves astype(copy=True) on this path sharing storage with the source instead of returning an independent copy. Move the copy handling after all cast paths or deep-copy this branch too.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cudf/cudf/core/column/numerical.py` around lines 914 - 930, Update the
equivalent-dtype cast path in ColumnBase.astype, including the
nullable-extension branch around NumericalColumn and ColumnBase.create, so
copy=True produces independent storage rather than a wrapper over
self.plc_column. Apply copy handling after all cast paths or deep-copy the newly
created result, while preserving the existing NaN-to-null conversion behavior.
python/cudf/cudf/tests/series/methods/test_astype.py (1)

1631-1652: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Expand edge-case coverage for the new cast path.

The parametrization currently covers only non-empty, multi-element inputs. Add empty, all-null/all-NaN, single-element, and mixed numeric cases so NaN normalization and equivalent nullable dtype handling are exercised broadly.

As per coding guidelines, python/**/test_*.py tests must provide comprehensive coverage for empty, all-null, single-element, and mixed types.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/cudf/cudf/tests/series/methods/test_astype.py` around lines 1631 -
1652, Expand the parametrization for
test_astype_masked_equivalent_dtype_no_source_mutation to include empty,
all-null/all-NaN, single-element, and mixed numeric inputs, covering both
supported source dtypes where applicable. Preserve assertions for source dtype
immutability, equivalent masked result dtype, and pandas-equivalent values,
including NaN normalization.

Source: Coding guidelines

@mhaseeb123 mhaseeb123 moved this to Burndown in libcudf Jul 21, 2026
@mhaseeb123 mhaseeb123 removed this from cuDF Python Jul 21, 2026
@mhaseeb123 mhaseeb123 added 5 - Ready to Merge Testing and reviews complete, ready to merge and removed 3 - Ready for Review Ready for review by team labels Jul 21, 2026
@GPUtester GPUtester moved this to In Progress in cuDF Python Jul 21, 2026
@davidwendt

Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot
rapids-bot Bot merged commit 2e3d754 into NVIDIA:release/26.08 Jul 21, 2026
137 of 138 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in cuDF Python Jul 21, 2026
@davidwendt
davidwendt deleted the remove-rmm-buffer-forward-declare branch July 21, 2026 21:31
@vuule vuule moved this from Burndown to Landed in libcudf Jul 21, 2026
@GregoryKimball GregoryKimball removed this from libcudf Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5 - Ready to Merge Testing and reviews complete, ready to merge cudf.pandas Issues specific to cudf.pandas cudf-polars Issues specific to cudf-polars improvement Improvement / enhancement to an existing function Java Affects Java cuDF API. libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change Python Affects Python cuDF API.

Projects

Status: Done
Status: Landed

Development

Successfully merging this pull request may close these issues.

10 participants