[Libclc-dev] [PATCH 00/14] Implement native_* functions using llvm

Jan Vesely via Libclc-dev libclc-dev at lists.llvm.org
Fri Nov 3 16:07:12 PDT 2017


This allows for better performance of programs that use native_ calls.
It also allows llvm to replace known patters with native instruction,
such as: 1/ sqrt -> rsq

Most of these give results within 4096 ULP so they can be used to
implement half_ functions.

Jan

Jan Vesely (14):
  native_log2: Switch to generic native intrinsic inc file
  native_log: Switch to generic native intrinsic inc file
  native_log10: Switch to generic native intrinsic inc file
  amdgpu: Add workaround for unimplemented llvm.exp intrinsic
  native_exp: Switch implementation ot llvm intrinsic
  native_exp2: Switch implementation to llvm intrinsic
  native_cos: Switch implementation to llvm intrinsic
  native_sin: Switch implementation to llvm intrinsic
  native_sqrt: Switch implementation to llvm intrinsic
  native_exp10: Switch implementation to use llvm intrinsic
  math: Use precomputed constant for log2(10.0)
  native_tan: Switch implementaiton to use native_sin/native_cos
  native_rsqrt: Switch implementation to 1 / native_sqrt
  native_recip: provide function implementation instead of macro

 amdgpu/lib/SOURCES                                 |  1 +
 amdgpu/lib/math/native_exp.cl                      |  5 +++++
 amdgpu/lib/math/native_exp.inc                     |  3 +++
 generic/include/clc/float/definitions.h            |  8 +++++++
 generic/include/clc/math/native_cos.h              | 10 ++++++++-
 generic/include/clc/math/native_exp.h              | 10 ++++++++-
 generic/include/clc/math/native_exp10.h            | 10 ++++++++-
 generic/include/clc/math/native_exp2.h             | 10 ++++++++-
 generic/include/clc/math/native_recip.h            | 10 ++++++++-
 generic/include/clc/math/native_rsqrt.h            | 10 ++++++++-
 generic/include/clc/math/native_sin.h              | 10 ++++++++-
 generic/include/clc/math/native_sqrt.h             | 10 ++++++++-
 generic/include/clc/math/native_tan.h              | 17 +++++++--------
 generic/include/utils.h                            |  9 ++++++++
 generic/lib/SOURCES                                |  9 ++++++++
 generic/lib/math/exp10.inc                         |  4 ++--
 generic/lib/math/native_cos.cl                     |  7 ++++++
 generic/lib/math/native_exp.cl                     |  7 ++++++
 generic/lib/math/native_exp10.cl                   |  5 +++++
 generic/lib/math/native_exp10.inc                  |  3 +++
 generic/lib/math/native_exp2.cl                    |  7 ++++++
 generic/lib/math/native_log.cl                     |  7 ++----
 generic/lib/math/native_log10.cl                   |  7 ++----
 generic/lib/math/native_log10.inc                  |  3 ---
 generic/lib/math/native_log2.cl                    |  8 ++-----
 generic/lib/math/native_log2.inc                   | 25 ----------------------
 generic/lib/math/native_recip.cl                   |  5 +++++
 generic/lib/math/native_recip.inc                  |  3 +++
 generic/lib/math/native_rsqrt.cl                   |  5 +++++
 generic/lib/math/native_rsqrt.inc                  |  3 +++
 generic/lib/math/native_sin.cl                     |  7 ++++++
 generic/lib/math/native_sqrt.cl                    |  7 ++++++
 generic/lib/math/native_tan.cl                     |  5 +++++
 generic/lib/math/native_tan.inc                    |  3 +++
 .../{native_log.inc => native_unary_intrinsic.inc} | 21 ++++++++++++++++--
 35 files changed, 209 insertions(+), 65 deletions(-)
 create mode 100644 amdgpu/lib/math/native_exp.cl
 create mode 100644 amdgpu/lib/math/native_exp.inc
 create mode 100644 generic/include/utils.h
 create mode 100644 generic/lib/math/native_cos.cl
 create mode 100644 generic/lib/math/native_exp.cl
 create mode 100644 generic/lib/math/native_exp10.cl
 create mode 100644 generic/lib/math/native_exp10.inc
 create mode 100644 generic/lib/math/native_exp2.cl
 delete mode 100644 generic/lib/math/native_log10.inc
 delete mode 100644 generic/lib/math/native_log2.inc
 create mode 100644 generic/lib/math/native_recip.cl
 create mode 100644 generic/lib/math/native_recip.inc
 create mode 100644 generic/lib/math/native_rsqrt.cl
 create mode 100644 generic/lib/math/native_rsqrt.inc
 create mode 100644 generic/lib/math/native_sin.cl
 create mode 100644 generic/lib/math/native_sqrt.cl
 create mode 100644 generic/lib/math/native_tan.cl
 create mode 100644 generic/lib/math/native_tan.inc
 rename generic/lib/math/{native_log.inc => native_unary_intrinsic.inc} (65%)

-- 
2.13.6



More information about the Libclc-dev mailing list