Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CUDA math API: difference between functions and intrinsics

Tags:

cuda

According to the CUDA math APi, many mathematical functions, like sine and cosine, are implemented both in software (functions) and in hardware (intrinsics). These intrinsics probably use the Special Function Units of the GPU, so what is the point of the software implementation? Isn't that slower than the hardware implementation?

like image 872
PieterV Avatar asked Jun 06 '14 15:06

PieterV


1 Answers

The better question to ask is "what is the point of the intrinsics?".

The answer lies in Appendix D of the programming guide. The intrinsics for the transcendental, trigonometric, and special functions are faster, but have more domain restrictions and generally lower accuracy than their software counterparts. For the primary purpose of the hardware (ie graphics), having fast approximate functions for sin, cos, square root, reciprocal, etc. allows for improved shader performance when ultimate mathematical accuracy is not critical. For some compute tasks, the less accurate versions are also fine. For other applications, the intrinsics may not be sufficient.

Having both allows the informed programmer to have a choice: speed or accuracy.

like image 142
talonmies Avatar answered Oct 14 '22 18:10

talonmies