From 734dbd134f47b233c58f952021da734d76d35818 Mon Sep 17 00:00:00 2001 From: igneum-labs <337424239+igneum-labs@users.noreply.github.com> Date: Sun, 4 Oct 2026 10:12:35 +0000 Subject: [PATCH] NVRTC worker: -default-device (NVRTC rejects unannotated pack helpers as host code; found on the first real card) Co-Authored-By: Claude Fable 5.1 --- proto-cuda/nvrtc/worker.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/proto-cuda/nvrtc/worker.cpp b/proto-cuda/nvrtc/worker.cpp index 08dab887c..10eaa476b 100644 --- a/proto-cuda/nvrtc/worker.cpp +++ b/proto-cuda/nvrtc/worker.cpp @@ -328,8 +328,10 @@ static bool rtcCompile(Ctx& c, const std::string& src, const char* name, const s if (r != NVRTC_SUCCESS) { err = "nvrtcAddNameExpression " + e + ": " + c.rtc.getErrorString(r); c.rtc.destroyProgram(&prog); return false; } } std::string archOpt = "--gpu-architecture=" + c.archOpt; - const char* opts[2] = { archOpt.c_str(), "--std=c++17" }; - r = c.rtc.compileProgram(prog, 2, opts); + // -default-device: NVRTC rejects unannotated functions as host code (nvcc treats them as host and discards them); + // the pack headers (program.h, memhard.h) carry plain inline helpers, so every unannotated function is device code here. + const char* opts[3] = { archOpt.c_str(), "--std=c++17", "-default-device" }; + r = c.rtc.compileProgram(prog, 3, opts); { size_t logSize = 0; if (c.rtc.getProgramLogSize(prog, &logSize) == NVRTC_SUCCESS && logSize > 1) {