mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 23:56:39 +08:00
Allocate per context SBA tracking buffer
Related-To: NEO-4637 Change-Id: I979aefe599df388a49be2b2703505090d7935d78 Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
7f3a13f3bc
commit
9c42183cd8
@@ -14,6 +14,7 @@ namespace ult {
|
||||
class MockDebuggerL0 : public L0::DebuggerL0 {
|
||||
public:
|
||||
using L0::DebuggerL0::DebuggerL0;
|
||||
using L0::DebuggerL0::perContextSbaAllocations;
|
||||
~MockDebuggerL0() override = default;
|
||||
};
|
||||
|
||||
|
||||
@@ -46,7 +46,8 @@ struct L0DebuggerFixture {
|
||||
struct MockL0DebuggerFixture : public L0DebuggerFixture {
|
||||
void SetUp() {
|
||||
L0DebuggerFixture::SetUp();
|
||||
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->debugger.reset(new MockDebuggerL0(neoDevice));
|
||||
mockDebugger = new MockDebuggerL0(neoDevice);
|
||||
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->debugger.reset(mockDebugger);
|
||||
neoDevice->setDebuggerActive(true);
|
||||
neoDevice->setPreemptionMode(PreemptionMode::Disabled);
|
||||
auto debugSurface = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(
|
||||
@@ -61,7 +62,9 @@ struct MockL0DebuggerFixture : public L0DebuggerFixture {
|
||||
|
||||
void TearDown() {
|
||||
L0DebuggerFixture::TearDown();
|
||||
mockDebugger = nullptr;
|
||||
}
|
||||
MockDebuggerL0 *mockDebugger = nullptr;
|
||||
};
|
||||
|
||||
} // namespace ult
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "shared/source/command_stream/linear_stream.h"
|
||||
#include "shared/source/gen_common/reg_configs/reg_configs_common.h"
|
||||
#include "shared/source/helpers/preamble.h"
|
||||
#include "shared/source/os_interface/os_context.h"
|
||||
#include "shared/test/unit_test/cmd_parse/gen_cmd_parse.h"
|
||||
|
||||
#include "test.h"
|
||||
@@ -37,11 +38,48 @@ TEST_F(L0DebuggerTest, givenL0DebuggerWhenCallingIsDebuggerActiveThenTrueIsRetur
|
||||
EXPECT_TRUE(neoDevice->getDebugger()->isDebuggerActive());
|
||||
}
|
||||
|
||||
TEST_F(L0DebuggerTest, givenL0DebuggerWhenCreatedThenSbaTrackingBufferIsAllocated) {
|
||||
TEST_F(L0DebuggerTest, givenL0DebuggerWhenCreatedThenPerContextSbaTrackingBuffersAreAllocated) {
|
||||
auto debugger = device->getL0Debugger();
|
||||
ASSERT_NE(nullptr, debugger);
|
||||
ASSERT_NE(nullptr, debugger->getSbaTrackingBuffer());
|
||||
EXPECT_EQ(NEO::GraphicsAllocation::AllocationType::DEBUG_SBA_TRACKING_BUFFER, debugger->getSbaTrackingBuffer()->getAllocationType());
|
||||
|
||||
EXPECT_NE(0u, debugger->getSbaTrackingGpuVa());
|
||||
std::vector<NEO::GraphicsAllocation *> allocations;
|
||||
|
||||
for (auto &engine : device->getNEODevice()->getEngines()) {
|
||||
auto sbaAllocation = debugger->getSbaTrackingBuffer(engine.osContext->getContextId());
|
||||
ASSERT_NE(nullptr, sbaAllocation);
|
||||
allocations.push_back(sbaAllocation);
|
||||
|
||||
EXPECT_EQ(NEO::GraphicsAllocation::AllocationType::DEBUG_SBA_TRACKING_BUFFER, sbaAllocation->getAllocationType());
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < allocations.size() - 1; i++) {
|
||||
EXPECT_NE(allocations[i], allocations[i + 1]);
|
||||
}
|
||||
|
||||
EXPECT_EQ(device->getNEODevice()->getEngines().size(), mockDebugger->perContextSbaAllocations.size());
|
||||
}
|
||||
|
||||
TEST_F(L0DebuggerTest, givenCreatedL0DebuggerThenSbaTrackingBuffersContainValidHeader) {
|
||||
auto debugger = device->getL0Debugger();
|
||||
ASSERT_NE(nullptr, debugger);
|
||||
|
||||
for (auto &sbaBuffer : mockDebugger->perContextSbaAllocations) {
|
||||
auto sbaAllocation = sbaBuffer.second;
|
||||
ASSERT_NE(nullptr, sbaAllocation);
|
||||
|
||||
auto sbaHeader = reinterpret_cast<SbaTrackedAddresses *>(sbaAllocation->getUnderlyingBuffer());
|
||||
|
||||
EXPECT_STREQ("sbaarea", sbaHeader->magic);
|
||||
EXPECT_EQ(0u, sbaHeader->BindlessSamplerStateBaseAddress);
|
||||
EXPECT_EQ(0u, sbaHeader->BindlessSurfaceStateBaseAddress);
|
||||
EXPECT_EQ(0u, sbaHeader->DynamicStateBaseAddress);
|
||||
EXPECT_EQ(0u, sbaHeader->GeneralStateBaseAddress);
|
||||
EXPECT_EQ(0u, sbaHeader->IndirectObjectBaseAddress);
|
||||
EXPECT_EQ(0u, sbaHeader->InstructionBaseAddress);
|
||||
EXPECT_EQ(0u, sbaHeader->SurfaceStateBaseAddress);
|
||||
EXPECT_EQ(0u, sbaHeader->Version);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(L0DebuggerTest, givenDebuggingEnabledWhenCommandListIsExecutedThenKernelDebugCommandsAreAdded) {
|
||||
|
||||
Reference in New Issue
Block a user