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 exec_aten util tests to new namespace #4610

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
c7cf226
[executorch] Migrate exec_aten util tests to new namespace
dbort Aug 9, 2024
fb2e5be
Update base for Update on "[executorch] Migrate exec_aten util tests …
dbort Aug 9, 2024
5a7f6a2
Update on "[executorch] Migrate exec_aten util tests to new namespace"
dbort Aug 9, 2024
1ed97bb
Update base for Update on "[executorch] Migrate exec_aten util tests …
dbort Aug 9, 2024
f05ee73
Update on "[executorch] Migrate exec_aten util tests to new namespace"
dbort Aug 9, 2024
8278c2e
Update base for Update on "[executorch] Migrate exec_aten util tests …
dbort Aug 9, 2024
3f438f4
Update on "[executorch] Migrate exec_aten util 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
3ff9787
Update base for Update on "[executorch] Migrate exec_aten util tests …
dbort Aug 14, 2024
87c2a13
Update on "[executorch] Migrate exec_aten util 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
cbf86e5
Update base for Update on "[executorch] Migrate exec_aten util tests …
dbort Aug 16, 2024
b541d94
Update on "[executorch] Migrate exec_aten util 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
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
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
33 changes: 21 additions & 12 deletions runtime/core/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

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

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

// Alias error code integral type to minimal platform width (32-bits for now).
typedef uint32_t error_code_t;
Expand Down Expand Up @@ -92,13 +92,22 @@ enum class Error : error_code_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::Error;
using ::executorch::runtime::error_code_t;
} // namespace executor
} // namespace torch

/**
* If cond__ is false, log the specified message and return the specified Error
* from the current function, which must be of return type
* torch::executor::Error.
* executorch::runtime::Error.
*
* @param[in] cond__ The condition to be checked, asserted as true.
* @param[in] error__ Error enum value to return without the `Error::` prefix,
Expand All @@ -110,14 +119,14 @@ enum class Error : error_code_t {
{ \
if (!(cond__)) { \
ET_LOG(Error, message__, ##__VA_ARGS__); \
return ::torch::executor::Error::error__; \
return ::executorch::runtime::Error::error__; \
} \
}

/**
* If error__ is not Error::Ok, optionally log a message and return the error
* from the current function, which must be of return type
* torch::executor::Error.
* executorch::runtime::Error.
*
* @param[in] error__ Error enum value asserted to be Error::Ok.
* @param[in] ... Optional format string for the log error message and its
Expand Down Expand Up @@ -161,19 +170,19 @@ enum class Error : error_code_t {
ET_INTERNAL_CHECK_OK_OR_RETURN_ERROR_##N

// Internal only: Use ET_CHECK_OK_OR_RETURN_ERROR() instead.
#define ET_INTERNAL_CHECK_OK_OR_RETURN_ERROR_1(error__) \
do { \
const auto et_error__ = (error__); \
if (et_error__ != ::torch::executor::Error::Ok) { \
return et_error__; \
} \
#define ET_INTERNAL_CHECK_OK_OR_RETURN_ERROR_1(error__) \
do { \
const auto et_error__ = (error__); \
if (et_error__ != ::executorch::runtime::Error::Ok) { \
return et_error__; \
} \
} while (0)

// Internal only: Use ET_CHECK_OK_OR_RETURN_ERROR() instead.
#define ET_INTERNAL_CHECK_OK_OR_RETURN_ERROR_2(error__, message__, ...) \
do { \
const auto et_error__ = (error__); \
if (et_error__ != ::torch::executor::Error::Ok) { \
if (et_error__ != ::executorch::runtime::Error::Ok) { \
ET_LOG(Error, message__, ##__VA_ARGS__); \
return et_error__; \
} \
Expand Down
8 changes: 4 additions & 4 deletions runtime/core/evalue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

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

namespace torch {
namespace executor {
namespace executorch {
namespace runtime {
template <>
exec_aten::ArrayRef<exec_aten::optional<exec_aten::Tensor>>
BoxedEvalueList<exec_aten::optional<exec_aten::Tensor>>::get() const {
Expand All @@ -27,5 +27,5 @@ BoxedEvalueList<exec_aten::optional<exec_aten::Tensor>>::get() const {
return exec_aten::ArrayRef<exec_aten::optional<exec_aten::Tensor>>{
unwrapped_vals_, wrapped_vals_.size()};
}
} // namespace executor
} // namespace torch
} // namespace runtime
} // namespace executorch
35 changes: 27 additions & 8 deletions runtime/core/evalue.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
#include <executorch/runtime/core/tag.h>
#include <executorch/runtime/platform/assert.h>

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

struct EValue;

namespace internal {

// Tensor gets proper reference treatment because its expensive to copy in aten
// mode, all other types are just copied.
template <typename T>
Expand All @@ -38,6 +40,8 @@ struct evalue_to_ref_overload_return<exec_aten::Tensor> {
using type = exec_aten::Tensor&;
};

} // namespace internal

/*
* Helper class used to correlate EValues in the executor table, with the
* unwrapped list of the proper type. Because values in the runtime's values
Expand Down Expand Up @@ -371,9 +375,9 @@ struct EValue {
template <typename T>
T to() &&;
template <typename T>
typename evalue_to_const_ref_overload_return<T>::type to() const&;
typename internal::evalue_to_const_ref_overload_return<T>::type to() const&;
template <typename T>
typename evalue_to_ref_overload_return<T>::type to() &;
typename internal::evalue_to_ref_overload_return<T>::type to() &;

/**
* Converts the EValue to an optional object that can represent both T and
Expand Down Expand Up @@ -441,13 +445,19 @@ struct EValue {
return static_cast<T>(std::move(*this).method_name()); \
} \
template <> \
inline evalue_to_const_ref_overload_return<T>::type EValue::to<T>() const& { \
typedef evalue_to_const_ref_overload_return<T>::type return_type; \
inline ::executorch::runtime::internal::evalue_to_const_ref_overload_return< \
T>::type \
EValue::to<T>() const& { \
typedef ::executorch::runtime::internal:: \
evalue_to_const_ref_overload_return<T>::type return_type; \
return static_cast<return_type>(this->method_name()); \
} \
template <> \
inline evalue_to_ref_overload_return<T>::type EValue::to<T>()& { \
typedef evalue_to_ref_overload_return<T>::type return_type; \
inline ::executorch::runtime::internal::evalue_to_ref_overload_return< \
T>::type \
EValue::to<T>()& { \
typedef ::executorch::runtime::internal::evalue_to_ref_overload_return< \
T>::type return_type; \
return static_cast<return_type>(this->method_name()); \
}

Expand Down Expand Up @@ -507,5 +517,14 @@ exec_aten::ArrayRef<T> BoxedEvalueList<T>::get() const {
return exec_aten::ArrayRef<T>{unwrapped_vals_, wrapped_vals_.size()};
}

} // 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::BoxedEvalueList;
using ::executorch::runtime::EValue;
} // namespace executor
} // namespace torch
Loading
Loading