<div dir="ltr"><div><div><div>The python changes in this file look good to me. I haven't done a line-by-line review of the SI changes.<br><br></div>I tested this patch and v2 of the related mesa series on r600g (radeon 6850) with a recent LLVM and fresh mesa master as of this evening. No real change in the piglit CL test success/failure rate.<br>
<br></div>Do you have any interest in trying to merge your changes to date back into the upstream libclc codebase? If you think it's a good idea, but don't have time to do it yourself, let me know and I'll try to re-base the series of patches.<br>
<br></div>--Aaron<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 12, 2013 at 3:20 PM, Tom Stellard <span dir="ltr"><<a href="mailto:tom@stellard.net" target="_blank">tom@stellard.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Tom Stellard <<a href="mailto:thomas.stellard@amd.com">thomas.stellard@amd.com</a>><br>
<br>
---<br>
configure.py | 119 ++++++++++++++++++++++++++++++++++++---------------------<br>
1 files changed, 75 insertions(+), 44 deletions(-)<br>
<br>
diff --git a/configure.py b/configure.py<br>
index d861c24..dfd9a8f 100755<br>
--- a/configure.py<br>
+++ b/configure.py<br>
@@ -68,6 +68,15 @@ llvm_clang = os.path.join(llvm_bindir, 'clang')<br>
llvm_link = os.path.join(llvm_bindir, 'llvm-link')<br>
llvm_opt = os.path.join(llvm_bindir, 'opt')<br>
<br>
+available_targets = {<br>
+ 'r600--' : { 'devices' :<br>
+ [{'gpu' : 'cedar', 'aliases' : ['palm', 'sumo', 'sumo2', 'redwood', 'juniper']},<br>
+ {'gpu' : 'cypress', 'aliases' : ['hemlock']},<br>
+ {'gpu' : 'barts', 'aliases' : ['turks', 'caicos']},<br>
+ {'gpu' : 'cayman', 'aliases' : ['aruba']},<br>
+ {'gpu' : 'tahiti', 'aliases' : ['pitcairn', 'verde', 'oland']}]}<br>
+}<br>
+<br>
default_targets = ['r600--']<br>
<br>
targets = args<br>
@@ -127,50 +136,72 @@ for target in targets:<br>
<br>
clang_cl_includes = ' '.join(["-I%s" % incdir for incdir in incdirs])<br>
<br>
- # The rule for building a .bc file for the specified architecture using clang.<br>
- clang_bc_flags = "-target %s -I`dirname $in` %s " \<br>
- "-Dcl_clang_storage_class_specifiers " \<br>
- "-Dcl_khr_fp64 " \<br>
- "-emit-llvm" % (target, clang_cl_includes)<br>
- clang_bc_rule = "CLANG_CL_BC_" + target<br>
- c_compiler_rule(b, clang_bc_rule, "LLVM-CC", llvm_clang, clang_bc_flags)<br>
-<br>
- objects = []<br>
- sources_seen = set()<br>
-<br>
- for libdir in libdirs:<br>
- subdir_list_file = os.path.join(libdir, 'SOURCES')<br>
- manifest_deps.add(subdir_list_file)<br>
- override_list_file = os.path.join(libdir, 'OVERRIDES')<br>
-<br>
- # Add target overrides<br>
- if os.path.exists(override_list_file):<br>
- for override in open(override_list_file).readlines():<br>
- override = override.rstrip()<br>
- sources_seen.add(override)<br>
-<br>
- for src in open(subdir_list_file).readlines():<br>
- src = src.rstrip()<br>
- if src not in sources_seen:<br>
- sources_seen.add(src)<br>
- obj = os.path.join(target, 'lib', src + '.bc')<br>
- objects.append(obj)<br>
- src_file = os.path.join(libdir, src)<br>
- ext = os.path.splitext(src)[1]<br>
- if ext == '.ll':<br>
- b.build(obj, 'LLVM_AS', src_file)<br>
- else:<br>
- b.build(obj, clang_bc_rule, src_file)<br>
-<br>
- builtins_link_bc = os.path.join(target, 'lib', 'builtins.link.bc')<br>
- builtins_opt_bc = os.path.join(target, 'lib', 'builtins.opt.bc')<br>
- builtins_bc = os.path.join('built_libs', target + '.bc')<br>
- b.build(builtins_link_bc, "LLVM_LINK", objects)<br>
- b.build(builtins_opt_bc, "OPT", builtins_link_bc)<br>
- b.build(builtins_bc, "PREPARE_BUILTINS", builtins_opt_bc, prepare_builtins)<br>
- install_files_bc.append((builtins_bc, builtins_bc))<br>
- install_deps.append(builtins_bc)<br>
- b.default(builtins_bc)<br>
+ for device in available_targets[target]['devices']:<br>
+ # The rule for building a .bc file for the specified architecture using clang.<br>
+ clang_bc_flags = "-target %s -I`dirname $in` %s " \<br>
+ "-Dcl_clang_storage_class_specifiers " \<br>
+ "-Dcl_khr_fp64 " \<br>
+ "-emit-llvm" % (target, clang_cl_includes)<br>
+ if device['gpu'] != '':<br>
+ clang_bc_flags += ' -mcpu=' + device['gpu']<br>
+ clang_bc_rule = "CLANG_CL_BC_" + target<br>
+ c_compiler_rule(b, clang_bc_rule, "LLVM-CC", llvm_clang, clang_bc_flags)<br>
+<br>
+ objects = []<br>
+ sources_seen = set()<br>
+<br>
+ if device['gpu'] == '':<br>
+ full_target_name = target<br>
+ obj_suffix = ''<br>
+ else:<br>
+ full_target_name = device['gpu'] + '-' + target<br>
+ obj_suffix = '.' + device['gpu']<br>
+<br>
+ for libdir in libdirs:<br>
+ subdir_list_file = os.path.join(libdir, 'SOURCES')<br>
+ manifest_deps.add(subdir_list_file)<br>
+ override_list_file = os.path.join(libdir, 'OVERRIDES')<br>
+<br>
+ # Add target overrides<br>
+ if os.path.exists(override_list_file):<br>
+ for override in open(override_list_file).readlines():<br>
+ override = override.rstrip()<br>
+ sources_seen.add(override)<br>
+<br>
+ for src in open(subdir_list_file).readlines():<br>
+ src = src.rstrip()<br>
+ # Only add the base filename (e.g. Add get_global_id instead of<br>
+ # <a href="http://get_global_id.cl" target="_blank">get_global_id.cl</a>) to sources_seen.<br>
+ # This allows targets to overide generic .cl sources with .ll sources.<br>
+ src_base = os.path.splitext(src)[0]<br>
+ if src_base not in sources_seen:<br>
+ sources_seen.add(src_base)<br>
+ obj = os.path.join(target, 'lib', src + obj_suffix + '.bc')<br>
+ objects.append(obj)<br>
+ src_file = os.path.join(libdir, src)<br>
+ ext = os.path.splitext(src)[1]<br>
+ if ext == '.ll':<br>
+ b.build(obj, 'LLVM_AS', src_file)<br>
+ else:<br>
+ b.build(obj, clang_bc_rule, src_file)<br>
+<br>
+ builtins_link_bc = os.path.join(target, 'lib', 'builtins.link' + obj_suffix + '.bc')<br>
+ builtins_opt_bc = os.path.join(target, 'lib', 'builtins.opt' + obj_suffix + '.bc')<br>
+ builtins_bc = os.path.join('built_libs', full_target_name + '.bc')<br>
+ b.build(builtins_link_bc, "LLVM_LINK", objects)<br>
+ b.build(builtins_opt_bc, "OPT", builtins_link_bc)<br>
+ b.build(builtins_bc, "PREPARE_BUILTINS", builtins_opt_bc, prepare_builtins)<br>
+ install_files_bc.append((builtins_bc, builtins_bc))<br>
+ install_deps.append(builtins_bc)<br>
+ for alias in device['aliases']:<br>
+ b.rule("CREATE_ALIAS", "ln -fs %s $out" % os.path.basename(builtins_bc)<br>
+ ,"CREATE-ALIAS $out")<br>
+<br>
+ alias_file = os.path.join('built_libs', alias + '-' + target + '.bc')<br>
+ b.build(alias_file, "CREATE_ALIAS", builtins_bc)<br>
+ install_files_bc.append((alias_file, alias_file))<br>
+ install_deps.append(alias_file)<br>
+ b.default(builtins_bc)<br>
<br>
<br>
install_cmd = ' && '.join(['mkdir -p $(DESTDIR)/%(dst)s && cp -r %(src)s $(DESTDIR)/%(dst)s' %<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.3.4<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>