Skip to content

Commit a516b58

Browse files
authored
Merge branch 'main' into build-tools
2 parents ae0015d + 4e1d2e5 commit a516b58

File tree

28 files changed

+34
-317
lines changed

28 files changed

+34
-317
lines changed

.ci/docker/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ case "${IMAGE_NAME}" in
4848
executorch-ubuntu-22.04-mediatek-sdk)
4949
MEDIATEK_SDK=yes
5050
CLANG_VERSION=12
51+
ANDROID_NDK_VERSION=r27b
5152
;;
5253
executorch-ubuntu-22.04-clang12-android)
5354
LINTRUNNER=""
File renamed without changes.

.github/workflows/apple.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
- build/build_apple_frameworks.sh
1515
- build/build_apple_llm_demo.sh
1616
- build/create_frameworks.sh
17-
- build/test_ios_ci.sh
17+
- .ci/scripts/test_ios_ci.sh
1818
- examples/demo-apps/apple_ios/**
1919
- extension/apple/**
2020
- extension/benchmark/apple/**
@@ -75,7 +75,7 @@ jobs:
7575
7676
# Build and test iOS Demo App
7777
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
78-
build/test_ios_ci.sh "${ARTIFACTS_DIR_NAME}"
78+
.ci/scripts/test_ios_ci.sh "${ARTIFACTS_DIR_NAME}"
7979
8080
# Upload the test demo app to S3
8181
upload-demo-ios:

backends/xnnpack/operators/node_visitor.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# LICENSE file in the root directory of this source tree.
66

77
import ctypes
8+
import hashlib
89

910
from typing import cast, Dict, List, Optional, Tuple
1011

@@ -34,7 +35,6 @@
3435
check_or_raise,
3536
get_input_node,
3637
get_param_tensor,
37-
get_tensor_name,
3838
is_param_node,
3939
PERM_NCHW_TO_NHWC,
4040
)
@@ -576,15 +576,19 @@ def get_serialized_buffer_index(
576576
if quant_params is not None and quant_params.is_qc4w:
577577
const_val = self.convert_to_qc4w(const_val)
578578

579-
array_type = ctypes.c_char * const_val.untyped_storage().nbytes()
579+
size = const_val.untyped_storage().nbytes()
580+
array_type = ctypes.c_char * size
580581
array = ctypes.cast(
581582
const_val.untyped_storage().data_ptr(),
582583
ctypes.POINTER(array_type),
583584
).contents
584585

585-
named_key = get_tensor_name(self.exported_program, get_attr_node)
586-
if named_key == "":
587-
raise ValueError(f"Tensor from node: {get_attr_node} has no name")
586+
check_or_raise(
587+
size > 0,
588+
f"Serializing constant data node {tensor} but tensor value has no bytes",
589+
)
590+
sha256_hash = hashlib.sha256(bytes(array))
591+
named_key = sha256_hash.hexdigest()
588592

589593
size = const_val.untyped_storage().nbytes()
590594
xnn_graph.constant_data.append(

devtools/etdump/tests/targets.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ def define_common_targets():
1515
deps = [
1616
"//executorch/devtools/etdump:etdump_flatcc",
1717
"//executorch/devtools/etdump:etdump_schema_flatcc",
18+
"//executorch/devtools/etdump/data_sinks:file_data_sink",
19+
"//executorch/extension/testing_util:temp_file",
1820
"//executorch/runtime/platform:platform",
1921
"//executorch/runtime/core/exec_aten/testing_util:tensor_util",
2022
],

devtools/inspector/_inspector.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,10 @@ def find_total_for_module(self, module_name: str) -> float:
12241224
total = 0.0
12251225
for block in self.event_blocks:
12261226
for event in block.events:
1227+
# Skip OPERATOR_CALL events to avoid double-counting and exclude framework tax
1228+
if event.event_name == "OPERATOR_CALL":
1229+
continue
1230+
12271231
module_hierarchy = event.module_hierarchy.values()
12281232
for hierarchy in module_hierarchy:
12291233
if not hierarchy:

extension/apple/ExecutorchRuntime/ExecutorchRuntime/ExecutorchRuntime.swift

Lines changed: 0 additions & 34 deletions
This file was deleted.

extension/apple/ExecutorchRuntime/ExecutorchRuntime/__tests__/ExecutorchRuntimeTests.swift

Lines changed: 0 additions & 30 deletions
This file was deleted.

extension/apple/ExecutorchRuntimeBridge/ExecutorchRuntimeBridge/Exported/Data/ExecutorchRuntimeTensorValue.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
#import <executorch/extension/module/module.h>
1111
#import <executorch/runtime/core/evalue.h>
1212
#endif
13-
#import <ModelRunnerDataKit/ModelRunnerDataKit-Swift.h>
13+
#import <RuntimeBridgingCore/RuntimeBridgingCore-Swift.h>
1414

1515
NS_ASSUME_NONNULL_BEGIN
1616

17-
@interface ExecutorchRuntimeTensorValue : NSObject <ModelRuntimeTensorValueBridging>
17+
@interface ExecutorchRuntimeTensorValue : NSObject
1818

1919
- (instancetype)init NS_UNAVAILABLE;
2020
+ (instancetype)new NS_UNAVAILABLE;
@@ -28,6 +28,9 @@ NS_ASSUME_NONNULL_BEGIN
2828
- (torch::executor::Tensor)backedValue;
2929
#endif
3030

31+
#pragma mark -
32+
- (ModelRuntimeTensorValueBridgingTuple * _Nullable)floatRepresentationAndReturnError:(NSError * _Nullable * _Nullable)error SWIFT_WARN_UNUSED_RESULT;
33+
3134
@end
3235

3336
NS_ASSUME_NONNULL_END

extension/apple/ExecutorchRuntimeBridge/ExecutorchRuntimeBridge/Exported/Data/ExecutorchRuntimeValue.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
#import <executorch/runtime/core/evalue.h>
1212
#endif
1313

14-
#import <ModelRunnerDataKit/ModelRunnerDataKit-Swift.h>
14+
#import <RuntimeBridgingCore/RuntimeBridgingCore-Swift.h>
1515

1616
#import "ExecutorchRuntimeTensorValue.h"
1717

1818
NS_ASSUME_NONNULL_BEGIN
1919

20-
@interface ExecutorchRuntimeValue : NSObject <ModelRuntimeValueBridging>
20+
@interface ExecutorchRuntimeValue : NSObject
2121

2222
- (instancetype)init NS_UNAVAILABLE;
2323
+ (instancetype)new NS_UNAVAILABLE;
@@ -29,6 +29,9 @@ NS_ASSUME_NONNULL_BEGIN
2929
- (torch::executor::EValue)getBackedValue;
3030
#endif
3131

32+
#pragma mark -
33+
- (ExecutorchRuntimeTensorValue *_Nullable)asTensorValueAndReturnError:(NSError * _Nullable * _Nullable)error SWIFT_WARN_UNUSED_RESULT;
34+
3235
@end
3336

3437
NS_ASSUME_NONNULL_END

extension/apple/ExecutorchRuntimeBridge/ExecutorchRuntimeBridge/Exported/Data/ExecutorchRuntimeValue.mm

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,7 @@ - (instancetype)initWithTensor:(ExecutorchRuntimeTensorValue *)tensorValue
4141
return self;
4242
}
4343

44-
- (nullable NSString *)stringValueAndReturnError:(NSError * _Nullable * _Nullable)error
45-
{
46-
if (error) {
47-
*error = [ModelRuntimeValueErrorFactory unsupportedType:@"ExecutorchRuntimeValue doesn't support strings"];
48-
}
49-
return nil;
50-
}
51-
52-
- (nullable id<ModelRuntimeTensorValueBridging>)tensorValueAndReturnError:(NSError * _Nullable * _Nullable)error
44+
- (nullable ExecutorchRuntimeTensorValue *)asTensorValueAndReturnError:(NSError * _Nullable * _Nullable)error
5345
{
5446
if (_value.isTensor()) {
5547
return [[ExecutorchRuntimeTensorValue alloc] initWithTensor:_value.toTensor() error:error];
@@ -68,12 +60,4 @@ - (EValue)getBackedValue
6860
return _value;
6961
}
7062

71-
- (NSArray<id<ModelRuntimeValueBridging>> *)arrayValueAndReturnError:(NSError * _Nullable * _Nullable)error
72-
{
73-
if (error) {
74-
*error = [ModelRuntimeValueErrorFactory unsupportedType:@"EValue doesn't support arrays"];
75-
}
76-
return nil;
77-
}
78-
7963
@end

extension/apple/ExecutorchRuntimeBridge/ExecutorchRuntimeBridge/__tests__/ExecutorchRuntimeEngineTests.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ - (void)testValidModel
5151
XCTAssertEqual(output.count, 1);
5252
NSError *tensorValueError = nil;
5353
NSError *floatRepresentationError = nil;
54-
const auto resultTensorValue = [[output.firstObject tensorValueAndReturnError:&tensorValueError]
54+
const auto resultTensorValue = [[output.firstObject asTensorValueAndReturnError:&tensorValueError]
5555
floatRepresentationAndReturnError:&floatRepresentationError];
5656

5757
XCTAssertNil(tensorValueError);

extension/apple/ExecutorchRuntimeBridge/ExecutorchRuntimeBridge/__tests__/ExecutorchRuntimeValueTests.mm

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#import <XCTest/XCTest.h>
1010

1111
#import <ExecutorchRuntimeBridge/ExecutorchRuntimeValue.h>
12-
#import <ModelRunnerDataKit/ModelRunnerDataKit-Swift.h>
1312
#import <executorch/extension/module/module.h>
1413

1514
using torch::executor::EValue;
@@ -21,16 +20,6 @@ @interface ExecutorchRuntimeValueTests : XCTestCase
2120

2221
@implementation ExecutorchRuntimeValueTests
2322

24-
- (void)testStringValueWithError
25-
{
26-
ExecutorchRuntimeValue *value = [[ExecutorchRuntimeValue alloc] initWithEValue:EValue((int64_t)1)];
27-
XCTAssertNil([value stringValueAndReturnError:nil]);
28-
NSError *error = nil;
29-
XCTAssertNil([value stringValueAndReturnError:&error]);
30-
XCTAssertNotNil(error);
31-
XCTAssertEqualObjects([error description], @"Unsupported type: ExecutorchRuntimeValue doesn't support strings");
32-
}
33-
3423
- (void)testTensorValue
3524
{
3625
NSMutableArray *data = [NSMutableArray new];
@@ -63,9 +52,9 @@ - (void)testTensorValueWithFloatArrayWithError
6352
- (void)testTensorValueWithError
6453
{
6554
ExecutorchRuntimeValue *value = [[ExecutorchRuntimeValue alloc] initWithEValue:EValue((int64_t)1)];
66-
XCTAssertNil([value tensorValueAndReturnError:nil]);
55+
XCTAssertNil([value asTensorValueAndReturnError:nil]);
6756
NSError *error = nil;
68-
XCTAssertNil([value tensorValueAndReturnError:&error]);
57+
XCTAssertNil([value asTensorValueAndReturnError:&error]);
6958
XCTAssertNotNil(error);
7059
XCTAssertEqualObjects([error description], @"Invalid type: Tag::4, expected Tag::Tensor");
7160
}

extension/apple/ExecutorchRuntimeValueSupport/ExecutorchRuntimeValueSupport/ExecutorchRuntimeValueSupport.swift

Lines changed: 0 additions & 45 deletions
This file was deleted.

extension/apple/ExecutorchRuntimeValueSupport/ExecutorchRuntimeValueSupport/__tests__/ExecutorchRuntimeValueSupportTests.swift

Lines changed: 0 additions & 48 deletions
This file was deleted.

extension/apple/ModelRunnerDataKit/ModelRunnerDataKit/ModelRuntime.swift

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)