Skip to content

Fix integer overflow in activitiesMaxGpuBufferSize for values >= 2048 MB#1316

Open
anubhavchaturvedi wants to merge 1 commit intopytorch:mainfrom
anubhavchaturvedi:export-D97185175
Open

Fix integer overflow in activitiesMaxGpuBufferSize for values >= 2048 MB#1316
anubhavchaturvedi wants to merge 1 commit intopytorch:mainfrom
anubhavchaturvedi:export-D97185175

Conversation

@anubhavchaturvedi
Copy link
Copy Markdown

Summary:
Fix integer overflow that occurs when ACTIVITIES_MAX_GPU_BUFFER_SIZE_MB is set to 2048 MB or higher, which was causing GPU trace collection to fail silently with negative buffer sizes.

Change activitiesMaxGpuBufferSize_ and related APIs from int to int64_t throughout the codebase to prevent overflow when multiplying megabytes by 1024*1024. The overflow occurred because 2048 * 1024 * 1024 = 2^31, which exceeds the signed 32-bit integer maximum, resulting in a negative value that immediately terminated GPU profiling during warmup.


AI generated Summary & Test Plan from DEV117610005

Differential Revision: D97185175

Summary:
Fix integer overflow that occurs when `ACTIVITIES_MAX_GPU_BUFFER_SIZE_MB` is set to 2048 MB or higher, which was causing GPU trace collection to fail silently with negative buffer sizes.

Change `activitiesMaxGpuBufferSize_` and related APIs from `int` to `int64_t` throughout the codebase to prevent overflow when multiplying megabytes by 1024*1024. The overflow occurred because `2048 * 1024 * 1024 = 2^31`, which exceeds the signed 32-bit integer maximum, resulting in a negative value that immediately terminated GPU profiling during warmup.

---
AI generated Summary & Test Plan from DEV117610005

Differential Revision: D97185175
@meta-cla meta-cla bot added the cla signed label Mar 20, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Mar 20, 2026

@anubhavchaturvedi has exported this pull request. If you are a Meta employee, you can view the originating Diff in D97185175.

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.

1 participant