mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 17:20:26 +08:00
Create map for deviceBitfields per rootDeviceIndex
Pass rootDeviceIndex to getDeviceBitfieldForAllocation Related-To: NEO-4589 Change-Id: Ib325a8bf822351ba36b225d94d4173fd725e8766 Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
e28f937683
commit
214342f405
@@ -198,6 +198,15 @@ bool Context::createImpl(const cl_context_properties *properties,
|
||||
}
|
||||
|
||||
this->devices = inputDevices;
|
||||
for (auto &rootDeviceIndex : rootDeviceIndices) {
|
||||
DeviceBitfield deviceBitfield{};
|
||||
for (const auto &pDevice : devices) {
|
||||
if (pDevice->getRootDeviceIndex() == rootDeviceIndex) {
|
||||
deviceBitfield |= pDevice->getDeviceBitfield();
|
||||
}
|
||||
}
|
||||
deviceBitfields.insert({rootDeviceIndex, deviceBitfield});
|
||||
}
|
||||
|
||||
if (devices.size() > 0) {
|
||||
maxRootDeviceIndex = *std::max_element(rootDeviceIndices.begin(), rootDeviceIndices.end(), std::less<uint32_t const>());
|
||||
@@ -438,13 +447,8 @@ AsyncEventsHandler &Context::getAsyncEventsHandler() const {
|
||||
return *static_cast<ClExecutionEnvironment *>(devices[0]->getExecutionEnvironment())->getAsyncEventsHandler();
|
||||
}
|
||||
|
||||
DeviceBitfield Context::getDeviceBitfieldForAllocation() const {
|
||||
DeviceBitfield deviceBitfield{};
|
||||
for (const auto &pDevice : devices) {
|
||||
deviceBitfield |= pDevice->getDeviceBitfield();
|
||||
}
|
||||
|
||||
return deviceBitfield;
|
||||
DeviceBitfield Context::getDeviceBitfieldForAllocation(uint32_t rootDeviceIndex) const {
|
||||
return deviceBitfields.at(rootDeviceIndex);
|
||||
}
|
||||
|
||||
void Context::setupContextType() {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "opencl/source/helpers/destructor_callback.h"
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
namespace NEO {
|
||||
@@ -148,7 +149,7 @@ class Context : public BaseObject<_cl_context> {
|
||||
|
||||
AsyncEventsHandler &getAsyncEventsHandler() const;
|
||||
|
||||
DeviceBitfield getDeviceBitfieldForAllocation() const;
|
||||
DeviceBitfield getDeviceBitfieldForAllocation(uint32_t rootDeviceIndex) const;
|
||||
bool getResolvesRequiredInKernels() const {
|
||||
return resolvesRequiredInKernels;
|
||||
}
|
||||
@@ -167,6 +168,7 @@ class Context : public BaseObject<_cl_context> {
|
||||
void setupContextType();
|
||||
|
||||
std::set<uint32_t> rootDeviceIndices = {};
|
||||
std::map<uint32_t, DeviceBitfield> deviceBitfields;
|
||||
std::vector<std::unique_ptr<SharingFunctions>> sharingFunctions;
|
||||
ClDeviceVector devices;
|
||||
std::list<ContextDestructorCallback *> destructorCallbacks;
|
||||
|
||||
Reference in New Issue
Block a user