← Commit history

tried to fix shit on wsl2 but im hopping nativly to arch now so i can test Vulkan better

lennoxrose committed on Oct 9, 2026 at 14:47 UTC

6f2452dparentd8069c5

2 files changed+154−3

pyre/src/D/runtime/targets.dmodified

+1−3
@@ -1,10 +1,8 @@
11 src/O/runtime/targets.o: src/C/runtime/targets.c src/H/runtime/targets.h \
22 src/H/backends/cpu/matrix_multiply.h src/H/backends/cpu/chaos.h \
3- src/H/backends/cpu/monte_carlo.h src/H/backends/vulkan/context.h \
4- src/H/backends/cuda/context.h
3+ src/H/backends/cpu/monte_carlo.h src/H/backends/vulkan/context.h
54 src/H/runtime/targets.h:
65 src/H/backends/cpu/matrix_multiply.h:
76 src/H/backends/cpu/chaos.h:
87 src/H/backends/cpu/monte_carlo.h:
98 src/H/backends/vulkan/context.h:
10-src/H/backends/cuda/context.h:

pyre/tools/fix_wsl2.shadded

+153−0
@@ -0,0 +1,153 @@
1+#!/usr/bin/env bash
2+# Diagnoses the "WARNING: dzn is not a conformant Vulkan implementation"
3+# and "Dropped Escape call with ulEscapeCode : ..." lines that show up in
4+# Pyre's dashboard log under WSL2 (dashboard.c pipes the child process's
5+# raw stdout+stderr into the log view, so driver chatter goes straight
6+# through).
7+#
8+# What these lines actually mean:
9+# - WSL2 has no kernel-level GPU passthrough. Vulkan only reaches the
10+# GPU by translating calls to D3D12, via Mesa's "dzn" (Dozen) driver.
11+# - NVIDIA additionally ships its own native Vulkan ICD into WSL
12+# (/usr/lib/wsl/lib/nvidia_icd.json) alongside the D3D12 path. If the
13+# loader finds it, it's used instead of dzn and the warning goes away.
14+# - AMD and Intel have no such native WSL ICD. dzn is the only Vulkan
15+# path available for them, full stop -- the warning is unavoidable
16+# and does not indicate a broken or incomplete install.
17+#
18+# So this script:
19+# 1. Confirms Vulkan can actually see a real GPU (not just llvmpipe).
20+# 2. On AMD/Intel: reports the dzn warning as expected/cosmetic once
21+# a real GPU is confirmed present.
22+# 3. On NVIDIA: if the native ICD manifest exists on disk but isn't in
23+# the loader's search path, registers it under /etc/vulkan/icd.d so
24+# native NVIDIA Vulkan is used instead of the dzn fallback.
25+set -euo pipefail
26+
27+log() { printf '%s\n' "$*"; }
28+ok() { printf ' [ok] %s\n' "$*"; }
29+warn() { printf ' [!!] %s\n' "$*"; }
30+info() { printf ' %s\n' "$*"; }
31+
32+if ! grep -qi microsoft /proc/version 2>/dev/null; then
33+ warn "This doesn't look like WSL2 (/proc/version has no 'microsoft' in it)."
34+ warn "fix_wsl2.sh only knows about WSL2's Vulkan-over-D3D12 setup; exiting."
35+ exit 1
36+fi
37+
38+if ! command -v vulkaninfo >/dev/null 2>&1; then
39+ warn "vulkaninfo not found -- run tools/install_deps.sh first."
40+ exit 1
41+fi
42+
43+log "fix_wsl2.sh: checking Vulkan device visibility under WSL2"
44+log
45+
46+VULKANINFO_OUT="$(vulkaninfo --summary 2>&1 || true)"
47+
48+# Pull out deviceName/driverID/deviceType, three lines per device block.
49+mapfile -t NAMES < <(printf '%s\n' "$VULKANINFO_OUT" | grep "deviceName" | sed 's/.*= //')
50+mapfile -t DRIVERS < <(printf '%s\n' "$VULKANINFO_OUT" | grep "driverID" | sed 's/.*= //')
51+mapfile -t DEVTYPES < <(printf '%s\n' "$VULKANINFO_OUT" | grep "deviceType" | sed 's/.*= //')
52+
53+if [ "${#NAMES[@]}" -eq 0 ]; then
54+ warn "vulkaninfo returned no devices at all. Output was:"
55+ printf '%s\n' "$VULKANINFO_OUT" | sed 's/^/ /'
56+ warn "This means WSL2's D3D12 bridge isn't working, not just a Vulkan issue."
57+ info "From a Windows (not WSL) PowerShell, try:"
58+ info " wsl --update"
59+ info " wsl --shutdown (then reopen your WSL terminal)"
60+ info "Also confirm the Windows GPU driver itself is current (NVIDIA/AMD/Intel"
61+ info "all need a driver version that supports WSL GPU paravirtualization)."
62+ exit 1
63+fi
64+
65+HAS_REAL_GPU=0
66+HAS_NVIDIA_DZN=0
67+for i in "${!NAMES[@]}"; do
68+ name="${NAMES[$i]}"
69+ driver="${DRIVERS[$i]:-unknown}"
70+ devtype="${DEVTYPES[$i]:-unknown}"
71+ log "GPU$i: $name"
72+ info "driverID: $driver"
73+ info "deviceType: $devtype"
74+
75+ case "$devtype" in
76+ *DISCRETE*|*INTEGRATED*) HAS_REAL_GPU=1 ;;
77+ esac
78+
79+ if [ "$driver" = "DRIVER_ID_MESA_DOZEN" ] && printf '%s' "$name" | grep -qi nvidia; then
80+ HAS_NVIDIA_DZN=1
81+ fi
82+ log
83+done
84+
85+if [ "$HAS_REAL_GPU" -eq 0 ]; then
86+ warn "Only software/CPU devices showed up (e.g. llvmpipe) -- no real GPU reached"
87+ warn "Vulkan. That's the actual problem; the dzn warning is not it."
88+ info "Checking WSL's D3D12 bridge libraries:"
89+ if [ -d /usr/lib/wsl/lib ]; then
90+ ls /usr/lib/wsl/lib | sed 's/^/ /'
91+ else
92+ warn "/usr/lib/wsl/lib does not exist -- WSL's GPU support isn't wired up."
93+ fi
94+ info "From Windows PowerShell: wsl --update, then wsl --shutdown and reopen."
95+ exit 1
96+fi
97+
98+ok "Vulkan sees a real GPU (not just software rasterizer) -- the dashboard warning"
99+ok "is noise from driver init, not a sign that your GPU setup is broken."
100+log
101+
102+if [ "$HAS_NVIDIA_DZN" -eq 1 ]; then
103+ log "NVIDIA GPU detected but running through dzn/D3D12 instead of NVIDIA's"
104+ log "native WSL Vulkan ICD. Looking for the native manifest..."
105+
106+ NATIVE_ICD=""
107+ for candidate in /usr/lib/wsl/lib/nvidia_icd.json /usr/lib/wsl/lib/*/nvidia_icd.json; do
108+ [ -f "$candidate" ] && NATIVE_ICD="$candidate" && break
109+ done
110+
111+ if [ -z "$NATIVE_ICD" ]; then
112+ warn "No nvidia_icd.json found under /usr/lib/wsl/lib."
113+ info "That file is shipped by the Windows NVIDIA driver, not this Linux"
114+ info "distro. On Windows: update the NVIDIA driver, run 'wsl --update',"
115+ info "then 'wsl --shutdown' and reopen WSL. If it's still missing after"
116+ info "that, dzn is genuinely the only path available right now and the"
117+ info "warning is cosmetic, same as the AMD/Intel case above."
118+ exit 0
119+ fi
120+
121+ ok "Found native ICD manifest: $NATIVE_ICD"
122+
123+ if [ "$(id -u)" -ne 0 ]; then
124+ warn "Need root to register it under /etc/vulkan/icd.d -- re-run with sudo."
125+ exit 1
126+ fi
127+
128+ mkdir -p /etc/vulkan/icd.d
129+ DEST=/etc/vulkan/icd.d/nvidia_icd.json
130+ if [ -e "$DEST" ] && [ ! -L "$DEST" ]; then
131+ warn "$DEST already exists and isn't a symlink we made -- leaving it alone."
132+ info "Point VK_ICD_FILENAMES=$NATIVE_ICD at it manually if you want to force it."
133+ exit 1
134+ fi
135+ ln -sf "$NATIVE_ICD" "$DEST"
136+ ok "Linked $DEST -> $NATIVE_ICD"
137+
138+ log
139+ log "Re-checking with the native ICD registered:"
140+ if vulkaninfo --summary 2>/dev/null | grep -q "DRIVER_ID_NVIDIA"; then
141+ ok "Native NVIDIA driver is now active -- the dzn warning should be gone."
142+ else
143+ warn "Still not picked up. Try forcing it for one run to confirm the file works:"
144+ info " VK_ICD_FILENAMES=$NATIVE_ICD vulkaninfo --summary"
145+ fi
146+ exit 0
147+fi
148+
149+log "No native WSL Vulkan ICD exists for this GPU vendor (AMD/Intel don't have"
150+log "one, unlike NVIDIA) -- dzn-over-D3D12 is the only Vulkan path WSL2 gives"
151+log "you here. The warnings you're seeing are expected driver chatter on every"
152+log "Vulkan app under WSL2 with this hardware, including Pyre's own benchmarks."
153+log "There is nothing left to install or fix."