Chris Low-level systems developer
← Back to all posts

The Extension You Cannot Disassemble

ISA

Ztso directly changes the architectural memory-order contract the post demonstrates: the spec strengthens RVWMO so loads act as acquire and stores as release, which is exactly what makes the compiler's fence deletion legal, and the _ztso1p0 architecture tag is an ISA-level declaration.

MICROARCH

The post constrains observable ordering but never reasons about a particular pipeline, store buffer, cache, or other microarchitectural mechanism; the deleted fences are a compiler decision against the architectural contract, not a hardware structure.

FIRMWARE

No bootloader, machine-mode firmware, or privilege-mode handoff takes part: the demonstration is a freestanding compile of C11 atomics to object files, and nothing in the post executes in or depends on firmware.

KERNEL

The proof uses freestanding C atomics compiled to object files, never a running kernel: no syscall, trap, page table, or kernel path appears in the experiment or the argument.

ALGORITHM

The post derives no lock-free algorithm and proves no algorithmic property; the four atomics are a compiler-input fixture for observing fence lowering, not a concurrent algorithm under analysis.

I compiled the same four C11 atomics twice, xPack GCC 15.2.0 at -O2, once for rv64gc and once for rv64gc_ztso. The only difference between the two runs was the Ztso flag. For a release store the base target emits fence rw,w and then sw. The Ztso target emits just sw. For an acquire load the base target emits lw and then fence r,rw. The Ztso target emits just lw. Two fences, deleted by a compiler flag [2].

The spec explains the deletion. Ztso strengthens the base memory model, RVWMO, into RVTSO: every load acts as an acquire, every store as a release, and AMOs as both, so a fence that only restated that ordering is redundant [1]. Under RVWMO the fences were load-bearing: without them the hardware could let a store or a load slide past a neighboring access. Under Ztso the ordering is a guarantee of the model, so the compiler stops emitting the instruction. A sequentially consistent atomic still keeps one fence rw,rw, because only a full barrier orders a store before a later load, and Ztso does not add that [1]. The compiler knows exactly which fences the promise covers.

A section of the Berlin Wall days after it opened in November 1989, people walking past where the barrier stood
November 1989: the barrier opens and the line keeps moving in order. Ztso deletes the fence instructions; the ordering promise remains.

The two builds side by side:

release store   base: fence rw,w ; sw     ztso: sw
acquire load    base: lw ; fence r,rw     ztso: lw
seq_cst         base: fence rw,rw         ztso: fence rw,rw

The deletion is exact: release loses one fence, acquire loses one fence, and sequential consistency keeps its full barrier on both targets. The compiler is not guessing. The Ztso model tells it which orderings are already guaranteed, and it emits fences only for the ones that are not [1] [2].

You cannot find Ztso in the disassembly. The extension adds no instructions, so there is nothing to disassemble [1]. The only trace is the object file's architecture string, where the Ztso build records _ztso1p0 in Tag_RISCV_arch: the binary's declaration that it requires the stronger model [2]. An extension that exists as a promise shows up only where promises are recorded, in the metadata.

Ztso is the extension you cannot disassemble: no new instructions, no fences, just an ordering promise and a flag in the object file.

Sources

  1. 01
    The RISC-V Ztso Extension, version 1.0RISC-V International

    Defines RVTSO as a delta from RVWMO: loads act as acquire-RCpc, stores as release-RCpc, AMOs as acquire-RCsc plus release-RCsc; non-I/O fences lacking both PW and SR become redundant; the extension adds no instructions; binaries that assume Ztso must identify that requirement.

  2. 02
    lab/161-ztso-fence-delete: Ztso fence deletion through the compilerChris Dillinger, systems-lab

    The firsthand experiment behind this post: xPack RISC-V GCC 15.2.0 at -O2 for rv64gc versus rv64gc_ztso, the deleted release and acquire fences, the retained sequential-consistency fence, the _ztso1p0 architecture tag, and the 36-check verification run.

Stuck on a board or a crash? Fixed-price firmware work: crash triage $250/symptom, bare-metal bring-up from $500, C audit from $350. .

Choose how to get in touch

The project brief is filled in for you.

Compose in Gmail Use my email app