Skip to content

Commit 0b6f685

Browse files
committed
[executorch][serialization] Rename scalar_type.fbs --> common.fbs
Allow us to add other shared flatbuffer types into `common.fbs`. - Rename scalar_type.fbs --> common.fbs - Rename scalar_type.py --> common_schema.py (differentiate from exir/common.py) Differential Revision: [D65442256](https://our.internmc.facebook.com/intern/diff/D65442256/) ghstack-source-id: 251940415 Pull Request resolved: #6678
1 parent cd565b5 commit 0b6f685

File tree

33 files changed

+79
-75
lines changed

33 files changed

+79
-75
lines changed

.ci/scripts/build-qnn-sdk.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ set_up_aot() {
4242

4343
# Workaround for fbs files in exir/_serialize
4444
cp schema/program.fbs exir/_serialize/program.fbs
45-
cp schema/scalar_type.fbs exir/_serialize/scalar_type.fbs
45+
cp schema/common.fbs exir/_serialize/common.fbs
4646
}
4747

4848
build_qnn_backend

.ci/scripts/test_llama.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ if [[ "${MODE}" =~ .*qnn.* ]]; then
7979
export LD_LIBRARY_PATH="${QNN_SDK_ROOT}/lib/x86_64-linux-clang"
8080
export PYTHONPATH=".."
8181
cp schema/program.fbs exir/_serialize/program.fbs
82-
cp schema/scalar_type.fbs exir/_serialize/scalar_type.fbs
82+
cp schema/common.fbs exir/_serialize/common.fbs
8383
cp -f build-x86/backends/qualcomm/PyQnnManagerAdaptor.cpython-310-x86_64-linux-gnu.so backends/qualcomm/python
8484
cp -f build-x86/backends/qualcomm/PyQnnWrapperAdaptor.cpython-310-x86_64-linux-gnu.so backends/qualcomm/python
8585

backends/qualcomm/scripts/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ if [ "$BUILD_X86_64" = true ]; then
136136
rm -f $PRJ_ROOT/backends/qualcomm/python/*
137137
cp -fv $BUILD_ROOT/backends/qualcomm/Py* "$PRJ_ROOT/backends/qualcomm/python"
138138
cp -fv "$PRJ_ROOT/schema/program.fbs" "$PRJ_ROOT/exir/_serialize/program.fbs"
139-
cp -fv "$PRJ_ROOT/schema/scalar_type.fbs" "$PRJ_ROOT/exir/_serialize/scalar_type.fbs"
139+
cp -fv "$PRJ_ROOT/schema/common.fbs" "$PRJ_ROOT/exir/_serialize/common.fbs"
140140

141141
EXAMPLE_ROOT=examples/qualcomm
142142
CMAKE_PREFIX_PATH="${BUILD_ROOT}/lib/cmake/ExecuTorch;${BUILD_ROOT}/third-party/gflags;"

devtools/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ if(NOT FLATC_EXECUTABLE)
3737
endif()
3838

3939
# Paths to headers generated from the .fbs files. set(_etdump_schemas
40-
# etdump_schema_flatcc.fbs scalar_type.fbs)
40+
# etdump_schema_flatcc.fbs common.fbs)
4141

42-
set(_etdump_schema_names "etdump_schema_flatcc.fbs" "scalar_type.fbs")
43-
set(_bundled_input_schema_names "bundled_program_schema.fbs" "scalar_type.fbs")
42+
set(_etdump_schema_names "etdump_schema_flatcc.fbs" "common.fbs")
43+
set(_bundled_input_schema_names "bundled_program_schema.fbs" "common.fbs")
4444

4545
foreach(schema_file ${_etdump_schema_names})
4646
list(APPEND _etdump_schema__srcs

devtools/bundled_program/schema/TARGETS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ runtime.python_library(
1919
"//executorch/devtools/etrecord/...",
2020
],
2121
deps = [
22-
"//executorch/exir:scalar_type",
22+
"//executorch/exir:common_schema",
2323
],
2424
)

devtools/bundled_program/schema/bundled_program_schema.fbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// See README.md before modifying this file.
55
//
66

7-
include "scalar_type.fbs";
7+
include "common.fbs";
88

99
namespace bundled_program_flatbuffer;
1010

devtools/bundled_program/schema/bundled_program_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from dataclasses import dataclass
1010
from typing import List, Union
1111

12-
from executorch.exir.scalar_type import ScalarType
12+
from executorch.exir.common_schema import ScalarType
1313

1414

1515
@dataclass

devtools/bundled_program/schema/targets.bzl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
22

3-
BUNLDED_STEM = "bundled_program_schema"
4-
SCALAR_TYPE_STEM = "scalar_type"
3+
BUNDLED_STEM = "bundled_program_schema"
4+
COMMON_STEM = "common"
55

6-
INPUT_BUNDLED = BUNLDED_STEM + ".fbs"
7-
INPUT_SCALAR_TYPE = SCALAR_TYPE_STEM + ".fbs"
6+
INPUT_BUNDLED = BUNDLED_STEM + ".fbs"
7+
INPUT_COMMON = COMMON_STEM + ".fbs"
88

9-
OUTPUT_BUNDLED_HEADER = BUNLDED_STEM + "_generated.h"
10-
OUTPUT_SCALAR_TYPE_HEADER = SCALAR_TYPE_STEM + "_generated.h"
9+
OUTPUT_BUNDLED_HEADER = BUNDLED_STEM + "_generated.h"
10+
OUTPUT_COMMON_HEADER = COMMON_STEM + "_generated.h"
1111

1212
BUNDLED_GEN_RULE_NAME = "generate_bundled_program"
1313

14-
BUNDLED_LIBRARY_NAME = BUNLDED_STEM + "_fbs"
14+
BUNDLED_LIBRARY_NAME = BUNDLED_STEM + "_fbs"
1515

1616
def _generate_schema_header(rule_name, srcs, headers, default_header):
1717
"""Generate header file given flatbuffer schema
@@ -54,16 +54,16 @@ def define_common_targets():
5454
)
5555

5656
runtime.export_file(
57-
name = INPUT_SCALAR_TYPE,
57+
name = INPUT_COMMON,
5858
visibility = [
5959
"//executorch/devtools/bundled_program/serialize/...",
6060
],
6161
)
6262

6363
_generate_schema_header(
6464
BUNDLED_GEN_RULE_NAME,
65-
[INPUT_BUNDLED, INPUT_SCALAR_TYPE],
66-
[OUTPUT_BUNDLED_HEADER, OUTPUT_SCALAR_TYPE_HEADER],
65+
[INPUT_BUNDLED, INPUT_COMMON],
66+
[OUTPUT_BUNDLED_HEADER, OUTPUT_COMMON_HEADER],
6767
OUTPUT_BUNDLED_HEADER,
6868
)
6969

@@ -77,7 +77,7 @@ def define_common_targets():
7777
],
7878
exported_headers = {
7979
OUTPUT_BUNDLED_HEADER: ":{}[{}]".format(BUNDLED_GEN_RULE_NAME, OUTPUT_BUNDLED_HEADER),
80-
OUTPUT_SCALAR_TYPE_HEADER: ":{}[{}]".format(BUNDLED_GEN_RULE_NAME, OUTPUT_SCALAR_TYPE_HEADER),
80+
OUTPUT_COMMON_HEADER: ":{}[{}]".format(BUNDLED_GEN_RULE_NAME, OUTPUT_COMMON_HEADER),
8181
},
8282
exported_external_deps = ["flatbuffers-api"],
8383
)

devtools/bundled_program/schema/test/test_schema.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ class TestSchema(unittest.TestCase):
1515
def test_schema_sync(self) -> None:
1616
# make the test work in both internal and oss.
1717
prefix = (
18-
"executorch/" if os.path.exists("executorch/schema/scalar_type.fbs") else ""
18+
"executorch/" if os.path.exists("executorch/schema/common.fbs") else ""
1919
)
2020

2121
self.assertTrue(
2222
filecmp.cmp(
23-
prefix + "devtools/bundled_program/schema/scalar_type.fbs",
24-
prefix + "schema/scalar_type.fbs",
23+
prefix + "devtools/bundled_program/schema/common.fbs",
24+
prefix + "schema/common.fbs",
2525
),
26-
'Please run "hg cp fbcode//executorch/schema/scalar_type.fbs fbcode//executorch/devtools/bundled_program/schema/scalar_type.fbs" to sync schema changes.',
26+
'Please run "hg cp fbcode//executorch/schema/common.fbs fbcode//executorch/devtools/bundled_program/schema/common.fbs" to sync schema changes.',
2727
)

0 commit comments

Comments
 (0)