cymem icon indicating copy to clipboard operation
cymem copied to clipboard

Aligned allocation

Open sampotter opened this issue 5 years ago • 3 comments

This seems like a very nice and useful little library. Definitely fills a need.

Would you be willing to include support for aligned allocation? This is handled a little differently on each platform, and providing a nice, platform independent interface to it that "just works" would be quite useful.

For instance, if you see lines 12-43 in this file, you can see my own attempt at this. Frankly, I have no confidence that I've done this the right way. :-)

(I'm considering using cymem in the library linked to above. Intel's Embree library requires memory to be allocated with alignment.)

sampotter avatar Nov 24 '20 21:11 sampotter

Yes I'd be interested in that. We have support for changing the allocation function, so in theory aligned allocation shouldn't be so hard.

The problem I have with aligned allocation is I never feel like I've done it properly =/. So I've never really seen a big performance increase.

honnibal avatar Nov 25 '20 00:11 honnibal

I don't have enough experience with it to know when exactly to expect a performance boost. You need to use it in order to take full advantage of SIMD vectorization. I understand your uncertainty... In my case, it's simply a requirement for using Embree---memory that the user allocates must be allocated with a specific alignment.

What can I do to help?

sampotter avatar Nov 25 '20 20:11 sampotter

Sorry for the very late reply here, but if you want to start work on a PR for this I think we'd be happy to look at it.

polm avatar Sep 19 '21 05:09 polm