[llvm-dev] [test-suite] making polybench/symm succeed with "-Ofast" and "-ffp-contract=on"

Sebastian Pop via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 11 04:46:33 PDT 2016


On Tue, Oct 11, 2016 at 6:33 AM, Renato Golin <renato.golin at linaro.org> wrote:
> On 11 October 2016 at 12:15, Sebastian Pop <sebpop.llvm at gmail.com> wrote:
>>>  1. Only test the non-FP-contracted output
>>
>> Yes, this is what I'm doing.
>
> If the whole test is about testing multiplications, what's the point of this?
>
>
>>>  2. Run the FP-contracted test only for a very small size (so that we'll stay within some reasonable tolerance of the reference output)
>>>  3. Change the matrix to something that will make the test numerically stable (it does not look like the matrix itself matters to the performance; where do the values come from?).
>
> 3 is more sound, 2 may be more practical.

2 sounds like you are asking to only run checkFP on the first elements
of the array.
In that case what would be the last element to check?

>
>
>> -      C_StrictFP[i][j] = C[i][j] = ((DATA_TYPE) i*j) / ni;
>> -      B[i][j] = ((DATA_TYPE) i*j) / ni;
>> +      C_StrictFP[i][j] = C[i][j] = ((DATA_TYPE) i-j) / ni;
>> +      B[i][j] = ((DATA_TYPE) i-j) / ni;
>>      }
>>    for (i = 0; i < nj; i++)
>>      for (j = 0; j < nj; j++)
>> -      A[i][j] = ((DATA_TYPE) i*j) / ni;
>> +      A[i][j] = ((DATA_TYPE) i-j) / ni;
>
> Changing from multiplication to subtraction changes completely the
> nature of the test and goes towards "return 0;", ie, fiddling with the
> code so that the compiler "behaves" better. This is *not* a solution.

Another observation: when changing * with + the test only passes at
-Ofast with FP_ABSTOLERANCE=1e-4.

Sebastian


More information about the llvm-dev mailing list