Skip to content

Improve documentation for correctly rounded divide and square root #1537

@bashbaug

Description

@bashbaug

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:

  1. 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.
  2. 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?
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions