Skip to content

Fix int32 overflow in rotating buffer size calculation#2298

Open
Z-Y00 wants to merge 1 commit into
ROCm:developfrom
Z-Y00:rotation-buffer-overflow
Open

Fix int32 overflow in rotating buffer size calculation#2298
Z-Y00 wants to merge 1 commit into
ROCm:developfrom
Z-Y00:rotation-buffer-overflow

Conversation

@Z-Y00
Copy link
Copy Markdown

@Z-Y00 Z-Y00 commented Mar 11, 2026

Motivation

This is Lorri Rao from AIG model team (lorri.rao@amd.com), trying to fix tensile tunning error for grouped gemm.

Technical Details

When rotating buffer sizes exceed ~2GB, the int32_t multiplication of rotatingNum * rotatingSize wraps negative (e.g. 838926336 * 3 = -1778188288), causing "Insufficient rotating buffer size" abort.
Very similar like 4GB overflow error for 32 sized datatype in memory allocation.
Use int64_t for rotatingNum and totalRotatingSizeNeeded to handle large grouped GEMM buffer allocations correctly.

Test Plan

NA

Test Result

NA

Submission Checklist

When rotating buffer sizes exceed ~2GB, the int32_t multiplication
of rotatingNum * rotatingSize wraps negative (e.g. 838926336 * 3 =
-1778188288), causing "Insufficient rotating buffer size" abort.
Use int64_t for rotatingNum and totalRotatingSizeNeeded to handle
large grouped GEMM buffer allocations correctly.
@Z-Y00
Copy link
Copy Markdown
Author

Z-Y00 commented Mar 11, 2026

Shall I submit PR in the mono repo instead?

@Z-Y00 Z-Y00 force-pushed the rotation-buffer-overflow branch 2 times, most recently from 00db9d8 to 6bad126 Compare March 11, 2026 21:33
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.

1 participant