From 97cd77e40d9d33feb2b1d7544bdf3f2da61880f7 Mon Sep 17 00:00:00 2001 From: tignear Date: Sat, 17 Oct 2026 10:07:12 +0900 Subject: [PATCH 1/3] docs: remove ADRs moved to Claude Docs The architecture decision records now live in the maintainers' Claude Docs alongside the other design documents. Drop the adr/ directory and its entry in the CI change classifier. --- adr/0001-value-change-callback-gpi-vpi.md | 106 ---------- adr/0002-external-modules.md | 195 ------------------ adr/0003/README.md | 186 ----------------- adr/0004-software-modules-sequential-first.md | 179 ---------------- adr/README.md | 26 --- scripts/ci-changes.mjs | 2 +- scripts/ci-changes.test.mjs | 2 +- 7 files changed, 2 insertions(+), 694 deletions(-) delete mode 100644 adr/0001-value-change-callback-gpi-vpi.md delete mode 100644 adr/0002-external-modules.md delete mode 100644 adr/0003/README.md delete mode 100644 adr/0004-software-modules-sequential-first.md delete mode 100644 adr/README.md diff --git a/adr/0001-value-change-callback-gpi-vpi.md b/adr/0001-value-change-callback-gpi-vpi.md deleted file mode 100644 index 18814e54095..00000000000 --- a/adr/0001-value-change-callback-gpi-vpi.md +++ /dev/null @@ -1,106 +0,0 @@ -# ADR-0001: Value Change Callback / GPI / VPI - -- **Date**: 2026-03-07 -- **Status**: proposed - -## Context - -Simulation に値変化コールバック (VCC) がなく、cocotb 連携や JS/TS からのリアクティブな信号監視ができない。 - -cocotb は GPI (Generic Programming Interface) を通じてシミュレータと通信する。Celox をcocotb バックエンドとして使うには GPI 互換レイヤーが必要。また JS/TS テストベンチでも同等の機能が求められる。 - -## Decision - -4 段階のフェーズで VCC → JS/TS API → GPI → VPI を積み上げる。 - -### Phase 1: Value Change Callback in Simulation - -Snapshot Compare 方式(JIT ノータッチ)で実装する。 - -- `step()` 前後で watched signal のバイト列を比較し変化を検出 -- JIT コード変更不要 -- watched signal 数は cocotb 典型で 10–20 個程度、スケジューラ処理に比べてオーバーヘッドは誤差 - -#### API (Rust) - -```rust -pub type WatchId = u32; - -impl Simulation { - fn watch(&mut self, signal: SignalRef, callback: WatchCallback) -> WatchId; - fn unwatch(&mut self, id: WatchId); -} -``` - -#### Implementation - -- `step()` 前: watched signal の値を snapshot (`Vec` バッファ) -- `step()` 実行 -- `step()` 後: snapshot と現在値を比較、変化していたら callback 発火 -- バッファは watch リスト変更時のみ再確保 - -### Phase 2: JS/TS API (NAPI) - -Simulation の VCC を NAPI 経由で JS に expose する。 - -```typescript -const watchId = simulation.watch(signal, (newValue) => { - console.log(`signal changed: ${newValue}`); -}); -simulation.unwatch(watchId); - -// cocotb-like sugar -await simulation.risingEdge(clockSignal); -await simulation.valueChange(dataSignal); -``` - -JS callback は `step()` の同期コンテキスト内で呼ばれる(napi-rs の threadsafe function は不要、single-threaded)。 - -### Phase 3: cocotb GPI Backend - -cocotb の `GpiImplInterface` を C ABI で実装する。 - -| GPI operation | Celox mapping | -|---|---| -| `gpi_get_root_handle` | `Simulation::named_hierarchy()` | -| `gpi_iterate` / `gpi_next` | hierarchy traversal | -| `gpi_get_handle_by_name` | `Simulation::signal()` | -| `gpi_get_signal_val_*` | `Simulation::get()` | -| `gpi_set_signal_val_*` | `Simulation::modify()` | -| `gpi_register_value_change_callback` | `Simulation::watch()` | -| `gpi_register_timed_callback` | `Simulation::schedule()` | -| `gpi_deregister_callback` | `Simulation::unwatch()` | - -Build: -- Rust crate (`celox-gpi`) exporting `extern "C"` functions -- cocotb discovers it via `GPI_EXTRA` / `MODULE` env vars -- Shared library (.so) that cocotb loads at startup - -### Phase 4: VPI Compatibility Layer - -GPI の上に thin VPI wrapper を載せる。 - -- `vpi_get_value` / `vpi_put_value` -- `vpi_register_cb` (cbValueChange, cbAfterDelay, cbNextSimTime) -- `vpi_iterate` / `vpi_scan` -- `vpi_handle_by_name` - -初期化は VPI 標準の `vlog_startup_routines` ではなく Celox 独自のロード機構で良い。 - -### Non-goals - -- JIT コードへの dirty bit 埋め込み(不要) -- VPI 完全準拠(cocotb + 基本操作のみ) -- マルチスレッド対応(single-threaded で十分) - -## Consequences - -- cocotb の Python テストベンチがそのまま Celox 上で動くようになる -- JS/TS テストベンチでリアクティブな信号監視が可能になる -- Snapshot Compare はシンプルだが、watched signal が大量(数百以上)になると性能懸念あり(その場合は JIT 内 dirty bit を検討) - -### Open Questions - -- cocotb の GPI C ABI は安定しているか?バージョン間で互換性は? -- `cbReadWriteSynch` / `cbReadOnlySynch` の region scheduling をどこまでサポートするか -- Python ↔ Rust の FFI: PyO3 vs 生 C ABI diff --git a/adr/0002-external-modules.md b/adr/0002-external-modules.md deleted file mode 100644 index 02ab1aed2ed..00000000000 --- a/adr/0002-external-modules.md +++ /dev/null @@ -1,195 +0,0 @@ -# ADR-0002: External Modules - -- **Date**: 2026-03-07 -- **Status**: proposed - -## Context - -Celox は現在 Veryl ソースコードのみをシミュレーション対象としている。全モジュールが Veryl で記述されている必要があり、外部 IP コア(メモリモデル、アナログモデル、プロプライエタリ IP のスタブ等)をシミュレーションに組み込む手段がない。 - -将来の SystemVerilog フロントエンド対応の布石としても、フロントエンド非依存なモジュール抽象が必要。 - -### 現状の制約 - -- `Component::SystemVerilog` は `ParserError::unsupported()` で拒否される -- 全モジュールが `Veryl Source → Analyzer → SIR → JIT` パイプラインを通る前提 -- 外部/スタブモジュールの概念がない - -## Decision - -Rust trait で振る舞いを実装したモジュールを、Veryl 設計内で透過的にインスタンスできる仕組みを導入する。DLL/SO からの動的ロードもサポートする。 - -### Architecture - -``` -Veryl Source (stub module + design) - │ - ▼ -Veryl Analyzer ── ポート情報を正常に解析 - │ - ▼ -Celox Parser - ├── 通常モジュール → SimModule → SIR → JIT - └── 外部モジュール → ExternalSimModule (ポートのみ、ロジックなし) - │ - ▼ -Flatten (hierarchy expansion) - ├── 通常インスタンス: glue blocks + relocate - └── 外部インスタンス: glue blocks のみ (内部ロジックなし) - │ - ▼ -JIT Compilation - └── eval_comb 内で外部モジュールは call_indirect で呼出し - │ - ▼ -Runtime - ├── JIT コード: 通常の組合せ/順序ロジック - └── 外部モジュール: trait method 呼出し (eval / clock_edge) -``` - -### 1. Rust Trait API - -Factory と Instance の 2 層構造: - -```rust -/// 外部モジュールの定義。ポート宣言とインスタンス生成を担う。 -pub trait ExternalModule: Send + Sync + 'static { - fn name(&self) -> &str; - fn ports(&self) -> &[PortDef]; - fn instantiate(&self) -> Box; -} - -/// 各インスタンスの振る舞い。 -pub trait ExternalModuleInstance: Send + 'static { - fn eval(&mut self, io: &mut PortIO); - fn on_rising_edge(&mut self, _clock: &str, _io: &mut PortIO) {} - fn on_falling_edge(&mut self, _clock: &str, _io: &mut PortIO) {} -} -``` - -Port I/O は JIT メモリバッファへの直接アクセス: - -```rust -pub struct PortIO<'a> { - memory: &'a mut [u8], - ports: &'a [PortSlot], -} - -impl<'a> PortIO<'a> { - pub fn get_u64(&self, name: &str) -> u64; - pub fn get_bool(&self, name: &str) -> bool; - pub fn get_wide(&self, name: &str) -> BigUint; - pub fn set_u64(&mut self, name: &str, val: u64); - pub fn set_bool(&mut self, name: &str, val: bool); - pub fn set_wide(&mut self, name: &str, val: BigUint); -} -``` - -### 2. Veryl Stub - -Analyzer 変更不要。stub をヘッダファイルとして使う: - -```veryl -module Memory ( - clk: input '_ clock, - addr: input logic<16>, - wdata: input logic<8>, - we: input logic, - rdata: output logic<8>, -) {} -``` - -- Analyzer は普通のモジュールとして処理する -- ポート型チェックが Veryl 側で完結する -- `inst` のポート接続構文がそのまま使える - -### 3. Builder API - -```rust -let sim = Simulator::builder(code, "Top") - .external_module(MemoryModel::descriptor()) // 同一バイナリ - .load_external_module("path/to/libcustom.so") // DLL/SO - .build()?; -``` - -Builder 内部処理: -1. `parse_ir()` で Veryl を解析 -2. 外部モジュール名と `SimModule` 名をマッチング -3. マッチしたモジュールを `ExternalSimModule` に置換(ポート Variables 保持、ロジック空) -4. `flatten()` で外部インスタンスも通常通り `InstanceId` を割当て -5. JIT コンパイル時、外部モジュールの `eval` を組込み - -### 4. Parser Integration - -`Component::SystemVerilog` と stub(ロジック空の `Component::Module`)の両方を外部モジュール名でマッチング。マッチしたら `ExternalSimModule`(ポートのみ)として扱う。 - -### 5. JIT Integration (eval_comb) - -Cranelift の外部関数呼出しで eval_comb 内から直接コールバック: - -``` -eval_comb JIT function: - ... (通常の comb ロジック) ... - ┌─ glue: parent → external module input ports (JIT) - │ call external_module_eval(instance_ptr, memory_ptr) - └─ glue: external module output ports → parent (JIT) - ... (通常の comb ロジック 続き) ... -``` - -トポロジカルソートには合成 `LogicPath` で参加(保守的に全出力が全入力に依存)。 - -### 6. Clock Edge Handling - -`tick(event)` 時: -1. `eval_comb()` — 外部モジュール `eval` 含む -2. 通常の FF apply -3. 外部モジュールの `on_rising_edge()` / `on_falling_edge()` 呼出し -4. `eval_comb()` — 再評価 - -クロックエッジ処理は JIT 外で実行。出力ポートへの反映は次の `eval_comb` で。 - -### 7. DLL/SO Loading - -```rust -pub type RegisterFn = unsafe extern "C" fn(registry: &mut dyn ModuleRegistry); - -pub trait ModuleRegistry { - fn register(&mut self, module: Box); -} -``` - -- `celox_register` 関数のシグネチャは C ABI (`extern "C"`) -- trait は Rust ABI — 同一 rustc バージョン制約 -- 将来、完全な C ABI vtable (`abi_stable` 等) に移行する可能性あり -- `libloading` で動的ロード - -### Implementation Phases - -| Phase | Scope | -|-------|-------| -| 1 | 基盤: trait 定義、builder API、parser 統合、eval_comb 組込み(同一バイナリ、comb のみ) | -| 2 | 順序ロジック: `on_rising_edge` / `on_falling_edge` の tick() 統合 | -| 3 | DLL/SO ロード: `celox-module-abi` crate、`libloading` | -| 4 | 拡張: TS/JS コールバック (NAPI ラッパー)、proc macro、stub 自動生成 | - -## Consequences - -### Positive - -- メモリモデル、IP スタブ等をシミュレーションに組み込める -- Veryl 側は `inst` 構文がそのまま使え、外部モジュールを意識しない -- DLL/SO で配布可能 — ソース非公開の IP モデルに対応 -- TS/JS コールバックは Rust trait の NAPI ラッパーとして自然に拡張可能 - -### Negative - -- eval_comb 内の外部関数呼出しが JIT 最適化の境界になる -- DLL は同一 rustc バージョン制約(v1) -- Veryl stub と trait の `ports()` の整合性を build 時に検証する必要がある - -### Open Questions - -1. **eval_comb 分割戦略**: JIT 関数分割 vs Cranelift `call_indirect`。後者が実装は楽だが最適化境界になる。 -2. **4-state サポート**: 外部モジュールポートでの X/Z 値の扱い。v1 では 2-state のみで十分か。 -3. **配列インスタンス**: `inst mem: Memory[4]` — `instantiate()` が 4 回呼ばれ独立した状態を持つ。 -4. **パラメトリック外部モジュール**: `instantiate()` にパラメータを渡す仕組みが必要。 diff --git a/adr/0003/README.md b/adr/0003/README.md deleted file mode 100644 index 02516b2f89d..00000000000 --- a/adr/0003/README.md +++ /dev/null @@ -1,186 +0,0 @@ -# ADR-0003: Self-Hosted x86-64 Backend - -- **Date**: 2026-03-24 -- **Status**: implemented -- **Updated**: 2026-03-28 - -## Context - -Celox は Cranelift を JIT バックエンドとして使用していたが、以下の問題により限界に達していた。 - -### Cranelift / regalloc2 の問題 - -1. **Live register 数のスケーリング破綻**: regalloc2 の backtracking allocator は、同時に live な register が数百〜数千になるとコンパイル時間が爆発する。wasmtime issue #3523 では、大きな関数のコンパイル時間の 96% が regalloc に消費された(15.48s / 16.04s) -2. **VReg 上限**: regalloc2 は Operand を 32bit に pack しており、VReg 数が 2^21(約 210 万)に制限される。64bit 化は 5-10% の性能劣化を伴う -3. **メモリ割り当てオーバーヘッド**: `try_to_allocate_bundle_to_reg` 単体で 1600 万回の一時 HashSet 確保が発生(issue #87) -4. **大きい Execution Unit への対応不能**: HDL シミュレーションの組み合わせ回路は巨大な関数を生成するが、Cranelift の主要ユーザーである wasmtime は小さな WASM 関数が前提 - -### 以前の workaround(Cranelift 時代) - -- **Tail-call splitting**: EU を CLIF 命令閾値・VReg 閾値以下に分割 -- **split_wide_commits**: Cranelift が wide value を扱えないため SIRT 側で事前分割 -- **reschedule**: Cranelift の regalloc のためのプレッシャー制御 - -## Decision - -Cranelift を自前の x86-64 コードジェネレータで完全に置き換えた。デフォルトバックエンドとして切り替え済み。 - -## Pipeline Architecture(実装済み) - -``` -SIR (bit-level SSA) - ↓ ISel (isel.rs) -MIR (word-level SSA, virtual registers) + SpillDesc per VReg - ↓ Analysis (analysis.rs) — liveness, next-use distance - ↓ Unified single-pass allocator (unified.rs) - — simultaneous spilling + assignment using RegFile -MIR (physical registers) - ↓ Emit (emit.rs) — iced-x86 CodeAssembler -x86-64 machine code -``` - -### MIR Design - -MIR は SIR(bit-level)と machine code の間に位置する word-level SSA IR。 - -- **64-bit レジスタ単位**: 全操作は 64-bit VReg 上で行う。>64-bit 値はチャンク配列 -- **SpillDesc サイドテーブル**: 各 VReg のスピルコスト情報。bit-level のアクセス情報を保持し、regalloc 本体は bit layout を知らなくてよい - -``` -SpillCost: - Rematerializable → cost 0 // 即値、再生成するだけ - SimStateAligned → cost 1 // static offset, word-aligned - SimStateSmall → cost 2 // static offset, width < native width - SimStateDynamic → cost 4 // dynamic offset - Transient → cost 2 // スタック spill slot -``` - -### ISel (isel.rs) - -SIR → MIR 変換。以下を処理: - -- **Narrow (≤64-bit)**: Load/Store, 全算術・論理・比較・シフト演算、Concat, Slice -- **Wide (>64-bit)**: チャンク分割による Add/Sub(carry chain), Mul(schoolbook O(n²)), Div/Rem(bit-by-bit restoring), Shl/Shr/Sar(定数: チャンクシフト+キャリー、ランタイム: select chain), 比較(MSB-to-LSB cascading), Concat repack, Slice -- **4-state**: 全操作に対するマスク伝播。値の正規化(`v |= m`、X = v:1,m:1) - - AND/OR/XOR: per-bit mask formula - - Arithmetic/Comparison: conservative(any X → all-X) - - Shift: 定数シフトはマスクも同様にシフト、ランタイムシフト amount X → all-X - - LogicAnd/Or: IEEE 1800 dominant-value semantics - - Reduction AND/OR: IEEE 1800 dominant-value semantics(definite-0/1 → 結果確定) - - Wildcard ==?/!=?: RHS X/Z ビットは don't-care - - Concat: narrow/wide ともマスクチャンクの repack - - Store to bit type: ソースレジスタのマスクを 0 にクリア - -### Unified Register Allocator (unified.rs) - -当初は Braun & Hack の separate-pass 設計(spilling → assignment)を実装したが、spilling と assignment の live set tracking に構造的な差分が生じ、k-1 ハックや eviction fallback が必要になった。最終的に **unified single-pass allocator** に置き換えた。 - -#### RegFile - -```rust -struct RegFile { - preg_to_vreg: BTreeMap, - vreg_to_preg: BTreeMap, -} -``` - -物理レジスタ ↔ VReg の双方向マップで、各プログラムポイントの正確なレジスタ状態を追跡。 - -#### アルゴリズム - -1. **Entry state**: predecessor の exit RegFile をマージ。phi coalescing を試行 -2. **Forward walk**: 各命令で uses を ensure(reload if needed)→ evict to k → assign def -3. **Eviction**: next-use distance 最遠 + remat/store-back-only を優先的に evict -4. **Fixed constraints**: shift rhs → RCX。occupant を spill + Mov で退避。pinned VReg 追跡 -5. **Clobbers**: UDiv/URem の RAX/RDX clobber。blocked set でこれらを def 割り当てから排除 -6. **Coupling code**: predecessor exit ↔ successor entry の差分で spill/reload を挿入 - -k = NUM_REGS = 13 (x86-64: 16 GPR - RSP - RBP - SimState base)。k-1 ハック不要。 - -#### next-use lookup - -`use_positions: BTreeMap>` による O(log n) binary search。O(n) forward scan を置き換え。 - -### Verifier (regalloc.rs) - -`#[cfg(debug_assertions)]` で有効。同時 live な VReg が同一 PhysReg を共有しないことを検証。use_positions テーブルによる O(n log n) dead check(O(n²) verifier を修正、sorter N=64 が 180s timeout → 5.3s に改善)。 - -### Code Emission (emit.rs) - -iced-x86 CodeAssembler で x86-64 機械語を生成。 - -- Prologue/Epilogue: callee-saved push/pop, frame allocation, SimState base (R15) setup -- Multi-EU chaining: 各 EU の ret を jmp rel32 にパッチして連鎖 -- Select emit: `dst == true_val` 時の reverse logic(cmove) -- UMulHi: `mul r64` → RDX 取得(wide Mul の上位 64 bit) - -## 4-State Support - -IEEE 1800 の 4-state logic をネイティブサポート。 - -### Memory Layout - -`MemoryLayout::build(sir, four_state=true)` で全変数に value + mask の二重領域を割り当て。mask は value の直後(`offset + byte_size`)。 - -### Encoding - -| mask | value | 意味 | -|------|-------|------| -| 0 | 0 | 0(definite zero)| -| 0 | 1 | 1(definite one)| -| 1 | 0 | Z(high-impedance)| -| 1 | 1 | X(unknown)| - -### 値の正規化 - -Binary 演算後に `value |= mask` を適用。X ポジション(mask=1)の値ビットを必ず 1 にし、エンコーディングの一貫性を保証。 - -### 初期化 - -`logic` 型変数は X で初期化(value=0xFF, mask=0xFF)。`bit` 型は 0 で初期化。 - -## Complexity - -| Phase | 計算量 | -|---|---| -| Analysis (liveness, next-use distance) | O(n) per iteration, bounded | -| ISel | O(n) | -| Unified allocator (spill + assign) | O(n × k) | -| Verifier (debug builds) | O(n × k × log n) | -| Code emission | O(n) | -| **Total** | **O(n × k)** ≈ **O(n)** | - -### Benchmark: SorterTreeDistEntry - -| N | 旧 (Cranelift workaround 時代) | 新 (native backend) | -|---|---|---| -| 16 | ~24 min (branch-based mux) | 1.0s | -| 64 | timeout | 5.3s | -| 128 | — | 15.1s | - -## 削減・簡素化されたパス - -| パス | Cranelift 時代 | Native backend 後 | -|---|---|---| -| `tail_call_split` | regalloc2 の VReg 上限回避 | **不要** | -| `split_wide_commits` | Cranelift が wide value を扱えない | **不要**(ISel がチャンク処理)| -| `reschedule` | regalloc のためのプレッシャー制御 | **簡素化可能** | - -## Target Architecture Strategy - -MIR はターゲット中立。emit phase のみターゲット別に分岐。 - -``` -SIR (bit-level, 共通) - ├── native backend: SIR → ISel → MIR → Unified Alloc → Emit (x86-64) - └── wasm backend: SIR → WASM codegen(MIR を経由しない) -``` - -AArch64 / RISC-V 対応は emit phase の追加で可能(k, ABI, 命令エンコーディングが異なる)。 - -## References - -- Braun, M. and Hack, S. (2009). "Register Spilling and Live-Range Splitting for SSA-Form Programs." CC 2009. -- Hack, S., Grund, D., and Goos, G. (2006). "Register Allocation for Programs in SSA-Form." CC 2006. -- Schwarz, T., Kamm, T., and Engelke, A. (2025). "TPDE: A Fast Adaptable Compiler Back-End Framework." CGO 2026. -- Cranelift/regalloc2 issues: wasmtime#3523, wasmtime#8783, regalloc2#87 diff --git a/adr/0004-software-modules-sequential-first.md b/adr/0004-software-modules-sequential-first.md deleted file mode 100644 index 3613dfabfa8..00000000000 --- a/adr/0004-software-modules-sequential-first.md +++ /dev/null @@ -1,179 +0,0 @@ -# ADR-0004: Software Modules Are Sequential-First - -- **Date**: 2026-04-12 -- **Status**: proposed - -## Context - -Celox で HDL モジュールの代わりに software 実装を差し込めるようにしたい。主な動機は、Vivado の MIG のような大きくて扱いづらい IP を、検証時だけ software 実装に置き換えたいことにある。 - -要件としては次が強い。 - -- HDL source 上では普通の module として存在してほしい -- どの階層でも普通の module と置き換えて使えてほしい -- host 側が module 名で software 実装へ差し替えたい - -一方で、software module の内部 signal と combinational scheduling を真面目に扱おうとすると、次の問題がある。 - -- same-cycle の input -> output combinational path があると、global scheduler の dependency graph に参加する必要がある -- callback ベースで雑に `eval_comb()` すると性能の根幹が死ぬ -- dependency を手で書かせると correctness が壊れやすい -- host language で graph/IR を組ませる方向に寄せると、「それなら RTL を書けばよい」に近づく - -特に MIG 代替のようなユースケースでは、本当に欲しいのは arbitrary combinational component 一般ではなく、 - -- 大きな内部 state を持つ -- bus-facing である -- cycle 単位で進む -- 入出力のどちらか、または両方が register で切られている - -ような externally synchronous component であることが多い。 - -## Decision - -software module は 2 種類に分けて扱う。 - -1. **Sequential software module** -2. **Combinational software module** - -v1 では **Sequential software module のみを正式対象** とする。Combinational software module は将来課題として分離し、同じ仕組みで一気に解こうとしない。 - -### 1. Instantiation model - -HDL source 上では普通の module を使い、host 側が module 名で software 実装へ差し替える。 - -- Veryl 側に専用構文は追加しない -- software module は top 専用ではなく、任意階層の instance と置き換え可能であるべき -- 親モジュールからは普通の instance と同じ port shape を持つ - -### 2. v1 で許可する software module - -v1 の software module は、**externally synchronous** でなければならない。 - -具体的には、module の外から観測可能な - -- input -> output - -の same-cycle combinational pathを持ってはならない。 - -言い換えると、 - -- 入力変化が同一 cycle 中にそのまま出力へ反映される component -- global comb scheduler の fixpoint に参加しないと正しく動かない component - -は v1 の対象外とする。 - -この制約により、MIG 代替や bus-facing memory model のような stateful component を先に扱える。 - -### 3. Internal signal - -Sequential software module は内部 state / internal signal を持ってよい。 - -ただし v1 では、それらは **module 内部に閉じた state** として扱い、global combinational scheduler に参加させない。 - -- 内部 state 更新は event / cycle 境界で行う -- 出力の更新も cycle 単位の contract に従う -- software module 内部の combinational detail を global dependency graph へ露出しない - -### 4. Host API registration first - -v1 は host 側 API で software module を登録する。 - -```rust -let sim = Simulator::builder(code, "Top") - .register_software_module("MigModel", |ctx| Box::new(MigModel::new(ctx))) - .build()?; -``` - -builder は module 名を key に registry を持ち、elaboration 時に一致した module instance を software 実装へ差し替える。 - -- HDL source 上では普通の module 定義を置く -- host は `module_name -> factory` を登録する -- factory は parameter / port metadata / instance path を受けて instance state を生成する - -想定する最小 API は次の 2 層である。 - -```rust -pub trait SoftwareModuleFactory: Send + Sync + 'static { - fn module_name(&self) -> &str; - fn instantiate(&self, ctx: &SoftwareModuleContext) -> Box; -} - -pub trait SequentialSoftwareModule: Send + 'static { - fn on_event(&mut self, event: EventId, io: &mut SoftwareIo); - fn settle_outputs(&mut self, io: &mut SoftwareIo); -} -``` - -`settle_outputs()` は pure combinational callback 一般ではなく、「外部から見て cycle 境界に閉じた output 導出」であることを要求する。 - -### 5. Execution model - -software module instance は instance graph の正式メンバーとして扱う。 - -- 親から見える port shape は元の HDL module と一致しなければならない -- flatten / path 解決 / hierarchy 上は普通の instance として見える -- 中身の実行だけが software 実装になる - -v1 の scheduler contract は次の通り。 - -1. 通常の HDL comb を評価 -2. event 境界で software module の `on_event()` を実行 -3. event 後に software module の `settle_outputs()` を実行 -4. software module output の変化を downstream に反映 - -この contract は、same-cycle input -> output path を持たない externally synchronous component を対象にしている。 - -### 6. DLL/SO loading later - -将来は host registry と同じ registry interface を DLL/SO から埋められるようにする。 - -```rust -pub trait SoftwareModuleRegistry { - fn register(&mut self, factory: Box); -} - -pub type RegisterFn = unsafe extern "C" fn(registry: &mut dyn SoftwareModuleRegistry); -``` - -- v1 は同一バイナリ内の host API 登録だけをサポートする -- v2 以降で `libloading` により `celox_register` をロードする -- 初期段階では Rust ABI 制約を許容する -- 必要なら将来 `abi_stable` 等で C ABI に寄せる - -### 7. What is deferred - -次は v1 では扱わない。 - -- same-cycle input -> output path を持つ software module -- global combinational scheduler への software node 参加 -- software module 内部 signal の global dirty propagation -- arbitrary callback ベースの `eval_comb()` による汎用 combinational component -- DLL/SO の安定 ABI - -これらは別 ADR / 別設計課題として扱う。 - -## Consequences - -### Positive - -- MIG 代替のような大きな stateful component を、RTL を無理に書かずに差し替えられる -- software module を module 名置換で使えるため、HDL 側の記述は自然 -- いきなり global comb scheduler を壊さずに導入できる -- 「汎用 software module」と「comb scheduler 統合」という別難題を分離できる -- v1 は host API 登録だけで始められるため、ABI/配布問題を後回しにできる - -### Negative - -- v1 では truly combinational な software component は扱えない -- input -> output same-cycle path を持つ memory/peripheral model は対象外になる -- 将来 combinational software module をやる場合、別の execution model が必要 -- DLL/SO ロードは別フェーズになる - -### Open Questions - -1. `settle_outputs()` をどこまで pure / side-effect-free に強制するか -2. `ready/valid` のような bus interface を v1 制約の下でどこまで自然に扱えるか -3. software module の internal state を introspection/debug でどこまで見せるか -4. module 名差し替え時に、元 HDL module body をどの段階で無視するか -5. parameterized module を factory にどう渡すか diff --git a/adr/README.md b/adr/README.md deleted file mode 100644 index 845a6006c5f..00000000000 --- a/adr/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# Architecture Decision Records - -プロジェクト内部の設計意思決定を時系列で記録する。 - -## Format - -`NNNN-title.md` — 連番 + kebab-case タイトル。 - -各 ADR は以下のセクションを持つ: - -- **Date**: 作成日 -- **Status**: `proposed` / `accepted` / `superseded` / `deprecated` -- **Context**: 背景・課題 -- **Decision**: 決定事項 -- **Consequences**: 結果・影響 - -Status が変わった場合は ADR 内に履歴を追記する。 -superseded の場合は後継 ADR へのリンクを記載する。 - -## Index - -| # | Title | Date | Status | -|---|-------|------|--------| -| [0001](0001-value-change-callback-gpi-vpi.md) | Value Change Callback / GPI / VPI | 2026-03-07 | proposed | -| [0002](0002-external-modules.md) | External Modules | 2026-03-07 | proposed | -| [0004](0004-software-modules-sequential-first.md) | Software Modules Are Sequential-First | 2026-04-12 | proposed | diff --git a/scripts/ci-changes.mjs b/scripts/ci-changes.mjs index ff5349b3e4f..7f4b683d2f3 100644 --- a/scripts/ci-changes.mjs +++ b/scripts/ci-changes.mjs @@ -143,7 +143,7 @@ export function classifyFiles(files, { releasePlease = false } = {}) { } if ( - startsWithAny(path, ["docs/", "adr/"]) || + startsWithAny(path, ["docs/"]) || path === "README.md" || path === "CONTRIBUTING.md" ) { diff --git a/scripts/ci-changes.test.mjs b/scripts/ci-changes.test.mjs index 54f41654427..b8431896085 100644 --- a/scripts/ci-changes.test.mjs +++ b/scripts/ci-changes.test.mjs @@ -33,7 +33,7 @@ const all = { test("documentation changes only build documentation", () => { assert.deepEqual( - classifyFiles(["docs/index.md", "adr/README.md", "CONTRIBUTING.md"]), + classifyFiles(["docs/index.md", "README.md", "CONTRIBUTING.md"]), { ...none, docs: true, From 3aa8a6d07fb83256572716ce115c4a7eaa924b31 Mon Sep 17 00:00:00 2001 From: tignear Date: Sat, 17 Oct 2026 10:43:13 +0900 Subject: [PATCH 2/3] ci(lydite): skip version-only release PRs Release Please only bumps Cargo versions, which selected the core lane through the shared Cargo configuration rule. The daily run still covers the released tree. --- CONTRIBUTING.md | 1 + scripts/ci-changes.mjs | 9 +++++++++ scripts/ci-lydite-changes.mjs | 4 ++++ scripts/ci-lydite-changes.test.mjs | 23 +++++++++++++++++++++++ 4 files changed, 37 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1fed841ec2d..255ecb482d2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -210,6 +210,7 @@ Lydite has its own test cadence (`scripts/ci-lydite-changes.mjs`): in the issue "Lydite validation is failing on ", closed by the next passing run. NAPI/JS changes, upstream private tests and Markdown do not reach Lydite. +- Version-only Release Please diffs, including their queue drafts, skip Lydite. - Shared dependency/toolchain configuration runs the core lane; an unreadable diff or dependency graph runs both lanes. The graph includes optional, build and dev edges. diff --git a/scripts/ci-changes.mjs b/scripts/ci-changes.mjs index 924e3bc5595..d4b8ff564df 100644 --- a/scripts/ci-changes.mjs +++ b/scripts/ci-changes.mjs @@ -102,6 +102,15 @@ export function cutsRelease(files) { ); } +// A Release Please diff that only bumps versions and changelogs. +export function isVersionOnlyRelease(files) { + const normalized = files.map((path) => path.replace(/^\.\//, "")); + return ( + cutsRelease(normalized) && + normalized.every((path) => RELEASE_PLEASE_FILES.has(path)) + ); +} + // On master, only the release pull request changes the release manifest, so a // PR or legacy merge group carrying it gets full validation before merging // instead of the change-based subset. Syncing master into develop carries the diff --git a/scripts/ci-lydite-changes.mjs b/scripts/ci-lydite-changes.mjs index 1449692eeae..819aab476e9 100644 --- a/scripts/ci-lydite-changes.mjs +++ b/scripts/ci-lydite-changes.mjs @@ -1,5 +1,6 @@ import { appendFileSync } from "node:fs"; import { fileURLToPath, pathToFileURL } from "node:url"; +import { isVersionOnlyRelease } from "./ci-changes.mjs"; import { changedFilesBetween, readWorkspace } from "./ci-rust-scope.mjs"; export const isLydite = (name) => @@ -93,6 +94,9 @@ const ownsBridge = (path) => ) || path.replace(/^\.\//, "") === ".github/workflows/lydite.yml"; export function pullRequestScope(files, packages) { + // Release PRs and their queue drafts only bump versions. + if (files !== null && isVersionOnlyRelease(files)) + return { core: false, bridge: false }; const scope = lyditeScope(files, packages); if (files === null) return scope; return { ...scope, bridge: scope.bridge && files.some(ownsBridge) }; diff --git a/scripts/ci-lydite-changes.test.mjs b/scripts/ci-lydite-changes.test.mjs index d2b59a3de8c..ce089d1ca99 100644 --- a/scripts/ci-lydite-changes.test.mjs +++ b/scripts/ci-lydite-changes.test.mjs @@ -84,6 +84,29 @@ test("PRs run the bridge only for Lydite-owned changes", () => { assert.deepEqual(pullRequestScope(null, packages), both); }); +test("version-only release PRs skip Lydite", () => { + const release = [ + ".release-please-manifest.json", + "CHANGELOG.md", + "Cargo.lock", + "Cargo.toml", + "VERSION", + "crates/celox-napi/package.json", + "packages/celox/package.json", + "packages/vite-plugin/package.json", + ]; + assert.deepEqual(pullRequestScope(release, packages), neither); + // Without the release manifest, Cargo changes are ordinary dependency edits. + assert.deepEqual(pullRequestScope(release.slice(1), packages), { + core: true, + bridge: false, + }); + assert.equal( + pullRequestScope([...release, "crates/lydite/src/main.rs"], packages).bridge, + true, + ); +}); + test("dependency selection follows new transitive edges automatically", () => { const graph = [ { name: "lydite", dir: "crates/lydite", dependencies: [] }, From c7018e37ec000a04f63a7aaee46fae29f5f03b64 Mon Sep 17 00:00:00 2001 From: tignear Date: Sat, 17 Oct 2026 10:51:25 +0900 Subject: [PATCH 3/3] ci(lydite): retire the old workflow path that stale branches still run PRs run the workflow from their merge ref, so stacked or old branches kept running the previous lydite.yml with every lane. Rename the workflow so the old path can stay disabled while the new one runs. Classifier and workflow edits now run only the core lane on PRs. --- .github/workflows/ci.yml | 2 +- .../workflows/{lydite.yml => lydite-checks.yml} | 2 +- .github/workflows/nightly.yml | 4 ++-- CLAUDE.md | 2 +- CONTRIBUTING.md | 6 +++++- lydite/README.md | 2 +- lydite/audit/README.md | 2 +- lydite/audit/automatic_proof/ci.py | 4 ++-- lydite/audit/veryl_scaling/rv32i_selected_ci.py | 2 +- lydite/conformance/veryl/README.md | 2 +- lydite/docs/usage.md | 2 +- scripts/ci-changes.mjs | 4 ++-- scripts/ci-lydite-changes.mjs | 8 ++++---- scripts/ci-lydite-changes.test.mjs | 14 +++++++++----- 14 files changed, 32 insertions(+), 24 deletions(-) rename .github/workflows/{lydite.yml => lydite-checks.yml} (99%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f266a99d85f..232a5024f1e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -214,7 +214,7 @@ jobs: # runs the binaries one after another. # A pull request builds and runs only the tests its changes can affect # (scripts/ci-rust-scope.mjs); merge groups and the daily run keep the - # Celox workspace. lydite.yml owns Lydite tests at its own cadence. + # Celox workspace. lydite-checks.yml owns Lydite tests at its own cadence. - name: Run workspace tests with CI features if: needs.changes.outputs.rust_full != 'false' run: >- diff --git a/.github/workflows/lydite.yml b/.github/workflows/lydite-checks.yml similarity index 99% rename from .github/workflows/lydite.yml rename to .github/workflows/lydite-checks.yml index c76896075fc..92dff0e5283 100644 --- a/.github/workflows/lydite.yml +++ b/.github/workflows/lydite-checks.yml @@ -1,4 +1,4 @@ -name: lydite +name: Lydite # Proof, editor, and pinned-Celox conformance gates imported from # https://github.com/tignear/hwverify. The workspace crates are also built, diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 7d904866769..bcc5e607f1e 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -21,7 +21,7 @@ jobs: - name: Dispatch full CI on develop run: gh workflow run ci.yml --repo "$GITHUB_REPOSITORY" --ref develop - # lydite.yml schedules the default branch itself; its bridge lanes do not run + # lydite-checks.yml schedules the default branch itself; its bridge lanes do not run # for Celox PRs, so check develop's in-tree Celox daily as well. queue-lydite-develop: name: Queue develop Lydite validation @@ -30,7 +30,7 @@ jobs: GH_TOKEN: ${{ github.token }} steps: - name: Dispatch every Lydite lane on develop - run: gh workflow run lydite.yml --repo "$GITHUB_REPOSITORY" --ref develop + run: gh workflow run lydite-checks.yml --repo "$GITHUB_REPOSITORY" --ref develop # heliodor-bench.yml schedules the stable master lane directly. Dispatch the # develop ref here for the small pinned/HEAD Linux boot compatibility gates. diff --git a/CLAUDE.md b/CLAUDE.md index f1ecd6bf882..65c5bff5124 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -34,7 +34,7 @@ cargo insta accept # Accept snapshot changes | `packages/celox` | TypeScript runtime package | | `packages/vite-plugin` | Vite plugin | | `crates/lydite-*` | lydite hardware refinement checker (unpublished; CLI is `lydite`) | -| `lydite/` | lydite docs, examples, editor client, and proof/conformance gates (`.github/workflows/lydite.yml`) | +| `lydite/` | lydite docs, examples, editor client, and proof/conformance gates (`.github/workflows/lydite-checks.yml`) | ### lydite diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 255ecb482d2..ae429db92c1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -211,6 +211,10 @@ Lydite has its own test cadence (`scripts/ci-lydite-changes.mjs`): passing run. NAPI/JS changes, upstream private tests and Markdown do not reach Lydite. - Version-only Release Please diffs, including their queue drafts, skip Lydite. +- PR workflows come from the PR's merge ref, so branches based on an older base + still carry the earlier `lydite.yml`, which selected every lane. That + workflow file stays disabled in repository settings; `lydite-checks.yml` + replaces it. Re-enable nothing under the old path. - Shared dependency/toolchain configuration runs the core lane; an unreadable diff or dependency graph runs both lanes. The graph includes optional, build and dev edges. @@ -234,7 +238,7 @@ uses the finer behavior-based matrix above. | Daily at 02:17 UTC (11:17 JST) | `codspeed.yml` measures compile time on the default branch using CPU simulation. Execution failures and CodSpeed performance-check failures open or update a branch issue; the next healthy run closes it. Manual dispatch supports branch measurements. PRs, merge groups, and pushes do not run CodSpeed. | | Daily at 02:37 UTC (11:37 JST) | `heliodor-bench.yml` runs the complete master Linux suite on x86-64 and AArch64. Explicit manual selections retain focused suite runs and ARM64 profiling. PRs do not run this workflow; its tooling tests run in `Lint & Format` with the other script tests. | | Every full CI run | Run every shared Veryl and SystemVerilog case against both Verilator and Icarus, with locked Nix tools. Run the live adapter tests normally marked ignored because they need external tools. Preserve reports and per-case diagnostics as artifacts for 14 days, including on failure; matrix failures do not cancel the other comparisons. | -| Affected pull requests and merge groups; daily at 03:41 UTC (12:41 JST); on demand | `lydite.yml` owns Lydite Rust tests, proof, conformance, editor, and mutation gates. Unrelated changes skip these jobs, and Celox changes skip the bridge. Daily and manual runs enable all lanes and report failures in an issue. | +| Affected pull requests and merge groups; daily at 03:41 UTC (12:41 JST); on demand | `lydite-checks.yml` owns Lydite Rust tests, proof, conformance, editor, and mutation gates. Unrelated changes skip these jobs, and Celox changes skip the bridge. Daily and manual runs enable all lanes and report failures in an issue. | | On demand | Dispatch `ci.yml` on the desired branch to run full CI and external comparisons, regardless of its diff. | | Pull requests that cut a release | A `master` pull request or legacy merge group whose diff changes `.release-please-manifest.json` (only the release pull request does there; syncing it into `develop` is not a release) runs full CI and the external comparisons. `Rust Test & NAPI Build` then requires the comparisons to pass, so a release cannot merge after only change-based checks. Daily and manual full runs do not gate on the comparisons; their failures reach the full CI issue below. A `master` pull request or legacy merge group whose diff cannot be determined is treated the same way. | diff --git a/lydite/README.md b/lydite/README.md index 3e28356ad73..21b8fd45ac6 100644 --- a/lydite/README.md +++ b/lydite/README.md @@ -42,4 +42,4 @@ LYDITE_SOLVER=finite ../target/release/lydite audit/lemma_candidates/counter.lyd The Rust translation, obligation generation, kernel and selected solver are trusted; see the [trust boundary](docs/trust.md). Current results come from -[CI](../.github/workflows/lydite.yml), not archived reports. +[CI](../.github/workflows/lydite-checks.yml), not archived reports. diff --git a/lydite/audit/README.md b/lydite/audit/README.md index 9206bdc27b2..6336c910077 100644 --- a/lydite/audit/README.md +++ b/lydite/audit/README.md @@ -13,7 +13,7 @@ the commands below the "Sealed archives" heading must be run. ## Fresh required gates Run from `lydite/` with fresh output directories outside the checkout. -The [workflow](../../.github/workflows/lydite.yml) is the authoritative ordering. +The [workflow](../../.github/workflows/lydite-checks.yml) is the authoritative ordering. The original-corpus preparation builds the pinned frontend needed by the later symbolic/RV gates; a failed dependency fetch is a setup failure, never a pass. diff --git a/lydite/audit/automatic_proof/ci.py b/lydite/audit/automatic_proof/ci.py index 0ef7ecb7d01..f63ea4c5bfc 100644 --- a/lydite/audit/automatic_proof/ci.py +++ b/lydite/audit/automatic_proof/ci.py @@ -216,7 +216,7 @@ def validate_group(out, group, summary, checker_hash): def source_files(): repo = ROOT.parent paths = {repo / 'Cargo.toml', repo / 'Cargo.lock', Path(__file__).with_name('ci-matrix.json'), - repo / '.github/workflows/lydite.yml', + repo / '.github/workflows/lydite-checks.yml', ROOT / 'conformance/veryl-symbolic/run_automatic_ci.sh', ROOT / 'conformance/veryl-proof/tools/z3-tripwire.sh', Path(__file__).with_name('test_ci.py')} @@ -266,7 +266,7 @@ def gate(out, checker): 'python': sys.version, 'files': fingerprints, 'source_snapshots': 'source-snapshots'}, indent=2) + '\n') scope = ['../crates/lydite-ir', '../crates/lydite', '../crates/lydite-celox', '../crates/lydite-solver', '../crates/lydite-syntax', '../crates/lydite-verify', 'audit/automatic_proof', 'conformance/veryl-symbolic/run_automatic_ci.sh', - '../.github/workflows/lydite.yml', '../Cargo.toml', '../Cargo.lock'] + '../.github/workflows/lydite-checks.yml', '../Cargo.toml', '../Cargo.lock'] (out / 'dirty.patch').write_bytes(subprocess.check_output(['git', 'diff', '--binary', 'HEAD', '--', *scope], cwd=ROOT)) (out / 'untracked-source-paths.txt').write_bytes(subprocess.check_output(['git', 'ls-files', '--others', '--exclude-standard', '--', *scope], cwd=ROOT)) tripwire = out / 'tripwire-bin' diff --git a/lydite/audit/veryl_scaling/rv32i_selected_ci.py b/lydite/audit/veryl_scaling/rv32i_selected_ci.py index 184fe406180..34e6e8fae86 100644 --- a/lydite/audit/veryl_scaling/rv32i_selected_ci.py +++ b/lydite/audit/veryl_scaling/rv32i_selected_ci.py @@ -27,7 +27,7 @@ def capture_provenance(out, checker): root = selected.ROOT scope = ['../Cargo.toml', '../Cargo.lock', '../crates/lydite-ir', '../crates/lydite', '../crates/lydite-celox', '../crates/lydite-solver', '../crates/lydite-syntax', '../crates/lydite-verify', 'audit/veryl_scaling', 'audit/lemma_candidates', - 'conformance/veryl-symbolic', '../.github/workflows/lydite.yml', + 'conformance/veryl-symbolic', '../.github/workflows/lydite-checks.yml', 'examples/build_pipeline.py', 'examples/build_branch_pipeline.py', 'audit/interpreter.py'] files = set() diff --git a/lydite/conformance/veryl/README.md b/lydite/conformance/veryl/README.md index 469dc755623..385d0e4b93f 100644 --- a/lydite/conformance/veryl/README.md +++ b/lydite/conformance/veryl/README.md @@ -62,7 +62,7 @@ ignored; no prototype workspace paths are required. Use a new output directory for every run so stale reports cannot be mistaken for new results. Python optimization is rejected because source-mutation controls must execute. -The workflow is [.github/workflows/lydite.yml](../../../.github/workflows/lydite.yml): +The workflow is [.github/workflows/lydite-checks.yml](../../../.github/workflows/lydite-checks.yml): `push` and `pull_request`, pinned official checkout/upload actions, read-only contents permission, no persisted credentials, no repository secrets passed to checks, no cache, and a 30-minute job limit. Audit upload runs even when a check diff --git a/lydite/docs/usage.md b/lydite/docs/usage.md index c654114dd9e..d8e7512dfab 100644 --- a/lydite/docs/usage.md +++ b/lydite/docs/usage.md @@ -60,7 +60,7 @@ covers local links and fragments in all tracked Markdown, including the sealed historical records retained unchanged. The mandatory hosted gates are defined in -[the workflow](../../.github/workflows/lydite.yml). They include the original Veryl +[the workflow](../../.github/workflows/lydite-checks.yml). They include the original Veryl corpus, symbolic RTL refinement, native lemma diagnostics, selected RV32I, fixed automatic-proof controls and original-formula mutants. For their exact commands, dependency preparation and evidence locations, use the [audit index](../audit/README.md). diff --git a/scripts/ci-changes.mjs b/scripts/ci-changes.mjs index d4b8ff564df..072399c715c 100644 --- a/scripts/ci-changes.mjs +++ b/scripts/ci-changes.mjs @@ -304,7 +304,7 @@ if ( }); } -// Lydite tests are selected independently by lydite.yml, including its bridge. +// Lydite tests are selected independently by lydite-checks.yml, including its bridge. export function celoxRustTestScope(files, packages) { return rustTestScope( files.filter((path) => !/^(?:\.\/)?(?:lydite\/|crates\/lydite(?:-|\/))/.test(path)), @@ -313,7 +313,7 @@ export function celoxRustTestScope(files, packages) { } // Queue drafts, merge groups, releases and daily runs keep the Celox -// workspace. Lydite tests run independently in lydite.yml. +// workspace. Lydite tests run independently in lydite-checks.yml. function rustScopeOutputs(files) { let scope = { full: true }; if (files !== null) { diff --git a/scripts/ci-lydite-changes.mjs b/scripts/ci-lydite-changes.mjs index 819aab476e9..1893e907298 100644 --- a/scripts/ci-lydite-changes.mjs +++ b/scripts/ci-lydite-changes.mjs @@ -48,7 +48,7 @@ export function lyditeScope(files, packages) { "rust-toolchain.toml", "flake.nix", "flake.lock", - ".github/workflows/lydite.yml", + ".github/workflows/lydite-checks.yml", ".github/workflows/ci.yml", ".config/nextest.toml", ].includes(path) || @@ -87,11 +87,11 @@ export function lyditeScope(files, packages) { // Celox dependency changes reach the bridge, but its replay and proof corpus // are too heavy for every Celox PR. PRs run the bridge only for Lydite-owned -// changes; daily runs cover Celox changes and report failures in an issue. +// sources; daily runs cover Celox and CI changes and report failures. const ownsBridge = (path) => - ["lydite/", "crates/lydite", "scripts/ci-lydite-changes."].some((prefix) => + ["lydite/", "crates/lydite"].some((prefix) => path.replace(/^\.\//, "").startsWith(prefix), - ) || path.replace(/^\.\//, "") === ".github/workflows/lydite.yml"; + ); export function pullRequestScope(files, packages) { // Release PRs and their queue drafts only bump versions. diff --git a/scripts/ci-lydite-changes.test.mjs b/scripts/ci-lydite-changes.test.mjs index ce089d1ca99..e1d8fba88d5 100644 --- a/scripts/ci-lydite-changes.test.mjs +++ b/scripts/ci-lydite-changes.test.mjs @@ -21,7 +21,7 @@ test("Lydite core changes and shared configuration run both lanes", () => { "Cargo.toml", "rust-toolchain.toml", "flake.lock", - ".github/workflows/lydite.yml", + ".github/workflows/lydite-checks.yml", "scripts/ci-lydite-changes.mjs", "vendor/new/src/lib.rs", "crates/new/src/lib.rs", @@ -71,14 +71,18 @@ test("PRs run the bridge only for Lydite-owned changes", () => { "crates/celox-test-suite/src/veryl/cases/flip_flop.vtest", ]) assert.deepEqual(pr(path), neither, path); - for (const path of ["Cargo.lock", "rust-toolchain.toml", ".github/workflows/ci.yml"]) + for (const path of [ + "Cargo.lock", + "rust-toolchain.toml", + ".github/workflows/ci.yml", + ".github/workflows/lydite-checks.yml", + "scripts/ci-lydite-changes.mjs", + ]) assert.deepEqual(pr(path), { core: true, bridge: false }, path); for (const path of [ "crates/lydite-celox/src/lib.rs", "crates/lydite/src/main.rs", "lydite/conformance/veryl-proof/case-exceptions.json", - ".github/workflows/lydite.yml", - "scripts/ci-lydite-changes.mjs", ]) assert.equal(pr(path).bridge, true, path); assert.deepEqual(pullRequestScope(null, packages), both); @@ -164,7 +168,7 @@ test("workflows transfer Rust tests and gate each Lydite lane", () => { ci, /cargo test --locked --workspace --exclude 'lydite\*' --doc/, ); - const workflow = readFileSync(`${root}.github/workflows/lydite.yml`, "utf8"); + const workflow = readFileSync(`${root}.github/workflows/lydite-checks.yml`, "utf8"); assert.match( workflow, /pull_request:\n merge_group:\n schedule:\n - cron: "41 3 \* \* \*"/,