2 ms·
> Which architecture’s memory model is more restrictive is not always easy to tell. If I understand correctly, the guarantees requested by the code are already
by layer8 4y ago
> Which architecture’s memory model is more restrictive is not always easy to tell.
If I understand correctly, the guarantees requested by the code are already implicitly fulfilled by x86_64, but mapping them to AArch64 requires inserting machine instructions that actually give stronger guarantees than requested by the code (and than provided by x86_64). Since the code actually needs those stronger guarantees (but didn’t request them), it fails on x86_64 while working on AArch64. AArch64 is thus only more “restrictive” in the sense that it isn’t able to map the weaker guarantees in the way x86_64 is able to.
I’d say the main lesson is that the C++-level memory instructions may translate to stronger guarantees for a target platform with a nominally weaker memory model than another target platform. That is, the actual guarantees of compiled code aren’t necessarily monotonic with the strength of the memory model of a target platform.
- josephcsible 4y ago> AArch64 is thus only more “restrictive” in the sense that it isn’t able to map the weaker guarantees in the way x86_64 is able to. I thought that it actually is able to map that, by using LDAPR instead of LDAR, and that the compiler just didn't for some reason.
- layer8 4y agoYou may be right, I was actually just assuming. Nevertheless, in general one has to expect both possibilities.