Skip to content

Commit a06b450

Browse files
dbortfacebook-github-bot
authored andcommitted
Fix various lint warnings under runtime/executor/... (#1589)
Summary: Pull Request resolved: #1589 Fix a bunch of clang-tidy warnings hit when building .cpp/.h files under runtime/executor/..., which can also include .h files included by those .cpp files. Reviewed By: larryliu0820 Differential Revision: D52717684 fbshipit-source-id: c882a9ac72981d364a9e58c24b1fc0ec19740c03
1 parent 54b2e0a commit a06b450

18 files changed

Lines changed: 18 additions & 27 deletions

runtime/backend/backend_init_context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace executor {
1818
*/
1919
class BackendInitContext final {
2020
public:
21-
BackendInitContext(MemoryAllocator* runtime_allocator)
21+
explicit BackendInitContext(MemoryAllocator* runtime_allocator)
2222
: runtime_allocator_(runtime_allocator) {}
2323

2424
/** Get the runtime allocator passed from Method. It's the same runtime

runtime/core/exec_aten/exec_aten.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ using ArrayRef = torch::executor::ArrayRef<T>;
9393
template <typename T>
9494
using optional = torch::executor::optional<T>;
9595
using nullopt_t = torch::executor::nullopt_t;
96+
// NOLINTNEXTLINE(facebook-hte-NamespaceScopedStaticDeclaration)
9697
static constexpr nullopt_t nullopt{0};
9798
using ScalarType = torch::executor::ScalarType;
9899
using TensorList = ArrayRef<Tensor>;

runtime/core/exec_aten/util/tensor_util.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -714,16 +714,6 @@ inline bool tensors_have_same_shape_and_dtype(
714714
return tensors_have_same_shape(a, b, c) && tensors_have_same_dtype(a, b, c);
715715
}
716716

717-
#define ET_CHECK_DEFAULT_OR_CHANNELSLAST_DIMORDER(t__) \
718-
({ \
719-
ET_CHECK_MSG( \
720-
is_default_dim_order( \
721-
t__.dim_order().data(), t__.dim_order().size()) || \
722-
is_channels_last_dim_order( \
723-
t__.dim_order().data(), t__.dim_order().size()), \
724-
"Tensor must have default or channels last dim order"); \
725-
})
726-
727717
inline bool tensor_has_expected_size(
728718
exec_aten::Tensor a,
729719
exec_aten::ArrayRef<exec_aten::SizesType> expected_sizes) {

runtime/executor/method.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@
88

99
#include <executorch/runtime/executor/method.h>
1010

11-
#include <cinttypes>
11+
#include <cinttypes> // @donotremove
1212
#include <cstdint>
1313
#include <cstdio>
1414

1515
#include <executorch/runtime/backend/interface.h>
1616
#include <executorch/runtime/core/event_tracer_hooks.h>
17-
#include <executorch/runtime/core/exec_aten/util/dim_order_util.h>
18-
#include <executorch/runtime/core/exec_aten/util/scalar_type_util.h>
1917
#include <executorch/runtime/core/exec_aten/util/tensor_util.h>
2018
#include <executorch/runtime/core/span.h>
2119
#include <executorch/runtime/executor/memory_manager.h>

runtime/executor/targets.bzl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ def define_common_targets():
6565
deps = [
6666
"//executorch/kernels/prim_ops:prim_ops_registry" + aten_suffix,
6767
"//executorch/runtime/backend:interface",
68-
"//executorch/runtime/core/exec_aten/util:dim_order_util",
69-
"//executorch/runtime/core/exec_aten/util:scalar_type_util",
7068
"//executorch/runtime/core/exec_aten/util:tensor_util" + aten_suffix,
7169
"//executorch/runtime/core:core",
7270
"//executorch/runtime/kernel:kernel_runtime_context" + aten_suffix,

runtime/executor/tensor_parser_aten.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <executorch/runtime/platform/profiler.h>
1616
#include <executorch/schema/program_generated.h>
1717

18-
#include <ATen/ATen.h> // @manual=//caffe2/aten:ATen-core
18+
#include <ATen/ATen.h> // @donotremove @manual=//caffe2/aten:ATen-core
1919

2020
namespace torch {
2121
namespace executor {

runtime/executor/tensor_parser_exec_aten.cpp

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

1111
#include <executorch/runtime/core/evalue.h>
1212
#include <executorch/runtime/core/exec_aten/exec_aten.h>
13-
#include <executorch/runtime/core/exec_aten/util/dim_order_util.h>
1413
#include <executorch/runtime/executor/memory_manager.h>
1514
#include <executorch/runtime/executor/program.h>
1615
#include <executorch/runtime/platform/profiler.h>

runtime/executor/tensor_parser_portable.cpp

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

99
#include <executorch/runtime/executor/tensor_parser.h>
1010

11-
#include <executorch/runtime/core/evalue.h>
1211
#include <executorch/runtime/core/exec_aten/exec_aten.h>
1312
#include <executorch/runtime/core/exec_aten/util/dim_order_util.h>
1413
#include <executorch/runtime/core/exec_aten/util/scalar_type_util.h>

runtime/executor/test/allocation_failure_stress_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ constexpr size_t kDefaultRuntimeMemBytes = 32 * 1024U;
3939
class AllocationFailureStressTest : public ::testing::Test {
4040
protected:
4141
void SetUp() override {
42+
torch::executor::runtime_init();
43+
4244
// Create a loader for the serialized ModuleAdd program.
4345
const char* path = std::getenv("ET_MODULE_ADD_PATH");
4446
Result<FileDataLoader> loader = FileDataLoader::from(path);

runtime/executor/test/kernel_integration_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ KernelControl KernelControl::singleton_;
129129
class KernelIntegrationTest : public ::testing::Test {
130130
protected:
131131
void SetUp() override {
132+
torch::executor::runtime_init();
133+
132134
// Register the controllable kernel hook.
133135
KernelControl::register_singleton();
134136
// Ensure that its state is clear.

0 commit comments

Comments
 (0)