On the GPU it has its own cache, I think on mobile, too. On the CPU it uses posix_memalign which relies on libc to do caching (I think they do in contemporary systems), so I would not worry about it.
You can also reserve the memory once and use matmul_out if you love manual, but very likely it will not be the largest lever you have in optimization of any given model.
There is ongoing work on a static runtime 2, which also involves static memory planning.
Best regards
Thomas