Skip to content

Commit 0e4b6ec

Browse files
committed
[devtool] make datasink as a sepreate directory
Pull Request resolved: #8514 this diff make data_sink_base and its childrens as a seperate directory for better structure. ghstack-source-id: 268186751 Differential Revision: [D69732404](https://our.internmc.facebook.com/intern/diff/D69732404/)
1 parent 7480514 commit 0e4b6ec

File tree

14 files changed

+90
-56
lines changed

14 files changed

+90
-56
lines changed

devtools/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ add_custom_command(
176176
add_library(
177177
etdump ${CMAKE_CURRENT_SOURCE_DIR}/etdump/etdump_flatcc.cpp
178178
${CMAKE_CURRENT_SOURCE_DIR}/etdump/emitter.cpp
179-
${CMAKE_CURRENT_SOURCE_DIR}/etdump/buffer_data_sink.cpp
180-
${CMAKE_CURRENT_SOURCE_DIR}/etdump/buffer_data_sink.h
179+
${CMAKE_CURRENT_SOURCE_DIR}/etdump/data_sinks/buffer_data_sink.cpp
180+
${CMAKE_CURRENT_SOURCE_DIR}/etdump/data_sinks/buffer_data_sink.h
181181
)
182182

183183
target_link_libraries(

devtools/etdump/data_sinks/TARGETS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
load(":targets.bzl", "define_common_targets")
2+
3+
oncall("executorch")
4+
5+
define_common_targets()

devtools/etdump/buffer_data_sink.cpp renamed to devtools/etdump/data_sinks/buffer_data_sink.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
#include <executorch/devtools/etdump/buffer_data_sink.h>
9+
#include <executorch/devtools/etdump/data_sinks/buffer_data_sink.h>
1010
#include <executorch/devtools/etdump/utils.h>
1111

1212
using ::executorch::runtime::Error;

devtools/etdump/buffer_data_sink.h renamed to devtools/etdump/data_sinks/buffer_data_sink.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#pragma once
1010

11-
#include <executorch/devtools/etdump/data_sink_base.h>
11+
#include <executorch/devtools/etdump/data_sinks/data_sink_base.h>
1212
#include <executorch/runtime/core/exec_aten/exec_aten.h>
1313
#include <executorch/runtime/core/span.h>
1414

File renamed without changes.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
2+
3+
4+
def define_data_sink_target(data_sink_name, aten_suffix):
5+
runtime.cxx_library(
6+
name = data_sink_name + aten_suffix,
7+
exported_headers = [
8+
data_sink_name + ".h",
9+
],
10+
srcs = [
11+
data_sink_name + ".cpp",
12+
],
13+
deps = [
14+
"//executorch/devtools/etdump:utils",
15+
],
16+
exported_deps = [
17+
"//executorch/runtime/core/exec_aten:lib" + aten_suffix,
18+
":data_sink_base" + aten_suffix,
19+
],
20+
visibility = [
21+
"//executorch/...",
22+
"@EXECUTORCH_CLIENTS",
23+
],
24+
)
25+
26+
def define_common_targets():
27+
"""Defines targets that should be shared between fbcode and xplat.
28+
29+
The directory containing this targets.bzl file should also contain both
30+
TARGETS and BUCK files that call this function.
31+
"""
32+
for aten_mode in (True, False):
33+
aten_suffix = "_aten" if aten_mode else ""
34+
35+
runtime.cxx_library(
36+
name = "data_sink_base" + aten_suffix,
37+
exported_headers = [
38+
"data_sink_base.h",
39+
],
40+
exported_deps = [
41+
"//executorch/runtime/core/exec_aten/util:scalar_type_util" + aten_suffix,
42+
],
43+
visibility = [
44+
"//executorch/...",
45+
"@EXECUTORCH_CLIENTS",
46+
],
47+
)
48+
49+
define_data_sink_target("buffer_data_sink", aten_suffix)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
load(":targets.bzl", "define_common_targets")
2+
3+
oncall("executorch")
4+
5+
define_common_targets()

devtools/etdump/tests/buffer_data_sink_test.cpp renamed to devtools/etdump/data_sinks/tests/buffer_data_sink_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
#include <executorch/devtools/etdump/buffer_data_sink.h>
9+
#include <executorch/devtools/etdump/data_sinks/buffer_data_sink.h>
1010
#include <executorch/runtime/core/exec_aten/testing_util/tensor_factory.h>
1111
#include <executorch/runtime/core/span.h>
1212
#include <executorch/runtime/platform/runtime.h>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
2+
3+
def define_common_targets():
4+
"""Defines targets that should be shared between fbcode and xplat.
5+
6+
The directory containing this targets.bzl file should also contain both
7+
TARGETS and BUCK files that call this function.
8+
"""
9+
10+
11+
runtime.cxx_test(
12+
name = "buffer_data_sink_test",
13+
srcs = [
14+
"buffer_data_sink_test.cpp",
15+
],
16+
deps = [
17+
"//executorch/devtools/etdump/data_sinks:buffer_data_sink",
18+
"//executorch/runtime/core/exec_aten/testing_util:tensor_util",
19+
],
20+
)

devtools/etdump/etdump_flatcc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#include <cstring>
1212

13-
#include <executorch/devtools/etdump/buffer_data_sink.h>
13+
#include <executorch/devtools/etdump/data_sinks/buffer_data_sink.h>
1414
#include <executorch/devtools/etdump/emitter.h>
1515
#include <executorch/devtools/etdump/etdump_schema_flatcc_builder.h>
1616
#include <executorch/devtools/etdump/etdump_schema_flatcc_reader.h>

0 commit comments

Comments
 (0)