P4 to Git Change 1775995 by gandryey@gera-w8 on 2019/04/29 13:46:53
SWDEV-79445 - OCL generic changes and code clean-up - Enable P2P extension for PAL path, currently it's staging copy only - Fix P2P staging copy Affected files ... ... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#55 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#243 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#336 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#130 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palsettings.cpp#77 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.cpp#131 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.hpp#59 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#124 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.hpp#36 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.cpp#74 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/command.cpp#92 edit
This commit is contained in:
@@ -49,8 +49,6 @@ amd::Device::Compiler* NullDevice::compilerHandle_;
|
||||
bool roc::Device::isHsaInitialized_ = false;
|
||||
hsa_agent_t roc::Device::cpu_agent_ = {0};
|
||||
std::vector<hsa_agent_t> roc::Device::gpu_agents_;
|
||||
amd::Monitor* roc::Device::p2p_stage_ops_ = nullptr;
|
||||
std::vector<Memory*> roc::Device::p2p_stages_;
|
||||
const bool roc::Device::offlineDevice_ = false;
|
||||
const bool roc::NullDevice::offlineDevice_ = true;
|
||||
|
||||
@@ -171,13 +169,14 @@ Device::~Device() {
|
||||
delete mapCache_;
|
||||
delete mapCacheOps_;
|
||||
|
||||
delete p2p_stage_ops_;
|
||||
p2p_stage_ops_ = nullptr;
|
||||
|
||||
for (auto buf: p2p_stages_) {
|
||||
delete buf;
|
||||
if (nullptr != p2p_stage_) {
|
||||
p2p_stage_->release();
|
||||
p2p_stage_ = nullptr;
|
||||
}
|
||||
if (glb_ctx_ != nullptr) {
|
||||
glb_ctx_->release();
|
||||
glb_ctx_ = nullptr;
|
||||
}
|
||||
p2p_stages_.clear();
|
||||
|
||||
// Destroy temporary buffers for read/write
|
||||
delete xferRead_;
|
||||
@@ -713,16 +712,32 @@ bool Device::create(bool sramEccEnabled) {
|
||||
// Use just 1 entry by default for the map cache
|
||||
mapCache_->push_back(nullptr);
|
||||
|
||||
if (p2p_stage_ops_ == nullptr) {
|
||||
p2p_stage_ops_ = new amd::Monitor("P2P Staging Lock", true);
|
||||
if (nullptr == p2p_stage_ops_) {
|
||||
return false;
|
||||
if ((p2p_agents_.size() == 0) &&
|
||||
(glb_ctx_ == nullptr) && (gpu_agents_.size() > 1) &&
|
||||
// Allow creation for the last device in the list.
|
||||
(gpu_agents_[gpu_agents_.size() - 1].handle == _bkendDevice.handle)) {
|
||||
|
||||
std::vector<amd::Device*> devices;
|
||||
uint32_t numDevices = amd::Device::numDevices(CL_DEVICE_TYPE_GPU, false);
|
||||
// Add all PAL devices
|
||||
for (uint32_t i = 0; i < numDevices; ++i) {
|
||||
devices.push_back(amd::Device::devices()[i]);
|
||||
}
|
||||
for (uint i = 0; i < 2; i++) {
|
||||
Memory* buf = new Buffer(*this, kP2PStagingSize);
|
||||
// Add current
|
||||
devices.push_back(this);
|
||||
|
||||
if (devices.size() > 1) {
|
||||
// Create a dummy context
|
||||
glb_ctx_ = new amd::Context(devices, info);
|
||||
if (glb_ctx_ == nullptr) {
|
||||
return false;
|
||||
}
|
||||
amd::Buffer* buf =
|
||||
new (GlbCtx()) amd::Buffer(GlbCtx(), CL_MEM_ALLOC_HOST_PTR, kP2PStagingSize);
|
||||
if ((buf != nullptr) && buf->create()) {
|
||||
p2p_stages_.push_back(buf);
|
||||
} else {
|
||||
p2p_stage_ = buf;
|
||||
}
|
||||
else {
|
||||
delete buf;
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user