This is one is interesting, and even weaker than the Alpha,
On LoongArch, you if you read from the same address twice,
you cannot be sure without synchronization that you get
the reads ordered correctly,
So, if on the the writer side, you have (where x is in memory)
x = 1;
x = 2;
and on the reader side
a = x;
b = x;
you can have a=2 and b=1 as a result.
They don't even have this in their English documentation
This is one is interesting, and even weaker than the Alpha,
On LoongArch, you if you read from the same address twice,
you cannot be sure without synchronization that you get
the reads ordered correctly,
So, if on the the writer side, you have (where x is in memory)
x = 1;
x = 2;
and on the reader side
a = x;
b = x;
you can have a=2 and b=1 as a result.
They don't even have this in their English documentation (I would
guess that LoongArch is for the Chinese market only, then) but it
caused a bug in gfortran recently, gcc.gnu.org/PR118935 .
On 2026-Aug-16 08:18, Thomas Koenig wrote:
This is one is interesting, and even weaker than the Alpha,
On LoongArch, you if you read from the same address twice,
you cannot be sure without synchronization that you get
the reads ordered correctly,
So, if on the the writer side, you have (where x is in memory)
-a-a-a x = 1;
-a-a-a x = 2;
and on the reader side
-a-a a = x;
-a-a b = x;
you can have a=2 and b=1 as a result.
They don't even have this in their English documentation (I would
guess that LoongArch is for the Chinese market only, then) but it
caused a bug in gfortran recently, gcc.gnu.org/PR118935 .
Are you sure your example is correct because that wouldn't work at all.
It would force the writer to insert store fences all over the place
just in case there was a copy of [x] in some other cache,
and that fence would stall the writer until all updates had reached
all readers and kill performance.
If this is correct then wow, they are in for a festival of buggy race conditions.
On 2026-Aug-16 08:18, Thomas Koenig wrote:
This is one is interesting, and even weaker than the Alpha,
On LoongArch, you if you read from the same address twice,
you cannot be sure without synchronization that you get
the reads ordered correctly,
So, if on the the writer side, you have (where x is in memory)
x = 1;
x = 2;
and on the reader side
a = x;
b = x;
you can have a=2 and b=1 as a result.
They don't even have this in their English documentation (I would
guess that LoongArch is for the Chinese market only, then) but it
caused a bug in gfortran recently, gcc.gnu.org/PR118935 .
Are you sure your example is correct because that wouldn't work at all.
It would force the writer to insert store fences all over the place
just in case there was a copy of [x] in some other cache,
and that fence would stall the writer until all updates had reached
all readers and kill performance.
If this is correct then wow, they are in for a festival of buggy race conditions.
This is one is interesting, and even weaker than the Alpha,
On LoongArch, you if you read from the same address twice,
you cannot be sure without synchronization that you get
the reads ordered correctly,
So, if on the the writer side, you have (where x is in memory)
x = 1;
x = 2;
and on the reader side
a = x;
b = x;
you can have a=2 and b=1 as a result.
They don't even have this in their English documentation (I would
guess that LoongArch is for the Chinese market only, then) but it
caused a bug in gfortran recently, gcc.gnu.org/PR118935 .
Thomas Koenig <tkoenig@netcologne.de> writes:
This is one is interesting, and even weaker than the Alpha,
On LoongArch, you if you read from the same address twice,
you cannot be sure without synchronization that you get
the reads ordered correctly,
So, if on the the writer side, you have (where x is in memory)
x = 1;
x = 2;
and on the reader side
a = x;
b = x;
you can have a=2 and b=1 as a result.
They don't even have this in their English documentation
Sounds like a bug to me.
But then, weak consistency, when documented, is a "feature" in the
sense of: Don't fix your bugs, document them as features; and some
have, at length; how many pages is the description of this bug in the
ARM manual, again?
On 2026-Aug-16 08:18, Thomas Koenig wrote:
This is one is interesting, and even weaker than the Alpha,
On LoongArch, you if you read from the same address twice,
you cannot be sure without synchronization that you get
the reads ordered correctly,
So, if on the the writer side, you have (where x is in memory)
-a-a-a x = 1;
-a-a-a x = 2;
and on the reader side
-a-a a = x;
-a-a b = x;
you can have a=2 and b=1 as a result.
They don't even have this in their English documentation (I would
guess that LoongArch is for the Chinese market only, then) but it
caused a bug in gfortran recently, gcc.gnu.org/PR118935 .
Are you sure your example is correct because that wouldn't work at all.
It would force the writer to insert store fences all over the place
just in case there was a copy of [x] in some other cache,
and that fence would stall the writer until all updates had reached
all readers and kill performance.
If this is correct then wow, they are in for a festival of buggy race conditions.
On 8/16/2026 8:08 AM, EricP wrote:
If this is correct then wow, they are in for a festival of buggy race
conditions.
Only from the programmers that don't know what they are doing?
Chris M. Thomasson <chris.m.thomasson.1@gmail.com> schrieb:
On 8/16/2026 8:08 AM, EricP wrote:
If this is correct then wow, they are in for a festival of buggy race
conditions.
Only from the programmers that don't know what they are doing?
Here's the automated translation of the Chinese original.
2.1.9.1 Sequential Execution of Load Operations at the Same Address
When the Loongson architecture adopts a weakly consistent memory
coherence model, hardware support for the sequential execution of
load operations at the same address is not required by default. In
this case, the software must insert data barrier instructions (it is recommended to use `dbar 0x700`) where necessary to ensure correct
programme execution. If a specific processor implementation supports sequential execution of load operations at the same address, it
must be ensured that the return value of CPUCFG.3.LD_SEQ_SA[bit23]
is 1, so that the software can identify this feature and carry
out relevant performance optimisations.
And yes, this causes real bugs in software that has
been written and tested for other processors.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 74 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 46:34:10 |
| Calls: | 1,100 |
| Files: | 1,339 |
| Messages: | 275,493 |