1 /* 2 * Copyright (c) Meta Platforms, Inc. and affiliates. 3 * All rights reserved. 4 * 5 * This source code is licensed under the BSD-style license found in the 6 * LICENSE file in the root directory of this source tree. 7 */ 8 9 #pragma once 10 11 #include <executorch/backends/vulkan/runtime/api/api.h> 12 13 namespace vkcompute { 14 15 struct GraphConfig final { 16 api::ContextConfig context_config; 17 18 // Creating a descriptor pool with exactly the number of descriptors tallied 19 // by iterating through the shader layouts of shaders used in the graph risks 20 // the descriptor pool running out of memory, therefore apply a safety factor 21 // to descriptor counts when creating the descriptor pool to mitigate this 22 // risk. 23 float descriptor_pool_safety_factor; 24 25 bool enable_storage_type_override; 26 utils::StorageType storage_type_override; 27 28 bool enable_memory_layout_override; 29 utils::GPUMemoryLayout memory_layout_override; 30 31 bool enable_querypool; 32 33 bool enable_local_wg_size_override; 34 utils::uvec3 local_wg_size_override; 35 36 // Generate a default graph config with pre-configured settings 37 explicit GraphConfig(); 38 39 void set_storage_type_override(utils::StorageType storage_type); 40 void set_memory_layout_override(utils::GPUMemoryLayout memory_layout); 41 void set_local_wg_size_override(const utils::uvec3& local_wg_size); 42 }; 43 44 } // namespace vkcompute 45