Use dedicated using type for TaskCount

Related-To: NEO-7155

Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
Maciej Plewka
2022-11-22 13:53:59 +00:00
committed by Compute-Runtime-Automation
parent 3f962bf3e8
commit 4b42b066f8
146 changed files with 568 additions and 529 deletions

View File

@@ -24,7 +24,7 @@ void DeviceFixture::setUpImpl(const NEO::HardwareInfo *hardwareInfo) {
auto &commandStreamReceiver = pDevice->getGpgpuCommandStreamReceiver();
pTagMemory = commandStreamReceiver.getTagAddress();
ASSERT_NE(nullptr, const_cast<uint32_t *>(pTagMemory));
ASSERT_NE(nullptr, const_cast<TagAddressType *>(pTagMemory));
}
void DeviceFixture::tearDown() {

View File

@@ -19,7 +19,7 @@ struct DeviceFixture {
MockDevice *createWithUsDeviceIdRevId(unsigned short usDeviceId, unsigned short usRevId);
MockDevice *pDevice = nullptr;
volatile uint32_t *pTagMemory = nullptr;
volatile TagAddressType *pTagMemory = nullptr;
HardwareInfo hardwareInfo = {};
PLATFORM platformHelper = {};
const uint32_t rootDeviceIndex = 0u;

View File

@@ -6,6 +6,7 @@
*/
#pragma once
#include "shared/source/command_stream/task_count_helper.h"
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/helpers/options.h"
@@ -21,8 +22,8 @@ class MemoryManagerWithCsrFixture {
MockMemoryManager *memoryManager;
ExecutionEnvironment executionEnvironment;
std::unique_ptr<MockCommandStreamReceiver> csr;
uint32_t taskCount = 0;
uint32_t currentGpuTag = initialHardwareTag;
TaskCountType taskCount = 0;
TagAddressType currentGpuTag = initialHardwareTag;
~MemoryManagerWithCsrFixture() = default;

View File

@@ -50,7 +50,7 @@ class UltAubCommandStreamReceiver : public AUBCommandStreamReceiverHw<GfxFamily>
return csr;
}
uint32_t flushBcsTask(const BlitPropertiesContainer &blitPropertiesContainer, bool blocking, bool profilingEnabled, Device &device) override {
TaskCountType flushBcsTask(const BlitPropertiesContainer &blitPropertiesContainer, bool blocking, bool profilingEnabled, Device &device) override {
blitBufferCalled++;
return BaseClass::flushBcsTask(blitPropertiesContainer, blocking, profilingEnabled, device);
}

View File

@@ -176,7 +176,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
CompletionStamp flushTask(LinearStream &commandStream, size_t commandStreamStart,
const IndirectHeap *dsh, const IndirectHeap *ioh, const IndirectHeap *ssh,
uint32_t taskLevel, DispatchFlags &dispatchFlags, Device &device) override {
TaskCountType taskLevel, DispatchFlags &dispatchFlags, Device &device) override {
recordedDispatchFlags = dispatchFlags;
this->lastFlushedCommandStream = &commandStream;
return BaseClass::flushTask(commandStream, commandStreamStart, dsh, ioh, ssh, taskLevel, dispatchFlags, device);
@@ -196,7 +196,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
downloadAllocationCalled = true;
}
WaitStatus waitForCompletionWithTimeout(const WaitParams &params, uint32_t taskCountToWait) override {
WaitStatus waitForCompletionWithTimeout(const WaitParams &params, TaskCountType taskCountToWait) override {
latestWaitForCompletionWithTimeoutTaskCount.store(taskCountToWait);
waitForCompletionWithTimeoutTaskCountCalled++;
if (callBaseWaitForCompletionWithTimeout) {
@@ -212,11 +212,11 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
}
}
WaitStatus waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMicroseconds, uint32_t taskCountToWait) {
WaitStatus waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMicroseconds, TaskCountType taskCountToWait) {
return waitForCompletionWithTimeout(WaitParams{false, enableTimeout, timeoutMicroseconds}, taskCountToWait);
}
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, QueueThrottle throttle) override {
WaitStatus waitForTaskCountWithKmdNotifyFallback(TaskCountType taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, QueueThrottle throttle) override {
if (waitForTaskCountWithKmdNotifyFallbackReturnValue.has_value()) {
return *waitForTaskCountWithKmdNotifyFallbackReturnValue;
}
@@ -245,7 +245,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
return makeResidentAllocations.find(graphicsAllocation) != makeResidentAllocations.end();
}
bool isMadeResident(GraphicsAllocation *graphicsAllocation, uint32_t taskCount) const {
bool isMadeResident(GraphicsAllocation *graphicsAllocation, TaskCountType taskCount) const {
auto it = makeResidentAllocations.find(graphicsAllocation);
if (it == makeResidentAllocations.end()) {
return false;
@@ -289,7 +289,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
return CommandStreamReceiverHw<GfxFamily>::obtainUniqueOwnership();
}
uint32_t flushBcsTask(const BlitPropertiesContainer &blitPropertiesContainer, bool blocking, bool profilingEnabled, Device &device) override {
TaskCountType flushBcsTask(const BlitPropertiesContainer &blitPropertiesContainer, bool blocking, bool profilingEnabled, Device &device) override {
blitBufferCalled++;
receivedBlitProperties = blitPropertiesContainer;
@@ -363,13 +363,13 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
BatchBuffer latestFlushedBatchBuffer = {};
std::atomic<uint32_t> recursiveLockCounter;
std::atomic<uint32_t> latestWaitForCompletionWithTimeoutTaskCount{0};
std::atomic<TaskCountType> latestWaitForCompletionWithTimeoutTaskCount{0};
std::atomic<uint32_t> waitForCompletionWithTimeoutTaskCountCalled{0};
LinearStream *lastFlushedCommandStream = nullptr;
uint32_t makeSurfacePackNonResidentCalled = false;
uint32_t latestSentTaskCountValueDuringFlush = 0;
TaskCountType latestSentTaskCountValueDuringFlush = 0;
uint32_t blitBufferCalled = 0;
uint32_t createPerDssBackedBufferCalled = 0;
uint32_t initDirectSubmissionCalled = 0;
@@ -400,7 +400,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
WaitStatus returnWaitForCompletionWithTimeout = WaitStatus::Ready;
std::optional<WaitStatus> waitForTaskCountWithKmdNotifyFallbackReturnValue{};
bool callBaseFlushBcsTask{true};
uint32_t flushBcsTaskReturnValue{};
TaskCountType flushBcsTaskReturnValue{};
std::optional<SubmissionStatus> flushReturnValue{};
CommandStreamReceiverType commandStreamReceiverType = CommandStreamReceiverType::CSR_HW;
};

View File

@@ -21,14 +21,14 @@ class MockBufferObject : public BufferObject {
struct ExecParams {
uint64_t completionGpuAddress = 0;
uint32_t completionValue = 0;
TaskCountType completionValue = 0;
};
std::vector<ExecParams> passedExecParams{};
MockBufferObject(Drm *drm) : BufferObject(drm, CommonConstants::unsupportedPatIndex, 0, 0, 1) {
}
int exec(uint32_t used, size_t startOffset, unsigned int flags, bool requiresCoherency, OsContext *osContext, uint32_t vmHandleId, uint32_t drmContextId,
BufferObject *const residency[], size_t residencyCount, ExecObject *execObjectsStorage, uint64_t completionGpuAddress, uint32_t completionValue) override {
BufferObject *const residency[], size_t residencyCount, ExecObject *execObjectsStorage, uint64_t completionGpuAddress, TaskCountType completionValue) override {
passedExecParams.push_back({completionGpuAddress, completionValue});
return BufferObject::exec(used, startOffset, flags, requiresCoherency, osContext, vmHandleId, drmContextId,
residency, residencyCount, execObjectsStorage, completionGpuAddress, completionValue);

View File

@@ -99,14 +99,14 @@ class TestedDrmCommandStreamReceiver : public DrmCommandStreamReceiver<GfxFamily
struct WaitUserFenceResult {
uint32_t called = 0u;
uint32_t waitValue = 0u;
TaskCountType waitValue = 0u;
int returnValue = 0;
bool callParent = true;
};
WaitUserFenceResult waitUserFenceResult;
int waitUserFence(uint32_t waitValue) override {
int waitUserFence(TaskCountType waitValue) override {
waitUserFenceResult.called++;
waitUserFenceResult.waitValue = waitValue;

View File

@@ -64,7 +64,7 @@ struct MockAubCsr : public AUBCommandStreamReceiverHw<GfxFamily> {
CompletionStamp flushTask(LinearStream &commandStream, size_t commandStreamStart,
const IndirectHeap *dsh, const IndirectHeap *ioh, const IndirectHeap *ssh,
uint32_t taskLevel, DispatchFlags &dispatchFlags, Device &device) override {
TaskCountType taskLevel, DispatchFlags &dispatchFlags, Device &device) override {
recordedDispatchFlags = dispatchFlags;
return AUBCommandStreamReceiverHw<GfxFamily>::flushTask(commandStream, commandStreamStart, dsh, ioh, ssh, taskLevel, dispatchFlags, device);
@@ -123,7 +123,7 @@ struct MockAubCsr : public AUBCommandStreamReceiverHw<GfxFamily> {
expectMemoryCompressedCalled = true;
return AUBCommandStreamReceiverHw<GfxFamily>::expectMemoryCompressed(gfxAddress, srcAddress, length);
}
WaitStatus waitForCompletionWithTimeout(const WaitParams &params, uint32_t taskCountToWait) override {
WaitStatus waitForCompletionWithTimeout(const WaitParams &params, TaskCountType taskCountToWait) override {
return NEO::WaitStatus::Ready;
}
void addAubComment(const char *message) override {

View File

@@ -7,7 +7,7 @@
#include "shared/test/common/mocks/mock_command_stream_receiver.h"
volatile uint32_t MockCommandStreamReceiver::mockTagAddress[MockCommandStreamReceiver::tagSize];
volatile TagAddressType MockCommandStreamReceiver::mockTagAddress[MockCommandStreamReceiver::tagSize];
SubmissionStatus MockCommandStreamReceiver::flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) {
return SubmissionStatus::SUCCESS;
@@ -19,7 +19,7 @@ CompletionStamp MockCommandStreamReceiver::flushTask(
const IndirectHeap *dsh,
const IndirectHeap *ioh,
const IndirectHeap *ssh,
uint32_t taskLevel,
TaskCountType taskLevel,
DispatchFlags &dispatchFlags,
Device &device) {
++taskCount;

View File

@@ -50,10 +50,10 @@ class MockCommandStreamReceiver : public CommandStreamReceiver {
MockCommandStreamReceiver(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex, const DeviceBitfield deviceBitfield)
: CommandStreamReceiver(executionEnvironment, rootDeviceIndex, deviceBitfield) {
CommandStreamReceiver::tagAddress = &mockTagAddress[0];
memset(const_cast<uint32_t *>(CommandStreamReceiver::tagAddress), 0xFFFFFFFF, tagSize * sizeof(uint32_t));
memset(const_cast<TagAddressType *>(CommandStreamReceiver::tagAddress), 0xFFFFFFFF, tagSize * sizeof(TagAddressType));
}
WaitStatus waitForCompletionWithTimeout(const WaitParams &params, uint32_t taskCountToWait) override {
WaitStatus waitForCompletionWithTimeout(const WaitParams &params, TaskCountType taskCountToWait) override {
waitForCompletionWithTimeoutCalled++;
return waitForCompletionWithTimeoutReturnValue;
}
@@ -80,7 +80,7 @@ class MockCommandStreamReceiver : public CommandStreamReceiver {
}
}
bool testTaskCountReady(volatile uint32_t *pollAddress, uint32_t taskCountToWait) override {
bool testTaskCountReady(volatile TagAddressType *pollAddress, TaskCountType taskCountToWait) override {
if (testTaskCountReadyReturnValue.has_value()) {
return *testTaskCountReadyReturnValue;
} else {
@@ -100,7 +100,7 @@ class MockCommandStreamReceiver : public CommandStreamReceiver {
const IndirectHeap *dsh,
const IndirectHeap *ioh,
const IndirectHeap *ssh,
uint32_t taskLevel,
TaskCountType taskLevel,
DispatchFlags &dispatchFlags,
Device &device) override;
@@ -111,15 +111,15 @@ class MockCommandStreamReceiver : public CommandStreamReceiver {
return true;
}
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool quickKmdSleep, QueueThrottle throttle) override {
WaitStatus waitForTaskCountWithKmdNotifyFallback(TaskCountType taskCountToWait, FlushStamp flushStampToWait, bool quickKmdSleep, QueueThrottle throttle) override {
return WaitStatus::Ready;
}
WaitStatus waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool quickKmdSleep, bool forcePowerSavingMode) {
WaitStatus waitForTaskCountWithKmdNotifyFallback(TaskCountType taskCountToWait, FlushStamp flushStampToWait, bool quickKmdSleep, bool forcePowerSavingMode) {
return WaitStatus::Ready;
}
uint32_t flushBcsTask(const BlitPropertiesContainer &blitPropertiesContainer, bool blocking, bool profilingEnabled, Device &device) override { return taskCount; };
TaskCountType flushBcsTask(const BlitPropertiesContainer &blitPropertiesContainer, bool blocking, bool profilingEnabled, Device &device) override { return taskCount; };
CommandStreamReceiverType getType() override {
return commandStreamReceiverType;
@@ -176,7 +176,7 @@ class MockCommandStreamReceiver : public CommandStreamReceiver {
SubmissionStatus initializeDeviceWithFirstSubmission() override { return SubmissionStatus::SUCCESS; }
static constexpr size_t tagSize = 256;
static volatile uint32_t mockTagAddress[tagSize];
static volatile TagAddressType mockTagAddress[tagSize];
std::vector<char> instructionHeapReserveredData;
int *flushBatchedSubmissionsCallCounter = nullptr;
uint32_t waitForCompletionWithTimeoutCalled = 0;
@@ -286,7 +286,7 @@ class MockCsrHw2 : public CommandStreamReceiverHw<GfxFamily> {
CompletionStamp flushTask(LinearStream &commandStream, size_t commandStreamStart,
const IndirectHeap *dsh, const IndirectHeap *ioh,
const IndirectHeap *ssh, uint32_t taskLevel, DispatchFlags &dispatchFlags, Device &device) override {
const IndirectHeap *ssh, TaskCountType taskLevel, DispatchFlags &dispatchFlags, Device &device) override {
passedDispatchFlags = dispatchFlags;
recordedCommandBuffer = std::unique_ptr<CommandBuffer>(new CommandBuffer(device));
@@ -306,7 +306,7 @@ class MockCsrHw2 : public CommandStreamReceiverHw<GfxFamily> {
return completionStamp;
}
uint32_t flushBcsTask(const BlitPropertiesContainer &blitPropertiesContainer, bool blocking, bool profilingEnabled, Device &device) override {
TaskCountType flushBcsTask(const BlitPropertiesContainer &blitPropertiesContainer, bool blocking, bool profilingEnabled, Device &device) override {
if (!skipBlitCalls) {
return CommandStreamReceiverHw<GfxFamily>::flushBcsTask(blitPropertiesContainer, blocking, profilingEnabled, device);
}

View File

@@ -117,7 +117,7 @@ class MockCsr : public MockCsrBase<GfxFamily> {
const IndirectHeap *dsh,
const IndirectHeap *ioh,
const IndirectHeap *ssh,
uint32_t taskLevel,
TaskCountType taskLevel,
DispatchFlags &dispatchFlags,
Device &device) override {
this->flushTaskStamp = *this->executionStamp;
@@ -140,7 +140,7 @@ class MockCsr : public MockCsrBase<GfxFamily> {
bool peekMediaVfeStateDirty() const { return mediaVfeStateDirty; }
bool slmUsedInLastFlushTask = false;
uint32_t lastTaskLevelToFlushTask = 0;
TaskCountType lastTaskLevelToFlushTask = 0;
};
template <typename GfxFamily>

View File

@@ -54,11 +54,11 @@ class MockGraphicsAllocation : public MemoryAllocation {
class MockGraphicsAllocationTaskCount : public MockGraphicsAllocation {
public:
uint32_t getTaskCount(uint32_t contextId) const override {
TaskCountType getTaskCount(uint32_t contextId) const override {
getTaskCountCalleedTimes++;
return MockGraphicsAllocation::getTaskCount(contextId);
}
void updateTaskCount(uint32_t newTaskCount, uint32_t contextId) override {
void updateTaskCount(TaskCountType newTaskCount, uint32_t contextId) override {
updateTaskCountCalleedTimes++;
MockGraphicsAllocation::updateTaskCount(newTaskCount, contextId);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -13,7 +13,7 @@ namespace NEO {
class MockInternalAllocationStorage : public InternalAllocationStorage {
public:
using InternalAllocationStorage::InternalAllocationStorage;
void cleanAllocationList(uint32_t waitTaskCount, uint32_t allocationUsage) override {
void cleanAllocationList(TaskCountType waitTaskCount, uint32_t allocationUsage) override {
cleanAllocationsCalled++;
lastCleanAllocationsTaskCount = waitTaskCount;
lastCleanAllocationUsage = allocationUsage;
@@ -23,14 +23,14 @@ class MockInternalAllocationStorage : public InternalAllocationStorage {
doUpdateCompletion = false;
}
}
void updateCompletionAfterCleaningList(uint32_t newValue) {
void updateCompletionAfterCleaningList(TaskCountType newValue) {
doUpdateCompletion = true;
valueToUpdateCompletion = newValue;
}
bool doUpdateCompletion = false;
uint32_t valueToUpdateCompletion;
TaskCountType valueToUpdateCompletion;
uint32_t lastCleanAllocationUsage = 0;
uint32_t lastCleanAllocationsTaskCount = 0;
TaskCountType lastCleanAllocationsTaskCount = 0;
uint32_t cleanAllocationsCalled = 0;
};
} // namespace NEO

View File

@@ -21,7 +21,7 @@ struct MockMigrationSyncData : public MigrationSyncData {
using MigrationSyncData::latestTaskCountUsed;
using MigrationSyncData::MigrationSyncData;
using MigrationSyncData::tagAddress;
void signalUsage(volatile uint32_t *tagAddress, uint32_t taskCount) override {
void signalUsage(volatile TagAddressType *tagAddress, TaskCountType taskCount) override {
signalUsageCalled++;
MigrationSyncData::signalUsage(tagAddress, taskCount);
}

View File

@@ -91,7 +91,7 @@ struct MockTbxCsrRegisterDownloadedAllocations : TbxCommandStreamReceiverHw<GfxF
this->downloadAllocationImpl = nullptr;
}
void downloadAllocationTbxMock(GraphicsAllocation &gfxAllocation) {
*reinterpret_cast<uint32_t *>(CommandStreamReceiver::getTagAllocation()->getUnderlyingBuffer()) = this->latestFlushedTaskCount;
*reinterpret_cast<TaskCountType *>(CommandStreamReceiver::getTagAllocation()->getUnderlyingBuffer()) = this->latestFlushedTaskCount;
downloadedAllocations.insert(&gfxAllocation);
}
bool flushBatchedSubmissions() override {

View File

@@ -40,7 +40,7 @@ class TestedBufferObject : public BufferObject {
}
int exec(uint32_t used, size_t startOffset, unsigned int flags, bool requiresCoherency, OsContext *osContext, uint32_t vmHandleId, uint32_t drmContextId,
BufferObject *const residency[], size_t residencyCount, ExecObject *execObjectsStorage, uint64_t completionGpuAddress, uint32_t completionValue) override {
BufferObject *const residency[], size_t residencyCount, ExecObject *execObjectsStorage, uint64_t completionGpuAddress, TaskCountType completionValue) override {
this->receivedCompletionGpuAddress = completionGpuAddress;
this->receivedCompletionValue = completionValue;
this->execCalled++;
@@ -61,7 +61,7 @@ class TestedBufferObject : public BufferObject {
uint64_t receivedCompletionGpuAddress = 0;
ExecObject *execObjectPointerFilled = nullptr;
uint32_t receivedCompletionValue = 0;
TaskCountType receivedCompletionValue = 0;
uint32_t execCalled = 0;
bool callBaseEvictUnusedAllocations{true};
};

View File

@@ -7,6 +7,7 @@
#include "shared/source/utilities/cpuintrinsics.h"
#include "shared/source/command_stream/task_count_helper.h"
#include "shared/source/helpers/ptr_math.h"
#include <atomic>
@@ -14,14 +15,14 @@
#include <functional>
namespace CpuIntrinsicsTests {
//std::atomic is used for sake of sanitation in MT tests
// std::atomic is used for sake of sanitation in MT tests
std::atomic<uintptr_t> lastClFlushedPtr(0u);
std::atomic<uint32_t> clFlushCounter(0u);
std::atomic<uint32_t> pauseCounter(0u);
std::atomic<uint32_t> sfenceCounter(0u);
volatile uint32_t *pauseAddress = nullptr;
uint32_t pauseValue = 0u;
volatile TagAddressType *pauseAddress = nullptr;
TaskCountType pauseValue = 0u;
uint32_t pauseOffset = 0u;
std::function<void()> setupPauseAddress;

View File

@@ -78,7 +78,7 @@ TEST_F(CommandStreamReceiverTest, givenOsAgnosticCsrWhenGettingCompletionValueTh
}
TEST_F(CommandStreamReceiverTest, givenOsAgnosticCsrWhenGettingCompletionAddressThenProperAddressIsReturned) {
auto expectedAddress = castToUint64(const_cast<uint32_t *>(commandStreamReceiver->getTagAddress()));
auto expectedAddress = castToUint64(const_cast<TagAddressType *>(commandStreamReceiver->getTagAddress()));
EXPECT_EQ(expectedAddress, commandStreamReceiver->getCompletionAddress());
}
@@ -186,7 +186,7 @@ TEST_F(CommandStreamReceiverTest, givenBaseDownloadAllocationCalledThenDoesNotCh
}
TEST_F(CommandStreamReceiverTest, WhenCommandStreamReceiverIsCreatedThenItHasATagValue) {
EXPECT_NE(nullptr, const_cast<uint32_t *>(commandStreamReceiver->getTagAddress()));
EXPECT_NE(nullptr, const_cast<TagAddressType *>(commandStreamReceiver->getTagAddress()));
}
TEST_F(CommandStreamReceiverTest, WhenGettingCommandStreamerThenValidPointerIsReturned) {
@@ -275,7 +275,7 @@ HWTEST_F(CommandStreamReceiverTest, givenGpuHangWhenWaititingForCompletionWithTi
csr.activePartitions = 1;
csr.gpuHangCheckPeriod = 0us;
volatile std::uint32_t tasksCount[16] = {};
volatile TagAddressType tasksCount[16] = {};
csr.tagAddress = tasksCount;
constexpr auto enableTimeout = false;
@@ -290,7 +290,7 @@ HWTEST_F(CommandStreamReceiverTest, givenNoGpuHangWhenWaititingForCompletionWith
auto driverModelMock = std::make_unique<MockDriverModel>();
driverModelMock->isGpuHangDetectedToReturn = false;
volatile std::uint32_t tasksCount[16] = {};
volatile TagAddressType tasksCount[16] = {};
driverModelMock->isGpuHangDetectedSideEffect = [&tasksCount] {
tasksCount[0]++;
};
@@ -367,7 +367,7 @@ HWTEST_F(CommandStreamReceiverTest, givenGpuHangWhenWaititingForTaskCountThenGpu
csr.activePartitions = 1;
csr.gpuHangCheckPeriod = 0us;
volatile std::uint32_t tasksCount[16] = {};
volatile TagAddressType tasksCount[16] = {};
csr.tagAddress = tasksCount;
constexpr auto taskCountToWait = 1;
@@ -413,8 +413,8 @@ HWTEST_F(CommandStreamReceiverTest, givenGpuHangAndNonEmptyAllocationsListWhenCa
csr.activePartitions = 1;
csr.gpuHangCheckPeriod = 0us;
volatile std::uint32_t tasksCount[16] = {};
VariableBackup<volatile std::uint32_t *> csrTagAddressBackup(&csr.tagAddress);
volatile TagAddressType tasksCount[16] = {};
VariableBackup<volatile TagAddressType *> csrTagAddressBackup(&csr.tagAddress);
csr.tagAddress = tasksCount;
auto hostPtr = reinterpret_cast<void *>(0x1234);
@@ -1473,8 +1473,8 @@ TEST(CommandStreamReceiverSimpleTest, givenGpuNotIdleImplicitFlushCheckEnabledWh
namespace CpuIntrinsicsTests {
extern std::atomic<uint32_t> pauseCounter;
extern volatile uint32_t *pauseAddress;
extern uint32_t pauseValue;
extern volatile TagAddressType *pauseAddress;
extern TaskCountType pauseValue;
extern uint32_t pauseOffset;
} // namespace CpuIntrinsicsTests
@@ -1505,8 +1505,8 @@ TEST(CommandStreamReceiverSimpleTest, givenMultipleActivePartitionsWhenWaitingFo
csr.taskCount = 3u;
csr.activePartitions = 2;
VariableBackup<volatile uint32_t *> backupPauseAddress(&CpuIntrinsicsTests::pauseAddress);
VariableBackup<uint32_t> backupPauseValue(&CpuIntrinsicsTests::pauseValue);
VariableBackup<volatile TagAddressType *> backupPauseAddress(&CpuIntrinsicsTests::pauseAddress);
VariableBackup<TaskCountType> backupPauseValue(&CpuIntrinsicsTests::pauseValue);
VariableBackup<uint32_t> backupPauseOffset(&CpuIntrinsicsTests::pauseOffset);
CpuIntrinsicsTests::pauseAddress = &csr.mockTagAddress[0];
@@ -1532,8 +1532,8 @@ TEST(CommandStreamReceiverSimpleTest, givenEmptyTemporaryAllocationListWhenWaiti
csr.mockTagAddress[0] = 0u;
csr.taskCount = 3u;
VariableBackup<volatile uint32_t *> backupPauseAddress(&CpuIntrinsicsTests::pauseAddress);
VariableBackup<uint32_t> backupPauseValue(&CpuIntrinsicsTests::pauseValue);
VariableBackup<volatile TagAddressType *> backupPauseAddress(&CpuIntrinsicsTests::pauseAddress);
VariableBackup<TaskCountType> backupPauseValue(&CpuIntrinsicsTests::pauseValue);
VariableBackup<uint32_t> backupPauseOffset(&CpuIntrinsicsTests::pauseOffset);
CpuIntrinsicsTests::pauseAddress = &csr.mockTagAddress[0];
@@ -2145,15 +2145,15 @@ HWTEST_F(CommandStreamReceiverTest, givenMultipleActivePartitionsWhenWaitLogIsEn
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
csr.activePartitions = 2;
volatile uint32_t *tagAddress = csr.tagAddress;
constexpr uint32_t tagValue = 2;
volatile TagAddressType *tagAddress = csr.tagAddress;
constexpr TagAddressType tagValue = 2;
*tagAddress = tagValue;
tagAddress = ptrOffset(tagAddress, csr.postSyncWriteOffset);
*tagAddress = tagValue;
WaitParams waitParams;
waitParams.waitTimeout = std::numeric_limits<int64_t>::max();
constexpr uint32_t taskCount = 1;
constexpr TaskCountType taskCount = 1;
testing::internal::CaptureStdout();
@@ -2166,7 +2166,7 @@ HWTEST_F(CommandStreamReceiverTest, givenMultipleActivePartitionsWhenWaitLogIsEn
expectedOutput << std::endl
<< "Waiting for task count " << taskCount
<< " at location " << const_cast<uint32_t *>(csr.tagAddress)
<< " at location " << const_cast<TagAddressType *>(csr.tagAddress)
<< " with timeout " << std::hex << waitParams.waitTimeout
<< ". Current value: " << std::dec << tagValue
<< " " << tagValue
@@ -2298,7 +2298,7 @@ struct MockRequiredScratchSpaceController : public ScratchSpaceControllerBase {
uint32_t scratchSlot,
uint32_t requiredPerThreadScratchSize,
uint32_t requiredPerThreadPrivateScratchSize,
uint32_t currentTaskCount,
TaskCountType currentTaskCount,
OsContext &osContext,
bool &stateBaseAddressDirty,
bool &vfeStateDirty) override {

View File

@@ -56,7 +56,7 @@ struct DeferrableAllocationDeletionTest : ::testing::Test {
MockMemoryManager *memoryManager = nullptr;
std::unique_ptr<MockDevice> device;
uint32_t defaultOsContextId = 0;
volatile uint32_t *hwTag = nullptr;
volatile TagAddressType *hwTag = nullptr;
};
TEST_F(DeferrableAllocationDeletionTest, givenDeferrableAllocationWhenApplyThenWaitForEachTaskCount) {

View File

@@ -876,7 +876,7 @@ TEST_F(HostPtrAllocationTest, whenOverlappedFragmentIsBiggerThenStoredAndStoredF
auto fragment2 = hostPtrManager->getFragment({alignUp(cpuPtr1, MemoryConstants::pageSize), csr->getRootDeviceIndex()});
EXPECT_NE(nullptr, fragment2);
uint32_t taskCountReady = 2;
TaskCountType taskCountReady = 2;
auto storage = new MockInternalAllocationStorage(*csr);
csr->internalAllocationStorage.reset(storage);
storage->storeAllocationWithTaskCount(std::unique_ptr<GraphicsAllocation>(graphicsAllocation1), TEMPORARY_ALLOCATION, taskCountReady);
@@ -901,16 +901,16 @@ TEST_F(HostPtrAllocationTest, whenOverlappedFragmentIsBiggerThenStoredAndStoredF
}
HWTEST_F(HostPtrAllocationTest, givenOverlappingFragmentsWhenCheckIsCalledThenWaitAndCleanOnAllEngines) {
uint32_t taskCountReady = 2;
uint32_t taskCountNotReady = 1;
TaskCountType taskCountReady = 2;
TaskCountType taskCountNotReady = 1;
auto &engines = memoryManager->getRegisteredEngines();
EXPECT_EQ(1u, engines.size());
auto csr0 = static_cast<MockCommandStreamReceiver *>(engines[0].commandStreamReceiver);
auto csr1 = std::make_unique<MockCommandStreamReceiver>(executionEnvironment, 0, 1);
uint32_t csr0GpuTag = taskCountNotReady;
uint32_t csr1GpuTag = taskCountNotReady;
TaskCountType csr0GpuTag = taskCountNotReady;
TaskCountType csr1GpuTag = taskCountNotReady;
csr0->tagAddress = &csr0GpuTag;
csr1->tagAddress = &csr1GpuTag;
auto osContext = memoryManager->createAndRegisterOsContext(csr1.get(), EngineDescriptorHelper::getDefaultDescriptor({aub_stream::EngineType::ENGINE_RCS, EngineUsage::LowPriority}));
@@ -969,7 +969,7 @@ TEST_F(HostPtrAllocationTest, whenOverlappedFragmentIsBiggerThenStoredAndStoredF
auto fragment2 = hostPtrManager->getFragment({alignUp(cpuPtr1, MemoryConstants::pageSize), csr->getRootDeviceIndex()});
EXPECT_NE(nullptr, fragment2);
uint32_t taskCountReady = 2;
TaskCountType taskCountReady = 2;
auto storage = csr->getInternalAllocationStorage();
storage->storeAllocationWithTaskCount(std::unique_ptr<GraphicsAllocation>(graphicsAllocation1), TEMPORARY_ALLOCATION, taskCountReady);
@@ -1052,7 +1052,7 @@ TEST_F(HostPtrAllocationTest, GivenAllocationsWithBiggerOverlapWhenChckingForOve
auto fragment2 = hostPtrManager->getFragment({alignUp(cpuPtr1, MemoryConstants::pageSize), csr->getRootDeviceIndex()});
EXPECT_NE(nullptr, fragment2);
uint32_t taskCountReady = 1;
TaskCountType taskCountReady = 1;
auto storage = csr->getInternalAllocationStorage();
storage->storeAllocationWithTaskCount(std::unique_ptr<GraphicsAllocation>(graphicsAllocation1), TEMPORARY_ALLOCATION, taskCountReady);

View File

@@ -288,7 +288,7 @@ TEST_F(MigrationSyncDataTests, whenSetTargetLocationIsCalledThenProperLocationIs
TEST(MigrationSyncDataTest, whenWaitOnCpuIsCalledThenWaitForValueSpecifiedInSignalUsageMethod) {
auto migrationSyncData = std::make_unique<MockMigrationSyncDataWithYield>(MemoryConstants::pageSize);
uint32_t tagAddress = 0;
TagAddressType tagAddress = 0;
migrationSyncData->signalUsage(&tagAddress, 2u);
migrationSyncData->waitOnCpu();
@@ -297,7 +297,7 @@ TEST(MigrationSyncDataTest, whenWaitOnCpuIsCalledThenWaitForValueSpecifiedInSign
TEST(MigrationSyncDataTest, whenTaskCountIsHigherThanExpectedThenWaitOnCpuDoesntHang) {
auto migrationSyncData = std::make_unique<MockMigrationSyncData>(MemoryConstants::pageSize);
uint32_t tagAddress = 5u;
TagAddressType tagAddress = 5u;
migrationSyncData->signalUsage(&tagAddress, 2u);
EXPECT_EQ(&tagAddress, migrationSyncData->tagAddress);

View File

@@ -62,7 +62,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenEnabledDirectSubmissionWhenGetting
HWTEST_TEMPLATED_F(DrmCommandStreamTest, whenGettingCompletionAddressThenOffsettedTagAddressIsReturned) {
csr->initializeTagAllocation();
EXPECT_NE(nullptr, csr->getTagAddress());
uint64_t tagAddress = castToUint64(const_cast<uint32_t *>(csr->getTagAddress()));
uint64_t tagAddress = castToUint64(const_cast<TagAddressType *>(csr->getTagAddress()));
auto expectedAddress = tagAddress + Drm::completionFenceOffset;
EXPECT_EQ(expectedAddress, csr->getCompletionAddress());
}

View File

@@ -746,7 +746,7 @@ struct MockDrmDirectSubmissionToTestDtor : public DrmDirectSubmission<GfxFamily,
functionsCalled.stopRingBuffer = true;
return true;
}
void wait(uint32_t taskCountToWait) override {
void wait(TaskCountType taskCountToWait) override {
functionsCalled.wait = true;
}
void deallocateResources() override {

View File

@@ -142,7 +142,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTestDrmPrelim, givenWaitUserFenceEnab
testDrmCsr->useContextForUserFenceWait = true;
testDrmCsr->activePartitions = static_cast<uint32_t>(drmCtxSize);
uint64_t tagAddress = castToUint64(const_cast<uint32_t *>(testDrmCsr->getTagAddress()));
uint64_t tagAddress = castToUint64(const_cast<TagAddressType *>(testDrmCsr->getTagAddress()));
FlushStamp handleToWait = 123;
testDrmCsr->waitForFlushStamp(handleToWait);
@@ -155,7 +155,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTestDrmPrelim, givenWaitUserFenceEnab
EXPECT_NE(0u, mock->context.receivedGemWaitUserFence.ctxId);
EXPECT_EQ(DrmPrelimHelper::getGTEWaitUserFenceFlag(), mock->context.receivedGemWaitUserFence.op);
EXPECT_EQ(0u, mock->context.receivedGemWaitUserFence.flags);
EXPECT_EQ(DrmPrelimHelper::getU32WaitUserFenceFlag(), mock->context.receivedGemWaitUserFence.mask);
EXPECT_EQ(DrmPrelimHelper::getU64WaitUserFenceFlag(), mock->context.receivedGemWaitUserFence.mask);
EXPECT_EQ(-1, mock->context.receivedGemWaitUserFence.timeout);
}
@@ -175,7 +175,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTestDrmPrelim, givenWaitUserFenceEnab
testDrmCsr->useUserFenceWait = true;
testDrmCsr->useContextForUserFenceWait = false;
uint64_t tagAddress = castToUint64(const_cast<uint32_t *>(testDrmCsr->getTagAddress()));
uint64_t tagAddress = castToUint64(const_cast<TaskCountType *>(testDrmCsr->getTagAddress()));
FlushStamp handleToWait = 123;
testDrmCsr->waitForFlushStamp(handleToWait);
@@ -188,7 +188,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTestDrmPrelim, givenWaitUserFenceEnab
EXPECT_EQ(0u, mock->context.receivedGemWaitUserFence.ctxId);
EXPECT_EQ(DrmPrelimHelper::getGTEWaitUserFenceFlag(), mock->context.receivedGemWaitUserFence.op);
EXPECT_EQ(0u, mock->context.receivedGemWaitUserFence.flags);
EXPECT_EQ(DrmPrelimHelper::getU32WaitUserFenceFlag(), mock->context.receivedGemWaitUserFence.mask);
EXPECT_EQ(DrmPrelimHelper::getU64WaitUserFenceFlag(), mock->context.receivedGemWaitUserFence.mask);
EXPECT_EQ(-1, mock->context.receivedGemWaitUserFence.timeout);
}
@@ -210,7 +210,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTestDrmPrelim, givenWaitUserFenceEnab
testDrmCsr->activePartitions = 2u;
EXPECT_NE(0u, testDrmCsr->postSyncWriteOffset);
uint64_t tagAddress = castToUint64(const_cast<uint32_t *>(testDrmCsr->getTagAddress()));
uint64_t tagAddress = castToUint64(const_cast<TagAddressType *>(testDrmCsr->getTagAddress()));
FlushStamp handleToWait = 123;
testDrmCsr->waitForFlushStamp(handleToWait);
@@ -223,7 +223,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTestDrmPrelim, givenWaitUserFenceEnab
EXPECT_EQ(0u, mock->context.receivedGemWaitUserFence.ctxId);
EXPECT_EQ(DrmPrelimHelper::getGTEWaitUserFenceFlag(), mock->context.receivedGemWaitUserFence.op);
EXPECT_EQ(0u, mock->context.receivedGemWaitUserFence.flags);
EXPECT_EQ(DrmPrelimHelper::getU32WaitUserFenceFlag(), mock->context.receivedGemWaitUserFence.mask);
EXPECT_EQ(DrmPrelimHelper::getU64WaitUserFenceFlag(), mock->context.receivedGemWaitUserFence.mask);
EXPECT_EQ(-1, mock->context.receivedGemWaitUserFence.timeout);
}

View File

@@ -126,15 +126,15 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmCommandStreamMultiTileMemExecTest, GivenDrmSuppo
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{0, 1024, AllocationType::COMMAND_BUFFER});
allocation->updateTaskCount(2, defaultEngine.osContext->getContextId());
volatile uint32_t *completionAddress = defaultEngine.commandStreamReceiver->getTagAddress();
completionAddress += (Drm::completionFenceOffset / sizeof(uint32_t));
volatile TagAddressType *completionAddress = defaultEngine.commandStreamReceiver->getTagAddress();
completionAddress += (Drm::completionFenceOffset / sizeof(TagAddressType));
*completionAddress = 1;
completionAddress += (postSyncOffset / sizeof(uint32_t));
completionAddress += (postSyncOffset / sizeof(TagAddressType));
*completionAddress = 1;
memoryManager->handleFenceCompletion(allocation);
uint64_t expectedAddress = castToUint64(const_cast<uint32_t *>(defaultEngine.commandStreamReceiver->getTagAddress())) +
uint64_t expectedAddress = castToUint64(const_cast<TagAddressType *>(defaultEngine.commandStreamReceiver->getTagAddress())) +
Drm::completionFenceOffset +
postSyncOffset;
constexpr uint64_t expectedValue = 2;
@@ -160,15 +160,15 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmCommandStreamMultiTileMemExecTest, GivenDrmSuppo
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{0, 1024, AllocationType::COMMAND_BUFFER});
allocation->updateTaskCount(2, defaultEngine.osContext->getContextId());
volatile uint32_t *completionAddress = defaultEngine.commandStreamReceiver->getTagAddress();
completionAddress += (Drm::completionFenceOffset / sizeof(uint32_t));
volatile TagAddressType *completionAddress = defaultEngine.commandStreamReceiver->getTagAddress();
completionAddress += (Drm::completionFenceOffset / sizeof(TagAddressType));
*completionAddress = 2; //1st context is ready
completionAddress += (postSyncOffset / sizeof(uint32_t));
completionAddress += (postSyncOffset / sizeof(TagAddressType));
*completionAddress = 1;
memoryManager->handleFenceCompletion(allocation);
uint64_t expectedAddress = castToUint64(const_cast<uint32_t *>(defaultEngine.commandStreamReceiver->getTagAddress())) +
uint64_t expectedAddress = castToUint64(const_cast<TagAddressType *>(defaultEngine.commandStreamReceiver->getTagAddress())) +
Drm::completionFenceOffset +
postSyncOffset;
constexpr uint64_t expectedValue = 2;

View File

@@ -5367,7 +5367,7 @@ TEST_F(DrmMemoryManagerTest, givenCompletionFenceEnabledWhenHandlingCompletionOf
auto engine = memoryManager->getRegisteredEngines()[0];
allocation->updateTaskCount(2, engine.osContext->getContextId());
uint64_t expectedFenceAddress = castToUint64(const_cast<uint32_t *>(engine.commandStreamReceiver->getTagAddress())) + Drm::completionFenceOffset;
uint64_t expectedFenceAddress = castToUint64(const_cast<TagAddressType *>(engine.commandStreamReceiver->getTagAddress())) + Drm::completionFenceOffset;
constexpr uint64_t expectedValue = 2;
memoryManager->handleFenceCompletion(allocation);

View File

@@ -22,7 +22,7 @@ class MockScratchSpaceControllerBase : public ScratchSpaceControllerBase {
uint32_t offset,
uint32_t requiredPerThreadScratchSize,
uint32_t requiredPerThreadPrivateScratchSize,
uint32_t currentTaskCount,
TaskCountType currentTaskCount,
OsContext &osContext,
bool &stateBaseAddressDirty,
bool &vfeStateDirty) override {
@@ -32,7 +32,7 @@ class MockScratchSpaceControllerBase : public ScratchSpaceControllerBase {
void programBindlessSurfaceStateForScratch(BindlessHeapsHelper *heapsHelper,
uint32_t requiredPerThreadScratchSize,
uint32_t requiredPerThreadPrivateScratchSize,
uint32_t currentTaskCount,
TaskCountType currentTaskCount,
OsContext &osContext,
bool &stateBaseAddressDirty,
bool &vfeStateDirty,

View File

@@ -34,7 +34,7 @@ class MockScratchSpaceControllerXeHPAndLater : public ScratchSpaceControllerXeHP
}
void prepareScratchAllocation(uint32_t requiredPerThreadScratchSize,
uint32_t requiredPerThreadPrivateScratchSize,
uint32_t currentTaskCount,
TaskCountType currentTaskCount,
OsContext &osContext,
bool &stateBaseAddressDirty,
bool &scratchSurfaceDirty,

View File

@@ -50,8 +50,8 @@ TEST(WaitTest, givenDefaultSettingsWhenPollAddressProvidedDoesNotMeetCriteriaThe
WaitUtils::init();
EXPECT_EQ(WaitUtils::defaultWaitCount, WaitUtils::waitCount);
volatile uint32_t pollValue = 1u;
uint32_t expectedValue = 3;
volatile TagAddressType pollValue = 1u;
TaskCountType expectedValue = 3;
uint32_t oldCount = CpuIntrinsicsTests::pauseCounter.load();
bool ret = WaitUtils::waitFunction(&pollValue, expectedValue);
@@ -63,8 +63,8 @@ TEST(WaitTest, givenDefaultSettingsWhenPollAddressProvidedMeetsCriteriaThenPause
WaitUtils::init();
EXPECT_EQ(WaitUtils::defaultWaitCount, WaitUtils::waitCount);
volatile uint32_t pollValue = 3u;
uint32_t expectedValue = 1;
volatile TagAddressType pollValue = 3u;
TaskCountType expectedValue = 1;
uint32_t oldCount = CpuIntrinsicsTests::pauseCounter.load();
bool ret = WaitUtils::waitFunction(&pollValue, expectedValue);
@@ -82,8 +82,8 @@ TEST(WaitTest, givenDebugFlagSetZeroWhenPollAddressProvidedMeetsCriteriaThenPaus
WaitUtils::init();
EXPECT_EQ(count, WaitUtils::waitCount);
volatile uint32_t pollValue = 3u;
uint32_t expectedValue = 1;
volatile TagAddressType pollValue = 3u;
TaskCountType expectedValue = 1;
uint32_t oldCount = CpuIntrinsicsTests::pauseCounter.load();
bool ret = WaitUtils::waitFunction(&pollValue, expectedValue);