aboutsummaryrefslogtreecommitdiff
path: root/src/zihintpause.tex
blob: 82b62a75dedf9fa33dab56eb263fe00972001233 (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
\chapter{``Zihintpause'' Pause Hint, Version 2.0}
\label{chap:zihintpause}

{\bf Warning! This draft specification is likely to change before being
accepted as standard by the RISC-V Foundation.}

The PAUSE instruction is a HINT that indicates the current hart's rate of
instruction retirement should be temporarily reduced.  The duration of its
effect must be bounded.

\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.

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}
We encoded PAUSE as a hint within the FENCE opcode because we expect some
implementations 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.

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}