Skip to content

Commit d445077

Browse files
pwilmaCompute-Runtime-Automation
authored andcommitted
Context creation flags in AubDump
Change-Id: Ia9651d37fa716351728633f0bee5b0eae98e758f
1 parent 477a06a commit d445077

File tree

5 files changed

+38
-1
lines changed

5 files changed

+38
-1
lines changed

runtime/aub_mem_dump/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ set(RUNTIME_SRCS_AUB_MEM_DUMP
1212
${CMAKE_CURRENT_SOURCE_DIR}/aub_mem_dump.h
1313
${CMAKE_CURRENT_SOURCE_DIR}/aub_mem_dump.inl
1414
${CMAKE_CURRENT_SOURCE_DIR}/aub_services.h
15+
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/context_flags.cpp
1516
${CMAKE_CURRENT_SOURCE_DIR}/page_table_entry_bits.h
1617
)
1718
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_AUB_MEM_DUMP})

runtime/aub_mem_dump/aub_mem_dump.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,11 @@ void LrcaHelper::initialize(void *pLRCIn) const {
137137
auto pLRI = ptrOffset(pLRCA, offsetLRI0);
138138
auto numRegs = numRegsLRI0;
139139
*pLRI++ = 0x11001000 | (2 * numRegs - 1);
140+
uint32_t ctxSrCtlValue = 0x00010001; // Inhibit context-restore
141+
setContextSaveRestoreFlags(ctxSrCtlValue);
140142
while (numRegs-- > 0) {
141143
*pLRI++ = mmioBase + 0x2244; // CTXT_SR_CTL
142-
*pLRI++ = 0x00010001; // Inhibit context-restore
144+
*pLRI++ = ctxSrCtlValue;
143145
}
144146

145147
// Initialize the other LRI

runtime/aub_mem_dump/aub_mem_dump.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ struct LrcaHelper {
343343
void setPDP3(void *pLRCIn, uint64_t address) const;
344344

345345
void setPML4(void *pLRCIn, uint64_t address) const;
346+
MOCKABLE_VIRTUAL void setContextSaveRestoreFlags(uint32_t &value) const;
346347
};
347348

348349
struct LrcaHelperRcs : public LrcaHelper {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Copyright (C) 2017-2018 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#include "runtime/aub_mem_dump/aub_mem_dump.h"
9+
10+
namespace AubMemDump {
11+
void LrcaHelper::setContextSaveRestoreFlags(uint32_t &ctxSrCtlValue) const {
12+
}
13+
} // namespace AubMemDump

unit_tests/aub/aub_helper_tests.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "runtime/aub/aub_helper.h"
1010
#include "runtime/aub_mem_dump/aub_mem_dump.h"
1111
#include "runtime/aub_mem_dump/page_table_entry_bits.h"
12+
#include "runtime/command_stream/aub_command_stream_receiver_hw.h"
1213
#include "unit_tests/fixtures/device_fixture.h"
1314
#include "test.h"
1415

@@ -100,3 +101,22 @@ HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPtEntryIsCall
100101
int addressSpace = aubHelper.getMemTraceForPtEntry();
101102
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace);
102103
}
104+
105+
struct MockLrcaHelper : AubMemDump::LrcaHelper {
106+
mutable uint32_t setContextSaveRestoreFlagsCalled = 0;
107+
MockLrcaHelper(uint32_t base) : AubMemDump::LrcaHelper(base) {}
108+
void setContextSaveRestoreFlags(uint32_t &value) const override {
109+
setContextSaveRestoreFlagsCalled++;
110+
AubMemDump::LrcaHelper::setContextSaveRestoreFlags(value);
111+
}
112+
};
113+
114+
HWTEST_F(AubHelperHwTest, giverLrcaHelperWhenContextIsInitializedThenContextFlagsAreSet) {
115+
const auto &csTraits = AUBCommandStreamReceiverHw<FamilyType>::getCsTraits(EngineType::ENGINE_RCS);
116+
MockLrcaHelper lrcaHelper(csTraits.mmioBase);
117+
118+
std::unique_ptr<void, std::function<void(void *)>> lrcaBase(alignedMalloc(csTraits.sizeLRCA, csTraits.alignLRCA), alignedFree);
119+
120+
lrcaHelper.initialize(lrcaBase.get());
121+
ASSERT_NE(0u, lrcaHelper.setContextSaveRestoreFlagsCalled);
122+
}

0 commit comments

Comments
 (0)