我完全删除了Linux,将Qwen3-0.6B嵌入到一个24 KB的纯x86-64汇编语言操作系统中,它的运行速度比原生Linux llama.cpp快54%。
整个多重引导操作系统二进制文件(asm-llm-os.elf)大小为 24,252 字节,完全从头编写,不使用 Linux、Windows、C、Rust 或 libc。它在 74 至 94 毫秒内直接启动进入 64 位长模式,通过 APIC 唤醒每个 CPU 内核,直接从物理 RAM 中映射 614 MiB 的 Q8_0 权重,并通过 VGA、PS/2 键盘和串行端口将您带入实时多轮 KV-cache 聊天。
我在同一款 AMD EPYC 7642 上对 llama.cpp(Q8_0,-ngl 0)进行了 CPU 对比基准测试:
- 1 个线程达到 23.67 tok/s,而之前为 16.63(+42%)- 4 个线程达到 78.89 tok/s,而之前为 51.08(+54%)
- 8 个线程达到 118.08 tok/s,相比之下为 80.79(+46%)
- 16 个线程达到 134.94 tok/s,而之前为 103.03(+31%,峰值为 136.6)
在一台无盘 0 GB Proxmox 虚拟机(2014 年 12 核英特尔至强 E5-2670 v3,2 GiB 内存)上,它在 5 秒内直接启动到提示符(95 毫秒内核启动),并以 78 tok/s 的解码速度和高达 111.5 tok/s 的预填充速度直接从内存运行,采用混合 BIOS+UEFI。还包括 ISO 构建器。输出在不同线程数下保持位精度,并且所有 64 个贪婪标记与 PyTorch FP32 匹配(0.99965 余弦)。
14.7 KB 的 Linux ELF 构建(FAST_Q8=1 INT8xINT8 AVX2+F16C)在 1 至 40 个线程的情况下也比 llama.cpp 快 18% 至 36%,使用 2 MiB 大页裸机启动还能再快 10%。回购、ISO 生成器和 Proxmox 设置指南请见下方回复。
整个多重引导操作系统二进制文件(asm-llm-os.elf)大小为 24,252 字节,完全从头编写,不使用 Linux、Windows、C、Rust 或 libc。它在 74 至 94 毫秒内直接启动进入 64 位长模式,通过 APIC 唤醒每个 CPU 内核,直接从物理 RAM 中映射 614 MiB 的 Q8_0 权重,并通过 VGA、PS/2 键盘和串行端口将您带入实时多轮 KV-cache 聊天。
我在同一款 AMD EPYC 7642 上对 llama.cpp(Q8_0,-ngl 0)进行了 CPU 对比基准测试:
- 1 个线程达到 23.67 tok/s,而之前为 16.63(+42%)- 4 个线程达到 78.89 tok/s,而之前为 51.08(+54%)
- 8 个线程达到 118.08 tok/s,相比之下为 80.79(+46%)
- 16 个线程达到 134.94 tok/s,而之前为 103.03(+31%,峰值为 136.6)
在一台无盘 0 GB Proxmox 虚拟机(2014 年 12 核英特尔至强 E5-2670 v3,2 GiB 内存)上,它在 5 秒内直接启动到提示符(95 毫秒内核启动),并以 78 tok/s 的解码速度和高达 111.5 tok/s 的预填充速度直接从内存运行,采用混合 BIOS+UEFI。还包括 ISO 构建器。输出在不同线程数下保持位精度,并且所有 64 个贪婪标记与 PyTorch FP32 匹配(0.99965 余弦)。
14.7 KB 的 Linux ELF 构建(FAST_Q8=1 INT8xINT8 AVX2+F16C)在 1 至 40 个线程的情况下也比 llama.cpp 快 18% 至 36%,使用 2 MiB 大页裸机启动还能再快 10%。回购、ISO 生成器和 Proxmox 设置指南请见下方回复。
查看原文
原帖正文
I deleted Linux completely, baked Qwen3-0.6B into a 24 KB pure x86-64 assembly OS, and it runs up to 54% faster than native Linux llama.cpp.The entire Multiboot OS binary (asm-llm-os.elf) is 24,252 bytes, written from scratch without Linux, Windows, C, Rust, or libc. It boots in 74 to 94 ms straight into 64-bit Long Mode, wakes every CPU core over APIC, maps the 614 MiB Q8_0 weights directly from physical RAM, and drops you into a live multi-turn KV-cache chat over VGA, PS/2 keyboard, and serial.I ran head-to-head CPU benchmarks against llama.cpp (Q8_0, -ngl 0) on the same AMD EPYC 7642:- 1 thread hits 23.67 tok/s vs 16.63 (+42%)
- 4 threads hit 78.89 tok/s vs 51.08 (+54%)
- 8 threads hit 118.08 tok/s vs 80.79 (+46%)
- 16 threads hit 134.94 tok/s vs 103.03 (+31%, 136.6 peak)On a diskless 0 GB Proxmox VM (2014 12-core Intel Xeon E5-2670 v3, 2 GiB RAM), it boots straight to the prompt in under 5 seconds (95 ms kernel boot) and runs live out of RAM at 78 tok/s decode and up to 111.5 tok/s prefill, with a hybrid BIOS+UEFI ISO builder included too. Output stays bit-exact across thread counts and matches all 64 greedy tokens against PyTorch FP32 (0.99965 cosine).The 14.7 KB Linux ELF build (FAST_Q8=1 INT8xINT8 AVX2+F16C) also beats llama.cpp by 18% to 36% from 1 to 40 threads, and booting bare metal with 2 MiB huge pages squeezes out another 10% on top.Repo, ISO builder, and Proxmox setup guide are in the reply below.
- 4 threads hit 78.89 tok/s vs 51.08 (+54%)
- 8 threads hit 118.08 tok/s vs 80.79 (+46%)
- 16 threads hit 134.94 tok/s vs 103.03 (+31%, 136.6 peak)On a diskless 0 GB Proxmox VM (2014 12-core Intel Xeon E5-2670 v3, 2 GiB RAM), it boots straight to the prompt in under 5 seconds (95 ms kernel boot) and runs live out of RAM at 78 tok/s decode and up to 111.5 tok/s prefill, with a hybrid BIOS+UEFI ISO builder included too. Output stays bit-exact across thread counts and matches all 64 greedy tokens against PyTorch FP32 (0.99965 cosine).The 14.7 KB Linux ELF build (FAST_Q8=1 INT8xINT8 AVX2+F16C) also beats llama.cpp by 18% to 36% from 1 to 40 threads, and booting bare metal with 2 MiB huge pages squeezes out another 10% on top.Repo, ISO builder, and Proxmox setup guide are in the reply below.
引用自 X
原帖地址:https://x.com/i/status/2125682626056839259
原帖:
本站媒体副本
0 条评论
登录后可以参与讨论。
成员登录还没有评论。第一条认真回应会很重要。