Repository navigation
Conversation
…ails UnicastConfigurator::setup left the range mapped when cuMemSetAccess failed, and teardown is not called for a failed setup, so the next materialize at that address failed. Unmap the range before rethrowing. Signed-off-by: Andrew Rusli <[email protected]>
|
/bot run |
|
No actionable comments were generated in the recent review. Walkthrough
ChangesUnicast access failure cleanup
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk:
|
|
PR_Github #85237 [ run ] triggered by Bot. Commit: |
|
PR_Github #85237 [ run ] completed with state
|
Dev Engineer Review
UnicastConfigurator::setupincpp/include/tensorrt_llm/runtime/virtualMemory.hnow handles acuMemSetAccessfailure. It unmaps the range, then rethrows the original exception. This fixes a leak where a failed setup left the range mapped.cuMemSetAccesserror is still the one propagated. Confirm that the warning does not replace the exception.cuMemSetAccessfails for a partially granted range, the unmap must still be valid. Check this path. The source was not inspected in this review.QA Engineer Review
Test files changed:
cpp/tests/unit_tests/runtime/virtualMemoryTest.cpp(modified, +29 lines): addsVirtualMemoryTest.TestUnicastAccessFailureUnmaps.Test function added:
TestUnicastAccessFailureUnmaps. It reserves a 256 MiB virtual address range and creates an allocation handle. It requests access for device indextc::getDeviceCount(), which does not exist, and expectssetupto throw. It then callssetupfor device 0 on the same range, which must succeed. Finally, it tears down the mapping, releases the handle, and frees the reservation.Coverage:
Coverage verdict: needs follow-up (the unmap-failure warning path is untested).
Per-File QA Perspective
cpp/include/tensorrt_llm/runtime/virtualMemory.h(source): After a failed access grant, the range is now unmapped before the error propagates. QA should confirm that a later materialization at the same address succeeds after such a failure.cpp/tests/unit_tests/runtime/virtualMemoryTest.cpp(test): Covers the failed-access regression. Test-list membership not verified.Description
Bug.
UnicastConfigurator::setup(virtualMemory.h) maps the allocation at a fixed virtual address and thengrants access with
cuMemSetAccess. If the access grant fails,setupthrows with the range still mapped.CUDAVirtualMemoryChunkrunsteardown()only for configurators whosesetup()succeeded, so nothing unmaps therange, and the next
materializeof the chunk fails incuMemMap. This breaks the "setup() shall not leak"contract of
Configurator.Who hits it. Users of CUDA virtual memory chunks (for example virtual-memory sleep and wake-up), when an
access grant fails: the chunk can then no longer be mapped at its address.
Fix.
UnicastConfigurator::setupunmaps the range before it rethrows the failedcuMemSetAccess. A failedunmap is logged as a warning instead of thrown (
TLLM_CU_CHECK_FREE_RESOURCEwould throw and replace theoriginal error), so the
cuMemSetAccesserror is the one that propagates.Risk. Very low. Nothing changes when the access grant succeeds.
Test Coverage
cpp/tests/unit_tests/runtime/virtualMemoryTest.cpp:VirtualMemoryTest.TestUnicastAccessFailureUnmaps(oneGPU) grants access to a device that does not exist, expects the throw, then maps the same range with a valid
descriptor and tears it down.
With and without the fix:
virtualMemoryTestbuilt from main plus the new test failsTestUnicastAccessFailureUnmaps(the other 21 tests pass); with the fix all 22 pass.PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.