llvm

Activity

Stars and mentions · Last 30 days, Oct 7 – Nov 5

GitHub stars377
Mentions40
07142128Oct 7Oct 21Nov 5
UTC days · repositories llvm owns5 repositories

Top repositories

llvm’s repositories ranked by pull request authors, as on trending.

Loading

Contributes to

Repositories outside llvm’s account where llvm opened or reviewed pull requests in the past 365 days.

Who noticed llvm

Everyone who starred or forked llvm’s repositories since the archive began in 2011.

Notable accounts

Ordered by the stars their own repositories have received.

Biggest fans

Accounts that starred the most of these repositories.

Breakout weeks

Each repository’s best week of new stars, with the release published around it.

Mentions

39posts
Nov 60 posts
  1. Update: 1 day after posting this, an AMD OpenMP developer made a PR to fix this: llvm-project#237914 It was merged 3 days later. Thank you, robert-imschweiler.com!

  2. Opened a small PR to make LLVM use SIMD for fixed-length memcmp calls on arm64. Current codegen is a bit suboptimal: godbolt.org (up to 2x slower than SIMD) Not sure it'll get reviewed amid the flood of contributions, though 😅 PR: llvm-project#238794 t.co

    26 likes · 931 views
  3. GPU-UNLOCK: How to Bypass NVIDIA's Artificial Compute Limits and Boost Local AI LLM Speeds by 50%+ --- title: "GPU-UNLOCK: How to Bypass NVIDIA's Artificial Compute Limits and Boost Local AI LLM Speeds by 50%+" published: true description: "Step-by-step visual tutorial on using the open-source Zagitta/gpu-unlock tool to eliminate artificial compute limits on NVIDIA GeForce RTX 30 and 40 series cards. Complete operational download links, benchmarks, and UEFI guide." tags: ai, gpu, hardware, machinelearning canonical_url: pixelbrain-tools.blogspot.com cover_image: iili.io --- Did you know that your consumer NVIDIA GeForce RTX card is running with an artificial handbrake? On RTX 30 and 40 series GPUs, NVIDIA deliberately caps the instruction issue rate for FP16, BF16, and TF32 tensor operations so consumer cards won't compete with their $10,000+ enterprise data center GPUs. In this practical, step-by-step guide, we break down how to use the open-source GPU-UNLOCK project to safely unlock your card's dual-issue tensor performance. Zero VBIOS flashing. Zero permanent hardware modifications. Bit-for-bit identical outputs with up to 50% to 100% higher AI throughput. --- 1. The Raw Benchmarks: Stock vs. Unlocked Tensor Performance Consumer GPUs have plenty of physical silicon headroom, but NVIDIA's default firmware restricts the issue rate of tensor core matrix math instructions. Below are the verified dense GEMM matrix multiplication benchmarks (FP32 accumulation at stock power limits): !GPU-UNLOCK Benchmark: Dense GEMM and Tensor Core Issue Rate Unlocked ▲ Benchmark Data: Dense matrix multiplication throughput before and after unlocking dual-issue tensor execution. Hardware Matrix Comparison | NVIDIA GPU Model | Stock Issue Rate (FP16/BF16) | GPU-UNLOCK (Dual Issue) | Real-World Gain | | :--- | :--- | :--- | :--- | | RTX 3060 12GB | 27 TFLOPS | 51 TFLOPS | +87% Compute | | RTX 3070 8GB | 40 TFLOPS | 72 TFLOPS | +81% Compute | | RTX 3080 10GB | 65 TFLOPS | 113 TFLOPS | +73% Compute | | RTX 3090 / Ti | 75 TFLOPS | 125 TFLOPS | +65% Compute | | RTX 4070 Ti / Super | 81 TFLOPS | 150 TFLOPS | +84% Compute | | RTX 4090 24GB | 165 TFLOPS | 329 TFLOPS | +100% Peak MMA Rate | What Does This Mean for Everyday AI Workloads? - LLM Prefill / Prompt Processing (Ollama, vLLM, DeepSeek-R1): +25% to +55% faster. - Time-to-First-Token (TTFT): Decreases by 25% to 48%. - Image Generation (SDXL, Flux, ComfyUI, DiT): +30% to +55% faster iterations. - FlashAttention / SDPA Kernels: +50% to +60% compute acceleration. - Model Output Accuracy: 100% bit-exact. The model weights and math results do not change at all—only the execution latency drops. --- 2. Essential Downloads & Repository Links Before starting, make sure you download the required open-source codebase and build dependencies: - Official GitHub Repository: Zagitta/gpu-unlock - Direct 1-Click ZIP Download: Download gpu-unlock-main.zip - LLVM Clang Compiler (Windows 64-bit): Download LLVM Releases on GitHub (Download and install to default C:\LLVM) - Python 3.10+ Runtime: Download Python for Windows - NVIDIA Game Ready / Studio Drivers (550.x+): Official NVIDIA Driver Downloads Clone the Repository via Terminal: git clone https://github.com/Zagitta/gpu-unlock.git cd gpu-unlock --- 3. Step 1: Check GPU Compatibility (One-Line PowerShell Scan) Before configuring anything, run the built-in non-invasive compatibility checker. This script simply queries your GPU PCI registers and motherboard UEFI state. It makes zero system changes. !Step 1: Check GPU Compatibility in PowerShell ▲ Step 1: Run the compatibility check script in Administrator PowerShell to verify your hardware profile. Prerequisites: 1. Windows 10/11 x64 installed on a GPT drive with UEFI enabled. 2. Secure Boot: Temporarily disabled in your motherboard BIOS settings. 3. BitLocker: Disabled or suspended on your OS drive. 4. Python 3.10+ installed on your system (Download here). Run the Scan: Open PowerShell as Administrator and navigate to your gpu-unlock directory: # 1. Switch PowerShell encoding to UTF-8 chcp 65001 $OutputEncoding = [System.Text.Encoding]::UTF8 # 2. Run the compatibility analyzer python -I .\tools\collect_compatibility.py If the tool outputs can_unlock: true or Assessment Verdict: COMPATIBLE FOR DUAL-ISSUE UNLOCK, your card is supported and ready for the next step. --- 4. Step 2: Build the Staging Unlock Payload The beauty of this method is safety: we do not flash your GPU's VBIOS ROM. Instead, a tiny open-source EFI helper runs during early boot, un-throttles the GPU's instruction issue register, and immediately hands control back to the standard Windows Boot Manager. !Step 2: Build and register the unlock staging entry ▲ Step 2: Configure the EFI target partition and register the safe test entry. Original boot priority is untouched. In Administrator PowerShell, execute the following 3 commands: # 1. Configure the target EFI staging partition (uses existing ESP partition) .\internal-boot\Configure.ps1 -UnlockDriveLetter U -WindowsEspGuid 'DEFAULT' # 2. Build the unlocked headless payload with LLVM Clang .\research\headless\build-unlock.ps1 -Clang 'C:\LLVM\bin\clang.exe' # 3. Register a separate experimental test entry .\internal-boot\Headless.ps1 -Assets '.\assets' -Register > Safety Guardrail: Running Headless.ps1 -Register only adds an experimental entry to your F8 boot menu. Your default Windows Boot Manager priority remains 100% active. --- 5. Step 3: Test Boot via the UEFI F8 Menu Now we perform a safe, one-time trial run: !Step 3: Select GPU Headless Unlock in UEFI F8 Menu ▲ Step 3: Restart your PC, tap F8 at POST, and select 'GPU Headless Unlock - Experimental'. 1. Save your open documents and restart your PC. 2. When the motherboard logo appears, repeatedly tap F8 (or F11/F12 depending on your motherboard) to open the BBS Boot Menu. 3. Select GPU Headless Unlock - Experimental. 4. What to expect: The display will flash black for approximately 2 to 3 seconds while the GPU tensor issue register unlocks, then Windows will immediately launch into your desktop. 5. If at any point you press Esc within 5 seconds, the unlock is skipped and Windows boots normally. --- 6. Step 4: Verify the Speedup in vLLM & ComfyUI Once you are back in Windows, your GPU is operating at its true physical compute potential: !Step 4: Real-world speed verification in vLLM and ComfyUI ▲ Step 4: Side-by-side benchmark verification in local LLM prompt processing and ComfyUI image generation. Concrete Performance Gains: 1. Local LLM Prompt Processing (DeepSeek-R1 / Qwen 2.5 32B on vLLM): - Stock speed: ~142 tokens/sec - Unlocked speed: 268 tokens/sec (+88% throughput) - Time-to-First-Token drops from 1.82s to 0.94s. 2. ComfyUI / SDXL 1024x1024 Generation: - Stock time (30 steps): 6.8 seconds (4.41 it/s) - Unlocked time: 3.6 seconds (8.33 it/s - nearly 2x faster!) Make the Unlock Automatic on Every Boot: Once you verify that Windows runs stably and your benchmarks are improved, you can make the unlock your permanent default by running: .\internal-boot\Headless.ps1 -EnableAutomatic -ConfirmedSuccess This sets the unthrottled bootloader as primary and disables fast startup interference. --- 7. Safety, Instant Recovery & Cloud Alternatives How to Revert to Stock at Any Time: If you ever want to completely remove the bootloader modification: .\internal-boot\Headless.ps1 -RestoreWindowsFirst This immediately restores your standard Windows Boot Manager priority and removes all staging entries. --- Don't Have an RTX 30/40 GPU or Prefer Running in the Cloud? Not everyone has high-end gaming hardware or wants to keep their home PC running 24/7. Here are battle-tested production alternatives: - 24/7 Cloud Background Workers: If you need always-on background workers, scrapers, or lightweight LLM servers without hardware risks, deploy on a Hostinger Cloud VPS (starts at a few dollars per month with dedicated IPv4 and up to 70% off). - Enterprise GPU Cluster Deployment: If your organization needs large-scale multi-GPU inference clusters, vLLM orchestration, or private enterprise fine-tuning, you can hire certified ML hardware engineers on the Upwork Enterprise Network. --- Project Links & Summary | Resource | Direct Link | | :--- | :--- | | GPU-UNLOCK GitHub | Zagitta/gpu-unlock | | 1-Click Source ZIP | Download .ZIP Archive | | LLVM Clang Compiler | LLVM Project Releases | | Python Runtime | Python Official Windows Release | | Hostinger Cloud VPS | Hostinger 70% Discount Partner Link | | Upwork ML Hardware Specialists | Upwork Certified Talent Network |

  4. LLVM Weekly - #670, November 2nd 2026 LLVM Weekly - #670, November 2nd 2026 ===================================== If you prefer, you can read a HTML version of this email at <llvmweekly.org>. Welcome to the six hundred and seventieth issue of LLVM Weekly, a weekly newsletter (published every Monday) covering developments in LLVM, Clang, and related projects. LLVM Weekly is brought to you by [Alex Bradbury](linkedin.com). Subscribe to future issues at <llvmweekly.org> and pass it on to anyone else you think may be interested. Please send any tips or feedback via email: <asb@asbradbury.org>, or Mastodon: [@llvmweekly@fosstodon.org](fosstodon.org) / [@asb@fosstodon.org](fosstodon.org), or Bluesky: [@llvmweekly.org](bsky.app) / [@asbradbury.org](bsky.app). ## News and articles from around the web and events Timm Baeder gave a [Clang bytecode interpreter update on the Red Hat blog](developers.redhat.com). Saleem Abdulrasool [wrote about ABIs](speakinginswift.substack.com) on the Browser Company Speaking in Swift blog. According to the [LLVM Calendar](calendar.google.com) in the coming week there will be the following: * Office hours with the following hosts: Quentin Colombet, Renato Golin. * Online sync-ups on the following topics: formal specification, MLIR C/C++ frontend working group, pointer authentication, lifetime safety, Clang static analysis, OpenMP, Clang C and C++ language working group, Flang, RISC-V, LLVM embedded toolchains, HLSL, MLGO, LLVM libc math. * For more details see the [LLVM calendar](calendar.google.com), getting involved documentation on [online sync ups](llvm.org) and [office hours](llvm.org). ## On the forums * Anton Korobeynikov noted that [the Graphite review tool will be disabled for the LLVM project](discourse.llvm.org) as they no longer offer discounted or free plans for open source organisations. * Notes are available from various round tables / workshops at last week's Dev Meeting: [debug info](discourse.llvm.org), [LLVM hearts ML](discourse.llvm.org), and the [RISC-V roundtable](discourse.llvm.org). * Michael Kruse provided an [update on the effort to improve Flang compilation speed by de-templatising](discourse.llvm.org) noting that a key PR will land soon. "Flang should not behave any differently, but builds up to 46% faster (gcc, without precompiled headers)". * Ralf Jung started an RFC discussion on [adding a freezing memcpy](discourse.llvm.org) which would be part of the story for exposing `freeze` to programmers in Rust. * Joshua Haberman posted an RFC on [`tail_chaincc`, a maximum efficiency tailcall convention](discourse.llvm.org). It combines the callee-cleanup mechanics of `tailcc` with the register optimisations of `preserve_none` and is intended to be used with `[[clang::musttail]]`. * paperchalice wrote a v2 RFC on [TableGen support for RegisterBankInfo](discourse.llvm.org), providing a way to define register bank mapping rules by matching `TypedOperand`s. * Federico Bruzzone posted an MLIR RFC on [unifying masking in the Vector dialect](discourse.llvm.org). * Konstantin Zhuravlyov started a discussion on [vendor-owned pre-merge testing for LLVM PRs](discourse.llvm.org). ## LLVM commits * LoopStrengthReduce learned to rewrite branches to eq/ne with an immediate for targets like RISC-V with the Zibi (immediate branch extension) enabled. [0b56c8e](github.com/llvm/llvm-project/commit/0b56c8e2a5b4). * llvm-dwarfutil now supports `--compress-debug-sections`. [cc6b3b5](github.com/llvm/llvm-project/commit/cc6b3b5a1d0f). * An X86 pass was added to insert `sfence` after non-temporal stores. [238ef21](github.com/llvm/llvm-project/commit/238ef21c3564). * A number of fixes were made to tail call support on AArch64 Windows. [3c956bd](github.com/llvm/llvm-project/commit/3c956bd6bc50). * The 'debugger-tuning' module flag was introduced. [738215b](github.com/llvm/llvm-project/commit/738215bc1122). * LLVM's AI contribution policy is now referenced on the 'how to submit a bug' page. [5661d4f](github.com/llvm/llvm-project/commit/5661d4fdb9c0). * `llvm.raw.sections` named metadata was added for embedding arbitrary binary data into named sections of the output object file. [39cd74f](github.com/llvm/llvm-project/commit/39cd74fb6ea2). * The `LiveVariables` analysis was removed, described as "12 years overdue" in the commit message! [93f05d7](github.com/llvm/llvm-project/commit/93f05d753ad3). * Malloc promotion was removed due to being buggy and rarely profitable. [e2089b0d](github.com/llvm/llvm-project/commit/e2089b0ddf1a). * VPlan now computes branch costs. [999b73d](github.com/llvm/llvm-project/commit/999b73deef74). ## Clang commits * `std::meta::is_type` support was implemented. [6006957](github.com/llvm/llvm-project/commit/6006957c522e). * Clang's DepScan gained a new API to find modulemaps without loading. [ff065cf](github.com/llvm/llvm-project/commit/ff065cf32589). ## Other project commits * Bolt's webpage styling was updated. [d35f657b](github.com/llvm/llvm-project/commit/d35f657bba4c). * LLVM's libc now has double precision sinh, cosh, and tanh correctly rounded for all rounding modes. [1866d4c](github.com/llvm/llvm-project/commit/1866d4cc5634), [075a6cb](github.com/llvm/llvm-project/commit/075a6cb14025), [ff9ad99](github.com/llvm/llvm-project/commit/ff9ad993c2b9). * LLVM libc's regex implementation is being fleshed out. [ad46922](github.com/llvm/llvm-project/commit/ad46922aac46), [adb8031](github.com/llvm/llvm-project/commit/adb80317aa28).

  5. TIL in LLVM: forget the colon in a FileCheck directive (CHECK-NEXT vs CHECK-NEXT:) and it's silently ignored. Test passes, checks nothing. Found 7 in a Clang test. Once enabled, 2 of them turned out to be wrong 😅 Fix got merged: llvm-project#236646

    2 likes · 62 views
  6. It seems like someone did: llvm-project#96971. However the performance implications of this was not well explored there

  7. Maybe LLVM doesn't have time for performance improvements due to still reading through 30000 open issues, which also include miscompilations leading to incorrect results at runtime? For example, my bug report that `+= 2` is broken has not been acknowledged (read?) by anyone for 3 years: const size_t n = 13; // triggers the issue #pragma omp parallel for for (uint32_t i = 0; i < n; i += 2) { // counts PAST 13! llvm-project#70687

  8. WASIじゃない、もう一つのインターフェース「WALI」という提案 はじめに 最近、仕事でいろんな言語やツールをWebAssembly(wasm)にして、ブラウザーの中で動かすことをやっています。RubyやPython、vimのような、もともとLinuxやMacで動いているプログラムをソースからwasmにビルドする作業です。 このとき毎回悩むのが、ファイルを開く、プロセスを増やす、といった機能をどうするかです。wasmそのものはこうした機能を持っていないので、外から用意してあげる必要があります。よく使われるのは、JavaScriptで用意した関数に任せるEmscriptenと、WASIという標準の関数のセットを使う方法の2つです。 僕はWASIを使うことが多いのですが、forkが無い、シグナルが無い、mmapが無い、と毎回のように引っかかります。CLIをひとつwasmにしたいだけなのに、ソースのあちこちに#ifdef wasiを足すことになるんですよね。そんな中で知ったのが、WALI(WebAssembly Linux Interface)という研究です。 一言でいうと「WASIのような新しいAPIを作るのはやめて、Linuxのシステムコールをそのままwasmに見せてしまおう」という提案です。最初に読んだときは「それアリなの?」と思ったのですが、調べていくと思った以上にちゃんと考えられていて、しかもLLVMやRustにもすでにターゲットとして入っていました。 この記事では、WALIがどんなものなのかを論文と実物のバイナリの両方から覗いてみます。 先に言葉を整理しておきます この記事は、wasmにしたプログラムがファイルやプロセスを使いたいときの話です。普段Webを書いていると見慣れない単語がたくさん出てくるので、先にざっくり整理しておきます。 言葉 ざっくりした意味 システムコール プログラムがLinuxのカーネルに「ファイルを開いて」「画面に書いて」とお願いするための入口です。read、write、forkなど、Linuxには数百個あります libc C言語の標準ライブラリです。printfやfopenの中で、最終的にシステムコールを呼んでいます。muslはその実装のひとつで、小さくて読みやすいのが特徴です import wasmのモジュールが「この関数は外からもらいます」と宣言しているものです。wasmは自分だけではファイルも画面も触れないので、外とのやり取りは全部importした関数を通します リニアメモリ wasmのプログラムが使える1本の大きなバイト列です。wasmの中のポインタは、このバイト列の先頭から何バイト目か、という数字です WASI wasmをブラウザーの外で動かすために標準化が進められている、ファイルや時計などを使うための関数のセットです。preview1、0.2、0.3と版を重ねています Emscripten CやC++をwasmにするコンパイラーです。ファイルなどの機能はJavaScriptで用意したものを使うのが基本で、ブラウザーで動かすときによく使われます wasm32 ポインタが32ビットのwasmのことです。普段見かけるwasmはほぼこれです ABI コンパイル済みのプログラム同士が合わせておく約束ごとです。longが何バイトか、構造体をどう並べるか、などが含まれます。ABIが違うものは混ぜて使えません ターゲットトリプル コンパイラーに「どこ向けに作るか」を伝える名前です。x86_64-linux-gnuやwasm32-wasip1のように、CPUの種類や動かす環境の名前を並べて書きます WAMR WebAssembly Micro Runtimeの略で、Bytecode Allianceが開発している小さなwasmの実行エンジンです Linuxでforkを呼ぶと何が起きているか WALIの話をする前に、普通のLinuxでCのプログラムがファイルやプロセスを使うときの流れを確認しておきます。ここがわかると、WASIやWALIが「どこを差し替えているのか」がすっと入ってくると思います。 たとえば、こんなCのプログラムがあったとします。 #include <stdio.h> #include <unistd.h> int main(void) { pid_t pid = fork(); if (pid == 0) { printf("子プロセスです\n"); } else { printf("親プロセスです(子のpidは%d)\n", pid); } return 0; } fork()もprintf()も、自分で書いた関数ではないですよね。これはlibcが用意している標準の関数です。Cのプログラムは、ファイルを開くのもプロセスを増やすのも、基本的にlibcの関数を呼ぶだけで済むようになっています。 ではlibcのfork()の中で何をしているかというと、カーネルに「プロセスを複製してください」とお願いするシステムコールを発行しています。printf()も、文字列を組み立てたあと最後はwriteというシステムコールで標準出力に書き込んでいます。図にするとこんな感じです。 つまり、自分のプログラムはlibcの関数を呼んでいるだけで、カーネルとやり取りしているのはlibcのほうです。この「libcとカーネルの境目」がシステムコールなんですね。 wasmの場合、一番下のシステムコールの命令がありません。wasmは自分だけではカーネルに何もお願いできないので、どこかで「外からもらった関数」、つまりimportに置き換える必要があります。 Emscriptenでは、この部分をJavaScriptで用意した関数が受け持ちます。WASIの場合は、libcの関数をWASIの関数に読み替える形になります。そういうlibc互換のライブラリのひとつにwasi-libcがあって、open()やwrite()を呼ぶと中でWASIの関数を呼んでくれます。ただ、WASIに対応する関数が無いものは読み替えようがないので、wasi-libcにはfork()そのものがありません。冒頭の「forkが無い」というのはこういうことなんです。 WebAssembly/wasi-libc WASIの何がつらいのか WALIの話に入る前に、WALIの論文がWASIのどこを問題にしているのかを見ておきます。 論文はカーネギーメロン大学のArjun Rameshさんたちによるもので、EuroSys '25に通っています。最初にarXivに出たときのタイトルが「Stop Hiding The Sharp Knives: The WebAssembly Linux Interface」で、直訳すると「よく切れるナイフを隠すのはもうやめよう」です。forkやシグナルのような強力だけど危ない機能をwasmから隠すのはやめよう、という意味だと思うのですが、なかなか攻めた名前なんですよね。いまは「Empowering WebAssembly with Thin Kernel Interfaces」に変わっています。 arxiv.org 論文がまず指摘しているのは、WASIがいろいろな環境をまたぐために作られた新しいAPIだという点です。新しいAPIなので、実行エンジンごと・環境ごとに実装し直す必要があります。しかもPOSIXと形が違うので、既存のソフトウェアはそのままでは動きません。メモリマップやプロセス、シグナルも無いので、そこを使っているプログラムは書き換えるしかないんですよね。エンジン側の実装も大きくなりがちで、libuvwasiのpreview1の実装はエンジン側のコードだけで6,000行を超えると書かれていました。 もうひとつが、仕様がまだ動いている最中で、長く使うものを載せるには不安定だという点です。これはここ数年WASIを追いかけてきた人なら実感があると思います。preview1から、wasmのモジュール同士を型付きでつなぐComponent Modelという仕組みを前提にしたWASI 0.2に移り、2026年6月にはasyncを入れたWASI 0.3.0が出ました。 wasi.dev どれも良い方向の進化なのですが、そのたびにツールチェーンやランタイムが追いかけることになるのは地味にしんどいところです。 WALIのアイデア そこでWALIは発想を逆にします。さっきの図でいうと「libcとカーネルの境目」、つまりすでに何十年も安定しているLinuxのシステムコールを、そのままwasmのimportとして出してしまおう、というものです。 WALIはLinuxのシステムコールの上に薄く1枚かぶせるだけの層です。WALIの関数はLinuxのシステムコールとほぼ1対1で対応していて、やることは主にwasmのリニアメモリ上のポインタとホストのアドレスの変換くらいです。 こうすると、libcはmuslをほぼそのまま使えます。muslはもともとシステムコールを発行する部分が1か所にまとまっているので、CPUの命令でカーネルを呼んでいたところをimportした関数の呼び出しに差し替えるだけで済むんです。fork()もlibcの関数としてちゃんと残ります。libcがLinuxのつもりで動くので、その上に載っているbashやvim、sqliteも、ほとんどソースを変えずにwasmになります。エンジン側も小さくて、論文ではWAMRへの実装が約2,000行のC、そのうちプラットフォーム固有の部分は100行未満だそうです。 理想のAPIを作るより、もう世の中で一番使われているAPIに合わせてしまう。この割り切りがWALIのおもしろいところなんですよね。 実物を覗いてみる 論文を読むだけだとイメージしにくいので、WALIのリポジトリに入っているビルド済みのバイナリを見てみます。 arjunr2/WALI examples/precompiledの下に、lua・bash・vim・sqliteなどがwasmになって置いてあります。WALIのランタイムはLinuxが前提なので、Macだと動かすにはDockerが要るのですが、中身を覗くだけならwasm-toolsがあれば十分です。 git clone --depth 1 arjunr2/WALI cd WALI/examples/precompiled wasm-tools print lua/lua.wasm | grep '(import' | head すると、こんなimportが並んでいます。見やすいように、関数名と型番号は省きました。 (import "wali" "SYS_read" (func (param i32 i32 i32) (result i64))) (import "wali" "SYS_write" (func (param i32 i32 i32) (result i64))) (import "wali" "SYS_open" (func (param i32 i32 i32) (result i64))) (import "wali" "SYS_fstat" (func (param i32 i32) (result i64))) (import "wali" "SYS_mmap" (func (param i32 i32 i32 i32 i32 i64) (result i64))) importの名前空間はwaliひとつだけで、関数名がSYS_read、SYS_write、SYS_mmap…と、Linuxのシステムコールの名前そのものになっています。WASIだとfd_writeに「どこから何バイト」を並べた配列を渡して、書けた長さをポインタで受け取る、という独特の形でしたが、こちらはwrite(fd, buf, count)がそのままの形で出ています。戻り値も、成功なら値、失敗ならエラーの番号をマイナスにしたもの(-errno)を返す、というLinuxのシステムコールの流儀そのままです。 同じようにbash.wasmのimportも眺めていたら、驚くものが並んでいました。 (import "wali" "SYS_fork" (func ...)) (import "wali" "SYS_execve" (func ...)) (import "wali" "SYS_wait4" (func ...)) (import "wali" "SYS_kill" (func ...)) (import "wali" "SYS_pipe2" (func ...)) wasmがforkをimportしているんですよね!WASIだとそもそもプロセスという概念が薄いので、bashをwasmにしようとしたらforkとexecまわりを全部書き換えることになります。WALIではそれをそのままホストのLinuxに投げてしまいます。論文でも、forkを含むプロセス・スレッド系のシステムコールのほとんどは素通しで実装できる、と書かれています。 ちなみにスレッドも使えます。WALIでは、スレッドを1本増やすたびに同じwasmをもう1つ起動して、メモリだけを共有させる、という方法で動かしているそうです。 名前でimportするのがうまい もうひとつ「なるほど」と思ったのが、importをシステムコールの番号ではなく名前で結んでいるところです。 Linuxのシステムコール番号はCPUのアーキテクチャごとに違います。たとえばwriteはx86_64だと1番、arm64とriscv64だと64番です。さらにopenやstatのような古いシステムコールは、arm64やriscv64にはそもそもなくて、openatやnewfstatatだけがあります。 WALIの仕様はリポジトリのspec/にPythonで書かれていて、そこを見るとこの対応表がそのまま載っています。 impl("read", ["int fd", "void* buf", "size_t count"], ArchNrs(x86_64=0, arm64=63, rv64=63)), impl("write", ["int fd", "void* buf", "size_t count"], ArchNrs(x86_64=1, arm64=64, rv64=64)), impl("open", ["char* pathname", "int flags", "mode_t mode"], ArchNrs(x86_64=2)), wasmのバイナリはSYS_openという名前でimportしておいて、エンジンがホストのアーキテクチャに合わせて番号に変えたり、無いものは他のシステムコールで代わりにやったりします。これで同じwasmがx86_64でもarm64でもriscv64でも動くわけです。 仕様にはLinuxのシステムコールがひと通り並んでいて、よく使われるものから実装が進められています。システムコール以外には、コマンドライン引数を受け取る__cl_get_argcのような、wasmならではの関数が少しだけ足されています。 wasm32なのにlongが64ビット ここが今回いちばん「細かいけど驚いた」ところです。 普通、wasm32ではポインタもlongも32ビットです。WASIのターゲットでもEmscriptenでもそうなっています。ところがWALIでは、wasm32なのにlongが64ビットなんです! RustのWALIターゲットのドキュメントには、普通のwasm32との一番の違いはlongが64ビットであること、そしてそれは64ビットのホストへソースをなるべく変えずに持っていくためだ、と書かれています。 doc.rust-lang.org ホストが64ビットのLinuxなので、カーネルとやり取りする構造体のレイアウトを64ビットのLinuxに寄せておけば、変換せずにそのまま渡せる場面が増える、という理屈です。実際、WALIの仕様の型定義はCの型の大きさを64ビットのLinuxに合わせてあって、struct statは144バイト、つまりx86_64のLinuxと同じ大きさで定義されています。 一方でポインタは4バイトのままで、size_tも32ビットです。LLVMのclangのソースを見ると、WALIのときだけこう分岐しています。 if (T.isWALI()) { // The WALI ABI is documented here: // doc.rust-lang.org // Currently, this ABI only applies to wasm32 targets and notably requires // 64-bit longs LongAlign = LongWidth = 64; SizeType = UnsignedInt; PtrDiffType = SignedInt; IntPtrType = SignedInt; } 「ポインタは32ビット、longは64ビット」というのは、普通のCの世界だとなかなか見ない組み合わせです。longにポインタを入れているような古いCのコードはこれで壊れるので、そこは割り切っているんだなと思います。 ちなみにwasmにも、ポインタが64ビットになるwasm64があります。2025年9月に確定したWebAssembly 3.0で正式に仕様に入りました。「それなら全部64ビットにすればいいのでは」と思いますよね。ただ、wasm64は遅くなりやすいんです。wasm32なら読み書きできる範囲が4GBに収まるので、エンジンはその外側に大きな空き領域を置いておくだけで、範囲外へのアクセスを止められます。wasm64ではこの手が使えないので、読み書きのたびに範囲のチェックが入ってしまいます。Firefoxの開発チームも、4GBを超えるメモリが本当に必要な場合以外はwasm32のほうがいい、と書いています。 spidermonkey.dev WALIがポインタは32ビットのままlongだけを64ビットにしているのは、速さはwasm32のまま保ちつつ、Linuxとやり取りする型の大きさだけを合わせたい、という狙いなのかなと思います。 LLVMとRustにも入っている 研究のプロトタイプで終わっているのかと思いきや、上流のツールチェーンにもちゃんと入っています。 Rustではwasm32-wali-linux-muslがTier 3のターゲットとして入っています。cfgはtarget_os = "linux"かつtarget_familyにwasmとunixの両方が立つ、というおもしろい形です。 LLVMでは2025年9月にRFCが出て、 discourse.llvm.org ターゲットの名前を何にするかでけっこう議論がありました。最初はRustに合わせて、vendorの位置にwaliを入れたwasm32-wali-linux-muslが提案されたのですが、「longの大きさが違うABIなのだから、トリプルで区別できるべき」「LLVMでは普通ABIの違いをvendorでは表さない」という意見が出て、最終的に環境の位置に入れたwasm32-linux-muslwaliに落ち着いています。この名前でのPRが2025年10月にマージされました。 llvm-project#162581 clangでこのターゲットを指定すると、linuxとunixに加えてwaliが定義されます。つまりCのプログラムから見ると「Linuxでコンパイルされている」ように見えるので、#ifdef linuxで分岐しているコードがそのままLinuxのほうに入ってくれます。WASIだとlinuxは立たないので、ここも地味に大きい違いだなと思います。 WASIはWALIの上に載せればいい ここまで読むと「じゃあWASIはいらないの?」となりそうですが、論文の主張はそうではありません。 WALIは「カーネルとの境目をできるだけ薄く・低くする」ためのもので、WASIのように「このディレクトリだけ触ってよい」と権限を渡して使うAPIは、WALIの上にwasmのモジュールとして載せればいいと言っています。実際に論文では、WASIの実装であるlibuvwasiをソースを変えずにWALIの上でビルドし、テストが全部通ることを確かめています。 こうすると、WASIの実装が信頼しないといけないエンジンの中から外に出ていくので、エンジンは小さく、安全になる、という理屈です。WASIを置き換えるというより、WASIより下にもう一段の層を作る提案なんですよね。 気になるところ もちろん良いことばかりではありません。 まず、ホストがLinux前提です。WALIのエンジンはLinuxのシステムコールを素通しする作りなので、MacやWindows、ブラウザーではそのままは動きません。リポジトリでも、Linux以外ではDockerで動かす手順になっています。 次に、WASIのバイナリと混ぜられません。longの大きさが違うので、wasm32-wasip1でビルドしたライブラリとWALIでビルドしたものはABIが合わないんですよね。既存のwasmの資産とは別の世界になってしまいます。 安全面の考え方も違います。wasmのプログラムが自分のメモリの外を壊せない、という性質はそのまま残ります。ただ、ファイルやネットワークには、wasmを動かしているプロセスが触れるものなら何でも触れてしまいます。「このフォルダだけ読める」のように権限を絞りたいなら、WASIのような層を上に載せることになります。 なので、「サーバーやエッジの上で、既存のLinuxのソフトウェアをそのままwasmで動かしたい」という用途にはかなり刺さる一方、「信頼できないコードを厳しく閉じ込めたい」「ブラウザーで動かしたい」という用途では、WALIそのものよりも考え方のほうが参考になるかなと思います。 Progateでも考え方は近い ここで少しだけProgateの話をさせてください。 Progateでは、学習者が環境構築をしなくてもコードを書いて動かせるように、いろんな言語やツールをwasmにしてブラウザーの中で動かす取り組みを進めています。以前、Node.jsの学習環境をブラウザーの中で再現した話も書きました。 zenn.dev 言語が増えてくると、冒頭に書いた「WASIに無いもの」に何度もぶつかります。たとえばWASIのpreview1には作業ディレクトリを変えるchdirが無いので、相対パスを解決するところを言語ごとに手当てすることになりました。全画面で動くvimのようなツールは、端末の大きさを取ったり入力の受け取り方を切り替えたりする機能がpreview1に無くて、そこも足す必要がありました。1つずつは小さな話なのですが、言語やツールの数だけ積み重なっていくんですよね。 そこで僕も、WASI独自の形に合わせて言語ごとに手当てを重ねるより、Linuxのシステムコールの形に寄せていく方向で考えています。考え方はWALIとかなり近いです。 ただ、ブラウザーの中には素通しする先のLinuxがないので、WALIをそのまま使うことはできません。また、すでにwasm32-wasip1でビルドした資産がたくさんあるので、longが64ビットになるWALIのABIには合わせていません。WALIの論文を読んだときは「同じことを考えている人がいて、しかも論文と上流のツールチェーンまで持っていっている」と知って、すごく励まされました。 まとめ WALIは、Linuxのシステムコールというすでにある境界をそのままwasmに出す、という割り切った提案でした。importにはSYS_writeのようなシステムコールの名前がそのまま並び、bashのwasmはforkまでimportしています。番号ではなく名前で結ぶことでCPUの違いを吸収していたり、wasm32なのにlongが64ビットだったりと、細かいところを見ていくとかなり考えて作られているのがわかります。研究で終わらず、LLVMとRustにもターゲットとして入っているのもすごいなと思います。 個人的には「新しいAPIを一から設計するより、Linuxに合わせたほうが結局みんな幸せなのでは」という問いかけがすごく刺さりました。WASIの話になるとComponent Modelやasyncの話題が多いですが、こういう「もっと下の層をどうするか」という方向の議論もあるんだなと、しみじみ思います。 Progateでも、ブラウザーの中で既存のプログラムをどこまでそのまま動かせるかは、まだまだ試行錯誤している途中です。また進んだら書きたいと思います! 参考 Arjun Ramesh, Tianshu Huang, Ben L. Titzer, Anthony Rowe. "Empowering WebAssembly with Thin Kernel Interfaces." EuroSys '25. dl.acm.org arXiv版: arxiv.org WALI のリポジトリ: arjunr2/WALI WALI の仕様: wasm-thin-kernel-interfaces.github.io Rust の wasm32-wali-linux-*: doc.rust-lang.org LLVM の RFC: discourse.llvm.org LLVM の PR #162581: llvm-project#162581 WASI 0.3.0: wasi.dev

    1 like
  9. LLVMにプチ貢献した🙌 llvm-project#235840

    7 likes · 273 views
  10. Reddit · · r/TrueOpenSource · u/JesseVPAND · llvm/llvm-project

    ICPP - Run C++ anywhere, just like a script. Interpreting C++, executing the source and executable like a script. - Writing powerful script using C++ just as easy as Python; - Writing hot-loading C++ script code in running process; - Based on AetherVM binary engine and Clang/LLVM C++ compiler; - Integrated internally with Standard C++23 libraries; - Integrated AetherVM and AetherBinary aarch64/x86_64 emulation engine for MachO/ELF/PE; - To reuse the existing C/C++ library as an icpp module extension is extremely simple. vpand/icpp

    1 point

Achievements

Awards earned by the repositories llvm owns. Select an award to embed its badge.

Gold
1921st place finishes
Silver
2512nd place finishes
Bronze
2523rd place finishes
Awarded repositories
1Owned by llvm now

Repositories

Ordered by gold, then silver, then bronze.

  1. llvm-projectBest: 1st by PR authors, 269 PR authors192251252

Every award

Top-three finishes of these repositories in completed trending days and weeks, newest first.

  1. llvm-project
  2. llvm-project
  3. llvm-project
  4. llvm-project
  5. llvm-project
  6. llvm-project
  7. llvm-project
  8. llvm-project

A repository earns an award for finishing first, second or third in a completed trending day or week, ranked by new stars, new forks or pull request authors. Awards follow a repository through renames and transfers and count toward its current owner. Weeks run Monday to Sunday, UTC.