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

@@ -93,6 +93,7 @@ struct CmdServicesMemTraceVersion {
enum {
Blc = 2,
Il = 5,
Glk = 17,
Skl = 12,
Hsw = 9,
Bxt = 14,
@@ -106,7 +107,8 @@ struct CmdServicesMemTraceVersion {
Vlv = 10,
Cln = 1,
Kbl = 16,
Bdw = 11
Bdw = 11,
Cfl = 24
};
};
struct RecordingMethodValues {

View File

@@ -81,6 +81,7 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverHw<GfxFamily> {
} engineInfoTable[EngineType::NUM_ENGINES];
std::unique_ptr<AUBCommandStreamReceiver::AubFileStream> stream;
uint32_t aubDeviceId;
bool standalone;
TypeSelector<PML4, PDPE, sizeof(void *) == 8>::type ppgtt;

View File

@@ -28,6 +28,7 @@
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
#include "runtime/gmm_helper/gmm_helper.h"
#include "runtime/helpers/string.h"
#include "runtime/os_interface/debug_settings_manager.h"
#include <cstring>
namespace OCLRT {
@@ -51,6 +52,10 @@ AUBCommandStreamReceiverHw<GfxFamily>::AUBCommandStreamReceiverHw(const Hardware
engineInfo.sizeRingBuffer = 0;
engineInfo.tailRingBuffer = 0;
}
auto debugDeviceId = DebugManager.flags.OverrideAubDeviceId.get();
this->aubDeviceId = debugDeviceId == -1
? hwInfoIn.capabilityTable.aubDeviceId
: static_cast<uint32_t>(debugDeviceId);
}
template <typename GfxFamily>
@@ -204,7 +209,7 @@ CommandStreamReceiver *AUBCommandStreamReceiverHw<GfxFamily>::create(const Hardw
DEBUG_BREAK_IF(true);
}
// Add the file header.
csr->stream->init(AubMemDump::SteppingValues::A, AUB::Traits::device);
csr->stream->init(AubMemDump::SteppingValues::A, csr->aubDeviceId);
return csr;
}

View File

@@ -88,6 +88,7 @@ class TbxCommandStreamReceiverHw : public CommandStreamReceiverHw<GfxFamily> {
void getGTTData(void *memory, AubGTTData &data);
TbxCommandStreamReceiver::TbxStream stream;
uint32_t aubDeviceId;
TypeSelector<PML4, PDPE, sizeof(void *) == 8>::type ppgtt;
PDPE ggtt;

View File

@@ -26,6 +26,7 @@
#include "runtime/helpers/ptr_math.h"
#include "runtime/memory_manager/graphics_allocation.h"
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.h"
#include "runtime/os_interface/debug_settings_manager.h"
#include <cstring>
namespace OCLRT {
@@ -43,6 +44,10 @@ TbxCommandStreamReceiverHw<GfxFamily>::TbxCommandStreamReceiverHw(const Hardware
engineInfo.sizeRCS = 0;
engineInfo.tailRCS = 0;
}
auto debugDeviceId = DebugManager.flags.OverrideAubDeviceId.get();
this->aubDeviceId = debugDeviceId == -1
? hwInfoIn.capabilityTable.aubDeviceId
: static_cast<uint32_t>(debugDeviceId);
}
template <typename GfxFamily>
@@ -175,7 +180,7 @@ CommandStreamReceiver *TbxCommandStreamReceiverHw<GfxFamily>::create(const Hardw
csr->stream.open(nullptr);
// Add the file header.
csr->stream.init(AubMemDump::SteppingValues::A, AUB::Traits::device);
csr->stream.init(AubMemDump::SteppingValues::A, csr->aubDeviceId);
return csr;
}

View File

@@ -22,6 +22,7 @@
#include "hw_info.h"
#include "hw_cmds.h"
#include "runtime/aub_mem_dump/aub_services.h"
#include "runtime/helpers/engine_node.h"
#include "runtime/memory_manager/memory_constants.h"
@@ -74,8 +75,8 @@ const RuntimeCapabilityTable BDW::capabilityTable{
EngineType::ENGINE_RCS, // defaultEngineType
MemoryConstants::pageSize, //requiredPreemptionSurfaceSize
true, // isCore
false // sourceLevelDebuggerSupported
};
false, // sourceLevelDebuggerSupported
CmdServicesMemTraceVersion::DeviceValues::Bdw};
const HardwareInfo BDW_1x2x6::hwInfo = {
&BDW::platform,

View File

@@ -22,6 +22,7 @@
#include "hw_info_bxt.h"
#include "hw_cmds.h"
#include "runtime/aub_mem_dump/aub_services.h"
#include "runtime/helpers/engine_node.h"
#include "runtime/memory_manager/memory_constants.h"
@@ -71,8 +72,8 @@ const RuntimeCapabilityTable BXT::capabilityTable{
EngineType::ENGINE_RCS, // defaultEngineType
MemoryConstants::pageSize, //requiredPreemptionSurfaceSize
false, // isCore
true // sourceLevelDebuggerSupported
};
true, // sourceLevelDebuggerSupported
CmdServicesMemTraceVersion::DeviceValues::Bxt};
const HardwareInfo BXT_1x2x6::hwInfo = {
&BXT::platform,

View File

@@ -22,6 +22,7 @@
#include "hw_info_cfl.h"
#include "hw_cmds.h"
#include "runtime/aub_mem_dump/aub_services.h"
#include "runtime/helpers/engine_node.h"
#include "runtime/memory_manager/memory_constants.h"
@@ -66,8 +67,8 @@ const RuntimeCapabilityTable CFL::capabilityTable{
EngineType::ENGINE_RCS, // defaultEngineType
MemoryConstants::pageSize, //requiredPreemptionSurfaceSize
true, // isCore
true // sourceLevelDebuggerSupported
};
true, // sourceLevelDebuggerSupported
CmdServicesMemTraceVersion::DeviceValues::Cfl};
const HardwareInfo CFL_1x2x6::hwInfo = {
&CFL::platform,

View File

@@ -22,6 +22,7 @@
#include "hw_info_glk.h"
#include "hw_cmds.h"
#include "runtime/aub_mem_dump/aub_services.h"
#include "runtime/helpers/engine_node.h"
#include "runtime/memory_manager/memory_constants.h"
@@ -66,8 +67,8 @@ const RuntimeCapabilityTable GLK::capabilityTable{
EngineType::ENGINE_RCS, // defaultEngineType
MemoryConstants::pageSize, //requiredPreemptionSurfaceSize
false, // isCore
true // sourceLevelDebuggerSupported
};
true, // sourceLevelDebuggerSupported
CmdServicesMemTraceVersion::DeviceValues::Glk};
const HardwareInfo GLK_1x3x6::hwInfo = {
&GLK::platform,

View File

@@ -22,6 +22,7 @@
#include "hw_info_kbl.h"
#include "hw_cmds.h"
#include "runtime/aub_mem_dump/aub_services.h"
#include "runtime/helpers/engine_node.h"
#include "runtime/memory_manager/memory_constants.h"
@@ -66,8 +67,8 @@ const RuntimeCapabilityTable KBL::capabilityTable{
EngineType::ENGINE_RCS, // defaultEngineType
MemoryConstants::pageSize, //requiredPreemptionSurfaceSize
true, // isCore
true // sourceLevelDebuggerSupported
};
true, // sourceLevelDebuggerSupported
CmdServicesMemTraceVersion::DeviceValues::Kbl};
const HardwareInfo KBL_1x2x6::hwInfo = {
&KBL::platform,

View File

@@ -22,6 +22,7 @@
#include "hw_info_skl.h"
#include "hw_cmds.h"
#include "runtime/aub_mem_dump/aub_services.h"
#include "runtime/helpers/engine_node.h"
#include "runtime/memory_manager/memory_constants.h"
@@ -74,8 +75,8 @@ const RuntimeCapabilityTable SKL::capabilityTable{
EngineType::ENGINE_RCS, // defaultEngineType
MemoryConstants::pageSize, //requiredPreemptionSurfaceSize
true, // isCore
true // sourceLevelDebuggerSupported
};
true, // sourceLevelDebuggerSupported
CmdServicesMemTraceVersion::DeviceValues::Skl};
const HardwareInfo SKL_1x2x6::hwInfo = {
&SKL::platform,

View File

@@ -74,6 +74,7 @@ struct RuntimeCapabilityTable {
size_t requiredPreemptionSurfaceSize;
bool isCore;
bool sourceLevelDebuggerSupported;
uint32_t aubDeviceId;
};
struct HardwareCapabilities {

View File

@@ -93,3 +93,4 @@ DECLARE_DEBUG_VARIABLE(int32_t, NodeOrdinal, -1, "-1: default do not override, 0
DECLARE_DEBUG_VARIABLE(int32_t, OverrideThreadArbitrationPolicy, -1, "-1 (dont override) or any valid config (0: Age Based, 1: Round Robin)")
DECLARE_DEBUG_VARIABLE(bool, HwQueueSupported, false, "Windows only. Pass flag to KMD during Wddm Context creation")
DECLARE_DEBUG_VARIABLE(bool, UseMaxSimdSizeToDeduceMaxWorkgroupSize, false, "With this flag on, max workgroup size is deduced using SIMD32 instead of SIMD8, this causes the max wkg size to be 4 times bigger")
DECLARE_DEBUG_VARIABLE(int32_t, OverrideAubDeviceId, -1, "-1 dont override, any other: use this value for AUB generation device id")

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