OpenCL™规范 5.8.6.2. 数学内部函数选项

5.8.6.2. Math Intrinsics Options
5.8.6.2. 数学内部函数选项

These options control compiler behavior regarding floating-point arithmetic. These options trade off between speed and correctness.

这些选项控制编译器在浮点运算方面的行为。这些选项在速度和正确性之间进行了权衡。

-cl-single-precision-constant

This option forces implicit conversions of double-precision floating-point literals to single precision. This option is ignored for programs created with IL.

此选项强制将双精度浮点字面值隐式转换为单精度。对于使用IL创建的程序,此选项将被忽略。

-cl-denorms-are-zero

This option controls how single precision and double precision denormalized numbers are handled. If specified as a build option, the single precision denormalized numbers may be flushed to zero; double precision denormalized numbers may also be flushed to zero if the optional extension for double precision is supported. This is intended to be a performance hint and the OpenCL compiler can choose not to flush denorms to zero if the device supports single precision (or double precision) denormalized numbers.

此选项控制如何处理单精度和双精度非规范化数字。如果指定为构建选项,则单精度非规范化数字可能会被刷新为零;如果支持双精度的可选扩展,则双精度非规范化数也可能被刷新为零。这是一个性能提示,如果设备支持单精度(或双精度)非标准化数字,OpenCL编译器可以选择不将非标准化数刷新为零。

This option is ignored for single precision numbers if the device does not support single precision denormalized numbers i.e. CL_FP_DENORM bit is not set in CL_DEVICE_SINGLE_FP_CONFIG.

​如果设备不支持单精度非标准化数字,即CL_FP_DENORM位未在CL_DEVICE_SINGLE_FP_CONFIG中设置,则对于单精度数字忽略此选项。

This option is ignored for double precision numbers if the device does not support double precision or if it does support double precision but not double precision denormalized numbers i.e. CL_FP_DENORM bit is not set in CL_DEVICE_DOUBLE_FP_CONFIG.

​如果设备不支持双精度,或者如果设备支持双精度但不支持非标准化双精度数字,即CL_FP_DENORM位未在CLD_double_FP_CONFIG中设置,则双精度数字将忽略此选项。

This flag only applies for scalar and vector single precision floating-point variables and computations on these floating-point variables inside a program. It does not apply to reading from or writing to image objects.

此标志仅适用于标量和向量单精度浮点变量以及程序内对这些浮点变量的计算。它不适用于读取或写入图像对象。

-cl-fp32-correctly-rounded-divide-sqrt

The -cl-fp32-correctly-rounded-divide-sqrt build option to clBuildProgram or clCompileProgram allows an application to specify that single precision floating-point divide (x/y and 1/x) and sqrt used in the program source are correctly rounded. If this build option is not specified, the minimum numerical accuracy of single precision floating-point divide and sqrt are as defined in the OpenCL C or OpenCL SPIR-V Environment specifications.

​clBuildProgram或clCompileProgram的-cl-fp32-correcty-rounded-divide-sqrt构建选项允许应用程序指定程序源代码中使用的单精度浮点除法(x/y和1/x)和sqrt是否正确四舍五入。如果未指定此构建选项,则单精度浮点除法和sqrt的最小数值精度如OpenCL C或OpenCL SPIR-V环境规范中所定义。

This build option can only be specified if the CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT is set in CL_DEVICE_SINGLE_FP_CONFIG (as defined in the Device Queries table) for devices that the program is being build. clBuildProgram or clCompileProgram will fail to compile the program for a device if the -cl-fp32-correctly-rounded-divide-sqrt option is specified and CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT is not set for the device.

​仅当在CLD_SINGLE_FP_CONFIG(如设备查询表中所定义)中为正在构建程序的设备设置了CL_FP_CORRECTLY_ROUNDED_IVIDE_SQRT时,才能指定此构建选项。如果指定了-cl-fp32-correct-rounded-divide-sqrt选项,并且未为设备设置CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT,则clBuildProgram或clCompileProgram将无法为设备编译程序。

Note: This option is missing before version 1.2.

​注意:1.2版本之前缺少此选项。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值