C++ Logo

std-discussion

Advanced search

a standard way to tell the compiler to choose an implementation version following policies ?

From: c.ohanessian <c.ohanessian_at_[hidden]>
Date: Fri, 12 Jun 2020 23:01:46 +0200 (CEST)
<div style="font-family:Arial, Helvetica, sans-serif; font-size:12px;">‌<span style="color:rgb(68, 68, 68)">‌Hi,</span><br style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; margin: auto; padding: 0px; color: rgb(68, 68, 68);">
<br style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; margin: auto; padding: 0px; color: rgb(68, 68, 68);">
<span style="color:rgb(68, 68, 68)">My name is Cesar OHANESSIAN, a C++ enthusiast. I am currently working on the implementation of a multidimensional array, the purpose being to extend std::array while being adaptable to most of the usual conventions (row/col vector, row/col major). I would like to allow people to mix the conventions, not only for compatibility reasons but also for local optimization purposes, for example:</span><br style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; margin: auto; padding: 0px; color: rgb(68, 68, 68);">
<br style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; margin: auto; padding: 0px; color: rgb(68, 68, 68);">
<span style="color:rgb(68, 68, 68)">&nbsp;-&nbsp;the matrix-vector product in col vector/row major gives 3 independent std::inner_product with contiguous iterators</span><br style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; margin: auto; padding: 0px; color: rgb(68, 68, 68);">
<span style="color:rgb(68, 68, 68)">&nbsp;- the recopy of a specific basis vector is a simple memcpy in col vector/col major (or in row vector/row major).</span><br style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; margin: auto; padding: 0px; color: rgb(68, 68, 68);">
<br style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; margin: auto; padding: 0px; color: rgb(68, 68, 68);">
<span style="color:rgb(68, 68, 68)">With that in mind, iterating over two arrays with different conventions is intrinsically sub optimal in memory and is a deciding factor to keep or reject a local optimization regarding its compatibility impact (when doing std::copy, std::equal).</span><br style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; margin: auto; padding: 0px; color: rgb(68, 68, 68);">
<br style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; margin: auto; padding: 0px; color: rgb(68, 68, 68);">
<span style="color:rgb(68, 68, 68)">I would like to tell the compiler to choose between different iterator implementations (all the stride order permutations)&nbsp;which are all equivalent in their defined behavior, following some policies (memory space/execution speed). It's a low level decision, depending on various fixed costs including the iterator implementation itself (dealing with for loops and counters). It would be pleasant to have a standard way for taking benefit of the compiler decisions, allowing more flexibility at compile time =&gt; each template instantiation has a unique solution so we shouldn't have to perform infinite experimental plans ! Does such a feature exist ?</span><br style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; margin: auto; padding: 0px; color: rgb(68, 68, 68);">
<br style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; margin: auto; padding: 0px; color: rgb(68, 68, 68);">
<span style="color:rgb(68, 68, 68)">Thank you in advance, you people are doing a formidable work and I owe you so much !</span><br style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; margin: auto; padding: 0px; color: rgb(68, 68, 68);">
<br style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; margin: auto; padding: 0px; color: rgb(68, 68, 68);">
<span style="color:rgb(68, 68, 68)">Best Regards,</span><br style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; margin: auto; padding: 0px; color: rgb(68, 68, 68);">
<br style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; margin: auto; padding: 0px; color: rgb(68, 68, 68);">
<br style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; margin: auto; padding: 0px; color: rgb(68, 68, 68);">
<span style="color:rgb(68, 68, 68)">Cesar OHANESSIAN</span></div>

Received on 2020-06-12 16:05:06