Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "store-buffer forwarding" mean in the Intel developer's manual?

The Intel 64 and IA-32 Architectures Software Developer's Manual says the following about re-ordering of actions by a single processor (Section 8.2.2, "Memory Ordering in P6 and More Recent Processor Families"):

Reads may be reordered with older writes to different locations but not with older writes to the same location.

Then below when discussing points where this is relaxed compared to earlier processors, it says:

Store-buffer forwarding, when a read passes a write to the same memory location.

As far as I can tell, "store-buffer forwarding" isn't precisely defined anywhere (and neither is "pass"). What does it mean for a read to pass a write to the same location here, given that above it says that reads can't be reordered with writes to the same location?

like image 442
jacobsa Avatar asked Jun 12 '14 04:06

jacobsa


1 Answers

The naming is a bit awkward. The "forwarding" happens inside a core/logical processor, as follows. If you first do a STORE, it will go to the store buffer to be flushed to memory asynchronously. If you do a subsequent LOAD to the same location ON THE SAME PROCESSOR before the value is flushed to the cache/memory, the value from the store buffer will be "forwarded" and you will get the value that was just stored. The read is "passing" the write in that it happens before the actual write from store-buffer to memory (which has yet to happen).

The statement isn't saying much actually if you just care about the ordering rules - this forwarding is a detail of what they do internally to guarantee that (on a processor) reads are not reordered with older writes to the same location (part of the rule you quoted).

Despite what some of the other answers here state, there is (at least as far as ordering guarantees go) NO store-buffer forwarding/snooping between processors/cores, as the 8.2.3.5 "Intra-Processor Forwarding Is Allowed" example in the manual shows.

like image 164
Radu Avatar answered Sep 29 '22 08:09

Radu