Assembly Hall of Shame

Assembly Hall of Shame

Assembly Hall of Shame Overview

Instruction latency analysis usually focuses on performance optimization—making code run as fast as possible. The Assembly Hall of Shame takes the opposite approach: searching for the absolute floor of single-instruction performance.

“汇编耻辱殿堂”概述

指令延迟分析通常侧重于性能优化——即让代码运行得尽可能快。而“汇编耻辱殿堂”(Assembly Hall of Shame)则采取了截然相反的方法:寻找单条指令性能的绝对下限。


🏆 Current Champions 🏆

x86: fxrstor64 Strategy: Use fxrstor64 to load 512-byte FPU/MMX/XMM state from a high-latency MMIO region in the PCIe fabric, then starve the fabric while the load is in flight — a fleet of hammer cores pounds a different high-latency MMIO register with tight 4-byte reads, saturating the PCIe root complex and endpoint with non-posted transactions, so CPU 0’s 512-byte fxrstor64 must queue behind all that contending traffic.

🏆 当前冠军 🏆

x86: fxrstor64 策略: 使用 fxrstor64 从 PCIe 架构中高延迟的 MMIO 区域加载 512 字节的 FPU/MMX/XMM 状态,并在加载过程中耗尽总线带宽——通过一组“锤击”核心(hammer cores)对另一个高延迟 MMIO 寄存器进行密集的 4 字节读取,用非发布(non-posted)事务填满 PCIe 根复合体和端点,从而迫使 CPU 0 的 512 字节 fxrstor64 指令必须排队等待处理这些竞争流量。


Contender: AMD Ryzen 7 5800H

  • CPU 0: timed instruction movl $0xfcc68830, %rsi; fxrstor64 %rsi
  • CPUs 1..N: hammer loop against a different high-latency location movl 0xfcc68858, %eax
  • Score: 198,002,498,236 cycles
  • Time: 62 seconds

参赛者: AMD Ryzen 7 5800H

  • CPU 0: 计时指令 movl $0xfcc68830, %rsi; fxrstor64 %rsi
  • CPU 1..N: 针对另一个高延迟位置的“锤击”循环 movl 0xfcc68858, %eax
  • 得分: 198,002,498,236 个时钟周期
  • 耗时: 62 秒

Honorable Mentions

A spec-violating unaligned ymm0 load that forced non-posted dword transactions from stalled GPU registers was used to break the fundamental design of System Management Mode in smiiiiiiiiiiiiiiii. vmovdqu 0xfcc003b1, %ymm0

荣誉提名

一种违反规范的非对齐 ymm0 加载操作,它强制从停滞的 GPU 寄存器中发出非发布双字(dword)事务,被用于破坏 smiiiiiiiiiiiiiiii 中系统管理模式(SMM)的基本设计。 vmovdqu 0xfcc003b1, %ymm0


Rules

Instructions may use whatever setup is necessary, but only a single instruction is eligible to be scored. Trapped/emulated/virtualized instructions may only time the trap, not the handler. Instructions must not be interruptible. rep movs, pause, etc. are disqualified. Times are normalized based on the CPU base clock frequency. All platforms must be in their factory stock configurations - no hardware modifications.

规则

指令可以使用任何必要的设置,但只有单条指令有资格参与评分。被捕获/模拟/虚拟化的指令只能对捕获过程计时,不能对处理程序计时。指令必须不可中断。rep movspause 等指令被取消资格。时间基于 CPU 基础时钟频率进行归一化处理。所有平台必须处于出厂默认配置——不得进行硬件改装。


x86 Leaderboard

27. nop Strategy: nop does nothing. It opens the leaderboard accordingly. Contender: Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz nop Score: 1 cycles | Time: 0 nanoseconds

x86 排行榜

27. nop 策略: nop 什么都不做。它相应地开启了排行榜。 参赛者: Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz nop 得分: 1 个时钟周期 | 耗时: 0 纳秒


26. nop16 Strategy: Regular nop was too short, but how do we make nothing take longer? Try a lonnnnnng nop. Contender: Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz data16 data16 data16 data16 data16 data16 data16 nopl 0x00000000(%%eax,%%eax,1) Score: 20 cycles | Time: 7 nanoseconds

26. nop16 策略: 普通的 nop 太短了,但我们如何让“什么都不做”花费更长时间?试试一个超长的 nop参赛者: Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz data16 data16 data16 data16 data16 data16 data16 nopl 0x00000000(%%eax,%%eax,1) 得分: 20 个时钟周期 | 耗时: 7 纳秒


25. rdtsc Strategy: Just a reference instruction to get our bearings. Contender: Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz rdtsc Score: 49 cycles | Time: 18 nanoseconds

25. rdtsc 策略: 仅作为参考指令来确定基准。 参赛者: Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz rdtsc 得分: 49 个时钟周期 | 耗时: 18 纳秒


24. idiv Strategy: Use 128-bit dividend (rdx:rax=2:0) with small divisor to push the quotient above the ceiling imposed by sign-extension, driving the longest path through the divider microcode. Contender: Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz xorq %rax, %rax; movq $2, %rdx; movq $5, %rbx; idivq %rbx Score: 77 cycles | Time: 28 nanoseconds

24. idiv 策略: 使用 128 位被除数(rdx:rax=2:0)配合较小的除数,将商推至符号扩展所设定的上限之上,从而驱动除法微代码执行最长的路径。 参赛者: Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz xorq %rax, %rax; movq $2, %rdx; movq $5, %rbx; idivq %rbx 得分: 77 个时钟周期 | 耗时: 28 纳秒


(Note: The article continues with further entries in the leaderboard, following the same pattern.)