We should improve our documentation for the "correctly rounded divide and square root" built option - -cl-fp32-correctly-rounded-divide-sqrt.
Spec reference: https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#math-intrinsics-options
Some things we should do specifically:
- Confirm: This build option only applies to single precision divides and square roots, and not to half precision (fp16) divides and square roots?
- Note that double precision (fp64) divides and square roots are correctly rounded by default.
- Check: What is the expected behavior if the
-cl-fp32-correctly-rounded-divide-sqrt build option is passed to clBuildProgram and the device does not support correctly rounded divides and square roots (CL_DEVICE_SINGLE_FP_CONFIG does not include CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT)?
- Should this generate CL_INVALID_BUILD_OPTIONS?
- What if some devices support correctly rounded divides and square roots, but some devices do not?
- Update the math function accuracy tables in the OpenCL C spec and the OpenCL SPIR-V environment spec to clearly document when divides and square roots must be correctly rounded.
- Low priority: Do we need to define the behavior when both the
-cl-fp32-correctly-rounded-divide-sqrt and -cl-unsafe-math-optimizations build options are present?
See also #1499.
We should improve our documentation for the "correctly rounded divide and square root" built option -
-cl-fp32-correctly-rounded-divide-sqrt.Spec reference: https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#math-intrinsics-options
Some things we should do specifically:
-cl-fp32-correctly-rounded-divide-sqrtbuild option is passed toclBuildProgramand the device does not support correctly rounded divides and square roots (CL_DEVICE_SINGLE_FP_CONFIG does not include CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT)?-cl-fp32-correctly-rounded-divide-sqrtand-cl-unsafe-math-optimizationsbuild options are present?See also #1499.