Integrated gfx11 under Linux: the expert arena is not registered with the driver by default

What the box showed (p2006, Radeon 780M gfx1103, 11-15): with the load, exit and transfer fixes in, the registered arena still reset
the GPU on its first start (first 512-token request, queue 1, "Failed to quiesce KFD"). The same binary with the arena unregistered
(STRATA_ARENA_PIN_GIB=none) ran 12 of 12 starts and 144 of 144 requests clean, with no eviction and no page move after READY, and
gave the same tokens as the registered build on every request.

So on this class the arena takes the existing unregistered path (UMA mode) by default. In that default no mlock is tried: it cannot
succeed under the default memlock limit and only printed "mlock failed (raise ulimit -l)". The start-up line keeps today's text
without that part.

Scope: HIP builds under Linux, every visible card an integrated gfx1103 / gfx1150 / gfx1151 (the class rule of
igpu_kfd_settle_default, the same as the other kfd_quiet fixes). Enforced at the class site in generate.cpp, inside the existing
STRATA_USE_HIP && __linux__ block. Other cards and builds: arena_no_register() and the lock rule compute the same as before (the
rules moved to kfd_quiet.hpp as pure functions, with unit tests).

A value the user set for STRATA_ARENA_PIN_GIB wins (none / 0 / N / auto), STRATA_UMA_REGISTER=1 still registers, a
STRATA_ARENA_LOCK the user set still decides the lock. Switch: STRATA_KFD_QUIET_NOREG=0 (or STRATA_KFD_QUIET=0) registers the arena
as before. No new user setting; STRATA_TRACE prints one trace line.
This commit is contained in:
Niko1221 committed 2026-11-15 03:11:03 +01:00
1 parent f5f28ae749
commit 8d1fadf925
4 files changed
+88 -7

No files matched your search

+35 -2
View File
@@ -10,8 +10,10 @@
// only when drained, then end by the same signal as before;
// XFER GPU_PINNED_MIN_XFER_SIZE set before HIP starts (pageable copies go through the runtime's staging buffers instead of
// pinning our pages in place); a value the caller set wins.
// NOREG the expert arena is not registered with the driver (the unregistered "UMA" path of pinned.cu), and not mlock'ed; a value
// the user set for STRATA_ARENA_PIN_GIB (or STRATA_UMA_REGISTER=1) wins.
// None changes a kernel or what is computed. STRATA_KFD_QUIET=0 turns all of them off at run time (A/B with the same binary);
// STRATA_KFD_QUIET_LOAD / _EXIT / _XFER = 0 turn one off. STRATA_TRACE prints one line per change that is active.
// STRATA_KFD_QUIET_LOAD / _EXIT / _XFER / _NOREG = 0 turn one off. STRATA_TRACE prints one line per change that is active.
//
// Pure pieces, testable without a GPU (tests/core/kfd_quiet_test.cpp): the switch rule, the topology rule (the device class
// from the KFD topology files, readable before HIP starts), and the teardown order with the GPU layer passed in.
@@ -30,7 +32,7 @@
namespace strata::core::kfd_quiet {
enum class Fix { Load, Exit, Xfer };
enum class Fix { Load, Exit, Xfer, NoReg, Lend };
/// The device class, set by the engine once the card is named (the rule of igpu_kfd_settle_default: integrated gfx1103 / gfx1150 /
/// gfx1151, Linux, every visible card). Load and Exit do nothing while it is false.
@@ -51,6 +53,8 @@ inline const char* fix_env(Fix f) {
case Fix::Load: return "STRATA_KFD_QUIET_LOAD";
case Fix::Exit: return "STRATA_KFD_QUIET_EXIT";
case Fix::Xfer: return "STRATA_KFD_QUIET_XFER";
case Fix::NoReg: return "STRATA_KFD_QUIET_NOREG";
case Fix::Lend: return "STRATA_KFD_QUIET_LEND";
}
return "STRATA_KFD_QUIET_LOAD";
}
@@ -76,6 +80,35 @@ inline LoadMoves load_moves() {
return load_moves(class_flag().load(std::memory_order_relaxed), std::getenv("STRATA_KFD_QUIET"), std::getenv(fix_env(Fix::Load)));
}
// ---- NOREG: the expert arena is not registered with the GPU driver on the class ---------------------------------------------------
/// Set by the engine (with arena_uma_no_register_flag, pinned.hpp) when NOREG chose the unregistered arena: the arena is then not
/// locked with mlock either (it cannot succeed under the default memlock limit of this class and only said "mlock failed").
inline std::atomic<bool>& noreg_flag() {
static std::atomic<bool> f{false};
return f;
}
/// NOREG: the class, the switches, and STRATA_UMA_REGISTER=1 (the existing "register it as before") not set.
inline bool noreg_default(bool cls, const char* all, const char* one, const char* uma_register) {
if (uma_register != nullptr && uma_register[0] == '1') return false;
return cls && switch_on(all, one);
}
/// The arena's mode (pinned.cu arena_no_register): a value the user set for STRATA_ARENA_PIN_GIB wins ("none" = not registered,
/// anything else = registered as that value says); unset or empty, the engine's flag decides.
inline bool arena_unregistered(const char* pin_gib, bool engine_flag) {
if (pin_gib != nullptr && *pin_gib != '\0') return std::string(pin_gib) == "none";
return engine_flag;
}
/// Whether the unregistered arena is locked with mlock: a STRATA_ARENA_LOCK the user set decides as before ("0" = no lock, anything
/// else = lock); unset, it is locked unless NOREG chose the mode (`noreg`).
inline bool arena_lock_wanted(bool noreg, const char* lock_env) {
if (lock_env != nullptr) return std::string(lock_env) != "0";
return !noreg;
}
// ---- XFER: the device class from the KFD topology (before HIP starts) ------------------------------------------------------------
/// One node's properties text: `gfx_target_version` and `simd_count` (0 when absent). A CPU node has simd_count 0.
+11 -5
View File
@@ -4,6 +4,7 @@
#include "strata/core/pin_budget.hpp"
#include "strata/core/arch_defaults.hpp" // arena_skip_thp_request
#include "strata/core/page_cache_drop.hpp" // drop_range (the drop behind the arena read, Linux)
#include "strata/core/kfd_quiet.hpp" // NOREG: the arena's mode and its lock (integrated gfx11, Linux HIP)
#include <cstddef>
#include <cuda_runtime.h>
@@ -578,9 +579,9 @@ void set_held_address_space(std::vector<uint64_t> bases) {
}
bool arena_no_register() {
const char* e = std::getenv("STRATA_ARENA_PIN_GIB");
if (e != nullptr && *e != '\0') return std::string(e) == "none"; // an explicit setting wins over the engine's flag
return arena_uma_no_register_flag().load(std::memory_order_relaxed);
// an explicit setting wins over the engine's flag (kfd_quiet.hpp arena_unregistered: the same rule as before, testable)
return strata::core::kfd_quiet::arena_unregistered(std::getenv("STRATA_ARENA_PIN_GIB"),
arena_uma_no_register_flag().load(std::memory_order_relaxed));
}
int arena_pin_cap_gib() {
@@ -789,13 +790,16 @@ PinnedArena::PinnedArena(uint64_t bytes, const std::vector<uint64_t>& bounds,
// 153-igpu (UMA mode): nothing is registered; the whole arena stays resident through the working-set lock instead
slice_bytes = 1; // "sliced" with no slice registered: the destructor unlocks from offset registered_bytes (0)
const char* env = std::getenv("STRATA_ARENA_LOCK");
// (kfd_quiet.hpp NOREG, integrated gfx11 under Linux: when the engine chose this mode, no mlock is tried and nothing is said
// about it; a STRATA_ARENA_LOCK the user set decides as before)
const bool noreg = strata::core::kfd_quiet::noreg_flag().load(std::memory_order_relaxed);
if (backing == PageBacking::LargePages) {
note = "large pages are resident without a lock; " + note;
} else if (env == nullptr || std::string(env) != "0") {
} else if (strata::core::kfd_quiet::arena_lock_wanted(noreg, env)) {
const strata::platform::LockResult lr = strata::platform::lock_resident((uint8_t*) base, bytes);
locked_bytes = lr.locked_bytes;
note = lr.note + "; " + note;
} else {
} else if (!noreg || env != nullptr) {
note = "arena lock disabled (STRATA_ARENA_LOCK=0); " + note;
}
note = "NOT registered with the GPU driver (integrated GPU, UMA mode; STRATA_ARENA_PIN_GIB=0 registers it); " + note;
@@ -972,6 +976,8 @@ PinnedArena::PinnedArena(uint64_t bytes, ByNeed, const std::vector<std::pair<uin
} else if (env != nullptr && std::string(env) == "0") {
note = "arena lock disabled (STRATA_ARENA_LOCK=0); " + note;
locked_ranges.clear();
} else if (none && !strata::core::kfd_quiet::arena_lock_wanted(strata::core::kfd_quiet::noreg_flag().load(std::memory_order_relaxed), env)) {
locked_ranges.clear(); // kfd_quiet.hpp NOREG chose the unregistered arena: no mlock tried, nothing said (as in the constructor above)
} else {
for (const auto& r : locked_ranges) holes.emplace_back((uint8_t*) base + r.first, r.second);
const strata::platform::LockResult lr = strata::platform::lock_resident_ranges(holes);
+11
View File
@@ -4125,6 +4125,17 @@ int main(int argc, char** argv) {
// and the KFD is not provoked while our queues are busy (kfd_quiet.hpp): the same device class, HIP under Linux only
if (strata::core::igpu_kfd_settle_default(ad.gcnArchName, all_igpu, win_host)) {
strata::core::kfd_quiet::class_flag().store(true);
// NOREG: the expert arena takes the unregistered path above (UMA mode) by default on this class, without mlock: with the
// arena registered, the first request reset the 780M on its first start (p2006, 11-15, three fixes in); unregistered, 12 of
// 12 starts ran clean. STRATA_ARENA_PIN_GIB set by the user (or STRATA_UMA_REGISTER=1) wins; STRATA_KFD_QUIET_NOREG=0 registers.
if (strata::core::kfd_quiet::noreg_default(true, std::getenv("STRATA_KFD_QUIET"), std::getenv("STRATA_KFD_QUIET_NOREG"),
std::getenv("STRATA_UMA_REGISTER"))) {
strata::core::arena_uma_no_register_flag().store(true);
strata::core::kfd_quiet::noreg_flag().store(true);
if (std::getenv("STRATA_TRACE") != nullptr)
std::fprintf(stderr, "strata trace: kfd quiet: expert arena not registered with the driver, no mlock (%s)\n",
strata::core::arena_no_register() ? "in effect" : "STRATA_ARENA_PIN_GIB set: registered as it says");
}
if (std::getenv("STRATA_TRACE") != nullptr && strata::core::kfd_quiet::on(strata::core::kfd_quiet::Fix::Load))
std::fprintf(stderr, "strata trace: kfd quiet: load order active (check first, settle after the expert cache, first prompt's buffers at init)\n");
if (strata::core::kfd_quiet::on(strata::core::kfd_quiet::Fix::Exit)) {
+31
View File
@@ -189,10 +189,41 @@ void stop_order() {
CHECK(on_signal(1) == OnSignal::DefaultAction);
CHECK(on_signal(2) == OnSignal::DefaultAction);
}
void noreg() {
CHECK(std::string(fix_env(Fix::NoReg)) == "STRATA_KFD_QUIET_NOREG");
// the class default: unregistered, unless a switch says 0 or STRATA_UMA_REGISTER=1 asks for the registration
CHECK(noreg_default(true, nullptr, nullptr, nullptr));
CHECK(noreg_default(true, "1", "1", nullptr));
CHECK(noreg_default(true, nullptr, nullptr, "0"));
CHECK(!noreg_default(false, nullptr, nullptr, nullptr)); // every other card keeps its registered arena
CHECK(!noreg_default(false, "1", "1", nullptr));
CHECK(!noreg_default(true, "0", nullptr, nullptr)); // STRATA_KFD_QUIET=0
CHECK(!noreg_default(true, nullptr, "0", nullptr)); // STRATA_KFD_QUIET_NOREG=0
CHECK(!noreg_default(true, nullptr, nullptr, "1")); // STRATA_UMA_REGISTER=1
// the arena's mode: the user's STRATA_ARENA_PIN_GIB wins both ways; unset or empty, the engine's flag
CHECK(arena_unregistered(nullptr, true));
CHECK(arena_unregistered("", true));
CHECK(!arena_unregistered(nullptr, false));
CHECK(arena_unregistered("none", false));
CHECK(arena_unregistered("none", true));
CHECK(!arena_unregistered("0", true)); // the user registers the whole arena
CHECK(!arena_unregistered("8", true)); // ... or a capped part of it
CHECK(!arena_unregistered("auto", true));
// the lock: never tried in the class default; a STRATA_ARENA_LOCK the user set decides; outside NOREG as before (lock unless "0")
CHECK(!arena_lock_wanted(true, nullptr));
CHECK(arena_lock_wanted(true, "1"));
CHECK(!arena_lock_wanted(true, "0"));
CHECK(arena_lock_wanted(false, nullptr));
CHECK(arena_lock_wanted(false, "1"));
CHECK(arena_lock_wanted(false, ""));
CHECK(!arena_lock_wanted(false, "0"));
}
} // namespace
int main() {
switches();
noreg();
load_order();
topology();
stop_order();