Skip to content

Add node retention integration tests to CI#3

Draft
robtaylor wants to merge 44 commits intoSilimate:node_retentionfrom
robtaylor:node_retention
Draft

Add node retention integration tests to CI#3
robtaylor wants to merge 44 commits intoSilimate:node_retentionfrom
robtaylor:node_retention

Conversation

@robtaylor
Copy link

Summary

  • Fix ctest step to use --test-dir build so it can find tests
  • Add CI steps that run the existing node_ret/*.script files (get_and_put, v3, abc.script) via the built abc binary
  • Add node_ret/scripts/ci_validate.sh to verify output BLIF files are produced and non-empty

Test plan

  • CI passes on both ubuntu-latest and macos-latest
  • Node retention test steps produce expected output BLIF files
  • Validation script correctly catches missing/empty outputs

alanminko and others added 30 commits January 16, 2026 14:19
Signed-off-by: JingrenWang <wjrforcyber@163.com>
Fix(Workflow): Bring windows build back to life
Signed-off-by: JingrenWang <wjrforcyber@163.com>
MINGW and WASI compile fixes (from YosysHQ fork)
@robtaylor
Copy link
Author

Could someone enable Actions on this repo? =)

@robtaylor robtaylor force-pushed the node_retention branch 2 times, most recently from d4f4121 to 3fc0c53 Compare February 21, 2026 15:06
- Use stdatomic.h on MinGW instead of MSVC Interlocked functions.
  MinGW defines _WIN32 but has <stdatomic.h> unlike MSVC. Fix guards
  in utilPth.c and sswPart.c.
- Exclude -ldl and -lrt from link libraries on MINGW/MSYS platforms,
  as these Unix-only libraries don't exist on MinGW.
- Add -lshlwapi on MINGW/MSYS for PathMatchSpec used in sclLiberty.c.

Co-developed-by: Claude Code v2.1.50 (claude-opus-4-6)
- Replace ancient .dsw project upgrade approach with CMake + MSYS2/MinGW
  on Windows, using the same CMake build system as posix builds
- Use MSYS2 with mingw-w64 toolchain for reliable GNU make + GCC support
- Use ABC_USE_STDINT_H=1 and -DWIN32 -DWIN32_NO_DLL to handle MinGW
  platform quirks (32-bit long on 64-bit Windows, missing WIN32 macro)
- Update Windows runner from windows-2019 to windows-latest
- Restrict push triggers to main/master branches only across all
  workflows, keeping pull_request triggers for all branches

Co-developed-by: Claude Code v2.1.50 (claude-opus-4-6)
Introduce Nr_Man_t and Nr_Entry_t types for tracking AIG node
retention IDs across logic optimization passes. Add node retention
manager (node_retention.c/h) with create/free/copy/validate/print
operations. Add pNodeRetention pointer to Abc_Ntk_t, Aig_Man_t,
Gia_Man_t, If_Man_t, and Abc_Frame_t data structures.

Co-developed-by: Claude Code v2.1.45 (claude-opus-4-6)
Hook Nr_ManCreate/Nr_ManFree into allocation and deallocation paths
for Abc_Ntk_t, Aig_Man_t, Gia_Man_t, If_Man_t, and Abc_Frame_t.
Ensures retention managers are properly initialized and cleaned up
throughout their lifecycle.

Co-developed-by: Claude Code v2.1.45 (claude-opus-4-6)
Propagate node retention IDs through Abc_Ntk object creation,
utility operations, netlist conversion, strashing, and AIG/Abc
conversion paths. Ensures retention IDs survive network
transformations in the classic representation.

Co-developed-by: Claude Code v2.1.45 (claude-opus-4-6)
Propagate retention IDs through AIG duplication (aigDup.c),
AIG-to-GIA and GIA-to-AIG conversions (giaAig.c), GIA duplication
(giaDup.c), GIA hashing (giaHash.c), MUX extraction/insertion
(giaMuxes.c), and equivalence operations (giaEquiv.c).

Co-developed-by: Claude Code v2.1.45 (claude-opus-4-6)
Propagate retention IDs through balance (giaBalAig.c), LUT mapping
(giaIf.c, giaLf.c), timing (giaTim.c), synthesis scripts
(giaScript.c), DAR balance/rewrite/refactor (darBalance.c,
darCore.c, darRefact.c, darScript.c), DAU GIA construction
(dauGia.c), and DCH choice computation (dchChoice.c).

Co-developed-by: Claude Code v2.1.45 (claude-opus-4-6)
Add &read_retention and &write_retention commands for loading and
outputting node retention data. Integrate retention propagation into
BLIF write paths and I/O utility functions. Register node retention
commands in the command processor.

Co-developed-by: Claude Code v2.1.45 (claude-opus-4-6)
- Fix ctest step to use --test-dir build
- Add CI steps running get_and_put, v3, and abc.script tests
- Add ci_validate.sh to verify output BLIF files are produced

Co-developed-by: Claude Code v2.1.44 (claude-opus-4-6)
Implements Phase 2 of the \src attribute preservation plan:

- New `&write_retention <file>` command writes GIA retention map
  containing CI position-to-GIA-ID mapping and AND/CO node origin
  tracking, enabling Yosys to recover source location attributes
  through ABC9 synthesis

- New `Nr_ManPrintRetentionMapGia()` function in node_retention.c
  that outputs retention data using GIA object IDs directly
  (no name resolution needed - Yosys handles via sym file)

- Seed retention with self-origins in `&read` command so all CI
  and AND objects establish baseline tracking before synthesis

- Fix missing retention propagation in `Gia_ManFromIfLogic()`
  (the default `&if` extraction path was not copying origins
  from If_Man_t back to the new GIA)

- Add GTest unit tests for GIA retention API
- Add integration test script and CI validation for &write_retention

Output format:
  .gia_retention_begin
  CI <ci_position> <gia_object_id>
  <gia_id> SRC <origin_gia_id_1> <origin_gia_id_2> ...
  .gia_retention_end

Co-developed-by: Claude Code v2.1.44 (claude-opus-4-6)
The &fraig -x command (Cec4_ManStartNew in cecSatG2.c) was creating new
GIA managers without propagating node retention data, causing all
retention information to be lost during SAT sweeping. This was the root
cause of empty retention sections when running the abc9 synthesis
pipeline.

Fixed retention propagation in:
- cecSatG2.c: Cec4_ManStartNew (CIs), sweep loops (ANDs), CO
  finalization, Gia_ManLocalRehash
- cecCorr.c: Gia_ManCorrReduce and Gia_ManCorrReduce_rec (scorr path)
- giaSweep.c: Gia_ManDupWithBoxes, Gia_ManFraigCreateGia,
  Gia_ManFraigReduceGia
- giaScript.c: Gia_ManDupFromBarBufs, Gia_ManDupToBarBufs (&dch path)
- dchAig.c: Dch_DeriveTotalAig_rec, Dch_DeriveTotalAig (dch -f path)
- dchSweep.c: Dch_ManSweep CI and AND node propagation

Co-developed-by: Claude Code v2.1.47 (claude-opus-4-6)
Internal nodes were losing retention data through the classic abc
synthesis commands (strash, dc2, balance, dch -f, if, write_blif).
The root cause was missing Nr_ManCopyOrigins calls in several
Abc_Ntk_t transformation functions.

Fixed retention propagation in:
- abcDar.c: Abc_NtkFromDar (Aig->Ntk for dc2/scorr/etc),
  Abc_NtkFromDarChoices (dch -f output)
- abcStrash.c: Abc_NtkRestrash (strash command AND nodes)
- abcBalance.c: Abc_NodeBalance_rec (balance command)
- abcNtk.c: Abc_NtkDup (strash and non-strash branches)
- abcIf.c: Abc_NtkToIf (Ntk->If CIs and ANDs),
  Abc_NodeFromIf_rec (If->Ntk mapped nodes)
- abcNetlist.c: Abc_NtkAigToLogicSop (AIG->logic for write_blif)

Co-developed-by: Claude Code v2.1.47 (claude-opus-4-6)
Add self-contained test scripts for node retention CI tests that use
i10.aig (already in repo) instead of the removed Silimate-specific
BLIF fixtures. Also add node_retention.c/.h to abclib.dsp so the
Windows Visual Studio build can link the retention symbols.

Co-developed-by: Claude Code v2.1.49 (claude-opus-4-6)
Fix bug in Abc_NtkToDar where Nr_ManCopyOrigins for latches used a
potentially complemented pointer (for Init1 latches) and was redundant
with the CI loop that already tracks all latch CIs. Remove the
duplicate commented-out include in abc.h and dead declaration in
mainInt.h.

Found by Greptile review on Silimate#4.

Co-developed-by: Claude Code v2.1.49 (claude-opus-4-6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants