r/computerscience • • Jan 28 '26

CPUs with addressable cache?

I was wondering if is there any CPUs/OSes where at least some part of the L1/L2 cache is addressable like normal memory, something like:

  • Caches would be accessible with pointers like normal memory
  • Load/Store operations could target either main memory, registers or a cache level (e.g.: load from RAM to L1, store from registers to L2)
  • The OS would manage allocations like with memory
  • The OS would manage coherency (immutable/mutable borrows, collisions, writebacks, synchronization, ...)
  • Pages would be replaced by cache lines/blocks

I tried to search google but probably I'm using the wrong keywords so unrelated results show up.

27 Upvotes

24 comments sorted by

View all comments

Show parent comment

3

u/mzl Jan 28 '26

As u/thesnootbooper9000 mentioned, the Unison project at KTH did a lot of interesting stuff with optimal code generation. When making instruction scheduling and register allocation at the same time, the graph coloring bit is a part of a larger combinatorial problem, and an optimal graph coloring is not necessarily optimal for the combined problem.

In general, for complex optimization problems like this, there are not that many success stories in using GPUs yet. This is mainly because GPUs are better for straight-line homogenous non-branchy data-flow code, while the logic in most optimizations systems is both heterogenous and very branchy.

As a simple analogy, one could sort n numbers by trying all the permutations in parallel on a GPU, but that is much worse than just running a standard sorting algorithm. There are sorting algorithms developed for GPUs (bitonic sort networks for example), but they are rather complex to implement and understand, and as algorithms become more complex translating them to GPU code is more and more complicated.