-
Notifications
You must be signed in to change notification settings - Fork 74
Zero registers, memory orderings and dependencies #988
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
Comments
Hi @hernanponcedeleon. The result is not surprising as the value of the
Hence I guess there should be no control dependency! Also consider there there is no architectural way to check the value read by the LDAR instruction of P1. Hence if P1 executes "before" P0 1:X2 final value is 1 if P1 executes "after" P0 the final value of 1:X2 is zero. In all cases, whatever occurred, the final value of 1:XZR is zero. Notice that litmus is wrong here, as it lets gcc reallocate "XZR" to an ordinary register, resulting in a potential final value of 1. Thank you for discovering this (litmus) bug. |
Arm's documentations is not so clear about this, it claims "The zero registers, XZR and WZR, always read as 0 and ignore writes." which I find it different that "you cannot write to those registers".
Just to be sure, is it valid to use zero registers as targets of loads and it is herd's responsibility to do the transformation above?
Assuming the psuedo-code is the intended architectural behavior, I agree.
Nice side effect :D |
I am trying to understand how zero registers (e.g.,
WZR
in aarch64) interact with the memory orderings anddata/addr/ctrl
dependencies.Consider this variation on
MP+ctrl
with rel-acq semanticswhere the values 0/1 are reverted wrt the usual MP, and the first load targets the zero register.
The
exists
is satisfiable despite the rel-acq because the acq-load can execute first, obtain value 1 and then "override" the target register with value zero.The fact that the only witness graph having
W2=1
has an eventc: R[y]Acq=1
makes me believe that the acquire semantics are preserved and herd internally then create some local eventWRZ <- 0
. However, I could not see such local event even if I addedshowevents all
.Adding option
doshow ctrl
does not show actrl
edge from the first to the second load (which I have if I replaceWZR
byW0
). This again suggest the existence of the local event I mentioned above.Am I right that P1 is internally modeled as follows?
meaning loads targeting zero registers preserve their memory order, but they are not in the domain of the
data,addr,ctrl
relations.The text was updated successfully, but these errors were encountered: