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 <noreply@anthropic.com>
This commit is contained in:
igneum-labs 2026-10-04 10:12:35 +00:00
parent a7d7f5da2a
commit 734dbd134f

View file

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