Skip to content

[CUDA] sycl::sqrt leads to IEEE754 incompatible results on NVidia cards #4041

@anton-v-gorshkov

Description

@anton-v-gorshkov

Bug Description

Using of sycl::sqrt() function leads to results that are incompatible to IEEE754 on NVidia cards (sqrt.approx.f PTX instruction is generated) even for precise ffp-model. sqrtf() works fine in contrast (sqrt.rn.f PTX instruction is generated).

To Reproduce

  1. Go to "sqrt" folder from archive in attachment;
  2. Build test application with ./build.sh
  3. Run ./sqrt
  4. Expected output:
Target device: GeForce RTX 2070
Difference: 1.788139e-07

Correct output should give zero difference, can be checked with sqrtf.

Environment:

Additional Context

Such an issue significantly degrades user experience while CUDA to DPC++ code migration. sycl::sqrt() is a function that normally used by default to compute square roots (e.g. it's generated by DPC++ Compatibility Tool), and observed accuracy issues that this function produces may be really tricky to debug.

sqrt.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcudaCUDA back-endruntimeRuntime library related issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions