mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
Create definition of tag allocation layout
we use tag allocation for multiple purposes, therefore we should define all offsets in one place Resolves: NEO-7559 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
ba9ea6fabf
commit
103f522f18
@@ -52,6 +52,7 @@ set(NEO_CORE_COMMAND_STREAM
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/submission_status.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/submissions_aggregator.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/submissions_aggregator.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tag_allocation_layout.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/task_count_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tbx_command_stream_receiver.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tbx_command_stream_receiver.h
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "shared/source/command_stream/experimental_command_buffer.h"
|
||||
#include "shared/source/command_stream/preemption.h"
|
||||
#include "shared/source/command_stream/scratch_space_controller.h"
|
||||
#include "shared/source/command_stream/tag_allocation_layout.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/direct_submission/direct_submission_controller.h"
|
||||
@@ -444,7 +445,7 @@ void CommandStreamReceiver::setTagAllocation(GraphicsAllocation *allocation) {
|
||||
UNRECOVERABLE_IF(allocation == nullptr);
|
||||
this->tagAddress = reinterpret_cast<TagAddressType *>(allocation->getUnderlyingBuffer());
|
||||
this->debugPauseStateAddress = reinterpret_cast<DebugPauseState *>(
|
||||
reinterpret_cast<uint8_t *>(allocation->getUnderlyingBuffer()) + debugPauseStateAddressOffset);
|
||||
reinterpret_cast<uint8_t *>(allocation->getUnderlyingBuffer()) + TagAllocationLayout::debugPauseStateAddressOffset);
|
||||
}
|
||||
|
||||
MultiGraphicsAllocation &CommandStreamReceiver::createTagsMultiAllocation() {
|
||||
@@ -687,10 +688,14 @@ bool CommandStreamReceiver::initializeTagAllocation() {
|
||||
this->setTagAllocation(tagAllocation);
|
||||
auto initValue = DebugManager.flags.EnableNullHardware.get() ? static_cast<uint32_t>(-1) : initialHardwareTag;
|
||||
auto tagAddress = this->tagAddress;
|
||||
auto completionFence = reinterpret_cast<TaskCountType *>(getCompletionAddress());
|
||||
UNRECOVERABLE_IF(!completionFence);
|
||||
uint32_t subDevices = static_cast<uint32_t>(this->deviceBitfield.count());
|
||||
for (uint32_t i = 0; i < subDevices; i++) {
|
||||
*tagAddress = initValue;
|
||||
tagAddress = ptrOffset(tagAddress, this->postSyncWriteOffset);
|
||||
*completionFence = 0;
|
||||
completionFence = ptrOffset(completionFence, this->postSyncWriteOffset);
|
||||
}
|
||||
*this->debugPauseStateAddress = DebugManager.flags.EnableNullHardware.get() ? DebugPauseState::disabled : DebugPauseState::waitingForFirstSemaphore;
|
||||
|
||||
@@ -956,4 +961,13 @@ TaskCountType CompletionStamp::getTaskCountFromSubmissionStatusError(SubmissionS
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t CommandStreamReceiver::getDebugPauseStateGPUAddress() const { return tagAllocation->getGpuAddress() + TagAllocationLayout::debugPauseStateAddressOffset; }
|
||||
uint64_t CommandStreamReceiver::getCompletionAddress() const {
|
||||
uint64_t completionFenceAddress = castToUint64(const_cast<TagAddressType *>(tagAddress));
|
||||
if (completionFenceAddress == 0) {
|
||||
return 0;
|
||||
}
|
||||
completionFenceAddress += TagAllocationLayout::completionFenceOffset;
|
||||
return completionFenceAddress;
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -133,7 +133,7 @@ class CommandStreamReceiver {
|
||||
}
|
||||
MultiGraphicsAllocation &createTagsMultiAllocation();
|
||||
volatile TagAddressType *getTagAddress() const { return tagAddress; }
|
||||
uint64_t getDebugPauseStateGPUAddress() const { return tagAllocation->getGpuAddress() + debugPauseStateAddressOffset; }
|
||||
uint64_t getDebugPauseStateGPUAddress() const;
|
||||
|
||||
virtual bool waitForFlushStamp(FlushStamp &flushStampToWait) { return true; }
|
||||
|
||||
@@ -335,14 +335,7 @@ class CommandStreamReceiver {
|
||||
MOCKABLE_VIRTUAL bool isGpuHangDetected() const;
|
||||
MOCKABLE_VIRTUAL bool checkGpuHangDetected(TimeType currentTime, TimeType &lastHangCheckTime) const;
|
||||
|
||||
uint64_t getCompletionAddress() const {
|
||||
uint64_t completionFenceAddress = castToUint64(const_cast<TagAddressType *>(tagAddress));
|
||||
if (completionFenceAddress == 0) {
|
||||
return 0;
|
||||
}
|
||||
completionFenceAddress += completionFenceOffset;
|
||||
return completionFenceAddress;
|
||||
}
|
||||
uint64_t getCompletionAddress() const;
|
||||
|
||||
TaskCountType getCompletionValue(const GraphicsAllocation &gfxAllocation);
|
||||
DispatchMode getDispatchMode() const {
|
||||
@@ -424,8 +417,6 @@ class CommandStreamReceiver {
|
||||
FrontEndPropertiesSupport feSupportFlags{};
|
||||
PipelineSelectPropertiesSupport pipelineSupportFlags{};
|
||||
|
||||
// offset for debug state is 1kbyte, tag writes can use multiple offsets for multiple partitions and each offset can vary per platform
|
||||
const uint64_t debugPauseStateAddressOffset = MemoryConstants::kiloByte;
|
||||
uint64_t totalMemoryUsed = 0u;
|
||||
|
||||
volatile TagAddressType *tagAddress = nullptr;
|
||||
@@ -476,7 +467,6 @@ class CommandStreamReceiver {
|
||||
uint32_t activePartitions = 1;
|
||||
uint32_t activePartitionsConfig = 1;
|
||||
uint32_t postSyncWriteOffset = 0;
|
||||
uint32_t completionFenceOffset = 0;
|
||||
TaskCountType completionFenceValue = 0;
|
||||
|
||||
const uint32_t rootDeviceIndex;
|
||||
|
||||
17
shared/source/command_stream/tag_allocation_layout.h
Normal file
17
shared/source/command_stream/tag_allocation_layout.h
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/helpers/constants.h"
|
||||
|
||||
namespace NEO {
|
||||
namespace TagAllocationLayout {
|
||||
inline constexpr uint64_t debugPauseStateAddressOffset = MemoryConstants::kiloByte;
|
||||
inline constexpr uint64_t completionFenceOffset = 2 * MemoryConstants::kiloByte;
|
||||
|
||||
} // namespace TagAllocationLayout
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user