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) {