CUDA API: The Difference Between Functions and Internal Features

According to CUDA math APi, many mathematical functions, such as sine and cosine, are implemented both in software (functions) and in hardware (built-in functions). These functions probably use special functional units of the GPU, so what is the point of implementing the software? Isn't that so slower than a hardware implementation?

+6
source share
1 answer

The best question to ask is "what is the meaning of the internal?"

The answer lies in Appendix D of the programming guide. Potentials for transcendental, trigonometric and special functions are faster, but have more restrictions for the domain and, as a rule, lower accuracy than their software counterparts. For the main purpose of hardware (i.e. graphs), which have fast approximate functions for sin, cos, square root, reciprocal, etc., Allows you to improve the performance of shaders when extreme mathematical accuracy is not critical. For some computational tasks, less accurate versions are also great. For other applications, entrails may not be sufficient.

The presence of both allows an informed programmer to have a choice: speed or accuracy.

+12
source

Source: https://habr.com/ru/post/970463/


All Articles