r335765 - [HIP] Support flush denormals bitcode

Aaron Enye Shi via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 27 11:58:55 PDT 2018


Author: aaronenyeshi
Date: Wed Jun 27 11:58:55 2018
New Revision: 335765

URL: http://llvm.org/viewvc/llvm-project?rev=335765&view=rev
Log:
[HIP] Support flush denormals bitcode

Summary:
Use oclc_daz_opt_on.amdgcn.bc bitcode when option fcuda-flush-denormal-to-zero is enabled, otherwise use oclc_daz_opt_off.amdgcn.bc bitcode. Added lit tests to verify that the correct bitcode is linked when -fcuda-flush-denormal-to-zero option is enabled or disabled.

Reviewers: yaxunl, scchan, b-sumner

Reviewed By: yaxunl, scchan, b-sumner

Subscribers: cfe-commits, yaxunl

Differential Revision: https://reviews.llvm.org/D48493

Added:
    cfe/trunk/test/Driver/Inputs/hip_dev_lib/
    cfe/trunk/test/Driver/Inputs/hip_dev_lib/irif.amdgcn.bc
    cfe/trunk/test/Driver/Inputs/hip_dev_lib/ockl.amdgcn.bc
    cfe/trunk/test/Driver/Inputs/hip_dev_lib/oclc_correctly_rounded_sqrt_on.amdgcn.bc
    cfe/trunk/test/Driver/Inputs/hip_dev_lib/oclc_daz_opt_off.amdgcn.bc
    cfe/trunk/test/Driver/Inputs/hip_dev_lib/oclc_daz_opt_on.amdgcn.bc
    cfe/trunk/test/Driver/Inputs/hip_dev_lib/oclc_finite_only_off.amdgcn.bc
    cfe/trunk/test/Driver/Inputs/hip_dev_lib/oclc_isa_version_803.amdgcn.bc
    cfe/trunk/test/Driver/Inputs/hip_dev_lib/oclc_isa_version_900.amdgcn.bc
    cfe/trunk/test/Driver/Inputs/hip_dev_lib/oclc_unsafe_math_off.amdgcn.bc
    cfe/trunk/test/Driver/Inputs/hip_dev_lib/ocml.amdgcn.bc
    cfe/trunk/test/Driver/Inputs/hip_dev_lib/opencl.amdgcn.bc
    cfe/trunk/test/Driver/hip-device-libs.hip
Modified:
    cfe/trunk/lib/Driver/ToolChains/HIP.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/HIP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/HIP.cpp?rev=335765&r1=335764&r2=335765&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/HIP.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/HIP.cpp Wed Jun 27 11:58:55 2018
@@ -75,10 +75,16 @@ const char *AMDGCN::Linker::constructLLV
     std::string ISAVerBC =
         "oclc_isa_version_" + SubArchName.drop_front(3).str() + ".amdgcn.bc";
 
+    llvm::StringRef FlushDenormalControlBC;
+    if (Args.hasArg(options::OPT_fcuda_flush_denormals_to_zero))
+      FlushDenormalControlBC = "oclc_daz_opt_on.amdgcn.bc";
+    else
+      FlushDenormalControlBC = "oclc_daz_opt_off.amdgcn.bc";
+
     BCLibs.append({"opencl.amdgcn.bc",
                    "ockl.amdgcn.bc", "irif.amdgcn.bc", "ocml.amdgcn.bc",
                    "oclc_finite_only_off.amdgcn.bc",
-                   "oclc_daz_opt_off.amdgcn.bc",
+                   FlushDenormalControlBC,
                    "oclc_correctly_rounded_sqrt_on.amdgcn.bc",
                    "oclc_unsafe_math_off.amdgcn.bc", ISAVerBC});
   }

Added: cfe/trunk/test/Driver/Inputs/hip_dev_lib/irif.amdgcn.bc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/hip_dev_lib/irif.amdgcn.bc?rev=335765&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/Inputs/hip_dev_lib/ockl.amdgcn.bc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/hip_dev_lib/ockl.amdgcn.bc?rev=335765&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/Inputs/hip_dev_lib/oclc_correctly_rounded_sqrt_on.amdgcn.bc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/hip_dev_lib/oclc_correctly_rounded_sqrt_on.amdgcn.bc?rev=335765&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/Inputs/hip_dev_lib/oclc_daz_opt_off.amdgcn.bc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/hip_dev_lib/oclc_daz_opt_off.amdgcn.bc?rev=335765&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/Inputs/hip_dev_lib/oclc_daz_opt_on.amdgcn.bc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/hip_dev_lib/oclc_daz_opt_on.amdgcn.bc?rev=335765&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/Inputs/hip_dev_lib/oclc_finite_only_off.amdgcn.bc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/hip_dev_lib/oclc_finite_only_off.amdgcn.bc?rev=335765&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/Inputs/hip_dev_lib/oclc_isa_version_803.amdgcn.bc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/hip_dev_lib/oclc_isa_version_803.amdgcn.bc?rev=335765&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/Inputs/hip_dev_lib/oclc_isa_version_900.amdgcn.bc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/hip_dev_lib/oclc_isa_version_900.amdgcn.bc?rev=335765&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/Inputs/hip_dev_lib/oclc_unsafe_math_off.amdgcn.bc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/hip_dev_lib/oclc_unsafe_math_off.amdgcn.bc?rev=335765&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/Inputs/hip_dev_lib/ocml.amdgcn.bc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/hip_dev_lib/ocml.amdgcn.bc?rev=335765&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/Inputs/hip_dev_lib/opencl.amdgcn.bc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/hip_dev_lib/opencl.amdgcn.bc?rev=335765&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/hip-device-libs.hip
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/hip-device-libs.hip?rev=335765&view=auto
==============================================================================
--- cfe/trunk/test/Driver/hip-device-libs.hip (added)
+++ cfe/trunk/test/Driver/hip-device-libs.hip Wed Jun 27 11:58:55 2018
@@ -0,0 +1,27 @@
+// REQUIRES: clang-driver
+// REQUIRES: x86-registered-target
+// REQUIRES: amdgpu-registered-target
+
+// Test flush-denormals-to-zero enabled uses oclc_daz_opt_on
+
+// RUN: %clang -### -target x86_64-linux-gnu \
+// RUN:   -x hip --cuda-gpu-arch=gfx900 \
+// RUN:   --hip-device-lib-path=%S/Inputs/hip_dev_lib \
+// RUN:   -fcuda-flush-denormals-to-zero \
+// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
+// RUN: 2>&1 | FileCheck %s --check-prefixes=COM,FLUSHD
+
+// Test flush-denormals-to-zero disabled uses oclc_daz_opt_off
+
+// RUN: %clang -### -target x86_64-linux-gnu \
+// RUN:   -x hip --cuda-gpu-arch=gfx900 \
+// RUN:   --hip-device-lib-path=%S/Inputs/hip_dev_lib \
+// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
+// RUN: 2>&1 | FileCheck %s --check-prefixes=COM,NOFLUSHD
+
+
+// COM: [[LLVM_LINK:"*.llvm-link"]]
+// FLUSHD-SAME: {{.*}} "{{.*}}oclc_daz_opt_on.amdgcn.bc"
+// NOFLUSHD-SAME: {{.*}} "{{.*}}oclc_daz_opt_off.amdgcn.bc"
+// COM-SAME: {{.*}} "-o" "{{.*}}-gfx900-linked-{{.*bc}}"
+




More information about the cfe-commits mailing list