[libclc] r314543 - Restore support for llvm-3.9

Jan Vesely via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 29 12:06:41 PDT 2017


Author: jvesely
Date: Fri Sep 29 12:06:41 2017
New Revision: 314543

URL: http://llvm.org/viewvc/llvm-project?rev=314543&view=rev
Log:
Restore support for llvm-3.9

Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
Acked-by: Aaron Watry <awatry at gmail.com>

Added:
    libclc/trunk/amdgcn/lib/OVERRIDES_3.9
    libclc/trunk/amdgcn/lib/SOURCES_3.9
    libclc/trunk/amdgcn/lib/workitem/get_global_size.39.ll
    libclc/trunk/amdgcn/lib/workitem/get_local_size.39.ll
    libclc/trunk/amdgcn/lib/workitem/get_num_groups.39.ll
    libclc/trunk/amdgpu/lib/SOURCES_3.9
Modified:
    libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES
    libclc/trunk/configure.py
    libclc/trunk/utils/prepare-builtins.cpp

Modified: libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES?rev=314543&r1=314542&r2=314543&view=diff
==============================================================================
--- libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES (original)
+++ libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES Fri Sep 29 12:06:41 2017
@@ -1 +1,4 @@
 workitem/get_num_groups.ll
+workitem/get_global_size.39.ll
+workitem/get_local_size.39.ll
+workitem/get_num_groups.39.ll

Added: libclc/trunk/amdgcn/lib/OVERRIDES_3.9
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/OVERRIDES_3.9?rev=314543&view=auto
==============================================================================
--- libclc/trunk/amdgcn/lib/OVERRIDES_3.9 (added)
+++ libclc/trunk/amdgcn/lib/OVERRIDES_3.9 Fri Sep 29 12:06:41 2017
@@ -0,0 +1,3 @@
+workitem/get_global_size.ll
+workitem/get_local_size.ll
+workitem/get_num_groups.ll

Added: libclc/trunk/amdgcn/lib/SOURCES_3.9
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/SOURCES_3.9?rev=314543&view=auto
==============================================================================
--- libclc/trunk/amdgcn/lib/SOURCES_3.9 (added)
+++ libclc/trunk/amdgcn/lib/SOURCES_3.9 Fri Sep 29 12:06:41 2017
@@ -0,0 +1,3 @@
+workitem/get_global_size.39.ll
+workitem/get_local_size.39.ll
+workitem/get_num_groups.39.ll

Added: libclc/trunk/amdgcn/lib/workitem/get_global_size.39.ll
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/workitem/get_global_size.39.ll?rev=314543&view=auto
==============================================================================
--- libclc/trunk/amdgcn/lib/workitem/get_global_size.39.ll (added)
+++ libclc/trunk/amdgcn/lib/workitem/get_global_size.39.ll Fri Sep 29 12:06:41 2017
@@ -0,0 +1,18 @@
+declare i32 @llvm.r600.read.global.size.x() nounwind readnone
+declare i32 @llvm.r600.read.global.size.y() nounwind readnone
+declare i32 @llvm.r600.read.global.size.z() nounwind readnone
+
+define i32 @get_global_size(i32 %dim) nounwind readnone alwaysinline {
+  switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim]
+x_dim:
+  %x = call i32 @llvm.r600.read.global.size.x()
+  ret i32 %x
+y_dim:
+  %y = call i32 @llvm.r600.read.global.size.y()
+  ret i32 %y
+z_dim:
+  %z = call i32 @llvm.r600.read.global.size.z()
+  ret i32 %z
+default:
+  ret i32 1
+}

Added: libclc/trunk/amdgcn/lib/workitem/get_local_size.39.ll
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/workitem/get_local_size.39.ll?rev=314543&view=auto
==============================================================================
--- libclc/trunk/amdgcn/lib/workitem/get_local_size.39.ll (added)
+++ libclc/trunk/amdgcn/lib/workitem/get_local_size.39.ll Fri Sep 29 12:06:41 2017
@@ -0,0 +1,18 @@
+declare i32 @llvm.r600.read.local.size.x() nounwind readnone
+declare i32 @llvm.r600.read.local.size.y() nounwind readnone
+declare i32 @llvm.r600.read.local.size.z() nounwind readnone
+
+define i32 @get_local_size(i32 %dim) nounwind readnone alwaysinline {
+  switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim]
+x_dim:
+  %x = call i32 @llvm.r600.read.local.size.x()
+  ret i32 %x
+y_dim:
+  %y = call i32 @llvm.r600.read.local.size.y()
+  ret i32 %y
+z_dim:
+  %z = call i32 @llvm.r600.read.local.size.z()
+  ret i32 %z
+default:
+  ret i32 1
+}

Added: libclc/trunk/amdgcn/lib/workitem/get_num_groups.39.ll
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/workitem/get_num_groups.39.ll?rev=314543&view=auto
==============================================================================
--- libclc/trunk/amdgcn/lib/workitem/get_num_groups.39.ll (added)
+++ libclc/trunk/amdgcn/lib/workitem/get_num_groups.39.ll Fri Sep 29 12:06:41 2017
@@ -0,0 +1,18 @@
+declare i32 @llvm.r600.read.ngroups.x() nounwind readnone
+declare i32 @llvm.r600.read.ngroups.y() nounwind readnone
+declare i32 @llvm.r600.read.ngroups.z() nounwind readnone
+
+define i32 @get_num_groups(i32 %dim) nounwind readnone alwaysinline {
+  switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim]
+x_dim:
+  %x = call i32 @llvm.r600.read.ngroups.x()
+  ret i32 %x
+y_dim:
+  %y = call i32 @llvm.r600.read.ngroups.y()
+  ret i32 %y
+z_dim:
+  %z = call i32 @llvm.r600.read.ngroups.z()
+  ret i32 %z
+default:
+  ret i32 1
+}

Added: libclc/trunk/amdgpu/lib/SOURCES_3.9
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgpu/lib/SOURCES_3.9?rev=314543&view=auto
==============================================================================
--- libclc/trunk/amdgpu/lib/SOURCES_3.9 (added)
+++ libclc/trunk/amdgpu/lib/SOURCES_3.9 Fri Sep 29 12:06:41 2017
@@ -0,0 +1,2 @@
+shared/vload_half_helpers.ll
+shared/vstore_half_helpers.ll

Modified: libclc/trunk/configure.py
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/configure.py?rev=314543&r1=314542&r2=314543&view=diff
==============================================================================
--- libclc/trunk/configure.py (original)
+++ libclc/trunk/configure.py Fri Sep 29 12:06:41 2017
@@ -72,8 +72,8 @@ llvm_version = llvm_config(['--version']
 llvm_int_version = int(llvm_version[0]) * 100 + int(llvm_version[1]) * 10
 llvm_string_version = llvm_version[0] + '.' + llvm_version[1]
 
-if llvm_int_version < 400:
-    print("libclc requires LLVM >= 4.0")
+if llvm_int_version < 390:
+    print("libclc requires LLVM >= 3.9")
     sys.exit(1)
 
 llvm_system_libs = llvm_config(['--system-libs'])
@@ -109,9 +109,13 @@ available_targets = {
   'nvptx64--nvidiacl' : { 'devices' : [{'gpu' : '', 'aliases' : []} ]},
 }
 
-available_targets['amdgcn-mesa-mesa3d'] = available_targets['amdgcn--']
 
-default_targets = ['nvptx--nvidiacl', 'nvptx64--nvidiacl', 'r600--', 'amdgcn--', 'amdgcn--amdhsa', 'amdgcn-mesa-mesa3d']
+default_targets = ['nvptx--nvidiacl', 'nvptx64--nvidiacl', 'r600--', 'amdgcn--', 'amdgcn--amdhsa']
+
+#mesa is using amdgcn-mesa-mesa3d since llvm-4.0
+if llvm_int_version > 390:
+    available_targets['amdgcn-mesa-mesa3d'] = available_targets['amdgcn--']
+    default_targets.append('amdgcn-mesa-mesa3d')
 
 targets = args
 if not targets:
@@ -218,6 +222,8 @@ for target in targets:
       override_list_file = os.path.join(libdir, 'OVERRIDES')
       compat_list_file = os.path.join(libdir,
         'SOURCES_' + llvm_string_version)
+      compat_list_override = os.path.join(libdir,
+        'OVERRIDES_' + llvm_string_version)
 
       # Build compat list
       if os.path.exists(compat_list_file):
@@ -225,6 +231,12 @@ for target in targets:
           compat = compat.rstrip()
           compats.append(compat)
 
+      # Add target compat overrides
+      if os.path.exists(compat_list_override):
+        for override in open(compat_list_override).readlines():
+          override = override.rstrip()
+          sources_seen.add(override)
+
       # Add target overrides
       if os.path.exists(override_list_file):
         for override in open(override_list_file).readlines():

Modified: libclc/trunk/utils/prepare-builtins.cpp
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/utils/prepare-builtins.cpp?rev=314543&r1=314542&r2=314543&view=diff
==============================================================================
--- libclc/trunk/utils/prepare-builtins.cpp (original)
+++ libclc/trunk/utils/prepare-builtins.cpp Fri Sep 29 12:06:41 2017
@@ -1,5 +1,10 @@
+#if HAVE_LLVM > 0x0390
 #include "llvm/Bitcode/BitcodeReader.h"
 #include "llvm/Bitcode/BitcodeWriter.h"
+#else
+#include "llvm/Bitcode/ReaderWriter.h"
+#endif
+
 #include "llvm/IR/Function.h"
 #include "llvm/IR/GlobalVariable.h"
 #include "llvm/IR/LLVMContext.h"
@@ -41,8 +46,12 @@ int main(int argc, char **argv) {
     } else {
       std::unique_ptr<MemoryBuffer> &BufferPtr = BufferOrErr.get();
       ErrorOr<std::unique_ptr<Module>> ModuleOrErr =
+#if HAVE_LLVM > 0x0390
           expectedToErrorOrAndEmitErrors(Context,
           parseBitcodeFile(BufferPtr.get()->getMemBufferRef(), Context));
+#else
+          parseBitcodeFile(BufferPtr.get()->getMemBufferRef(), Context);
+#endif
       if (std::error_code ec = ModuleOrErr.getError())
         ErrorMessage = ec.message();
 




More information about the cfe-commits mailing list