Skip to content

Commit

Permalink
[devtool] make datasink as a sepreate directory
Browse files Browse the repository at this point in the history
this diff make data_sink_base and its childrens as a seperate directory for better structure.

Differential Revision: [D69732404](https://our.internmc.facebook.com/intern/diff/D69732404/)

ghstack-source-id: 266774369
Pull Request resolved: #8514
  • Loading branch information
Gasoonjia committed Feb 17, 2025
1 parent a4279eb commit 97a916e
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 54 deletions.
5 changes: 5 additions & 0 deletions devtools/etdump/data_sinks/TARGETS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
load(":targets.bzl", "define_common_targets")

oncall("executorch")

define_common_targets()
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/

#include <executorch/devtools/etdump/buffer_data_sink.h>
#include <executorch/devtools/etdump/data_sinks/buffer_data_sink.h>
#include <executorch/devtools/etdump/utils.h>

using ::executorch::runtime::Error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#pragma once

#include <executorch/devtools/etdump/data_sink_base.h>
#include <executorch/devtools/etdump/data_sinks/data_sink_base.h>
#include <executorch/runtime/core/exec_aten/exec_aten.h>
#include <executorch/runtime/core/span.h>

Expand Down
File renamed without changes.
46 changes: 46 additions & 0 deletions devtools/etdump/data_sinks/targets.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")


def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
The directory containing this targets.bzl file should also contain both
TARGETS and BUCK files that call this function.
"""
for aten_mode in (True, False):
aten_suffix = "_aten" if aten_mode else ""

runtime.cxx_library(
name = "data_sink_base" + aten_suffix,
exported_headers = [
"data_sink_base.h",
],
exported_deps = [
"//executorch/runtime/core/exec_aten/util:scalar_type_util" + aten_suffix,
],
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
)

runtime.cxx_library(
name = "buffer_data_sink" + aten_suffix,
exported_headers = [
"buffer_data_sink.h",
],
srcs = [
"buffer_data_sink.cpp",
],
deps = [
"//executorch/devtools/etdump:utils",
],
exported_deps = [
"//executorch/runtime/core/exec_aten:lib" + aten_suffix,
":data_sink_base" + aten_suffix,
],
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
)
5 changes: 5 additions & 0 deletions devtools/etdump/data_sinks/tests/TARGETS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
load(":targets.bzl", "define_common_targets")

oncall("executorch")

define_common_targets()
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/

#include <executorch/devtools/etdump/buffer_data_sink.h>
#include <executorch/devtools/etdump/data_sinks/buffer_data_sink.h>
#include <executorch/runtime/core/exec_aten/testing_util/tensor_factory.h>
#include <executorch/runtime/core/span.h>
#include <executorch/runtime/platform/runtime.h>
Expand Down
20 changes: 20 additions & 0 deletions devtools/etdump/data_sinks/tests/targets.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")

def define_common_targets():
"""Defines targets that should be shared between fbcode and xplat.
The directory containing this targets.bzl file should also contain both
TARGETS and BUCK files that call this function.
"""


runtime.cxx_test(
name = "buffer_data_sink_test",
srcs = [
"buffer_data_sink_test.cpp",
],
deps = [
"//executorch/devtools/etdump/data_sinks:buffer_data_sink",
"//executorch/runtime/core/exec_aten/testing_util:tensor_util",
],
)
2 changes: 1 addition & 1 deletion devtools/etdump/etdump_flatcc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <cstring>

#include <executorch/devtools/etdump/buffer_data_sink.h>
#include <executorch/devtools/etdump/data_sinks/buffer_data_sink.h>
#include <executorch/devtools/etdump/emitter.h>
#include <executorch/devtools/etdump/etdump_schema_flatcc_builder.h>
#include <executorch/devtools/etdump/etdump_schema_flatcc_reader.h>
Expand Down
2 changes: 1 addition & 1 deletion devtools/etdump/etdump_flatcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <cstdint>
#include <memory>

#include <executorch/devtools/etdump/data_sink_base.h>
#include <executorch/devtools/etdump/data_sinks/data_sink_base.h>
#include <executorch/runtime/core/event_tracer.h>
#include <executorch/runtime/core/span.h>
#include <executorch/runtime/platform/platform.h>
Expand Down
40 changes: 3 additions & 37 deletions devtools/etdump/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -94,47 +94,13 @@ def define_common_targets():
"utils.h",
],
visibility = [

"//executorch/devtools/etdump/...",
],
)

for aten_mode in (True, False):
aten_suffix = "_aten" if aten_mode else ""

runtime.cxx_library(
name = "data_sink_base" + aten_suffix,
exported_headers = [
"data_sink_base.h",
],
exported_deps = [
"//executorch/runtime/core/exec_aten/util:scalar_type_util" + aten_suffix,
],
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
)

runtime.cxx_library(
name = "buffer_data_sink" + aten_suffix,
exported_headers = [
"buffer_data_sink.h",
],
srcs = [
"buffer_data_sink.cpp",
],
deps = [
":utils",
],
exported_deps = [
"//executorch/runtime/core/exec_aten:lib" + aten_suffix,
":data_sink_base" + aten_suffix,
],
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
)
runtime.cxx_library(
name = "etdump_flatcc" + aten_suffix,
srcs = [
Expand All @@ -153,8 +119,8 @@ def define_common_targets():
exported_deps = [
":etdump_schema_flatcc",
":utils",
":data_sink_base" + aten_suffix,
":buffer_data_sink" + aten_suffix,
"//executorch/devtools/etdump/data_sinks:data_sink_base" + aten_suffix,
"//executorch/devtools/etdump/data_sinks:buffer_data_sink" + aten_suffix,
"//executorch/runtime/core:event_tracer" + aten_suffix,
"//executorch/runtime/core/exec_aten/util:scalar_type_util" + aten_suffix,
],
Expand Down
2 changes: 1 addition & 1 deletion devtools/etdump/tests/etdump_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <gtest/gtest.h>
#include <cstdio>

#include <executorch/devtools/etdump/buffer_data_sink.h>
#include <executorch/devtools/etdump/data_sinks/buffer_data_sink.h>
#include <executorch/devtools/etdump/etdump_flatcc.h>
#include <executorch/devtools/etdump/etdump_schema_flatcc_builder.h>
#include <executorch/devtools/etdump/etdump_schema_flatcc_reader.h>
Expand Down
11 changes: 0 additions & 11 deletions devtools/etdump/tests/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,3 @@ def define_common_targets():
"//executorch/runtime/core/exec_aten/testing_util:tensor_util",
],
)

runtime.cxx_test(
name = "buffer_data_sink_test",
srcs = [
"buffer_data_sink_test.cpp",
],
deps = [
"//executorch/devtools/etdump:buffer_data_sink",
"//executorch/runtime/core/exec_aten/testing_util:tensor_util",
],
)

0 comments on commit 97a916e

Please sign in to comment.