Comment by grandinj
8 years ago
That doesn't give you run-time dispatch based on available hardware capabilities. So you either need virtual functions (and take the associated perf hit), or some other solution like the linker tricks mentions, or cached JIT, or....
It’s not runtime, it’s compile-time. That means it needs to be separately compiled for each hardware backend.
How do you combine the separately compiled libraries into a single deliverable library/executable?
Because that is what the original article is aiming for.
It doesn’t do the runtime dispatch this person wants, but it eliminates the worry of running into an illegal instruction error.
I think there are use cases for a fat binary, but I’m less certain as to its necessity.
it can, you generate all desired version of simd-ified function at compile time, then write a function to select the right one at runtime.
that is what the Rust libs are doing, just using traits or macros instead of templates.