I want instruction sets to offer peak-efficiency block moves and fills, with cache control that works alongside them. My argument is that CPU-accessible hardware could use the machine’s actual memory configuration, improve existing code, and enable software to adapt around stronger capabilities. This is a design proposal, not a report of an implementation or benchmark. It connects to broader questions about memory and data movement and game engine technology.
I have always been disappointed that more instruction sets don’t have peak-efficiency block move and fill operations.
I consider REP MOVS/STOS in x86/x64 still pretty great, although not optimal in all cases.
I think there is a bias against block-move operations because they are not RISCy.
I think even a tiny SoC today would barely notice the addition of a little move engine grafted onto the CPU.
I note that many systems already have DMA engines, but they aren’t accessible to user-mode programs or properly integrated into the cache hierarchy.
I describe a traditional CPU-architecture approach as doing the easy things in hardware and letting software work out the messy edge cases; I think actual hardware gates in parallel can handle picky edge cases better than software, as compression acceleration shows.
I recall that game machines often had easily programmable DMA and blitters that could completely saturate memory bandwidth.
I note that GPUs have dedicated memory-move engines, but at a high level users sometimes wind up using shaders to block copy memory, which I consider terrible.
I think an instruction could automatically tailor itself to the exact memory configuration it is running on, unlike specialized hand-coded routines that cannot do so in a forward-compatible way.
I note that there are dozens of different cache and memory-controller configurations in the wild right now.
The last statistics I saw had memset/memcpy operations only consuming a few percent of most program mixes, but that may have changed and probably doesn’t include all the inlined small operations.
I note that most truly high-performance programming arranges to completely avoid copies and fills altogether.
I think much of Moore’s Law’s million-fold progress is a compounding of small improvements.
I think any improvement on existing code is the minimum speedup, which may be exceeded as programming styles adapt to the new capabilities.
I advocate integrating better cache control, which can wind up being much more significant than the data-movement operation alone.
I miss DCBZ and friends on non-PPC architectures.
I would consider allowing the operation to be fully asynchronous, with different priorities relative to conventional instructions.
I note that hardware like asynchronous data movement already exists, but it isn’t user-mode accessible on most systems.
I think the feature has to actually be great, not just exist.
I remember early rumors in the 80s that the Apple IIGS’s 65816 CPU would have a 2 cycle/byte block-move instruction.
The Apple IIGS’s MVN / MVP wound up being 7 cycles/byte, which I found disappointing.
I made this argument on 2024-11-01 17:31 UTC.
Related: memory and data movement, gpu architecture and scaling, responsive software and playback