← 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
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.h3
+ src/H/backends/cpu/monte_carlo.h src/H/backends/vulkan/context.h54
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 bash2
+# Diagnoses the "WARNING: dzn is not a conformant Vulkan implementation"3
+# and "Dropped Escape call with ulEscapeCode : ..." lines that show up in4
+# Pyre's dashboard log under WSL2 (dashboard.c pipes the child process's5
+# raw stdout+stderr into the log view, so driver chatter goes straight6
+# through).7
+#8
+# What these lines actually mean:9
+# - WSL2 has no kernel-level GPU passthrough. Vulkan only reaches the10
+# GPU by translating calls to D3D12, via Mesa's "dzn" (Dozen) driver.11
+# - NVIDIA additionally ships its own native Vulkan ICD into WSL12
+# (/usr/lib/wsl/lib/nvidia_icd.json) alongside the D3D12 path. If the13
+# 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 Vulkan15
+# path available for them, full stop -- the warning is unavoidable16
+# 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 once21
+# a real GPU is confirmed present.22
+# 3. On NVIDIA: if the native ICD manifest exists on disk but isn't in23
+# the loader's search path, registers it under /etc/vulkan/icd.d so24
+# native NVIDIA Vulkan is used instead of the dzn fallback.25
+set -euo pipefail26
+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; then33
+ 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 136
+fi37
+38
+if ! command -v vulkaninfo >/dev/null 2>&1; then39
+ warn "vulkaninfo not found -- run tools/install_deps.sh first."40
+ exit 141
+fi42
+43
+log "fix_wsl2.sh: checking Vulkan device visibility under WSL2"44
+log45
+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 ]; then54
+ 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 163
+fi64
+65
+HAS_REAL_GPU=066
+HAS_NVIDIA_DZN=067
+for i in "${!NAMES[@]}"; do68
+ 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" in76
+ *DISCRETE*|*INTEGRATED*) HAS_REAL_GPU=1 ;;77
+ esac78
+79
+ if [ "$driver" = "DRIVER_ID_MESA_DOZEN" ] && printf '%s' "$name" | grep -qi nvidia; then80
+ HAS_NVIDIA_DZN=181
+ fi82
+ log83
+done84
+85
+if [ "$HAS_REAL_GPU" -eq 0 ]; then86
+ 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 ]; then90
+ ls /usr/lib/wsl/lib | sed 's/^/ /'91
+ else92
+ warn "/usr/lib/wsl/lib does not exist -- WSL's GPU support isn't wired up."93
+ fi94
+ info "From Windows PowerShell: wsl --update, then wsl --shutdown and reopen."95
+ exit 196
+fi97
+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
+log101
+102
+if [ "$HAS_NVIDIA_DZN" -eq 1 ]; then103
+ 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; do108
+ [ -f "$candidate" ] && NATIVE_ICD="$candidate" && break109
+ done110
+111
+ if [ -z "$NATIVE_ICD" ]; then112
+ 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 0119
+ fi120
+121
+ ok "Found native ICD manifest: $NATIVE_ICD"122
+123
+ if [ "$(id -u)" -ne 0 ]; then124
+ warn "Need root to register it under /etc/vulkan/icd.d -- re-run with sudo."125
+ exit 1126
+ fi127
+128
+ mkdir -p /etc/vulkan/icd.d129
+ DEST=/etc/vulkan/icd.d/nvidia_icd.json130
+ if [ -e "$DEST" ] && [ ! -L "$DEST" ]; then131
+ 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 1134
+ fi135
+ ln -sf "$NATIVE_ICD" "$DEST"136
+ ok "Linked $DEST -> $NATIVE_ICD"137
+138
+ log139
+ log "Re-checking with the native ICD registered:"140
+ if vulkaninfo --summary 2>/dev/null | grep -q "DRIVER_ID_NVIDIA"; then141
+ ok "Native NVIDIA driver is now active -- the dzn warning should be gone."142
+ else143
+ 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
+ fi146
+ exit 0147
+fi148
+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."