mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 07:14:10 +08:00
feature: Add support for P2P Image Copy
Enables P2P Copy support for all Image API related calls: - zeCommandListAppendImageCopy - zeCommandListAppendImageCopyRegion - zeCommandListAppendImageCopyToMemory - zeCommandListAppendImageCopyFromMemory Related-To: LOCI-4112 Signed-off-by: Raiyan Latif <raiyan.latif@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
e813ae0f4a
commit
e3f732f5a6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -28,6 +28,7 @@ struct Image : _ze_image_handle_t {
|
||||
|
||||
virtual ~Image() = default;
|
||||
virtual ze_result_t destroy() = 0;
|
||||
virtual ze_result_t destroyPeerImages(const void *ptr, Device *device) = 0;
|
||||
|
||||
static ze_result_t create(uint32_t productFamily, Device *device, const ze_image_desc_t *desc, Image **pImage);
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "shared/source/memory_manager/memory_manager.h"
|
||||
|
||||
#include "level_zero/core/source/device/device.h"
|
||||
#include "level_zero/core/source/device/device_imp.h"
|
||||
#include "level_zero/core/source/driver/driver_handle_imp.h"
|
||||
|
||||
#include "igfxfmid.h"
|
||||
|
||||
@@ -26,10 +28,32 @@ ImageImp::~ImageImp() {
|
||||
}
|
||||
|
||||
ze_result_t ImageImp::destroy() {
|
||||
if (this->getAllocation() && this->device) {
|
||||
auto imageAllocPtr = reinterpret_cast<const void *>(this->getAllocation()->getGpuAddress());
|
||||
DriverHandleImp *driverHandle = static_cast<DriverHandleImp *>(this->device->getDriverHandle());
|
||||
|
||||
for (auto peerDevice : driverHandle->devices) {
|
||||
this->destroyPeerImages(imageAllocPtr, peerDevice);
|
||||
}
|
||||
}
|
||||
|
||||
delete this;
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ze_result_t ImageImp::destroyPeerImages(const void *ptr, Device *device) {
|
||||
DeviceImp *deviceImp = static_cast<DeviceImp *>(device);
|
||||
|
||||
std::unique_lock<NEO::SpinLock> lock(deviceImp->peerImageAllocationsMutex);
|
||||
|
||||
if (deviceImp->peerImageAllocations.find(ptr) != deviceImp->peerImageAllocations.end()) {
|
||||
delete deviceImp->peerImageAllocations[ptr];
|
||||
deviceImp->peerImageAllocations.erase(ptr);
|
||||
}
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ze_result_t ImageImp::createView(Device *device, const ze_image_desc_t *desc, ze_image_handle_t *pImage) {
|
||||
auto productFamily = device->getNEODevice()->getHardwareInfo().platform.eProductFamily;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -15,6 +15,7 @@ namespace L0 {
|
||||
|
||||
struct ImageImp : public Image {
|
||||
ze_result_t destroy() override;
|
||||
ze_result_t destroyPeerImages(const void *ptr, Device *device) override;
|
||||
|
||||
virtual ze_result_t initialize(Device *device, const ze_image_desc_t *desc) = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user