STALLWAIT
tenstorrent_tt_isa)Tenstorrent Wormhole B0 & Blackhole A0
main
userTensix, Sync Unit, BlackholeA0, WormholeB0Summary
One or more assorted conditions are selected using a bitmask, and one or more blocked instructions are selected using another bitmask. The issuing thread can continue execution until one of the blocked instructions is reached, at which point execution of the thread is paused until all of the selected conditions are simultaneously met.
Syntax / Encoding
TT_STALLWAIT(/* u9 */ BlockMask, /* u15 */ ConditionMask)
Binary Encodings (2)
| Width | Format | Bit Pattern | Mask / Match |
|---|---|---|---|
| 32 | Tensix-32b | 10100010xxxxxxxxxxxxxxxxxxxxxxxx | 0xff000000 / 0xa2000000 |
| 32 | Tensix-32b (Blackhole) | 10100010xxxxxxxxxxxxxxxxxxxxxxxx | 0xff000000 / 0xa2000000 |
Operands
| Name | Description |
|---|---|
BlockMask | |
ConditionMask |
Reference Notes
# `STALLWAIT` (Limit thread execution until assorted conditions met)
**Summary:** One or more assorted conditions are selected using a bitmask, and one or more blocked instructions are selected using another bitmask. The issuing thread can continue execution until one of the blocked instructions is reached, at which point execution of the thread is paused until all of the selected conditions are simultaneously met.
A `BlockMask` or `ConditionMask` of zero is `UnsupportedFunctionality`, and its use is strongly discouraged: it has no known usage.
**Backend execution unit:** [Sync Unit](SyncUnit.md)
## Syntax
```c
TT_STALLWAIT(/* u9 */ BlockMask, /* u15 */ ConditionMask)
```
## Encoding

## Functional model
The instruction is considered complete once the following happens:
```c
WaitGate[CurrentThread].LatchedWaitInstruction.Opcode = STALLWAIT;
WaitGate[CurrentThread].LatchedWaitInstruction.ConditionMask = ConditionMask ? ConditionMask : 0x7F;
WaitGate[CurrentThread].LatchedWaitInstruction.BlockMask = BlockMask ? BlockMask : (1u << 6);
WaitGate[CurrentThread].LatchedWaitInstruction.SemaphoreMask = 0;
if (ConditionMask == 0 || BlockMask == 0) {
UnsupportedFunctionality(); // A mask of zero: no known usage
// The model continues to describe the defaults above
}
```
The Wait Gate will then continuously re-evaluate the latched wait instruction until all of the selected conditions are simultaneously met, at which point the latched wait instruction will be forgotten, and instructions will no longer be blocked. The new latched wait instruction takes effect immediately, so it will influence whether or not the instruction immediately after `STALLWAIT` can pass through the Wait Gate. There is a one cycle lag between the condition(s) being met and the block mask being removed - in particular this means that the instruction immediately after `STALLWAIT` will always be subject to the block mask for at least one cycle, even if the condition(s) are met immediately.
If a thread presents a `STALLWAIT` instruction whilst it already has a latched wait instruction, then `STALLWAIT` does not execute until the previously latched wait instruction has been forgotten, so a `STALLWAIT` never replaces a latched wait instruction. Instructions after the `STALLWAIT` wait behind it. [`SEMWAIT`](SEMWAIT.md) does _not_ behave this way; see its description for details.
## Block mask
The block mask consists of nine bits, named B0 (least significant bit) through B8 (most significant bit). The approximate meaning of each bit is:
||Approximate meaning|
|---|---|
|**B0**|Block thread from starting new [Miscellaneous Unit](MiscellaneousUnit.md), [Mover](XMOV.md), [Scalar Unit (ThCon)](ScalarUnit.md), [Packer](Packers/README.md), or Unpacker instructions|
|**B1**|Block thread from starting new [Sync Unit](SyncUnit.md) instructions|
|**B2**|Block thread from starting new [Packer](Packers/README.md) instructions|
|**B3**|Block thread from starting new Unpacker instructions|
|**B4**|Block thread from starting new [Mover](XMOV.md) instructions|
|**B5**|Block thread from starting new [Scalar Unit (ThCon)](ScalarUnit.md) instructions|
|**B6**|Block thread from starting new [Matrix Unit (FPU)](MatrixUnit.md) instructions|
|**B7**|Block thread from starting new [Configuration Unit](ConfigurationUnit.md) instructions|
|**B8**|Block thread from starting new Vector Unit (SFPU) instructions|
The exact set of instructions blocked from starting by each bit is:
<table><thead><tr><th>Instruction</th><th>B0</th><th>B1</th><th>B2</th><th>B3</th><th>B4</th><th>B5</th><th>B6</th><th>B7</th><th>B8</th></tr></thead>
<tr><th align="left"><code>ADDDMAREG</code></th><td align="center">❌</td><td></td><td></td><td></td><td></td><td align="center">❌</td><td></td><td></td><td></td></tr>
<tr><th align="left"><code>ADDRCRXY</code></th><td align="center">❌</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><th align="left"><code>ADDRCRZW</code></th><td align="center">❌</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><th align="left"><code>APOOL3S1</code></th><td></td><td></td><td></td><td></td><td></td><td></td><td align="center">❌</td><td></td><td></td></tr>
<tr><th align="left"><code>APOOL3S2</code></th><td></td><td></td><td></td><td></td><td></td><td></td><td align="center">❌</td><td></td><td></td></tr>
<tr><th align="left"><code>ATCAS</code></th><td align="center">❌</td><td></td><td></td><td></td><td></td><td align="center">❌</td><td></td><td></td><td></td></tr>
<tr><th align="left"><code>ATGETM</code></th><td></td><td align="center">❌</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><th align="left"><code>ATINCGET</code></th><td align="center">❌</td><td></td><td></td><td></td><td></td><td align="center">❌</td><td></td><td></td><td></td></tr>
<tr><th align="left"><code>ATINCGETPTR</code></th><td align="center">❌</td><td></td><td></td><td></td><td></td><td align="center">❌</td><td></td><td></td><td></td></tr>
<tr><th align="left"><code>ATRELM</code></th><td></td><td align="center">❌</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><th align="left"><code>ATSWAP</code></th><td align="center">❌</td><td></td><td></td><td></td><td></td><td align="center">❌</td><td></td><td></td><td></td></tr>
<tr><th align="left"><code>BITWOPDMAREG</code></th><td align="center">❌</td><td></td><td></td><td></td><td></td><td align="center">❌</td><td></td><td></td><td></td></tr>
<tr><th align="left"><code>CLEARDVALID</code></th><td></td><td></td><td></td><td></td><td></td><td></td><td align="center">❌</td><td></td><td></td></tr>
<tr><th align="left"><code>CLREXPHIST</code></th><td></td><td></td><td></td><td></td><td></td><td></td><td align="center">❌</td><td></td><td></td></tr>
<tr><th align="left"><code>CMPDMAREG</code></th><td align="center">❌</td><td></td><td></td><td></td><td></td><td al