3 ms·
It's cooler than that, IMO. It uses the SIGSEGV to jump back to the start, once per global iteration. Bit most of the normal 'jumps' are encoded by doing both
by monocasa 9y ago
It's cooler than that, IMO. It uses the SIGSEGV to jump back to the start, once per global iteration. Bit most of the normal 'jumps' are encoded by doing both sides of the work, but using a scratch base address for the storage of the 'not taken' side that ends up not contributing to the actual result.
- euyyn 9y agoSo it prevents speculative execution of branches, by speculatively executing them itself? lol
- banachtarski 9y agoIt went full circle! The irony is that CPUs already do a ton of speculative branching
- dfox 9y agoStructuring code like this actually has it's purpose. Instruction stream executed by massively parallel SIMD systems (prototypically for 80's supercomputers like Connection Machine, but also for GPUs few generations back) actually works in exactly same way.