LFD114 - Issue on describing Ztso disallowing store -> load reordering on ch 6, lesson 9

Hello!

I was reading chapter 06. "MEMORY MODEL -ARM & RISCV-V" and in Lesson 9, "RISC-V TSO (Ztso): Who Enables It, When, and What Changes", I encountered this line :

"Ztso is the RISC-V extension that makes the machine behave like a Total Store Order (TSO) system (i.e., the same high-level ordering guarantees programmers expect on x86). In effect, ordinary loads act like acquire, ordinary stores act like release, and store→load reordering is disallowed. Given the hardware is already “paying” this cost, when targeting TSO hardware the compilers no longer need to emit fence instructions to implement load-acquire or store-release. "

It says store->load reordering is disallowed for TSO.

I was reading the "Computer Architecture: A Quantative appraoch, 7th edition, page 431", it said:

"Sequential consistency requires maintaining all four possible orderings:

R -> W; R -> R; W -> R; and W -> W.

The relaxed models are defined by the subset of four orderings they relax: Relaxing only the W -> R ordering yields a model known as total store ordering or processor consistency."

So, I am confused as to why it said "store->load reordering is disallowed". The book says its relaxed.

Best Answers

  • noureddi
    noureddi Posts: 1
    Answer ✓

    Hi Afsan,

    It seems to me that the statement in the Chapter 06, Lesson 9 is in fact not accurate. It might be that the author meant to write that "store->load reordering is allowed". The way I understand it is that store --> load reordering is the only one that can be allowed.

    Here's how I see it. From the RISC-V specs:

    RVTSO makes the following adjustments to RVWMO:
    - All load operations behave as if they have an acquire-RCpc annotation
    - All store operations behave as if they have a release-RCpc annotation.
    - All AMOs behave as if they have both acquire-RCsc and release-RCsc annotations.

    Putting AMOs aside, a load with acquire-RCpc orders what comes after it, a store with release-RCpc orders what comes before it. So if we consider this example:

    sw     (instruction A)
    sw     (instruction B)
    lw      (instruction C)
    lw      (instruction D)
    

    The specs rules say that (A) --> (B) are ordered (because (B) is now release-RCpc) and (C) --> (D) are ordered (because (C) is now acquire RC-pc), but says nothing about any ordering of stores to load. So the order (C) --> (D) --> (A) --> (B) is valid under Ztso, same as (A) --> (C) --> (B) --> (D).

  • arianehamm
    arianehamm Posts: 107
    Answer ✓

    Hi @Afsan ,

    Thank you for bringing this issue to our attention. This is was really helpful!

    We have updated Lesson 9 of Chapter 6: RISC-V TSO (Ztso): Who Enables It, When, and What Changes. You should see the changes reflected in the course. If you see anything else that we need to address, please don't hesitate to bring it up in the Forum.

    All the best,
    Ariane
    Linux Foundation Education

Answers

  • Afsan
    Afsan Posts: 2
    edited October 29

    @noureddi , Its just that, in the following sentence it says,

    "You do not insert a fence after every store under TSO; rather, TSO’s rules inherently forbid store→load reordering." .

    I believe, store→load reordering is not allowed if its same address. But, Its not written here.

Categories

Upcoming Training