File tree Expand file tree Collapse file tree 4 files changed +24
-0
lines changed
Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,12 @@ GraphConfig get_graph_config(ArrayRef<CompileSpec>& compile_specs) {
179179 config.expect_dynamic_shapes = true ;
180180 }
181181 }
182+ if (strcmp (spec.key , " warmup_execute_after_compile" ) == 0 ) {
183+ ET_CHECK_MSG (value_size == sizeof (uint8_t ), " Unexpected value size!" );
184+ bool value = getBool (value_data);
185+
186+ config.warmup_execute_after_compile = value;
187+ }
182188 }
183189#ifdef ET_EVENT_TRACER_ENABLED
184190 config.enable_querypool = true ;
@@ -579,6 +585,8 @@ class VulkanBackend final : public ::executorch::runtime::BackendInterface {
579585
580586 compute_graph->prepack ();
581587
588+ compute_graph->optional_warmup_execute ();
589+
582590 return Error::Ok;
583591 }
584592
Original file line number Diff line number Diff line change @@ -1107,6 +1107,12 @@ void ComputeGraph::prepack() {
11071107 }
11081108}
11091109
1110+ void ComputeGraph::optional_warmup_execute () {
1111+ if (config_.warmup_execute_after_compile ) {
1112+ execute ();
1113+ }
1114+ }
1115+
11101116void ComputeGraph::execute () {
11111117 if (deferred_cmd_list_.empty ()) {
11121118 context_->flush ();
Original file line number Diff line number Diff line change @@ -1033,6 +1033,12 @@ class ComputeGraph final {
10331033 */
10341034 void prepack ();
10351035
1036+ //
1037+ // Optional Graph Execution
1038+ //
1039+
1040+ void optional_warmup_execute ();
1041+
10361042 //
10371043 // Graph Execution
10381044 //
Original file line number Diff line number Diff line change @@ -71,6 +71,10 @@ struct GraphConfig final {
7171 // many command buffers.
7272 size_t execute_max_cmds = 0 ;
7373
74+ // If true, then the graph will be executed once immediately after it is
75+ // compiled.
76+ bool warmup_execute_after_compile = false ;
77+
7478 vkapi::Adapter* external_adapter;
7579
7680 // Generate a default graph config with pre-configured settings
You can’t perform that action at this time.
0 commit comments