refine llvm dep

This commit is contained in:
colin 2020-10-13 20:04:09 +08:00
parent a0f2513706
commit e3ad2a5982
2 changed files with 34 additions and 224 deletions

130
WORKSPACE
View File

@ -4,121 +4,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository")
load("//third_party:repo.bzl", "tf_http_archive")
# def clean_dep(dep):
# return str(Label(dep))
LLVM_COMMIT = "85763e0758fbd238c81f233c6f9510e81c7de177" # llvm 12
LLVM_BAZEL_TAG = "llvm-project-%s" % (LLVM_COMMIT,)
LLVM_BAZEL_SHA256 = "5d358075abc2db8192c138bdaa6ce74f2c59a0bde6d7d57813f3fc66d6b6da34"
http_archive(
name = "llvm-bazel",
sha256 = LLVM_BAZEL_SHA256,
strip_prefix = "llvm-bazel-{tag}/llvm-bazel".format(tag = LLVM_BAZEL_TAG),
url = "https://github.com/google/llvm-bazel/archive/{tag}.tar.gz".format(tag = LLVM_BAZEL_TAG),
)
LLVM_SHA256 = "f33108ba4bc81c6704753838ee4d85ad87e195fda3df991c2b00f18872a9e2dd"
LLVM_SHA256 = ""
LLVM_URLS = [
# "https://storage.googleapis.com/mirror.tensorflow.org/github.com/llvm/llvm-project/archive/{commit}.tar.gz".format(commit = LLVM_COMMIT),
"https://github.com/llvm/llvm-project/archive/{commit}.tar.gz".format(commit = LLVM_COMMIT),
]
http_archive(
name = "llvm-project-raw",
build_file_content = "#empty",
sha256 = LLVM_SHA256,
strip_prefix = "llvm-project-" + LLVM_COMMIT,
urls = LLVM_URLS,
)
load("@llvm-bazel//:configure.bzl", "llvm_configure")
llvm_configure(
name = "llvm-project",
src_path = ".",
src_workspace = "@llvm-project-raw//:WORKSPACE",
)
ONNX_MLIR_SHA256 = "f33108ba4bc81c6704753838ee4d85ad87e195fda3df991c2b00f18872a9e2dd"
# http_archive(
# name = "onnx-mlir-raw",
# build_file_content = "#empty",
# sha256 = ONNX_MLIR_SHA256,
# strip_prefix = "src",
# urls = [
# "https://github.com/onnx/onnx-mlir.git",
# ],
# )
# protobuf #####################################################################
# http_archive(
# name = "protobuf_archive",
# sha256 = "1c020fafc84acd235ec81c6aac22d73f23e85a700871466052ff231d69c1b17a",
# strip_prefix = "protobuf-5902e759108d14ee8e6b0b07653dac2f4e70ac73",
# build_file = "//third_party:protobuf.BUILD",
# # system_build_file = clean_dep("//third_party/systemlibs:protobuf.BUILD"),
# # system_link_files = {
# # "//third_party/systemlibs:protobuf.bzl": "protobuf.bzl",
# # },
# urls = [
# "https://github.com/protocolbuffers/protobuf/archive/5902e759108d14ee8e6b0b07653dac2f4e70ac73.tar.gz",
# "http://mirror.tensorflow.org/github.com/protocolbuffers/protobuf/archive/5902e759108d14ee8e6b0b07653dac2f4e70ac73.tar.gz",
# ],
# )
# PROTOBUF_URLS = [
# "http://mirror.tensorflow.org/github.com/protocolbuffers/protobuf/archive/5902e759108d14ee8e6b0b07653dac2f4e70ac73.tar.gz",
# "https://github.com/protocolbuffers/protobuf/archive/5902e759108d14ee8e6b0b07653dac2f4e70ac73.tar.gz",
# ]
# PROTOBUF_SHA256 = "1c020fafc84acd235ec81c6aac22d73f23e85a700871466052ff231d69c1b17a"
# PROTOBUF_STRIP_PREFIX = "protobuf-5902e759108d14ee8e6b0b07653dac2f4e70ac73"
# tf_http_archive(
# name = "protobuf_archive",
# sha256 = PROTOBUF_SHA256,
# strip_prefix = PROTOBUF_STRIP_PREFIX,
# system_build_file = clean_dep("//third_party/systemlibs:protobuf.BUILD"),
# system_link_files = {
# "//third_party/systemlibs:protobuf.bzl": "protobuf.bzl",
# },
# urls = PROTOBUF_URLS,
# )
# # We need to import the protobuf library under the names com_google_protobuf
# # and com_google_protobuf_cc to enable proto_library support in bazel.
# # Unfortunately there is no way to alias http_archives at the moment.
# tf_http_archive(
# name = "com_google_protobuf",
# sha256 = PROTOBUF_SHA256,
# strip_prefix = PROTOBUF_STRIP_PREFIX,
# system_build_file = clean_dep("//third_party/systemlibs:protobuf.BUILD"),
# system_link_files = {
# "//third_party/systemlibs:protobuf.bzl": "protobuf.bzl",
# },
# urls = PROTOBUF_URLS,
# )
# tf_http_archive(
# name = "com_google_protobuf_cc",
# sha256 = PROTOBUF_SHA256,
# strip_prefix = PROTOBUF_STRIP_PREFIX,
# system_build_file = clean_dep("//third_party/systemlibs:protobuf.BUILD"),
# system_link_files = {
# "//third_party/systemlibs:protobuf.bzl": "protobuf.bzl",
# },
# urls = PROTOBUF_URLS,
# )
# rules_cc defines rules for generating C++ code from Protocol Buffers.
http_archive(
name = "rules_cc",
@ -142,16 +28,16 @@ http_archive(
)
load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies")
rules_cc_dependencies()
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
rules_proto_dependencies()
rules_proto_toolchains()
###############################################################################
# Skylib #######################################################################
http_archive(
name = "bazel_skylib",
@ -167,8 +53,14 @@ load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()
###############################################################################
load(":onnxmlir.bzl", "onnxmlir_deps")
onnxmlir_deps()
load("@llvm-bazel//:configure.bzl", "llvm_configure")
llvm_configure(
name = "llvm-project",
src_path = ".",
src_workspace = "@llvm-project-raw//:WORKSPACE",
)

View File

@ -5,74 +5,6 @@ def clean_dep(dep):
return str(Label(dep))
def third_party_deps():
if "zlib_archive" not in native.existing_rules():
http_archive(
name = "zlib_archive",
build_file = "//third_party:zlib.BUILD",
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
strip_prefix = "zlib-1.2.11",
urls = [
"http://mirror.tensorflow.org/zlib.net/zlib-1.2.11.tar.gz",
"https://zlib.net/zlib-1.2.11.tar.gz",
],
)
if "gtest" not in native.existing_rules():
http_archive(
name = "gtest",
sha256 = "9cbca84c4256bed17df2c8f4d00c912c19d247c11c9ba6647cd6dd5b5c996b8d",
strip_prefix = "googletest-9816b96a6ddc0430671693df90192bbee57108b6",
urls = [
"https://mirror.bazel.build/github.com/google/googletest/archive/9816b96a6ddc0430671693df90192bbee57108b6.zip",
"https://github.com/google/googletest/archive/9816b96a6ddc0430671693df90192bbee57108b6.zip",
],
)
if "glog" not in native.existing_rules():
git_repository(
name = "glog",
commit = "41f4bf9cbc3e8995d628b459f6a239df43c2b84a",
remote = "https://github.com/google/glog",
)
if "com_github_gflags_gflags" not in native.existing_rules():
http_archive(
name = "com_github_gflags_gflags",
sha256 = "34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf",
strip_prefix = "gflags-2.2.2",
urls = [
"https://github.com/gflags/gflags/archive/v2.2.2.tar.gz",
],
)
if "pybind11" not in native.existing_rules():
http_archive(
name = "pybind11",
build_file = "//third_party:pybind11.BUILD",
sha256 = "1eed57bc6863190e35637290f97a20c81cfe4d9090ac0a24f3bbf08f265eb71d",
strip_prefix = "pybind11-2.4.3",
urls = [
"https://github.com/pybind/pybind11/archive/v2.4.3.tar.gz",
],
)
if "eigen" not in native.existing_rules():
http_archive(
name = "eigen",
build_file = "//third_party:eigen.BUILD",
sha256 = "d56fbad95abf993f8af608484729e3d87ef611dd85b3380a8bad1d5cbc373a57",
strip_prefix = "eigen-3.3.7",
urls = ["https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz"],
)
if "google_styleguide" not in native.existing_rules():
new_git_repository(
name = "google_styleguide",
build_file = "//third_party:google_styleguide.BUILD",
commit = "91d6e367e384b0d8aaaf7ce95029514fcdf38651",
remote = "https://github.com/google/styleguide",
)
if "onnx" not in native.existing_rules():
new_git_repository(
name = "onnx",
@ -81,49 +13,35 @@ def third_party_deps():
remote = "https://github.com/onnx/onnx",
)
#if "rules_foreign_cc" not in native.existing_rules():
# http_archive(
# name = "rules_foreign_cc",
# strip_prefix = "rules_foreign_cc-master",
# url = "https://github.com/bazelbuild/rules_foreign_cc/archive/master.zip",
# )
def llvm_deps():
LLVM_COMMIT = "85763e0758fbd238c81f233c6f9510e81c7de177" # llvm 12
LLVM_BAZEL_TAG = "llvm-project-%s" % (LLVM_COMMIT,)
LLVM_BAZEL_SHA256 = "5d358075abc2db8192c138bdaa6ce74f2c59a0bde6d7d57813f3fc66d6b6da34"
if "cpp-taskflow" not in native.existing_rules():
if "llvm-bazel" not in native.existing_rules():
http_archive(
name = "cpp-taskflow",
build_file = "//third_party:cpp-taskflow.BUILD",
sha256 = "e32168875e18182a5796e453751715c2a7ef7beefbebe57b1f55a705de223c1e",
strip_prefix = "taskflow-2.3.0",
urls = ["https://github.com/cpp-taskflow/cpp-taskflow/archive/v2.3.0.tar.gz"],
name = "llvm-bazel",
sha256 = LLVM_BAZEL_SHA256,
strip_prefix = "llvm-bazel-{tag}/llvm-bazel".format(tag = LLVM_BAZEL_TAG),
url = "https://github.com/google/llvm-bazel/archive/{tag}.tar.gz".format(tag = LLVM_BAZEL_TAG),
)
if "clang_binary" not in native.existing_rules():
LLVM_SHA256 = "f33108ba4bc81c6704753838ee4d85ad87e195fda3df991c2b00f18872a9e2dd"
LLVM_SHA256 = ""
LLVM_URLS = [
# "https://storage.googleapis.com/mirror.tensorflow.org/github.com/llvm/llvm-project/archive/{commit}.tar.gz".format(commit = LLVM_COMMIT),
"https://github.com/llvm/llvm-project/archive/{commit}.tar.gz".format(commit = LLVM_COMMIT),
]
if "llvm-project-raw" not in native.existing_rules():
http_archive(
name = "clang_binary",
build_file = "@Primo//:third_party/clang_binary.BUILD",
url = "http://swbuild.enflame.cn/clang/clang11-20200628.tar.gz",
sha256 = "b51a7e534f20fe0977c5f0096d4c44fd2c3bd28661c43f4149d217540aea700c",
name = "llvm-project-raw",
build_file_content = "#empty",
sha256 = LLVM_SHA256,
strip_prefix = "llvm-project-" + LLVM_COMMIT,
urls = LLVM_URLS,
)
if "scope_guard" not in native.existing_rules():
new_git_repository(
name = "scope_guard",
remote = "https://github.com/ricab/scope_guard",
commit = "760de0a9ea0fec980a5244604ffa5b1acff2db7a",
build_file = "//third_party:scope_guard.BUILD",
)
if "dlpack" not in native.existing_rules():
new_git_repository(
name = "dlpack",
remote = "https://github.com/dmlc/dlpack",
commit = "3ec04430e89a6834e5a1b99471f415fa939bf642",
build_file = "//third_party:dlpack.BUILD",
)
def internal_deps():
return
def onnxmlir_deps():
internal_deps()
llvm_deps()
third_party_deps()