[linux-audio-dev] matrix model vs. memory

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: [linux-audio-dev] matrix model vs. memory
From: Paul Davis (pbd_AT_Op.Net)
Date: Fri May 18 2001 - 18:02:28 EEST


in a matrix model for inputs and outputs, each connection associated
with a gain coefficients.

in this model, whenever a plugin writes to an output, its not actually
writing to the memory location that someone else will use for
input. that location is filled "later" by multiplying the contents of
the output buffer by the gain coefficient(s) and storing the result in
the input buffer.

as far as i can see, this means that you cannot optimize memory usage
by sharing buffers between two connected ports. on the other hand, it
also resolves whether to use "run" or "run_adding" semantics: every
buffer is unique, so just use "run".

what worries me about the memory use is that the numbers could climb
fairly quickly. consider the 64-frame period case again. with IEEE 32
bit floats, thats 64 * 4 = 256 bytes per buffer. Create 3 plugins:

    #1: 52 input ports, 26 output ports
    #2: 32 input ports, 32 output ports
    #3: 4 input ports, 8 output ports
    
thats 154 ports, or 38.5kB of buffer space. this doesn't feel like it
scales very well for the MP case, where we know memory footprint makes
even more of a difference than the SP case.

its interesting to think about the graph of frames-per-period and the
cost of the context switch - as fpp goes up, so does the memory usage,
and thus more cache/TLB effects. but as fpp goes up, the cost matters
less since there is more time per period. i wonder which is the
steeper of the two curves?

still, its a much more flexible model, since it allows independent
gain coefficients for each port-to-port connection, so it seems worth
pursuing for the time being. my model for now:

  Engine::process (nframes) {
     foreach plugin {
         plugin->copy_data_from_input_ports_to_output_port_buffers (nframes); */
         process (nframes); /* in-place processing on output port buffers */
         /* data is now in output port buffers */
      }
  }

comments?


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Fri May 18 2001 - 20:39:10 EEST