Skip to content

Commit 394dd9c

Browse files
feat(pkg): compat.sycl-runtime 2026.09.07 carries the driver, so a SYCL project need not know CUDA is underneath (#355)
2026.09.06 farms the SYCL runtime and its dlopen chain, and a SYCL artifact using the CUDA back end still needed `compat:cuda-runtime` declared beside it, because `libur_adapter_cuda.so.0` reaches `libcuda.so.1` through the artifact's own search path. That is a true statement about the implementation and a poor one to put in a user's manifest: which back end the SYCL runtime dlopens is the runtime's business, not the project's. 2026.09.07 declares `xim:libcuda-host-link` and links the same versioned soname `compat.cuda-runtime` links -- the same sentinel, the same file, the same soname, so a program that has both farms on its path loads it once. Only the versioned name: mcpp puts `runtime.library_dirs` on the LINK line as well, and an unversioned `libcuda.so` would be found by `-lcuda` and bind the build to one machine's driver. Nothing is required of the machine. On one with no NVIDIA driver the sentinel installs a deliberately dangling link and warns, and the SYCL runtime reports its CUDA back end unavailable -- which is the correct answer and the one it would give anyway. Measured: a consumer declaring `compat:sycl-runtime = "2026.09.07"` and NOTHING else from compat, with `xim:dpcpp`, `xim:gcc` and `xim:cuda-nvcc` in its workspace, answers `12 24 36 48` on an RTX 4080. 2026.09.06 is kept and frozen; a consumer already pinning it keeps resolving and installs the farm it always did. Co-authored-by: speak-agent <x.d2learn.org@gmail.com>
1 parent e17fc88 commit 394dd9c

2 files changed

Lines changed: 48 additions & 3 deletions

File tree

‎pkgs/c/compat.sycl-runtime.lua‎

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,29 @@ package = {
6363
-- developer machine that had zlib installed for other reasons the
6464
-- omission was invisible; a fresh runner reported
6565
-- `FAIL libsycl.so.9: libz.so.1: cannot open shared object file`.
66-
deps = { "xim:dpcpp@7.1.0", "xim:zlib" },
66+
--
67+
-- `xim:libcuda-host-link` is the third, and it is the one the
68+
-- 2026.09.06 version was missing. `libur_adapter_cuda.so.0` needs
69+
-- `libcuda.so.1`, and until the dpcpp payload gained a search path
70+
-- of its own that adapter had none -- so it inherited the
71+
-- ARTIFACT's DT_RPATH, which `compat.cuda-runtime` had already put
72+
-- the driver on. The moment the payload's libraries acquired
73+
-- `RUNPATH = $ORIGIN`, that inheritance switched off for them and
74+
-- the adapter could no longer see a driver two farms away. The
75+
-- sentinel is the one package permitted to know where the driver
76+
-- is; this package declares it and links the same file
77+
-- compat.cuda-runtime links, under the same soname, so a program
78+
-- that has both farms on its path loads it once.
79+
deps = { "xim:dpcpp@7.1.0", "xim:zlib", "xim:libcuda-host-link" },
80+
-- 2026.09.06 is kept and frozen: a consumer already pinning it
81+
-- keeps resolving, and it installs the farm it always did. It is
82+
-- missing `libcuda.so.1`, which on a machine whose dpcpp payload
83+
-- predates the search-path repair is invisible, because the
84+
-- adapter then inherits the artifact's path instead.
85+
["2026.09.07"] = {
86+
url = "https://raw.githubusercontent.com/intel/llvm/v7.1.0/sycl/LICENSE.TXT",
87+
sha256 = "410f3a23b4bbacbd246310d8c014a20af18cfc8c0d740ddf0f673ea20894da9c",
88+
},
6789
["2026.09.06"] = {
6890
-- Nothing downloaded matters: the content is the set of
6991
-- symlinks install() creates. A stable, tiny anchor keeps the
@@ -72,7 +94,7 @@ package = {
7294
url = "https://raw.githubusercontent.com/intel/llvm/v7.1.0/sycl/LICENSE.TXT",
7395
sha256 = "410f3a23b4bbacbd246310d8c014a20af18cfc8c0d740ddf0f673ea20894da9c",
7496
},
75-
["latest"] = { ref = "2026.09.06" },
97+
["latest"] = { ref = "2026.09.07" },
7698
},
7799
},
78100

@@ -260,6 +282,29 @@ function install()
260282
return true
261283
end
262284

285+
-- The driver, through the sentinel and never through a probe of our own.
286+
-- Only the versioned soname: mcpp puts runtime.library_dirs on the LINK
287+
-- line as well, and an unversioned `libcuda.so` here would be picked up by
288+
-- `-lcuda` and bind the build to one machine's driver.
289+
local drv = 0
290+
for _, root in ipairs({ path.directory(path.directory(src)) }) do
291+
local f = io.popen(string.format(
292+
[[ls -1d "%s"/xim-x-libcuda-host-link/*/lib/libcuda.so.1 2>/dev/null | sort -V | tail -1]], root))
293+
local hit = f and (f:read("l") or "") or ""
294+
if f then f:close() end
295+
if hit ~= "" then
296+
os.exec(string.format([[ln -sfn "%s" "%s"]], hit, path.join(outdir, "libcuda.so.1")))
297+
drv = 1
298+
end
299+
end
300+
if drv == 0 then
301+
-- Not fatal, and not this package's business to decide: a machine with
302+
-- no NVIDIA driver is a legitimate configuration, and the SYCL runtime
303+
-- reports an unavailable back end itself.
304+
log.warn("compat.sycl-runtime: no libcuda-host-link found; the CUDA "
305+
.. "back end of the SYCL runtime will report itself unavailable")
306+
end
307+
263308
local stubs = farm_libc_stubs(outdir, src)
264309
log.info("compat.sycl-runtime: %d versioned sonames from %s, %d C-library stubs",
265310
n, src, stubs)

‎tests/examples/sycl-runtime/mcpp.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ name = "sycl-runtime-tests"
99
version = "0.1.0"
1010

1111
[target.'cfg(linux)'.dependencies.compat]
12-
sycl-runtime = "2026.09.06"
12+
sycl-runtime = "2026.09.07"

0 commit comments

Comments
 (0)