[+Cc: Paul] Hello, I reflowed your message quoted below so that it fits 78 char width. On Fri, 28 Feb 2025 18:31:02 +0100, Ignacio Encinas Rubio wrote: > Hello! > > I recently looked at memory consistency models with a particular focus > on hardware details and found this book to be great, but I was left > wondering about something regarding Alpha's memory model. > > I tried to find previous discussions about this but didn't find > anything, so I'll go ahead: > > Table 15.5: Summary of Memory Ordering states that Alpha is *NOT* > Other-Multicopy Atomic but I couldn't find the explanation for this. > Other sources contradict this statement [1] [2]. > [3] Documents ARM's adoption of other-multicopy atomicity, using POWER > as an example of non-other-multicopy-atomicity but fails to mention Alpha. > > Furthermore, [2] models non-other-multicopy-atomicity by having "Read > from external" (rfe) not impose ordering. Alpha's reference manual [3] > Section 5.6.1.5 states > > If u is a write access Pi:W<m>(x,a) and v is an overlapping read > access Pj:R<n>(y,b), u is visible to v only if: > - u <- v, or > - u precedes v in processor issue sequence (possible only if Pi=Pjn). As is well known, Alpha is infamous of its lack of address-dependency guarantees. I don't see much point in discussing whether it is multicopy atomic or not. That said, here is a naive litmus test on Non multicopy atomicity: --------------------------------------------------------------------- C NMCA (* Demonstrate no-ordering of non-multicopy atomicity * Result: Sometimes -- Non-multicopy atomic platforms (LKMM, Armv7, POWER, etc.) Never -- Other-multicopy atomic platforms (e.g., x86, Armv8) -- Full-multicopy atomic platform (s390) *) {} P0(int *x, int *y) { int r0; int r1; r0 = READ_ONCE(*y); r1 = READ_ONCE(*x); } P1(int *x, int *y) { int r0; int r1; r0 = READ_ONCE(*y); r1 = READ_ONCE(*x); } P2(int *x, int *y) { WRITE_ONCE(*x, 1); WRITE_ONCE(*y, 1); } exists (0:r0=0 /\ 0:r1=1 /\ 1:r0=1 /\ 1:r1=0) --------------------------------------------------------------------- If you have access to an Alpha machine with 3 or more CPUs, you should be able to run this test with the help of klitmus7. Note that you might need to run the test against pre-4.15 Linux release. READ_ONCE() since 4.15 has smp_mb() for Alpha to ensure that it can be used as a start point of an address dependency. Litmus test above might behave differently against Linux releases of pre and post 4.15 WRT Alpha. Also note that even if you see a result saying "Never", it does not necessarily mean Alpha architecture is other-multicopy-atomic or stronger. The behavior might depend on specific memory/cache system found on a specific model of the machine, for example. Finally, my mental model of other-multi-copy might be different from those defined in papers you cited below. > > Which seems to confirm that Alpha was indeed other-multicopy atomic. > > Best regards, > Ignacio > > > [1] https://arxiv.org/pdf/1707.05923 - First page > [2] http://www0.cs.ucl.ac.uk/staff/j.alglave/these.pdf - Section 4.2.3.1 > [3] https://dl.acm.org/doi/pdf/10.1145/3158107 ([3]: with the last-minute edit in your follow-up.) Thanks, Akira