MCPcopy Create free account
hub / github.com/Niko1221/Strata / grant

Function grant

engine/src/split/src/store.cpp:63–80  ·  view source on GitHub ↗

device chunks: their card; host chunks: every card and the CPU. A worker maps the holder's chunks read only: the weights are shared by every later worker, and a stray write by a faulting kernel (CUDA traps none inside an allocation) would poison them for all of them; read only, it faults in the worker that made it

Source from the content-addressed store, hash-verified

61// weights are shared by every later worker, and a stray write by a faulting kernel (CUDA traps none inside an
62// allocation) would poison them for all of them; read only, it faults in the worker that made it
63void grant(int loc, uint64_t va, size_t size, bool read_only) {
64 const CUmemAccess_flags prot = read_only ? CU_MEM_ACCESS_FLAGS_PROT_READ : CU_MEM_ACCESS_FLAGS_PROT_READWRITE;
65 CUmemAccessDesc a[NCARD + 1] = {};
66 int n = 0;
67 for (int c = 0; c < NCARD; ++c) {
68 if (!is_host(loc) && c != loc) continue;
69 a[n].location.type = CU_MEM_LOCATION_TYPE_DEVICE;
70 a[n].location.id = c;
71 a[n].flags = prot;
72 ++n;
73 }
74 if (is_host(loc)) {
75 a[n].location = prop_of(loc).location;
76 a[n].flags = prot;
77 ++n;
78 }
79 cu(cuMemSetAccess((CUdeviceptr) va, size, a, n), "access");
80}
81
82} // namespace
83

Callers 2

takeMethod · 0.85
attachMethod · 0.85

Calls 3

is_hostFunction · 0.85
prop_ofFunction · 0.85
cuFunction · 0.70

Tested by

no test coverage detected