Repository navigation
xpu: without Sysman (WSL2), free memory falls back to the core total (stacked on #1672) - #1691
Merged
Merged
Conversation
…a prompt cache needs free memory Under WSL2 (Intel Iris Xe 0x9a49 over /dev/dxg, compute runtime 23.43.27642, Level Zero loader 1.16) zesInit(0) segfaults inside libze_intel_gpu.so.1. tensorfold-native died at startup in ze.Gpu.memory(), which the lane host called for the prompt cache budget even when no cache is made. The lane host now reads free memory only for drafted engines, the only ones that keep a cache. zesDriverGet, zesDeviceGet and zesDeviceEnumMemoryModules ask for the count first, clamp it and skip null handles, as the core enumeration does.
…less what the process allocated Under WSL2 the GPU is a WDDM adapter (/dev/dxg, no /dev/dri). NEO 23.43's zesInit walks /dev/dri/renderD128..191, then opens /dev/dxg and faults inside libze_intel_gpu.so.1 (SIGSEGV at 0x100000000, an AVX-512 string compare in libc on a bad pointer), with or without ZES_ENABLE_SYSMAN. With ZES_ENABLE_SYSMAN=1 set before zeInit, zesInit returns ZE_RESULT_ERROR_UNINITIALIZED instead; Sysman has no WDDM backend either way. Gpu.memory() now asks Sysman only where /dev/dri exists (or /dev/dxg does not). Elsewhere free and size are the core total (zeDeviceGetMemoryProperties, asked with room for 8 modules: NEO answers a count query with 0), and the lane host's freeMemory subtracts this process's allocations as before, so a drafted engine's prompt cache is sized on WSL too. tf-xpu-memory-test asks free memory the way the lane host does, before and after a 512 MiB allocation.
Owner
|
Thank you @jschmied. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
Owner
|
Thanks @jschmied! The free-memory fallback for Intel GPUs on WSL2 is in 1.2.1: https://github.com/ashhart/TensorFold/releases/tag/v1.2.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On WSL2,
zesInitcrashes with SIGSEGV inside Intel's driver (NEO 23.43,libze_intel_gpu.so.1)./dev/dri/renderD128–191, which are all missing under WSL. It then opens/dev/dxgand faults atsi_addr=0x100000000.ZES_ENABLE_SYSMAN=1the init fails cleanly instead, but there is still no Sysman.TensorFold calls
zesInitto size a prompt cache from free memory, so a drafted engine (Nemotron with MTP) can't size its cache on WSL.Change
zesInitruns only when a prompt cache needs free memory.ze.Gpu.memory(): calls Sysman only where/dev/driexists or/dev/dxgdoes not. Native Linux (xe/i915) is unchanged.free = size =the core total fromzeDeviceGetMemoryProperties, which works on WSL: 7,428,497,408 bytes on an Iris Xe, the same as clinfo.min(free, size − allocated), so the budget becomes "total minus what TensorFold allocated".ZES_ENABLE_SYSMANis left alone, since setting it changeszeIniton native Linux.Checks
tf-xpu-memory-testreports 6.92 GiB free, and 6.42 GiB after a 512 MiB allocation;xpu-nativeandxpu-testsbuilds still succeed. Native-Linux Sysman isn't retested; its code is unchanged apart from the count-first lists.zig build test, the contract, golden, security and fuzz steps pass;git diff --checkis clean.Stacked on #1672: without its count-first enumeration,
Context.inititself crashes on this machine.