Merge perf-PR group rdna2 (f-145-pp-rdna2)

This commit is contained in:
Niko1221 committed 2026-10-16 10:54:10 +02:00
commit 21c579727c
35 files changed
+2262 -98

No files matched your search

+5 -4
View File
@@ -1,6 +1,7 @@
// src/core/peer_experts.cpp - see include/strata/core/peer_experts.hpp.
#include "strata/core/peer_experts.hpp"
#include "strata/core/device.hpp" // primary_device() (STRATA_PRIMARY_DEVICE)
#include "strata/kernels/cpu/expert_layout.hpp"
#include "strata/kernels/elementwise.hpp"
#include "strata/kernels/iq_kernels.hpp"
@@ -136,16 +137,16 @@ bool PeerExperts::open(int device, const std::vector<std::pair<int32_t, int32_t>
res_.assign((size_t) (n_layers * n_expert), kNotResident);
{ // direct access both ways (NVLink or another P2P path): the prompt path copies activations and results over it
int a = 0, b = 0;
cudaDeviceCanAccessPeer(&a, 0, device);
cudaDeviceCanAccessPeer(&b, device, 0);
cudaDeviceCanAccessPeer(&a, primary_device(), device);
cudaDeviceCanAccessPeer(&b, device, primary_device());
if (const char* np = std::getenv("STRATA_PEER_NO_P2P"); np != nullptr && std::atoi(np) != 0) a = 0; // test knob: pretend the pair has no P2P
p2p_ = a && b;
if (p2p_) {
On on0(0);
On on0(primary_device());
cudaError_t e0 = cudaDeviceEnablePeerAccess(device, 0);
if (e0 == cudaErrorPeerAccessAlreadyEnabled) { cudaGetLastError(); e0 = cudaSuccess; }
On on1(device);
cudaError_t e1 = cudaDeviceEnablePeerAccess(0, 0);
cudaError_t e1 = cudaDeviceEnablePeerAccess(primary_device(), 0);
if (e1 == cudaErrorPeerAccessAlreadyEnabled) { cudaGetLastError(); e1 = cudaSuccess; }
p2p_ = e0 == cudaSuccess && e1 == cudaSuccess;
// recommend, never force: the direct path is used only if a test copy each way arrives exact (#2666)