4 ms·
> Which brings us back to regular discussion: C ( and C++ ) does not match hardware anymore. There is no real control over important properties of generated cod
by dist1ll 3y ago
> Which brings us back to regular discussion: C ( and C++ ) does not match hardware anymore. There is no real control over important properties of generated code. Programmers need tools to control what they write. Plug and pray compilation is not a solid engineering approach.
Not sure how one relates to the other. Do you want more fine-grained control over emitted assembly? Or do you want a general-purpose CPU that exposes microarchitecture details (i.e. "matching hardware")?
Only the former can be solved by tooling.
- waynecochran 3y agoC++ could add a an explicit conditional move I suppose. `x` and `y` types would have to be restrictive: x = std::cmove(y,flag); The compiler would be slightly mrve compelled to use a hardware conditional move than in the following case: if (flag) x = y; The other option is to do something more like CUDA / SIMD kernels do ... every line gets executed but each each instruction inside the "false branch" becomes a no-op. Of course this requires hardware support.
- touisteur 3y agoPushing this a bit more, one could read about SPMD and ISPC (originally by Matt Pharr) https://pharr.org/matt/blog/2018/04/30/ispc-all https://pharr.org/matt/blog/2018/04/30/ispc-all I've used it (sparringly) for vectorizable, branchy code and it's mostly been a simple process, with very efficient binaries produced (often beating hand written intrinsics by intermediate level coder - themselves beating the autovectorizer). Don't know about using it in prod on multi generational hardware though.