bluespec.com Forum Index bluespec.com
Bluespec Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

bsc: out of memory (requested 1048576 bytes)

 
Post new topic   Reply to topic    bluespec.com Forum Index -> Tools: BSC (Bluespec Compiler)
View previous topic :: View next topic  
Author Message
akshayj



Joined: 19 Feb 2015
Posts: 10

PostPosted: Tue Aug 04, 2015 1:29 am    Post subject: bsc: out of memory (requested 1048576 bytes) Reply with quote

I have to create (n-1) number of stages of FIFOs, where each stage in itself has (w-n) FIFOS. The type of FIFOS I am using is mkDFIFO.

Value of n can be 3,5,7,11. And w represents the width of the image.

Now the problem is if value of w (eg. 30) is less the code compiles and simulates fine, but as soon as I increase the the size of w (eg. 320) following error occurs:-
Code:

bsc: out of memory (requested 1048576  bytes).


Code:
Vector#(TSub#(7,1), Vector#(TSub#(320,7),FIFOF#(Pixelsize))) fifos <- replicateM(replicateM(mkDFIFOF(0)));


Please find the code and the makefile as an attachment.



Makefile.txt
 Description:
Makefile

Download
 Filename:  Makefile.txt
 Filesize:  624 Bytes
 Downloaded:  305 Time(s)


Serp_mem_left_modified.bsv
 Description:
Code

Download
 Filename:  Serp_mem_left_modified.bsv
 Filesize:  4.53 KB
 Downloaded:  347 Time(s)

Back to top
View user's profile Send private message
quark
Site Admin


Joined: 02 Nov 2007
Posts: 495

PostPosted: Tue Aug 04, 2015 2:46 pm    Post subject: Re: bsc: out of memory (requested 1048576 bytes) Reply with quote

What version of BSC are you using? When you get the error, do you know what stage BSC is in? (You can see that by giving the -v flag, which will cause BSC to print messages as it progresses from stage to stage.)

There may be a scaling issue in BSC, which we will investigate. But looking at your design, I can recommend that you not write it that way.

You should not have a separate rule for every assignment. All actions that should happen in lock step should be put in the same rule. When actions are in separate rules, you're saying that they are independent actions, and that one is allowed to happen without the other.

Code like this:
Code:
for (int i=1; i<16-1; i=i+1)
begin
    rule regs_buffer (received_pixel);
        regs_buff[i] <= regs_buff[i-1];
    endrule
end
rule step1;
    regs_buff[0] <= inputpixel;
endrule

at the very least should be written like this:
Code:
rule regs_buffer (received_pixel);
    regs_buff[0] <= inputpixel;
    for (int i=1; i<16-1; i=i+1) begin
        regs_buff[i] <= regs_buff[i-1];
    end
endrule

However, this rule should probably also be merged with other rules (such as the rules that write "reg").

Also, don't generate rules with static conditions. For example, here:
Code:
for (int i=7-2; i >= 0; i=i-1)
    for (int j=320-7-1; j>0; j=j-1)
        rule fifosValueShiftlefttmostfifodeq ((j==320-7-1) && received_pixel);

This will create a rule during every iteration of the loop, and later in the compilation BSC will discover that the condition for most of the rules is False, and will ignore them. But you can avoid creating the rules in the first place:
Code:
for (int i=7-2; i >= 0; i=i-1)
    for (int j=320-7-1; j>0; j=j-1)
        if (j==320-7-1)
            rule fifosValueShiftlefttmostfifodeq (received_pixel);

Or, avoid the if-statement by starting the for-loop later:
Code:
for (int i=7-2; i >= 0; i=i-1)
    // for j==320-7-1
    rule fifosValueShiftlefttmostfifodeq (received_pixel);
        ...
    endrule
    // for all other j
    for (int j=320-7-1-1; j>0; j=j-1)
        ....

But, again, I would ask whether you need separate rules for all of these, or if you can have one rule, that contains the actions:
Code:
rule r(received_pixel);
    for (int i=7-2; i >= 0; i=i-1) begin
        // for j==320-7-1
        ... actions for j==320-7-1...
        // for all other j
        for (int j=320-7-1-1; j>0; j=j-1) begin
            ... actions for all other j ...
        end
    end
endrule

You might need separate rules because you're using FIFOs, which have implicit conditions (whether they are full or empty). If one FIFO is full and can't enqueue, separate rules would help allow other actions to proceed and not be held up because one enqueue can't happen. But it looks like your actions are happening in lock step, so that should never happen. Is there a reason you need FIFOs, then?
Back to top
View user's profile Send private message
akshayj



Joined: 19 Feb 2015
Posts: 10

PostPosted: Sat Aug 08, 2015 3:13 am    Post subject: Reply with quote

Hi Quark,

Thanks a lot for your valuable suggestions.
I am using Bluespec-2014.07.A. The error is coming during the "writeABin" stage

Code:

.......
starting dropundet
dropundet done
 elapsed time: CPU 0.14s, real 0.14s

starting writeABin
bsc: out of memory (requested 1048576 bytes)
make: *** [all] Error 1


As per your suggestions I made the changes and yes, I realized every thing is happening in lock step, and I can use registers instead of FIFOs. By doing so I obtained the desired output.

Thanks again
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    bluespec.com Forum Index -> Tools: BSC (Bluespec Compiler) All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
bluespec.com topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP