KhronosGroup / KhronosGroup/Vulkan-ValidationLayers

Flush debug printf error message on quick exits

Open
#9,456 1 comment 1 reaction 0 assignees View on GitHub
DebugPrintf
Dominant language
C++
Stars
1k
Forks
504
Avg merge
11h 35m
Merged PRs (30d)
224

Description

@rg3igalia brought up how CTS will sometime do a queue submit, process the output, and exit without seeing the debug printf error message

My worry is someone one day will try to write a quick "let me see if this works" test app and do the same and get gaslighted by validation layers that the DebugPrintf is not working, when really it is just they exited early

My simple idea is to have `vkDestroyDevice` in GPU-AV check the status of the queues and essentially enforce a `vkDeviceWaitIdle` and/or just flush out any debug printf error messages so the user see's them

Small test that shows the behavior

```c++
TEST_F(NegativeDebugPrintf, QuickExit) {
TEST_DESCRIPTION("CTS devs will try to use debugPrintf, but don't always wait for device idle and then will exit before message is printed.");
RETURN_IF_SKIP(InitDebugPrintfFramework());
RETURN_IF_SKIP(InitState());

char const *shader_source = R"glsl(
#version 450
#extension GL_EXT_debug_printf : enable
void main() {
debugPrintfEXT("HERE");
}
)glsl";

CreateComputePipelineHelper pipe(*this);
pipe.cs_ = std::make_unique(this, shader_source, VK_SHADER_STAGE_COMPUTE_BIT);
pipe.CreateComputePipeline();

m_command_buffer.Begin();
vk::CmdBindPipeline(m_command_buffer.handle(), VK_PIPELINE_BIND_POINT_COMPUTE, pipe.Handle());
vk::CmdDispatch(m_command_buffer.handle(), 1, 1, 1);
m_command_buffer.End();

m_errorMonitor->SetDesiredInfo("HERE");
m_default_queue->Submit(m_command_buffer);
// m_default_queue->Wait();
m_errorMonitor->VerifyFound();
}
```

Contributor guide

Open the contributing guide

Research direction

Start with NegativeDebugPrintf::QuickExit and the GPU-AV vkDestroyDevice path mentioned in the issue. Reproduce the early-exit behavior without m_default_queue->Wait(), then trace how debug printf messages are flushed during device destruction. Done means the quick-exit test observes "HERE" without requiring an explicit queue wait.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.