P4 to Git Change 1193161 by xcui@merged_opencl_jxcwin on 2015/09/22 16:16:10
SWDEV-59579 - temporary Back out changelist 1193093 Affected files ... ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_svm.cpp#14 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#257 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#526 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.hpp#151 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#381 edit
Этот коммит содержится в:
1 родитель
2cd56dc9f0
Коммит
9604ede937
4 files changed
+79
-132
No files matched your search
@@ -1013,43 +1013,35 @@ VirtualGPU::submitSvmCopyMemory(amd::SvmCopyMemoryCommand& vcmd)
|
||||
profilingBegin(vcmd);
|
||||
|
||||
cl_command_type type = vcmd.type();
|
||||
//no op for FGS supported device
|
||||
if (!dev().isFineGrainedSystem()) {
|
||||
|
||||
amd::Memory* srcMem = amd::SvmManager::FindSvmBuffer(vcmd.src());
|
||||
amd::Memory* dstMem = amd::SvmManager::FindSvmBuffer(vcmd.dst());
|
||||
if (NULL == srcMem || NULL == dstMem) {
|
||||
vcmd.setStatus(CL_INVALID_OPERATION);
|
||||
return;
|
||||
}
|
||||
|
||||
amd::Coord3D srcOrigin(0, 0, 0);
|
||||
amd::Coord3D dstOrigin(0, 0, 0);
|
||||
amd::Coord3D size(vcmd.srcSize(), 1, 1);
|
||||
amd::BufferRect srcRect;
|
||||
amd::BufferRect dstRect;
|
||||
|
||||
srcOrigin.c[0] = static_cast<const_address>(vcmd.src()) - static_cast<address>(srcMem->getSvmPtr());
|
||||
dstOrigin.c[0] = static_cast<const_address>(vcmd.dst()) - static_cast<address>(dstMem->getSvmPtr());
|
||||
|
||||
if (!(srcMem->validateRegion(srcOrigin, size)) || !(dstMem->validateRegion(dstOrigin, size))) {
|
||||
vcmd.setStatus(CL_INVALID_OPERATION);
|
||||
return;
|
||||
}
|
||||
|
||||
bool entire = srcMem->isEntirelyCovered(srcOrigin, size) &&
|
||||
dstMem->isEntirelyCovered(dstOrigin, size);
|
||||
|
||||
if (!copyMemory(type, *srcMem, *dstMem, entire,
|
||||
srcOrigin, dstOrigin, size, srcRect, dstRect)) {
|
||||
vcmd.setStatus(CL_INVALID_OPERATION);
|
||||
}
|
||||
amd::Memory* srcMem = amd::SvmManager::FindSvmBuffer(vcmd.src());
|
||||
amd::Memory* dstMem = amd::SvmManager::FindSvmBuffer(vcmd.dst());
|
||||
if (NULL == srcMem || NULL == dstMem) {
|
||||
vcmd.setStatus(CL_INVALID_OPERATION);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
//direct memcpy for FGS enabled system
|
||||
memcpy(vcmd.dst(), vcmd.src(), vcmd.srcSize());
|
||||
|
||||
amd::Coord3D srcOrigin(0, 0, 0);
|
||||
amd::Coord3D dstOrigin(0, 0, 0);
|
||||
amd::Coord3D size(vcmd.srcSize(), 1, 1);
|
||||
amd::BufferRect srcRect;
|
||||
amd::BufferRect dstRect;
|
||||
|
||||
srcOrigin.c[0] = static_cast<const_address>(vcmd.src()) - static_cast<address>(srcMem->getSvmPtr());
|
||||
dstOrigin.c[0] = static_cast<const_address>(vcmd.dst()) - static_cast<address>(dstMem->getSvmPtr());
|
||||
|
||||
if (!(srcMem->validateRegion(srcOrigin, size)) || !(dstMem->validateRegion(dstOrigin, size))) {
|
||||
vcmd.setStatus(CL_INVALID_OPERATION);
|
||||
return;
|
||||
}
|
||||
|
||||
bool entire = srcMem->isEntirelyCovered(srcOrigin, size) &&
|
||||
dstMem->isEntirelyCovered(dstOrigin, size);
|
||||
|
||||
if (!copyMemory(type, *srcMem, *dstMem, entire,
|
||||
srcOrigin, dstOrigin, size, srcRect, dstRect)) {
|
||||
vcmd.setStatus(CL_INVALID_OPERATION);
|
||||
}
|
||||
|
||||
profilingEnd(vcmd);
|
||||
}
|
||||
|
||||
@@ -1361,28 +1353,25 @@ VirtualGPU::submitSvmMapMemory(amd::SvmMapMemoryCommand& vcmd)
|
||||
|
||||
profilingBegin(vcmd, true);
|
||||
|
||||
//no op for FGS supported device
|
||||
if (!dev().isFineGrainedSystem()) {
|
||||
// Make sure we have memory for the command execution
|
||||
gpu::Memory* memory = dev().getGpuMemory(vcmd.getSvmMem());
|
||||
// Make sure we have memory for the command execution
|
||||
gpu::Memory* memory = dev().getGpuMemory(vcmd.getSvmMem());
|
||||
|
||||
memory->saveMapInfo(vcmd.origin(), vcmd.size(),
|
||||
vcmd.mapFlags(), vcmd.isEntireMemory());
|
||||
memory->saveMapInfo(vcmd.origin(), vcmd.size(),
|
||||
vcmd.mapFlags(), vcmd.isEntireMemory());
|
||||
|
||||
if (memory->mapMemory() != NULL) {
|
||||
if (vcmd.mapFlags() & (CL_MAP_READ | CL_MAP_WRITE)) {
|
||||
amd::Coord3D dstOrigin(0, 0, 0);
|
||||
assert(memory->cal()->buffer_ && "SVM memory can't be an image");
|
||||
if (!blitMgr().copyBuffer(*memory, *memory->mapMemory(),
|
||||
vcmd.origin(), dstOrigin, vcmd.size(), vcmd.isEntireMemory())) {
|
||||
LogError("submitSVMMapMemory() - copy failed");
|
||||
vcmd.setStatus(CL_MAP_FAILURE);
|
||||
}
|
||||
if (memory->mapMemory() != NULL) {
|
||||
if (vcmd.mapFlags() & (CL_MAP_READ | CL_MAP_WRITE)) {
|
||||
amd::Coord3D dstOrigin(0, 0, 0);
|
||||
assert(memory->cal()->buffer_ && "SVM memory can't be an image");
|
||||
if (!blitMgr().copyBuffer(*memory, *memory->mapMemory(),
|
||||
vcmd.origin(), dstOrigin, vcmd.size(), vcmd.isEntireMemory())) {
|
||||
LogError("submitSVMMapMemory() - copy failed");
|
||||
vcmd.setStatus(CL_MAP_FAILURE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
LogError("Unhandled svm map!");
|
||||
}
|
||||
}
|
||||
else {
|
||||
LogError("Unhandled svm map!");
|
||||
}
|
||||
|
||||
profilingEnd(vcmd);
|
||||
@@ -1395,21 +1384,18 @@ VirtualGPU::submitSvmUnmapMemory(amd::SvmUnmapMemoryCommand& vcmd)
|
||||
amd::ScopedLock lock(execution());
|
||||
profilingBegin(vcmd, true);
|
||||
|
||||
//no op for FGS supported device
|
||||
if (!dev().isFineGrainedSystem()) {
|
||||
gpu::Memory* memory = dev().getGpuMemory(vcmd.getSvmMem());
|
||||
|
||||
gpu::Memory* memory = dev().getGpuMemory(vcmd.getSvmMem());
|
||||
if (memory->mapMemory() != NULL) {
|
||||
if (memory->isUnmapWrite()) {
|
||||
amd::Coord3D srcOrigin(0, 0, 0);
|
||||
// Target is a remote resource, so copy
|
||||
assert(memory->cal()->buffer_ && "SVM memory can't be an image");
|
||||
if (!blitMgr().copyBuffer(*memory->mapMemory(), *memory, srcOrigin,
|
||||
memory->writeMapInfo()->origin_, memory->writeMapInfo()->region_,
|
||||
memory->writeMapInfo()->entire_)) {
|
||||
LogError("submitSvmUnmapMemory() - copy failed");
|
||||
vcmd.setStatus(CL_OUT_OF_RESOURCES);
|
||||
}
|
||||
if (memory->mapMemory() != NULL) {
|
||||
if (memory->isUnmapWrite()) {
|
||||
amd::Coord3D srcOrigin(0, 0, 0);
|
||||
// Target is a remote resource, so copy
|
||||
assert(memory->cal()->buffer_ && "SVM memory can't be an image");
|
||||
if (!blitMgr().copyBuffer(*memory->mapMemory(), *memory, srcOrigin,
|
||||
memory->writeMapInfo()->origin_, memory->writeMapInfo()->region_,
|
||||
memory->writeMapInfo()->entire_)) {
|
||||
LogError("submitSvmUnmapMemory() - copy failed");
|
||||
vcmd.setStatus(CL_OUT_OF_RESOURCES);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1425,38 +1411,23 @@ VirtualGPU::submitSvmFillMemory(amd::SvmFillMemoryCommand& vcmd)
|
||||
|
||||
profilingBegin(vcmd, true);
|
||||
|
||||
size_t patternSize = vcmd.patternSize();
|
||||
size_t fillSize = patternSize * vcmd.times();
|
||||
size_t offset = 0;
|
||||
amd::Memory* dstMemory = amd::SvmManager::FindSvmBuffer(vcmd.dst());
|
||||
assert(dstMemory&&"No svm Buffer to fill with!");
|
||||
size_t offset = reinterpret_cast<uintptr_t>(vcmd.dst())
|
||||
- reinterpret_cast<uintptr_t>(dstMemory->getSvmPtr());
|
||||
assert((offset >= 0)&&"wrong svm ptr to fill with!");
|
||||
|
||||
if (!dev().isFineGrainedSystem()) {
|
||||
amd::Memory* dstMemory = amd::SvmManager::FindSvmBuffer(vcmd.dst());
|
||||
assert(dstMemory&&"No svm Buffer to fill with!");
|
||||
offset = reinterpret_cast<uintptr_t>(vcmd.dst())
|
||||
- reinterpret_cast<uintptr_t>(dstMemory->getSvmPtr());
|
||||
assert((offset >= 0) && "wrong svm ptr to fill with!");
|
||||
gpu::Memory* memory = dev().getGpuMemory(dstMemory);
|
||||
size_t fillSize = vcmd.patternSize() * vcmd.times();
|
||||
|
||||
gpu::Memory* memory = dev().getGpuMemory(dstMemory);
|
||||
amd::Coord3D origin(offset, 0, 0);
|
||||
amd::Coord3D size(fillSize, 1, 1);
|
||||
assert((dstMemory->validateRegion(origin, size))&&"The incorrect fill size!");
|
||||
|
||||
amd::Coord3D origin(offset, 0, 0);
|
||||
amd::Coord3D size(fillSize, 1, 1);
|
||||
assert((dstMemory->validateRegion(origin, size)) && "The incorrect fill size!");
|
||||
|
||||
if (!fillMemory(vcmd.type(), dstMemory, vcmd.pattern(),
|
||||
vcmd.patternSize(), origin, size)) {
|
||||
vcmd.setStatus(CL_INVALID_OPERATION);
|
||||
}
|
||||
if (!fillMemory(vcmd.type(), dstMemory, vcmd.pattern(),
|
||||
vcmd.patternSize(), origin, size)) {
|
||||
vcmd.setStatus(CL_INVALID_OPERATION);
|
||||
}
|
||||
else {
|
||||
// for FGS capable device, fill CPU memory directly
|
||||
for (size_t i = 0; i < vcmd.times(); i++) {
|
||||
memcpy(reinterpret_cast<address>(vcmd.dst()) + offset,
|
||||
reinterpret_cast<const_address>(vcmd.pattern()),
|
||||
patternSize);
|
||||
offset += patternSize;
|
||||
}
|
||||
}
|
||||
|
||||
profilingEnd(vcmd);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user