[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] how do I disable this buffer warning?

From: Matt Ettus
Subject: Re: [Discuss-gnuradio] how do I disable this buffer warning?
Date: Mon, 04 Jun 2007 09:58:26 -0700
User-agent: Thunderbird (X11/20070530)

I also get a lot of messages like this, and I suspect it is the curse
for doing vector processing on vectors of length other than powers of
two. Am I correct?

Exactly. What is happening is that there is a very efficient way of implementing circular buffers using a virtual memory trick. By having 2 consecutive virtual page mappings to the same physical page, you don't have to check for the wrap at the end of the buffer back to the beginning. it allows us to implement very efficient fifos between blocks. The problem is that the VM trick I described above requires 2 things: The FIFO is an integral number of pages
   The FIFO is an integral number of "items"

On X86 and x86-64, pages are 4096 bytes. Therefore, the FIFO size must be equal to the least common multiple (LCM) of 4096 and your item size. Thus, there is no problem when your items are things like bytes or complex numbers (8 bytes) -- the FIFO becomes 1 page of 4096 bytes. However, if you have an item size of 9 bytes for example, you need a bigger fifo. LCM(4096,9) equals 9*4096 since they are relatively prime. The cost is having a larger fifo taking up more memory, or more importantly, more CACHE space.

It would be much worse if you chose an item size of say 4095. The LCM in that case is 4095*4096, or just under 16 megabytes.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]