mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
refactor: move tag initialization to allocator [1/n]
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
2062c13704
commit
b1dea19fbd
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -14,13 +14,15 @@ namespace NEO {
|
||||
|
||||
class HwTimeStamps : public TagTypeBase {
|
||||
public:
|
||||
void initialize() {
|
||||
globalStartTS = 0;
|
||||
contextStartTS = 0;
|
||||
globalEndTS = 0;
|
||||
contextEndTS = 0;
|
||||
globalCompleteTS = 0;
|
||||
contextCompleteTS = 0;
|
||||
using ValueT = uint64_t;
|
||||
|
||||
void initialize(uint64_t initValue) {
|
||||
globalStartTS = initValue;
|
||||
contextStartTS = initValue;
|
||||
globalEndTS = initValue;
|
||||
contextEndTS = initValue;
|
||||
globalCompleteTS = initValue;
|
||||
contextCompleteTS = initValue;
|
||||
}
|
||||
|
||||
static constexpr AllocationType getAllocationType() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -14,9 +14,11 @@ namespace NEO {
|
||||
|
||||
class HwPerfCounter : public TagTypeBase {
|
||||
public:
|
||||
void initialize() {
|
||||
using ValueT = uint8_t;
|
||||
|
||||
void initialize(uint8_t initValue) {
|
||||
query = {};
|
||||
report[0] = 0;
|
||||
report[0] = initValue;
|
||||
}
|
||||
|
||||
static constexpr AllocationType getAllocationType() {
|
||||
|
||||
@@ -104,10 +104,11 @@ class TagNode : public TagNodeBase, public IDNode<TagNode<TagType>> {
|
||||
"This structure is consumed by GPU and has to follow specific restrictions for padding and size");
|
||||
|
||||
public:
|
||||
using ValueT = typename TagType::ValueT;
|
||||
TagType *tagForCpuAccess;
|
||||
|
||||
void initialize() override {
|
||||
tagForCpuAccess->initialize();
|
||||
tagForCpuAccess->initialize(static_cast<TagAllocator<TagType> *>(allocator)->getInitialValue());
|
||||
packetsUsed = 1;
|
||||
setProfilingCapable(true);
|
||||
}
|
||||
@@ -177,13 +178,15 @@ template <typename TagType>
|
||||
class TagAllocator : public TagAllocatorBase {
|
||||
public:
|
||||
using NodeType = TagNode<TagType>;
|
||||
using ValueT = typename TagType::ValueT;
|
||||
|
||||
TagAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memMngr, size_t tagCount,
|
||||
size_t tagAlignment, size_t tagSize, bool doNotReleaseNodes, bool initializeTags, DeviceBitfield deviceBitfield);
|
||||
size_t tagAlignment, size_t tagSize, ValueT initialValue, bool doNotReleaseNodes, bool initializeTags, DeviceBitfield deviceBitfield);
|
||||
|
||||
TagNodeBase *getTag() override;
|
||||
|
||||
void returnTag(TagNodeBase *node) override;
|
||||
ValueT getInitialValue() const { return initialValue; }
|
||||
|
||||
protected:
|
||||
TagAllocator() = delete;
|
||||
@@ -202,6 +205,7 @@ class TagAllocator : public TagAllocatorBase {
|
||||
|
||||
std::vector<std::unique_ptr<NodeType[]>> tagPoolMemory;
|
||||
|
||||
const ValueT initialValue;
|
||||
bool initializeTags = true;
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
namespace NEO {
|
||||
template <typename TagType>
|
||||
TagAllocator<TagType>::TagAllocator(const RootDeviceIndicesContainer &rootDeviceIndices, MemoryManager *memMngr, size_t tagCount, size_t tagAlignment,
|
||||
size_t tagSize, bool doNotReleaseNodes, bool initializeTags, DeviceBitfield deviceBitfield)
|
||||
: TagAllocatorBase(rootDeviceIndices, memMngr, tagCount, tagAlignment, tagSize, doNotReleaseNodes, deviceBitfield), initializeTags(initializeTags) {
|
||||
size_t tagSize, ValueT initialValue, bool doNotReleaseNodes, bool initializeTags, DeviceBitfield deviceBitfield)
|
||||
: TagAllocatorBase(rootDeviceIndices, memMngr, tagCount, tagAlignment, tagSize, doNotReleaseNodes, deviceBitfield), initialValue(initialValue), initializeTags(initializeTags) {
|
||||
|
||||
populateFreeTags();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user