blob: c739e617ee3f32dd118242d4157e8563b8fcb1ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
\chapter{``Zihintpause'' Pause Hint, Version 1.0}
\label{chap:zihintpause}
The PAUSE instruction is a HINT that indicates the current hart's rate of
instruction retirement should be temporarily reduced or paused. The duration of its
effect must be bounded and may be zero. No architectural state is changed.
\begin{commentary}
Software can use the PAUSE instruction to reduce energy consumption while
executing spin-wait code sequences. Multithreaded cores might temporarily
relinquish execution resources to other harts when PAUSE is executed.
It is recommended that a PAUSE instruction generally be included in the code
sequence for a spin-wait loop.
A future extension might add primitives similar to the x86 MONITOR/MWAIT
instructions, which provide a more efficient mechanism to wait on writes to
a specific memory location.
However, these instructions would not supplant PAUSE.
PAUSE is more appropriate when polling for non-memory events, when polling for
multiple events, or when software does not know precisely what events it is
polling for.
The duration of a PAUSE instruction's effect may vary significantly within and
among implementations.
Portable software should not use more than one PAUSE instruction before
re-evaluating loop conditions, else performance might substantially degrade on
other implementations, or even on some executions on the same implementation.
\end{commentary}
PAUSE is encoded as a FENCE instruction with {\em pred}=W and {\em succ}=0.
\begin{commentary}
PAUSE is encoded as a hint within the FENCE opcode because some
implementations are expected to deliberately stall the PAUSE instruction until outstanding
memory transactions have completed.
Because the successor set is null, however, PAUSE does not {\em mandate} any
particular memory ordering---hence, it truly is a HINT.
Like other FENCE instructions, PAUSE cannot be used within LR/SC sequences
without voiding the forward-progress guarantee.
The choice of a predecessor set of W is arbitrary, since the successor set is
null.
Other HINTs similar to PAUSE might be encoded with other predecessor sets.
\end{commentary}
|