-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix performance downgrade issue & update doc #229
Conversation
Can you reason about why the compiler/hardware can handle this correctly? |
The code can be simplified as this: volatile int *addr;
while(true) {
if (atomic_load(addr, std::memory_order_relaxed) == 0) {
break;
}
}
atomic_store(addr, 1, std::memory_order_relaxed);
For |
Put this link here: https://en.cppreference.com/w/cpp/language/eval_order. Seems we meet the rule 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
For push function, we only need to make sure the instruction
st.global
will be executed after the while loop. Since there is a Write-After-Read hazard fortrigger.fst
(Checkthis->triggers[curFifoHead % size].fst != 0
first then write value totriggers[curFifoHead % size]
), we can expect the compiler and hardware can handle this situation correctly. Remove therelease.sys
there.BTW,
st.global.release.sys.v2.u64
will cause perf regression issue. Previous we usest.global.release.cta.v2.u64
, but seems not necessary.