Commit Graph

9 Commits

Author SHA1 Message Date
Pooya Parsa
cec0a49f5d vk: make a wgpu app's graphics pipelines for the negative viewport height it draws with: the ICD sends the app's engine name in the hello, and for wgpu-hal the host translates vertex stages without the y flip and builds that variant in vkCreateGraphicsPipelines (it was built in the first submit, after an unused flipped one); the other orientation is a variant at draw time, logged once per connection with the engine's name; the host check draws both ways after destroying the shader modules and runs its SPIR-V suite with the toolchain's glslc 2026-11-25 14:31:55 +00:00
Pooya Parsa
e16c37ad6f vk: let wgpu apps (Zed) create a device and draw: the ICD reports maxFragmentCombinedOutputResources as the sum of storage buffers, storage images and color attachments (8 made wgpu derive 3 color attachments) and every bind group as a descriptor set (a layout with all of them and push constants fails in vkCreatePipelineLayout), and a pipeline's stages keep their shader module, so a variant made at draw time translates it after the app destroyed it 2026-11-25 14:02:24 +00:00
Pooya Parsa
7d74d40f94 vk: run llama.cpp's quantized models: the translator keeps barriers in uniform control flow past invocation-dependent continues, reads num_workgroups and workgroup_id without naga's private copy, runs workgroups wider than the device's limit as virtual invocations and lowers subgroup builtins of shaders without subgroup operations; a compute pipeline WebGPU refuses as read_write is made with its read-only buffers kept; the subgroup size is agreed in the hello (32, KWVK_SUBGROUP_SIZE: Qwen2.5 0.5B Q4_K_M 75 to 22 ms a token on an M4 Pro); timestamp queries resolve once at the read and never go backwards 2026-11-24 21:21:48 +00:00
Pooya Parsa
6e71333536 vk: pin glslc (shaderc v2026.4, built from source by vk/glslc.sh) and the SPIR-V headers for test/vk/guest/build-llama.sh, which cross-builds against the pinned Vulkan headers 2026-11-24 21:21:48 +00:00
Pooya Parsa
e615c1a0bf vk: flush only the mapped ranges a submit can touch and signal fences at submit when nothing is read back (Qwen2.5 0.5B decode overhead 1588 to 41 ms per token without GPU work), a 4 GiB device-only heap apart from the host-visible one (KWVK_HEAP_MB) and maxMemoryAllocationSize from WebGPU's limits, uniform and push-constant blocks WGSL cannot lay out repacked as vec4<u32> words so Firefox and Safari take ggml's rope shaders, division by a constant zero rewritten, validation with WebGPU's capabilities only, the adapter in the device name with the words Ollama reads as Metal, CUDA or ROCm spelled apart (KWVK_DEVICE_NAME); web: Ollama and fx (local model) ask which model (SmolLM2 with a tool template, Qwen2.5 1.5B, Llama 3.2 1B, Qwen3.5 0.8B added), TEMP and THINK options (fx at temperature 0, thinking off), a free-space check before a model download, the server restarted when GPU discovery times out 2026-11-24 14:09:09 +00:00
Pooya Parsa
17781fa30a vk: present Wayland windows without copying (wland 0.1.0-261124-3c987e5 external buffers: the ICD names each swapchain image to the compositor and the page resolves it from the WebGPU texture; readback stays the fallback and for X11), track descriptor writes that spill over bindings and read back only the ranges the GPU wrote (device-local and host-visible memory types only), take a read-only marking from a buffer's members in the translator; web: Vulkan in the resource monitor, no guest Vulkan where WebGPU has no adapter, llama.cpp and D3D12 (vkd3d) gears and triangle apps, the Agents folder renamed AI 2026-11-24 10:45:38 +00:00
Pooya Parsa
85fb2c4e1c vk: fail loudly instead of giving wrong results: pipeline creation waits for the host and returns a Vulkan error when the shader or pipeline is refused, a failed submit, write or unencodable command loses the device, the ICD prints each error on stderr, and capabilities the host cannot honour are refused or no longer advertised; check it in test/vk (vk-loud, host cases) 2026-11-24 08:38:43 +00:00
Pooya Parsa
15e1dd3c89 vk: report the driver ID and name to Vulkan 1.2 callers (VkPhysicalDeviceVulkan12Properties), and note what keeps Mesa's zink off kwvk 2026-11-24 07:47:50 +00:00
Pooya Parsa
3538073b0f Add guest Vulkan on the page's WebGPU (kwvk): a Vulkan 1.2 ICD in the base (vk/icd, libvulkan_kw.so under the stock loader) sends commands over vsock port 1018 to a renderer in the SDK (createKernel({ vk }), js/core/vk*.ts) that implements them on a GPUDevice, with SPIR-V translated to WGSL by naga as wasm (vk/naga); Wayland, X11 and headless presentation by readback; the page's Guest Vulkan option, Environment row and vkcube, vkmark and GTK tiles; checks in test/vk 2026-11-24 07:23:03 +00:00