Skip to content

Commit 9597b5f

Browse files
committed
Update on "[devtool] introduce datasink class to etdump"
this diff introduce datasink class, the class for managing the customized debug data storage pipeline. Detials can be found in https://docs.google.com/document/d/1y_m32mKdj-OgLcLUz9TKhBW3PC3bBDYSBbeAH544EfM/edit?tab=t.0 Differential Revision: [D69583422](https://our.internmc.facebook.com/intern/diff/D69583422/) [ghstack-poisoned]
2 parents 90e6322 + c3fddc3 commit 9597b5f

File tree

5 files changed

+28
-21
lines changed

5 files changed

+28
-21
lines changed

devtools/etdump/targets.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def define_common_targets():
103103

104104
runtime.cxx_library(
105105
name = "data_sink_base" + aten_suffix,
106-
headers = [
106+
exported_headers = [
107107
"data_sink_base.h",
108108
],
109109
exported_deps = [

runtime/core/error.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,22 @@ using ::executorch::runtime::error_code_t;
126126
} \
127127
}
128128

129+
/**
130+
* A convenience macro to be used in utility functions that check whether input
131+
* tensor(s) are valid, which are expected to return a boolean. Checks whether
132+
* `cond` is true; if not, log the failed check with `message` and return false.
133+
*
134+
* @param[in] cond the condition to check
135+
* @param[in] message an additional message to log with `cond`
136+
*/
137+
#define ET_CHECK_OR_RETURN_FALSE(cond__, message__, ...) \
138+
{ \
139+
if (!(cond__)) { \
140+
ET_LOG(Error, "Check failed (%s): " message__, #cond__, ##__VA_ARGS__); \
141+
return false; \
142+
} \
143+
}
144+
129145
/**
130146
* If error__ is not Error::Ok, optionally log a message and return the error
131147
* from the current function, which must be of return type

runtime/core/exec_aten/util/tensor_util.h

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -332,35 +332,22 @@
332332
})
333333

334334
/**
335+
* DEPRECATED: Please use ET_CHECK_OR_RETURN_FALSE instead and provide
336+
* an informative message. (For example, the values of any variables used in
337+
* `cond` would not be reported automatically by this macro.)
338+
*
335339
* A convenience macro to be used in utility functions that check whether input
336340
* tensor(s) are valid, which are expected to return a boolean. Checks whether
337341
* `cond` is true; if not, log the failed check and return false.
338342
*
339343
* @param[in] cond the condition to check
340344
*/
341-
#define ET_LOG_AND_RETURN_IF_FALSE(cond) \
342-
do { \
343-
if (!(cond)) { \
344-
ET_LOG(Error, "Check failed (%s): ", #cond); \
345-
return false; \
346-
} \
347-
} while (false)
345+
#define ET_LOG_AND_RETURN_IF_FALSE(cond) ET_CHECK_OR_RETURN_FALSE(cond, "")
348346

349347
/**
350-
* A convenience macro to be used in utility functions that check whether input
351-
* tensor(s) are valid, which are expected to return a boolean. Checks whether
352-
* `cond` is true; if not, log the failed check with `message` and return false.
353-
*
354-
* @param[in] cond the condition to check
355-
* @param[in] message an additional message to log with `cond`
348+
* DEPRECATED: Please use ET_CHECK_OR_RETURN_FALSE instead.
356349
*/
357-
#define ET_LOG_MSG_AND_RETURN_IF_FALSE(cond, message, ...) \
358-
do { \
359-
if (!(cond)) { \
360-
ET_LOG(Error, "Check failed (%s): " message, #cond, ##__VA_ARGS__); \
361-
return false; \
362-
} \
363-
} while (false)
350+
#define ET_LOG_MSG_AND_RETURN_IF_FALSE ET_CHECK_OR_RETURN_FALSE
364351

365352
/**
366353
* If `cond` is false, log `cond` and return from the kernel with a failure

runtime/core/exec_aten/util/test/targets.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,6 @@ def define_common_targets():
5252
srcs = ["tensor_shape_to_c_string_test.cpp"],
5353
deps = [
5454
"//executorch/runtime/core/exec_aten/util:tensor_shape_to_c_string",
55+
"//executorch/runtime/core/exec_aten/util:tensor_util",
5556
],
5657
)

shim/xplat/executorch/build/env_interface.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ _EXTERNAL_DEPS = {
3939
"gtest_aten": "//third-party:gtest_aten",
4040
"libtorch": "//third-party:libtorch",
4141
"libtorch_python": "//third-party:libtorch_python",
42+
# Huggingface Tokenizer
43+
"nlohmann_json": [], # Intentionally not supporting OSS buck build HF tokenizer.
4244
"prettytable": "//third-party:prettytable",
4345
"pybind11": "//third-party:pybind11",
4446
"re2": "//extension/llm/third-party:re2",
47+
"sentencepiece": [], # Intentionally not supporting OSS buck build of sentencepiece.
4548
"sentencepiece-py": [],
4649
# Core C++ PyTorch functionality like Tensor and ScalarType.
4750
"torch-core-cpp": "//third-party:libtorch",

0 commit comments

Comments
 (0)