diff options
author | Benoit Steiner <bsteiner@google.com> | 2016-11-09 14:57:34 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2016-11-09 15:06:00 -0800 |
commit | 715585c50625d8d6177ad5eeeec244bc76070b09 (patch) | |
tree | eb6f9fd222affc57413ab76b648992ada6760a78 /third_party/sycl/sycl | |
parent | e105989bef735af5dcca15f09ccae9224ff3bcc6 (diff) |
Added a new rule to handle the OpenCL backend: we comment it out in
google3, and enable it in github. This is because we haven't imported the backed in google3 just yet.
Change: 138689620
Diffstat (limited to 'third_party/sycl/sycl')
-rw-r--r-- | third_party/sycl/sycl/BUILD | 0 | ||||
-rwxr-xr-x | third_party/sycl/sycl/BUILD.tpl | 43 | ||||
-rwxr-xr-x | third_party/sycl/sycl/build_defs.bzl.tpl | 13 | ||||
-rwxr-xr-x | third_party/sycl/sycl/platform.bzl.tpl | 5 |
4 files changed, 61 insertions, 0 deletions
diff --git a/third_party/sycl/sycl/BUILD b/third_party/sycl/sycl/BUILD new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/third_party/sycl/sycl/BUILD diff --git a/third_party/sycl/sycl/BUILD.tpl b/third_party/sycl/sycl/BUILD.tpl new file mode 100755 index 0000000000..9e83b1994c --- /dev/null +++ b/third_party/sycl/sycl/BUILD.tpl @@ -0,0 +1,43 @@ +licenses(["notice"]) # Apache 2.0 + +load("@local_config_sycl//sycl:build_defs.bzl", "if_sycl") +load("platform", "sycl_library_path") + +load("platform", "readlink_command") + +package(default_visibility = ["//visibility:public"]) + +config_setting( + name = "using_sycl", + values = { + "define": "using_sycl=true", + }, +) + +cc_library( + name = "sycl_headers", + hdrs = glob([ + "**/*.h", + ]), + includes = [".", "include"], +) + +cc_library( + name = "syclrt", + srcs = [ + sycl_library_path("ComputeCpp") + ], + data = [ + sycl_library_path("ComputeCpp") + ], + includes = ["include/"], + linkstatic = 1, +) + +cc_library( + name = "sycl", + deps = if_sycl([ + ":sycl_headers", + ":syclrt", + ]), +) diff --git a/third_party/sycl/sycl/build_defs.bzl.tpl b/third_party/sycl/sycl/build_defs.bzl.tpl new file mode 100755 index 0000000000..09bef0a661 --- /dev/null +++ b/third_party/sycl/sycl/build_defs.bzl.tpl @@ -0,0 +1,13 @@ +# Macros for building SYCL code. + +def if_sycl(if_true, if_false = []): + """Shorthand for select()'ing on whether we're building with SYCL. + + Returns a select statement which evaluates to if_true if we're building + with SYCL enabled. Otherwise, the select statement evaluates to if_false. + + """ + return select({ + "@local_config_sycl//sycl:using_sycl": if_true, + "//conditions:default": if_false + }) diff --git a/third_party/sycl/sycl/platform.bzl.tpl b/third_party/sycl/sycl/platform.bzl.tpl new file mode 100755 index 0000000000..cb4b3356b2 --- /dev/null +++ b/third_party/sycl/sycl/platform.bzl.tpl @@ -0,0 +1,5 @@ +def sycl_library_path(name): + return "lib/lib{}.so".format(name) + +def readlink_command(): + return "readlink" |