Skip to content

Conversation

@brandon-b-miller
Copy link
Contributor

@brandon-b-miller brandon-b-miller commented Oct 24, 2025

Part of #471

  • Adds a DeprecatedNDArrayAPIWarning emitted from all user facing functions for moving data around (cuda.to_device, driver.host_to_device, device_to_host, also as_cuda_array, is_cuda_array, etc
  • Separates existing now deprecated APIs into internal non-warning versions and external warning versions
  • Adds a deprecation warning to the DeviceNDArray ctor
  • Separates DeviceNDArray into a functionally equivalent internal class that doesn't warn and a public wrapper that does warn
  • Removes as many usages of the deprecated APIs as possible from the test suite in favor of cupy arrays
  • Catches warnings for tests of the currently exposed and now deprecated APIs
  • Where absolutely necessary, tests calls internal non-warning versions of the deprecated APIs
  • Rework tests to not use these apis as much as possible

@copy-pr-bot
Copy link

copy-pr-bot bot commented Oct 24, 2025

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@functools.wraps(func)
def wrapper(*args, **kwargs):
warnings.warn(
f"{func.__name__} api is deprecated. Please prefer cupy for array functions",
Copy link
Contributor

Choose a reason for hiding this comment

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

cupy arrays are much slower than DeviceNDArray because they require creating an external (i.e., non-numba-cuda-created) stream, so I'm not sure a recommendation for that is what we should do right now.

I was thinking that we can keep the top-level APIs (device_array etc.) and replace their internals with StridedMemoryView or something similar, in an effort to allow folks to as-cheaply-as-possible construct arrays.

Copy link
Contributor

Choose a reason for hiding this comment

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

Here's the current state of the art:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I concur that a light weight device array like container should exist, I'm just not sure that numba-cuda should necessarily be the library providing it publicly. I think we should nudge users away from using numba-cuda as such, like for moving data from host to device. That said, I'm open to suggestions on what we should recommend.

@gmarkall gmarkall added the 2 - In Progress Currently a work in progress label Oct 24, 2025
@rparolin rparolin added this to the next milestone Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2 - In Progress Currently a work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants