Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions backends/vulkan/runtime/VulkanBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ GraphConfig get_graph_config(ArrayRef<CompileSpec>& compile_specs) {
config.expect_dynamic_shapes = true;
}
}
if (strcmp(spec.key, "warmup_execute_after_compile") == 0) {
ET_CHECK_MSG(value_size == sizeof(uint8_t), "Unexpected value size!");
bool value = getBool(value_data);

config.warmup_execute_after_compile = value;
}
}
#ifdef ET_EVENT_TRACER_ENABLED
config.enable_querypool = true;
Expand Down Expand Up @@ -579,6 +585,8 @@ class VulkanBackend final : public ::executorch::runtime::BackendInterface {

compute_graph->prepack();

compute_graph->optional_warmup_execute();

return Error::Ok;
}

Expand Down
6 changes: 6 additions & 0 deletions backends/vulkan/runtime/graph/ComputeGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,12 @@ void ComputeGraph::prepack() {
}
}

void ComputeGraph::optional_warmup_execute() {
if (config_.warmup_execute_after_compile) {
execute();
}
}

void ComputeGraph::execute() {
if (deferred_cmd_list_.empty()) {
context_->flush();
Expand Down
6 changes: 6 additions & 0 deletions backends/vulkan/runtime/graph/ComputeGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,12 @@ class ComputeGraph final {
*/
void prepack();

//
// Optional Graph Execution
//

void optional_warmup_execute();

//
// Graph Execution
//
Expand Down
4 changes: 4 additions & 0 deletions backends/vulkan/runtime/graph/GraphConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ struct GraphConfig final {
// many command buffers.
size_t execute_max_cmds = 0;

// If true, then the graph will be executed once immediately after it is
// compiled.
bool warmup_execute_after_compile = false;

vkapi::Adapter* external_adapter;

// Generate a default graph config with pre-configured settings
Expand Down
Loading