Skip to content

Commit cabe7e1

Browse files
authored
Merge branch 'pytorch:main' into main
2 parents 720ba42 + cd565b5 commit cabe7e1

File tree

6 files changed

+23
-16
lines changed

6 files changed

+23
-16
lines changed

kernels/quantized/cpu/op_quantize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ Tensor& quantize_per_channel_out(
281281
check_quantize_per_tensor_args(input, quant_min, quant_max, dtype, out);
282282

283283
// a list contains all dimensions except axis
284-
int64_t dims[input.dim() - 1];
284+
int64_t dims[kTensorDimensionLimit];
285285
for (int64_t i = 0; i < input.dim() - 1; i++) {
286286
if (i < axis) {
287287
dims[i] = i;

runtime/core/evalue.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,13 @@ struct EValue {
242242
// Template constructor that allows construction from types that can be
243243
// dereferenced to produce a type that EValue can be implicitly constructed
244244
// from.
245-
template <typename T>
246-
/*implicit*/ EValue(
247-
T&& value,
248-
typename std::enable_if<std::is_convertible<
249-
decltype(*std::forward<T>(value)),
250-
EValue>::value>::type* = 0) {
245+
template <
246+
typename T,
247+
typename = typename std::enable_if<std::is_convertible<
248+
decltype(*std::forward<T>(std::declval<T>())), // declval to simulate
249+
// forwarding
250+
EValue>::value>::type>
251+
/*implicit*/ EValue(T&& value) {
251252
ET_CHECK_MSG(value != nullptr, "Pointer is null.");
252253
// Note that this ctor does not initialize this->tag directly; it is set by
253254
// moving in the new value.

runtime/core/exec_aten/exec_aten.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#pragma once
1010

1111
#include <executorch/runtime/core/tensor_shape_dynamism.h> // @manual
12+
#include <executorch/runtime/platform/compiler.h>
1213
#ifdef USE_ATEN_LIB
1314
#include <ATen/Tensor.h> // @manual
1415
#include <c10/core/Device.h>

runtime/core/portable_type/tensor_impl.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,11 @@ Error TensorImpl::internal_resize_contiguous(ArrayRef<SizesType> new_sizes) {
110110
numel_bound_);
111111

112112
if (strides_ && dim_order_) {
113-
ET_CHECK_OK_OR_RETURN_ERROR(
114-
dim_order_to_stride(new_sizes.data(), dim_order_, dim_, strides_));
113+
auto error =
114+
dim_order_to_stride(new_sizes.data(), dim_order_, dim_, strides_);
115+
if (error != Error::Ok) {
116+
return error;
117+
}
115118
}
116119
numel_ = new_numel;
117120
std::copy(new_sizes.begin(), new_sizes.end(), sizes_);

runtime/executor/memory_manager.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,16 @@ class MemoryManager final {
6767
* TODO(T162089316): Remove this once all users migrate to the new ctor.
6868
*/
6969
ET_DEPRECATED MemoryManager(
70-
// We would normally use ET_UNUSED here, but GCC older than 9.3 has a
71-
// bug that triggers a syntax error when using [[maybe_unused]] on the
72-
// first parameter of a constructor:
73-
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81429
74-
__attribute__((unused)) MemoryAllocator* constant_allocator,
70+
MemoryAllocator* constant_allocator,
7571
HierarchicalAllocator* non_constant_allocator,
7672
MemoryAllocator* runtime_allocator,
7773
MemoryAllocator* temporary_allocator)
7874
: MemoryManager(
7975
/*method_allocator=*/runtime_allocator,
8076
/*planned_memory=*/non_constant_allocator,
81-
/*temp_allocator=*/temporary_allocator) {}
77+
/*temp_allocator=*/temporary_allocator) {
78+
(void)constant_allocator; // Suppress unused variable warning
79+
}
8280

8381
/**
8482
* Returns the allocator that the runtime will use to allocate internal

runtime/executor/program.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ Result<executorch_flatbuffer::ExecutionPlan*> get_execution_plan(
8686
} else if (eh.error() == Error::NotFound) {
8787
// No header; the program consumes the whole file, and there are no
8888
// segments.
89-
program_size = ET_UNWRAP(loader->size());
89+
auto result = loader->size();
90+
if (!result.ok()) {
91+
return result.error();
92+
}
93+
program_size = result.get();
9094
} else {
9195
ET_LOG(Error, "Extended header may be corrupt");
9296
return eh.error();

0 commit comments

Comments
 (0)