OpenXiangShan / XiangShan

Open-source high-performance RISC-V processor
Other
4.45k stars 620 forks source link

Compile Exception while using "make emu EMU_THREADS=8 MFC=1 CONFIG=KunminghuV2Config", #2989

Open Jeremy-Jia opened 1 month ago

Jeremy-Jia commented 1 month ago

Before start

PLEASE MAKE SURE you have done these:

Describe the question

A clear and concise description of your question.

Compile Exception while using "make emu EMU_THREADS=8 MFC=1 CONFIG=KunminghuV2Config", the error message is:

    Exception in thread "main" java.util.NoSuchElementException: head of empty list
    at scala.collection.immutable.Nil$.head(List.scala:662)
    at scala.collection.immutable.Nil$.head(List.scala:661)
    at top.BusPerfMonitorImp.<init>(BusPerfMonitor.scala:105)
    at top.BusPerfMonitor.$anonfun$module$1(BusPerfMonitor.scala:30)
    at chisel3.internal.plugin.package$.autoNameRecursively(package.scala:33)
    at top.BusPerfMonitor.module$lzycompute(BusPerfMonitor.scala:30)
    at top.BusPerfMonitor.module(BusPerfMonitor.scala:30)
    at top.BusPerfMonitor.module(BusPerfMonitor.scala:28)
    at freechips.rocketchip.diplomacy.LazyModuleImpLike.$anonfun$instantiate$15(LazyModule.scala:335)
    at chisel3.Module$.evaluate(Module.scala:88)
    at chisel3.Module$.do_apply(Module.scala:35)
    at freechips.rocketchip.diplomacy.LazyModuleImpLike.$anonfun$instantiate$14(LazyModule.scala:335)
    at chisel3.internal.plugin.package$.autoNameRecursively(package.scala:33)
    at freechips.rocketchip.diplomacy.LazyModuleImpLike.$anonfun$instantiate$13(LazyModule.scala:335)
    at scala.Option.getOrElse(Option.scala:201)
    at freechips.rocketchip.diplomacy.LazyModuleImpLike.$anonfun$instantiate$1(LazyModule.scala:333)
    at scala.collection.immutable.List.flatMap(List.scala:293)
    at freechips.rocketchip.diplomacy.LazyModuleImpLike.instantiate(LazyModule.scala:309)
    at freechips.rocketchip.diplomacy.LazyModuleImpLike.instantiate$(LazyModule.scala:306)
    at freechips.rocketchip.diplomacy.LazyModuleImp.instantiate(LazyModule.scala:396)
    at freechips.rocketchip.diplomacy.LazyModuleImp.$anonfun$x$22$1(LazyModule.scala:398)
    at chisel3.internal.plugin.package$.autoNameRecursivelyProduct(package.scala:48)
    at freechips.rocketchip.diplomacy.LazyModuleImp.<init>(LazyModule.scala:398)
    at xiangshan.L2Top$L2TopImp.<init>(L2Top.scala:147)
    at xiangshan.L2Top.$anonfun$module$1(L2Top.scala:244)
    at chisel3.internal.plugin.package$.autoNameRecursively(package.scala:33)
    at xiangshan.L2Top.module$lzycompute(L2Top.scala:244)
    at xiangshan.L2Top.module(L2Top.scala:244)
    at xiangshan.L2Top.module(L2Top.scala:56)
    at freechips.rocketchip.diplomacy.LazyModuleImpLike.$anonfun$instantiate$15(LazyModule.scala:335)
    at chisel3.Module$.evaluate(Module.scala:88)
    at chisel3.Module$.do_apply(Module.scala:35)
    at freechips.rocketchip.diplomacy.LazyModuleImpLike.$anonfun$instantiate$14(LazyModule.scala:335)
    at chisel3.internal.plugin.package$.autoNameRecursively(package.scala:33)
    at freechips.rocketchip.diplomacy.LazyModuleImpLike.$anonfun$instantiate$13(LazyModule.scala:335)
    at scala.Option.getOrElse(Option.scala:201)
    at freechips.rocketchip.diplomacy.LazyModuleImpLike.$anonfun$instantiate$1(LazyModule.scala:333)
    at scala.collection.immutable.List.flatMap(List.scala:293)
    at freechips.rocketchip.diplomacy.LazyModuleImpLike.instantiate(LazyModule.scala:309)
    at freechips.rocketchip.diplomacy.LazyModuleImpLike.instantiate$(LazyModule.scala:306)
    at freechips.rocketchip.diplomacy.LazyModuleImp.instantiate(LazyModule.scala:396)
    at freechips.rocketchip.diplomacy.LazyModuleImp.$anonfun$x$22$1(LazyModule.scala:398)
    at chisel3.internal.plugin.package$.autoNameRecursivelyProduct(package.scala:48)
    at freechips.rocketchip.diplomacy.LazyModuleImp.<init>(LazyModule.scala:398)
    at xiangshan.XSTile$XSTileImp.<init>(XSTile.scala:108)
    at xiangshan.XSTile.$anonfun$module$1(XSTile.scala:182)
    at chisel3.internal.plugin.package$.autoNameRecursively(package.scala:33)
    at xiangshan.XSTile.module$lzycompute(XSTile.scala:182)
    at xiangshan.XSTile.module(XSTile.scala:182)
    at xiangshan.XSTile.module(XSTile.scala:33)
    at freechips.rocketchip.diplomacy.LazyModuleImpLike.$anonfun$instantiate$15(LazyModule.scala:335)
    at chisel3.Module$.evaluate(Module.scala:88)
    at chisel3.Module$.do_apply(Module.scala:35)
    at freechips.rocketchip.diplomacy.LazyModuleImpLike.$anonfun$instantiate$14(LazyModule.scala:335)
    at chisel3.internal.plugin.package$.autoNameRecursively(package.scala:33)
    at freechips.rocketchip.diplomacy.LazyModuleImpLike.$anonfun$instantiate$13(LazyModule.scala:335)
    at scala.Option.getOrElse(Option.scala:201)
    at freechips.rocketchip.diplomacy.LazyModuleImpLike.$anonfun$instantiate$1(LazyModule.scala:333)
    at scala.collection.immutable.List.flatMap(List.scala:293)
    at freechips.rocketchip.diplomacy.LazyModuleImpLike.instantiate(LazyModule.scala:309)
    at freechips.rocketchip.diplomacy.LazyModuleImpLike.instantiate$(LazyModule.scala:306)
    at freechips.rocketchip.diplomacy.LazyRawModuleImp.instantiate(LazyModule.scala:405)
    at freechips.rocketchip.diplomacy.LazyRawModuleImp.$anonfun$x$23$2(LazyModule.scala:418)
    at chisel3.withClockAndReset$.apply(MultiClock.scala:35)
    at chisel3.withClockAndReset$.apply(MultiClock.scala:18)
    at freechips.rocketchip.diplomacy.LazyRawModuleImp.$anonfun$x$23$1(LazyModule.scala:418)
    at chisel3.internal.plugin.package$.autoNameRecursivelyProduct(package.scala:48)
    at freechips.rocketchip.diplomacy.LazyRawModuleImp.<init>(LazyModule.scala:417)
    at top.XSTop$XSTopImp.<init>(Top.scala:163)
    at top.XSTop.$anonfun$module$1(Top.scala:300)
    at chisel3.internal.plugin.package$.autoNameRecursively(package.scala:33)
    at top.XSTop.module$lzycompute(Top.scala:300)
    at top.XSTop.module(Top.scala:300)
    at top.SimTop.$anonfun$soc$2(SimTop.scala:32)
    at chisel3.Module$.evaluate(Module.scala:88)
    at chisel3.Module$.do_apply(Module.scala:35)
    at top.SimTop.$anonfun$soc$1(SimTop.scala:32)
    at chisel3.internal.plugin.package$.autoNameRecursively(package.scala:33)
    at top.SimTop.<init>(SimTop.scala:32)
    at top.SimTop$.$anonfun$new$22(SimTop.scala:110)
    at freechips.rocketchip.diplomacy.package$.DisableMonitors(package.scala:228)
    at top.SimTop$.$anonfun$new$21(SimTop.scala:110)
    at chisel3.Module$.evaluate(Module.scala:88)
    at chisel3.Module$.do_apply(Module.scala:35)
    at chisel3.stage.phases.Elaborate.$anonfun$transform$2(Elaborate.scala:48)
    at chisel3.internal.Builder$.$anonfun$buildImpl$1(Builder.scala:1023)
    at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
    at chisel3.internal.Builder$.buildImpl(Builder.scala:1017)
    at chisel3.internal.Builder$.$anonfun$build$1(Builder.scala:1008)
    at logger.Logger$.$anonfun$makeScope$4(Logger.scala:148)
    at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
    at logger.Logger$.makeScope(Logger.scala:146)
    at logger.Logger$.makeScope(Logger.scala:133)
    at chisel3.internal.Builder$.build(Builder.scala:1008)
    at chisel3.stage.phases.Elaborate.$anonfun$transform$1(Elaborate.scala:48)
    at scala.collection.immutable.List.flatMap(List.scala:293)
    at scala.collection.immutable.List.flatMap(List.scala:79)
    at chisel3.stage.phases.Elaborate.transform(Elaborate.scala:32)
    at chisel3.stage.phases.Elaborate.transform(Elaborate.scala:22)
    at firrtl.options.DependencyManager.$anonfun$transform$5(DependencyManager.scala:280)
    at firrtl.Utils$.time(Utils.scala:53)
    at firrtl.options.DependencyManager.$anonfun$transform$3(DependencyManager.scala:280)
    at scala.collection.LinearSeqOps.foldLeft(LinearSeq.scala:183)
    at scala.collection.LinearSeqOps.foldLeft$(LinearSeq.scala:179)
    at scala.collection.immutable.List.foldLeft(List.scala:79)
    at firrtl.options.DependencyManager.transform(DependencyManager.scala:269)
    at firrtl.options.DependencyManager.transform$(DependencyManager.scala:255)
    at firrtl.options.PhaseManager.transform(DependencyManager.scala:443)
    at top.XiangShanStage.run(XiangShanStage.scala:68)
    at firrtl.options.Stage$$anon$1.transform(Stage.scala:42)
    at firrtl.options.Stage$$anon$1.transform(Stage.scala:42)
    at firrtl.options.Stage.$anonfun$transform$3(Stage.scala:45)
    at scala.collection.LinearSeqOps.foldLeft(LinearSeq.scala:183)
    at scala.collection.LinearSeqOps.foldLeft$(LinearSeq.scala:179)
    at scala.collection.immutable.List.foldLeft(List.scala:79)
    at firrtl.options.Stage.$anonfun$transform$2(Stage.scala:45)
    at logger.Logger$.$anonfun$makeScope$4(Logger.scala:148)
    at scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
    at logger.Logger$.makeScope(Logger.scala:146)
    at logger.Logger$.makeScope(Logger.scala:125)
    at firrtl.options.Stage.transform(Stage.scala:45)
    at firrtl.options.Stage.execute(Stage.scala:56)
    at top.Generator$.execute(Generator.scala:34)
    at top.SimTop$.delayedEndpoint$top$SimTop$1(SimTop.scala:111)
    at top.SimTop$delayedInit$body.apply(SimTop.scala:97)
    at scala.Function0.apply$mcV$sp(Function0.scala:42)
    at scala.Function0.apply$mcV$sp$(Function0.scala:42)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
    at scala.App.$anonfun$main$1(App.scala:98)
    at scala.App.$anonfun$main$1$adapted(App.scala:98)
    at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:575)
    at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:573)
    at scala.collection.AbstractIterable.foreach(Iterable.scala:933)
    at scala.App.main(App.scala:98)
    at scala.App.main$(App.scala:96)
    at top.SimTop$.main(SimTop.scala:97)
    at top.SimTop.main(SimTop.scala)

1 targets failed xiangshan[chisel].test.runMain subprocess failed make: *** [Makefile:162: build/rtl/SimTop.v] Error 1

Environment

Operating System: Ubuntu 20.04

gcc version: gcc version 11.2.0 (Ubuntu 11.2.0-19ubuntu1)

mill version: Mill Build Tool version 0.11.1 Java version: 11.0.22, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64 Default locale: en, platform encoding: UTF-8 OS name: "Linux", version: 5.15.146.1-microsoft-standard-WSL2, arch: amd64

The commit log:

commit 5961467fb71810763d53d8d244fbcdfa2b81fa81 (HEAD -> master, origin/master, origin/HEAD) Author: Xiaokun-Pei peixiaokun23z@ict.ac.cn Date: Wed May 15 14:23:12 2024 +0800 HPTW, RVH: add the flush function (#2982)

cebarobot commented 1 month ago

Thank you for your report. This issue has been reproduced.

We will fix it latter.

cebarobot commented 1 month ago

Sorry, this is not a bug.

KunminghuV2Config is only used for generating verilog of XiangShan with CHI and cannot be used for building emu.

You could:

Jeremy-Jia commented 1 month ago

Thank you for your reply. Please note that in the XiangShan Makefile:

IMAGE ?= temp
CONFIG ?= DefaultConfig
NUM_CORES ?= 1
MFC ?= 1

The default configuration is DefaultConfig. When I run the command “make emu EMU_THREADS=8 MFC=1”, it initially generates the Verilog code for DefaultConfig, which lacks CHI features. As a result, the emulator uses the Verilog code for DefaultConfig instead of KunminghuV2Config.

And, if I first generate the Verilog code for KunminghuV2Config using “make verilog EMU_THREADS=8 MFC=1 CONFIG=KunminghuV2Config”, this action will be overridden when I subsequently execute “make emu EMU_THREADS=8 MFC=1”.

cebarobot commented 1 month ago

My previous response might have caused some misunderstanding. Please allow me to clarify:

You could run either make verilog EMU_THREADS=8 MFC=1 CONFIG=KunminghuV2Config or make emu EMU_THREADS=8 MFC=1, but not run them sequentially.

At present, our emu infrastructure are not ready for CHI, which means you cannot build emu for XiangShan with CHI (KunminghuV2Config) by any means. The only workable output of KunminghuV2Config is verilog.

Jeremy-Jia commented 1 month ago

“At present, our emu infrastructure are not ready for CHI, which means you cannot build emu for XiangShan with CHI (KunminghuV2Config) by any means. The only workable output of KunminghuV2Config is verilog.”

Got it.