Skip to content

feat(const-fold): write prepopulated inputs, place fewer Consts + next to source not targets#1489

Open
acl-cqc wants to merge 1 commit intomainfrom
acl/const_fold_near_source
Open

feat(const-fold): write prepopulated inputs, place fewer Consts + next to source not targets#1489
acl-cqc wants to merge 1 commit intomainfrom
acl/const_fold_near_source

Conversation

@acl-cqc
Copy link
Copy Markdown
Contributor

@acl-cqc acl-cqc commented Mar 31, 2026

Previously mb_root_inp was used to prevent values passed to prepopulate_wire / prepopulate_inputs being written into the graph - I think at the time I did this because writing them in seemed a bit superfluous, but really it's consistent with what we do to other ops. Hence, drop the mb_root_inp.

Prior to #1474 (now merged) this broke lots of things because mb_root_inp was covering that bug. Post #1474 this breaks only a few cases in const_fold::test::test_cfg which were calling assert_fully_folded

  • This was failing because this test has ops with nonlocal edges from ancestor Input nodes for which values were being provided by prepopulate_inputs. The mb_root_inp was preventing these from being written into the graph, but without that, they are written into the graph which wre are checking is fully folded and so it doesn't match the expected form. (Specifically, assert_fully_folded looks for the nodes you'd expect in a DFG; we are running it on a BasicBlock in a CFG, and the fed-in constant values are the successor-predicate)
  • Hence, change the Const-insertion code. Instead of placing (duplicating) each Const next to each input using the const value, place a single Const next to the output producing the value, and route edges (perhaps nonlocal) to all targets.

Base automatically changed from acl/fix_const_fold to main April 2, 2026 09:23
@acl-cqc acl-cqc force-pushed the acl/const_fold_near_source branch from 7fe677f to 88d3803 Compare April 2, 2026 19:05
@acl-cqc acl-cqc changed the title feat (const-fold): write prepopulated inputs, and place Consts next to source not targets feat(const-fold): write prepopulated inputs, place fewer Consts + next to source not targets Apr 2, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.82%. Comparing base (4fdadd2) to head (8feb879).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1489      +/-   ##
==========================================
+ Coverage   83.81%   83.82%   +0.01%     
==========================================
  Files         187      187              
  Lines       28943    28956      +13     
  Branches    27880    27877       -3     
==========================================
+ Hits        24258    24273      +15     
+ Misses       3523     3522       -1     
+ Partials     1162     1161       -1     
Flag Coverage Δ
python 92.33% <ø> (-0.08%) ⬇️
qis-compiler 91.66% <ø> (ø)
rust 83.49% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@acl-cqc acl-cqc force-pushed the acl/const_fold_near_source branch from 88d3803 to 8feb879 Compare April 7, 2026 15:46
@acl-cqc acl-cqc marked this pull request as ready for review April 7, 2026 16:30
@acl-cqc acl-cqc requested a review from a team as a code owner April 7, 2026 16:30
@acl-cqc acl-cqc requested a review from ss2165 April 7, 2026 16:30
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.

1 participant