P4 to Git Change 1991259 by gandryey@gera-win10 on 2019/08/29 18:45:50
SWDEV-200614 - [Schneider] Crash in Agisoft when run in mGPU environment - Add a workaround for memory pinning path. It will perform 2-step copy to make sure memory pinning doesn't occur on the first unaligned page, because in Windows memory manager can have CPU access to the allocation header in another thread and a race condition is possible - change some default setting for staging and pinned paths, because PCIE gen3 performance. Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palsettings.cpp#96 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.cpp#150 edit ... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.hpp#317 edit
Dieser Commit ist enthalten in:
1 Ursprung
b6f298d3f0
Commit
daa0e96062
3 Dateien geändert
+54
-8
Keine Dateien entsprechen Ihrer Suche
@@ -1145,8 +1145,28 @@ void VirtualGPU::submitReadMemory(amd::ReadMemoryCommand& vcmd) {
|
||||
result = blitMgr().copyBuffer(*memory, *hostMemory, origin, dstOrigin, size,
|
||||
vcmd.isEntireMemory());
|
||||
} else {
|
||||
result =
|
||||
blitMgr().readBuffer(*memory, vcmd.destination(), origin, size, vcmd.isEntireMemory());
|
||||
// The logic below will perform 2 step copy to make sure memory pinning doesn't
|
||||
// occur on the first unaligned page, because in Windows memory manager can
|
||||
// have CPU access to the allocation header in another thread
|
||||
// and a race condition is possible.
|
||||
char* tmpHost = amd::alignUp(
|
||||
reinterpret_cast<char*>(vcmd.destination()), PinnedMemoryAlignment);
|
||||
|
||||
// Find the partial size for unaligned copy
|
||||
size_t partial = tmpHost - reinterpret_cast<char*>(vcmd.destination());
|
||||
result = true;
|
||||
// Check if it's staging copy, then ignore unaligned address
|
||||
if (size[0] <= dev().settings().pinnedMinXferSize_) {
|
||||
partial = size[0];
|
||||
}
|
||||
// Make first step transfer
|
||||
if (partial > 0) {
|
||||
result = blitMgr().readBuffer(*memory, vcmd.destination(), origin, partial);
|
||||
}
|
||||
// Second step transfer if something left to copy
|
||||
if (partial < size[0]) {
|
||||
result &= blitMgr().readBuffer(*memory, tmpHost, origin[0] + partial, size[0] - partial);
|
||||
}
|
||||
}
|
||||
if (nullptr != bufferFromImage) {
|
||||
bufferFromImage->release();
|
||||
@@ -1258,7 +1278,28 @@ void VirtualGPU::submitWriteMemory(amd::WriteMemoryCommand& vcmd) {
|
||||
result = blitMgr().copyBuffer(*hostMemory, *memory, srcOrigin, origin, size,
|
||||
vcmd.isEntireMemory());
|
||||
} else {
|
||||
result = blitMgr().writeBuffer(vcmd.source(), *memory, origin, size, vcmd.isEntireMemory());
|
||||
// The logic below will perform 2 step copy to make sure memory pinning doesn't
|
||||
// occur on the first unaligned page, because in Windows memory manager can
|
||||
// have CPU access to the allocation header in another thread
|
||||
// and a race condition is possible.
|
||||
const char* tmpHost =
|
||||
amd::alignUp(reinterpret_cast<const char*>(vcmd.source()), PinnedMemoryAlignment);
|
||||
|
||||
// Find the partial size for unaligned copy
|
||||
size_t partial = tmpHost - reinterpret_cast<const char*>(vcmd.source());
|
||||
result = true;
|
||||
// Check if it's staging copy, then ignore unaligned address
|
||||
if (size[0] <= dev().settings().pinnedMinXferSize_) {
|
||||
partial = size[0];
|
||||
}
|
||||
// Make first step transfer
|
||||
if (partial > 0) {
|
||||
result = blitMgr().writeBuffer(vcmd.source(), *memory, origin, partial);
|
||||
}
|
||||
// Second step transfer if something left to copy
|
||||
if (partial < size[0]) {
|
||||
result &= blitMgr().writeBuffer(tmpHost, *memory, origin[0] + partial, size[0] - partial);
|
||||
}
|
||||
}
|
||||
if (nullptr != bufferFromImage) {
|
||||
bufferFromImage->release();
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren