mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
Refactor TagAllocator
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
cb4db7767e
commit
5a50ad098c
@@ -117,7 +117,7 @@ Event *Event::create(EventPool *eventPool, const ze_event_desc_t *desc, Device *
|
||||
|
||||
if (eventPool->isEventPoolUsedForTimestamp) {
|
||||
event->isTimestampEvent = true;
|
||||
event->timestampsData = std::make_unique<TimestampPacketStorage>();
|
||||
event->timestampsData = std::make_unique<NEO::TimestampPackets<uint32_t>>();
|
||||
}
|
||||
|
||||
auto alloc = eventPool->getAllocation().getGraphicsAllocation(device->getNEODevice()->getRootDeviceIndex());
|
||||
@@ -140,7 +140,7 @@ NEO::GraphicsAllocation &Event::getAllocation() {
|
||||
}
|
||||
|
||||
uint64_t Event::getTimestampPacketAddress() {
|
||||
return gpuAddress + packetsInUse * sizeof(TimestampPacketStorage::Packet);
|
||||
return gpuAddress + packetsInUse * sizeof(NEO::TimestampPackets<uint32_t>::Packet);
|
||||
}
|
||||
|
||||
ze_result_t EventImp::calculateProfilingData() {
|
||||
@@ -172,7 +172,7 @@ void EventImp::assignTimestampData(void *address) {
|
||||
|
||||
for (uint32_t i = 0; i < packetsToCopy; i++) {
|
||||
timestampsData->assignDataToAllTimestamps(i, address);
|
||||
address = ptrOffset(address, sizeof(struct TimestampPacketStorage::Packet));
|
||||
address = ptrOffset(address, sizeof(struct NEO::TimestampPackets<uint32_t>::Packet));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ ze_result_t EventImp::queryStatus() {
|
||||
this->csr->downloadAllocations();
|
||||
if (isTimestampEvent) {
|
||||
auto baseAddr = reinterpret_cast<uint64_t>(hostAddress);
|
||||
auto timeStampAddress = baseAddr + offsetof(TimestampPacketStorage::Packet, contextEnd);
|
||||
auto timeStampAddress = baseAddr + offsetof(NEO::TimestampPackets<uint32_t>::Packet, contextEnd);
|
||||
hostAddr = reinterpret_cast<uint64_t *>(timeStampAddress);
|
||||
}
|
||||
memcpy_s(static_cast<void *>(&queryVal), sizeof(uint32_t), static_cast<void *>(hostAddr), sizeof(uint32_t));
|
||||
@@ -212,11 +212,11 @@ ze_result_t EventImp::hostEventSetValueTimestamps(uint32_t eventVal) {
|
||||
};
|
||||
|
||||
for (uint32_t i = 0; i < NEO::TimestampPacketSizeControl::preferredPacketCount; i++) {
|
||||
eventTsSetFunc(baseAddr + offsetof(TimestampPacketStorage::Packet, contextStart));
|
||||
eventTsSetFunc(baseAddr + offsetof(TimestampPacketStorage::Packet, globalStart));
|
||||
eventTsSetFunc(baseAddr + offsetof(TimestampPacketStorage::Packet, contextEnd));
|
||||
eventTsSetFunc(baseAddr + offsetof(TimestampPacketStorage::Packet, globalEnd));
|
||||
baseAddr += sizeof(struct TimestampPacketStorage::Packet);
|
||||
eventTsSetFunc(baseAddr + offsetof(NEO::TimestampPackets<uint32_t>::Packet, contextStart));
|
||||
eventTsSetFunc(baseAddr + offsetof(NEO::TimestampPackets<uint32_t>::Packet, globalStart));
|
||||
eventTsSetFunc(baseAddr + offsetof(NEO::TimestampPackets<uint32_t>::Packet, contextEnd));
|
||||
eventTsSetFunc(baseAddr + offsetof(NEO::TimestampPackets<uint32_t>::Packet, globalEnd));
|
||||
baseAddr += sizeof(struct NEO::TimestampPackets<uint32_t>::Packet);
|
||||
}
|
||||
assignTimestampData(hostAddress);
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace L0 {
|
||||
typedef uint64_t FlushStamp;
|
||||
struct EventPool;
|
||||
struct MetricStreamer;
|
||||
using TimestampPacketStorage = NEO::TimestampPackets<uint32_t>;
|
||||
|
||||
struct Event : _ze_event_handle_t {
|
||||
virtual ~Event() = default;
|
||||
@@ -61,7 +60,7 @@ struct Event : _ze_event_handle_t {
|
||||
ze_event_scope_flags_t waitScope = 0u;
|
||||
bool isTimestampEvent = false;
|
||||
|
||||
std::unique_ptr<TimestampPacketStorage> timestampsData = nullptr;
|
||||
std::unique_ptr<NEO::TimestampPackets<uint32_t>> timestampsData = nullptr;
|
||||
uint64_t globalStartTS;
|
||||
uint64_t globalEndTS;
|
||||
uint64_t contextStartTS;
|
||||
@@ -158,7 +157,7 @@ struct EventPoolImp : public EventPool {
|
||||
size_t numEvents;
|
||||
|
||||
protected:
|
||||
const uint32_t eventSize = static_cast<uint32_t>(alignUp(NEO::TimestampPacketSizeControl::preferredPacketCount * sizeof(struct TimestampPacketStorage::Packet),
|
||||
const uint32_t eventSize = static_cast<uint32_t>(alignUp(NEO::TimestampPacketSizeControl::preferredPacketCount * sizeof(struct NEO::TimestampPackets<uint32_t>::Packet),
|
||||
MemoryConstants::cacheLineSize));
|
||||
const uint32_t eventAlignment = MemoryConstants::cacheLineSize;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user