@@ -142,6 +142,13 @@ DEFINE_int32(
142142 " This is a runtime option and will override the profile level set during AOT. "
143143 " Refer to QnnExecuTorchProfileLevel under qc_compiler_spec.fbs for more info." );
144144
145+ DEFINE_string (
146+ heap_profiling_path,
147+ " " ,
148+ " Output path for QNN heap-profiling dump. "
149+ " Empty disables heap profiling. "
150+ " This is a runtime option and will override the path set during AOT." );
151+
145152using executorch::aten::Tensor;
146153using executorch::aten::TensorImpl;
147154using executorch::etdump::ETDumpGen;
@@ -212,7 +219,7 @@ int main(int argc, char** argv) {
212219 }
213220
214221 // Set runtime options
215- executorch::runtime::BackendOptions<8 > backend_options;
222+ executorch::runtime::BackendOptions<9 > backend_options;
216223 if (!gflags::GetCommandLineFlagInfoOrDie (" log_level" ).is_default ) {
217224 ET_LOG (Info, " Setting runtime log level: %d" , FLAGS_log_level);
218225 ET_CHECK_MSG (
@@ -290,6 +297,18 @@ int main(int argc, char** argv) {
290297 " Failed to set backend options: %s" ,
291298 QNN_RUNTIME_LPAI_CORE_SELECTION );
292299 }
300+ if (!gflags::GetCommandLineFlagInfoOrDie (" heap_profiling_path" ).is_default ) {
301+ ET_LOG (
302+ Info,
303+ " Setting runtime heap_profiling_path: %s" ,
304+ FLAGS_heap_profiling_path.c_str ());
305+ ET_CHECK_MSG (
306+ backend_options.set_option (
307+ QNN_RUNTIME_HEAP_PROFILING_PATH ,
308+ FLAGS_heap_profiling_path.c_str ()) == Error::Ok,
309+ " Failed to set backend options: %s" ,
310+ QNN_RUNTIME_HEAP_PROFILING_PATH );
311+ }
293312 ET_CHECK_MSG (
294313 set_option (QNN_BACKEND , backend_options.view ()) == Error::Ok,
295314 " Failed to set runtime options." );
0 commit comments