Conversation
robtaylor
commented
Dec 18, 2025
- Updated README.md with information on LLVM18.
- Updated Readme.
- $bound_step() fixed.
- CI: No need to run on push to all branches
- CI: Explictly name runner images
- CI: Cache brew packages
- CI: No need to install mingw on macos
- CI: Cache cargo build
- Fix order-dependency in small-signal analysis from IndexSet::remove deprecation
- CI: Enable integration tests
- Fix non-deterministic compilation causing random CI test failures
- Update snapshots
- First attempt. HiSIMHV still crashes.
- Loops hoisted correctly to init. HiSIMHV works.
- Fix LLVM 18 compatibility on macOS ARM64
- CI: Update for LLVM 18 and enable integration tests
- Remove architecture-specific values from OSDI integration test snapshots
- Fix ld64.lld linking on macOS for LLVM 18
- Fix ARM64 SIGSEGV: correct snprintf varargs calling convention
- Fix linking of built objects on macos
- Fix order-dependency in small-signal analysis from IndexSet::remove deprecation
- cargo fmt
- Updated README, enabled CI for macos-patches-v3.
- Fixed snprintf bug where i32 was passed but size_t was expected.
- CI: Explictly install rust toolchain
- CI: Add arch to cache keys
- CI: Fix actionlint warnings
- Add READMEs for all the Cargo Crates
- Migrate from LLVM 18 to LLVM 21
- Add multi-LLVM version support (18, 19, 20, 21)
- Simplify macOS CI to use default Homebrew LLVM
- Fix test compilation with multi-LLVM support
- Simplify Ubuntu CI to test only LLVM 18 and 21
- Fix LLVM detection on Ubuntu by creating llvm-config symlink
- Fix symlink creation when file already exists
- Build specific packages to avoid workspace feature unification
- Fix macOS linking without LLVM_SYS_181_PREFIX
- Fix Ubuntu CI integration test package name
- Add --allow-analog-in-cond flag for non-standard Verilog-A models
- Add --allow-builtin-primitives CLI flag
- Fix code formatting with nightly rustfmt
- Move BuiltInPrimitive enum to body/lower.rs
- Fix integration tests for multi-module files
e45d376 to
9cd805d
Compare
…eprecation The deprecated IndexSet::remove() method was replaced with swap_remove() in the small-signal network analysis. However, this exposed a latent order- dependency bug where the analysis results differed based on iteration order. Root Cause: The algorithm had a circular dependency where analyze_value() checks if values are in small_signal_vals, but membership in that set depends on the analysis results. With platform-specific hash ordering (ahash::RandomState), this caused reactive/resistive contribution counts to swap on Windows MSYS2. Solution: Implemented an order-independent fixed-point algorithm with four phases: 1. Speculatively add ALL candidate nodes to small_signal_vals 2. Evaluate all candidates against this consistent set state 3. Remove speculative nodes that weren't confirmed 4. Add confirmed flows and remove resolved candidates This ensures all candidates see the same set state during evaluation, making the analysis deterministic regardless of iteration order while still supporting circular dependencies (e.g., noise nodes). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The compiler was producing non-deterministic output due to use of ahash's RandomState, which uses random seeding for its hash function. This caused iteration order of hash-based collections to vary between runs, leading to different compilation results and sporadic CI failures. Root cause: GVN (Global Value Numbering) used ahash::RandomState for hashing expressions. Different hash values across runs caused different equivalence class assignments and leader selections, which cascaded: 1. GVN picks different instruction leaders non-deterministically 2. Values get replaced differently via replace_uses() 3. op_dependent_insts BitSet gets populated differently 4. determine_evaluation() makes different linearization decisions 5. Noise sources/implicit equations are created vs. linearized differently This manifested as entire noise sources or implicit equations appearing or disappearing between runs - not just ordering differences. Changes: - Replace ahash::RandomState with BuildHasherDefault<FxHasher> in GVN - Replace AHashMap/AHashSet with IndexMap/IndexSet (with FxHasher) or HashMap/HashSet (with FxHasher) throughout the codebase - Use FxHasher consistently for deterministic hashing - Remove unused ahash dependencies from several crates Affected crates: mir_opt, mir_autodiff, sim_back, osdi, hir_def, hir_lower, basedb, mir, vfs, typed_indexmap, sourcegen 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit fixes multiple issues related to building and linking with LLVM 18 on macOS ARM64: 1. Use LLVM 18's clang for bitcode generation (build.rs) - Bitcode generated by Apple's clang is incompatible with LLVM 18 - Now uses clang from LLVM_SYS_181_PREFIX when available 2. Configure ld64.lld linker with proper flags (linker/src/lib.rs) - Detect and use ld64.lld from LLVM 18 when available - Automatically add -syslibroot flag using xcrun --show-sdk-path 3. Simplify macOS target configuration (aarch64_apple_darwin.rs) - Removed -lSystem from post_link_args - With -undefined dynamic_lookup, symbols are resolved at runtime - Added -platform_version flags required by ld64.lld 4. Update README with macOS build instructions - Add macOS dependency setup section with Homebrew instructions - Document build-macos.sh and test-macos.sh convenience scripts - Add section explaining integration tests - Clarify how to enable and run integration tests These changes ensure the compiler works correctly when built against LLVM 18, fixing "Unsupported stack probing method" and "library not found for -lSystem" errors. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Updates: - Configure macOS CI to use llvm@18 instead of latest llvm - Add xtask for setup on Mac. Unfortunatly we can't fix for straight cargo build/test without patching llvm-sys 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This change makes integration test snapshots platform-agnostic, allowing cross-platform CI testing without spurious failures due to different struct layouts on ARM64 vs x86-64. Removed values: - residual offset numbers (4 values per node) - react_ptr offset values in jacobian entries - instance_size and model_size values These values are calculated by LLVM using platform-specific ABI alignment rules (LLVMABISizeOfType and LLVMOffsetOfElement), causing differences between architectures. All semantic information (parameter names, types, node names, jacobian flags, etc.) is preserved. All integration test snapshots have been regenerated. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
LLVM 18's ld64.lld requires -platform_version flags on both x86_64 and ARM64. Also fixes CI to use correct GitHub runners (macos-14 for ARM64, macos-13 for x86_64). Changes: - Add -platform_version flags to x86_64_apple_darwin target spec - Update CI matrix to use macos-14 for ARM64 builds (macos-13 is x86_64 only) This fixes the linker error: ld64.lld: error: must specify -platform_version ld64.lld: error: missing or unsupported -arch x86_64 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Root cause: snprintf was declared with ALL parameters as variadic `(...)` instead of having its first 3 parameters fixed: `(ptr, i64, ptr, ...)`. On ARM64, fixed and variadic parameters use different calling conventions: - Fixed parameters: passed in x0-x7 registers - Variadic parameters: special handling, different register/stack allocation When snprintf was declared as `i32 (...)`, LLVM generated code expecting all arguments to use the variadic calling convention. This caused: 1. Arguments passed in wrong registers/memory locations 2. Double values (like 0x3ff0000000000000 = 1.0) interpreted as pointers 3. SIGSEGV when snprintf tried to strlen() these bogus pointer values Fix: Changed intrinsics.rs line 100 to pass `args` instead of `&[]` to `ty_variadic_func()`. Now snprintf is correctly declared as: declare i32 @snprintf(ptr, i64, ptr, ...) This makes the first 3 parameters use the standard calling convention while only format arguments use varargs convention. Also removed duplicate parameter addition code in compilation_unit.rs (lines 452-455) which was likely a failed attempt to work around the incorrect function signature. Fixes: Integration test crashes on ARM64 macOS with LLVM 18 Affects: BSIM3, BSIM4, and other models with large instance structs Testing: All 28 integration tests now pass on ARM64 macOS 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…eprecation The deprecated IndexSet::remove() method was replaced with swap_remove() in the small-signal network analysis. However, this exposed a latent order- dependency bug where the analysis results differed based on iteration order. Root Cause: The algorithm had a circular dependency where analyze_value() checks if values are in small_signal_vals, but membership in that set depends on the analysis results. With platform-specific hash ordering (ahash::RandomState), this caused reactive/resistive contribution counts to swap on Windows MSYS2. Solution: Implemented an order-independent fixed-point algorithm with four phases: 1. Speculatively add ALL candidate nodes to small_signal_vals 2. Evaluate all candidates against this consistent set state 3. Remove speculative nodes that weren't confirmed 4. Add confirmed flows and remove resolved candidates This ensures all candidates see the same set state during evaluation, making the analysis deterministic regardless of iteration order while still supporting circular dependencies (e.g., noise nodes). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
If an instance parameter was given with a model defaulting did not work correctly. The default value of an instance parameter is now stored in the model data structure (if not given). In instance data structure the default value is also stored if parameter is not given. The default value is taken from the model (if given) or from parameter definition.
On macOS, always pass -syslibroot to the linker pointing to the macOS SDK (detected via xcrun --show-sdk-path). This allows openvaf-r to compile Verilog-A to OSDI without requiring the LLVM_SYS_181_PREFIX environment variable at runtime. Previously, linking would fail with "ld: library 'System' not found" when LLVM_SYS_181_PREFIX was not set because the system linker didn't know where to find system libraries. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Apply nightly rustfmt formatting to satisfy CI requirements. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The BuiltInPrimitive enum was in builtin.rs which is auto-generated by sourcegen. Moving it to body/lower.rs where it's actually used prevents it from being removed during code generation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Update compile_and_load_with_opts to handle files with multiple modules - Add OSDI snapshots for BUILTIN_PRIMITIVES and MODULE_INST tests - Remove unused compile_and_load function 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add missing imports in body/lower.rs: Name, AssignOp, BinaryOp, AstNode, ItemTree, Module, ModuleInstItem, ModuleItem - Add AstPtr import in item_tree/lower.rs - Fix duplicate ConstExprValue import in item_tree.rs - Change ModuleInstItem.param_assignments to store AstPtr<ast::Expr> instead of Name to allow proper expression handling - Add builtin_primitives.va test file with resistor and capacitor primitives demonstrating the feature - Update OSDI snapshot to match test output 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
These fields were previously private in the Residual struct. Making them public allows openvaf_py to extract and expose small-signal data for AC analysis support in jax-spice. Co-developed-by: Claude Code v2.0.82 (claude-opus-4-5-20251101)
Adds a new standalone visualization tool for OpenVAF's intermediate representations, focused on compiler debugging with interactive HTML output: - MIR visualization: Control flow graphs, basic blocks, instructions - CompiledModule visualization: DAE system, parameter mappings, jacobian - Multiple output formats: HTML (interactive), JSON (structured), DOT (GraphViz) Features: - Dark theme UI with collapsible blocks and function tabs - Opcode categorization (arithmetic, logic, control flow, math, etc.) - Search functionality across instructions and values - Support for filtering by function (eval, init, model_param_setup) - Topology: Circuit topology graph from DAE system showing unknowns (KirchoffLaw nodes, Current branches, Implicit equations) and their jacobian relationships - Jacobian: Sparse matrix visualization showing resistive/reactive entries with grid view for small matrices and list view for large - Interactive features: - Pan and zoom with mouse/trackpad - Zoom controls (+, -, Reset, Fit) - Click node to navigate to code view - Hover tooltip showing block instructions and metadata
Add three workflow files for automated visualization generation: - build-viz.yml: Reusable workflow that builds openvaf-viz and generates HTML visualizations for all .va models in integration_tests. Creates an index page with links to all generated visualizations. - preview-viz.yml: PR preview workflow following chipflow-docs pattern. Deploys visualizations to gh-pages/pr-preview/ for each PR and posts a comment with the preview link. - deploy-viz.yml: Deploys visualizations to GitHub Pages on push to master/main. Preserves existing PR previews during deployment. Co-developed-by: Claude Code v2.1.3 (claude-opus-4-5-20251101)
|
IR Visualization PreviewPreview is deploying! This preview shows interactive visualizations of OpenVAF's intermediate representations for all compact models. Built from commit 4e2a474 |
- Enable detailed DOT generation with full instruction info and PHI edges - Remove dead_code warnings from now-used functions Co-developed-by: Claude Code v2.1.5 (claude-opus-4-5-20251101)
IR Visualization PreviewPreview is deploying! This preview shows interactive visualizations of OpenVAF's intermediate representations for all compact models. Built from commit 50369b7 |
IR Visualization PreviewPreview is deploying! This preview shows interactive visualizations of OpenVAF's intermediate representations for all compact models. Built from commit 01b30c3 |
Exposes the internal ModuleId for use with hir_def APIs like body_with_sourcemap() which require DefWithBodyId::ModuleId. This enables source location tracking from MIR instructions back to the original Verilog-A source code. Co-developed-by: Claude Code v2.1.12 (claude-opus-4-5-20251101)
IR Visualization PreviewPreview is deploying! This preview shows interactive visualizations of OpenVAF's intermediate representations for all compact models. Built from commit bbef250 |
Switch from codeberg.org/arpadbuermen/VACASK to github.com/robtaylor/VACASK for better reliability in CI environments. Co-developed-by: Claude Code v2.1.12 (claude-opus-4-5-20251101)
IR Visualization PreviewPreview is deploying! This preview shows interactive visualizations of OpenVAF's intermediate representations for all compact models. Built from commit c6b5e49 |
IR Visualization PreviewPreview is deploying! This preview shows interactive visualizations of OpenVAF's intermediate representations for all compact models. Built from commit 1c3a7d4 |