Avatar
omochimetaru 9/28/2025 1:43 PM
https://youtu.be/E9GdNKjGZ7Y?si=HWsGVoUOHUOdgYI3 llvm-casclang に導入するパッチの解説動画を見ました。難しくて推測混じりですが・・・ 内容をキーにした(content addressable)なストレージを基盤に使って、その上でファイルシステムのミラーのようなものを作る これはイミュータブルなツリーになる。 その上でコンパイラの個別の処理を動かして、既存の依存スキャンやジョブキャッシュの仕組みを使うと、 必然的に内容が違えば入力パラメータに含まれるファイル参照が変わるので、ファイルシステムの意図しないミュータビリティを避けることができてキャッシュシステムとして安定する かつ、同一内容は単一化されるので、クリーンを跨いだリビルドでも以前の内容を使ったキャッシュが動かせる。 ファイルツリーだけじゃなくて、#include ツリー(ようわからん)とかMachOバイナリなどのドメインデータ構造もCAS上のツリーとして扱うことで、ブロブのキャッシュが効いて、ビルドシステム全体で消費する物理ストレージがだいぶ節約できる。
1:45 PM
で、調べてみると、Swift CompilerもCASを活用できるようにパッチが最近入ってる。一連のパッチは @cachemeifyoucan さんが作ってて、そのために生まれた人みたいになってる・・・ https://github.com/swiftlang/swift/pull/81990
Create a path that swift-frontend can execute an uncached job from modules built with CAS based explicit module build. The new flag -import-module-from-cas will allow an uncached build to load modu...
1:48 PM
Step 1 of making swift compiler output cacheable. Virtualize swift compiler outputs (not everything yet, but most of the important output to show feasibility) and add a mechanics to verify the outp...
Teach swift compiler about CAS to allow compiler caching in the future. Add flags to initiate CAS inside swift-frontend Teach swift to compile using a CAS file system.