Use product aub device id and make it configurable by using debug flag

Change-Id: Ie65eea0f72497ef68e805ad438f4f53df731d304
This commit is contained in:
Zdanowicz, Zbigniew
2018-06-06 17:03:46 +02:00
parent bd16f4bf2b
commit 36621b2488
19 changed files with 88 additions and 26 deletions

View File

@ -48,7 +48,8 @@ HWTEST_F(AubMemDumpTests, testHeader) {
aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary);
// Header
aubFile.init(AubMemDump::SteppingValues::A, AUB::Traits::device);
auto deviceId = pDevice->getHardwareInfo().capabilityTable.aubDeviceId;
aubFile.init(AubMemDump::SteppingValues::A, deviceId);
aubFile.fileHandle.close();
}
@ -62,7 +63,8 @@ HWTEST_F(AubMemDumpTests, reserveMaxAddress) {
aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary);
// Header
aubFile.init(AubMemDump::SteppingValues::A, AUB::Traits::device);
auto deviceId = pDevice->getHardwareInfo().capabilityTable.aubDeviceId;
aubFile.init(AubMemDump::SteppingValues::A, deviceId);
auto gAddress = static_cast<uintptr_t>(-1) - 4096;
auto pAddress = static_cast<uint64_t>(gAddress) & 0xFFFFFFFF;
@ -80,7 +82,8 @@ HWTEST_F(AubMemDumpTests, writeVerifyOneBytePPGTT) {
aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary);
// Header
aubFile.init(AubMemDump::SteppingValues::A, AUB::Traits::device);
auto deviceId = pDevice->getHardwareInfo().capabilityTable.aubDeviceId;
aubFile.init(AubMemDump::SteppingValues::A, deviceId);
uint8_t byte = 0xbf;
auto gAddress = reinterpret_cast<uintptr_t>(&byte);
@ -101,7 +104,8 @@ HWTEST_F(AubMemDumpTests, writeVerifyOneByteGGTT) {
aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary);
// Header
aubFile.init(AubMemDump::SteppingValues::A, AUB::Traits::device);
auto deviceId = pDevice->getHardwareInfo().capabilityTable.aubDeviceId;
aubFile.init(AubMemDump::SteppingValues::A, deviceId);
uint8_t byte = 0xbf;
uint64_t physAddress = reinterpret_cast<uint64_t>(&byte) & 0xFFFFFFFF;
@ -122,7 +126,8 @@ HWTEST_F(AubMemDumpTests, writeVerifySevenBytesPPGTT) {
aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary);
// Header
aubFile.init(AubMemDump::SteppingValues::A, AUB::Traits::device);
auto deviceId = pDevice->getHardwareInfo().capabilityTable.aubDeviceId;
aubFile.init(AubMemDump::SteppingValues::A, deviceId);
uint8_t bytes[] = {0, 1, 2, 3, 4, 5, 6};
auto gAddress = reinterpret_cast<uintptr_t>(bytes);
@ -143,7 +148,8 @@ HWTEST_F(AubMemDumpTests, writeVerifySevenBytesGGTT) {
aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary);
// Header
aubFile.init(AubMemDump::SteppingValues::A, AUB::Traits::device);
auto deviceId = pDevice->getHardwareInfo().capabilityTable.aubDeviceId;
aubFile.init(AubMemDump::SteppingValues::A, deviceId);
uint8_t bytes[] = {0, 1, 2, 3, 4, 5, 6};
uint64_t physAddress = reinterpret_cast<uint64_t>(bytes) & 0xFFFFFFFF;

View File

@ -53,7 +53,8 @@ void setupAUB(const OCLRT::Device *pDevice, OCLRT::EngineType engineType) {
aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary);
// Header
aubFile.init(AubMemDump::SteppingValues::A, AUB::Traits::device);
auto deviceId = pDevice->getHardwareInfo().capabilityTable.aubDeviceId;
aubFile.init(AubMemDump::SteppingValues::A, deviceId);
aubFile.writeMMIO(mmioBase + 0x229c, 0xffff8280);

View File

@ -42,7 +42,8 @@ void setupAUBWithBatchBuffer(const OCLRT::Device *pDevice, OCLRT::EngineType eng
aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary);
// Header
aubFile.init(AubMemDump::SteppingValues::A, AUB::Traits::device);
auto deviceId = pDevice->getHardwareInfo().capabilityTable.aubDeviceId;
aubFile.init(AubMemDump::SteppingValues::A, deviceId);
aubFile.writeMMIO(mmioBase + 0x229c, 0xffff8280);

View File

@ -35,8 +35,8 @@
using namespace OCLRT;
using ::testing::Invoke;
using ::testing::_;
using ::testing::Invoke;
using ::testing::Return;
typedef Test<DeviceFixture> AubCommandStreamReceiverTests;
@ -104,6 +104,7 @@ TEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenTypeIsChe
}
HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenItIsCreatedWithDefaultSettingsThenItHasBatchedDispatchModeEnabled) {
DebugManagerStateRestore stateRestore;
DebugManager.flags.CsrDispatchMode.set(0);
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], true));
EXPECT_EQ(DispatchMode::BatchedDispatch, aubCsr->peekDispatchMode());
@ -1200,3 +1201,17 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMe
queryGmm.release();
memoryManager->freeGraphicsMemory(imageAllocation);
}
HWTEST_F(AubCommandStreamReceiverTests, givenNoDbgDeviceIdFlagWhenAubCsrIsCreatedThenUseDefaultDeviceId) {
const HardwareInfo &hwInfoIn = *platformDevices[0];
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(hwInfoIn, true));
EXPECT_EQ(hwInfoIn.capabilityTable.aubDeviceId, aubCsr->aubDeviceId);
}
HWTEST_F(AubCommandStreamReceiverTests, givenDbgDeviceIdFlagIsSetWhenAubCsrIsCreatedThenUseDebugDeviceId) {
DebugManagerStateRestore stateRestore;
DebugManager.flags.OverrideAubDeviceId.set(9); //this is Hsw, not used
const HardwareInfo &hwInfoIn = *platformDevices[0];
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(hwInfoIn, true));
EXPECT_EQ(9u, aubCsr->aubDeviceId);
}

View File

@ -25,9 +25,11 @@
#include "runtime/command_stream/tbx_command_stream_receiver_hw.h"
#include "runtime/command_stream/command_stream_receiver_hw.h"
#include "runtime/helpers/ptr_math.h"
#include "runtime/os_interface/debug_settings_manager.h"
#include "gen_cmd_parse.h"
#include "unit_tests/command_queue/command_queue_fixture.h"
#include "unit_tests/fixtures/device_fixture.h"
#include "unit_tests/helpers/debug_manager_state_restore.h"
#include "test.h"
#include <cstdint>
@ -288,4 +290,18 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledTh
TEST(TbxMemoryManagerTest, givenTbxMemoryManagerWhenItIsQueriedForSystemSharedMemoryThen1GBIsReturned) {
TbxMemoryManager memoryManager;
EXPECT_EQ(1 * GB, memoryManager.getSystemSharedMemory());
}
}
HWTEST_F(TbxCommandStreamTests, givenNoDbgDeviceIdFlagWhenTbxCsrIsCreatedThenUseDefaultDeviceId) {
const HardwareInfo &hwInfo = *platformDevices[0];
TbxCommandStreamReceiverHw<FamilyType> *tbxCsr = reinterpret_cast<TbxCommandStreamReceiverHw<FamilyType> *>(pCommandStreamReceiver);
EXPECT_EQ(hwInfo.capabilityTable.aubDeviceId, tbxCsr->aubDeviceId);
}
HWTEST_F(TbxCommandStreamTests, givenDbgDeviceIdFlagIsSetWhenTbxCsrIsCreatedThenUseDebugDeviceId) {
DebugManagerStateRestore stateRestore;
DebugManager.flags.OverrideAubDeviceId.set(9); //this is Hsw, not used
const HardwareInfo &hwInfoIn = *platformDevices[0];
std::unique_ptr<TbxCommandStreamReceiverHw<FamilyType>> tbxCsr(reinterpret_cast<TbxCommandStreamReceiverHw<FamilyType> *>(TbxCommandStreamReceiver::create(hwInfoIn, false)));
EXPECT_EQ(9u, tbxCsr->aubDeviceId);
}

View File

@ -64,4 +64,5 @@ PrintDispatchParameters = false
AddPatchInfoCommentsForAUBDump = false
HwQueueSupported = false
DisableZeroCopyForUseHostPtr = false
SchedulerGWS = 0
SchedulerGWS = 0
OverrideAubDeviceId = -1