Clean node retention implementation with extended coverage#4
Open
robtaylor wants to merge 14 commits intoSilimate:yosys-experimentalfrom
Open
Clean node retention implementation with extended coverage#4robtaylor wants to merge 14 commits intoSilimate:yosys-experimentalfrom
robtaylor wants to merge 14 commits intoSilimate:yosys-experimentalfrom
Conversation
Greptile SummaryThis PR implements a comprehensive node retention system for tracking source node origins through ABC synthesis transformations, enabling Yosys to preserve Key Changes
Issues Found
The implementation is well-structured with proper memory management, validation functions, and thorough test coverage. The retention manager uses dynamic hash table resizing and provides comprehensive debugging/profiling capabilities. Confidence Score: 3/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TB
subgraph Input["Input Stage"]
READ["read/&r command"]
SEED["Self-origin seeding<br/>(CI and AND nodes)"]
end
subgraph Core["Core Data Structures"]
ABC_NTK["Abc_Ntk_t<br/>pNodeRetention"]
AIG_MAN["Aig_Man_t<br/>pNodeRetention"]
GIA_MAN["Gia_Man_t<br/>pNodeRetention"]
NR_MAN["Nr_Man_t<br/>(hash table)"]
end
subgraph Transforms["Transformation Layer"]
direction LR
CLASSIC["Classic ABC<br/>- Strash<br/>- Balance<br/>- Dar<br/>- If mapping"]
GIA_OPS["GIA Ops<br/>- Dup<br/>- Hash<br/>- Sweep<br/>- Script"]
CEC["CEC/SAT<br/>- Sweeping<br/>- Correlation"]
end
subgraph Output["Output Stage"]
WRITE_BLIF["write_blif<br/>(retention map)"]
WRITE_RET["&write_retention<br/>(GIA retention)"]
end
READ --> SEED
SEED --> ABC_NTK
SEED --> GIA_MAN
ABC_NTK --> NR_MAN
AIG_MAN --> NR_MAN
GIA_MAN --> NR_MAN
NR_MAN --> CLASSIC
NR_MAN --> GIA_OPS
NR_MAN --> CEC
CLASSIC --> |Nr_ManCopyOrigins| NR_MAN
GIA_OPS --> |Nr_ManCopyOrigins| NR_MAN
CEC --> |Nr_ManCopyOrigins| NR_MAN
NR_MAN --> WRITE_BLIF
NR_MAN --> WRITE_RET
WRITE_BLIF --> YOSYS["Yosys integration<br/>(classic abc pass)"]
WRITE_RET --> YOSYS2["Yosys integration<br/>(abc9 pass)"]
Last reviewed commit: 0163b34 |
robtaylor
added a commit
to robtaylor/abc
that referenced
this pull request
Feb 20, 2026
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)
robtaylor
added a commit
to robtaylor/abc
that referenced
this pull request
Feb 21, 2026
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)
d4f4121 to
3fc0c53
Compare
- 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)
3fc0c53 to
8a5259c
Compare
robtaylor
added a commit
to robtaylor/abc
that referenced
this pull request
Feb 24, 2026
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)
4 tasks
|
Hey @robtaylor sorry I missed this! This looks awesome. I'll test this out and give some feedback soon. |
|
In the meantime, can you take a look at the conflicts? |
Author
|
Ah, it’s now been superseded by
berkeley-abc#487
…On Sat, 7 Mar 2026 at 01:49, Akash Levy ***@***.***> wrote:
*akashlevy* left a comment (Silimate/abc#4)
<#4 (comment)>
In the meantime, can you take a look at the conflicts?
—
Reply to this email directly, view it on GitHub
<#4 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAB4O4DNWIABP7VYH2MTYDD4PN54BAVCNFSM6AAAAACV24OKXSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DAMJVGIYDINJWGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR provides a clean, restructured implementation of the node retention feature, based on the original work by @AdvaySingh1. The key changes:
&write_retentioncommand: Dumps GIA retention map for debugging/validationNew retention propagation (not in original branch)
Cec4_ManStartNew, sweep loops,Gia_ManLocalRehashDch_DeriveTotalAig,Dch_ManSweepGia_ManDupWithBoxes,Gia_ManFraigCreateGia,Gia_ManFraigReduceGiaGia_ManDupFromBarBufs,Gia_ManDupToBarBufsGia_ManCorrReduceAbc_NtkRestrashAbc_NodeBalance_recAbc_NtkFromDar,Abc_NtkFromDarChoicesAbc_NtkToIf,Abc_NodeFromIf_recAbc_NtkDupAbc_NtkAigToLogicSopValidated with Yosys integration
This ABC branch is used by two Yosys PRs that preserve
\srcattributes through synthesis:abcpass: robtaylor/yosys#1abc9pass: robtaylor/yosys#2Both pass CI with test fixtures including Amaranth-style and SpinalHDL-style Verilog designs.
Test plan
get_and_put,v3, full pipeline)&write_retentionoutput verified)abcsrc retention tests passingabc9src retention tests passingcc @AdvaySingh1