Fix reduction behavior#111
Open
igor-sachok wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A reduction instruction whose operand depends on a preceding arithmetic instruction can deadlock: once the reduction enters the Reduction_Reduce stage. The preceding instruction's retire condition in control_proc is never satisfied — it can't retire and release its result. The reduction, in turn, is stuck waiting on that same result. That creates a deadlock.
Code example:
asm volatile("vsetvli %0, %1, e8, m8, ta, ma" : "=r"(vl) : "r"(64));
asm volatile("vmv.v.i v0, 1");
asm volatile("vrsub.vi v16, v0, 0");
asm volatile("vmv.v.i v24, -1");
asm volatile("vredand.vs v8, v16, v24");
asm volatile("vmv.x.s %0, v8" : "=r"(result));
A solution is to add a check to control_proc that non-reduction instructions can retire regardless of reduction_state_q