Skip to content

Commit 435a59d

Browse files
committed
fix timestamp queries on non-nv hardware
1 parent b327896 commit 435a59d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/runtime/vulkan/vk_runtime_dispatch.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static void bind_program_resources(VkrCommand* cmd, VkrSpecProgram* prog) {
5353

5454
static Command make_command_base() {
5555
return (Command) {
56-
.wait_for_completion = (bool(*)(Command*)) vkr_wait_completion,
56+
.wait_for_completion = (bool(*)(Command*)) vkr_wait_completion,
5757
};
5858
}
5959

@@ -92,7 +92,7 @@ VkrCommand* vkr_launch_kernel(VkrDevice* device, Program* program, String entry_
9292
};
9393
CHECK_VK(vkCreateQueryPool(device->device, &qpci, NULL, &cmd->query_pool), {});
9494
cmd->profiled_gpu_time = options->profiled_gpu_time;
95-
vkCmdResetQueryPool(cmd->cmd_buf, cmd->query_pool, 0, 1);
95+
vkCmdResetQueryPool(cmd->cmd_buf, cmd->query_pool, 0, 2);
9696
vkCmdWriteTimestamp(cmd->cmd_buf, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, cmd->query_pool, 0);
9797
}
9898

@@ -174,7 +174,7 @@ bool vkr_wait_completion(VkrCommand* cmd) {
174174
if (cmd->profiled_gpu_time) {
175175
uint64_t ts[2];
176176
CHECK_VK(vkGetQueryPoolResults(cmd->device->device, cmd->query_pool, 0, 2, sizeof(uint64_t) * 2, ts, sizeof(uint64_t), VK_QUERY_RESULT_64_BIT), {});
177-
*cmd->profiled_gpu_time = ts[1] - ts[0];
177+
*cmd->profiled_gpu_time = (ts[1] - ts[0]) * cmd->device->caps.properties.base.properties.limits.timestampPeriod;
178178
}
179179
vkr_destroy_command(cmd);
180180
return true;

0 commit comments

Comments
 (0)