mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Revert "Move storage of mapped operations to OpenCL context"
This reverts commit 8c9dd3085b.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
e199097acd
commit
116dac90de
@@ -72,21 +72,3 @@ void MapOperationsHandler::remove(void *mappedPtr) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MapOperationsHandler &NEO::MapOperationsStorage::getHandler(cl_mem memObj) {
|
||||
return handlers[memObj];
|
||||
}
|
||||
|
||||
MapOperationsHandler *NEO::MapOperationsStorage::getHandlerIfExists(cl_mem memObj) {
|
||||
auto iterator = handlers.find(memObj);
|
||||
if (iterator == handlers.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return &iterator->second;
|
||||
}
|
||||
|
||||
void NEO::MapOperationsStorage::removeHandler(cl_mem memObj) {
|
||||
auto iterator = handlers.find(memObj);
|
||||
handlers.erase(iterator);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "opencl/source/helpers/properties_helper.h"
|
||||
|
||||
#include <mutex>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace NEO {
|
||||
@@ -29,16 +28,4 @@ class MapOperationsHandler {
|
||||
mutable std::mutex mtx;
|
||||
};
|
||||
|
||||
class MapOperationsStorage {
|
||||
public:
|
||||
using HandlersMap = std::unordered_map<cl_mem, MapOperationsHandler>;
|
||||
|
||||
MapOperationsHandler &getHandler(cl_mem memObj);
|
||||
MapOperationsHandler *getHandlerIfExists(cl_mem memObj);
|
||||
void removeHandler(cl_mem memObj);
|
||||
|
||||
protected:
|
||||
HandlersMap handlers{};
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -62,14 +62,9 @@ MemObj::~MemObj() {
|
||||
if (allocatedMapPtr != nullptr) {
|
||||
needWait = true;
|
||||
}
|
||||
|
||||
if (auto mapOperationsHandler = getMapOperationsHandlerIfExists(); mapOperationsHandler != nullptr) {
|
||||
if (mapOperationsHandler->size() > 0 && !getCpuAddressForMapping()) {
|
||||
needWait = true;
|
||||
}
|
||||
context->getMapOperationsStorage().removeHandler(this);
|
||||
if (mapOperationsHandler.size() > 0 && !getCpuAddressForMapping()) {
|
||||
needWait = true;
|
||||
}
|
||||
|
||||
if (!destructorCallbacks.empty()) {
|
||||
needWait = true;
|
||||
}
|
||||
@@ -177,7 +172,7 @@ cl_int MemObj::getMemObjectInfo(cl_mem_info paramName,
|
||||
|
||||
case CL_MEM_MAP_COUNT:
|
||||
srcParamSize = sizeof(mapCount);
|
||||
mapCount = static_cast<cl_uint>(getMapOperationsHandler().size());
|
||||
mapCount = static_cast<cl_uint>(mapOperationsHandler.size());
|
||||
srcParam = &mapCount;
|
||||
break;
|
||||
|
||||
@@ -387,26 +382,11 @@ void *MemObj::getBasePtrForMap(uint32_t rootDeviceIndex) {
|
||||
}
|
||||
}
|
||||
|
||||
MapOperationsHandler &MemObj::getMapOperationsHandler() {
|
||||
return context->getMapOperationsStorage().getHandler(this);
|
||||
}
|
||||
|
||||
MapOperationsHandler *MemObj::getMapOperationsHandlerIfExists() {
|
||||
return context->getMapOperationsStorage().getHandlerIfExists(this);
|
||||
}
|
||||
|
||||
bool MemObj::addMappedPtr(void *ptr, size_t ptrLength, cl_map_flags &mapFlags,
|
||||
MemObjSizeArray &size, MemObjOffsetArray &offset,
|
||||
uint32_t mipLevel) {
|
||||
return getMapOperationsHandler().add(ptr, ptrLength, mapFlags, size, offset, mipLevel);
|
||||
}
|
||||
|
||||
bool MemObj::findMappedPtr(void *mappedPtr, MapInfo &outMapInfo) {
|
||||
return getMapOperationsHandler().find(mappedPtr, outMapInfo);
|
||||
}
|
||||
|
||||
void MemObj::removeMappedPtr(void *mappedPtr) {
|
||||
getMapOperationsHandler().remove(mappedPtr);
|
||||
return mapOperationsHandler.add(ptr, ptrLength, mapFlags, size, offset,
|
||||
mipLevel);
|
||||
}
|
||||
|
||||
bool MemObj::isTiledAllocation() const {
|
||||
|
||||
@@ -86,11 +86,9 @@ class MemObj : public BaseObject<_cl_mem> {
|
||||
bool getIsObjectRedescribed() const { return isObjectRedescribed; };
|
||||
size_t getSize() const;
|
||||
|
||||
MapOperationsHandler &getMapOperationsHandler();
|
||||
MapOperationsHandler *getMapOperationsHandlerIfExists();
|
||||
bool addMappedPtr(void *ptr, size_t ptrLength, cl_map_flags &mapFlags, MemObjSizeArray &size, MemObjOffsetArray &offset, uint32_t mipLevel);
|
||||
bool findMappedPtr(void *mappedPtr, MapInfo &outMapInfo);
|
||||
void removeMappedPtr(void *mappedPtr);
|
||||
bool findMappedPtr(void *mappedPtr, MapInfo &outMapInfo) { return mapOperationsHandler.find(mappedPtr, outMapInfo); }
|
||||
void removeMappedPtr(void *mappedPtr) { mapOperationsHandler.remove(mappedPtr); }
|
||||
void *getBasePtrForMap(uint32_t rootDeviceIndex);
|
||||
|
||||
MOCKABLE_VIRTUAL void setAllocatedMapPtr(void *allocatedMapPtr);
|
||||
@@ -175,6 +173,7 @@ class MemObj : public BaseObject<_cl_mem> {
|
||||
void *memoryStorage;
|
||||
void *hostPtr;
|
||||
void *allocatedMapPtr = nullptr;
|
||||
MapOperationsHandler mapOperationsHandler;
|
||||
size_t offset = 0;
|
||||
MemObj *associatedMemObject = nullptr;
|
||||
cl_uint refCount = 0;
|
||||
|
||||
Reference in New Issue
Block a user