OpenCL 有一个名为 native_recip
的内置函数:
gentype native_recip(gentype x);
native_recip
computes reciprocal over an implementation-defined range. The maximum error is implementation-defined.The vector versions of the math functions operate component-wise. The description is per-component.
The built-in math functions are not affected by the prevailing rounding mode in the calling environment, and always return the same value as they would if called with the round to nearest even rounding mode.
CUDA 中有与此功能等效的函数吗?
最佳答案
正如评论中所述,它是 __frcp_rn()
对于 float
和 __drcp_rn()
对于双
的;以及向量类型的实现(例如 float4
),以便按元素应用 frcp/drcp。
注意:“rcp”是“reciprocal”的缩写,“rn”是舍入模式 "round to nearest even" .
关于cuda - OpenCL 中是否有与 native_recip() 等效的 CUDA?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63101094/