Integrated gfx11 under Linux: the unregistered expert arena only on the Radeon 780M class

The owner decided (by 11:05 on 11-15) that the default "arena not registered with the GPU driver" (NOREG, 8d1fadf92 and the
pinned.cu guard 05718a08f) applies to the Radeon 780M class only: gfx1103, which includes the 760M / 740M of the same chip
family. Strix Halo (gfx1151) keeps its registered arena. Strix Point (gfx1150, an experimental opt-in like gfx1103) also
keeps registration, as before NOREG.

Scope: only NOREG's class changes. LOAD (load order and settle), EXIT (the drain on a stop by signal) and XFER
(GPU_PINNED_MIN_XFER_SIZE) stay as they are for the whole integrated gfx11 class (gfx1103 / gfx1150 / gfx1151). Tokens are
the same in both modes.

How it is enforced: kfd_quiet.hpp gets NOREG's own rule, nodes_in_noreg_class: at least one GPU node in the KFD topology and
every GPU node gfx_target_version 110003. generate.cpp passes that rule to noreg_default instead of `true`, inside the
existing STRATA_USE_HIP && __linux__ block and still under the class check. Any other value (110500, 110501, a discrete
card, a 780M beside another card, no topology) keeps the registered arena. A user's STRATA_ARENA_PIN_GIB or
STRATA_UMA_REGISTER=1 still wins, and STRATA_KFD_QUIET_NOREG=0 (or STRATA_KFD_QUIET=0) still registers. pinned.cu changes
only two comments inside its Linux HIP guards.

Test: tests/core/kfd_quiet_test.cpp checks 110003 (unregistered), 110500 and 110501 (registered), discrete cards and
mixed machines (registered), the switches and STRATA_ARENA_PIN_GIB on top of the new rule, and that LOAD / EXIT / XFER keep
the whole class. g++ -std=c++20 -O1 -Wall -Wextra -Werror on p1004: ok.
This commit is contained in:
Niko1221 committed 2026-11-15 11:09:51 +01:00
1 parent 05718a08f5
commit 5450e4344d
4 files changed
+67 -8

No files matched your search

+18 -2
View File
@@ -11,7 +11,8 @@
// 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.
// the user set for STRATA_ARENA_PIN_GIB (or STRATA_UMA_REGISTER=1) wins. Only on the Radeon 780M class (gfx1103, also the
// 760M / 740M of the same chip family: nodes_in_noreg_class); gfx1150 and gfx1151 keep the registered arena.
// LEND the prompt path keeps its own buffers instead of lending expert cache slots (no refill after every prompt), decided after
// the cache is sized and only where the buffers fit; the chunk stays. Off by default (kNoLendDefaultOn); _LEND=1 turns it on.
// 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);
@@ -100,7 +101,8 @@ inline std::atomic<bool>& noreg_flag() {
return f;
}
/// NOREG: the class, the switches, and STRATA_UMA_REGISTER=1 (the existing "register it as before") not set.
/// NOREG: the class, the switches, and STRATA_UMA_REGISTER=1 (the existing "register it as before") not set. `cls` is NOREG's own
/// class, nodes_in_noreg_class (the Radeon 780M class only), not class_flag().
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);
@@ -209,6 +211,20 @@ inline bool nodes_in_class(const std::vector<Node>& nodes) {
return gpus > 0;
}
/// NOREG's class: the Radeon 780M class only, gfx1103 = 110003 (the 780M and the 760M / 740M of the same chip family). Every GPU
/// node must be one. gfx1150 (Strix Point) and gfx1151 (Strix Halo) keep the registered arena as before, and so does a machine with
/// any other GPU beside it. LOAD, EXIT and XFER keep the whole class of nodes_in_class.
inline bool gfx_in_noreg_class(int64_t gfx) { return gfx == 110003; }
inline bool nodes_in_noreg_class(const std::vector<Node>& nodes) {
int gpus = 0;
for (const Node& n : nodes) {
if (n.simds <= 0) continue;
++gpus;
if (!gfx_in_noreg_class(n.gfx)) return false;
}
return gpus > 0;
}
#if defined(__linux__)
/// The nodes under `topo` (normally /sys/class/kfd/kfd/topology/nodes); empty when the folder is not there.
inline std::vector<Node> read_topology(const std::string& topo) {
+2 -2
View File
@@ -5,7 +5,7 @@
#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)
#if defined(STRATA_USE_HIP) && defined(__linux__) // kfd_quiet NOREG scope: Linux HIP only, every other build keeps its old text
#include "strata/core/kfd_quiet.hpp" // NOREG: the arena's mode and its lock (integrated gfx11, Linux HIP)
#include "strata/core/kfd_quiet.hpp" // NOREG: the arena's mode and its lock (the Radeon 780M class, Linux HIP)
#endif
#include <cstddef>
@@ -799,7 +799,7 @@ PinnedArena::PinnedArena(uint64_t bytes, const std::vector<uint64_t>& bounds,
slice_bytes = 1; // "sliced" with no slice registered: the destructor unlocks from offset registered_bytes (0)
const char* env = std::getenv("STRATA_ARENA_LOCK");
#if defined(STRATA_USE_HIP) && defined(__linux__) // kfd_quiet NOREG scope: Linux HIP only, every other build keeps its old text
// (kfd_quiet.hpp NOREG, integrated gfx11 under Linux: when the engine chose this mode, no mlock is tried and nothing is said
// (kfd_quiet.hpp NOREG, the Radeon 780M class 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) {
+8 -4
View File
@@ -4125,10 +4125,14 @@ 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"),
// NOREG: the expert arena takes the unregistered path above (UMA mode) by default on the Radeon 780M class only (every
// GPU node gfx1103, kfd_quiet.hpp nodes_in_noreg_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. gfx1150 and gfx1151
// keep the registered arena. STRATA_ARENA_PIN_GIB set by the user (or STRATA_UMA_REGISTER=1) wins; STRATA_KFD_QUIET_NOREG=0
// registers.
const bool noreg_cls =
strata::core::kfd_quiet::nodes_in_noreg_class(strata::core::kfd_quiet::read_topology("/sys/class/kfd/kfd/topology/nodes"));
if (strata::core::kfd_quiet::noreg_default(noreg_cls, 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);
+39
View File
@@ -113,8 +113,10 @@ void topology() {
const std::vector<Node> v = read_topology(root);
CHECK(v.size() == 2);
CHECK(nodes_in_class(v));
CHECK(nodes_in_noreg_class(v));
put(root + "/2/properties", k7900);
CHECK(!nodes_in_class(read_topology(root)));
CHECK(!nodes_in_noreg_class(read_topology(root)));
CHECK(read_topology(root + "/none").empty());
for (const char* p : {"/0/properties", "/1/properties", "/2/properties", "/README"}) std::remove((root + p).c_str());
for (const char* p : {"/0", "/1", "/2", ""}) rmdir((root + p).c_str());
@@ -202,6 +204,43 @@ void noreg() {
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
// NOREG's own class: the Radeon 780M class only (gfx1103 = 110003); Strix Point, Strix Halo and discrete cards stay registered
auto noreg_cls = [](const std::vector<const char*>& texts) {
std::vector<Node> v;
for (const char* t : texts) v.push_back(parse_node_properties(t));
return nodes_in_noreg_class(v);
};
auto noreg_on = [&](const std::vector<const char*>& texts) { return noreg_default(noreg_cls(texts), nullptr, nullptr, nullptr); };
CHECK(gfx_in_noreg_class(110003));
CHECK(!gfx_in_noreg_class(110500));
CHECK(!gfx_in_noreg_class(110501));
CHECK(!gfx_in_noreg_class(110000));
CHECK(!gfx_in_noreg_class(120001));
CHECK(noreg_on({kCpuNode, k780M})); // 110003: unregistered
CHECK(!noreg_on({kCpuNode, k890M})); // 110500: registered
CHECK(!noreg_on({kCpuNode, k8060S})); // 110501: registered
CHECK(!noreg_on({kCpuNode, k7900})); // a discrete card: unchanged (registered)
CHECK(!noreg_on({kCpuNode, kR9700}));
CHECK(!noreg_on({kCpuNode, k780M, k7900})); // a 780M beside a discrete card: registered, as before
CHECK(!noreg_on({kCpuNode, k780M, k890M})); // every GPU node must be a gfx1103
CHECK(!noreg_on({}));
CHECK(!noreg_on({kCpuNode}));
// the switches still win on the 780M: STRATA_KFD_QUIET_NOREG=0 / STRATA_KFD_QUIET=0 / STRATA_UMA_REGISTER=1 register
CHECK(!noreg_default(noreg_cls({kCpuNode, k780M}), nullptr, "0", nullptr));
CHECK(!noreg_default(noreg_cls({kCpuNode, k780M}), "0", nullptr, nullptr));
CHECK(!noreg_default(noreg_cls({kCpuNode, k780M}), nullptr, nullptr, "1"));
// the user's STRATA_ARENA_PIN_GIB wins over the class default both ways
CHECK(arena_unregistered(nullptr, noreg_on({kCpuNode, k780M})));
CHECK(!arena_unregistered("0", noreg_on({kCpuNode, k780M})));
CHECK(!arena_unregistered(nullptr, noreg_on({kCpuNode, k8060S})));
CHECK(arena_unregistered("none", noreg_on({kCpuNode, k8060S})));
// LOAD / EXIT / XFER keep the whole integrated gfx11 class
auto cls = [](const std::vector<const char*>& texts) {
std::vector<Node> v;
for (const char* t : texts) v.push_back(parse_node_properties(t));
return nodes_in_class(v);
};
CHECK(cls({kCpuNode, k780M}) && cls({kCpuNode, k890M}) && cls({kCpuNode, k8060S}));
// 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));