Skip to content

Commit 7d01074

Browse files
Update aub/tbx stepping handling
For the stepping value use hardware value. Resolves: NEO-5475 Signed-off-by: Filip Hazubski <[email protected]>
1 parent c35f560 commit 7d01074

File tree

18 files changed

+156
-39
lines changed

18 files changed

+156
-39
lines changed

opencl/source/command_stream/aub_command_stream_receiver_hw_base.inl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2020 Intel Corporation
2+
* Copyright (C) 2019-2021 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -146,7 +146,9 @@ void AUBCommandStreamReceiverHw<GfxFamily>::initFile(const std::string &fileName
146146
UNRECOVERABLE_IF(true);
147147
}
148148
// Add the file header
149-
stream->init(AubMemDump::SteppingValues::A, aubDeviceId);
149+
auto &hwInfo = this->peekHwInfo();
150+
auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily);
151+
stream->init(hwHelper.getAubStreamSteppingFromHwRevId(hwInfo), aubDeviceId);
150152
}
151153
}
152154

opencl/source/command_stream/tbx_command_stream_receiver_hw.inl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2020 Intel Corporation
2+
* Copyright (C) 2017-2021 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -160,11 +160,11 @@ CommandStreamReceiver *TbxCommandStreamReceiverHw<GfxFamily>::create(const std::
160160
uint32_t rootDeviceIndex,
161161
const DeviceBitfield deviceBitfield) {
162162
TbxCommandStreamReceiverHw<GfxFamily> *csr;
163+
auto &hwInfo = *(executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo());
164+
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
163165
if (withAubDump) {
164-
auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
165-
auto &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
166-
auto localMemoryEnabled = hwHelper.getEnableLocalMemory(*hwInfo);
167-
auto fullName = AUBCommandStreamReceiver::createFullFilePath(*hwInfo, baseName);
166+
auto localMemoryEnabled = hwHelper.getEnableLocalMemory(hwInfo);
167+
auto fullName = AUBCommandStreamReceiver::createFullFilePath(hwInfo, baseName);
168168
if (DebugManager.flags.AUBDumpCaptureFileName.get() != "unk") {
169169
fullName.assign(DebugManager.flags.AUBDumpCaptureFileName.get());
170170
}
@@ -197,7 +197,7 @@ CommandStreamReceiver *TbxCommandStreamReceiverHw<GfxFamily>::create(const std::
197197
csr->stream->open(nullptr);
198198

199199
// Add the file header.
200-
bool streamInitialized = csr->stream->init(AubMemDump::SteppingValues::A, csr->aubDeviceId);
200+
bool streamInitialized = csr->stream->init(hwHelper.getAubStreamSteppingFromHwRevId(hwInfo), csr->aubDeviceId);
201201
csr->streamInitialized = streamInitialized;
202202
}
203203
return csr;

opencl/test/unit_test/aub/aub_center_tests.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77

88
#include "shared/source/debug_settings/debug_settings_manager.h"
99
#include "shared/source/helpers/basic_math.h"
10+
#include "shared/source/helpers/hw_helper.h"
1011
#include "shared/source/helpers/hw_info.h"
1112
#include "shared/test/common/helpers/debug_manager_state_restore.h"
1213
#include "shared/test/common/helpers/default_hw_info.h"
1314

15+
#include "opencl/test/unit_test/helpers/hw_helper_tests.h"
1416
#include "opencl/test/unit_test/mocks/mock_aub_center.h"
1517
#include "opencl/test/unit_test/mocks/mock_aub_manager.h"
1618

@@ -74,6 +76,24 @@ TEST(AubCenter, GivenCsrHwAndNotEmptyAubFileNameWhenGettingAubStreamModeThenMode
7476
EXPECT_EQ(aub_stream::mode::aubFile, mode);
7577
}
7678

79+
TEST(AubCenter, WhenAubManagerIsCreatedThenCorrectSteppingIsSet) {
80+
DebugManagerStateRestore restorer;
81+
DebugManager.flags.UseAubStream.set(true);
82+
83+
auto hwInfo = *defaultHwInfo;
84+
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
85+
for (auto steppingPair : steppingPairsToTest) {
86+
auto hwRevId = hwHelper.getHwRevIdFromStepping(steppingPair.stepping, hwInfo);
87+
if (hwRevId == CommonConstants::invalidStepping) {
88+
continue;
89+
}
90+
91+
hwInfo.platform.usRevId = hwRevId;
92+
MockAubCenter aubCenter(&hwInfo, false, "", CommandStreamReceiverType::CSR_AUB);
93+
EXPECT_EQ(steppingPair.aubStreamStepping, aubCenter.stepping);
94+
}
95+
}
96+
7797
TEST(AubCenter, GivenCsrTypeWhenGettingAubStreamModeThenCorrectModeIsReturned) {
7898
DebugManagerStateRestore restorer;
7999
DebugManager.flags.UseAubStream.set(true);

opencl/test/unit_test/aub_tests/command_stream/aub_mem_dump_tests.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2020 Intel Corporation
2+
* Copyright (C) 2017-2021 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -40,8 +40,10 @@ void setupAUB(const NEO::Device *pDevice, aub_stream::EngineType engineType) {
4040
aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary);
4141

4242
// Header
43-
auto deviceId = pDevice->getHardwareInfo().capabilityTable.aubDeviceId;
44-
aubFile.init(AubMemDump::SteppingValues::A, deviceId);
43+
auto &hwInfo = pDevice->getHardwareInfo();
44+
auto deviceId = hwInfo.capabilityTable.aubDeviceId;
45+
auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily);
46+
aubFile.init(hwHelper.getAubStreamSteppingFromHwRevId(hwInfo), deviceId);
4547

4648
aubFile.writeMMIO(mmioBase + 0x229c, 0xffff8280);
4749

opencl/test/unit_test/aub_tests/gen11/batch_buffer/aub_batch_buffer_tests_gen11.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018-2020 Intel Corporation
2+
* Copyright (C) 2018-2021 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -29,7 +29,9 @@ void setupAUBWithBatchBuffer(const NEO::Device *pDevice, aub_stream::EngineType
2929
aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary);
3030

3131
// Header
32-
aubFile.init(AubMemDump::SteppingValues::A, AUB::Traits::device);
32+
auto &hwInfo = pDevice->getHardwareInfo();
33+
auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily);
34+
aubFile.init(hwHelper.getAubStreamSteppingFromHwRevId(hwInfo), AUB::Traits::device);
3335

3436
aubFile.writeMMIO(AubMemDump::computeRegisterOffset(mmioBase, 0x229c), 0xffff8280);
3537

opencl/test/unit_test/aub_tests/gen12lp/batch_buffer/aub_batch_buffer_tests_gen12lp.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2020 Intel Corporation
2+
* Copyright (C) 2019-2021 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -29,7 +29,9 @@ void setupAUBWithBatchBuffer(const NEO::Device *pDevice, aub_stream::EngineType
2929
aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary);
3030

3131
// Header
32-
aubFile.init(AubMemDump::SteppingValues::A, AUB::Traits::device);
32+
auto &hwInfo = pDevice->getHardwareInfo();
33+
auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily);
34+
aubFile.init(hwHelper.getAubStreamSteppingFromHwRevId(hwInfo), AUB::Traits::device);
3335

3436
aubFile.writeMMIO(AubMemDump::computeRegisterOffset(mmioBase, 0x229c), 0xffff8280);
3537

opencl/test/unit_test/aub_tests/gen9/batch_buffer/aub_batch_buffer_tests.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/*
2-
* Copyright (C) 2018-2020 Intel Corporation
2+
* Copyright (C) 2018-2021 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
66
*/
77

88
#pragma once
99
#include "shared/source/aub/aub_helper.h"
10+
#include "shared/source/helpers/hw_helper.h"
1011

1112
#include "opencl/test/unit_test/aub_tests/command_stream/aub_mem_dump_tests.h"
1213

@@ -29,8 +30,10 @@ void setupAUBWithBatchBuffer(const NEO::Device *pDevice, aub_stream::EngineType
2930
aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary);
3031

3132
// Header
32-
auto deviceId = pDevice->getHardwareInfo().capabilityTable.aubDeviceId;
33-
aubFile.init(AubMemDump::SteppingValues::A, deviceId);
33+
auto &hwInfo = pDevice->getHardwareInfo();
34+
auto deviceId = hwInfo.capabilityTable.aubDeviceId;
35+
auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily);
36+
aubFile.init(hwHelper.getAubStreamSteppingFromHwRevId(hwInfo), deviceId);
3437

3538
aubFile.writeMMIO(AubMemDump::computeRegisterOffset(mmioBase, 0x229c), 0xffff8280);
3639

opencl/test/unit_test/helpers/hw_helper_tests.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -875,11 +875,23 @@ HWTEST_F(HwHelperTest, givenVariousValuesWhenConvertingHwRevIdAndSteppingThenCon
875875
for (uint32_t testValue = 0; testValue < 0x10; testValue++) {
876876
auto hwRevIdFromStepping = helper.getHwRevIdFromStepping(testValue, hardwareInfo);
877877
if (hwRevIdFromStepping != CommonConstants::invalidStepping) {
878-
EXPECT_EQ(testValue, helper.getSteppingFromHwRevId(hwRevIdFromStepping, hardwareInfo));
878+
hardwareInfo.platform.usRevId = hwRevIdFromStepping;
879+
EXPECT_EQ(testValue, helper.getSteppingFromHwRevId(hardwareInfo));
879880
}
880-
auto steppingFromHwRevId = helper.getSteppingFromHwRevId(testValue, hardwareInfo);
881+
hardwareInfo.platform.usRevId = testValue;
882+
auto steppingFromHwRevId = helper.getSteppingFromHwRevId(hardwareInfo);
881883
if (steppingFromHwRevId != CommonConstants::invalidStepping) {
882884
EXPECT_EQ(testValue, helper.getHwRevIdFromStepping(steppingFromHwRevId, hardwareInfo));
885+
} else {
886+
EXPECT_EQ(AubMemDump::SteppingValues::A, helper.getAubStreamSteppingFromHwRevId(hardwareInfo));
887+
}
888+
}
889+
890+
for (auto &steppingPair : steppingPairsToTest) {
891+
auto hwRevIdFromStepping = helper.getHwRevIdFromStepping(steppingPair.stepping, hardwareInfo);
892+
if (hwRevIdFromStepping != CommonConstants::invalidStepping) {
893+
hardwareInfo.platform.usRevId = hwRevIdFromStepping;
894+
EXPECT_EQ(steppingPair.aubStreamStepping, helper.getAubStreamSteppingFromHwRevId(hardwareInfo));
883895
}
884896
}
885897
}
@@ -889,7 +901,9 @@ HWTEST_F(HwHelperTest, givenInvalidProductFamilyWhenConvertingHwRevIdAndStepping
889901
hardwareInfo.platform.eProductFamily = IGFX_UNKNOWN;
890902
for (uint32_t testValue = 0; testValue < 0x10; testValue++) {
891903
EXPECT_EQ(CommonConstants::invalidStepping, helper.getHwRevIdFromStepping(testValue, hardwareInfo));
892-
EXPECT_EQ(CommonConstants::invalidStepping, helper.getSteppingFromHwRevId(testValue, hardwareInfo));
904+
hardwareInfo.platform.usRevId = testValue;
905+
EXPECT_EQ(CommonConstants::invalidStepping, helper.getSteppingFromHwRevId(hardwareInfo));
906+
EXPECT_EQ(AubMemDump::SteppingValues::A, helper.getAubStreamSteppingFromHwRevId(hardwareInfo));
893907
}
894908
}
895909

opencl/test/unit_test/helpers/hw_helper_tests.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2020 Intel Corporation
2+
* Copyright (C) 2017-2021 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -18,3 +18,15 @@ using namespace NEO;
1818
using HwHelperTest = Test<ClDeviceFixture>;
1919

2020
void testDefaultImplementationOfSetupHardwareCapabilities(HwHelper &hwHelper, const HardwareInfo &hwInfo);
21+
22+
constexpr struct {
23+
__REVID stepping;
24+
uint32_t aubStreamStepping;
25+
} steppingPairsToTest[] = {
26+
{REVISION_A0, AubMemDump::SteppingValues::A},
27+
{REVISION_A1, AubMemDump::SteppingValues::A},
28+
{REVISION_A3, AubMemDump::SteppingValues::A},
29+
{REVISION_B, AubMemDump::SteppingValues::B},
30+
{REVISION_C, AubMemDump::SteppingValues::C},
31+
{REVISION_D, AubMemDump::SteppingValues::D},
32+
{REVISION_K, AubMemDump::SteppingValues::K}};

opencl/test/unit_test/mocks/mock_aub_center.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018-2020 Intel Corporation
2+
* Copyright (C) 2018-2021 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -28,6 +28,7 @@ class MockAubCenter : public AubCenter {
2828
using AubCenter::AubCenter;
2929
using AubCenter::aubManager;
3030
using AubCenter::aubStreamMode;
31+
using AubCenter::stepping;
3132

3233
MockAubCenter() {
3334
streamProvider.reset(new MockAubStreamProvider());

0 commit comments

Comments
 (0)