feature: obtain GraphicsAllocation from external CB event

Related-To: NEO-8179

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2024-05-06 15:11:38 +00:00
committed by Compute-Runtime-Automation
parent d6c16c1640
commit ce36812f8d
7 changed files with 64 additions and 15 deletions

View File

@@ -80,7 +80,7 @@ struct InOrderCmdListFixture : public ::Test<ModuleFixture> {
uint64_t *hostAddress = &(standaloneCbEventStorage.data()[standaloneCbEventStorage.size() - 1]);
uint64_t *deviceAddress = ptrOffset(hostAddress, 0x1000);
auto inOrderExecInfo = NEO::InOrderExecInfo::createFromExternalAllocation(*device->getNEODevice(), castToUint64(deviceAddress), hostAddress, 1);
auto inOrderExecInfo = NEO::InOrderExecInfo::createFromExternalAllocation(*device->getNEODevice(), castToUint64(deviceAddress), nullptr, hostAddress, 1);
ze_event_desc_t eventDesc = {};
eventDesc.pNext = pNext;

View File

@@ -3865,7 +3865,10 @@ HWTEST2_F(InOrderCmdListTests, givenIncorrectInputParamsWhenAskingForEventAddres
HWTEST2_F(InOrderCmdListTests, givenCorrectInputParamsWhenCreatingCbEventThenReturnSuccess, IsAtLeastSkl) {
uint64_t counterValue = 2;
uint64_t *hostAddress = &counterValue;
auto hostAddress = reinterpret_cast<uint64_t *>(allocHostMem(sizeof(uint64_t)));
*hostAddress = counterValue;
uint64_t *gpuAddress = ptrOffset(&counterValue, 64);
ze_event_desc_t eventDesc = {};
@@ -3876,6 +3879,7 @@ HWTEST2_F(InOrderCmdListTests, givenCorrectInputParamsWhenCreatingCbEventThenRet
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zexCounterBasedEventCreate(context, device, gpuAddress, nullptr, counterValue, &eventDesc, &handle));
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zexCounterBasedEventCreate(context, device, nullptr, hostAddress, counterValue, &eventDesc, &handle));
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zexCounterBasedEventCreate(context, nullptr, gpuAddress, hostAddress, counterValue, &eventDesc, &handle));
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zexCounterBasedEventCreate(context, device, gpuAddress, &counterValue, counterValue, &eventDesc, &handle));
EXPECT_EQ(ZE_RESULT_SUCCESS, zexCounterBasedEventCreate(context, device, gpuAddress, hostAddress, counterValue, &eventDesc, &handle));
@@ -3896,11 +3900,15 @@ HWTEST2_F(InOrderCmdListTests, givenCorrectInputParamsWhenCreatingCbEventThenRet
EXPECT_EQ(value, counterValue);
zeEventDestroy(handle);
context->freeMem(hostAddress);
}
HWTEST2_F(InOrderCmdListTests, givenStandaloneEventWhenCallingSynchronizeThenReturnCorrectValue, IsAtLeastSkl) {
uint64_t counterValue = 2;
uint64_t *hostAddress = &counterValue;
auto hostAddress = reinterpret_cast<uint64_t *>(allocHostMem(sizeof(uint64_t)));
*hostAddress = counterValue;
uint64_t *gpuAddress = ptrOffset(&counterValue, 64);
ze_event_desc_t eventDesc = {};
@@ -3912,11 +3920,13 @@ HWTEST2_F(InOrderCmdListTests, givenStandaloneEventWhenCallingSynchronizeThenRet
EXPECT_EQ(ZE_RESULT_NOT_READY, eventObj->hostSynchronize(1));
counterValue++;
(*hostAddress)++;
EXPECT_EQ(ZE_RESULT_SUCCESS, eventObj->hostSynchronize(1));
zeEventDestroy(handle);
context->freeMem(hostAddress);
}
HWTEST2_F(InOrderCmdListTests, givenStandaloneCbEventWhenPassingExternalInterruptIdThenAssign, IsAtLeastSkl) {
@@ -3937,7 +3947,9 @@ HWTEST2_F(InOrderCmdListTests, givenStandaloneCbEventWhenPassingExternalInterrup
HWTEST2_F(InOrderCmdListTests, givenStandaloneEventWhenCallingAppendThenSuccess, IsAtLeastXeHpCore) {
uint64_t counterValue = 2;
uint64_t *hostAddress = &counterValue;
auto hostAddress = reinterpret_cast<uint64_t *>(allocHostMem(sizeof(uint64_t)));
*hostAddress = counterValue;
uint64_t *gpuAddress = ptrOffset(&counterValue, 64);
ze_event_desc_t eventDesc = {};
@@ -3962,11 +3974,14 @@ HWTEST2_F(InOrderCmdListTests, givenStandaloneEventWhenCallingAppendThenSuccess,
zeEventDestroy(eHandle1);
zeEventDestroy(eHandle2);
zeEventDestroy(eHandle3);
context->freeMem(hostAddress);
}
HWTEST2_F(InOrderCmdListTests, givenStandaloneEventAndKernelSplitWhenCallingAppendThenSuccess, IsAtLeastXeHpCore) {
uint64_t counterValue = 2;
uint64_t *hostAddress = &counterValue;
auto hostAddress = reinterpret_cast<uint64_t *>(allocHostMem(sizeof(uint64_t)));
*hostAddress = counterValue;
uint64_t *gpuAddress = ptrOffset(&counterValue, 64);
ze_event_desc_t eventDesc = {};
@@ -3989,11 +4004,14 @@ HWTEST2_F(InOrderCmdListTests, givenStandaloneEventAndKernelSplitWhenCallingAppe
alignedFree(alignedPtr);
zeEventDestroy(eHandle1);
zeEventDestroy(eHandle2);
context->freeMem(hostAddress);
}
HWTEST2_F(InOrderCmdListTests, givenStandaloneEventAndCopyOnlyCmdListWhenCallingAppendThenSuccess, IsAtLeastXeHpCore) {
uint64_t counterValue = 2;
uint64_t *hostAddress = &counterValue;
auto hostAddress = reinterpret_cast<uint64_t *>(allocHostMem(sizeof(uint64_t)));
*hostAddress = counterValue;
uint64_t *gpuAddress = ptrOffset(&counterValue, 64);
ze_event_desc_t eventDesc = {};
@@ -4014,6 +4032,7 @@ HWTEST2_F(InOrderCmdListTests, givenStandaloneEventAndCopyOnlyCmdListWhenCalling
context->freeMem(data);
zeEventDestroy(eHandle1);
zeEventDestroy(eHandle2);
context->freeMem(hostAddress);
}
HWTEST2_F(InOrderCmdListTests, givenCounterBasedEventWhenAskingForEventAddressAndValueThenReturnCorrectValues, IsAtLeastSkl) {
@@ -4229,7 +4248,9 @@ struct MultiTileInOrderCmdListTests : public InOrderCmdListTests {
HWTEST2_F(MultiTileInOrderCmdListTests, givenStandaloneEventWhenCallingAppendThenSuccess, IsAtLeastXeHpCore) {
uint64_t counterValue = 2;
uint64_t *hostAddress = &counterValue;
auto hostAddress = reinterpret_cast<uint64_t *>(allocHostMem(sizeof(uint64_t)));
*hostAddress = counterValue;
uint64_t *gpuAddress = ptrOffset(&counterValue, 64);
ze_event_desc_t eventDesc = {};
@@ -4254,11 +4275,14 @@ HWTEST2_F(MultiTileInOrderCmdListTests, givenStandaloneEventWhenCallingAppendThe
zeEventDestroy(eHandle1);
zeEventDestroy(eHandle2);
zeEventDestroy(eHandle3);
context->freeMem(hostAddress);
}
HWTEST2_F(MultiTileInOrderCmdListTests, givenStandaloneEventAndKernelSplitWhenCallingAppendThenSuccess, IsAtLeastXeHpCore) {
uint64_t counterValue = 2;
uint64_t *hostAddress = &counterValue;
auto hostAddress = reinterpret_cast<uint64_t *>(allocHostMem(sizeof(uint64_t)));
*hostAddress = counterValue;
uint64_t *gpuAddress = ptrOffset(&counterValue, 64);
ze_event_desc_t eventDesc = {};
@@ -4281,11 +4305,14 @@ HWTEST2_F(MultiTileInOrderCmdListTests, givenStandaloneEventAndKernelSplitWhenCa
alignedFree(alignedPtr);
zeEventDestroy(eHandle1);
zeEventDestroy(eHandle2);
context->freeMem(hostAddress);
}
HWTEST2_F(MultiTileInOrderCmdListTests, givenStandaloneEventAndCopyOnlyCmdListWhenCallingAppendThenSuccess, IsAtLeastXeHpCore) {
uint64_t counterValue = 2;
uint64_t *hostAddress = &counterValue;
auto hostAddress = reinterpret_cast<uint64_t *>(allocHostMem(sizeof(uint64_t)));
*hostAddress = counterValue;
uint64_t *gpuAddress = ptrOffset(&counterValue, 64);
ze_event_desc_t eventDesc = {};
@@ -4306,6 +4333,7 @@ HWTEST2_F(MultiTileInOrderCmdListTests, givenStandaloneEventAndCopyOnlyCmdListWh
context->freeMem(data);
zeEventDestroy(eHandle1);
zeEventDestroy(eHandle2);
context->freeMem(hostAddress);
}
HWTEST2_F(MultiTileInOrderCmdListTests, givenDebugFlagSetWhenAskingForAtomicSignallingThenReturnTrue, IsAtLeastXeHpCore) {

View File

@@ -3399,7 +3399,14 @@ HWTEST_F(EventTests, givenStandaloneCbEventAndTbxModeWhenSynchronizingThenHandle
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<NEO::MockMemoryOperations>();
uint64_t counterValue = 2;
uint64_t *hostAddress = &counterValue;
ze_host_mem_alloc_desc_t desc = {};
void *ptr = nullptr;
context->allocHostMem(&desc, sizeof(uint64_t), 1, &ptr);
uint64_t *hostAddress = static_cast<uint64_t *>(ptr);
*hostAddress = counterValue;
uint64_t *gpuAddress = ptrOffset(&counterValue, 64);
ze_event_desc_t eventDesc = {};
@@ -3414,6 +3421,7 @@ HWTEST_F(EventTests, givenStandaloneCbEventAndTbxModeWhenSynchronizingThenHandle
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
zeEventDestroy(handle);
context->freeMem(hostAddress);
}
HWTEST_F(EventTests, givenInOrderEventWithHostAllocWhenHostSynchronizeIsCalledThenAllocationIsDonwloadedOnlyAfterEventWasUsedOnGpu) {