-
Hi, However I read on the Internet:
So I would like to know if there is something to take care when using StoreAlignedNonTemporal. Do I have to call an additional instruction at the end of my loops? SFENCE? Where is this instruction in c#? My use cases are for image processing function. For example, to convert a 26 megapixels image from RGBA32 (byte) to RGBA128(float), it take 30 ms with StoreAligned, and only 13 ms using StoreAlignedNonTemporal... so that is really interesting, but I am not sure about side effects... For example can I chain several functions that use NonTemporal store/load ? Thanks for helping! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
It depends on when you need the data again. There's some good write-up in (so I don't have to write similar my own):
Personally I'd use the regular (temporal) stores, except benchmarking shows that non-temporal stores are beneficial. But then one needs good real-world testcase and acceptable load to cover all potential troubles (that will most likely result from the different visibility). |
Beta Was this translation helpful? Give feedback.
Imagine empty caches and you load the data as usual (i.e. temporal load). Then it goes
RAM -> L3 -> L2 -> L1 -> cpu
.The you perform a non-temporal store (
cpu -> RAM
), and after that the same cpu needs the data again, so it will try to read from L1, and if it's there uses it w/o noticing that the data changed in the meantime.So for "correct?" it's not in every case, especially if the same cpu reads the data again.
Non-temporal stores can be used when data is read once, then written back to memory bypassing the caches in a wo…