mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
performance: allow non cb events address extraction
Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
40612e93d3
commit
ef37b140de
@@ -22,12 +22,22 @@ ZE_APIEXPORT ze_result_t ZE_APICALL
|
||||
zexEventGetDeviceAddress(ze_event_handle_t event, uint64_t *completionValue, uint64_t *address) {
|
||||
auto eventObj = Event::fromHandle(event);
|
||||
|
||||
if (!eventObj || !eventObj->isCounterBased() || !eventObj->getInOrderExecInfo() || !completionValue || !address) {
|
||||
if (!eventObj || !completionValue || !address) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
*completionValue = eventObj->getInOrderExecSignalValueWithSubmissionCounter();
|
||||
*address = eventObj->getInOrderExecInfo()->getBaseDeviceAddress() + eventObj->getInOrderAllocationOffset();
|
||||
if (eventObj->isCounterBased()) {
|
||||
if (!eventObj->getInOrderExecInfo()) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
*completionValue = eventObj->getInOrderExecSignalValueWithSubmissionCounter();
|
||||
*address = eventObj->getInOrderExecInfo()->getBaseDeviceAddress() + eventObj->getInOrderAllocationOffset();
|
||||
} else if (eventObj->isEventTimestampFlagSet()) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
} else {
|
||||
*completionValue = Event::State::STATE_SIGNALED;
|
||||
*address = eventObj->getCompletionFieldGpuAddress(eventObj->peekEventPool()->getDevice());
|
||||
}
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -121,6 +121,7 @@ struct Event : _ze_event_handle_t {
|
||||
MOCKABLE_VIRTUAL NEO::GraphicsAllocation *getPoolAllocation(Device *device) const;
|
||||
|
||||
void setEventPool(EventPool *eventPool) { this->eventPool = eventPool; }
|
||||
EventPool *peekEventPool() { return this->eventPool; }
|
||||
|
||||
MOCKABLE_VIRTUAL uint64_t getGpuAddress(Device *device) const;
|
||||
virtual uint32_t getPacketsInUse() const = 0;
|
||||
|
||||
@@ -3961,7 +3961,7 @@ HWTEST2_F(InOrderCmdListTests, givenProfilingEventWhenDoingCpuCopyThenSetProfili
|
||||
context->freeMem(deviceAlloc);
|
||||
}
|
||||
|
||||
HWTEST2_F(InOrderCmdListTests, givenIncorrectInputParamsWhenAskingForEventAddressAndValueThenReturnError, IsAtLeastSkl) {
|
||||
HWTEST2_F(InOrderCmdListTests, givenEventCreatedFromPoolWhenItIsQueriedForAddressItReturnsProperAddressFromPool, IsAtLeastSkl) {
|
||||
auto eventPool = createEvents<FamilyType>(1, false);
|
||||
uint64_t counterValue = 0;
|
||||
uint64_t address = 0;
|
||||
@@ -3973,6 +3973,17 @@ HWTEST2_F(InOrderCmdListTests, givenIncorrectInputParamsWhenAskingForEventAddres
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zexEventGetDeviceAddress(nullptr, &counterValue, &address));
|
||||
|
||||
events[0]->makeCounterBasedImplicitlyDisabled();
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zexEventGetDeviceAddress(eventHandle, &counterValue, &address));
|
||||
EXPECT_EQ(Event::State::STATE_SIGNALED, counterValue);
|
||||
EXPECT_EQ(address, events[0]->getCompletionFieldGpuAddress(events[0]->peekEventPool()->getDevice()));
|
||||
}
|
||||
HWTEST2_F(InOrderCmdListTests, givenEventCreatedFromPoolWithTimestampsWhenQueriedForAddressErrorIsReturned, IsAtLeastSkl) {
|
||||
auto eventPool = createEvents<FamilyType>(1, true);
|
||||
uint64_t counterValue = 0;
|
||||
uint64_t address = 0;
|
||||
|
||||
auto eventHandle = events[0]->toHandle();
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zexEventGetDeviceAddress(eventHandle, &counterValue, &address));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user