[libclc] 25/92: Restore support for llvm-3.9
Andreas Boll
aboll-guest at moszumanska.debian.org
Mon Nov 6 15:11:57 UTC 2017
This is an automated email from the git hooks/post-receive script.
aboll-guest pushed a commit to branch master
in repository libclc.
commit 419632b3a20ad3a1ded47a95eadd3ff05b62c4d8
Author: Jan Vesely <jan.vesely at rutgers.edu>
Date: Fri Sep 29 19:06:41 2017 +0000
Restore support for llvm-3.9
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
Acked-by: Aaron Watry <awatry at gmail.com>
git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@314543 91177308-0d34-0410-b5e6-96231b3b80d8
---
amdgcn-amdhsa/lib/OVERRIDES | 3 +++
amdgcn/lib/OVERRIDES_3.9 | 3 +++
amdgcn/lib/SOURCES_3.9 | 3 +++
amdgcn/lib/workitem/get_global_size.39.ll | 18 ++++++++++++++++++
amdgcn/lib/workitem/get_local_size.39.ll | 18 ++++++++++++++++++
amdgcn/lib/workitem/get_num_groups.39.ll | 18 ++++++++++++++++++
amdgpu/lib/SOURCES_3.9 | 2 ++
configure.py | 20 ++++++++++++++++----
utils/prepare-builtins.cpp | 9 +++++++++
9 files changed, 90 insertions(+), 4 deletions(-)
diff --git a/amdgcn-amdhsa/lib/OVERRIDES b/amdgcn-amdhsa/lib/OVERRIDES
index c9bd69b..e4dfca1 100644
--- a/amdgcn-amdhsa/lib/OVERRIDES
+++ b/amdgcn-amdhsa/lib/OVERRIDES
@@ -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
diff --git a/amdgcn/lib/OVERRIDES_3.9 b/amdgcn/lib/OVERRIDES_3.9
new file mode 100644
index 0000000..f26fbbe
--- /dev/null
+++ b/amdgcn/lib/OVERRIDES_3.9
@@ -0,0 +1,3 @@
+workitem/get_global_size.ll
+workitem/get_local_size.ll
+workitem/get_num_groups.ll
diff --git a/amdgcn/lib/SOURCES_3.9 b/amdgcn/lib/SOURCES_3.9
new file mode 100644
index 0000000..6ee7cb8
--- /dev/null
+++ b/amdgcn/lib/SOURCES_3.9
@@ -0,0 +1,3 @@
+workitem/get_global_size.39.ll
+workitem/get_local_size.39.ll
+workitem/get_num_groups.39.ll
diff --git a/amdgcn/lib/workitem/get_global_size.39.ll b/amdgcn/lib/workitem/get_global_size.39.ll
new file mode 100644
index 0000000..d51def3
--- /dev/null
+++ b/amdgcn/lib/workitem/get_global_size.39.ll
@@ -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
+}
diff --git a/amdgcn/lib/workitem/get_local_size.39.ll b/amdgcn/lib/workitem/get_local_size.39.ll
new file mode 100644
index 0000000..92c6d26
--- /dev/null
+++ b/amdgcn/lib/workitem/get_local_size.39.ll
@@ -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
+}
diff --git a/amdgcn/lib/workitem/get_num_groups.39.ll b/amdgcn/lib/workitem/get_num_groups.39.ll
new file mode 100644
index 0000000..fd5c17c
--- /dev/null
+++ b/amdgcn/lib/workitem/get_num_groups.39.ll
@@ -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
+}
diff --git a/amdgpu/lib/SOURCES_3.9 b/amdgpu/lib/SOURCES_3.9
new file mode 100644
index 0000000..69c5e5c
--- /dev/null
+++ b/amdgpu/lib/SOURCES_3.9
@@ -0,0 +1,2 @@
+shared/vload_half_helpers.ll
+shared/vstore_half_helpers.ll
diff --git a/configure.py b/configure.py
index 4e7a32c..00d1ecb 100755
--- a/configure.py
+++ b/configure.py
@@ -72,8 +72,8 @@ llvm_version = llvm_config(['--version']).replace('svn', '').split('.')
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():
diff --git a/utils/prepare-builtins.cpp b/utils/prepare-builtins.cpp
index 5cd32cd..0f03e05 100644
--- a/utils/prepare-builtins.cpp
+++ b/utils/prepare-builtins.cpp
@@ -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();
--
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