Thread View: comp.arch
82 messages
82 total messages
Page 2 of 2
Started by Anton Ertl
Tue, 13 Oct 2026 08:43
Page 2 of 2 • 82 total messages
Re: Algol 68
Author: Stefan Monnier
Date: Mon, 19 Oct 2026 03:34
Date: Mon, 19 Oct 2026 03:34
52 lines
4196 bytes
4196 bytes
Anton Ertl [2026-10-18 14:08:34] wrote: > My take is that BNF was a big success in formalizing a part of a > language. So what do you do when you are successful? You try to > follow up on that. So they wanted to formalize more of the language, > and go beyond the limits of BNF (context-free grammars) with Vw > grammars. This was technically successful, but from a usability POV > it was not. Yup. That was before type systems. > Standard ML has been formally specified, and, given the audience of > this language, if any programming language may have success going > there, it should be a language like ML. There is a first revision > (1990) and a second revision (1997), and SML seems to have reached the > end of its evolution there. FWIW, I don't think the end of SML's evolution is a consequence of its having a formal spec, but admittedly, some of the factors that made it have a formal spec may have also been factors in the end of its evolution. > Concerning terms like "semantic errors" or "static semantics" they > make it appear that there is a fundamental difference between syntax > and "static semantics" (the part that is not context-free and that is > checked by the compiler). It seems to me that that's just a matter of > what is expressed in the BNF. Agreed. The dividing line between lexical analysis, syntactic analysis, and "static semantics" mostly comes down to what is most convenient for a given set of tools: those things that work well with a regexp/DFA get handled in the lexical analysis, then those which work well with BNF/PEG are done in the syntactic analysis, and whatever's left over is dumped into the "static semantics". > E.g., in Algol 60 the computation of conditions for if-statements have > special BNF rules, whereas some later programming languages have > a boolean type and putting a non-boolean between IF and THEN produces > a type error, not a syntax error. Because in the mean time, people realized that moving it to types makes for a simpler grammar and in return they let you have a more flexible language where you can precompute those booleans into a variable that you later test in the if-statement. A related example would be `break` statements in C, which are allowed to occur only in loops and switch statements: you could encode that detail directly in the grammar, but it's usually considered easier to do it later on as a "static check" (more clear, less code). Not only it's simpler but it also makes it easier to emit meaningful error messages. === Stefan
Re: Performance of xchg reg,reg
Author: Stefan Monnier
Date: Mon, 19 Oct 2026 03:43
Date: Mon, 19 Oct 2026 03:43
14 lines
2190 bytes
2190 bytes
Anton Ertl [2026-10-18 16:57:26] wrote: > And actually all the stuff about XCHG with memory operands does not > contradict this sentence. It could be understood as meaning that > while all the other aspects of locking don't apply to "XCHG reg, reg", > the assertion of the LOCK# signal still has to occur, and that's why > Intel processors implement a slow XCHG reg, reg. How could code witness the difference? I believe AMD can claim that its behavior is consistent with the behavior you'd get when asserting the LOCK# signal. === Stefan
Re: PL/I, was Algol 68 (was: Documentation (was Re: Performance of xchg reg,reg))
Author: Anton Ertl
Date: Mon, 19 Oct 2026 05:34
Date: Mon, 19 Oct 2026 05:34
37 lines
3185 bytes
3185 bytes
John Levine <johnl@taugh.com> writes: >According to Anton Ertl <anton@mips.complang.tuwien.ac.at>: >>A team at the IBM Lab in Vienna made a formal specification for PL/I; >>I attended a lecture by Heinz Zemanek (the team leader) where he >>mentioned something about an implementor disagreeing with the formal >>specification for recursion (disagreements between implementor and >>specification can also happen with specifications written in a natural >>language, so that may not say much). Anyway, >><https://en.wikipedia.org/wiki/PL/I#Standardization> says "The >>standard is couched as a formal definition[17] using a "PL/I >>Machine"[21] to specify the semantics." This sounds like the >>operational semantics that was developed by the IBM Lab Vienna, so >>maybe the standardization committee picked up this work. But it seems >>that the first standard never had a followon; was the definition too >>unwieldy? > >I have a copy of the ANSI PL/I standard which uses VDL which I find close to impenetrable. Thanks. Yes, VDL is the specification language that the group at IBM Labs Vienna designed in order to define the formal semantics of PL/I (the V in VDL stands for Vienna). So the PL/I standard used their work. >The syntax part is OK but the semantics are endless definitions of something >in terms of something else and I could never find the places where your program >actually did anything. Interesting. I have seen this overfactoring in programs as well as natural-language specifications. Factoring is useful to avoid repeating stuff, but when you are interested in one specific thing, you would rather prefer that much of the factored-out stuff is inlined. - anton -- 'Anyone trying for "industrial quality" ISA should avoid undefined behavior.' Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>
Re: Documentation (was Re: Performance of xchg reg,reg)
Author: Thomas Koenig
Date: Mon, 19 Oct 2026 07:44
Date: Mon, 19 Oct 2026 07:44
51 lines
2920 bytes
2920 bytes
John Savard <quadibloc@invalid.com> schrieb:
> On Sun, 18 Oct 2026 09:45:00 -0400, George Neuner
><gneuner2@comcast.net> wrote:
>
>>The problem with the original report was that they attempted with the
>>grammar turn [at least some kinds of] semantic errors into syntax
>>errors.
>
> Obviously, there's no way one can enable a compiler to flag logic
> errors in programs.
>A Turing-complete language can calculate anything,
> so how can it tell you that you were calculating this when you wanted
> to calculate that?
There are three possibilities: a) A formal verification can succeed,
b) it can fail to make a determination, or c) it can show up bugs.
c) is already implemented with many compiler warnings and errors,
a simple example:
$ cat do.f90
program main
implicit none
integer :: i
real, dimension(5) :: a
do i=1,6
a(i) = i + 2
end do
print *,a
end
$ gfortran do.f90
do.f90:6:6:
5 | do i=1,6
| 2
6 | a(i) = i + 2
| 1
Warning: Array reference at (1) out of bounds (6 > 5) in loop beginning at (2)
If you develop code with formal verification and hit b), you have the
option of not accepting the code.
I believe Lean is a language which implements a) and shows missing
goals for b), but I have never worked with it.
--
This USENET posting was made without artificial intelligence,
artificial impertinence, artificial arrogance, artificial stupidity,
artificial flavorings or artificial colorants.
Re: Performance of xchg reg,reg
Author: EricP
Date: Mon, 19 Oct 2026 13:38
Date: Mon, 19 Oct 2026 13:38
9 lines
1324 bytes
1324 bytes
On 2026-Oct-18 15:27, Chris M. Thomasson wrote: > > Try a LOCK RMW on memory that straddles a L2 cache line. That should trigger a full bus lock. FYI there is an article measuring the effects of cache line split locks Investigating Split Locks on x86-64 https://chipsandcheese.com/p/investigating-split-locks-on-x86
Re: Performance of xchg reg,reg
Author: Stephen Fuld
Date: Mon, 19 Oct 2026 13:57
Date: Mon, 19 Oct 2026 13:57
30 lines
2859 bytes
2859 bytes
On 10/18/2026 8:43 PM, Stefan Monnier wrote: > Anton Ertl [2026-10-18 16:57:26] wrote: >> And actually all the stuff about XCHG with memory operands does not >> contradict this sentence. It could be understood as meaning that >> while all the other aspects of locking don't apply to "XCHG reg, reg", >> the assertion of the LOCK# signal still has to occur, and that's why >> Intel processors implement a slow XCHG reg, reg. > > How could code witness the difference? > > I believe AMD can claim that its behavior is consistent with the > behavior you'd get when asserting the LOCK# signal. > > > === Stefan I believe this all started with empirical data from Anton showing different performance between Intel and AMD processors for XCHG reg,reg. There was some speculation that Intel asserted the lock protocol and that was the cause. The discussion then moved to at best confusing, and perhaps contradictory documentation. But has anyone addressed the original question? Specifically, do Intel processors actually do the lock stuff when it isn't necessary? If so, is the cause of the difference? If not, what is the cause? -- - Stephen Fuld (e-mail address disguised to prevent spam)
Re: Documentation (was Re: Performance of xchg reg,reg)
Author: Stefan Monnier
Date: Mon, 19 Oct 2026 16:24
Date: Mon, 19 Oct 2026 16:24
20 lines
2428 bytes
2428 bytes
John Savard [2026-10-19 00:18:32] wrote: > Obviously, there's no way one can enable a compiler to flag logic > errors in programs. Compilers' ability to report errors mostly depend on the presence of redundancy in the source code. That redundancy depends can be influenced by the design of the language. So, in theory, a compiler can very much flag most logic errors in a program, simply by requiring all source code to come in two different forms (e.g. a "spec" and an "implementation") and to automatically verify that the two match. > A Turing-complete language can calculate anything, so how can it tell > you that you were calculating this when you wanted to calculate that? And the same still holds for non-Turing-complete languages, admittedly. === Stefan
Re: Documentation (was Re: Performance of xchg reg,reg)
Author: George Neuner
Date: Mon, 19 Oct 2026 18:50
Date: Mon, 19 Oct 2026 18:50
73 lines
4102 bytes
4102 bytes
On Mon, 19 Oct 2026 01:52:51 -0000 (UTC),
cross@spitfire.i.gajendra.net (Dan Cross) wrote:
>In article <6ad5609b.8505984@news.eternal-september.org>,
>John Savard <quadibloc@invalid.com> wrote:
>>On Sun, 18 Oct 2026 09:45:00 -0400, George Neuner
>><gneuner2@comcast.net> wrote:
>>
>>>The problem with the original report was that they attempted with the
>>>grammar turn [at least some kinds of] semantic errors into syntax
>>>errors.
>>
>>Obviously, there's no way one can enable a compiler to flag logic
>>errors in programs. A Turing-complete language can calculate anything,
>>so how can it tell you that you were calculating this when you wanted
>>to calculate that?
>
>With apologies, arguments like these always seem to me to miss
>the forest for the trees a bit. Some constructs clearly violate
>the documented semantics of e.g. a language.
>
>Yes, these langauges are all Turing-complete and so on, and no,
>we cannot solve _The_ Halting Problem, in all of its glorious
>generality. But, we can solve any number of specific halting
>_problems_. For example, I can see that, `for (;;);` is a loop
>that does not terminate. With enough effort, I can take that
>down some reasonably long paths.
>
>So, too, one can spot a lot of logic errors. There's no reason
>a compiler can't see this, for example:
>
>? if (ptr == NULL) {
>? int v = *ptr++;
>? *ptr = v + 10;
>? }
>
>And flag it with a error: "you dereferenced a pointer right
>after you asserted it was nil; did you invert the condition?"
Absolutely compiler analysis can catch (some) semantic errors ... that
never was in question.
The problem with the *original* Algol68 report was that they tried to
encode semantics using the syntax, the idea being that the parser then
could catch semantic errors as syntax errors.
The revised report changed direction: the syntax no longer tried to
encode the semantics ... but it still was hard to read because the
syntax definitions made copious /reference/ to semantics discussed in
accompanying text.
>Similarly, I posted about Rust a few days ago, which can do all
>sorts of fun stuff with its borrow checker to assert that an
>object is still alive while references to it exist, and so on,
>and reject programs at compilation time that violate those
>semantics.
>
>>Of course, with AI, we might be able to do something there.
>>
>>But already many modern languages do have strict type-checking.
>>
>>So even if Algol 68 was over-ambitious in this regard, trying to have
>>the language help the programmer avoid more mistakes is basically a
>>sound idea.
>
>Agreed. Indeed, we've gone much farther than just mere type
>checking.
>
> - Dan C.
>
Re: Performance of xchg reg,reg
Author: Chris M. Thomasson
Date: Mon, 19 Oct 2026 21:08
Date: Mon, 19 Oct 2026 21:08
18 lines
2209 bytes
2209 bytes
On 10/19/2026 6:38 AM, EricP wrote: > On 2026-Oct-18 15:27, Chris M. Thomasson wrote: >> >> Try a LOCK RMW on memory that straddles a L2 cache line. That should >> trigger a full bus lock. > > FYI there is an article measuring the effects of cache line split locks > > Investigating Split Locks on x86-64 > https://chipsandcheese.com/p/investigating-split-locks-on-x86 > I see. Actually, a way to "abuse" it even further is to use a LOCK RMW, say even LOCK XADD on something that straddles a cache line issues a bus lock. So, I have seen some papers on abusing QPI to gain a remote memory barrier or async sync for things like RCU. FlushProcessWriteBuffers (windows way), I forgot the damn Linux thing. I think it might be sys_membarrier...
Re: Performance of xchg reg,reg
Author: Lawrence D’Oliveiro
Date: Mon, 19 Oct 2026 21:21
Date: Mon, 19 Oct 2026 21:21
5 lines
1573 bytes
1573 bytes
On Mon, 19 Oct 2026 14:08:53 -0700, Chris M. Thomasson wrote: > I forgot the damn Linux thing. I think it might be sys_membarrier... <https://manpages.debian.org/membarrier(2)> ?
Re: Performance of xchg reg,reg
Author: Chris M. Thomasson
Date: Mon, 19 Oct 2026 21:26
Date: Mon, 19 Oct 2026 21:26
12 lines
2074 bytes
2074 bytes
On 10/19/2026 2:21 PM, Lawrence D’Oliveiro wrote: > On Mon, 19 Oct 2026 14:08:53 -0700, Chris M. Thomasson wrote: > >> I forgot the damn Linux thing. I think it might be sys_membarrier... > > <https://manpages.debian.org/membarrier(2)> ? Has to be it. Afaict, its a way to help algorithms like RCU, or basically any async sync pattern. Say the readers are cheap, the writers not so cheap... Fwiw, here is the windows side of the coin: https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-flushprocesswritebuffers
Re: Performance of xchg reg,reg
Author: Chris M. Thomasson
Date: Mon, 19 Oct 2026 21:27
Date: Mon, 19 Oct 2026 21:27
30 lines
2935 bytes
2935 bytes
On 10/19/2026 6:57 AM, Stephen Fuld wrote: > On 10/18/2026 8:43 PM, Stefan Monnier wrote: >> Anton Ertl [2026-10-18 16:57:26] wrote: >>> And actually all the stuff about XCHG with memory operands does not >>> contradict this sentence. It could be understood as meaning that >>> while all the other aspects of locking don't apply to "XCHG reg, reg", >>> the assertion of the LOCK# signal still has to occur, and that's why >>> Intel processors implement a slow XCHG reg, reg. >> >> How could code witness the difference? >> >> I believe AMD can claim that its behavior is consistent with the >> behavior you'd get when asserting the LOCK# signal. >> >> >> === Stefan > > I believe this all started with empirical data from Anton showing > different performance between Intel and AMD processors for XCHG > reg,reg. There was some speculation that Intel asserted the lock > protocol and that was the cause. The discussion then moved to at best > confusing, and perhaps contradictory documentation. But has anyone > addressed the original question? > > Specifically, do Intel processors actually do the lock stuff when it > isn't necessary? If so, is the cause of the difference? If not, what > is the cause? > Bingo! Tango, Locked on.
Re: Performance of xchg reg,reg
Author: Joseph Seigh
Date: Mon, 19 Oct 2026 23:17
Date: Mon, 19 Oct 2026 23:17
24 lines
2485 bytes
2485 bytes
On 10/19/26 5:08 PM, Chris M. Thomasson wrote: > On 10/19/2026 6:38 AM, EricP wrote: >> On 2026-Oct-18 15:27, Chris M. Thomasson wrote: >>> >>> Try a LOCK RMW on memory that straddles a L2 cache line. That should >>> trigger a full bus lock. >> >> FYI there is an article measuring the effects of cache line split locks >> >> Investigating Split Locks on x86-64 >> https://chipsandcheese.com/p/investigating-split-locks-on-x86 >> > > I see. Actually, a way to "abuse" it even further is to use a LOCK RMW, > say even LOCK XADD on something that straddles a cache line issues a bus > lock. So, I have seen some papers on abusing QPI to gain a remote memory > barrier or async sync for things like RCU. FlushProcessWriteBuffers > (windows way), I forgot the damn Linux thing. I think it might be > sys_membarrier... You are thinking of IPI (inter processsor interrupt) maybe? membarrier changed to that apparently because the quiesce points used by the RCU implementation of membarrier weren't frequent enough.
Re: Performance of xchg reg,reg
Author: Dan Cross
Date: Tue, 20 Oct 2026 02:00
Date: Tue, 20 Oct 2026 02:00
34 lines
2554 bytes
2554 bytes
In article <jwv8q3uqrxf.fsf-monnier+comp.arch@gnu.org>, Stefan Monnier <monnier@iro.umontreal.ca> wrote: >Anton Ertl [2026-10-18 16:57:26] wrote: >> And actually all the stuff about XCHG with memory operands does not >> contradict this sentence. It could be understood as meaning that >> while all the other aspects of locking don't apply to "XCHG reg, reg", >> the assertion of the LOCK# signal still has to occur, and that's why >> Intel processors implement a slow XCHG reg, reg. > >How could code witness the difference? > >I believe AMD can claim that its behavior is consistent with the >behavior you'd get when asserting the LOCK# signal. The effects of a bus lock include disallowing memory operations (except for instruction fetches or page table accesses) passing a locked operation. If `XCHG reg,reg` where indeed treated as though it asserted `LOCK#` for the duration of its execution, it could be (ab)used to force that behavior: From sec 11.1.2.2 of SDM Volume 3a (Sept 2026 version): |Locked operations are atomic with respect to all other memory |operations and all externally visible events. Only instruction |fetch and page table accesses can pass locked instructions. |Locked instructions can be used to synchronize data written by |one processor and read by another processor. For example, this could be used before releasing a lock to prevent a load from migrating into the critical section (though on a TSO machine this should be ok, since a load can't be reordered before a store to the same location). - Dan C.
Re: Documentation (was Re: Performance of xchg reg,reg)
Author: Dan Cross
Date: Tue, 20 Oct 2026 02:05
Date: Tue, 20 Oct 2026 02:05
62 lines
3461 bytes
3461 bytes
In article <7tocdllvftsndin92d9q2kjf90if8dha8p@4ax.com>,
George Neuner <gneuner2@comcast.net> wrote:
>On Mon, 19 Oct 2026 01:52:51 -0000 (UTC),
>cross@spitfire.i.gajendra.net (Dan Cross) wrote:
>
>>In article <6ad5609b.8505984@news.eternal-september.org>,
>>John Savard <quadibloc@invalid.com> wrote:
>>>On Sun, 18 Oct 2026 09:45:00 -0400, George Neuner
>>><gneuner2@comcast.net> wrote:
>>>
>>>>The problem with the original report was that they attempted with the
>>>>grammar turn [at least some kinds of] semantic errors into syntax
>>>>errors.
>>>
>>>Obviously, there's no way one can enable a compiler to flag logic
>>>errors in programs. A Turing-complete language can calculate anything,
>>>so how can it tell you that you were calculating this when you wanted
>>>to calculate that?
>>
>>With apologies, arguments like these always seem to me to miss
>>the forest for the trees a bit. Some constructs clearly violate
>>the documented semantics of e.g. a language.
>>
>>Yes, these langauges are all Turing-complete and so on, and no,
>>we cannot solve _The_ Halting Problem, in all of its glorious
>>generality. But, we can solve any number of specific halting
>>_problems_. For example, I can see that, `for (;;);` is a loop
>>that does not terminate. With enough effort, I can take that
>>down some reasonably long paths.
>>
>>So, too, one can spot a lot of logic errors. There's no reason
>>a compiler can't see this, for example:
>>
>>? if (ptr == NULL) {
>>? int v = *ptr++;
>>? *ptr = v + 10;
>>? }
>>
>>And flag it with a error: "you dereferenced a pointer right
>>after you asserted it was nil; did you invert the condition?"
>
>Absolutely compiler analysis can catch (some) semantic errors ... that
>never was in question.
Sorry, I was referring specifically to the factually incorrect
statement that "there's no way one can enable a compiler to flag
logic errors in programs," quoted above, which is flatly
incorrect.
>The problem with the *original* Algol68 report was that they tried to
>encode semantics using the syntax, the idea being that the parser then
>could catch semantic errors as syntax errors.
>
>The revised report changed direction: the syntax no longer tried to
>encode the semantics ... but it still was hard to read because the
>syntax definitions made copious /reference/ to semantics discussed in
>accompanying text.
Oophf. Sounds painful.
- Dan C.
Re: Performance of xchg reg,reg
Author: Chris M. Thomasson
Date: Tue, 20 Oct 2026 05:41
Date: Tue, 20 Oct 2026 05:41
35 lines
3140 bytes
3140 bytes
On 10/19/2026 4:17 PM, Joseph Seigh wrote: > On 10/19/26 5:08 PM, Chris M. Thomasson wrote: >> On 10/19/2026 6:38 AM, EricP wrote: >>> On 2026-Oct-18 15:27, Chris M. Thomasson wrote: >>>> >>>> Try a LOCK RMW on memory that straddles a L2 cache line. That should >>>> trigger a full bus lock. >>> >>> FYI there is an article measuring the effects of cache line split locks >>> >>> Investigating Split Locks on x86-64 >>> https://chipsandcheese.com/p/investigating-split-locks-on-x86 >>> >> >> I see. Actually, a way to "abuse" it even further is to use a LOCK >> RMW, say even LOCK XADD on something that straddles a cache line >> issues a bus lock. So, I have seen some papers on abusing QPI to gain >> a remote memory barrier or async sync for things like RCU. >> FlushProcessWriteBuffers (windows way), I forgot the damn Linux thing. >> I think it might be sys_membarrier... > > > You are thinking of IPI (inter processsor interrupt) maybe? membarrier > changed to that apparently because the quiesce points used by the RCU > implementation of membarrier weren't frequent enough. I remember reading a paper from somebody, was it Dice? Damn! Cannot remember right now. That abused the QPI, I think the quick path interconnect, to give them a "remote" membar to implement async algos. Iirc they used misaligned LOCK RMW on something that straddled a l2 cache line to make the system assert a bus lock. I know I read the damn paper but it was way back. Iiirc around 2006-2008 ish? I cannot remember. The IPI uses things like FlushProcessWriteBuffers over on Windows, Linux has one to.
Re: Performance of xchg reg,reg
Author: Stefan Monnier
Date: Tue, 20 Oct 2026 14:00
Date: Tue, 20 Oct 2026 14:00
20 lines
2632 bytes
2632 bytes
Stephen Fuld [2026-10-19 06:57:48] wrote: > On 10/18/2026 8:43 PM, Stefan Monnier wrote: >> Anton Ertl [2026-10-18 16:57:26] wrote: >>> And actually all the stuff about XCHG with memory operands does not >>> contradict this sentence. It could be understood as meaning that >>> while all the other aspects of locking don't apply to "XCHG reg, reg", >>> the assertion of the LOCK# signal still has to occur, and that's why >>> Intel processors implement a slow XCHG reg, reg. >> How could code witness the difference? >> I believe AMD can claim that its behavior is consistent with the >> behavior you'd get when asserting the LOCK# signal. >> === Stefan > I believe this all started with empirical data from Anton showing different > performance between Intel and AMD processors for XCHG reg,reg. Indeed but my question is about the ISA definition, i.e. independent from any specific implementation. === Stefan
Re: Performance of xchg reg,reg
Author: Stefan Monnier
Date: Tue, 20 Oct 2026 14:05
Date: Tue, 20 Oct 2026 14:05
14 lines
2022 bytes
2022 bytes
Dan Cross [2026-10-20 02:00:48] wrote: > In article <jwv8q3uqrxf.fsf-monnier+comp.arch@gnu.org>, > Stefan Monnier <monnier@iro.umontreal.ca> wrote: >>How could code witness the difference? > The effects of a bus lock include disallowing memory operations > (except for instruction fetches or page table accesses) passing > a locked operation. Ah, so it doesn't just make the operation atomic, but it additionally imposes barrier-style restrictions on reordering surrounding memory operations? I see, thanks. === Stefan
Re: Performance of xchg reg,reg
Author: Scott Lurndal
Date: Tue, 20 Oct 2026 14:09
Date: Tue, 20 Oct 2026 14:09
29 lines
2370 bytes
2370 bytes
cross@spitfire.i.gajendra.net (Dan Cross) writes: >In article <jwv8q3uqrxf.fsf-monnier+comp.arch@gnu.org>, >Stefan Monnier <monnier@iro.umontreal.ca> wrote: >>Anton Ertl [2026-10-18 16:57:26] wrote: >>> And actually all the stuff about XCHG with memory operands does not >>> contradict this sentence. It could be understood as meaning that >>> while all the other aspects of locking don't apply to "XCHG reg, reg", >>> the assertion of the LOCK# signal still has to occur, and that's why >>> Intel processors implement a slow XCHG reg, reg. >> >>How could code witness the difference? >> >>I believe AMD can claim that its behavior is consistent with the >>behavior you'd get when asserting the LOCK# signal. > >The effects of a bus lock include disallowing memory operations >(except for instruction fetches or page table accesses) passing >a locked operation. If `XCHG reg,reg` where indeed treated as >though it asserted `LOCK#` for the duration of its execution, it >could be (ab)used to force that behavior: From sec 11.1.2.2 of >SDM Volume 3a (Sept 2026 version): > It's worth noting that AMD processors (in the 2008 timeframe) would assert the LOCK# signal if a highly contended cache line could not be acquired in exclusive mode within a certain window of time, even if the access was completely encapsulated in said cache line. I suspect that is still the case.
Re: Performance of xchg reg,reg
Author: MitchAlsup
Date: Tue, 20 Oct 2026 16:45
Date: Tue, 20 Oct 2026 16:45
41 lines
3022 bytes
3022 bytes
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> posted: > On 10/19/2026 4:17 PM, Joseph Seigh wrote: > > On 10/19/26 5:08 PM, Chris M. Thomasson wrote: > >> On 10/19/2026 6:38 AM, EricP wrote: > >>> On 2026-Oct-18 15:27, Chris M. Thomasson wrote: > >>>> > >>>> Try a LOCK RMW on memory that straddles a L2 cache line. That should > >>>> trigger a full bus lock. > >>> > >>> FYI there is an article measuring the effects of cache line split locks > >>> > >>> Investigating Split Locks on x86-64 > >>> https://chipsandcheese.com/p/investigating-split-locks-on-x86 > >>> > >> > >> I see. Actually, a way to "abuse" it even further is to use a LOCK > >> RMW, say even LOCK XADD on something that straddles a cache line > >> issues a bus lock. So, I have seen some papers on abusing QPI to gain > >> a remote memory barrier or async sync for things like RCU. > >> FlushProcessWriteBuffers (windows way), I forgot the damn Linux thing. > >> I think it might be sys_membarrier... > > > > > > You are thinking of IPI (inter processsor interrupt) maybe? membarrier > > changed to that apparently because the quiesce points used by the RCU > > implementation of membarrier weren't frequent enough. > > I remember reading a paper from somebody, was it Dice? Damn! Cannot > remember right now. That abused the QPI, I think the quick path > interconnect, to give them a "remote" membar to implement async algos. > Iirc they used misaligned LOCK RMW on something that straddled a l2 > cache line to make the system assert a bus lock. I know I read the damn > paper but it was way back. Iiirc around 2006-2008 ish? I cannot remember. > > The IPI uses things like FlushProcessWriteBuffers over on Windows, Linux > has one to. In My 66000, an IPI is a write to MM I/O space and is sequentially consistent, so all older writes leave the core prior to the MM I/O leaving the core.
Re: Performance of xchg reg,reg
Author: Dan Cross
Date: Tue, 20 Oct 2026 19:56
Date: Tue, 20 Oct 2026 19:56
20 lines
1784 bytes
1784 bytes
In article <jwvzew8mpwv.fsf-monnier+comp.arch@gnu.org>, Stefan Monnier <monnier@iro.umontreal.ca> wrote: >Dan Cross [2026-10-20 02:00:48] wrote: >> In article <jwv8q3uqrxf.fsf-monnier+comp.arch@gnu.org>, >> Stefan Monnier <monnier@iro.umontreal.ca> wrote: >>>How could code witness the difference? >> The effects of a bus lock include disallowing memory operations >> (except for instruction fetches or page table accesses) passing >> a locked operation. > >Ah, so it doesn't just make the operation atomic, but it additionally >imposes barrier-style restrictions on reordering surrounding memory >operations? I see, thanks. Well, to be clear, I don't think that _that particular form_ of `xchg` actually does. But if the destination were a memory operand, it would, yes. :-) - Dan C.
Re: Performance of xchg reg,reg
Author: Chris M. Thomasson
Date: Tue, 20 Oct 2026 23:44
Date: Tue, 20 Oct 2026 23:44
35 lines
3262 bytes
3262 bytes
On 10/20/2026 7:09 AM, Scott Lurndal wrote: > cross@spitfire.i.gajendra.net (Dan Cross) writes: >> In article <jwv8q3uqrxf.fsf-monnier+comp.arch@gnu.org>, >> Stefan Monnier <monnier@iro.umontreal.ca> wrote: >>> Anton Ertl [2026-10-18 16:57:26] wrote: >>>> And actually all the stuff about XCHG with memory operands does not >>>> contradict this sentence. It could be understood as meaning that >>>> while all the other aspects of locking don't apply to "XCHG reg, reg", >>>> the assertion of the LOCK# signal still has to occur, and that's why >>>> Intel processors implement a slow XCHG reg, reg. >>> >>> How could code witness the difference? >>> >>> I believe AMD can claim that its behavior is consistent with the >>> behavior you'd get when asserting the LOCK# signal. >> >> The effects of a bus lock include disallowing memory operations >> (except for instruction fetches or page table accesses) passing >> a locked operation. If `XCHG reg,reg` where indeed treated as >> though it asserted `LOCK#` for the duration of its execution, it >> could be (ab)used to force that behavior: From sec 11.1.2.2 of >> SDM Volume 3a (Sept 2026 version): >> > > It's worth noting that AMD processors (in the 2008 timeframe) would > assert the LOCK# signal if a highly contended cache line could not > be acquired in exclusive mode within a certain window of time, > even if the access was completely encapsulated in said cache line. > > I suspect that is still the case. I almost have to agree. I think it was there for some sort of anti livelock...? Try bashing the shit out of a LOCK CMPXCHG with another thread just writing to the address trying to make the CAS fail, over and over again... It might force some internal logic to assert a real bus lock.
Re: Algol 68 (was Re: Documentation)
Author: John Savard
Date: Wed, 21 Oct 2026 14:15
Date: Wed, 21 Oct 2026 14:15
13 lines
2028 bytes
2028 bytes
On Mon, 19 Oct 2026 01:46:21 -0000 (UTC), Lawrence =?iso-8859-13?q?D=FFOliveiro?= <ldo@nz.invalid> wrote: >Niklaus Wirth was possibly the biggest critic of the Algol 68 effort. >He and Tony Hoare had previously created Algol-W, which pioneered the >concept of record structures (taking a simpler form than COBOL’s >convoluted record structures). Pascal was basically the next step in >the evolution of that. And, of course, one might mention MODULA-2, which took certain advanced ideas seen in Ada and put them in a Pascal-like context. John Savard
Re: Algol 68 (was Re: Documentation)
Author: Niklas Holsti
Date: Wed, 21 Oct 2026 15:34
Date: Wed, 21 Oct 2026 15:34
18 lines
2237 bytes
2237 bytes
On 2026-10-21 17:15, John Savard wrote: > On Mon, 19 Oct 2026 01:46:21 -0000 (UTC), Lawrence > =?iso-8859-13?q?D=FFOliveiro?= <ldo@nz.invalid> wrote: > >> Niklaus Wirth was possibly the biggest critic of the Algol 68 effort. >> He and Tony Hoare had previously created Algol-W, which pioneered the >> concept of record structures (taking a simpler form than COBOL’s >> convoluted record structures). Pascal was basically the next step in >> the evolution of that. > > And, of course, one might mention MODULA-2, which took certain > advanced ideas seen in Ada and put them in a Pascal-like context. My understanding is that the influences went from Modula-2 to Ada, and Wikipedia agrees with me, saying that Modula-2 first appeared in 1978. The development of these languages overlapped in time, but Modula-2 was finalized and published before Ada.
Re: Algol 68 (was Re: Documentation)
Author: John Savard
Date: Wed, 21 Oct 2026 19:38
Date: Wed, 21 Oct 2026 19:38
16 lines
2210 bytes
2210 bytes
On Wed, 21 Oct 2026 18:34:46 +0300, Niklas Holsti <niklas.holsti@tidorum.invalid> wrote: >My understanding is that the influences went from Modula-2 to Ada, and >Wikipedia agrees with me, saying that Modula-2 first appeared in 1978. You're quite right. I searched for more information, and apparently Concurrent Pascal was "first", with MODULA-2 coming very shortly after. And then, after the two competing models of those languages were discussed for a while, Ada included the feature as well. However, one source claimed that PL/I should really be given the credit for including parallel constructs well before Concurrent Pascal. John Savard
Re: Algol 68 (was Re: Documentation)
Author: aph
Date: Thu, 22 Oct 2026 09:51
Date: Thu, 22 Oct 2026 09:51
22 lines
2821 bytes
2821 bytes
John Savard <quadibloc@invalid.com> wrote: > On Wed, 21 Oct 2026 18:34:46 +0300, Niklas Holsti > <niklas.holsti@tidorum.invalid> wrote: > >>My understanding is that the influences went from Modula-2 to Ada, and >>Wikipedia agrees with me, saying that Modula-2 first appeared in 1978. > > You're quite right. I searched for more information, and apparently > Concurrent Pascal was "first", with MODULA-2 coming very shortly > after. And then, after the two competing models of those languages > were discussed for a while, Ada included the feature as well. > > However, one source claimed that PL/I should really be given the > credit for including parallel constructs well before Concurrent > Pascal. I think that's a rather IBM-centric view. The Burroughs B5000 (after 1961) OS was written in an Algol dialect called ESPOL, which necessarily had concurrency support. The first production PL/I compiler shipped in 1966. Andrew.
Re: Performance of xchg reg,reg
Author: Anton Ertl
Date: Thu, 22 Oct 2026 10:54
Date: Thu, 22 Oct 2026 10:54
18 lines
2281 bytes
2281 bytes
Stefan Monnier <monnier@iro.umontreal.ca> writes: >Anton Ertl [2026-10-18 16:57:26] wrote: >> And actually all the stuff about XCHG with memory operands does not >> contradict this sentence. It could be understood as meaning that >> while all the other aspects of locking don't apply to "XCHG reg, reg", >> the assertion of the LOCK# signal still has to occur, and that's why >> Intel processors implement a slow XCHG reg, reg. > >How could code witness the difference? Depends on the hardware. If there is some device connected t the LOCK# signal (e.g., another CPU), and that behaves differently when the signal is asserted, the code can measure that. - anton -- 'Anyone trying for "industrial quality" ISA should avoid undefined behavior.' Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>
Re: Performance of xchg reg,reg
Author: Michael S
Date: Thu, 22 Oct 2026 19:11
Date: Thu, 22 Oct 2026 19:11
23 lines
2574 bytes
2574 bytes
On Thu, 22 Oct 2026 10:54:04 GMT anton@mips.complang.tuwien.ac.at (Anton Ertl) wrote: > Stefan Monnier <monnier@iro.umontreal.ca> writes: > >Anton Ertl [2026-10-18 16:57:26] wrote: > >> And actually all the stuff about XCHG with memory operands does not > >> contradict this sentence. It could be understood as meaning that > >> while all the other aspects of locking don't apply to "XCHG reg, > >> reg", the assertion of the LOCK# signal still has to occur, and > >> that's why Intel processors implement a slow XCHG reg, reg. > > > >How could code witness the difference? > > Depends on the hardware. If there is some device connected t the > LOCK# signal (e.g., another CPU), and that behaves differently when > the signal is asserted, the code can measure that. > > - anton My undersanding is that in server x86 CPU physical LOCK# signal does not exist for more than decade. Probably much longer in desktop and laptop devices.
Re: Algol 68 (was Re: Documentation)
Author: Stephen Fuld
Date: Thu, 22 Oct 2026 21:15
Date: Thu, 22 Oct 2026 21:15
28 lines
2919 bytes
2919 bytes
On 10/21/2026 12:38 PM, John Savard wrote: > On Wed, 21 Oct 2026 18:34:46 +0300, Niklas Holsti > <niklas.holsti@tidorum.invalid> wrote: > >> My understanding is that the influences went from Modula-2 to Ada, and >> Wikipedia agrees with me, saying that Modula-2 first appeared in 1978. > > You're quite right. I searched for more information, and apparently > Concurrent Pascal was "first", with MODULA-2 coming very shortly > after. And then, after the two competing models of those languages > were discussed for a while, Ada included the feature as well. > > However, one source claimed that PL/I should really be given the > credit for including parallel constructs well before Concurrent > Pascal. I vaguely recall that there was an optional feature in the COBOL standard for concurrent processing, or something like that. It wasn't implemented in the compiler I used and I never investigated exactly what it was. But it certainly predated Pascal, Ad and other such languages. Does anyone else know anything about this? -- - Stephen Fuld (e-mail address disguised to prevent spam)
Re: Algol 68 (was Re: Documentation)
Author: Scott Lurndal
Date: Fri, 23 Oct 2026 14:08
Date: Fri, 23 Oct 2026 14:08
27 lines
2597 bytes
2597 bytes
Stephen Fuld <sfuld@alumni.cmu.edu.invalid> writes: >On 10/21/2026 12:38 PM, John Savard wrote: >> On Wed, 21 Oct 2026 18:34:46 +0300, Niklas Holsti >> <niklas.holsti@tidorum.invalid> wrote: >> >>> My understanding is that the influences went from Modula-2 to Ada, and >>> Wikipedia agrees with me, saying that Modula-2 first appeared in 1978. >> >> You're quite right. I searched for more information, and apparently >> Concurrent Pascal was "first", with MODULA-2 coming very shortly >> after. And then, after the two competing models of those languages >> were discussed for a while, Ada included the feature as well. >> >> However, one source claimed that PL/I should really be given the >> credit for including parallel constructs well before Concurrent >> Pascal. > >I vaguely recall that there was an optional feature in the COBOL >standard for concurrent processing, or something like that. It wasn't >implemented in the compiler I used and I never investigated exactly what >it was. But it certainly predated Pascal, Ad and other such languages. > >Does anyone else know anything about this? Burroughs added concurrent programming extensions to COBOL74 back in the 70's. USAGE IS TASK, for example; also the PROCESS verb was added.
Re: Algol 68 (was Re: Documentation)
Author: Tim Rentsch
Date: Sat, 21 Nov 2026 18:12
Date: Sat, 21 Nov 2026 18:12
33 lines
3094 bytes
3094 bytes
aph@littlepinkcloud.invalid writes: > John Savard <quadibloc@invalid.com> wrote: > >> On Wed, 21 Oct 2026 18:34:46 +0300, Niklas Holsti >> <niklas.holsti@tidorum.invalid> wrote: >> >>> My understanding is that the influences went from Modula-2 to Ada, and >>> Wikipedia agrees with me, saying that Modula-2 first appeared in 1978. >> >> You're quite right. I searched for more information, and apparently >> Concurrent Pascal was "first", with MODULA-2 coming very shortly >> after. And then, after the two competing models of those languages >> were discussed for a while, Ada included the feature as well. >> >> However, one source claimed that PL/I should really be given the >> credit for including parallel constructs well before Concurrent >> Pascal. > > I think that's a rather IBM-centric view. The Burroughs B5000 (after > 1961) OS was written in an Algol dialect called ESPOL, which > necessarily had concurrency support. IIANM ESPOL was a system-specific language and also allowed direct low-level hardware access. So basically that's like saying assembly language has concurrency support. The point is that PL/I offers concurrency support in a system-independent language, and without any direct hardware access. That is a significant step forward. > The first production PL/I compiler shipped in 1966. IIRC the PL/I language definition was delivered in 1964.
Page 2 of 2 • 82 total messages
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads