@@ -21,12 +21,28 @@ T get_option(T aot_option) {
21
21
executorch::runtime::BackendOption backend_option;
22
22
23
23
if constexpr (std::is_same_v<T, QnnExecuTorchLogLevel>) {
24
- backend_option = {QNN_RUNTIME_LOG_LEVEL, -1 };
24
+ std::strncpy (
25
+ backend_option.key ,
26
+ QNN_RUNTIME_LOG_LEVEL,
27
+ runtime::kMaxOptionKeyLength );
28
+ backend_option.key [runtime::kMaxOptionKeyLength - 1 ] = ' \0 ' ;
29
+ backend_option.value = -1 ;
25
30
} else if constexpr (std::is_same_v<T, QnnExecuTorchHtpPerformanceMode>) {
26
- backend_option = {QNN_RUNTIME_HTP_PERFORMANCE_MODE, -1 };
31
+ std::strncpy (
32
+ backend_option.key ,
33
+ QNN_RUNTIME_HTP_PERFORMANCE_MODE,
34
+ runtime::kMaxOptionKeyLength );
35
+ backend_option.key [runtime::kMaxOptionKeyLength - 1 ] = ' \0 ' ;
36
+ backend_option.value = -1 ;
27
37
} else if constexpr (std::is_same_v<T, QnnExecuTorchProfileLevel>) {
28
- backend_option = {QNN_RUNTIME_PROFILE_LEVEL, -1 };
38
+ std::strncpy (
39
+ backend_option.key ,
40
+ QNN_RUNTIME_PROFILE_LEVEL,
41
+ runtime::kMaxOptionKeyLength );
42
+ backend_option.key [runtime::kMaxOptionKeyLength - 1 ] = ' \0 ' ;
43
+ backend_option.value = -1 ;
29
44
}
45
+
30
46
// This will call get_option under runtime backend interface
31
47
status = get_option (QNN_BACKEND, backend_option);
32
48
0 commit comments