Optimize CUDA export host memory usage - #21617
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21617
Note: Links to docs will display an error until the docs builds have been completed. ❌ 12 Pending, 1 Unclassified FailureAs of commit 49c2980 with merge base 74f1ce8 ( UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
|
nit: do you want to split in two PRs? EXIR and CUDA? |
|
@claude review this PR. |
|
Claude finished @digantdesai's task in 4m 23s —— View job PR Review: Optimize CUDA export host memory usageI reviewed the full diff against Correctness / lifetime1. 2. The all-CUDA streaming path — the one that actually runs on GPU export — is not unit-tested. In if not all_cuda and (padding := (-nbytes) % 64):
output.write(bytes(padding))
3. Minor4. Trailing whitespace on 5. 6. On @digantdesai's split suggestionI agree splitting is reasonable. The Things done well
|
1968c82 to
0bebda5
Compare
This PR reduces peak host memory usage during CUDA export by streaming and file-backing serialized weight data instead of materializing large in-memory copies. For Gemma 4 31B Q4_K_M, cold-start peak host memory decreased from 110.7 GB to 54.9 GB (50.35%), with identical output and no increase in GPU VRAM usage.