Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

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

Niko1221158e85bf439c
diff --git a/src/core/device.cu b/src/core/device.cu
index 4d8e350e1..814635a61 100644
--- a/src/core/device.cu
+++ b/src/core/device.cu
@@ -93,12 +93,16 @@ std::string gpu_arch_problem(int ordinal) {
}
std::string device_code_error() {
+#if defined(STRATA_USE_HIP)
+ return ""; // gpu_arch_problem() checks the HIP architectures against STRATA_HIP_ARCHS, before this point
+#else
// every .cu of the engine is compiled for the same CMAKE_CUDA_ARCHITECTURES, so this kernel stands for all
cudaFuncAttributes a{};
const cudaError_t e = cudaFuncGetAttributes(&a, poison_kernel);
if (e == cudaSuccess) return {};
cudaGetLastError();
return cudaGetErrorString(e);
+#endif
}
DeviceInfo device_info(int ordinal) {
diff --git a/src/kernels/cuda/fused_gr.cu b/src/kernels/cuda/fused_gr.cu
index 7b346b09f..fa8a8adc9 100644
--- a/src/kernels/cuda/fused_gr.cu
+++ b/src/kernels/cuda/fused_gr.cu
@@ -564,7 +564,7 @@ void fused_gr_read_multi(const FusedGrArgs* a, int n_tok, float* xn_scratch, voi
if (dev >= 0 && dev < 64 && !attr[dev]) {
int optin = 0;
cudaDeviceGetAttribute(&optin, cudaDevAttrMaxSharedMemoryPerBlockOptin, dev);
- optin = strata::smem_optin_of(optin);
+ optin = strata::smem_optin_of(optin); // STRATA_EMULATE_CC (tests only)
// the down kernel stages n_tok*TILEV floats of dynamic shared memory - 80 KB at the full 8 tokens of the
// CUDA tile. sm_75 gets the smaller tile: all eight tokens fit one 40 KiB launch there (no more slicing),
// the TQ-5 prefetch holds half the registers, and the smaller blocks raise how many of the 41-block grid
@@ -577,7 +577,7 @@ void fused_gr_read_multi(const FusedGrArgs* a, int n_tok, float* xn_scratch, voi
int cc_maj = 0, cc_min = 0;
cudaDeviceGetAttribute(&cc_maj, cudaDevAttrComputeCapabilityMajor, dev);
cudaDeviceGetAttribute(&cc_min, cudaDevAttrComputeCapabilityMinor, dev);
- const bool small_tile = cc_maj * 10 + cc_min == 75;
+ const bool small_tile = strata::cc_major_of(cc_maj) * 10 + strata::cc_minor_of(cc_min) == 75;
#endif
const int tv = small_tile ? 1280 : 2560;
tile[dev] = tv;
@@ -599,6 +599,7 @@ void fused_gr_read_multi(const FusedGrArgs* a, int n_tok, float* xn_scratch, voi
int cc = 0, per_block = 0;
cudaDeviceGetAttribute(&cc, cudaDevAttrComputeCapabilityMajor, dev);
cudaDeviceGetAttribute(&per_block, cudaDevAttrMaxSharedMemoryPerBlock, dev);
+ cc = strata::cc_major_of(cc);
const int usable = (cc >= 7 && optin > 0) ? optin : per_block;
#endif
const int capacity = usable / (int) (tv * sizeof(float));
diff --git a/src/program/generate.cpp b/src/program/generate.cpp
index 5c127d842..ce58147e6 100644
--- a/src/program/generate.cpp
+++ b/src/program/generate.cpp
@@ -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;
}
}