Skip to content

Commit 897b0c4

Browse files
author
Github Executorch
committed
Update
[ghstack-poisoned]
1 parent 4815e29 commit 897b0c4

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

runtime/kernel/operator_registry.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,14 @@ struct KernelKey {
123123
* for all input tensor dtypes and dim orders if the specialized kernel is not
124124
* registered.
125125
*/
126-
KernelKey() = default;
126+
constexpr KernelKey() = default;
127127

128128
/**
129129
* Creates a specialized (non-fallback) kernel key that matches a specific
130130
* set of input tensor dtypes and dim orders. See the class comment for the
131131
* expected format of `kernel_key_data`.
132132
*/
133-
/* implicit */ KernelKey(const char* kernel_key_data)
133+
/* implicit */ constexpr KernelKey(const char* kernel_key_data)
134134
: kernel_key_data_(kernel_key_data) {}
135135

136136
bool operator==(const KernelKey& other) const {
@@ -188,12 +188,13 @@ struct Kernel {
188188
* itself, we require the lifetime of the operator name to be at least as long
189189
* as the operator registry.
190190
*/
191-
explicit Kernel(const char* name, OpFunction func) : name_(name), op_(func) {}
191+
constexpr explicit Kernel(const char* name, OpFunction func)
192+
: name_(name), op_(func) {}
192193

193-
explicit Kernel(const char* name, KernelKey key, OpFunction func)
194+
constexpr explicit Kernel(const char* name, KernelKey key, OpFunction func)
194195
: name_(name), kernel_key_(key), op_(func) {}
195196

196-
Kernel() {}
197+
constexpr Kernel() : name_(nullptr), op_(nullptr) {}
197198
};
198199

199200
namespace internal {

0 commit comments

Comments
 (0)