Skip to content

Commit 2ca6c33

Browse files
committed
Update base for Update on "[5.1/ N] set_option/get_option API with {backend_name, backend options} only"
This PR only expose the set_option/get_option API via the pair {backend_name, backend_options}, without necessarily backend options map. The backend options map and it's corresponding API will be exposed to another PR Reference PR in #11758 which exposes the set_option/get_option with backendoptions map too Differential Revision: [D77190316](https://our.internmc.facebook.com/intern/diff/D77190316/) [ghstack-poisoned]
1 parent 6bbf5b8 commit 2ca6c33

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

runtime/backend/interface.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class BackendInterface {
111111
* @retval Error::Ok if successful.
112112
*/
113113
ET_NODISCARD virtual Error set_option(
114-
BackendOptionContext& context,
114+
__ET_UNUSED BackendOptionContext& context,
115115
const executorch::runtime::Span<BackendOption>& backend_options) {
116116
return Error::Ok;
117117
};
@@ -127,7 +127,7 @@ class BackendInterface {
127127
* @retval Error::Ok if successful.
128128
*/
129129
ET_NODISCARD virtual Error get_option(
130-
BackendOptionContext& context,
130+
__ET_UNUSED BackendOptionContext& context,
131131
executorch::runtime::Span<BackendOption>& backend_options) {
132132
return Error::Ok;
133133
};

runtime/backend/options.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ using OptionValue =
2929
struct BackendOption {
3030
// key is the name of the backend option, like num_threads, enable_profiling,
3131
// etc
32-
char key[kMaxOptionKeyLength];
32+
char key[kMaxOptionKeyLength]{};
3333
// value is the value of the backend option, like 4, true, etc
3434
OptionValue value;
3535
};
@@ -129,7 +129,7 @@ class BackendOptions {
129129
Error set_option(const char (&key)[N], const char* value) noexcept {
130130
static_assert(N <= kMaxOptionKeyLength, "Option key is too long");
131131
// Create a fixed-size array and copy the string
132-
std::array<char, kMaxOptionValueLength> arr;
132+
std::array<char, kMaxOptionValueLength> arr{};
133133
strncpy(arr.data(), value, kMaxOptionValueLength - 1);
134134
arr[kMaxOptionValueLength - 1] = '\0'; // Ensure null termination
135135
return set_option_impl(key, arr);

runtime/backend/test/backend_interface_update_test.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,23 @@ class MockBackend : public BackendInterface {
3838
}
3939

4040
Result<DelegateHandle*> init(
41-
BackendInitContext& context,
42-
FreeableBuffer* processed,
43-
ArrayRef<CompileSpec> compile_specs) const override {
41+
__ET_UNUSED BackendInitContext& context,
42+
__ET_UNUSED FreeableBuffer* processed,
43+
__ET_UNUSED ArrayRef<CompileSpec> compile_specs) const override {
4444
init_called = true;
4545
return nullptr;
4646
}
4747

4848
Error execute(
49-
BackendExecutionContext& context,
50-
DelegateHandle* handle,
51-
EValue** args) const override {
49+
__ET_UNUSED BackendExecutionContext& context,
50+
__ET_UNUSED DelegateHandle* handle,
51+
__ET_UNUSED EValue** args) const override {
5252
execute_count++;
5353
return Error::Ok;
5454
}
5555

5656
Error set_option(
57-
BackendOptionContext& context,
57+
__ET_UNUSED BackendOptionContext& context,
5858
const executorch::runtime::Span<BackendOption>& backend_options)
5959
override {
6060
set_option_count++;

0 commit comments

Comments
 (0)