Skip to content

Conversation

@jackkoenig
Copy link
Contributor

@jackkoenig jackkoenig commented Jul 25, 2025

Initial version was surprisingly easy, but ended up being a little more complicated because I added support to Chisel's internal IR for complex expressions instead of every expression also being a Statement.

Contributor Checklist

  • Did you add Scaladoc to every public function/method?
  • Did you add at least one test demonstrating the PR?
  • Did you delete any extraneous printlns/debugging code?
  • Did you specify the type of improvement?
  • Did you add appropriate documentation in docs/src?
  • Did you request a desired merge strategy?
  • Did you add text to be included in the Release Notes for this change?

Type of Improvement

  • Backend code generation
  • Performance improvement

Desired Merge Strategy

  • Squash

Release Notes

This should not be visible to most users unless they inspect emitted .fir. It reduces memory use, improves performance, and reduces the size of emitted .fir a little bit, ~2-5% depending on the design.

Reviewer Checklist (only modified by reviewer)

  • Did you add the appropriate labels? (Select the most appropriate one based on the "Type of Improvement")
  • Did you mark the proper milestone (Bug fix: 3.6.x, 5.x, or 6.x depending on impact, API modification or big change: 7.0)?
  • Did you review?
  • Did you check whether all relevant Contributor checkboxes have been checked?
  • Did you do one of the following when ready to merge:
    • Squash: You/ the contributor Enable auto-merge (squash) and clean up the commit message.
    • Merge: Ensure that contributor has cleaned up their commit history, then merge with Create a merge commit.

@dtzSiFive
Copy link
Member

Woohoo! Glad it was easy 😁 🤞 .

Can't wait to never see hi_hi_lo_lo_hi_lo_hi_hi in FIRRTL source again! 😉

@jackkoenig jackkoenig force-pushed the jackkoenig/variadic-cat branch from efff5f9 to d4b30b0 Compare July 29, 2025 00:25
To avoid emitting nodes simply to cast SInts to UInts, improve the
internal IR with PrimExpr which are primitive expressions.
@jackkoenig jackkoenig force-pushed the jackkoenig/variadic-cat branch from d4b30b0 to 35486ce Compare August 10, 2025 01:21
@jackkoenig jackkoenig added the Backend Code Generation Affects backend code generation, will be included in release notes label Aug 10, 2025
@jackkoenig jackkoenig added this to the 7.0 milestone Aug 10, 2025
@jackkoenig jackkoenig marked this pull request as ready for review August 10, 2025 01:30
@jackkoenig
Copy link
Contributor Author

Ready for review at your leisure @seldridge. I think we separately also need to bump the emitted Firrtl Version before 7.0 release. I'm running an internal smoke test to make sure there are no surprises but I'm not worried.

Copy link
Member

@seldridge seldridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines -57 to +56
chirrtl should include("node lo_lo = cat(in[6], in[7])")
chirrtl should include("node lo_hi = cat(in[4], in[5])")
chirrtl should include("node hi_lo = cat(in[2], in[3])")
chirrtl should include("node hi_hi = cat(in[0], in[1])")
chirrtl should include("cat(in[0], in[1], in[2], in[3], in[4], in[5], in[6], in[7])")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks a lot nicer!

@jackkoenig jackkoenig merged commit 20c8e09 into main Aug 18, 2025
15 of 16 checks passed
@jackkoenig jackkoenig deleted the jackkoenig/variadic-cat branch August 18, 2025 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend Code Generation Affects backend code generation, will be included in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants