Skip to content

Commit 709deb0

Browse files
authored
Merge branch 'main' into recurrent-fla
2 parents 8d35c65 + 300e368 commit 709deb0

File tree

61 files changed

+1357
-596
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1357
-596
lines changed

.ci/scripts/export_model_artifact.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ if [ "$MODEL_NAME" = "voxtral_realtime" ]; then
358358
STREAMING_ARG=""
359359
PREPROCESSOR_ARGS="--feature_size 128 --output_file ${OUTPUT_DIR}/preprocessor.pte"
360360
if [ "$USE_STREAMING" = "true" ]; then
361-
STREAMING_ARG="--streaming"
361+
STREAMING_ARG="--streaming --sliding-window 2048"
362362
PREPROCESSOR_ARGS="$PREPROCESSOR_ARGS --streaming"
363363
else
364364
PREPROCESSOR_ARGS="$PREPROCESSOR_ARGS --stack_output --max_audio_len 300"

.github/workflows/android-release-artifacts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ jobs:
165165
contents: read
166166
steps:
167167
- name: configure aws credentials
168-
uses: aws-actions/configure-aws-credentials@v1.7.0
168+
uses: aws-actions/configure-aws-credentials@v4
169169
with:
170170
role-to-assume: arn:aws:iam::308535385114:role/gha_executorch_upload-frameworks-android
171171
aws-region: us-east-1

.github/workflows/apple.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ jobs:
239239
python-version: '3.11'
240240
cache: pip
241241
- name: configure aws credentials
242-
uses: aws-actions/configure-aws-credentials@v1.7.0
242+
uses: aws-actions/configure-aws-credentials@v4
243243
with:
244244
role-to-assume: arn:aws:iam::308535385114:role/gha_executorch_upload-frameworks-ios
245245
aws-region: us-east-1

.lintrunner.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ exclude_patterns = [
223223
'**/*.gif',
224224
'extension/llm/tokenizers',
225225
'extension/llm/tokenizers/**',
226+
'backends/cadence/utils/FACTO',
226227
'examples/cuda',
227228
'kernels/portable',
228229
# File contains @generated

backends/aoti/utils.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <executorch/runtime/platform/log.h>
1616
#include <cstddef>
1717
#include <cstdint>
18+
#include <utility>
1819
#include <vector>
1920

2021
namespace executorch {
@@ -163,6 +164,27 @@ inline bool is_contiguous_tensor(
163164
return true;
164165
}
165166

167+
// Scope guard: invokes a callable on destruction. Equivalent to
168+
// std::scope_exit (C++23 <scope>), which is not available in C++17/20.
169+
template <typename F>
170+
class ScopeGuard {
171+
public:
172+
static_assert(
173+
noexcept(std::declval<F&>()()),
174+
"ScopeGuard callable must be noexcept to avoid std::terminate "
175+
"if it throws during stack unwinding");
176+
177+
explicit ScopeGuard(F&& fn) : fn_(std::move(fn)) {}
178+
~ScopeGuard() noexcept {
179+
fn_();
180+
}
181+
ScopeGuard(const ScopeGuard&) = delete;
182+
ScopeGuard& operator=(const ScopeGuard&) = delete;
183+
184+
private:
185+
F fn_;
186+
};
187+
166188
} // namespace aoti
167189
} // namespace backends
168190
} // namespace executorch
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
//
2+
// ETCoreMLCacheProtocol.h
3+
//
4+
// Copyright © 2024 Apple Inc. All rights reserved.
5+
//
6+
// Please refer to the license found in the LICENSE file in the root directory of the source tree.
7+
8+
#import <Foundation/Foundation.h>
9+
10+
NS_ASSUME_NONNULL_BEGIN
11+
12+
/// Protocol defining the interface for CoreML model caching.
13+
///
14+
/// This protocol abstracts the cache implementation
15+
@protocol ETCoreMLCache <NSObject>
16+
17+
/// Returns the URL of a cached model if it exists and is valid, otherwise nil.
18+
///
19+
/// @param identifier The unique identifier for the cached model.
20+
/// @param error On failure, error is filled with the failure information.
21+
/// @return The URL to the cached model bundle, or nil if not found or invalid.
22+
///
23+
/// @warning The returned URL may become invalid before the caller uses it if another
24+
/// process deletes or replaces the cached model. Callers MUST handle MLModel load
25+
/// failures gracefully by treating them as cache misses and recompiling.
26+
- (nullable NSURL*)cachedModelURLForIdentifier:(NSString*)identifier error:(NSError**)error;
27+
28+
/// Stores a compiled model in the cache. Returns the cached URL on success.
29+
///
30+
/// @param compiledModelURL The URL of the compiled model bundle to cache. Must exist.
31+
/// @param identifier The unique identifier for this model.
32+
/// @param error On failure, error is filled with the failure information.
33+
/// @return The URL of the cached model, or nil on failure.
34+
- (nullable NSURL*)storeModelAtURL:(NSURL*)compiledModelURL withIdentifier:(NSString*)identifier error:(NSError**)error;
35+
36+
/// Removes a specific cached model.
37+
///
38+
/// @param identifier The unique identifier for the cached model to remove.
39+
/// @param error On failure, error is filled with the failure information.
40+
/// @return YES if the model was removed or didn't exist. Returns NO only on I/O errors.
41+
- (BOOL)removeCachedModelWithIdentifier:(NSString*)identifier error:(NSError**)error;
42+
43+
/// Clears the entire cache, including all cached models.
44+
///
45+
/// @param error On failure, error is filled with the failure information.
46+
/// @return YES if the cache was purged successfully, otherwise NO.
47+
- (BOOL)purgeAndReturnError:(NSError**)error;
48+
49+
/// Returns a temp URL where intermediate files can be written during compilation.
50+
/// This is guaranteed to be on the same filesystem as the cache, ensuring atomic moves.
51+
///
52+
/// @param error On failure, error is filled with the failure information.
53+
/// @return A temp URL where intermediate files can be written, or nil on failure.
54+
///
55+
/// @note The temp URL is unique (UUID-based) to avoid conflicts.
56+
/// @note Temp entries are cleaned up automatically after 24 hours.
57+
- (nullable NSURL*)temporaryDirectoryWithError:(NSError**)error;
58+
59+
@end
60+
61+
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)