fix: create standalone event with correct packet size

Related-To: NEO-11925

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2024-11-07 15:09:45 +00:00
committed by Compute-Runtime-Automation
parent 778504c928
commit 34e22f0eee
4 changed files with 29 additions and 1 deletions

View File

@@ -54,6 +54,7 @@ constexpr int stallSamplingReportSubSliceAndFlagsOffset = 48;
struct Event;
struct Device;
struct EventPool;
struct EventDescriptor;
class L0GfxCoreHelper;
using createL0GfxCoreHelperFunctionType = std::unique_ptr<L0GfxCoreHelper> (*)();
@@ -79,6 +80,7 @@ class L0GfxCoreHelper : public NEO::ApiGfxCoreHelper {
virtual void setAdditionalGroupProperty(ze_command_queue_group_properties_t &groupProperty, NEO::EngineGroupT &group) const = 0;
virtual L0::Event *createEvent(L0::EventPool *eventPool, const ze_event_desc_t *desc, L0::Device *device) const = 0;
virtual L0::Event *createStandaloneEvent(const EventDescriptor &desc, L0::Device *device, ze_result_t &result) const = 0;
virtual bool isResumeWARequired() = 0;
virtual bool imageCompressionSupported(const NEO::HardwareInfo &hwInfo) const = 0;
@@ -133,6 +135,7 @@ class L0GfxCoreHelperHw : public L0GfxCoreHelper {
void setAdditionalGroupProperty(ze_command_queue_group_properties_t &groupProperty, NEO::EngineGroupT &group) const override;
L0::Event *createEvent(L0::EventPool *eventPool, const ze_event_desc_t *desc, L0::Device *device) const override;
L0::Event *createStandaloneEvent(const EventDescriptor &desc, L0::Device *device, ze_result_t &result) const override;
bool isResumeWARequired() override;
bool imageCompressionSupported(const NEO::HardwareInfo &hwInfo) const override;

View File

@@ -34,6 +34,11 @@ L0::Event *L0GfxCoreHelperHw<Family>::createEvent(L0::EventPool *eventPool, cons
return Event::create<typename Family::TimestampPacketType>(eventPool, desc, device);
}
template <typename Family>
L0::Event *L0GfxCoreHelperHw<Family>::createStandaloneEvent(const EventDescriptor &desc, L0::Device *device, ze_result_t &result) const {
return Event::create<typename Family::TimestampPacketType>(desc, device, result);
}
template <typename Family>
bool L0GfxCoreHelperHw<Family>::alwaysAllocateEventInLocalMem() const {
return false;

View File

@@ -4693,6 +4693,24 @@ HWTEST2_F(InOrderCmdListTests, givenCorrectInputParamsWhenCreatingCbEvent2ThenRe
context->freeMem(hostAddress);
}
HWTEST_F(InOrderCmdListTests, givenTimestmapEnabledWhenCreatingStandaloneCbEventThenSetCorrectPacketSize) {
zex_counter_based_event_desc_t counterBasedDesc = {ZEX_STRUCTURE_COUTER_BASED_EVENT_DESC}; // NOLINT(clang-analyzer-optin.core.EnumCastOutOfRange), NEO-12901
counterBasedDesc.flags = ZEX_COUNTER_BASED_EVENT_FLAG_IMMEDIATE | ZEX_COUNTER_BASED_EVENT_FLAG_KERNEL_TIMESTAMP;
ze_event_handle_t handle = nullptr;
EXPECT_EQ(ZE_RESULT_SUCCESS, zexCounterBasedEventCreate2(context, device, &counterBasedDesc, &handle));
auto eventObj = Event::fromHandle(handle);
using TagSizeT = typename FamilyType::TimestampPacketType;
constexpr auto singlePacetSize = NEO::TimestampPackets<TagSizeT, NEO::TimestampPacketConstants::preferredPacketCount>::getSinglePacketSize();
EXPECT_EQ(singlePacetSize, eventObj->getSinglePacketSize());
zeEventDestroy(handle);
}
HWTEST2_F(InOrderCmdListTests, givenStandaloneEventWhenCallingSynchronizeThenReturnCorrectValue, MatchAny) {
uint64_t counterValue = 2;
auto hostAddress = reinterpret_cast<uint64_t *>(allocHostMem(sizeof(uint64_t)));