@@ -21,12 +21,28 @@ T get_option(T aot_option) {
2121 executorch::runtime::BackendOption backend_option;
2222
2323 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 ;
2530 } 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 ;
2737 } 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 ;
2944 }
45+
3046 // This will call get_option under runtime backend interface
3147 status = get_option (QNN_BACKEND, backend_option);
3248
0 commit comments