Skip to content

Conversation

@cpcloud
Copy link
Contributor

@cpcloud cpcloud commented Dec 15, 2025

Revert the revert of StridedLayout and privatize as _StridedLayout

Summary

This PR reverts the removal of StridedLayout (reverting #1370) and
immediately privatizes it to _StridedLayout to unblock ongoing work while
avoiding premature API stabilization.

Motivation

The original StridedLayout implementation was reverted in #1370, but this
blocked work that depends on the internal layout infrastructure. Rather than
keeping the code removed, we've chosen to:

  1. Restore the implementation - Bring back all StridedLayout functionality
  2. Privatize the API - Rename StridedLayout to _StridedLayout (making it internal-only)
  3. Remove from documentation - Ensure no public API promises are made

This approach allows internal and experimental code to continue using the
layout functionality while clearly signaling that the API is not yet stable.

Changes

  • Reverted commit d8e9317 which removed StridedLayout
  • Renamed StridedLayout to _StridedLayout throughout the codebase
  • Removed _StridedLayout from public API documentation
  • Updated all tests to use the privatized name

Follow-up Work

An immediate follow-up PR will refactor StridedMemoryView.from_buffer to
remove the _StridedLayout parameter and replace it with explicit stride and
shape arguments. This will further reduce the API surface of the internal
layout implementation.

@copy-pr-bot
Copy link
Contributor

copy-pr-bot bot commented Dec 15, 2025

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

Contributors can view more details about this message here.

@cpcloud
Copy link
Contributor Author

cpcloud commented Dec 15, 2025

/ok to test d61ed66

@cpcloud cpcloud requested a review from leofang December 15, 2025 20:57
@github-actions

This comment has been minimized.

@leofang leofang added this to the cuda.core beta 10 milestone Dec 15, 2025
@leofang leofang added P0 High priority - Must do! feature New feature or request cuda.core Everything related to the cuda.core module labels Dec 15, 2025
@cpcloud cpcloud enabled auto-merge (squash) December 15, 2025 21:33

@classmethod
def from_buffer(
cls, buffer : Buffer, layout : _StridedLayout,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Happy to defer it to a follow up but having this constructor require a private class isn't ideal. Should we make this private as well?

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 will address these comments in the from_buffer PR follow-up.

dlm_tensor = <DLManagedTensor*>data
dlm_tensor.deleter(dlm_tensor)

def view(
Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

raise NotImplementedError("Sorry, not supported: copy_to")

@property
def layout(self) -> _StridedLayout:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we make this private for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do in a follow-up.

@cpcloud
Copy link
Contributor Author

cpcloud commented Dec 15, 2025

/ok to test

@cpcloud
Copy link
Contributor Author

cpcloud commented Dec 15, 2025

/ok to test

@leofang
Copy link
Member

leofang commented Dec 16, 2025

Let me admin-merge this PR. All other CI pipelines are green but one, which seems to be causing the main branch to fail as well. I've raised a thread internally.

@leofang leofang disabled auto-merge December 16, 2025 00:18
@leofang leofang merged commit 1f1f479 into NVIDIA:main Dec 16, 2025
153 of 156 checks passed
@leofang leofang mentioned this pull request Dec 16, 2025
2 tasks
@github-actions
Copy link

Doc Preview CI
Preview removed because the pull request was closed or merged.

@cpcloud cpcloud deleted the revert-revert branch December 16, 2025 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.core Everything related to the cuda.core module feature New feature or request P0 High priority - Must do!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants