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++

HIP: build main's post-0.1.21 code (trap, device attribute, window-graph listing and GPU stamp); Windows NOMINMAX

Niko122132fe13bac9c1
diff --git a/include/strata/hip_compat/cuda_runtime.h b/include/strata/hip_compat/cuda_runtime.h
index 243d25097..7cfe335e0 100644
--- a/include/strata/hip_compat/cuda_runtime.h
+++ b/include/strata/hip_compat/cuda_runtime.h
@@ -8,6 +8,7 @@
#define cudaDevAttrMaxSharedMemoryPerBlockOptin hipDeviceAttributeMaxSharedMemoryPerBlock
#define cudaDevAttrMultiProcessorCount hipDeviceAttributeMultiprocessorCount
#define cudaDevAttrClockRate hipDeviceAttributeClockRate
+#define cudaDevAttrComputeCapabilityMajor hipDeviceAttributeComputeCapabilityMajor
#define cudaDeviceGetAttribute hipDeviceGetAttribute
#define cudaDeviceProp hipDeviceProp_t
#define cudaDeviceSynchronize hipDeviceSynchronize
@@ -95,6 +96,7 @@ inline hipError_t cudaGraphInstantiate(hipGraphExec_t* exec, hipGraph_t graph,
hipGraphNode_t* error, char* log, size_t size) {
return hipGraphInstantiate(exec, graph, error, log, size);
}
+#define __trap() __builtin_trap() // the compiled-out sm_80 paths (never selected on AMD)
#define cudaMemcpyToSymbol(symbol, ...) hipMemcpyToSymbol(HIP_SYMBOL(symbol), __VA_ARGS__)
#include "intrinsics.hpp"
diff --git a/src/core/expert_source.cpp b/src/core/expert_source.cpp
index 07b89a67e..6e007928e 100644
--- a/src/core/expert_source.cpp
+++ b/src/core/expert_source.cpp
@@ -26,6 +26,9 @@
#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
+#ifndef NOMINMAX
+#define NOMINMAX // std::numeric_limits<T>::max() below
+#endif
#include <windows.h>
#else
#include <fcntl.h>
diff --git a/src/core/verify.cpp b/src/core/verify.cpp
index 29643d6de..a76664bc8 100644
--- a/src/core/verify.cpp
+++ b/src/core/verify.cpp
@@ -829,6 +829,7 @@ bool Verifier::capture(int T, std::string& err) {
err = std::string("verify: end capture: ") + cudaGetErrorString(ce);
return false;
}
+#if !defined(STRATA_USE_HIP) // a CUDA debug listing (node types, kernel names)
if (std::getenv("STRATA_VERIFY_NODES") != nullptr) { // what the window graph holds
size_t nn = 0;
cudaGraphGetNodes(graph, nullptr, &nn);
@@ -856,6 +857,7 @@ bool Verifier::capture(int T, std::string& err) {
for (size_t i = 0; i < v.size() && i < 40; ++i) std::fprintf(stderr, " %d x %.60s;", v[i].first, v[i].second.c_str());
std::fprintf(stderr, "\n");
}
+#endif
const cudaError_t ie = cudaGraphInstantiate(&exec_[T], graph, 0);
cudaGraphDestroy(graph);
if (ie != cudaSuccess) {
diff --git a/src/kernels/cuda/verify_kernels.cu b/src/kernels/cuda/verify_kernels.cu
index 3ba13b497..b8a3a619f 100644
--- a/src/kernels/cuda/verify_kernels.cu
+++ b/src/kernels/cuda/verify_kernels.cu
@@ -544,7 +544,11 @@ void copy_indexed(float* dst, const float* src, int64_t stride, const int32_t* i
// a GPU timestamp (ns, %globaltimer) into buf[i] - the verify window's stage profiler
namespace { __global__ void gpu_stamp_kernel(unsigned long long* buf, int i) {
unsigned long long t;
+#if defined(__HIPCC__)
+ t = wall_clock64() * 10ull; // gfx11: a constant 100 MHz counter, in ns
+#else
asm volatile("mov.u64 %0, %%globaltimer;" : "=l"(t));
+#endif
buf[i] = t;
} }
void gpu_stamp(unsigned long long* buf, int i, void* stream) {