Skip to content

Add cuTENSOR safe wrapper#570

Open
g-ampo wants to merge 2 commits into
chelsea0x3b:mainfrom
g-ampo:cutensor-safe
Open

Add cuTENSOR safe wrapper#570
g-ampo wants to merge 2 commits into
chelsea0x3b:mainfrom
g-ampo:cutensor-safe

Conversation

@g-ampo

@g-ampo g-ampo commented May 6, 2026

Copy link
Copy Markdown

Add cuTENSOR safe wrapper

Closes #392.

  • safe.rs: CuTensor handle with contract() and reduce() managing the full pipeline (descriptors -> operation -> plan -> workspace -> execute -> cleanup). RAII wrappers for all intermediate objects.
  • result.rs: adds create_compute_descriptor / destroy_compute_descriptor via dynamic loading. cuTENSOR 2.2.0 segfaults on the predefined sentinel values that older versions accepted.

@g-ampo g-ampo requested a review from chelsea0x3b as a code owner May 6, 2026 21:59

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a safe abstraction layer for cuTENSOR, providing RAII wrappers for handles, descriptors, and execution plans, along with high-level methods for tensor contraction and reduction. It also enhances the low-level result module with dynamic library loading for compute descriptors. Review feedback identifies a misleading error message during library loading and recommends avoiding .unwrap() in Drop implementations to prevent potential process aborts during panics.

Comment thread src/cutensor/result.rs Outdated
Comment thread src/cutensor/safe.rs
Comment thread src/cutensor/safe.rs
Comment thread src/cutensor/safe.rs
Comment thread src/cutensor/safe.rs
Comment thread src/cutensor/safe.rs
@g-ampo g-ampo mentioned this pull request May 6, 2026
@g-ampo g-ampo changed the title add cutensor safe wrapper with RAII handles, tensor contraction, and … Add cuTENSOR safe wrapper May 6, 2026
@chelsea0x3b

Copy link
Copy Markdown
Owner

Hey I'm gonna be honest, this PR is way too big for me to review and needs to be split into multiple sub PRs. I appreciate the use of agents, but this is not set up nicely for me.

Did you run the tests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add cuTensor support

2 participants