feature(ocl) use tags to synchronize multi root device events

Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
Maciej Plewka
2023-01-12 09:59:50 +00:00
committed by Compute-Runtime-Automation
parent fecb52ac49
commit 16bc84e27d
59 changed files with 644 additions and 193 deletions

View File

@@ -49,7 +49,9 @@ Context::Context(
Context::~Context() {
gtpinNotifyContextDestroy((cl_context)this);
if (multiRootDeviceTimestampPacketAllocator.get() != nullptr) {
multiRootDeviceTimestampPacketAllocator.reset();
}
if (smallBufferPoolAllocator.isAggregatedSmallBuffersEnabled(this)) {
smallBufferPoolAllocator.releaseSmallBufferPool();
}
@@ -558,5 +560,15 @@ void Context::BufferPoolAllocator::releaseSmallBufferPool() {
delete this->mainStorage;
this->mainStorage = nullptr;
}
TagAllocatorBase *Context::getMultiRootDeviceTimestampPacketAllocator() {
return multiRootDeviceTimestampPacketAllocator.get();
}
void Context::setMultiRootDeviceTimestampPacketAllocator(std::unique_ptr<TagAllocatorBase> &allocator) {
multiRootDeviceTimestampPacketAllocator = std::move(allocator);
}
std::unique_lock<std::mutex> Context::obtainOwnershipForMultiRootDeviceAllocator() {
return std::unique_lock<std::mutex>(multiRootDeviceAllocatorMtx);
}
} // namespace NEO

View File

@@ -37,6 +37,7 @@ class SharingFunctions;
class SVMAllocsManager;
class Program;
class Platform;
class TagAllocatorBase;
template <>
struct OpenCLObjectMapper<_cl_context> {
@@ -223,6 +224,9 @@ class Context : public BaseObject<_cl_context> {
BufferPoolAllocator &getBufferPoolAllocator() {
return this->smallBufferPoolAllocator;
}
TagAllocatorBase *getMultiRootDeviceTimestampPacketAllocator();
std::unique_lock<std::mutex> obtainOwnershipForMultiRootDeviceAllocator();
void setMultiRootDeviceTimestampPacketAllocator(std::unique_ptr<TagAllocatorBase> &allocator);
protected:
struct BuiltInKernel {
@@ -263,6 +267,8 @@ class Context : public BaseObject<_cl_context> {
uint32_t maxRootDeviceIndex = std::numeric_limits<uint32_t>::max();
cl_bool preferD3dSharedResources = 0u;
ContextType contextType = ContextType::CONTEXT_TYPE_DEFAULT;
std::unique_ptr<TagAllocatorBase> multiRootDeviceTimestampPacketAllocator;
std::mutex multiRootDeviceAllocatorMtx;
bool interopUserSync = false;
bool resolvesRequiredInKernels = false;