Skip to content

[ET-VK] Removing descriptor pool intialization from DescriptorPool ctor. #10777

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: gh/trivedivivek/83/base
Choose a base branch
from
Open
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
22 changes: 12 additions & 10 deletions backends/vulkan/runtime/api/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,6 @@ Context* context() {
8u, // cmdPoolBatchSize
};

const vkapi::DescriptorPoolConfig descriptor_pool_config{
VULKAN_DESCRIPTOR_POOL_SIZE, // descriptorPoolMaxSets
VULKAN_DESCRIPTOR_POOL_SIZE, // descriptorUniformBufferCount
VULKAN_DESCRIPTOR_POOL_SIZE, // descriptorStorageBufferCount
VULKAN_DESCRIPTOR_POOL_SIZE, // descriptorCombinedSamplerCount
VULKAN_DESCRIPTOR_POOL_SIZE, // descriptorStorageImageCount
32u, // descriptorPileSizes
};

const vkapi::QueryPoolConfig query_pool_config{
VULKAN_QUERY_POOL_SIZE, // maxQueryCount
256u, // initialReserveSize
Expand All @@ -252,7 +243,7 @@ Context* context() {
const ContextConfig config{
cmd_submit_frequency,
cmd_config,
descriptor_pool_config,
{},
query_pool_config,
};

Expand All @@ -266,6 +257,17 @@ Context* context() {
return context.get();
}

vkapi::DescriptorPoolConfig default_descriptor_pool_config() {
return {
VULKAN_DESCRIPTOR_POOL_SIZE, // descriptorPoolMaxSets
VULKAN_DESCRIPTOR_POOL_SIZE, // descriptorUniformBufferCount
VULKAN_DESCRIPTOR_POOL_SIZE, // descriptorStorageBufferCount
VULKAN_DESCRIPTOR_POOL_SIZE, // descriptorCombinedSamplerCount
VULKAN_DESCRIPTOR_POOL_SIZE, // descriptorStorageImageCount
32u, // descriptorPileSizes
};
}

#ifdef VULKAN_DEBUG

#ifdef VK_KHR_pipeline_executable_properties
Expand Down
2 changes: 2 additions & 0 deletions backends/vulkan/runtime/api/Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ bool available();
// a static local variable.
Context* context();

vkapi::DescriptorPoolConfig default_descriptor_pool_config();

namespace detail {

inline void arg_is_empty(
Expand Down
6 changes: 1 addition & 5 deletions backends/vulkan/runtime/vk_api/Descriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,7 @@ DescriptorPool::DescriptorPool(
pool_(VK_NULL_HANDLE),
config_(config),
mutex_{},
piles_{} {
if (config.descriptor_pool_max_sets > 0) {
init(config);
}
}
piles_{} {}

DescriptorPool::~DescriptorPool() {
if (pool_ == VK_NULL_HANDLE) {
Expand Down
3 changes: 3 additions & 0 deletions backends/vulkan/test/vulkan_compute_api_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ class VulkanComputeAPITest : public ::testing::Test {
void SetUp() override {
// Make sure we are starting with a clean slate
EXPECT_TRUE(get_vma_allocation_count() == 0);
if (!context()->descriptor_pool()) {
context()->descriptor_pool().init(default_descriptor_pool_config());
}
}

void TearDown() override {
Expand Down
Loading