Skip to content

[QDP] DLPack Tensor unsafe Cleanup Refactoring#1011

Open
0lai0 wants to merge 1 commit intoapache:mainfrom
0lai0:unsafe-dlpack-example
Open

[QDP] DLPack Tensor unsafe Cleanup Refactoring#1011
0lai0 wants to merge 1 commit intoapache:mainfrom
0lai0:unsafe-dlpack-example

Conversation

@0lai0
Copy link
Contributor

@0lai0 0lai0 commented Feb 3, 2026

Purpose of PR

This PR refactors DLPack tensor cleanup in qdp-core examples by introducing a shared helper (free_dlpack_tensor) in the DLPack module and updating examples to use it. This reduces duplicated unsafe code, adds defensive checks (null pointer / missing deleter), and improves error reporting when cleanup fails.

Related Issues or PRs

Related to #1009

Changes Made

  • Bug fix
  • New feature
  • Refactoring
  • Documentation
  • Test
  • CI/CD pipeline
  • Other

Breaking Changes

  • Yes
  • No

Checklist

  • Added or updated unit tests for all changes
  • Added or updated documentation for all changes
  • Successfully built and ran all unit tests or manual tests locally
  • PR title follows "MAHOUT-XXX: Brief Description" format (if related to an issue)
  • Code follows ASF guidelines

@rich7420
Copy link
Contributor

rich7420 commented Feb 3, 2026

@0lai0 thanks for the patch!
cloud you add a test for free_dlpack_tensor?

@0lai0
Copy link
Contributor Author

0lai0 commented Feb 3, 2026

Sure, Thanks @rich7420 .

@guan404ming guan404ming added this to the Qumat 0.6.0 milestone Feb 4, 2026
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.

3 participants