Skip to content

Commit 547d567

Browse files
committed
[ET-VK] Removing descriptor pool intialization from DescriptorPool ctor.
Pull Request resolved: #10777 Descriptor pool is initialized with proper capacity while ComputeGraph is build, in ComputeGraph::prepare function. Thus, initializing descriptor pool in constructor just add throwaway work. Differential Revision: [D74347030](https://our.internmc.facebook.com/intern/diff/D74347030/) ghstack-source-id: 283034826
1 parent 277c39d commit 547d567

File tree

4 files changed

+18
-15
lines changed

4 files changed

+18
-15
lines changed

backends/vulkan/runtime/api/Context.cpp

+12-10
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,6 @@ Context* context() {
235235
8u, // cmdPoolBatchSize
236236
};
237237

238-
const vkapi::DescriptorPoolConfig descriptor_pool_config{
239-
VULKAN_DESCRIPTOR_POOL_SIZE, // descriptorPoolMaxSets
240-
VULKAN_DESCRIPTOR_POOL_SIZE, // descriptorUniformBufferCount
241-
VULKAN_DESCRIPTOR_POOL_SIZE, // descriptorStorageBufferCount
242-
VULKAN_DESCRIPTOR_POOL_SIZE, // descriptorCombinedSamplerCount
243-
VULKAN_DESCRIPTOR_POOL_SIZE, // descriptorStorageImageCount
244-
32u, // descriptorPileSizes
245-
};
246-
247238
const vkapi::QueryPoolConfig query_pool_config{
248239
VULKAN_QUERY_POOL_SIZE, // maxQueryCount
249240
256u, // initialReserveSize
@@ -252,7 +243,7 @@ Context* context() {
252243
const ContextConfig config{
253244
cmd_submit_frequency,
254245
cmd_config,
255-
descriptor_pool_config,
246+
{},
256247
query_pool_config,
257248
};
258249

@@ -266,6 +257,17 @@ Context* context() {
266257
return context.get();
267258
}
268259

260+
vkapi::DescriptorPoolConfig default_descriptor_pool_config() {
261+
return {
262+
VULKAN_DESCRIPTOR_POOL_SIZE, // descriptorPoolMaxSets
263+
VULKAN_DESCRIPTOR_POOL_SIZE, // descriptorUniformBufferCount
264+
VULKAN_DESCRIPTOR_POOL_SIZE, // descriptorStorageBufferCount
265+
VULKAN_DESCRIPTOR_POOL_SIZE, // descriptorCombinedSamplerCount
266+
VULKAN_DESCRIPTOR_POOL_SIZE, // descriptorStorageImageCount
267+
32u, // descriptorPileSizes
268+
};
269+
}
270+
269271
#ifdef VULKAN_DEBUG
270272

271273
#ifdef VK_KHR_pipeline_executable_properties

backends/vulkan/runtime/api/Context.h

+2
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ bool available();
267267
// a static local variable.
268268
Context* context();
269269

270+
vkapi::DescriptorPoolConfig default_descriptor_pool_config();
271+
270272
namespace detail {
271273

272274
inline void arg_is_empty(

backends/vulkan/runtime/vk_api/Descriptor.cpp

+1-5
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,7 @@ DescriptorPool::DescriptorPool(
269269
pool_(VK_NULL_HANDLE),
270270
config_(config),
271271
mutex_{},
272-
piles_{} {
273-
if (config.descriptor_pool_max_sets > 0) {
274-
init(config);
275-
}
276-
}
272+
piles_{} {}
277273

278274
DescriptorPool::~DescriptorPool() {
279275
if (pool_ == VK_NULL_HANDLE) {

backends/vulkan/test/vulkan_compute_api_test.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ class VulkanComputeAPITest : public ::testing::Test {
8787
void SetUp() override {
8888
// Make sure we are starting with a clean slate
8989
EXPECT_TRUE(get_vma_allocation_count() == 0);
90+
if (!context()->descriptor_pool()) {
91+
context()->descriptor_pool().init(default_descriptor_pool_config());
92+
}
9093
}
9194

9295
void TearDown() override {

0 commit comments

Comments
 (0)