Skip to content

Commit f9e1c1d

Browse files
committed
[executorch] Create target for named_data_map
Pull Request resolved: #8110 named_data_map depends on tensor_layout, which depends on exec_lib. Move it out from core, as we have a circular dep when exec_lib is part of core. Also make TensorLayout::create return a const. Differential Revision: [D68972364](https://our.internmc.facebook.com/intern/diff/D68972364/) ghstack-source-id: 264109129
1 parent 6f67038 commit f9e1c1d

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

runtime/core/targets.bzl

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def define_common_targets():
4141
"defines.h",
4242
"error.h",
4343
"freeable_buffer.h",
44-
"named_data_map.h",
4544
"result.h",
4645
"span.h",
4746
],
@@ -133,6 +132,20 @@ def define_common_targets():
133132
],
134133
)
135134

135+
runtime.cxx_library(
136+
name = "named_data_map",
137+
exported_headers = [
138+
"named_data_map.h",
139+
],
140+
visibility = [
141+
"//executorch/...",
142+
"@EXECUTORCH_CLIENTS",
143+
],
144+
exported_deps = [
145+
":tensor_layout",
146+
],
147+
)
148+
136149
runtime.cxx_library(
137150
name = "tensor_layout",
138151
srcs = ["tensor_layout.cpp"],

runtime/core/tensor_layout.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Result<size_t> calculate_nbytes(
3030
}
3131
} // namespace
3232

33-
Result<TensorLayout> TensorLayout::create(
33+
Result<const TensorLayout> TensorLayout::create(
3434
Span<const int32_t> sizes,
3535
Span<const uint8_t> dim_order,
3636
executorch::aten::ScalarType scalar_type) {

runtime/core/tensor_layout.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ET_EXPERIMENTAL TensorLayout final {
3333
* @param[in] scalar_type The scalar type of the tensor.
3434
* @return A Result containing the TensorLayout on success, or an error.
3535
*/
36-
static executorch::runtime::Result<TensorLayout> create(
36+
static executorch::runtime::Result<const TensorLayout> create(
3737
Span<const int32_t> sizes,
3838
Span<const uint8_t> dim_order,
3939
executorch::aten::ScalarType scalar_type);

0 commit comments

Comments
 (0)