PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

LUT question

I was just pondering a question regarding the approach the arm processor/memory controll takes torwards uncached data. I know in most cases with LUTs we try to get them smaller then the actual cache size, but I guess the question is "Is it really worth filling the cache with these values?"

When dealing with trig functions and division, how much locality is there?

Now I pose the question, what happens if we leave them in an uncached memory region? (using VirtualAlloc) If an uncached single 32bit word data access occurs, will the processor still fetch the whole cache line or will it only fetch the 4 bytes we require? (Thus quartering the time to load this value)

Don't have much time to test this myself, but if that was the case I'll probably end up rewriting a lot of my code.

Just A Thought
-Exocet
If an uncached single 32bit word data access occurs, will the processor still fetch the whole cache line or will it only fetch the 4 bytes we require? (Thus quartering the time to load this value)

It'll only fetch the 4 bytes you asked for. However, "quartering" is dubious, as usually with RAM the highest penalty is for the accessing the first word, then the next few are a bit cheaper.

The gain is also compounded by the fact that when the ARMs are running in "enhanced mode" (I think it's called), the CPU will return the first word as soon as it's been loaded and continue filling the cache line in the background, only stalling other loads. (Though worst case cache-line fill is to have to evict a full dirty line back into memory before the re-fill).

Don't have much time to test this myself, but if that was the case I'll probably end up rewriting a lot of my code.

Why would you have to rewrite it? Just mark the LUT as uncached and use it as normal.

Basically, just test it and find out. :P

Oh, and actually LUTs still make a lot of sense, even uncached, for things like divisions where the range is known well enough to use a LUT.