#289 follow-up: a placeholder GPU name when the properties query fails; HIP builds compile (no device_code_error probe)

- generate.cpp: the startup line names "(an unnamed GPU)" when cudaGetDevice/cudaGetDeviceProperties fail (the
  error is cleared), and the "no code for" message uses the same name; a HIP build prints the gfx architecture
  instead of a CUDA compute capability.
- device.cu: device_code_error() returns "" on HIP - cudaFuncAttributes/cudaFuncGetAttributes have no mapping in
  hip_compat, and gpu_arch_problem() already stops a HIP run on an architecture the build lacks.
- fused_gr.cu: STRATA_EMULATE_CC also answers the two compute-capability queries there (small tile, the sm_70
  capacity rule), as the PR's description promises; with the variable unset nothing changes.
This commit is contained in:
Niko1221 committed 2026-10-01 08:11:39 +02:00
1 parent a606e3a966
commit 158e85bf43
3 files changed
+18 -7

No files matched your search

+11 -5
View File
@@ -2397,14 +2397,20 @@ int main(int argc, char** argv) {
// otherwise, after the whole expert arena has loaded) - before the arena starts loading
int dev = 0;
cudaDeviceProp p{};
if (cudaGetDevice(&dev) == cudaSuccess && cudaGetDeviceProperties(&p, dev) == cudaSuccess)
std::fprintf(stderr, "strata generate: GPU %d: %s, compute capability %d.%d%s\n", dev, p.name,
strata::cc_major_of(p.major), strata::cc_minor_of(p.minor),
strata::emulated_cc() ? " (STRATA_EMULATE_CC: a test mode, the card is emulated)" : "");
const bool named = cudaGetDevice(&dev) == cudaSuccess && cudaGetDeviceProperties(&p, dev) == cudaSuccess;
if (!named) cudaGetLastError();
const char* name = named && p.name[0] ? p.name : "(an unnamed GPU)";
#if defined(STRATA_USE_HIP)
std::fprintf(stderr, "strata generate: GPU %d: %s (%s)\n", dev, name, named ? p.gcnArchName : "?");
#else
std::fprintf(stderr, "strata generate: GPU %d: %s, compute capability %d.%d%s\n", dev, name,
strata::cc_major_of(p.major), strata::cc_minor_of(p.minor),
strata::emulated_cc() ? " (STRATA_EMULATE_CC: a test mode, the card is emulated)" : "");
#endif
const std::string e = strata::core::device_code_error();
if (!e.empty()) {
std::fprintf(stderr, "strata generate: this engine has no code for %s (sm_%d%d): %s - rebuild it for this "
"card (setup does: START-HERE.bat --setup)\n", p.name, p.major, p.minor, e.c_str());
"card (setup does: START-HERE.bat --setup)\n", name, p.major, p.minor, e.c_str());
return 1;
}
}