Skip to content

fix(hipcub): Avoid zero-sized allocation when HMM is enabled#9246

Open
umfranzw wants to merge 1 commit into
developfrom
users/umfranzw/fix_hipcub_hmm_zero_alloc_test
Open

fix(hipcub): Avoid zero-sized allocation when HMM is enabled#9246
umfranzw wants to merge 1 commit into
developfrom
users/umfranzw/fix_hipcub_hmm_zero_alloc_test

Conversation

@umfranzw

@umfranzw umfranzw commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Motivation

While hipMalloc allows you to allocate buffers of size 0, hipMallocManaged does not. This was causing HipcubDeviceSegmentedRadixSort's SortKeysEmptyData test to fail.

JIRA ID: ROCM-27801

Technical Details

This change avoids the zero-sized allocation in the test, and adds a warning message that's printed to stderr whenever we attempt to allocate zero bytes using the hipMallocHelper function.

Test Plan

Export these:
export HSA_XNACK=1
export HIPCUB_USE_HMM=1

Build the test_hipcub_device_segmented_radix_sort target. Don't forget to enable xnack by appending :xnack+ to the GPU target. All tests should pass.

Test Result

Everything passes locally.

Submission Checklist

While hipMalloc allows you to allocate buffers of size 0, hipMallocManaged does not.
This was causing HipcubDeviceSegmentedRadixSort's SortKeysEmptyData test
to fail.

This change avoids the zero-sized allocation in the test, and adds a
warning message that's printed to stderr whenever we attempt to allocate
zero bytes using the hipMallocHelper function.
@umfranzw umfranzw requested a review from a team as a code owner July 9, 2026 19:52
@therock-pr-bot

therock-pr-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
🌿 Branch Name ✅ Pass
📝 PR Title/Description ✅ Pass
Forbidden Files ✅ Pass
🧪 Unit Test ✅ Pass
🔎 pre-commit ✅ Pass
🚫 Draft PR 🔜 To Be Enabled
🚩 Feature Flag 🔜 To Be Enabled
📊 Code Coverage 🔜 To Be Enabled
🤖 therock-pr-bot ✅ Pass

🎉 All checks passed! This PR is ready for review.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

@therock-pr-bot

therock-pr-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

🎉 All checks passed! This PR is ready for review.

@umfranzw umfranzw changed the title fix(hipcub) Avoid zero-sized allocation when HMM is enabled fix(hipcub): Avoid zero-sized allocation when HMM is enabled Jul 9, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

❌ Your project status has failed because the head coverage (76.92%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #9246   +/-   ##
========================================
  Coverage    64.99%   64.99%           
========================================
  Files         2685     2685           
  Lines       422116   422116           
  Branches     62707    62707           
========================================
  Hits        274344   274344           
  Misses      127073   127073           
  Partials     20699    20699           
Flag Coverage Δ *Carryforward flag
TensileLite 34.86% <ø> (ø) Carriedforward from 83cd82f
hipBLAS 90.81% <ø> (ø) Carriedforward from 83cd82f
hipBLASLt 34.71% <ø> (ø) Carriedforward from 83cd82f
hipCUB 82.68% <ø> (ø)
hipDNN 86.15% <ø> (ø) Carriedforward from 83cd82f
hipFFT 50.88% <ø> (ø) Carriedforward from 83cd82f
hipRAND 76.12% <ø> (ø) Carriedforward from 83cd82f
hipSOLVER 69.18% <ø> (ø) Carriedforward from 83cd82f
hipSPARSE 86.10% <ø> (ø) Carriedforward from 83cd82f
rocBLAS 47.91% <ø> (ø) Carriedforward from 83cd82f
rocFFT 50.80% <ø> (ø) Carriedforward from 83cd82f
rocRAND 57.02% <ø> (ø) Carriedforward from 83cd82f
rocSOLVER 76.92% <ø> (ø) Carriedforward from 83cd82f
rocSPARSE 72.37% <ø> (ø) Carriedforward from 83cd82f
rocThrust 91.36% <ø> (ø) Carriedforward from 83cd82f

*This pull request uses carry forward flags. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants