mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 15:53:45 +08:00
Add xe_hp_core shared tests
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
74e6c74071
commit
3e213c9c06
34
shared/test/common/libult/xe_hp_core.cpp
Normal file
34
shared/test/common/libult/xe_hp_core.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/populate_factory.h"
|
||||
|
||||
#include "opencl/test/unit_test/libult/ult_command_stream_receiver.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
typedef XeHpFamily Family;
|
||||
|
||||
static auto gfxCore = IGFX_XE_HP_CORE;
|
||||
|
||||
extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE];
|
||||
|
||||
template <>
|
||||
void populateFactoryTable<UltCommandStreamReceiver<Family>>() {
|
||||
commandStreamReceiverFactory[IGFX_MAX_CORE + gfxCore] = UltCommandStreamReceiver<Family>::create;
|
||||
}
|
||||
|
||||
struct enableXeHpCore {
|
||||
enableXeHpCore() {
|
||||
populateFactoryTable<UltCommandStreamReceiver<Family>>();
|
||||
}
|
||||
};
|
||||
|
||||
static enableXeHpCore enable;
|
||||
|
||||
template class UltCommandStreamReceiver<XeHpFamily>;
|
||||
} // namespace NEO
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/preemption.h"
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
@@ -92,3 +93,26 @@ XEHPTEST_F(XeHPPreambleVfeState, whenProgrammingVfeStateThenDoNotAddPipeControlW
|
||||
|
||||
EXPECT_EQ(sizeBefore, sizeAfter);
|
||||
}
|
||||
|
||||
XEHPTEST_F(XeHPPreambleVfeState, WhenProgramVFEStateIsCalledThenCorrectCfeStateAddressIsReturned) {
|
||||
using CFE_STATE = typename FamilyType::CFE_STATE;
|
||||
|
||||
char buffer[64];
|
||||
MockGraphicsAllocation graphicsAllocation(buffer, sizeof(buffer));
|
||||
LinearStream preambleStream(&graphicsAllocation, graphicsAllocation.getUnderlyingBuffer(), graphicsAllocation.getUnderlyingBufferSize());
|
||||
uint64_t addressToPatch = 0xC0DEC0DE;
|
||||
uint64_t expectedAddress = 0xDEC0C0;
|
||||
|
||||
auto pCfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&preambleStream, *defaultHwInfo, EngineGroupType::RenderCompute);
|
||||
StreamProperties emptyProperties{};
|
||||
PreambleHelper<FamilyType>::programVfeState(pCfeCmd, *defaultHwInfo, 1024u, addressToPatch,
|
||||
10u, AdditionalKernelExecInfo::NotApplicable,
|
||||
emptyProperties);
|
||||
EXPECT_GE(reinterpret_cast<uintptr_t>(pCfeCmd), reinterpret_cast<uintptr_t>(preambleStream.getCpuBase()));
|
||||
EXPECT_LT(reinterpret_cast<uintptr_t>(pCfeCmd), reinterpret_cast<uintptr_t>(preambleStream.getCpuBase()) + preambleStream.getUsed());
|
||||
|
||||
auto &cfeCmd = *reinterpret_cast<CFE_STATE *>(pCfeCmd);
|
||||
EXPECT_EQ(10u, cfeCmd.getMaximumNumberOfThreads());
|
||||
EXPECT_EQ(1u, cfeCmd.getNumberOfWalkers());
|
||||
EXPECT_EQ(expectedAddress, cfeCmd.getScratchSpaceBuffer());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user