Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[executorch] Migrate runtime/executor tests to new namespace #4616

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f5bf1b2
[executorch] Migrate runtime/executor tests to new namespace
dbort Aug 9, 2024
3273e8b
Update base for Update on "[executorch] Migrate runtime/executor test…
dbort Aug 9, 2024
cd0c0b7
Update on "[executorch] Migrate runtime/executor tests to new namespace"
dbort Aug 9, 2024
d050b24
Update base for Update on "[executorch] Migrate runtime/executor test…
dbort Aug 9, 2024
7d19167
Update on "[executorch] Migrate runtime/executor tests to new namespace"
dbort Aug 9, 2024
768c28d
Update base for Update on "[executorch] Migrate runtime/executor test…
dbort Aug 9, 2024
deb5d79
Update on "[executorch] Migrate runtime/executor tests to new namespace"
dbort Aug 9, 2024
7b27f9b
Back out "Back out "[executorch][PR] Add stories ci for qnn""
cccclai Aug 14, 2024
6efc222
[llava][19/N] Add multimodal runner base class and build file
larryliu0820 Aug 14, 2024
0b51363
Add 256 constraint executorch.max_kernel_num for
devanl Aug 14, 2024
023ab35
Use MmapDataLoader::MlockConfig::NoMlock for Module::LoadMode::Mmap
kirklandsign Aug 14, 2024
2780528
Update bundle identifier.
shoumikhin Aug 14, 2024
c541bc1
Fix return type mismatch in choose_qparams_tensor_out
python3kgae Aug 14, 2024
1cb97e0
Initial Implementation of MediaTek Backend for Executorch
neuropilot-captain Aug 14, 2024
ef56414
[XNNPACK] Share workspace across delegate instances
digantdesai Aug 14, 2024
7e8a4fb
Update base for Update on "[executorch] Migrate runtime/executor test…
dbort Aug 14, 2024
d0b3fdf
Update on "[executorch] Migrate runtime/executor tests to new namespace"
dbort Aug 14, 2024
84100d1
[llava][20/N] Add llava runner using building blocks in e/llm/runner …
larryliu0820 Aug 15, 2024
f1b741e
Use the common return_type field to support ET-QNN internally and ext…
derekxu Aug 15, 2024
5c4a2a2
[MPS] Add support for Int4 groupwise quantization
DenisVieriu97 Aug 15, 2024
35a15a6
[llava] Fix llava test-model-linux CI job
larryliu0820 Aug 15, 2024
a9ed835
[Core ML] Implement intermediate tensor logging
cymbalrush Aug 15, 2024
54f8932
API life cycle and deprecation policy in official documentation
Olivia-liu Aug 15, 2024
938748b
FuseDequantLinearPass to convert dq -> linear into weight_int8packed_mm
nathanaelsee Aug 15, 2024
48b4304
Implement mm op for Arm backend
tom-arm Aug 15, 2024
35da5bf
Add event tracing and ETDumps to executor_runner
benkli01 Aug 15, 2024
caadd81
VulkanQuantizer for weight-only quantization on linear
nathanaelsee Aug 15, 2024
c4ccad3
added expand and gelu ops
zonglinpengmeta Aug 15, 2024
ba2ff63
Add QnnBackend dependency to the ET main test binary app in buck for …
derekxu Aug 15, 2024
2b9c4b2
[executorch] Migrate runtime/platform to new namespace
dbort Aug 15, 2024
9b0b8e7
Fix android perf periodic default spec
huydhn Aug 15, 2024
bf29bd6
[executorch] Migrate runtime/platform tests to new namespace
dbort Aug 15, 2024
39aeff9
Back out "Implement intermediate tensor logging"
cccclai Aug 15, 2024
2dcf0f3
cria runner
cccclai Aug 15, 2024
ae299cf
[executorch] Migrate runtime/core to new namespace
dbort Aug 15, 2024
3e4508a
Refactor delegation code
angelayi Aug 15, 2024
f25f135
[executorch] Migrate runtime/core tests to new namespace
dbort Aug 15, 2024
aead1d5
Revert "Add event tracing and ETDumps to executor_runner"
GregoryComer Aug 15, 2024
9a98abb
Back out "Back out "[executorch][PR] [Core ML] Implement intermediate…
cccclai Aug 15, 2024
add6e2e
Support mutable tensors in TensorParser
JacobSzwejbka Aug 16, 2024
5c9a00a
Make the Module non-movable.
shoumikhin Aug 16, 2024
09ab2f3
Update base for Update on "[executorch] Migrate runtime/executor test…
dbort Aug 16, 2024
718d145
Update on "[executorch] Migrate runtime/executor tests to new namespace"
dbort Aug 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions backends/apple/coreml/runtime/sdk/model_event_logger_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#import <CoreML/CoreML.h>
#import <model_event_logger.h>

namespace torch::executor {
namespace executorch::runtime {
class EventTracer;
}

Expand All @@ -21,7 +21,7 @@ namespace executorchcoreml {
class ModelEventLoggerImpl final : public ModelEventLogger {
public:
/// Construct a `ModelEventLoggerImpl` from the `EventTracer`.
explicit ModelEventLoggerImpl(torch::executor::EventTracer* tracer) : tracer_(tracer) { }
explicit ModelEventLoggerImpl(::executorch::runtime::EventTracer* tracer) : tracer_(tracer) { }

/// Logs profiling infos.
///
Expand All @@ -44,6 +44,6 @@ class ModelEventLoggerImpl final : public ModelEventLogger {
NSDictionary<ETCoreMLModelStructurePath*, NSString*>* op_path_to_debug_symbol_name_map) const noexcept override;

private:
torch::executor::EventTracer* tracer_;
::executorch::runtime::EventTracer* tracer_;
};
} // namespace executorchcoreml
3 changes: 0 additions & 3 deletions extension/aten_util/make_aten_functor_from_et_functor.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
namespace torch {
namespace executor {

class KernelRuntimeContext; // Forward declaration
using RuntimeContext = KernelRuntimeContext; // TODO(T147221312): Remove

// Map types from ETen to ATen.
// This is used to convert ETen arguments into ATen.
template <typename T>
Expand Down
46 changes: 27 additions & 19 deletions extension/evalue_util/print_evalue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
#include <ostream>
#include <sstream>

namespace torch {
namespace executor {
using exec_aten::ScalarType;

namespace executorch {
namespace extension {

namespace {

Expand Down Expand Up @@ -102,7 +104,7 @@ void print_scalar_list(
// We've printed a full line, so wrap and begin a new one.
os << "\n ";
}
os << EValue(exec_aten::Scalar(list[i]));
os << executorch::runtime::EValue(exec_aten::Scalar(list[i]));
if (wrapping || i < list.size() - 1) {
// No trailing comma when not wrapping. Always a trailing comma when
// wrapping. This will leave a trailing space at the end of every wrapped
Expand Down Expand Up @@ -149,12 +151,13 @@ void print_tensor(std::ostream& os, exec_aten::Tensor tensor) {
//
// TODO(T159700776): Format multidimensional data like numpy/PyTorch does.
// https://github.com/pytorch/pytorch/blob/main/torch/_tensor_str.py
#define PRINT_TENSOR_DATA(ctype, dtype) \
case ScalarType::dtype: \
print_scalar_list( \
os, \
ArrayRef<ctype>(tensor.const_data_ptr<ctype>(), tensor.numel()), \
/*print_length=*/false); \
#define PRINT_TENSOR_DATA(ctype, dtype) \
case ScalarType::dtype: \
print_scalar_list( \
os, \
exec_aten::ArrayRef<ctype>( \
tensor.const_data_ptr<ctype>(), tensor.numel()), \
/*print_length=*/false); \
break;

switch (tensor.scalar_type()) {
Expand Down Expand Up @@ -211,7 +214,20 @@ void print_list_optional_tensor(

} // namespace

void evalue_edge_items::set_edge_items(std::ostream& os, long edge_items) {
os.iword(get_edge_items_xalloc()) = edge_items;
}

} // namespace extension
} // namespace executorch

namespace executorch {
namespace runtime {

// This needs to live in the same namespace as EValue.
std::ostream& operator<<(std::ostream& os, const EValue& value) {
using namespace executorch::extension;

switch (value.tag) {
case Tag::None:
os << "None";
Expand Down Expand Up @@ -258,13 +274,5 @@ std::ostream& operator<<(std::ostream& os, const EValue& value) {
return os;
}

namespace util {

void evalue_edge_items::set_edge_items(std::ostream& os, long edge_items) {
os.iword(get_edge_items_xalloc()) = edge_items;
}

} // namespace util

} // namespace executor
} // namespace torch
} // namespace runtime
} // namespace executorch
19 changes: 15 additions & 4 deletions extension/evalue_util/print_evalue.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@

#include <executorch/runtime/core/evalue.h>

namespace torch {
namespace executor {

namespace executorch {
namespace runtime {
/**
* Prints an Evalue to a stream.
*/
std::ostream& operator<<(std::ostream& os, const EValue& value);
// Note that this must be declared in the same namespace as EValue.
} // namespace runtime
} // namespace executorch

namespace util {
namespace executorch {
namespace extension {

/**
* Sets the number of "edge items" when printing EValue lists to a stream.
Expand Down Expand Up @@ -67,6 +69,15 @@ class evalue_edge_items final {
const long edge_items_;
};

} // namespace extension
} // namespace executorch

namespace torch {
namespace executor {
namespace util {
// TODO(T197294990): Remove these deprecated aliases once all users have moved
// to the new `::executorch` namespaces.
using ::executorch::extension::evalue_edge_items;
} // namespace util
} // namespace executor
} // namespace torch
24 changes: 15 additions & 9 deletions extension/kernel_util/make_boxed_from_unboxed_functor.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
/// Example usage:
/// ```
/// Tensor&
/// my_op(RuntimeContext& ctx, const Tensor& self, const Tensor& other, Tensor&
/// out) {
/// my_op(KernelRuntimeContext& ctx, const Tensor& self, const Tensor& other,
/// Tensor& out)
/// {
/// // ...
/// return out;
/// }
Expand Down Expand Up @@ -47,12 +48,15 @@
#include <type_traits>
#include <typeinfo>

namespace executorch {
namespace runtime {
class KernelRuntimeContext; // Forward declaration
} // namespace runtime
} // namespace executorch

namespace torch {
namespace executor {

class KernelRuntimeContext; // Forward declaration
using RuntimeContext = KernelRuntimeContext; // TODO(T147221312): Remove

// evalue_to_arg
template <class T>
struct decay_if_not_tensor final {
Expand Down Expand Up @@ -106,7 +110,7 @@ struct evalue_to_arg<exec_aten::ArrayRef<exec_aten::optional<T>>> final {

template <class Functor, size_t... evalue_arg_indices, typename... ArgTypes>
void call_functor_with_args_from_stack_(
RuntimeContext& ctx,
::executorch::runtime::KernelRuntimeContext& ctx,
EValue** stack,
std::index_sequence<evalue_arg_indices...>,
typelist<ArgTypes...>*) {
Expand All @@ -129,16 +133,18 @@ struct WrapUnboxedIntoFunctor {
using TrueType = typename FuncType::FuncType;
using ReturnType = typename infer_function_traits_t<TrueType>::return_type;
using ArgsType = typename infer_function_traits_t<TrueType>::parameter_types;
// check if the first argument is RuntimeContext, if so, remove it
// check if the first argument is KernelRuntimeContext, if so, remove it
static constexpr bool first_arg_is_context = std::is_same<
RuntimeContext,
::executorch::runtime::KernelRuntimeContext,
std::remove_reference_t<head_with_default_t<void, ArgsType>>>::value;
using ContextRemovedArgsType = std::conditional_t<
first_arg_is_context,
drop_if_nonempty_t<ArgsType, 1>,
ArgsType>;

static void call(RuntimeContext& ctx, EValue** stack) {
static void call(
::executorch::runtime::KernelRuntimeContext& ctx,
EValue** stack) {
constexpr size_t num_inputs = size<ContextRemovedArgsType>::value;
return call_functor_with_args_from_stack_<FuncType>(
ctx,
Expand Down
12 changes: 10 additions & 2 deletions runtime/backend/backend_execution_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include <executorch/runtime/core/event_tracer.h>
#include <executorch/runtime/core/memory_allocator.h>

namespace torch {
namespace executor {
namespace executorch {
namespace runtime {

/**
* BackendExecutionContext will be used to inject run time context.
Expand Down Expand Up @@ -57,5 +57,13 @@ class BackendExecutionContext final {
MemoryAllocator* temp_allocator_ = nullptr;
};

} // namespace runtime
} // namespace executorch

namespace torch {
namespace executor {
// TODO(T197294990): Remove these deprecated aliases once all users have moved
// to the new `::executorch` namespaces.
using ::executorch::runtime::BackendExecutionContext;
} // namespace executor
} // namespace torch
12 changes: 10 additions & 2 deletions runtime/backend/backend_init_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#pragma once
#include <executorch/runtime/core/memory_allocator.h>

namespace torch {
namespace executor {
namespace executorch {
namespace runtime {

/**
* BackendInitContext will be used to inject runtime info for to initialize
Expand All @@ -33,5 +33,13 @@ class BackendInitContext final {
MemoryAllocator* runtime_allocator_ = nullptr;
};

} // namespace runtime
} // namespace executorch

namespace torch {
namespace executor {
// TODO(T197294990): Remove these deprecated aliases once all users have moved
// to the new `::executorch` namespaces.
using ::executorch::runtime::BackendInitContext;
} // namespace executor
} // namespace torch
10 changes: 5 additions & 5 deletions runtime/backend/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
#include <executorch/runtime/backend/interface.h>
#include <executorch/runtime/platform/assert.h>

namespace torch {
namespace executor {
namespace executorch {
namespace runtime {

PyTorchBackendInterface::~PyTorchBackendInterface() {}

// Task t128866626: Remove global static variables.
// TODO(T128866626): Remove global static variables.
// We want to be able to run multiple Executor instances
// and having a global registration isn't a viable solution
// in the long term.
Expand Down Expand Up @@ -56,5 +56,5 @@ Error BackendRegistry::register_backend(const Backend& backend) {
return Error::Ok;
}

} // namespace executor
} // namespace torch
} // namespace runtime
} // namespace executorch
20 changes: 18 additions & 2 deletions runtime/backend/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include <executorch/runtime/core/result.h>
#include <executorch/runtime/platform/compiler.h>

namespace torch {
namespace executor {
namespace executorch {
namespace runtime {

struct SizedBuffer {
void* buffer;
Expand Down Expand Up @@ -170,5 +170,21 @@ PyTorchBackendInterface* get_backend_class(const char* name);
*/
__ET_NODISCARD Error register_backend(const Backend& backend);

} // namespace runtime
} // namespace executorch

namespace torch {
namespace executor {
// TODO(T197294990): Remove these deprecated aliases once all users have moved
// to the new `::executorch` namespaces.
using ::executorch::runtime::Backend;
using ::executorch::runtime::BackendRegistry;
using ::executorch::runtime::CompileSpec;
using ::executorch::runtime::DelegateHandle;
using ::executorch::runtime::get_backend_class;
// using ::executorch::runtime::kRegistrationTableMaxSize;
using ::executorch::runtime::PyTorchBackendInterface;
using ::executorch::runtime::register_backend;
using ::executorch::runtime::SizedBuffer;
} // namespace executor
} // namespace torch
14 changes: 12 additions & 2 deletions runtime/core/array_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

#include <executorch/runtime/platform/assert.h>

namespace torch {
namespace executor {
namespace executorch {
namespace runtime {

/**
* Represents a constant reference to an array (0 or more elements
Expand Down Expand Up @@ -236,5 +236,15 @@ bool operator!=(ArrayRef<T> a1, ArrayRef<T> a2) {

using IntArrayRef = ArrayRef<int64_t>;

} // namespace runtime
} // namespace executorch

namespace torch {
namespace executor {
// TODO(T197294990): Remove these deprecated aliases once all users have moved
// to the new `::executorch` namespaces.
using ::executorch::runtime::ArrayRef;
using ::executorch::runtime::IntArrayRef;
using ::executorch::runtime::makeArrayRef;
} // namespace executor
} // namespace torch
12 changes: 10 additions & 2 deletions runtime/core/data_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include <executorch/runtime/core/result.h>
#include <executorch/runtime/platform/compiler.h>

namespace torch {
namespace executor {
namespace executorch {
namespace runtime {

/**
* Loads from a data source.
Expand Down Expand Up @@ -125,5 +125,13 @@ class DataLoader {
__ET_NODISCARD virtual Result<size_t> size() const = 0;
};

} // namespace runtime
} // namespace executorch

namespace torch {
namespace executor {
// TODO(T197294990): Remove these deprecated aliases once all users have moved
// to the new `::executorch` namespaces.
using ::executorch::runtime::DataLoader;
} // namespace executor
} // namespace torch
Loading
Loading