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

Chisel v6.0.0 compile works, test fails #3746

Closed
gonsolo opened this issue Jan 19, 2024 · 7 comments
Closed

Chisel v6.0.0 compile works, test fails #3746

gonsolo opened this issue Jan 19, 2024 · 7 comments

Comments

@gonsolo
Copy link
Contributor

gonsolo commented Jan 19, 2024

Testing Chisel v6.0.0 with my small project resulted in the following error messages. Any ideas?
Version 5.1.0 works fine. I'm using chiseltest 5.0.2.

[info] compiling 3 Scala sources to /home/gonsolo/work/pepe/target/scala-2.13/test-classes ...
[info] DiffuseSpec:
[info] Diffuse
[info] bsdf.DiffuseSpec *** ABORTED ***
[info]   java.lang.NoClassDefFoundError: firrtl/ir/PartialConnect
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:232)
[info]   at chiseltest.simulator.ChiselBridge$.$anonfun$convert$8(ChiselBridge.scala:227)
[info]   at scala.collection.immutable.Vector1.map(Vector.scala:2140)
[info]   at scala.collection.immutable.Vector1.map(Vector.scala:385)
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:227)
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:167)
[info]   at chiseltest.simulator.ChiselBridge$.$anonfun$convert$1(ChiselBridge.scala:155)
[info]   at scala.collection.immutable.List.map(List.scala:250)
[info] MultiplySpectrumSpec:
[info]   at scala.collection.immutable.List.map(List.scala:79)
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:155)
[info]   ...
[info]   Cause: java.lang.ClassNotFoundException: firrtl.ir.PartialConnect
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:232)
[info]   at chiseltest.simulator.ChiselBridge$.$anonfun$convert$8(ChiselBridge.scala:227)
[info]   at scala.collection.immutable.Vector1.map(Vector.scala:2140)
[info] bsdf.MultiplySpectrumSpec *** ABORTED ***
[info]   at scala.collection.immutable.Vector1.map(Vector.scala:385)
[info]   java.lang.NoClassDefFoundError: firrtl/ir/PartialConnect
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:227)
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:232)
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:167)
[info]   at chiseltest.simulator.ChiselBridge$.$anonfun$convert$8(ChiselBridge.scala:227)
[info]   at chiseltest.simulator.ChiselBridge$.$anonfun$convert$1(ChiselBridge.scala:155)
[info]   at scala.collection.immutable.Vector1.map(Vector.scala:2140)
[info]   at scala.collection.immutable.List.map(List.scala:250)
[info]   at scala.collection.immutable.Vector1.map(Vector.scala:385)
[info]   at scala.collection.immutable.List.map(List.scala:79)
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:227)
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:155)
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:167)
[info]   ...
[info]   at chiseltest.simulator.ChiselBridge$.$anonfun$convert$1(ChiselBridge.scala:155)
[info]   at scala.collection.immutable.List.map(List.scala:250)
[info]   at scala.collection.immutable.List.map(List.scala:79)
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:155)
[info]   ...
[info]   Cause: java.lang.ClassNotFoundException: firrtl.ir.PartialConnect
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:232)
[info]   at chiseltest.simulator.ChiselBridge$.$anonfun$convert$8(ChiselBridge.scala:227)
[info]   at scala.collection.immutable.Vector1.map(Vector.scala:2140)
[info]   at scala.collection.immutable.Vector1.map(Vector.scala:385)
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:227)
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:167)
[info]   at chiseltest.simulator.ChiselBridge$.$anonfun$convert$1(ChiselBridge.scala:155)
[info]   at scala.collection.immutable.List.map(List.scala:250)
[info]   at scala.collection.immutable.List.map(List.scala:79)
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:155)
[info]   ...
[info] MultiplySpec:
[info] bsdf.MultiplySpec *** ABORTED ***
[info]   java.lang.NoClassDefFoundError: firrtl/ir/PartialConnect
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:232)
[info]   at chiseltest.simulator.ChiselBridge$.$anonfun$convert$8(ChiselBridge.scala:227)
[info]   at scala.collection.immutable.Vector1.map(Vector.scala:2140)
[info]   at scala.collection.immutable.Vector1.map(Vector.scala:385)
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:227)
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:167)
[info]   at chiseltest.simulator.ChiselBridge$.$anonfun$convert$1(ChiselBridge.scala:155)
[info]   at scala.collection.immutable.List.map(List.scala:250)
[info]   at scala.collection.immutable.List.map(List.scala:79)
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:155)
[info]   ...
[info]   Cause: java.lang.ClassNotFoundException: firrtl.ir.PartialConnect
[info]   at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
[info]   at sbt.internal.ManagedClassLoader.findClass(ManagedClassLoader.java:103)
[info]   at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:592)
[info]   at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:232)
[info]   at chiseltest.simulator.ChiselBridge$.$anonfun$convert$8(ChiselBridge.scala:227)
[info]   at scala.collection.immutable.Vector1.map(Vector.scala:2140)
[info]   at scala.collection.immutable.Vector1.map(Vector.scala:385)
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:227)
[info]   at chiseltest.simulator.ChiselBridge$.convert(ChiselBridge.scala:167)
[info]   ...
[error] Test suite bsdf.DiffuseSpec failed with java.lang.NoClassDefFoundError: firrtl/ir/PartialConnect.
[error] This may be due to the ClassLoaderLayeringStrategy (ScalaLibrary) used by your task.
[error] To improve performance and reduce memory, sbt attempts to cache the class loaders used to load the project dependencies.
[error] The project class files are loaded in a separate class loader that is created for each test run.
[error] The test class loader accesses the project dependency classes using the cached project dependency classloader.
[error] With this approach, class loading may fail under the following conditions:
[error] 
[error]  * Dependencies use reflection to access classes in your project's classpath.
[error]    Java serialization/deserialization may cause this.
[error]  * An open package is accessed across layers. If the project's classes access or extend
[error]    jvm package private classes defined in a project dependency, it may cause an IllegalAccessError
[error]    because the jvm enforces package private at the classloader level.
[error] 
[error] These issues, along with others that were not enumerated above, may be resolved by changing the class loader layering strategy.
[error] The Flat and ScalaLibrary strategies bundle the full project classpath in the same class loader.
[error] To use one of these strategies, set the  ClassLoaderLayeringStrategy key
[error] in your configuration, for example:
[error] 
[error] set root / Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.ScalaLibrary
[error] set root / Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.Flat
[error] 
[error] See ClassLoaderLayeringStrategy.scala for the full list of options.
[error] Test suite bsdf.MultiplySpec failed with java.lang.NoClassDefFoundError: firrtl/ir/PartialConnect.
[error] This may be due to the ClassLoaderLayeringStrategy (ScalaLibrary) used by your task.
[error] To improve performance and reduce memory, sbt attempts to cache the class loaders used to load the project dependencies.
[error] The project class files are loaded in a separate class loader that is created for each test run.
[error] The test class loader accesses the project dependency classes using the cached project dependency classloader.
[error] With this approach, class loading may fail under the following conditions:
[error] 
[error]  * Dependencies use reflection to access classes in your project's classpath.
[error]    Java serialization/deserialization may cause this.
[error]  * An open package is accessed across layers. If the project's classes access or extend
[error]    jvm package private classes defined in a project dependency, it may cause an IllegalAccessError
[error]    because the jvm enforces package private at the classloader level.
[error] 
[error] These issues, along with others that were not enumerated above, may be resolved by changing the class loader layering strategy.
[error] The Flat and ScalaLibrary strategies bundle the full project classpath in the same class loader.
[error] To use one of these strategies, set the  ClassLoaderLayeringStrategy key
[error] in your configuration, for example:
[error] 
[error] set root / Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.ScalaLibrary
[error] set root / Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.Flat
[error] 
[error] See ClassLoaderLayeringStrategy.scala for the full list of options.
[error] Test suite bsdf.MultiplySpectrumSpec failed with java.lang.NoClassDefFoundError: firrtl/ir/PartialConnect.
[error] This may be due to the ClassLoaderLayeringStrategy (ScalaLibrary) used by your task.
[error] To improve performance and reduce memory, sbt attempts to cache the class loaders used to load the project dependencies.
[error] The project class files are loaded in a separate class loader that is created for each test run.
[error] The test class loader accesses the project dependency classes using the cached project dependency classloader.
[error] With this approach, class loading may fail under the following conditions:
[error] 
[error]  * Dependencies use reflection to access classes in your project's classpath.
[error]    Java serialization/deserialization may cause this.
[error]  * An open package is accessed across layers. If the project's classes access or extend
[error]    jvm package private classes defined in a project dependency, it may cause an IllegalAccessError
[error]    because the jvm enforces package private at the classloader level.
[error] 
[error] These issues, along with others that were not enumerated above, may be resolved by changing the class loader layering strategy.
[error] The Flat and ScalaLibrary strategies bundle the full project classpath in the same class loader.
[error] To use one of these strategies, set the  ClassLoaderLayeringStrategy key
[error] in your configuration, for example:
[error] 
[error] set root / Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.ScalaLibrary
[error] set root / Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.Flat
[error] 
[error] See ClassLoaderLayeringStrategy.scala for the full list of options.
[info] Run completed in 899 milliseconds.
[info] Total number of tests run: 0
[info] Suites: completed 0, aborted 3
[info] Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0
[info] *** 3 SUITES ABORTED ***

@gonsolo
Copy link
Contributor Author

gonsolo commented Jan 19, 2024

It seems chiseltest is not supported anymore and svsim should be used.
Anyway chisel-template (which should be kept up to date) is still using chiseltest.

@jackkoenig
Copy link
Contributor

This is a binary compatibility issue, please see Chisel's versioning policy: https://www.chisel-lang.org/docs/appendix/versioning

Basically, binary compatibility breaks between major versions, so ChiselTest compiled for Chisel 5.x will not work with Chisel 6.x. Kevin has indicated intent to release ChiselTest for Chisel 6: ucb-bar/chiseltest#699.

@gonsolo
Copy link
Contributor Author

gonsolo commented Jan 20, 2024

chiseltest sbt publishLocal needs the following patch:

diff --git a/src/main/scala/treadle2/stage/phases/GetFirrtlAst.scala b/src/main/scala/treadle2/stage/phases/GetFirrtlAst.scala
index 388846a..ed856f9 100644
--- a/src/main/scala/treadle2/stage/phases/GetFirrtlAst.scala
+++ b/src/main/scala/treadle2/stage/phases/GetFirrtlAst.scala
@@ -38,7 +38,7 @@ object GetFirrtlAst extends Phase {
     def handleFirrtlFile(): Option[AnnotationSeq] = {
       annotationSeq.collectFirst { case FirrtlFileAnnotation(fileName) => fileName } match {
         case Some(fileName) =>
-          val file = io.Source.fromFile(fileName)
+          val file = scala.io.Source.fromFile(fileName)
           val text = file.mkString
           file.close()

firrtl2 needs the following patch:

diff --git a/build.sbt b/build.sbt
index 895191b0..ffe0d80c 100644
--- a/build.sbt
+++ b/build.sbt
@@ -4,7 +4,7 @@ enablePlugins(SiteScaladocPlugin)
 
 lazy val commonSettings = Seq(
   organization := "edu.berkeley.cs",
-  scalaVersion := "3.2.2",
+  scalaVersion := "2.13.12",
   crossScalaVersions := Seq("2.13.10", "3.2.2")
 )
 
@@ -100,8 +100,7 @@ lazy val docSettings = Seq(
   Compile / doc / scalacOptions ++= Seq(
     // ANTLR-generated classes aren't really part of public API and cause
     // errors in ScalaDoc generation
-    "-skip-packages",
-    "firrtl2.antlr",
+    "-skip-packages:firrtl2.antlr",
     "-Xfatal-warnings",
     "-feature",
     "-diagrams",

After that my project fails with:

[info] java.lang.NoClassDefFoundError: chisel3/internal/firrtl/Width

From my point of view this issue is far from completed.
My wishlist:

  1. Before releasing a new Chisel version, keep at least chisel-template and chiseltest working. (Alternatively: How are you testing at SiFive and Berkeley?)
  2. At least keep chiseltest compiling.
  3. Similarly keep firrtl2 compiling.
  4. Don't fork an old compiler just.
    4a. Using Scala 3 makes the forked compiler incompatible to the rest of Chisel/chiseltest/...

As for now I'm staying at 5.1.0, and I hope you consider not breaking external projects in the future.

@kiniry
Copy link

kiniry commented Feb 20, 2024

Love your comment's wishlist number 1 in particular, @gonsolo....

Releasing Chisel 6 without having any structured means by which to perform assurance is gonzo. CC @schoeberl (Hi Martin!)

@schoeberl
Copy link
Contributor

Hi Joseph (@kiniry), what is your interest in Chisel?

@seldridge
Copy link
Member

Hi all. Sorry about the breakages with ChiselTest. ChiselTest, from the perspective of the Chisel developers, was not intended to be used beyond Chisel 3.6. ChiselSim was built as a lightweight, maintained replacement in Chisel 5. Please migrate to ChiselSim. More information about the background of this issue and a migration guide is now provided here: http://www.chisel-lang.org/docs/appendix/migrating-from-chiseltest.

If there are features you want/need with ChiselSim (e.g., enqueueSeq/dequeueSeq or fork/join), please open issues or consider contributing these features to the project.

The chipsalliance/chisel-template has been migrated to use ChiselSim.

@kiniry
Copy link

kiniry commented Feb 27, 2024

Hey @schoeberl! Remember me from DTU? We hardly got to talk while I was working there for a year before joining Galois ten years (!) ago.

We have used Chisel at Galois on several Government-funded R&D projects I have run for the past eight years or so, including taping out several interesting ASICs. E.g., we were responsible for the six SoCs (plus OSs, development toolchains, improvements to clang to support RISC-V, and much more) provided by the Government to DARPA SSITH performers, and we simulated those SoCs in AWS for DARPA FETT, for which we built the entire infrastructure.

We are currently using Chisel on the [DARPA AISS[(https://www.darpa.mil/program/automatic-implementation-of-secure-silicon) program, as we are developing a product line of hardware security engines. Thus, I need to be able to automatically generate model-based test benches and verification benches from our RDE (formally-grounded) designs/models.

While we can go from RDE models to SVA-based benches (or, yuck, UVM), I'd rather push toward stronger integration of Chisel-centric assurance in this project, thus my nudge on this issue.

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

No branches or pull requests

5 participants