Instruction
ENQCMD
Sends a 64-byte command, tagged with the PASID from the IA32_PASID MSR, to a device's enqueue register and sets ZF if the device did not accept it.
ENQCMD hands a 64-byte command to a device that many programs share, such as an accelerator with a shared work queue, without a system call. It reads the command from memory, stamps it with the thread’s process address space identifier (PASID), writes it in one piece to the device’s enqueue register, whose address is in a general-purpose register, and learns in ZF whether the device took it. It shares the opcode 0F 38 F8 with MOVDIR64B, whose 64-byte write it resembles, and with ENQCMDS, the kernel’s variant that takes the PASID and the privilege bit from the command itself.
What the command carries
Bits 19:0 of the written command are the PASID from the IA32_PASID MSR, bit 31 is 0 to say the sender runs as a user, whatever the current privilege level, and bits 511:32 come from the source. The low 32 bits of the source must be 0, the MSR’s valid bit set and the destination aligned to 64 bytes, or ENQCMD raises #GP. Only the operating system writes the MSR, so a program cannot pose as another address space, and a device can rely on the PASID to tell whose addresses a command holds. The MSR is supervisor state component 10 of XSAVE.
Accepted or not
ZF = 0 means the device accepted the command, not that it ran it. ZF = 1
asks for a retry: the queue was full, or the address was no enqueue
register at all, in which case nothing is written anywhere. The other
arithmetic flags are cleared. The intrinsic _enqcmd(portal, desc)
(-menqcmd) returns ZF, so the usual loop retries while it returns 1: GCC
14 at -O2 compiles it to enqcmd rdi, zmmword ptr [rsi], SETE and a
test, Clang 23 to ENQCMD and a JNE on the flag directly, its loop
unrolled five times.
Like the direct stores, the write bypasses the caches and is not ordered after earlier stores to write-back or write-combining memory, so a command that points at data written just before needs an SFENCE first.
Where it runs
The page lists Intel’s server processors from Sapphire Rapids on and no AMD processor; Zen 5 reports no ENQCMD (CPUID leaf 7, ECX bit 29), so the page’s pseudocode is written from Intel’s manual and was not run. APX adds an EVEX form for its new registers.
Forms
| Instruction | Encoding | Requires |
|---|---|---|
ENQCMD r16/32/64, m512
ENQCMD_GPRa_MEMu32 | F2 0F 38 F8 /r | ENQCMD |
ENQCMD r16/32/64, m512
ENQCMD_GPRav_MEMu32_APX | EVEX.LLZ.F2.MAP4.SCALABLE F8 /r | APX_F + ENQCMD |
Latency and throughput
| Model | r32, m512 |
|---|---|
| Sapphire Rapids | 1 / 1p49 |
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
a = dest.read() # 64 bits, 32 with a 67 prefix; ES,
# which no prefix overrides
if a % 64:
fault(GP, 0) # 64-byte aligned
p = msr[0xD93] # IA32_PASID
if not p >> 31 & 1:
fault(GP, 0) # the OS gave the thread no PASID
v = src.read() # 64 bytes, not read atomically
if v & 0xFFFFFFFF:
fault(GP, 0) # bits 31:0 must be 0
c = v | p & 0xFFFFF # the PASID in bits 19:0; bit 31,
# 0: a user's command
zf = 1 - enqueue(a, c)
of = sf = af = pf = cf = 0Not run on a processor: no processor at hand has ENQCMD.
Operands
| Operand | Kind | Action |
|---|---|---|
ENQCMD r16/32/64, m512 | ||
r16/32/64 | explicit | read |
m512 | explicit | read |
RFLAGS | implicit | write |
Flags
| OF | SF | ZF | AF | PF | CF |
|---|---|---|---|---|---|
| All forms | |||||
| 0 | 0 | M | 0 | 0 | 0 |
Exceptions
The exception class is XED's name for the set of exception conditions that a form follows. How to read.
- Legacy forms
- none in XED
- EVEX forms
APX-EVEX-ENQCMD
CPUID and processors
Each form belongs to an XED ISA set. A form can be used when the processor reports every CPUID bit of one of its ISA set's alternatives.
| ISA set | CPUID | Processors |
|---|---|---|
ENQCMD | ENQCMD | Sapphire Rapids, Emerald Rapids, Granite Rapids, Diamond Rapids, Sierra Forest, Clearwater Forest |
APX_F_ENQCMD | APX_F + ENQCMD | Nova Lake, Diamond Rapids |
More ENQCMD instructions
More APX instructions
Sources
- Intel XED v2026.08.23 (commit
0bcb6237345c): forms, encodings, operands, flags, exception classes, attributes, ISA sets, CPUID bits and chip model. - LLVM 23.1.2's x86 scheduling models (commit
85ac56026243): the latency, reciprocal throughput and ports of each form, as llvm-mca reports them. - Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2A, page 3-289 (ENQCMD)
- Intel Advanced Performance Extensions (Intel APX) Architecture Specification, revision 9.0 (355828-009, August 2026)
- Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1 (253665-093, September 2026)
The tables are derived from Intel XED, Copyright Intel Corporation, licensed under the Apache License 2.0; x86-64.net converted and reformatted them. The timings come from LLVM's scheduling models, part of the LLVM Project, licensed under the Apache License 2.0 with LLVM Exceptions. The text is our own.