Skip to content

Commit bfff0cc

Browse files
swolchokfacebook-github-bot
authored andcommitted
Use c10 version of half/bfloat16 in executorch (pytorch#144111)
Summary: X-link: pytorch/executorch#7040 Accomplished by importing relevant files from c10 into executorch/runtime/core/portable_type/c10, and then using `using` in the top-level ExecuTorch headers. This approach should keep the ExecuTorch build hermetic for embedded use cases. In the future, we should add a CI job to ensure the c10 files stay identical to the PyTorch ones. ghstack-source-id: 265190624 exported-using-ghexport Test Plan: builds Reviewed By: shoumikhin Differential Revision: D66106969
1 parent 5d75321 commit bfff0cc

File tree

4 files changed

+42
-1
lines changed

4 files changed

+42
-1
lines changed

buckbuild.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,7 @@ def define_buck_targets(
997997
"Config.h": ":generate_aten_config[Config.h]",
998998
},
999999
labels = labels,
1000+
visibility = ["PUBLIC"],
10001001
)
10011002

10021003
fb_xplat_cxx_library(

c10/build.bzl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,15 @@ def define_targets(rules):
2222
[],
2323
),
2424
)
25+
26+
rules.cc_library(
27+
name = "c10_headers",
28+
deps = [
29+
"//c10/core:base_headers",
30+
"//c10/macros",
31+
"//c10/util:base_headers",
32+
"//c10/util:bit_cast",
33+
"//c10/util:ssize",
34+
],
35+
visibility = ["//visibility:public"],
36+
)

c10/core/build.bzl

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,22 @@ def define_targets(rules):
9090
alwayslink = True,
9191
)
9292

93+
rules.cc_library(
94+
name = "base_headers",
95+
srcs = [],
96+
hdrs = rules.glob(
97+
[
98+
"*.h",
99+
"impl/*.h",
100+
],
101+
exclude = [
102+
"CPUAllocator.h",
103+
"impl/alloc_cpu.h",
104+
],
105+
),
106+
visibility = ["//visibility:public"],
107+
)
108+
93109
rules.filegroup(
94110
name = "headers",
95111
srcs = rules.glob(
@@ -101,5 +117,5 @@ def define_targets(rules):
101117
"alignment.h",
102118
],
103119
),
104-
visibility = ["//c10:__pkg__"],
120+
visibility = ["//visibility:public"],
105121
)

c10/util/build.bzl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,18 @@ def define_targets(rules):
8080
],
8181
)
8282

83+
rules.cc_library(
84+
name = "base_headers",
85+
hdrs = rules.glob(
86+
["*.h"],
87+
exclude = [
88+
"bit_cast.h",
89+
"ssize.h",
90+
],
91+
),
92+
visibility = ["//visibility:public"],
93+
)
94+
8395
rules.filegroup(
8496
name = "headers",
8597
srcs = rules.glob(

0 commit comments

Comments
 (0)