P4 to Git Change 1561216 by gandryey@gera-w8 on 2018/05/29 18:05:31

SWDEV-79445 - OCL generic changes and code clean-up
	- Remove parent_ field from the device object, since it was used for subdevices only.

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_device.cpp#72 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#219 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#304 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#590 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#91 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/context.cpp#52 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/program.cpp#94 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/program.hpp#45 edit
此提交包含在:
foreman
2018-05-29 18:13:40 -04:00
父節點 a36ef232f2
當前提交 12315470b7
共有 7 個檔案被更改,包括 13 行新增77 行删除
+3 -20
查看文件
@@ -198,18 +198,14 @@ void Device::tearDown() {
#endif // WITH_PAL_DEVICE
}
Device::Device(Device* parent)
Device::Device()
: settings_(NULL),
online_(true),
blitProgram_(NULL),
hwDebugMgr_(NULL),
parent_(parent),
vaCacheAccess_(nullptr),
vaCacheMap_(nullptr) {
memset(&info_, '\0', sizeof(info_));
if (parent_ != NULL) {
parent_->retain();
}
}
Device::~Device() {
@@ -223,12 +219,8 @@ Device::~Device() {
delete settings_;
}
if (parent_ != NULL) {
parent_->release();
} else {
if (info_.extensions_ != NULL) {
delete[] info_.extensions_;
}
if (info_.extensions_ != NULL) {
delete[] info_.extensions_;
}
}
@@ -244,15 +236,6 @@ bool Device::create() {
return true;
}
bool Device::isAncestor(const Device* sub) const {
for (const Device* d = sub->parent_; d != NULL; d = d->parent_) {
if (d == this) {
return true;
}
}
return false;
}
void Device::registerDevice() {
assert(Runtime::singleThreaded() && "this is not thread-safe");
+1 -38
查看文件
@@ -1411,24 +1411,12 @@ class Device : public RuntimeObject {
virtual Compiler* compiler() const = 0;
Device(Device* parent = NULL);
Device();
virtual ~Device();
//! Initializes abstraction layer device object
bool create();
//! Increment the reference count
uint retain() {
// Only increment the reference count of sub-devices
return !isRootDevice() ? RuntimeObject::retain() : 0u;
}
//! Decrement the reference count
uint release() {
// Only decrement the reference count of sub-devices
return !isRootDevice() ? RuntimeObject::release() : 0u;
}
//! Register a device as available
void registerDevice();
@@ -1561,30 +1549,6 @@ class Device : public RuntimeObject {
//! Returns TRUE if the device is available for computations
bool isOnline() const { return online_; }
//! Returns TRUE if the device is a root device (as opposed to sub-device)
bool isRootDevice() const { return parent_ == NULL; }
//! Returns TRUE if 'this' is an ancestor of the given sub-device.
bool isAncestor(const Device* sub) const;
//! Return the parent device.
Device* parent() const { return parent_; }
//! Return the root device for this instance;
Device& rootDevice() {
Device* root = this;
while (!root->isRootDevice()) {
root = root->parent_;
}
return *root;
}
const Device& rootDevice() const {
const Device* root = this;
while (!root->isRootDevice()) {
root = root->parent_;
}
return *root;
}
//! Returns device settings
const device::Settings& settings() const { return *settings_; }
@@ -1643,7 +1607,6 @@ class Device : public RuntimeObject {
static std::vector<Device*>* devices_; //!< All known devices
Device* parent_; //!< This device's parent
Monitor* vaCacheAccess_; //!< Lock to serialize VA caching access
std::map<uintptr_t, device::Memory*>* vaCacheMap_; //!< VA cache map
};
+1 -1
查看文件
@@ -63,7 +63,7 @@ aclCompiler* NullDevice::hsaCompiler_;
AppProfile Device::appProfile_;
NullDevice::NullDevice()
: amd::Device(NULL), calTarget_(static_cast<CALtarget>(0)), hwInfo_(NULL) {}
: amd::Device(), calTarget_(static_cast<CALtarget>(0)), hwInfo_(NULL) {}
bool NullDevice::init() {
std::vector<Device*> devices;
+1 -1
查看文件
@@ -62,7 +62,7 @@ NullDevice::Compiler* NullDevice::compiler_;
AppProfile Device::appProfile_;
NullDevice::NullDevice()
: amd::Device(nullptr), ipLevel_(Pal::GfxIpLevel::None), hwInfo_(nullptr) {}
: amd::Device(), ipLevel_(Pal::GfxIpLevel::None), hwInfo_(nullptr) {}
bool NullDevice::init() {
std::vector<Device*> devices;
+1 -2
查看文件
@@ -315,9 +315,8 @@ void Context::svmFree(void* ptr) const {
}
bool Context::containsDevice(const Device* device) const {
for (const auto& it : devices_) {
if (device == it || it->isAncestor(device)) {
if (device == it) {
return true;
}
}
+5 -14
查看文件
@@ -62,7 +62,7 @@ cl_int Program::addDeviceProgram(Device& device, const void* image, size_t lengt
return CL_INVALID_VALUE;
}
Device& rootDev = device.rootDevice();
Device& rootDev = device;
// if the rootDev is already associated with a program
if (devicePrograms_[&rootDev] != NULL) {
@@ -150,7 +150,7 @@ cl_int Program::addDeviceProgram(Device& device, const void* image, size_t lengt
}
device::Program* Program::getDeviceProgram(const Device& device) const {
const auto it = devicePrograms_.find(&device.rootDevice());
const auto it = devicePrograms_.find(&device);
if (it == devicePrograms_.cend()) {
return NULL;
}
@@ -613,20 +613,11 @@ bool Symbol::setDeviceKernel(const Device& device, const device::Kernel* func) {
}
const device::Kernel* Symbol::getDeviceKernel(const Device& device) const {
const devicekernels_t* devKernels = &deviceKernels_;
const auto itEnd = devKernels->cend();
auto it = devKernels->find(&device);
if (it != itEnd) {
auto it = deviceKernels_.find(&device);
if (it != deviceKernels_.cend()) {
return it->second;
}
for (it = devKernels->cbegin(); it != itEnd; ++it) {
if (it->first->isAncestor(&device)) {
return it->second;
}
}
return NULL;
return nullptr;
}
} // namespace amd
+1 -1
查看文件
@@ -149,7 +149,7 @@ class Program : public RuntimeObject {
const Symbol* findSymbol(const char* name) const;
//! Return the binary image.
const binary_t& binary(const Device& device) { return binary_[&device.rootDevice()]; }
const binary_t& binary(const Device& device) { return binary_[&device]; }
//! Return the program kernel names
const std::string& kernelNames() const { return kernelNames_; }