Allow device allocs for timestamp events

Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@intel.com>
This commit is contained in:
Aravind Gopalakrishnan
2022-02-25 22:35:37 +00:00
committed by Compute-Runtime-Automation
parent d603bb2f34
commit 8aa2e76173
2 changed files with 37 additions and 1 deletions

View File

@@ -85,7 +85,7 @@ ze_result_t EventPoolImp::initialize(DriverHandle *driver, Context *context, uin
useDeviceAlloc = false;
}
if (useDeviceAlloc && !isEventPoolTimestampFlagSet()) {
if (useDeviceAlloc) {
allocationType = NEO::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER;
}

View File

@@ -935,6 +935,42 @@ TEST_F(TimestampEventCreate, givenEventWithStaticPartitionOffThenQueryTimestampE
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, result);
}
class TimestampDeviceEventCreate : public Test<DeviceFixture> {
public:
void SetUp() override {
DeviceFixture::SetUp();
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.count = 1;
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
ze_event_desc_t eventDesc = {};
eventDesc.index = 0;
eventDesc.signal = 0;
eventDesc.wait = 0;
ze_result_t result = ZE_RESULT_SUCCESS;
eventPool = std::unique_ptr<L0::EventPool>(L0::EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, result));
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
ASSERT_NE(nullptr, eventPool);
event = std::unique_ptr<L0::EventImp<uint32_t>>(static_cast<L0::EventImp<uint32_t> *>(L0::Event::create<uint32_t>(eventPool.get(), &eventDesc, device)));
ASSERT_NE(nullptr, event);
}
void TearDown() override {
DeviceFixture::TearDown();
}
std::unique_ptr<L0::EventPool> eventPool;
std::unique_ptr<L0::EventImp<uint32_t>> event;
};
TEST_F(TimestampDeviceEventCreate, givenTimestampDeviceEventThenAllocationsIsOfGpuDeviceTimestampType) {
auto allocation = &eventPool->getAllocation();
ASSERT_NE(nullptr, allocation);
EXPECT_EQ(NEO::AllocationType::GPU_TIMESTAMP_DEVICE_BUFFER, allocation->getAllocationType());
}
using EventQueryTimestampExpWithSubDevice = Test<MultiDeviceFixture>;
TEST_F(EventQueryTimestampExpWithSubDevice, givenEventWhenQuerytimestampExpWithSubDeviceThenReturnsCorrectValueReturned) {