Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • How to Use This Course
  • Reading Paths
  • Concept Map
  • How to Read the Diagrams
  • Part 0: What Is a Protocol?10
  • Part 1: Timing and Clocking11
  • Part 2: Encoding and Framing12
  • Part 3: Handshakes13
  • Part 4: Flow Control17
  • Part 5: Transactions19
  • Part 6: Concurrency and Performance17
  • Part 7: Ordering13
    • Why Ordering Matters
    • Ordering Scopes
    • The Point of Serialisation
    • Early and Final Acknowledgement
    • Fences and Barriers
    • Ordering Tables
    • Relaxed and ID-Based Ordering
    • Same-Address Hazards
    • Interrupt and Data Ordering
    • Memory Consistency Models
    • Ordering Across Bridges
    • Protocols Compared: Ordering
    • Drills: Ordering
  • Part 8: Sharing and Arbitration12
  • Part 9: Deadlock and Liveness13
  • Part 10: Reliability and Recovery20
  • Part 11: Bring-Up and Link Management10
  • Part 12: Power8
  • Part 13: Shared State and Coherence9
  • Part 14: Security and Isolation7
  • Part 15: Specifying and Verifying11
  • Part 16: Protocols Dissected17
  • Part 17: Capstones5
  • Part 18: Interview Preparation6
Loading lesson

‹Part 7: Ordering
  1. Topics
  2. First Principles of Hardware Protocols
  3. Part 7: Ordering
  4. Relaxed and ID-Based Ordering

Part 7 · Ordering · Principal (P)

Relaxed and ID-Based Ordering

Ordering rules protect producer/consumer patterns, but most traffic is not part of one. Relaxed ordering and ID-based ordering let a requester give up order it does not need. When that is safe, and who may decide.

On this page

    Note

    Level: Principal (P) · Answers: In what order do results become visible?

    Before this: Ordering Tables

    A network card streams packet data into memory at full rate. Somewhere on the path, one write stalls briefly because its memory bank is busy. Every write behind it waits, because posted writes may not pass posted writes, although none of those writes depend on each other. Only the final "packet ready" entry depends on all of them. The ordering rule built for that one write is slowing down the thousands before it.

    How can a requester give up ordering it does not need, without breaking the ordering it does?

    The obvious answer, and why it breaks

    The obvious fix is to drop the ordering rule for bulk traffic. But the fabric cannot tell bulk writes from flag writes: they look the same. The requester knows. So the rules are relaxed per transaction, by the requester marking the transactions that need no ordering, while the ones that do (the flag, the completion entry) stay strictly ordered behind them.

    The idea: mark what may be reordered

    Mechanism

    What it relaxes

    Safe when

    Relaxed ordering (per transaction)

    A marked posted write may pass earlier posted writes; a marked completion may pass earlier posted writes

    The marked transaction is not the "flag" of a producer/consumer pair: bulk data, not the write that announces it

    ID-based ordering

    Ordering is kept only among transactions from the same source; traffic from different sources may pass each other

    Different sources' traffic is independent, as it usually is

    Per-ID ordering in AXI

    Different IDs are never ordered (lesson 7.2)

    The requester chooses IDs so that dependent transactions share one

    The key point is asymmetry: the bulk writes may pass each other, but the flag is not marked relaxed, so it may not pass them. The flag still arrives after all the data; the data writes no longer wait for each other.

    Who is allowed to set the bits

    • The requester, per transaction: only it knows which writes are data and which announce data.

    • System software must allow it, per device: relaxing order is only safe if the device's driver and the platform agree, so there is a control bit to enable it, and a platform whose memory system cannot handle relaxed traffic correctly keeps it disabled.

    • Nobody downstream may add it: a bridge or switch that marks traffic relaxed on its own initiative breaks producer/consumer patterns it knows nothing about. Components may ignore the bits (and keep strict order) but must not invent them.

    How real protocols chose

    Protocol

    Relaxation

    PCI Express

    A Relaxed Ordering attribute bit in the packet header, set by the requester and enabled per device by system software; ID-Based Ordering (from PCIe 3.0) keeps order only within one requester's traffic.

    AXI

    No relaxation bits: ordering is per ID, so requesters relax order by using different IDs.

    What breaks

    • Relaxing the flag (illustrative): a device marked every write relaxed, including its completion-queue entries. The entries occasionally arrived before the data they described. The flag must be strictly ordered.

    • Enabling it on a platform that mishandles it: some root ports have had problems with relaxed traffic, and Linux keeps a list of them on which it is not used. That is exactly why system software must opt in per device.

    • A bridge that invents relaxation to speed up a benchmark breaks every driver that relied on strict order.

    Why this matters

    Principal lens. Relaxed ordering is a contract with three parties: the device marks only independent traffic, the driver and platform enable it only where the memory system honours it correctly, and every component in between either honours or ignores the bits but never sets them. In reviews, find the "flag" transactions (completion entries, doorbells, status updates) and confirm they are never marked relaxed.

    Interview

    Asked: "When is relaxed ordering safe?"

    Weak answer: When you need performance.

    Strong answer: When the marked transaction isn't part of a producer/consumer dependency: bulk data writes that nothing reads until a later flag. Those may pass each other; the flag itself stays strictly ordered, so it still arrives after all the data. It's set per transaction by the requester, which is the only party that knows which writes are data and which announce data, and system software must enable it per device. Downstream components may ignore it, but must never add it.

    Follow-ups: (1) What is ID-based ordering? (2) Why must system software be able to disable relaxed ordering?

    Check yourself A device writes 4 KB of packet data and then a completion entry. Which writes may be marked relaxed?

    The data writes. The completion entry must not be relaxed, so it cannot pass the data.

    Check yourself Why may a switch ignore the relaxed bit but not set it?

    Ignoring it only keeps stricter order, which is always correct; setting it removes order the requester may depend on.

    Key takeaways

    • Relaxed ordering lets marked transactions pass earlier ones; ID-based ordering keeps order only within one source.

    • Only independent traffic may be relaxed; the "flag" stays strictly ordered behind it.

    • Requesters set the bits, system software enables them, and nothing downstream may add them.

    Keep going

    Next: Lesson 7.8, Same-Address Hazards. Read after write and write after write, through buffers and multiple paths.

    Related topics

    • Part 7 overview: Ordering

    Previous

    110 / 234

    Next: Same-Address Hazards

    Up next

    Up nextSame-Address Hazards

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Why Ordering Matters
    • Ordering Scopes
    • The Point of Serialisation