I tested call vkCreateFence 1500 times on linux, and it took about 6secs, the same program also tested on windows (GTX 1060) and the time is 5ms. My graphic card info on linux is listed below:
Driver Version : 418.43
CUDA Version : 10.1
Attached GPUs : 4
GPU 00000000:00:08.0
Product Name : GeForce GTX 1080 Ti
Product Brand : GeForce
Display Mode : Disabled
Display Active : Disabled
Persistence Mode : Enabled
Accounting Mode : Disabled
Accounting Mode Buffer Size : 4000
the vulkan sdk is latest 1.1.97
here is my test code :
WatchTimer timer;
timer.start();
for (int i = 0; i < 1600; ++i)
{
VkFenceCreateInfo Info;
memset(&Info, 0, sizeof(VkFenceCreateInfo));
Info.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
Info.flags = 0;
VkFence Handle;
VK_ASSERT(vkCreateFence(mDevice, &Info, nullptr, &Handle));
}
timer.stop();
LOG_ERROR("fence %f", timer.getAccumulateTime());
I also traced the vkCreateFence callstack using gprof, the callstacks like below:
(00007fd0b5df7607) :0:__munmap
(00007fd0b5d7e881) :0:__GI__IO_setb
(00007fd0b5d7d02f) :0:_IO_new_file_close_it
(00007fd0b5d7101f) :0:_IO_new_fclose
(00007fd0a7613754) ??:0:0x00007fd0a7613754
(00007fd0a76138de) ??:0:0x00007fd0a76138de
(00007fd0a7614094) ??:0:0x00007fd0a7614094
(00007fd0a7611a8f) ??:0:0x00007fd0a7611a8f
(00007fd0a760eb25) ??:0:0x00007fd0a760eb25
(00007fd0a7610ba3) ??:0:0x00007fd0a7610ba3
(00007fd0a76125fc) ??:0:0x00007fd0a76125fc
(00007fd0a730edcb) ??:0:_glCallList
(00007fd0a75a4877) ??:0:0x00007fd0a75a4877
(00007fd0a75a5266) ??:0:0x00007fd0a75a5266
(00007fd0a75a51a2) ??:0:0x00007fd0a75a51a2
(00007fd0a75a584b) ??:0:0x00007fd0a75a584b