Could D's Mixins be used to map linear algebra operations to either/both CPU code and OpenCL or GPU vertex shader functions such as GLSL? This would be a real killer application for D and better bridge logic targeted for both CPU and GPU execution. Compare this with glm and D's gl3n which is only compile fixed-size linear algebra to CPU-code.
VexCL is a proof of concept for this using OpenCL and C++11 (GCC 4.6 or later) by completely abstracting away backend-dependent (CPU/GPU) implementation details about memory allocations and code execution somewhat similar to C++ AMP. So things can only get better in D right? Can mixins completely replace the use of C++ expression templates used in VexCL? Here's a nice tutorial on its use.
CTFE may also play a role here in this discussion.
Yes, definitely. In fact it should be quite straightforward. I did a proof-of-concept of this sort of thing back in 2007 (see my presentation at the first D conference). Hardly anything worked in CTFE in those days, but it was still an order of magnitude easier than doing the equivalent thing in C++.
The desire to do this sort of thing was part of the motivation for development of template value parameters, CTFE, and SIMD operations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With