From 73e01fa54dc276ceb31c2aa352778e8201fb4664 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Wed, 7 Oct 2026 02:52:41 +0200 Subject: [PATCH] sycl: on the xe driver without --stream-experts, --pcie-frac defaults to 0 (and an explicit value gets a warning) An Arc Pro B70 (xe) page-faults when a kernel reads ordinary pageable host memory (devcoredump: ccs0, FaultType 0, faulted address in the CPU's mmap range, then Timedout job and device lost). Without --stream-experts the experts outside the VRAM cache sit in a pageable arena that the PCIe share hands to the GPU. The default share is 0 there (the CPU computes those misses) with a one-line warning naming --stream-experts, as setup configures it. An explicit --pcie-frac is kept and warned about. i915 (Arc Alchemist), CUDA and HIP are unchanged. strata::intel_gpu_driver() reads the driver from sysfs; verify.cpp's i915 test uses it. The mirror table (host-mirror pointers for the device plan) is filled only from pinned USM aliases under --stream-experts, so it cannot hand out pageable pointers. --- sycl/include/strata/sycl_queue.hpp | 25 +++++++++++++++++++++++++ sycl/src/core/verify.cpp | 14 +------------- sycl/src/program/generate.cpp | 19 +++++++++++++++++++ 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/sycl/include/strata/sycl_queue.hpp b/sycl/include/strata/sycl_queue.hpp index 69a55c48..e9986d82 100644 --- a/sycl/include/strata/sycl_queue.hpp +++ b/sycl/include/strata/sycl_queue.hpp @@ -90,3 +90,28 @@ inline void host_free_polled(void* p, sycl::queue& q) { sycl::free(p, q); } } // namespace strata + +// The kernel driver of the Intel GPU ("xe", "i915", or "" when unknown), from sysfs. The driver decides what the GPU +// may read: an Arc A750 (i915) reads ordinary host memory a kernel is handed; an Arc Pro B70 (xe) page-faults on it +// (ccs0, FaultType 0, address in the CPU's mmap range) and the card times the job out. +#include +#include +#include +namespace strata { +inline const std::string& intel_gpu_driver() { + static const std::string drv = [] { + std::error_code ec; + for (const auto& e : std::filesystem::directory_iterator("/sys/class/drm", ec)) { + const std::string n = e.path().filename().string(); + if (n.rfind("card", 0) != 0 || n.find('-') != std::string::npos) continue; + std::ifstream vf(e.path() / "device" / "vendor"); + std::string vendor; + if (!(vf >> vendor) || vendor != "0x8086") continue; + const auto d = std::filesystem::read_symlink(e.path() / "device" / "driver", ec); + if (!ec) return d.filename().string(); + } + return std::string(); + }(); + return drv; +} +} // namespace strata diff --git a/sycl/src/core/verify.cpp b/sycl/src/core/verify.cpp index 7487dcb1..8e27634a 100644 --- a/sycl/src/core/verify.cpp +++ b/sycl/src/core/verify.cpp @@ -147,19 +147,7 @@ bool one_token_self_commit() { } // True when the GPU runs under the i915 kernel driver (Arc Alchemist: A310-A770), read from sysfs. -bool intel_i915_gpu() { - static const bool v = [] { - std::error_code ec; - for (const auto& e : std::filesystem::directory_iterator("/sys/class/drm", ec)) { - const std::string n = e.path().filename().string(); - if (n.rfind("card", 0) != 0 || n.find('-') != std::string::npos) continue; - const auto drv = std::filesystem::read_symlink(e.path() / "device" / "driver", ec); - if (!ec && drv.filename() == "i915") return true; - } - return false; - }(); - return v; -} +bool intel_i915_gpu() { return strata::intel_gpu_driver() == "i915"; } // How long the host waits for a layer's doorbell before it gives the window up (#267). 20 s by default; the first // window of a run on a card that JIT-compiles its kernels (no AOT: an Arc A750 needs FP64 emulation) can take longer diff --git a/sycl/src/program/generate.cpp b/sycl/src/program/generate.cpp index ce2f488a..76b94853 100644 --- a/sycl/src/program/generate.cpp +++ b/sycl/src/program/generate.cpp @@ -2480,6 +2480,7 @@ int main(int argc, char **argv) try { // link (the copy kernel, since 0.1.14), so on a slower link it must shrink or the window waits for it. The // real H2D bandwidth is probed once; from 20 GB/s up (x16 PCIe 4/5) the measured default stays. The canonical // pack's 0.2 was never measured against the link, so it is left alone. `--calibrate` measures it outright. + const bool pcie_explicit = o.pcie_frac >= 0.0; if (o.pcie_frac < 0.0) { const double base = native_pack ? 0.55 : 0.2; std::string bursts; @@ -2495,6 +2496,24 @@ int main(int argc, char **argv) try { std::fprintf(stderr, "strata generate: PCIe probe failed -> pcie_frac default %.2f\n", base); } } + // SYCL port, Arc on the xe driver (Arc Pro B60/B65/B70, B580): the GPU page-faults when a kernel reads ordinary + // (pageable) host memory, and the card times the job out (seen on a B70: Timedout job, Fault response -EINVAL, + // faulted address in the CPU's mmap range). Without --stream-experts the experts outside the VRAM cache stay in a + // pageable arena that the PCIe share (--pcie-frac) hands to the GPU. Recommend, never force: the default share + // becomes 0 (the CPU computes those misses) and an explicit --pcie-frac is kept with a warning. + if (strata::intel_gpu_driver() == "xe" && !o.stream_experts) { + if (!pcie_explicit) { + o.pcie_frac = 0.0; + std::fprintf(stderr, "strata generate: xe driver without --stream-experts: the GPU faults on pageable host " + "memory, so --pcie-frac defaults to 0 here (the CPU computes the experts outside VRAM). " + "Use --stream-experts, as setup configures it, to let the GPU read a pinned mirror\n"); + } else if (o.pcie_frac > 0.0) { + std::fprintf(stderr, "strata generate: WARNING: --pcie-frac %.2f on the xe driver without --stream-experts " + "makes the GPU read pageable host memory; that page-faulted and hung an Arc Pro B70 " + "(Timedout job, device lost). Use --stream-experts, as setup configures it, or " + "--pcie-frac 0\n", o.pcie_frac); + } + } // the canonical Q2_0 pack's CPU kernels are AVX-512 only; a native pack runs on AVX2 CPUs as well if (!native_pack) strata::kernels::cpu::cpu_require_expert_support(); else if (!strata::kernels::cpu::cpu_avx512_ok())