Merge the Aurora gfx1151 branch (f-halo-int + HCD_EXACT + the expert bundle) onto 0.1.39

Merges f-halo-int (82cf9b8 + 56 commits: the gfx1151 target, WMMA prompt attention / GEMM / scorer, GDN recurrence,
fused gfx11 prompt experts, decode switches, drafting) with f-halo-int-S (STRATA_HCD_EXACT, 203ec5c) and
f-halo-int-W (table16, float4 combine, LDS alias + occupancy, d23d4e2).  Conflicts resolved against 0.1.39's own
all-resident verify graph, forked shared-expert stream, fused swiglu q8_1, PLE batch, GDN commit split and peer
prompt path; the gfx1151-only code stays gated (build fixes and the arch defaults follow in separate commits).
This commit is contained in:
Niko1221 committed 2026-10-05 11:07:15 +02:00
commit bc6b6f87a9
66 files changed
+7050 -260

No files matched your search

+39
View File
@@ -15,11 +15,49 @@
#include <algorithm>
#include <cstdio>
#include <filesystem>
#include <cstdlib>
#include <utility>
#include <cstring>
namespace strata::core {
// See the header. NVIDIA's DGX Spark Porting Guide (section 5.5, "Memory reporting on UMA systems") recommends the same:
// not to rely on cudaMemGetInfo alone but to count the memory the OS can reclaim. Swap is not counted here (unlike
// NVIDIA's reference snippet): an expert cache that pushes the system into swap would be far slower than a smaller one.
size_t device_free_bytes() {
size_t free_b = 0, total_b = 0;
cudaMemGetInfo(&free_b, &total_b);
#if defined(__linux__)
static const bool unified_memory = [] {
int dev = 0, v = 0;
return cudaGetDevice(&dev) == cudaSuccess && cudaDeviceGetAttribute(&v, cudaDevAttrIntegrated, dev) == cudaSuccess && v;
}();
if (unified_memory) {
if (FILE* m = std::fopen("/proc/meminfo", "r")) {
char line[256];
unsigned long long kb = 0;
while (std::fgets(line, sizeof line, m))
if (std::sscanf(line, "MemAvailable: %llu kB", &kb) == 1) break;
std::fclose(m);
// STRATA_UMA_HEADROOM_GIB: a whole number of GiB, 0..1024; anything else keeps the default 6 (said once)
static const long gib = [] {
const char* h = std::getenv("STRATA_UMA_HEADROOM_GIB");
if (h == nullptr) return 6L;
char* end = nullptr;
const long v = std::strtol(h, &end, 10);
if (end != h && *end == '\0' && v >= 0 && v <= 1024) return v;
std::fprintf(stderr, "strata: STRATA_UMA_HEADROOM_GIB=%s is not a whole number of GiB (0-1024): using 6\n", h);
return 6L;
}();
const unsigned long long head = (unsigned long long) gib << 30;
const unsigned long long avail = kb << 10;
if (avail > head && avail - head > free_b) free_b = (size_t) (avail - head);
}
}
#endif
return free_b;
}
bool read_expert_profile(const std::string& path, int64_t n_layers, int64_t n_expert,
std::vector<std::pair<int32_t, int32_t>>& ranked, int64_t& slots, std::string& err) {
std::FILE* f = std::fopen(path.c_str(), "rb");
@@ -422,6 +460,7 @@ bool ExpertCache::open(int64_t n_slots, int64_t n_layers, int64_t n_expert, int6
// and the two numbers are named in the refusal.
size_t free_b = 0, total_b = 0;
if (cudaMemGetInfo(&free_b, &total_b) == cudaSuccess) {
free_b = device_free_bytes(); // unified memory: what the OS can give back counts (see the header)
if ((uint64_t) free_b < want) {
char buf[320];
std::snprintf(buf, sizeof buf,