TestApplicationException - exit code 139

496 views
Skip to first unread message

Anup Kini

unread,
May 5, 2016, 1:27:32 AM5/5/16
to chisel-users
Hi All,

I am trying to run Chisel CPP based simulation and end up with the following exception.

CPP elaborate
[info] [18.880] // COMPILING < (class Fabric.REDEFINE_CR_NoC_RRM)>(8)
[info] [22.736] giving names
[info] [26.008] executing custom transforms
[info] [26.009] convert masked writes of inline mems
[info] [28.131] adding clocks and resets
[info] [30.434] inferring widths
[info] [34.972] checking widths
[info] [36.159] lowering complex nodes to primitives
[info] [36.159] removing type nodes
[info] [37.765] compiling 1039734 nodes
[info] [37.765] computing memory ports
[info] [40.477] resolving nodes to the components
[info] [50.921] creating clock domains
[info] [51.666] pruning unconnected IOs
[info] [51.817] checking for combinational loops
[info] [54.271] NO COMBINATIONAL LOOP FOUND
[info] [56.872] populating clock domains
CppBackend::elaborate: need 11760, redundant 13543 shadow registers
[info] [61.231] generating cpp files
CppBackend: createCppFile REDEFINE_CR_NoC_RRM.cpp

<no startup message>
[error] (run-main-0) Chisel.TestApplicationException: test application exit - exit code 139
Chisel.TestApplicationException: test application exit - exit code 139
at Chisel.Tester.throwExceptionIfDead(Tester.scala:226)
at Chisel.Tester.<init>(Tester.scala:827)
at REDEFINE.REDEFINE1Tester.<init>(redefine_CR_NoC_RRM.scala:18)
at REDEFINE.fabric$$anonfun$main$2.apply(main.scala:36)
at REDEFINE.fabric$$anonfun$main$2.apply(main.scala:36)
at Chisel.Driver$.apply(Driver.scala:67)
at Chisel.chiselMain$.apply(hcl.scala:63)
at Chisel.chiselMainTest$.apply(hcl.scala:76)
at REDEFINE.fabric$.main(main.scala:36)
at REDEFINE.fabric.main(main.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
[trace] Stack trace suppressed: run last main/compile:run for the full output.
java.lang.RuntimeException: Nonzero exit code: 1
at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last main/compile:run for the full output.
[error] (main/compile:run) Nonzero exit code: 1


Chisel command line args: "--backend", "c", "--genHarness", "--targetDir", "cppBackend", "--compile", "--test", "--debug"

build.sbt has the following:
scalaVersion := "2.11.7",
scalacOptions := Seq("-unchecked", "-deprecation", "-encoding", "utf8", "-feature", "-language:reflectiveCalls", "-language:implicitConversions", "-language:existentials", "-language:postfixOps"),
libraryDependencies += "edu.berkeley.cs" %% "chisel" % "latest.release"


Let me know if any further details are required to get me through this exception.


Thanks,
Anup.


ucbjrl

unread,
May 5, 2016, 11:18:21 AM5/5/16
to chisel-users
Exit code 139 is SIGSEGV (segmentation fault). Large designs triggered this exception during initialization in versions prior to v2.2.33 2016-04-14.

The "--debug" Chisel argument makes all internal signals available for debugging, which significantly increases the shared memory communication area. You might try generating and testing without this flag, just to see if it eliminates the SIGSEGV.

You can track down where the exception is occurring by setting the environment variable CXXFLAGS to generate an un-optimized debug executable, re-generating the simulation, and starting it up under a debugger (gdb or lldb).

    % export CXXFLAGS="-O0 -g"
    % sbt "run ...."
    % gdb <simulation_executable>
    (gdb) run

where <simulation_executable> may be cppBackend/REDEFINE_CR_NoC_RRM in your case.

If the exception occurs during initialization, gdb will announce that fact and a stack trace (the "where" command in gdb) may be instructive.

Anup Kini

unread,
May 6, 2016, 5:53:34 AM5/6/16
to chisel-users, cha...@morphing.in, Dr. Ranjani Narayan, Arka Maity
Dear Jim,

Thanks you for explaining the cause of exception.

I ran the compilation again, without debug flag and -g option for gdb.
Chisel compile options:  "--backend", "c", "--genHarness", "--targetDir", "cppBackend", "--compile", "--compileInitializationUnoptimized", "--test"
CXXFLAGS="-O0 -g"

Here is the gdb output:

(gdb) run
Starting program: /home/anup/work/testRedefine2/cppBackend/REDEFINE_CR_NoC_RRM 

Program received signal SIGSEGV, Segmentation fault.
0x000000000262fae4 in REDEFINE_CR_NoC_RRM_api_t::init_sim_data (this=<error reading variable: Cannot access memory at address 0x7fffff3e0bb8>) at cppBackend/REDEFINE_CR_NoC_RRM-4.cpp:3
3 void REDEFINE_CR_NoC_RRM_api_t::init_sim_data (  ) {
(gdb)

with the where command, the detailed line number is below

(gdb) where
#0  0x000000000262fae4 in REDEFINE_CR_NoC_RRM_api_t::init_sim_data (this=<error reading variable: Cannot access memory at address 0x7fffff3e0bb8>) at cppBackend/REDEFINE_CR_NoC_RRM-4.cpp:3
#1  0x0000000005415ebc in main (argc=1, argv=0x7fffffffe348) at cppBackend/REDEFINE_CR_NoC_RRM-emulator.cpp:7
(gdb)


Kindly let me know if there is a way around this exception to simulation large designs.

ucbjrl

unread,
May 6, 2016, 12:54:02 PM5/6/16
to chisel-users

This looks like the old communications bug that should be fixed in v2.2.33.

Could you verify the Chisel version you are using? It looks like you are using ivy/maven, which should pick up the latest release.

See if you can force a build with v2.2.33 by replacing :


    libraryDependencies += "edu.berkeley.cs" %% "chisel" % "latest.release"

with:

    libraryDependencies += "edu.berkeley.cs" %% "chisel" % "2.2.33"

in your build.sbt file. Then rebuild and run your tests (no need to involve gdb).

If this fails in the same way, then it may be a new variant of the communications bug. Is it possible to make your design (scala source code) available?


On Wednesday, May 4, 2016 at 10:27:32 PM UTC-7, Anup Kini wrote:

Anup Kini

unread,
May 9, 2016, 7:22:00 AM5/9/16
to chisel-users
Hi Jim,

I made the changes regarding chisel version and built the design again
libraryDependencies += "edu.berkeley.cs" %% "chisel" % "2.2.33"

I still get the same exception, here is the log

CPP elaborate
[ info ] [17.579] // COMPILING < (class Fabric.REDEFINE_CR_NoC_RRM)>(8)
[ info ] [24.430] giving names
[ info ] [27.748] executing custom transforms
[ info ] [27.749] convert masked writes of inline mems
[ info ] [29.727] adding clocks and resets
[ info ] [31.993] inferring widths
[ info ] [36.586] checking widths
[ info ] [37.608] lowering complex nodes to primitives
[ info ] [37.608] removing type nodes
[ info ] [39.154] compiling 1039734 nodes
[ info ] [39.154] computing memory ports
[ info ] [41.858] resolving nodes to the components
[ info ] [51.157] creating clock domains
[ info ] [51.804] pruning unconnected IOs
[ info ] [51.944] checking for combinational loops
[ info ] [54.194] NO COMBINATIONAL LOOP FOUND
[ info ] [56.631] populating clock domains
CppBackend::elaborate: need 11760, redundant 13543 shadow registers
[ info ] [63.633] generating cpp files
CppBackend: createCppFile REDEFINE_CR_NoC_RRM-0.cpp
CppBackend: createCppFile REDEFINE_CR_NoC_RRM-1.cpp
CppBackend: createCppFile REDEFINE_CR_NoC_RRM-2.cpp
CppBackend: createCppFile REDEFINE_CR_NoC_RRM-3.cpp
CppBackend: createCppFile REDEFINE_CR_NoC_RRM-4.cpp
[ info ] [2524.925] g++ -c -o cppBackend/REDEFINE_CR_NoC_RRM-emulator.o  -I../ -I/csrc/  cppBackend/REDEFINE_CR_NoC_RRM-emulator.cpp RET 0
[ info ] [5384.891] g++ -c -o cppBackend/REDEFINE_CR_NoC_RRM-4.o  -I../ -I/csrc/  -O0 cppBackend/REDEFINE_CR_NoC_RRM-4.cpp RET 0
[ info ] [10807.409] g++ -c -o cppBackend/REDEFINE_CR_NoC_RRM-0.o  -I../ -I/csrc/  -O1 cppBackend/REDEFINE_CR_NoC_RRM-0.cpp RET 0
[ info ] [13453.563] g++ -c -o cppBackend/REDEFINE_CR_NoC_RRM-1.o  -I../ -I/csrc/  -O1 cppBackend/REDEFINE_CR_NoC_RRM-1.cpp RET 0
[ info ] [19719.769] g++ -c -o cppBackend/REDEFINE_CR_NoC_RRM-2.o  -I../ -I/csrc/  -O2 cppBackend/REDEFINE_CR_NoC_RRM-2.cpp RET 0
[ info ] [22737.602] g++ -c -o cppBackend/REDEFINE_CR_NoC_RRM-3.o  -I../ -I/csrc/  -O2 cppBackend/REDEFINE_CR_NoC_RRM-3.cpp RET 0
[ info ] [22739.809] g++   -o cppBackend/REDEFINE_CR_NoC_RRM cppBackend/REDEFINE_CR_NoC_RRM-0.o cppBackend/REDEFINE_CR_NoC_RRM-1.o cppBackend/REDEFINE_CR_NoC_RRM-2.o cppBackend/REDEFINE_CR_NoC_RRM-3.o cppBackend/REDEFINE_CR_NoC_RRM-4.o cppBackend/REDEFINE_CR_NoC_RRM-emulator.o RET 0

<no startup message>
 [ error ]  (run-main-0) Chisel.TestApplicationException: test application exit - exit code 139 
Chisel.TestApplicationException: test application exit - exit code 139
at Chisel.Tester.throwExceptionIfDead(Tester.scala:226)
at Chisel.Tester.<init>(Tester.scala:827)
at REDEFINE.REDEFINE1Tester.<init>(redefine_CR_NoC_RRM.scala:18)
at REDEFINE.fabric$$anonfun$main$2.apply(main.scala:49)
at REDEFINE.fabric$$anonfun$main$2.apply(main.scala:49)
at Chisel.Driver$.apply(Driver.scala:67)
at Chisel.chiselMain$.apply(hcl.scala:63)
at Chisel.chiselMainTest$.apply(hcl.scala:76)
at REDEFINE.fabric$.main(main.scala:49)
at REDEFINE.fabric.main(main.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
 [ trace ]  Stack trace suppressed: run  last main/compile:run  for the full output. 
java.lang.RuntimeException: Nonzero exit code: 1
at scala.sys.package$.error(package.scala:27)
 [ trace ]  Stack trace suppressed: run  last main/compile:run  for the full output. 
 [ error ]  (main/compile: run ) Nonzero exit code: 1


Regarding the code, Do you need just the chisel tester class or the entire chisel code base ?

Jim Lawson

unread,
May 9, 2016, 11:26:02 AM5/9/16
to chisel...@googlegroups.com
Please tar or zip up the cppBackend directory (at least all the *.cpp and *.h files generated with CXXFLAGS="-O0-g") and make it available - either send it to me directly or put it somewhere publicly available - don't send it to the entire list.
> --
> You received this message because you are subscribed to the Google Groups "chisel-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to chisel-users...@googlegroups.com.
> To post to this group, send email to chisel...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/chisel-users/08bddb27-8679-45a0-8dc7-123dab012cd6%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Jim Lawson

unread,
May 13, 2016, 12:27:11 PM5/13/16
to chisel...@googlegroups.com
Although this issue hasn't been resolved completely, we have learned something useful which we'd like to pass on to the group.

This is a very large design (it took around 4 hours to compile the C++ code on a reasonably beefy machine - I gave up after three days trying to compile it on my laptop). The following are the relevant sizes of the simulation components:

    % wc *.cpp
       248899    901393  10971846 REDEFINE_CR_NoC_RRM-0.cpp
           26        86       597 REDEFINE_CR_NoC_RRM-1.cpp
      1094889   4747238  81272118 REDEFINE_CR_NoC_RRM-2.cpp
        54422    213923   6447834 REDEFINE_CR_NoC_RRM-3.cpp
       422344   1091858  49771988 REDEFINE_CR_NoC_RRM-4.cpp
           20        58       621 REDEFINE_CR_NoC_RRM-emulator.cpp
      1820600   6954556 148465004 total
    % size REDEFINE_CR_NoC_RRM{,*.o}
       text    data     bss     dec       hex filename
    110692336  7640     648 110700624 6992850 REDEFINE_CR_NoC_RRM
      8112920  1064      16   8114000  7bcf50 REDEFINE_CR_NoC_RRM-0.o
         4064  1064      16      5144    1418 REDEFINE_CR_NoC_RRM-1.o
     24928023  1064      16  24929103 17c634f REDEFINE_CR_NoC_RRM-2.o
      2909769  1064      16   2910849  2c6a81 REDEFINE_CR_NoC_RRM-3.o
     70386883  1064      16   7038796 43208fb REDEFINE_CR_NoC_RRM-4.o
      4343549  1064      49   4344662  424b56 REDEFINE_CR_NoC_RRM-emulator.o

The initial SIGSEGV is due to the default stack size limitation, and can be avoided with:

    % ulimit -s unlimited

Reply all
Reply to author
Forward
0 new messages