Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ChiselStage and Builder handling of logging (backport #3895) #3897

Merged
merged 4 commits into from
Mar 7, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Mar 1, 2024

This is an automatic backport of pull request #3895 done by Mergify.
Cherry-pick of 88d147d has failed:

On branch mergify/bp/5.x/pr-3895
Your branch is up to date with 'origin/5.x'.

You are currently cherry-picking commit 88d147d90.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   docs/src/explanations/warnings.md
	modified:   firrtl/src/main/scala/logger/Logger.scala
	new file:   src/main/scala/circt/stage/Shell.scala

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   core/src/main/scala/chisel3/experimental/hierarchy/core/Definition.scala
	both modified:   core/src/main/scala/chisel3/internal/Builder.scala
	both modified:   docs/src/cookbooks/cookbook.md
	both modified:   src/main/scala/chisel3/aop/injecting/InjectingAspect.scala
	both modified:   src/main/scala/chisel3/stage/phases/Elaborate.scala
	both modified:   src/main/scala/circt/stage/ChiselStage.scala
	both modified:   src/test/scala/circtTests/stage/ChiselStageSpec.scala

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally


Mergify commands and options

More conditions and actions can be found in the documentation.

You can also trigger Mergify actions by commenting on this pull request:

  • @Mergifyio refresh will re-evaluate the rules
  • @Mergifyio rebase will rebase this PR on its base branch
  • @Mergifyio update will merge the base branch into this PR
  • @Mergifyio backport <destination> will backport this PR on <destination> branch

Additionally, on Mergify dashboard you can:

  • look at your merge queues
  • generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.com


Original PR Body

I originally set out just to fix the minor issue of Chisel not doing Logger.withScope, that ended up being more involved than I expected.

Long-term, we should probably ditch our Logger code and switch to a more robust solution, probably scribe or scribe + a thin wrapper around it. But this fix is needed for anything using firtool-resolver, otherwise it's really painful for the user to debug what is going wrong with that.

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

  • Bugfix

Desired Merge Strategy

  • Squash

Release Notes

  • Adds support for --log-level to circt.stage.ChiselStage
  • Previously, object circt.stage.ChiselStage was ignoring the Logger.
  • Also, Chisel was not creating its own logger scope which could lead to clobbering of the Console when running invoking Chisel in the same process multiple times.

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), clean up the commit message, and label with Please Merge.
    • Merge: Ensure that contributor has cleaned up their commit history, then merge with Create a merge commit.

Previously, object circt.stage.ChiselStage was ignoring the Logger.
Also, Chisel was not creating its own logger scope which could lead to
clobbering of the Console when running invoking Chisel in the same
process multiple times.

Fix various places we had to workaround this behavior and fix tests
checking --log-level debug.

(cherry picked from commit 88d147d)

# Conflicts:
#	core/src/main/scala/chisel3/experimental/hierarchy/core/Definition.scala
#	core/src/main/scala/chisel3/internal/Builder.scala
#	docs/src/cookbooks/cookbook.md
#	src/main/scala/chisel3/aop/injecting/InjectingAspect.scala
#	src/main/scala/chisel3/stage/phases/Elaborate.scala
#	src/main/scala/circt/stage/ChiselStage.scala
#	src/test/scala/circtTests/stage/ChiselStageSpec.scala
@mergify mergify bot added Backport Automated backport, please consider for minor release bp-conflict labels Mar 1, 2024
Copy link
Contributor Author

mergify bot commented Mar 1, 2024

Cherry-pick of 88d147d has failed:

On branch mergify/bp/5.x/pr-3895
Your branch is up to date with 'origin/5.x'.

You are currently cherry-picking commit 88d147d90.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   docs/src/explanations/warnings.md
	modified:   firrtl/src/main/scala/logger/Logger.scala
	new file:   src/main/scala/circt/stage/Shell.scala

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   core/src/main/scala/chisel3/experimental/hierarchy/core/Definition.scala
	both modified:   core/src/main/scala/chisel3/internal/Builder.scala
	both modified:   docs/src/cookbooks/cookbook.md
	both modified:   src/main/scala/chisel3/aop/injecting/InjectingAspect.scala
	both modified:   src/main/scala/chisel3/stage/phases/Elaborate.scala
	both modified:   src/main/scala/circt/stage/ChiselStage.scala
	both modified:   src/test/scala/circtTests/stage/ChiselStageSpec.scala

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@github-actions github-actions bot added the Bugfix Fixes a bug, will be included in release notes label Mar 1, 2024
@jackkoenig
Copy link
Contributor

This backport needs f1b5eff

jackkoenig and others added 2 commits March 7, 2024 08:58
Change logger annotations to mix-in the Unserializable trait so that they
will not emitted by a stage.  These annotations are not intended to be
seen by CIRCT and these should be stripped from the output FIRRTL text.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Copy link

linux-foundation-easycla bot commented Mar 7, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@chiselbot chiselbot merged commit cc512a6 into 5.x Mar 7, 2024
17 checks passed
@chiselbot chiselbot deleted the mergify/bp/5.x/pr-3895 branch March 7, 2024 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport Automated backport, please consider for minor release Bugfix Fixes a bug, will be included in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants