mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
fix: Proper update of device count that generated events
numDeviceEvents out param is not being updated in case there are no events and device events map is not overridden on multiple register calls result in failure. Related-To: LOCI-4751 Signed-off-by: Bellekallu Rajkiran <bellekallu.rajkiran@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
742bc15be9
commit
63fa05e776
@@ -122,7 +122,7 @@ void LinuxEventsUtil::eventRegister(zes_event_type_flags_t events, SysmanDeviceI
|
||||
registeredEvents = deviceEventsMap[pSysmanDevice];
|
||||
}
|
||||
registeredEvents |= (events & supportedEventMask);
|
||||
deviceEventsMap.emplace(pSysmanDevice, registeredEvents);
|
||||
deviceEventsMap[pSysmanDevice] = registeredEvents;
|
||||
}
|
||||
|
||||
// Write to Pipe only if eventregister() is called during listen and previously registered events are modified.
|
||||
@@ -142,6 +142,7 @@ void LinuxEventsUtil::init() {
|
||||
|
||||
ze_result_t LinuxEventsUtil::eventsListen(uint64_t timeout, uint32_t count, zes_device_handle_t *phDevices, uint32_t *pNumDeviceEvents, zes_event_type_flags_t *pEvents) {
|
||||
memset(pEvents, 0, count * sizeof(zes_event_type_flags_t));
|
||||
*pNumDeviceEvents = 0;
|
||||
std::vector<zes_event_type_flags_t> registeredEvents(count);
|
||||
for (uint32_t devIndex = 0; devIndex < count; devIndex++) {
|
||||
auto device = static_cast<SysmanDeviceImp *>(L0::SysmanDevice::fromHandle(phDevices[devIndex]));
|
||||
|
||||
@@ -618,7 +618,7 @@ TEST_F(SysmanEventsFixture,
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDeviceEventRegister(device->toHandle(), ZES_EVENT_TYPE_FLAG_DEVICE_RESET_REQUIRED));
|
||||
zes_device_handle_t *phDevices = new zes_device_handle_t[1];
|
||||
phDevices[0] = device->toHandle();
|
||||
uint32_t numDeviceEvents = 0;
|
||||
uint32_t numDeviceEvents = std::numeric_limits<uint32_t>::max();
|
||||
zes_event_type_flags_t *pDeviceEvents = new zes_event_type_flags_t[1];
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDriverEventListen(driverHandle->toHandle(), 1u, 1u, phDevices, &numDeviceEvents, pDeviceEvents));
|
||||
EXPECT_EQ(0u, numDeviceEvents);
|
||||
@@ -714,6 +714,7 @@ TEST_F(SysmanEventsFixture, GivenEventsAreRegisteredWhenEventRegisterWithNoEvent
|
||||
|
||||
pLinuxEventsImp->deviceEventsMap = deviceEventsMap;
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDeviceEventRegister(device->toHandle(), 0));
|
||||
EXPECT_EQ(0u, pLinuxEventsImp->deviceEventsMap[pLinuxSysmanImp->getSysmanDeviceImp()]);
|
||||
|
||||
pPublicLinuxSysmanDriverImp->pLinuxEventsUtil = pLinuxEventsUtilOld;
|
||||
L0::osSysmanDriverDestructor();
|
||||
|
||||
Reference in New Issue
Block a user