Out of Order Execution and Memory Fences

后端 未结 3 995
-上瘾入骨i
-上瘾入骨i 2021-02-01 09:50

I know that modern CPUs can execute out of order, However they always retire the results in-order, as described by wikipedia.

\"Out of Oder processors fill these \"slots

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-01 10:10

    Just to make explicit what is implicit in the previous answers, this is correct, but is distinct from memory accesses:

    CPUs can execute out of order, However they always retire the results in-order

    Retirement of the instruction is separate from performing the memory access, the memory access may complete at a different time to instruction retirement.

    Each core will act as if it's own memory accesses occur at retirement, but other cores may see those accesses at different times.

    (On x86 and ARM, I think only stores are observably subject to this, but e.g., Alpha may load an old value from memory. x86 SSE2 has instructions with weaker guarentees than normal x86 behaviour).

    PS. From memory the abandoned Sparc ROCK could in fact retire out-of-order, it spent power and transistors determining when this was harmless. It got abandoned because of power consumption and transistor count... I don't believe any general purpose CPU has been bought to market with out-of-order retirement.

提交回复
热议问题