Skip to content

Commit

Permalink
Merge branch 'master' into bowa_fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
narendasan authored Apr 30, 2021
2 parents 5110480 + d7eda0d commit dde0216
Show file tree
Hide file tree
Showing 61 changed files with 1,142 additions and 1,012 deletions.
26 changes: 12 additions & 14 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,28 @@ pkg_tar(
"//core/conversion:include",
"//core/conversion/conversionctx:include",
"//core/conversion/converters:include",
"//core/conversion/var:include",
"//core/conversion/tensorcontainer:include",
"//core/conversion/evaluators:include",
"//core/conversion/converters/impl/plugins:include",
"//core/runtime:include",
"//core/conversion/evaluators:include",
"//core/conversion/tensorcontainer:include",
"//core/conversion/var:include",
"//core/lowering:include",
"//core/lowering/passes:include",
"//core/runtime:include",
"//core/util:include",
"//core/util/logging:include"
"//core/util/logging:include",
],
)

pkg_tar(
name = "include",
package_dir = "include/trtorch/",
srcs = [
"//cpp/api:api_headers",
],
package_dir = "include/trtorch/",
)

pkg_tar(
name = "lib",
package_dir = "lib/",
srcs = select({
":windows": ["//cpp/api/lib:trtorch.dll"],
"//conditions:default": [
Expand All @@ -46,26 +45,25 @@ pkg_tar(
],
}),
mode = "0755",
package_dir = "lib/",
)


pkg_tar(
name = "bin",
package_dir = "bin/",
srcs = [
"//cpp/trtorchc:trtorchc",
"//cpp/trtorchc",
],
mode = "0755",
package_dir = "bin/",
)


pkg_tar(
name = "libtrtorch",
extension = "tar.gz",
package_dir = "trtorch",
srcs = [
"//:LICENSE"
"//:LICENSE",
],
extension = "tar.gz",
package_dir = "trtorch",
deps = [
":lib",
":include",
Expand Down
37 changes: 19 additions & 18 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,38 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

http_archive(
name = "rules_python",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.2.0/rules_python-0.2.0.tar.gz",
sha256 = "778197e26c5fbeb07ac2a2c5ae405b30f6cb7ad1f5510ea6fdac03bded96cc6f",
)
name = "rules_python",
sha256 = "778197e26c5fbeb07ac2a2c5ae405b30f6cb7ad1f5510ea6fdac03bded96cc6f",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.2.0/rules_python-0.2.0.tar.gz",
)

load("@rules_python//python:pip.bzl", "pip_install")

http_archive(
name = "rules_pkg",
sha256 = "038f1caa773a7e35b3663865ffb003169c6a71dc995e39bf4815792f385d837d",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.4.0/rules_pkg-0.4.0.tar.gz",
"https://github.com/bazelbuild/rules_pkg/releases/download/0.4.0/rules_pkg-0.4.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.4.0/rules_pkg-0.4.0.tar.gz",
"https://github.com/bazelbuild/rules_pkg/releases/download/0.4.0/rules_pkg-0.4.0.tar.gz",
],
sha256 = "038f1caa773a7e35b3663865ffb003169c6a71dc995e39bf4815792f385d837d",
)

load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")

rules_pkg_dependencies()

git_repository(
name = "googletest",
remote = "https://github.com/google/googletest",
commit = "703bd9caab50b139428cea1aaff9974ebee5742e",
shallow_since = "1570114335 -0400"
remote = "https://github.com/google/googletest",
shallow_since = "1570114335 -0400",
)

# CUDA should be installed on the system locally
new_local_repository(
name = "cuda",
path = "/usr/local/cuda-11.1/",
build_file = "@//third_party/cuda:BUILD",
path = "/usr/local/cuda-11.1/",
)

#############################################################################################################
Expand All @@ -44,16 +45,16 @@ new_local_repository(
http_archive(
name = "libtorch",
build_file = "@//third_party/libtorch:BUILD",
strip_prefix = "libtorch",
sha256 = "1f8aec376f9343538bd7c2fd3abb81ed3af11f575efe3aa72777c4d62044b832",
strip_prefix = "libtorch",
urls = ["https://download.pytorch.org/libtorch/cu111/libtorch-cxx11-abi-shared-with-deps-1.8.1%2Bcu111.zip"],
)

http_archive(
name = "libtorch_pre_cxx11_abi",
build_file = "@//third_party/libtorch:BUILD",
strip_prefix = "libtorch",
sha256 = "3a6e0dc11859111e75caa640c8ce9bf904fbb6e9992b4345e444ed5410e4d77e",
strip_prefix = "libtorch",
urls = ["https://download.pytorch.org/libtorch/cu111/libtorch-shared-with-deps-1.8.1%2Bcu111.zip"],
)

Expand All @@ -63,22 +64,22 @@ http_archive(

http_archive(
name = "cudnn",
build_file = "@//third_party/cudnn/archive:BUILD",
sha256 = "98a8784e92862f20018d20c281b30d4a0cd951f93694f6433ccf4ae9c502ba6a",
strip_prefix = "cuda",
urls = [
"https://developer.nvidia.com/compute/machine-learning/cudnn/secure/8.1.1.33/11.2_20210301/cudnn-11.2-linux-x64-v8.1.1.33.tgz",
],
build_file = "@//third_party/cudnn/archive:BUILD",
sha256 = "98a8784e92862f20018d20c281b30d4a0cd951f93694f6433ccf4ae9c502ba6a",
strip_prefix = "cuda"
)

http_archive(
name = "tensorrt",
build_file = "@//third_party/tensorrt/archive:BUILD",
sha256 = "d3a1f478e304b48878604fac70ce7920fece71f9cac62f925c9c59c197f5d087",
strip_prefix = "TensorRT-7.2.3.4",
urls = [
"https://developer.nvidia.com/compute/machine-learning/tensorrt/secure/7.2.3/tars/TensorRT-7.2.3.4.Ubuntu-18.04.x86_64-gnu.cuda-11.1.cudnn8.1.tar.gz",
],
build_file = "@//third_party/tensorrt/archive:BUILD",
strip_prefix = "TensorRT-7.2.3.4",
sha256 = "d3a1f478e304b48878604fac70ce7920fece71f9cac62f925c9c59c197f5d087"
)

####################################################################################
Expand Down
22 changes: 11 additions & 11 deletions core/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,44 @@ config_setting(
name = "use_pre_cxx11_abi",
values = {
"define": "abi=pre_cxx11_abi",
}
},
)

config_setting(
name = "python_core",
values = {
"define": "target_lang=python"
}
"define": "target_lang=python",
},
)

cc_library(
name = "core",
hdrs = [
"compiler.h",
],
srcs = [
"compiler.cpp",
],
hdrs = [
"compiler.h",
],
deps = [
"//core/conversion",
"//core/runtime",
"//core/lowering",
"//core/partitioning",
"//core/util/logging",
"@tensorrt//:nvinfer"
"@tensorrt//:nvinfer",
] + select({
":use_pre_cxx11_abi": ["@libtorch_pre_cxx11_abi//:libtorch"],
"//conditions:default": ["@libtorch//:libtorch"],
":use_pre_cxx11_abi": ["@libtorch_pre_cxx11_abi//:libtorch"],
"//conditions:default": ["@libtorch//:libtorch"],
}),
alwayslink=True,
alwayslink = True,
)

load("@rules_pkg//:pkg.bzl", "pkg_tar")

pkg_tar(
name = "include",
package_dir = "core/",
srcs = [
"compiler.h",
],
package_dir = "core/",
)
18 changes: 9 additions & 9 deletions core/conversion/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,37 @@ config_setting(
name = "use_pre_cxx11_abi",
values = {
"define": "abi=pre_cxx11_abi",
}
},
)

cc_library(
name = "conversion",
hdrs = [
"conversion.h",
],
srcs = [
"InterfaceTypes.cpp",
"conversion.cpp",
"conversion_ignorelist.cpp",
"InterfaceTypes.cpp"
],
hdrs = [
"conversion.h",
],
deps = [
"@tensorrt//:nvinfer",
"//core/conversion/var",
"//core/conversion/conversionctx",
"//core/conversion/converters",
"//core/conversion/evaluators",
"//core/util:prelude",
"//core/ir",
"//core/util:prelude",
] + select({
":use_pre_cxx11_abi": ["@libtorch_pre_cxx11_abi//:libtorch"],
"//conditions:default": ["@libtorch//:libtorch"],
":use_pre_cxx11_abi": ["@libtorch_pre_cxx11_abi//:libtorch"],
"//conditions:default": ["@libtorch//:libtorch"],
}),
)

load("@rules_pkg//:pkg.bzl", "pkg_tar")

pkg_tar(
name = "include",
package_dir = "core/conversion/",
srcs = ["conversion.h"],
package_dir = "core/conversion/",
)
14 changes: 7 additions & 7 deletions core/conversion/conversionctx/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@ config_setting(
name = "use_pre_cxx11_abi",
values = {
"define": "abi=pre_cxx11_abi",
}
},
)

cc_library(
name = "conversionctx",
hdrs = [
"ConversionCtx.h",
],
srcs = [
"ConversionCtx.cpp",
],
hdrs = [
"ConversionCtx.h",
],
deps = [
"@tensorrt//:nvinfer",
"//core/util:prelude",
] + select({
":use_pre_cxx11_abi": ["@libtorch_pre_cxx11_abi//:libtorch"],
"//conditions:default": ["@libtorch//:libtorch"],
":use_pre_cxx11_abi": ["@libtorch_pre_cxx11_abi//:libtorch"],
"//conditions:default": ["@libtorch//:libtorch"],
}),
)

load("@rules_pkg//:pkg.bzl", "pkg_tar")

pkg_tar(
name = "include",
package_dir = "core/conversion/conversionctx/",
srcs = ["ConversionCtx.h"],
package_dir = "core/conversion/conversionctx/",
)
Loading

0 comments on commit dde0216

Please sign in to comment.