flat assembler
Message board for the users of flat assembler.
Index
> Main > CPU load/store queues, pointer update and pipeline |
| Author |
|
|
bitRAKE 06 Mar 2026, 14:07
Volume 3A, Chapter 10, Section 10.2 — Memory Ordering
"Writes are not reordered with older reads." There is no stall - all reads of RBX are planned to be performed prior to the final write of RBX - nothing unexpected is happening that requires a change. I reread the above chapter very often - it was chapter 8 in older manuals, iirc. Many of your present concerns are directly related to this content. Yes, the register file can be imagined as a very fast memory - it follows the same rules in general. _________________ ¯\(°_o)/¯ AI may [not] have aided with the above reply. |
|||
|
|
revolution 06 Mar 2026, 17:08
Most CPus have register renaming. That means that rbx uses a new register from the pool each time it is written. The old value of rbx is still in the previous register in the pool.
Code: mov rax,[rbx] ; rbx = pool_reg[43], rax = pool_reg[42] inc rbx ; rbx = pool_reg[44] |
|||
|
|
sylware 06 Mar 2026, 18:46
This is what I suspected (due to register renaming).
Then there is no pipeline stall if I update the pointer while the load is in flight. Good! |
|||
|
|
revolution 07 Mar 2026, 18:21
BTW: inc can be a problematic instruction.
Because inc doesn't alter the carry flag, some CPUs create a false dependency on the carry flag, and some don't. This depends on whether the CPU implements separate carry flag renaming or not. Some CPUs only implement the full flags register renaming, and thus don't track the carry separately. Something to be mindful of, and worthwhile testing for to see if it affects performance or not. inc can be replaced with the longer add rbx,1 to explicitly break the carry flag dependency. |
|||
|
|
sylware 07 Mar 2026, 21:37
@revolution I heard about the flags register nightmare for out-of-order large CPU implementations... it seems RISC-V has no flags mostly for this very reason.
|
|||
|
|
bitRAKE 08 Mar 2026, 21:00
... and if the flags aren't needed we can lea rbx, [rbx+1] -- assuming this instruction was a performance problem because of flags dependency.
_________________ ¯\(°_o)/¯ AI may [not] have aided with the above reply. |
|||
|
|
sylware 09 Mar 2026, 13:41
Good catch. Feels convoluted ofc.
Now I am thinking of it, I wonder how many hardware bugs the tracking of the flags dependency has in modern hardware pipelines. It is said complex to a point some ISAs are excluding it completely out of the core design, maybe there are already CVEs about it. |
|||
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2026, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.