4 ms·
It wouldn't be hard, except for Apple being in bed with Intel. As they exist today, GCD/libdispatch blocks are very similar to OpenCL native kernels, but with
by wtallis 15y ago
It wouldn't be hard, except for Apple being in bed with Intel.
As they exist today, GCD/libdispatch blocks are very similar to OpenCL native kernels, but with more automatic scheduling and implicit data transfers (which are almost no-ops when the kernel is running on the host device).
On an AMD Fusion system with a shared memory controller, you don't have the huge latency of transferring your kernel arguments to the GPU (and with libdispatch blocks, you are generally transferring less data), so a block could be executed on the GPU with hardly any more overhead than on a different CPU core.
The only problem would be that you would need universal binaries of your blocks to also target the GPU (or LLVM IR to be finalized at runtime). As Apple has complete control over their very modern and flexible LLVM-based toolchain, implementing this would be very straightforward, even without the fruits of an AMD/ARM collaboration. (Though it sounds like ARM may help AMD be able to provide an array of scalar processors that would have good performance characteristics for typical dispatch_async uses.)