Skip to content

Commit 51ed40e

Browse files
committed
Update base for Update on "Add get_option/set_option APIs"
Expose the API to set/get backend option. We can either pass in {backend_name, backend options} or {backend options map} Differential Revision: [D76825663](https://our.internmc.facebook.com/intern/diff/D76825663/) Differential Revision: [D76825663](https://our.internmc.facebook.com/intern/diff/D76825663) [ghstack-poisoned]
1 parent ba6f9f9 commit 51ed40e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

runtime/backend/backend_options.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#pragma once
1010
#include <executorch/runtime/core/error.h>
11+
#include <executorch/runtime/core/span.h>
1112
#include <cstddef>
1213
#include <cstring>
1314
#include <variant>
@@ -71,6 +72,15 @@ class BackendOptions {
7172
return Error::NotFound;
7273
}
7374

75+
executorch::runtime::Span<BackendOption> view() const {
76+
return executorch::runtime::Span<BackendOption>(options_, size_);
77+
}
78+
79+
// Non-const version that allows modification of the underlying data
80+
executorch::runtime::Span<BackendOption> view() {
81+
return executorch::runtime::Span<BackendOption>(options_, size_);
82+
}
83+
7484
private:
7585
BackendOption options_[MaxCapacity]{}; // Storage for backend options
7686
size_t size_; // Current number of options

0 commit comments

Comments
 (0)