[libclc] 15/58: configure: Introduce per device defines

Andreas Boll aboll-guest at moszumanska.debian.org
Thu Oct 6 08:16:29 UTC 2016


This is an automated email from the git hooks/post-receive script.

aboll-guest pushed a commit to branch master
in repository libclc.

commit b72f405642cc87c7d8df8f305c8069a70fc04a0c
Author: Jan Vesely <jan.vesely at rutgers.edu>
Date:   Tue Feb 9 22:17:45 2016 +0000

    configure: Introduce per device defines
    
    Make cl_khr_fp64 define per-device.
    This patch does not change the generated Makefile (for llvm 3.6, 3.7)
    
    v2: Make the device defines per LLVM version, 'all' for all versions
    
    reviewer: tstellard
    Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
    
    git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@260302 91177308-0d34-0410-b5e6-96231b3b80d8
---
 configure.py | 35 ++++++++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 11 deletions(-)

diff --git a/configure.py b/configure.py
index 70a8ac8..b47951e 100755
--- a/configure.py
+++ b/configure.py
@@ -91,16 +91,25 @@ if not cxx_compiler:
 
 available_targets = {
   'r600--' : { 'devices' :
-               [{'gpu' : 'cedar',   'aliases' : ['palm', 'sumo', 'sumo2', 'redwood', 'juniper']},
-                {'gpu' : 'cypress', 'aliases' : ['hemlock']},
-                {'gpu' : 'barts',   'aliases' : ['turks', 'caicos']},
-                {'gpu' : 'cayman',  'aliases' : ['aruba']}]},
+               [{'gpu' : 'cedar',   'aliases' : ['palm', 'sumo', 'sumo2', 'redwood', 'juniper'],
+                 'defines' : {'LLVM3.6':['cl_khr_fp64'], 'LLVM3.7':['cl_khr_fp64']}},
+                {'gpu' : 'cypress', 'aliases' : ['hemlock'],
+                 'defines' : {'LLVM3.6':['cl_khr_fp64'], 'LLVM3.7':['cl_khr_fp64']}},
+                {'gpu' : 'barts',   'aliases' : ['turks', 'caicos'],
+                 'defines' : {'LLVM3.6':['cl_khr_fp64'], 'LLVM3.7':['cl_khr_fp64']}},
+                {'gpu' : 'cayman',  'aliases' : ['aruba'],
+                 'defines' : {'LLVM3.6':['cl_khr_fp64'], 'LLVM3.7':['cl_khr_fp64']}} ]},
   'amdgcn--': { 'devices' :
-                [{'gpu' : 'tahiti',  'aliases' : ['pitcairn', 'verde', 'oland', 'hainan', 'bonaire', 'kabini', 'kaveri', 'hawaii', 'mullins', 'tonga','carrizo','iceland','fiji','stoney']}]},
-  'nvptx--'   : { 'devices' : [{'gpu' : '', 'aliases' : []}]},
-  'nvptx64--'   : { 'devices' : [{'gpu' : '', 'aliases' : []}] },
-  'nvptx--nvidiacl'   : { 'devices' : [{'gpu' : '', 'aliases' : []}] },
-  'nvptx64--nvidiacl' : { 'devices' : [{'gpu' : '', 'aliases' : []}] }
+                [{'gpu' : 'tahiti', 'aliases' : ['pitcairn', 'verde', 'oland', 'hainan', 'bonaire', 'kabini', 'kaveri', 'hawaii','mullins','tonga','carrizo','iceland','fiji','stoney'],
+                 'defines' : {'LLVM3.6':['cl_khr_fp64'], 'LLVM3.7':['cl_khr_fp64']}} ]},
+  'nvptx--'   : { 'devices' : [{'gpu' : '', 'aliases' : [],
+                                'defines' : {'all' : ['cl_khr_fp64']}}]},
+  'nvptx64--' : { 'devices' : [{'gpu' : '', 'aliases' : [],
+                                'defines' : {'all' : ['cl_khr_fp64']}}]},
+  'nvptx--nvidiacl'   : { 'devices' : [{'gpu' : '', 'aliases' : [],
+                                        'defines' : {'all' : ['cl_khr_fp64']}}]},
+  'nvptx64--nvidiacl' : { 'devices' : [{'gpu' : '', 'aliases' : [],
+                                        'defines' : {'all' : ['cl_khr_fp64']}}]},
 }
 
 default_targets = ['nvptx--nvidiacl', 'nvptx64--nvidiacl', 'r600--', 'amdgcn--']
@@ -178,13 +187,17 @@ for target in targets:
 
   for device in available_targets[target]['devices']:
     # The rule for building a .bc file for the specified architecture using clang.
+    device_def_list = (device['defines']['all'] if 'all' in device['defines'] else []);
+    if llvm_string_version in device['defines']:
+        device_def_list += (device['defines'][llvm_string_version]);
+    device_defines = ' '.join(["-D%s" % define for define in device_def_list])
     clang_bc_flags = "-target %s -I`dirname $in` %s " \
                      "-fno-builtin " \
                      "-Dcl_clang_storage_class_specifiers " \
-                     "-Dcl_khr_fp64 " \
+                     "%s " \
                      "-Dcles_khr_int64 " \
                      "-D__CLC_INTERNAL " \
-                     "-emit-llvm" % (target, clang_cl_includes)
+                     "-emit-llvm" % (target, clang_cl_includes, device_defines)
     if device['gpu'] != '':
       clang_bc_flags += ' -mcpu=' + device['gpu']
     clang_bc_rule = "CLANG_CL_BC_" + target + "_" + device['gpu']

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/libclc.git



More information about the Pkg-opencl-commits mailing list