orcc / xronos

Xronos: High Level Synthesis of Streaming Applications
5 stars 3 forks source link

GC overhead limit exceeded, probably due to this output pattern. #3

Open robstewart57 opened 9 years ago

robstewart57 commented 9 years ago

Hi Endri,

Given this actor:

actor fold() int img1 ==> int my_histogram :
  int hist[255][255][255];
  int height = 512;
  int width = 256;
  int i := 0;
   fold: action img1:[r,g,b] ==>
         guard i < (height * width)
         do
           hist[r][g][b] := hist[r][g][b] + 1;
           i := i+1 ;
         end

   send: action ==> my_histogram:[[hist[r][g][b] : for int r in 0 .. 254, for int g in 0 .. 254, for int b in 0 .. 254 ]] repeat (255 * 255 * 255)
         do
           i := 0;
         end

   schedule fsm fold:
     fold (fold) --> fold;
     fold (send) --> send;
     send (fold) --> fold;
   end

   priority fold > send;
   end
end

I'm getting the following error when attempting to compile with Xronos:

3:12:42 PM SEVERE:   - failed to compile: GC overhead limit exceeded
[java.lang.Integer.valueOf(Integer.java:642), org.xronos.orcc.design.visitors.StateVarVisitor.makeLogicalValueObject(StateVarVisitor.java:212), org.xronos.orcc.design.visitors.StateVarVisitor.makeLogicalValueObject(StateVarVisitor.java:185), org.xronos.orcc.design.visitors.StateVarVisitor.makeLogicalValueObject(StateVarVisitor.java:185), org.xronos.orcc.design.visitors.StateVarVisitor.makeLogicalValue(StateVarVisitor.java:123), org.xronos.orcc.design.visitors.StateVarVisitor.caseVar(StateVarVisitor.java:77), net.sf.orcc.ir.util.IrSwitch.doSwitch(IrSwitch.java:1088), org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:53), net.sf.orcc.ir.util.AbstractIrVisitor.doSwitch(AbstractIrVisitor.java:214), org.xronos.orcc.design.visitors.DesignActor.caseActor(DesignActor.java:185), net.sf.orcc.df.util.DfSwitch.doSwitch(DfSwitch.java:142), org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:53), net.sf.orcc.df.util.DfVisitor.doSwitch(DfVisitor.java:234), org.xronos.orcc.design.ActorToDesign.buildDesign(ActorToDesign.java:75), org.xronos.orcc.design.DesignEngine.buildLim(DesignEngine.java:123), org.xronos.openforge.app.Engine.begin(Engine.java:119), org.xronos.orcc.backend.XronosPrinter.printInstance(XronosPrinter.java:195), org.xronos.orcc.backend.Xronos.generateInstances(Xronos.java:347), org.xronos.orcc.backend.Xronos.doGenerateNetwork(Xronos.java:154), net.sf.orcc.backends.AbstractBackend.compile(AbstractBackend.java:335), net.sf.orcc.ui.launching.OrccRunLaunchDelegate$1.run(OrccRunLaunchDelegate.java:92), org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)]
3:12:42 PM SEVERE: -------------------------------------------------------------------------------
3:12:43 PM SEVERE: NOTE: 1 actor failed to compile
3:12:43 PM SEVERE: -------------------------------------------------------------------------------

I suspect it is to do with the output pattern for the send action, i.e.

my_histogram:[[hist[r][g][b] : for int r in 0 .. 254, for int g in 0 .. 254, for int b in 0 .. 254 ]] repeat (255 * 255 * 255)
endrix commented 9 years ago

Hi Rob, Actually there is a memory limitations in Forge that prevents to operate on huge arrays. It is a know bug, that I have not yet figure it out.

But by the way your array need 255 * 255 * 255 * 32 bits --> 64 MB it will "probably" not fit on the FPGA :)

Does it work with smaller array size like 16 * 16 * 16

robstewart57 commented 9 years ago

Hi Endri,

Thanks. The dimensionality of the hist array is constrained by the nature of 3-element vector RGB values, each with a range from 0 to 255, i.e. within 16 bit range. If I rewrite for constructing a histogram over grey images, i.e. a 1 element vector for each pixel, then Xronos can compile the following code:

actor fold_grey() uint(size=16) img1 ==> uint(size=16) my_histogram :
  uint(size=16) hist[255];
  uint(size=16) height = 512;
  uint(size=16) width = 256;
  int i := 0;
   fold: action img1:[grey] ==>
         guard i < (height * width)
         do
           hist[grey] := hist[grey] + 1;
           i := i+1 ;
         end

   send: action ==> my_histogram:[[hist[grey] : for uint(size=16) grey in 0 .. 254 ]] repeat (255)
         do
           i := 0;
         end

   schedule fsm fold:
     fold (fold) --> fold;
     fold (send) --> send;
     send (fold) --> fold;
   end

   priority fold > send;
   end
end