mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 12:18:37 +00:00
A diagnostic, off by default. Each submission on a queue whose family has timestamp bits gets a query pool, reset once at the start of its command buffer, and bottom-of-pipe timestamps: after the opening barrier and bindless upload, before each run of consecutive draws or dispatches of one pipeline, after a run that another command follows, and at the end. The difference between two consecutive timestamps is what lies between them added to the queue's work: a run's GPU time, or "other" when no draw or dispatch lies between. The results are read on the fence callback once the submission is done, never waited for, and summed by pipeline under its stages' ShaderLibrary names (as the pass trace prints them), else its id. Every 10 s, [rt] gpu profile lines give per frame the compute, graphics and mesh totals, other work, per queue kind the busy time (measured as LEONIDA_GPU_LATENCY does) against the timestamped span and the share in draws and dispatches, and the 20 pipelines with the most GPU time (ms per frame, share, kind, calls per frame, ms per call). PSOs register their names with the context when the profile is on, as they already do for the device-fault report; the device passes the families' timestamp bits to the context. Off: one test per submission and per command. On: about 1 us per timestamp on the Raphael iGPU, submit to idle (vk_gpu_profile_test). vk_gpu_profile_test runs known dispatches of two pipelines and a draw through VulkanQueue and checks each pipeline's name, calls, runs, a time that grows with its loop count, and that the intervals add up to the span. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
22 lines
636 B
Plaintext
22 lines
636 B
Plaintext
#version 450
|
|
// vk_gpu_profile_test: a dispatch whose GPU time grows with s0, the loop count (the translator's 144-byte user-data
|
|
// block: s0..s31, heap base, code base). Each invocation writes its result, so the loop is kept.
|
|
layout(local_size_x = 64) in;
|
|
|
|
layout(set = 0, binding = 0, std430) buffer Results {
|
|
uint value[];
|
|
} results;
|
|
|
|
layout(push_constant) uniform UserData {
|
|
uint s[32];
|
|
uvec2 heap_base;
|
|
uvec2 code_base;
|
|
} pc;
|
|
|
|
void main() {
|
|
const uint x = gl_GlobalInvocationID.x;
|
|
uint v = x;
|
|
for (uint i = 0; i < pc.s[0]; ++i) v = (v * 1664525u + 1013904223u) ^ (v >> 13);
|
|
results.value[x] = v;
|
|
}
|