mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-05 15:58:53 +00:00
Integrated gfx11 under Linux: pageable copies staged by the HIP runtime
The HIP runtime copies a pageable source of 1 MiB or more by pinning its pages in place (a GPU userptr) and keeps them (generate.cpp, the STRATA_ARENA_MMAP note). On a Radeon 780M such a userptr is memory the kernel can move under a running dispatch: the hc check's two 6.5 MB vectors at load, and without a registered arena the lent refill's 1.3 MiB blobs (expert_cache.cpp fill_slot_queued); uma-r13 reset in the load with a "Failed to quiesce KFD" line although nothing of ours was registered. The engine now sets GPU_PINNED_MIN_XFER_SIZE=1000000 before HIP starts on this class, the value STRATA_ARENA_MMAP=1 already sets (measured then: decode 49.06 vs 49.16 ms a window). The class is read from the KFD topology files, since the device properties need HIP up: every GPU node (simd_count > 0) of /sys/class/kfd/kfd/topology/nodes/*/properties has gfx_target_version 110003, 110500 or 110501 (gfx1103 / gfx1150 / gfx1151, integrated only); a machine with another GPU beside them, or no KFD topology, is not the class. What the runtime does with the variable was not checked against its source: C:\TheRock on the owner PC is the Windows binary SDK of TheRock 10.0.0 (bin, include, lib, share; therock-10.0.0.tar.gz holds the same files), not the ROCclr / ROCr sources. Its bin\amdhip64_7.dll carries the names GPU_PINNED_MIN_XFER_SIZE and GPU_PINNED_XFER_SIZE and the line "HSA Copy Using Pinned resource size %d", without the flags' descriptions; it is the Windows (PAL) runtime. The behaviour relied on is the one measured on Linux for STRATA_ARENA_MMAP. Cost by reading: one CPU copy into the runtime's staging buffer per pageable copy of 1 MiB or more (milliseconds at load); none in the default mode's requests, whose copies come from registered or cudaHostAlloc memory. Scope: compiled only with STRATA_USE_HIP on __linux__; set only in the class above, and never over a value the caller set (setenv without overwrite, and not at all when the variable exists). STRATA_KFD_QUIET=0 or STRATA_KFD_QUIET_XFER=0 sets nothing; STRATA_TRACE prints one line when it is set. Test: the topology rule and the value rule in tests/core/kfd_quiet_test.cpp (text cases and a temporary folder tree).
This commit is contained in:
1 parent
59375eb069
commit
f73fa74107
3 files changed
+172
No files matched your search
@@ -3587,6 +3587,21 @@ int main(int argc, char** argv) {
|
||||
// ROCclr stages through its own pinned buffers instead; decode is unchanged (49.06 vs 49.16 ms/window).
|
||||
if (std::getenv("STRATA_ARENA_MMAP") && std::getenv("STRATA_ARENA_MMAP")[0] == '1')
|
||||
setenv("GPU_PINNED_MIN_XFER_SIZE", "1000000", 0); // MiB; an explicit setting wins
|
||||
#endif
|
||||
#if defined(STRATA_USE_HIP) && defined(__linux__)
|
||||
// XFER (kfd_quiet.hpp): on an integrated gfx11 (every GPU node of the KFD topology a gfx1103 / gfx1150 / gfx1151: the class is
|
||||
// read from the topology files, since the device properties need HIP up) the same setting by default, so that no pageable
|
||||
// source of a copy (the check's vectors at load, the lent refill's blobs without a registered arena) becomes a userptr the
|
||||
// kernel can move under a running dispatch. A value the caller set wins; STRATA_KFD_QUIET(_XFER)=0 sets nothing.
|
||||
{
|
||||
const bool cls = strata::core::kfd_quiet::nodes_in_class(strata::core::kfd_quiet::read_topology("/sys/class/kfd/kfd/topology/nodes"));
|
||||
if (const char* v = strata::core::kfd_quiet::xfer_value(cls, std::getenv("STRATA_KFD_QUIET"), std::getenv("STRATA_KFD_QUIET_XFER"),
|
||||
std::getenv("GPU_PINNED_MIN_XFER_SIZE"))) {
|
||||
setenv("GPU_PINNED_MIN_XFER_SIZE", v, 0);
|
||||
if (std::getenv("STRATA_TRACE") != nullptr)
|
||||
std::fprintf(stderr, "strata trace: kfd quiet: GPU_PINNED_MIN_XFER_SIZE=%s (pageable copies staged by the runtime)\n", v);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// Load every CUDA kernel when the context is created, before the expert cache takes the free VRAM. With the
|
||||
// default lazy loading, a kernel first used mid-prompt (MMQ for IQ3_XXS at 64K+ on a 12 GB card) found no VRAM
|
||||
|
||||
Reference in new issue
Block a user