Fix: fix output buffer overwrite issue in intranode EP. #93
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a work by a team from Moreh Inc.
Motivation
Fixed the problem where the output occasionally becomes incorrect.
Technical Details
Issue
When running the intranode EP, the output occasionally becomes incorrect.
Cause
This issue occurs because both the dispatch and combine phases share the same output buffers,
shmemOutTokMemObjandshmemOutWeightsMemObj.Since these buffers are reused across phases, they can be overwritten due to differences in execution timing between ranks.
In intranode EP, each dispatch/combine kernel behaviors are as follows:
shmemOutTokMemObjandshmemOutWeightsMemObj.shmemOutTokMemObjandshmemOutWeightsMemObj.The Core Issue
Because the same buffers are reused for every dispatch/combine call, the combine result should be copied to the user buffer.
While one rank is performing the combine recv phase, another rank might already be executing the dispatch send phase.
Fix
Split
shmemOutTokMemObjandshmemOutWeightsMemObjinto seperate objects for dispatch and combineTest Plan
moreh-dev:fix_ep_result_error: fixed possible result value error in internode and intranode EP (Fix: fix possible result value error in internode and intranode EP #87)moreh-dev:enhance_mori_ep_test: enhanced mori ep unit test. (Enhancement of mori ep unit test #92)tests/python/ops/test_dispatch_combine.pyas below:Test Result
Before modification: the test fails
After modification: all test passed
Submission Checklist