系统与基础设施yosefk.com
“用硬件实现,所以很便宜”(2012)
“It's done in hardware so it's cheap” (2012)
2012 — 2022,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
YosefK 博客的一篇经典文章,质疑“用专用硬件做就便宜”的常见说法,分析硬件加速背后的真实成本与收益,并讨论了多核、RISC/CISC 等处理器设计话题。文章在 2012、2019、2022 年多次登上 HN 首页。
为什么经久不衰:它对硬件加速、数据搬运成本和处理器架构演进的洞察在十年后(AI 矩阵运算时代)反而更显价值,是理解“为什么专用芯片赢”的必读思考。
HN 评论精选
专用硬件的核心优势在于数据流相邻、省去寄存器堆和旁路网络的数据搬运成本,矩阵运算尤其如此
专用硬件除了派发开销之外的另一个好处是数据搬运成本。芯片越宽,需要更多物理寄存器和端口,成本超线性增长;旁路网络在晶体管上也是平方级增长;核心物理尺寸越大,数据传输耗电越多。而专用硬件可以把操作串成数据流,让上一级的输出直接进入物理相邻的下一级,无需经过寄存器堆或旁路网络。硬件向量运算相对标量的好处主要在派发开销,而硬件矩阵运算相对向量的好处主要来自减少数据搬运。(当然,这篇文章写于 2012 年,那时还没人做硬件矩阵乘法,可以理解。)
Symmetry查看英文原文
Another benefit of specialized hardware, besides dispatch costs, is the cost of moving data around. As your chip gets wider you want more physical (rather than architectural) registers with more ports meaning super linear growth. And your bypass network also grows quadratically in transistor terms. And as your core gets bigger physically you lose more power moving data longer distances. But in dedicated hardware you can just gang your operations into dataflows where the output of one stage feeds into the physically adjacent next stage with no need to make a trip through the register file or bypass network. A lot of the benefit of hardware vector operations over scalar operations is in the dispatch cost, but most of the benefit from hardware matrix operations over hardware vector operations is from reduced data movement. EDIT: Of course, the post is from 2012 back when nobody was doing hardware matrix multiplication so it's understandable.
加“便宜”的硬件核会把成本转嫁给固件团队,多核调试是真实的隐性代价
这让我想起做固件开发时,ASIC 团队会问能不能加一个额外的 Cortex-M3 核来解决特定控制问题——这些核被当作可编程状态机用。对 ASIC 团队来说加核几乎免费,比定制逻辑便宜;但对固件团队来说又多了一份要写要测的固件。我们有过多达 10 个 Cortex-M3 核的设计,听说别的公司有 32 个,调试起来非常痛苦。
pkaye查看英文原文
Reminds of when I was doing firmware development and the ASIC team would ask if they could toss in a extra Cortex-M3 core to solve specific control problems. Those cores would be used as programmable state machines. For the ASIC team tossing in a extra core was free compared to custom logic design. However for the firmware team it would be another job to write and test that firmware. We had designs with upwards of 10 Cortex-M3 cores. I've heard from a friend at another employer had something like 32 such cores and it was a pain to debug.
多核的兴起不是因为它省电,而是 Dennard 缩放终结后晶体管过剩的必然结果
既然多核不省能源,为什么还要做多核芯片?除了文章说的原因,直白地说:因为我们有晶体管。Dennard 缩放已经终结,时钟频率无法继续提升,但晶体管数量还在增长,这基本迫使 CPU 厂商转向多核。另外 big/little、关闭闲置硅片等方法即使多用晶体管也能省电。
CalChris查看英文原文
Why have multicore chips if it saves no energy? In addition to TFA's reason, bluntly, because we have the transistors. Dennard scaling has ended which has meant that we can't continue to increase clock frequencies. However, transistor counts have continued to increase. This has basically forced CPU manufacturers to focus on multicore because we have the transistors. Also, big/little, gating off unused silicon and other approaches can save energy even as they use more transistors.
反驳“C 语言导致处理器复杂”的说法:当年处理器本就以 Pascal/PL/M 为卖点,复杂化与 C 无关
“处理器这么复杂是因为 C 语言”是 HN 上流传最久的故事之一,我很奇怪为什么。翻看当年的资料很容易发现,68000 和 8086 上市时主打的是 Pascal 或 PL/M。就算 C 没有统治世界,我们也会得到类似的执行模型。
dang查看英文原文
Related: “It's done in hardware so it's cheap” (2012) - https://news.ycombinator.com/item?id=19340667 - March 2019 (38 comments) "It’s done in hardware so it’s cheap" - https://news.ycombinator.com/item?id=4339024 - Aug 2012 (29 comments)
历次讨论
同类还值得读
TTY 揭秘(2008)
The TTY demystified (2008)
经典文章深入剖析了 Unix/Linux 中 TTY 子系统的工作原理,包括线路规程、终端驱动、信号与控制字符等机制。
系统与基础设施上首页 11 次 · 2009–2025linusakesson.net编辑精选为什么 GNU grep 这么快
Why GNU grep is Fast
FreeBSD 邮件列表上一篇广为流传的帖子,解释 GNU grep 为什么快:核心在于 Boyer-Moore 字符串搜索算法配合精心优化的内部循环和 I/O,让程序在搜索时“…
系统与基础设施上首页 9 次 · 2010–2022lists.freebsd.orgXplain:为普通人讲解 X11
Xplain – Explaining X11 for the rest of us
《Xplain》是作者(HN 用户 Jasper_)写的一系列 X11 长文,用他在浏览器中重建的 X11 绘图模型做交互演示,讲解 X11 的绘图模型与窗口系统设计。
系统与基础设施上首页 6 次 · 2013–2020magcius.github.io编辑精选旋风教程:为 Linux 创建极小 ELF 可执行文件(1999)
A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux (1999)
breadbox 写于 1999 年的经典教程,主题是如何为 Linux 手工构造并裁剪出体积极小的 ELF 可执行文件。
系统与基础设施上首页 6 次 · 2007–2025muppetlabs.comPostgreSQL 内部原理
The internals of PostgreSQL
《The Internals of PostgreSQL》是一本免费在线书籍,系统讲解 PostgreSQL 的内部实现,包括查询处理、并发控制、WAL、缓冲区管理等核心机制。
系统与基础设施上首页 5 次 · 2017–2025interdb.jp编辑精选