FILT memory

  • MachineMan
    30th May Member 0 Permalink

    There are three methods of FILT storage; "Easy storage", "Reference storage", and "FILT sharing storage".  I found a way to use Reference storage and FILT sharing storage in combination:

    https://powdertoy.co.uk/Discussions/Thread/View.html?Thread=27075

    But I learned that you can store a lot of memory using all three methods in combination.  There is a save by mad-cow that does this, but it's in subframe.  Can anyone show me what using the three FILT storage methods together looks like in non-subframe?  And also highlight where each on the storage methods are being used.

    Edited 2 times by MachineMan. Last: 30th May
  • Jerehmia
    30th May Member 0 Permalink

    Easy storage means you just store a single value as is in the ctype of a FILT.

     

    Reference storage is useful if you have a small set of large values you have to store multiple times. instead of storing the large values every time you create a lookup table that holds a single copy of each possible large value and instead of storing the large values directly you store (much smaller) indexes/references into the lookup table.

     

    Let's assume we have to store the values 40000, 50000 and 60000 a 1000 times each. Each value takes 16 bits to represent so it would cost 3 x 16 x 1000 = 48000 bits to store them directly. Storing them all once in a lookup table takes 3 x 16 = 48 bits. Because there are only 3 values an index takes just 2 bits to reperesent, so storing the indexes just costs 3 x 1000 x 2 = 6000 bits. By storing by reference we've used 6000 + 48 bits instead of 48000 bits to store the same amount of information.

     

    Shared storage means you store more than a single value in a single FILT. You create shared values by bitshifting individual values so their bits don´t overlap and use a bitwise or to combine them. You extract them by bitshifing individual values back and masking out other values with a bitwise and (or a FILT sub).

     

    If you need a demo let me know, shared storage is fairly easy to implement and an example is probably easier to understand than paragraphs of text.

    Edited once by Jerehmia. Last: 30th May
  • MachineMan
    1st June Member 0 Permalink

    I've made a setup that attempts to use all three metods in combination.  It's designed to store the numbers 40, 50, and 60; 3 times each.  I've decoed FILT pixels where each storage method is being used; Easy storage is marked in red, Reference storage and index assignment in green, and FILT sharing storage in blue; yellow highlights FILT that's not being used any of the aformentioned functions.  If this isn't the correct way to use the three methods in together, please give me a demo save (not in subframe) and highlight where each storage method is being used.

    Edited 5 times by MachineMan. Last: 1st June
  • Jerehmia
    2nd June Member 0 Permalink

    I made a save that demonstrates shared memory and referenced memory.

     

     

    Okay, so a got carried away a bit and made the hypothetical drawing program :)

     

    Edited once by Jerehmia. Last: 2nd June
  • MachineMan
    5th June Member 0 Permalink

    Here's my second attempt at combining the three FILT storage techniques; this time 40, 50, and 60 are each stored once and the Easy storage, Reference storage, and FILT sharing storage are NOT highlighted in dcolour.  Am I using Reference storage right now?

    Edited once by MachineMan. Last: 5th June
  • Jerehmia
    5th June Member 0 Permalink

    This save explains in detail how to implement shared storage, I'll make another one for reference sorage later.

     

  • MachineMan
    5th June Member 0 Permalink

    Thank you for the explanation save (which I now have favourited), but I already understand how FILT sharing storage works; it's the Reference storage I have trouble with.  I thought Reference storage was using smaller numbers to represent bigger numbers; like using a single bit to represent a number that's made of mutiple bits.  Here's an example of how I thought one should combine the three FILT storage techniques:

     

    Easy storage:

    Storing four 8-bit numbers; one FILT for each of them.

     

    Reference storage:

    Using a single bit as index to represent an 8-bit number; since we have four 8-bit number, using bits 1, 2, 4, and 8 should suffice.

     

    FILT sharing storage:

    Storing all the single-bit index values used to represent the large numbers (see above) onto a single FILT; since storing four 8-bit takes 32 bits, it's impossible to directly store them onto a single FILT which can only store 30 bits--29 bits if you use the 30th bit to represent 0.  With single-bit index values used to represent the 8-bit numbers you can store the four 8-bit numbers on the FILT as a one 4-bit number; with bitshifting you can even store the the four 8-bit numbers, now represented as a 4-bit number, up to 7 times over.  You can single out the value you need with AND FILT(s).

     

    When I saw that, in the shared storage, you were storing the big numbers and the index values on the same FILT, it confused me; perhaps Reference storage is more complicated than I thought.  I hope once you have the Reference storage explanation save ready, it'll clear things up for me.

    Edited 5 times by MachineMan. Last: 5th June
  • Jerehmia
    5th June Member 0 Permalink

    Here is the reference storage save.

     

  • MachineMan
    7th June Member 0 Permalink

    Read and favourited; thanks.  I now understand Reference storage.  Now all that's left is too figure out how to use all three FILT storage techniques together.  I read in the tpt wiki that you can do this by using Easy storage to store big complicated numbers, Reference storage to assign smaller numbers (index numbers) to those big numbers, and FILT sharing storage to store those numbers on a single FILT; it doesn't specify wheather the numbers you store on the shared storage FILT are the big numbers themselves or the index numbers to which you assign the big numbers.  FILT sharing storage can quadruple you're storage space, but with only 30 bits per FILT, you can't store a lot of big numbers on one FILT, so I assume that when using all three techniques, you store all the index numbers on a shared FILT and use AND FILT(s) to single out the index number to be used in the lookup table's splitter.  But it feels as though I'm missing something.  Perhaps the Reference library (the line of FILT read by the lookup table) can be a collection of shared FILTs and you can use AND FILT(s) to single out the desired value from a shared FILT once it's read by the lookup table--this would also have the bonus of reducing the necessary size of the Reference library.  But I don't know how I would be able to change the ctype of the AND FILT(s) as needed.

     

    P.S.

    I made a save of a setup that uses Reference storage to store the 26 ascii values of the uppercase letters of the alphabet.  It reads the letter E by default, but you can change it.

     

    P.P.S.

    I also made a save of a setup that uses FILT sharing storage to store the number 127 four times on one line of FILT.

    Edited 11 times by MachineMan. Last: 8th June
  • Jerehmia
    8th June Member 0 Permalink

    I think the Pixel Painter save I made above demonstrates all three types of storage, it uses easy storage to hold the 16  predefined color values, it uses reference storage for the color indexes, and it uses shared storage to combine an X coordinate, a Y coordinate and a color index into a single stored value.

     

    Note that there are other ways to create lookup tables, here is an example of a more advance method that uses life deserialization to control the range of an LDTC that reads the predefined values.