forked from pytorch/xla
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrules_def.bzl
40 lines (37 loc) · 1019 Bytes
/
rules_def.bzl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""Rules that simplify deps and compiler configuration for PyTorch/XLA."""
load(
"@xla//xla:xla.bzl",
"xla_cc_test",
)
def ptxla_cc_library(
deps = [],
copts = [],
**kwargs):
native.cc_library(
copts = copts + ["-isystemexternal/torch"], # Required for system includes.
deps = deps + [
"@torch//:headers",
"@torch//:runtime_headers",
],
**kwargs
)
def ptxla_cc_test(
deps,
copts = [],
**kwargs):
xla_cc_test(
linkstatic = True,
copts = copts + [
"-isystemexternal/torch", # Required for system includes.
"-fexceptions", # Required for testing crashes.
],
deps = deps + [
"@pybind11//:pybind11_embed", # libpython
"@torch//:headers",
"@torch//:libc10",
"@torch//:libtorch",
"@torch//:libtorch_cpu",
"@torch//:libtorch_python",
],
**kwargs
)