Skip to content

Instantly share code, notes, and snippets.

View nanokatze's full-sized avatar

Caterina Shablia nanokatze

View GitHub Profile
@nanokatze
nanokatze / sync.md
Created December 9, 2025 00:10
Vulkan sync

Ordering

/* 1 */ vkCmdDispatch(cb, 1, 1, 1);
/* 2 */ vkCmdDispatch(cb, 1, 1, 1);

dispatches 1 and 2 aren't ordered wrt each other. So the threads spawned by 1 and 2 may start in any order, execute in parallel, and complete in any order.

/* 1 */ vkCmdDispatch(cb, 1, 1, 1);

A good way to think about a buffer or an image descriptor is to imagine it as a very fat pointer. This is, in fact, not too far removed from reality, as we shall see.

Taking a peek at radv, we find the uniform buffer and storage buffer descriptors to be a 4-word tuple, where the first two words make up the address, followed by length in bytes for bounds checking and an extra word, which holds format information and bounds checking behavior [^1].

Similarly, the sampled image descriptor is a 16-word tuple containing an

vec4
qconj(vec4 x)
{
return vec4(-x.xyz, x.w);
}
vec4
qmul(vec4 x, vec4 y)
{
return vec4(