Fix zero size allocation look up
Signed-off-by: Jemale Lockett <jemale.lockett@intel.com> Related-To: LOCI-2537
This commit is contained in:
parent
f0cb1cc388
commit
a2401299a0
|
@ -257,10 +257,16 @@ ze_result_t DriverHandleImp::getDevice(uint32_t *pCount, ze_device_handle_t *phD
|
||||||
bool DriverHandleImp::findAllocationDataForRange(const void *buffer,
|
bool DriverHandleImp::findAllocationDataForRange(const void *buffer,
|
||||||
size_t size,
|
size_t size,
|
||||||
NEO::SvmAllocationData **allocData) {
|
NEO::SvmAllocationData **allocData) {
|
||||||
|
|
||||||
|
size_t offset = 0;
|
||||||
|
if (size > 0) {
|
||||||
|
offset = size - 1;
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure the host buffer does not overlap any existing allocation
|
// Make sure the host buffer does not overlap any existing allocation
|
||||||
const char *baseAddress = reinterpret_cast<const char *>(buffer);
|
const char *baseAddress = reinterpret_cast<const char *>(buffer);
|
||||||
NEO::SvmAllocationData *beginAllocData = svmAllocsManager->getSVMAlloc(baseAddress);
|
NEO::SvmAllocationData *beginAllocData = svmAllocsManager->getSVMAlloc(baseAddress);
|
||||||
NEO::SvmAllocationData *endAllocData = svmAllocsManager->getSVMAlloc(baseAddress + size - 1);
|
NEO::SvmAllocationData *endAllocData = svmAllocsManager->getSVMAlloc(baseAddress + offset);
|
||||||
|
|
||||||
if (allocData) {
|
if (allocData) {
|
||||||
if (beginAllocData) {
|
if (beginAllocData) {
|
||||||
|
|
|
@ -735,6 +735,38 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenMemoryCopyRegionWithSignalAndIn
|
||||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, result);
|
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HWTEST2_F(CommandListCreate, givenCommandListWhenMemoryCopyRegionHasEmptyRegionWithSignalAndWaitEventsUsingCopyEngineThenSuccessIsReturned, Platforms) {
|
||||||
|
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||||
|
|
||||||
|
ze_result_t result = ZE_RESULT_SUCCESS;
|
||||||
|
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Copy, 0u, result));
|
||||||
|
|
||||||
|
void *srcBuffer = reinterpret_cast<void *>(0x1234);
|
||||||
|
void *dstBuffer = reinterpret_cast<void *>(0x2345);
|
||||||
|
|
||||||
|
ze_event_pool_desc_t eventPoolDesc = {};
|
||||||
|
eventPoolDesc.count = 2;
|
||||||
|
auto eventPool = std::unique_ptr<L0::EventPool>(L0::EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, result));
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
std::vector<ze_event_handle_t> events;
|
||||||
|
|
||||||
|
ze_event_desc_t eventDesc = {};
|
||||||
|
eventDesc.index = 0;
|
||||||
|
eventDesc.wait = ZE_EVENT_SCOPE_FLAG_HOST;
|
||||||
|
auto event = std::unique_ptr<L0::Event>(L0::Event::create<uint32_t>(eventPool.get(), &eventDesc, device));
|
||||||
|
events.push_back(event.get());
|
||||||
|
eventDesc.index = 1;
|
||||||
|
auto event1 = std::unique_ptr<L0::Event>(L0::Event::create<uint32_t>(eventPool.get(), &eventDesc, device));
|
||||||
|
events.push_back(event1.get());
|
||||||
|
|
||||||
|
// set regions to 0
|
||||||
|
ze_copy_region_t sr = {0U, 0U, 0U, 0U, 0U, 0U};
|
||||||
|
ze_copy_region_t dr = {0U, 0U, 0U, 0U, 0U, 0U};
|
||||||
|
result = commandList->appendMemoryCopyRegion(dstBuffer, &dr, 0, 0,
|
||||||
|
srcBuffer, &sr, 0, 0, events[0], 1u, &events[1]);
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
}
|
||||||
|
|
||||||
HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenMemoryCopyRegionWithSignalAndWaitEventsUsingRenderEngineThenSuccessIsReturned, Platforms) {
|
HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenMemoryCopyRegionWithSignalAndWaitEventsUsingRenderEngineThenSuccessIsReturned, Platforms) {
|
||||||
const ze_command_queue_desc_t desc = {};
|
const ze_command_queue_desc_t desc = {};
|
||||||
bool internalEngine = true;
|
bool internalEngine = true;
|
||||||
|
|
Loading…
Reference in New Issue