mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Add XE_HP_CORE OCL unit tests and waDefaultTile4 flag
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
7f1c67c970
commit
75812634cf
@ -8,6 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/helpers/constants.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
@ -18,3 +19,25 @@ using namespace NEO;
|
||||
using HwHelperTest = Test<ClDeviceFixture>;
|
||||
|
||||
void testDefaultImplementationOfSetupHardwareCapabilities(HwHelper &hwHelper, const HardwareInfo &hwInfo);
|
||||
|
||||
struct ComputeSlmTestInput {
|
||||
uint32_t expected;
|
||||
uint32_t slmSize;
|
||||
};
|
||||
|
||||
constexpr ComputeSlmTestInput computeSlmValuesXeHPPlusTestsInput[] = {
|
||||
{0, 0 * KB},
|
||||
{1, 0 * KB + 1},
|
||||
{1, 1 * KB},
|
||||
{2, 1 * KB + 1},
|
||||
{2, 2 * KB},
|
||||
{3, 2 * KB + 1},
|
||||
{3, 4 * KB},
|
||||
{4, 4 * KB + 1},
|
||||
{4, 8 * KB},
|
||||
{5, 8 * KB + 1},
|
||||
{5, 16 * KB},
|
||||
{6, 16 * KB + 1},
|
||||
{6, 32 * KB},
|
||||
{7, 32 * KB + 1},
|
||||
{7, 64 * KB}};
|
||||
|
@ -56,6 +56,7 @@ struct SkuInfoBaseReference {
|
||||
refWaTable.WaLimit128BMediaCompr = 1;
|
||||
refWaTable.WaUntypedBufferCompression = 1;
|
||||
refWaTable.WaAuxTable16KGranular = 1;
|
||||
refWaTable.WaDefaultTile4 = 1;
|
||||
}
|
||||
|
||||
static void fillReferenceFtrToReceive(FeatureTable &refFtrTable) {
|
||||
@ -172,6 +173,7 @@ struct SkuInfoBaseReference {
|
||||
refWaTable.waUntypedBufferCompression = true;
|
||||
refWaTable.waAuxTable16KGranular = true;
|
||||
refWaTable.waDisableFusedThreadScheduling = true;
|
||||
refWaTable.waDefaultTile4 = true;
|
||||
}
|
||||
}; // namespace SkuInfoBaseReference
|
||||
} // namespace NEO
|
||||
|
@ -7,6 +7,12 @@
|
||||
if(TESTS_XE_HP_CORE)
|
||||
set(IGDRCL_SRCS_tests_xe_hp_core
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/copy_engine_tests_xe_hp_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_cmds_programming_xe_hp_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_xe_hp_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_xe_hp_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_platform_caps_xe_hp_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_sample_xe_hp_core.cpp
|
||||
${NEO_SOURCE_DIR}/shared/test/common/xe_hp_core/unit_test_helper_xe_hp_core.cpp
|
||||
)
|
||||
|
||||
|
@ -0,0 +1,696 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/gmm_helper/client_context/gmm_client_context.h"
|
||||
#include "shared/source/gmm_helper/gmm.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/helpers/timestamp_packet.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/unit_test/utilities/base_object_utils.h"
|
||||
|
||||
#include "opencl/test/unit_test/libult/ult_command_stream_receiver.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct BlitXE_HP_CORETests : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
if (is32bit) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
DebugManager.flags.RenderCompressedBuffersEnabled.set(true);
|
||||
DebugManager.flags.EnableLocalMemory.set(true);
|
||||
|
||||
clDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
|
||||
}
|
||||
|
||||
uint32_t blitBuffer(CommandStreamReceiver *csr, const BlitProperties &blitProperties, bool blocking) {
|
||||
BlitPropertiesContainer blitPropertiesContainer;
|
||||
blitPropertiesContainer.push_back(blitProperties);
|
||||
|
||||
return csr->blitBuffer(blitPropertiesContainer, blocking, false);
|
||||
}
|
||||
|
||||
std::unique_ptr<MockClDevice> clDevice;
|
||||
TimestampPacketContainer timestampPacketContainer;
|
||||
CsrDependencies csrDependencies;
|
||||
DebugManagerStateRestore debugRestorer;
|
||||
};
|
||||
|
||||
XE_HP_CORE_TEST_F(BlitXE_HP_CORETests, givenCompressedBufferWhenProgrammingBltCommandThenSetCompressionFields) {
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
|
||||
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(clDevice->getEngine(aub_stream::EngineType::ENGINE_BCS, EngineUsage::Regular).commandStreamReceiver);
|
||||
MockContext context(clDevice.get());
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto bufferCompressed = clUniquePtr<Buffer>(Buffer::create(&context, CL_MEM_READ_WRITE, 2048, nullptr, retVal));
|
||||
bufferCompressed->getGraphicsAllocation(clDevice->getRootDeviceIndex())->getDefaultGmm()->isCompressionEnabled = true;
|
||||
auto bufferNotCompressed = clUniquePtr<Buffer>(Buffer::create(&context, CL_MEM_READ_WRITE, 2048, nullptr, retVal));
|
||||
bufferNotCompressed->getGraphicsAllocation(clDevice->getRootDeviceIndex())->getDefaultGmm()->isCompressionEnabled = false;
|
||||
|
||||
auto gmmHelper = clDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmHelper();
|
||||
uint32_t compressionFormat = gmmHelper->getClientContext()->getSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT::GMM_FORMAT_GENERIC_8BIT);
|
||||
|
||||
{
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopyBuffer(bufferNotCompressed->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
bufferCompressed->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
0, 0, {2048, 1, 1}, 0, 0, 0, 0, csr->getClearColorAllocation());
|
||||
|
||||
blitBuffer(csr, blitProperties, true);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream);
|
||||
|
||||
auto bltCmd = genCmdCast<XY_COPY_BLT *>(*(hwParser.cmdList.begin()));
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
EXPECT_EQ(bltCmd->getDestinationCompressionEnable(), XY_COPY_BLT::COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_DISABLE);
|
||||
EXPECT_EQ(bltCmd->getDestinationAuxiliarysurfacemode(), XY_COPY_BLT::AUXILIARY_SURFACE_MODE_AUX_NONE);
|
||||
EXPECT_EQ(bltCmd->getDestinationCompressionFormat(), 0u);
|
||||
EXPECT_EQ(bltCmd->getSourceCompressionEnable(), XY_COPY_BLT::COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_ENABLE);
|
||||
EXPECT_EQ(bltCmd->getSourceAuxiliarysurfacemode(), XY_COPY_BLT::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
|
||||
EXPECT_EQ(bltCmd->getSourceCompressionFormat(), compressionFormat);
|
||||
}
|
||||
|
||||
{
|
||||
auto offset = csr->commandStream.getUsed();
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopyBuffer(bufferCompressed->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
bufferNotCompressed->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
0, 0, {2048, 1, 1}, 0, 0, 0, 0, csr->getClearColorAllocation());
|
||||
blitBuffer(csr, blitProperties, true);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream, offset);
|
||||
|
||||
auto bltCmd = genCmdCast<XY_COPY_BLT *>(*(hwParser.cmdList.begin()));
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
EXPECT_EQ(bltCmd->getDestinationCompressionEnable(), XY_COPY_BLT::COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_ENABLE);
|
||||
EXPECT_EQ(bltCmd->getDestinationAuxiliarysurfacemode(), XY_COPY_BLT::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
|
||||
EXPECT_EQ(bltCmd->getDestinationCompressionFormat(), compressionFormat);
|
||||
EXPECT_EQ(bltCmd->getSourceCompressionEnable(), XY_COPY_BLT::COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_DISABLE);
|
||||
EXPECT_EQ(bltCmd->getSourceAuxiliarysurfacemode(), XY_COPY_BLT::AUXILIARY_SURFACE_MODE_AUX_NONE);
|
||||
EXPECT_EQ(bltCmd->getSourceCompressionFormat(), 0u);
|
||||
}
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(BlitXE_HP_CORETests, givenDebugFlagSetWhenCompressionEnabledThenForceCompressionFormat) {
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
|
||||
uint32_t compressionFormat = 3;
|
||||
DebugManager.flags.ForceBufferCompressionFormat.set(compressionFormat);
|
||||
|
||||
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(clDevice->getEngine(aub_stream::EngineType::ENGINE_BCS, EngineUsage::Regular).commandStreamReceiver);
|
||||
MockContext context(clDevice.get());
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto bufferCompressed = clUniquePtr<Buffer>(Buffer::create(&context, CL_MEM_READ_WRITE, 2048, nullptr, retVal));
|
||||
bufferCompressed->getGraphicsAllocation(clDevice->getRootDeviceIndex())->getDefaultGmm()->isCompressionEnabled = true;
|
||||
auto bufferNotCompressed = clUniquePtr<Buffer>(Buffer::create(&context, CL_MEM_READ_WRITE, 2048, nullptr, retVal));
|
||||
bufferNotCompressed->getGraphicsAllocation(clDevice->getRootDeviceIndex())->getDefaultGmm()->isCompressionEnabled = false;
|
||||
|
||||
{
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopyBuffer(bufferNotCompressed->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
bufferCompressed->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
0, 0, {2048, 1, 1}, 0, 0, 0, 0, csr->getClearColorAllocation());
|
||||
|
||||
blitBuffer(csr, blitProperties, true);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream);
|
||||
|
||||
auto bltCmd = genCmdCast<XY_COPY_BLT *>(*(hwParser.cmdList.begin()));
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
EXPECT_EQ(bltCmd->getDestinationCompressionEnable(), XY_COPY_BLT::COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_DISABLE);
|
||||
EXPECT_EQ(bltCmd->getDestinationAuxiliarysurfacemode(), XY_COPY_BLT::AUXILIARY_SURFACE_MODE_AUX_NONE);
|
||||
EXPECT_EQ(bltCmd->getDestinationCompressionFormat(), 0u);
|
||||
EXPECT_EQ(bltCmd->getSourceCompressionEnable(), XY_COPY_BLT::COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_ENABLE);
|
||||
EXPECT_EQ(bltCmd->getSourceAuxiliarysurfacemode(), XY_COPY_BLT::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
|
||||
EXPECT_EQ(bltCmd->getSourceCompressionFormat(), compressionFormat);
|
||||
}
|
||||
|
||||
{
|
||||
auto offset = csr->commandStream.getUsed();
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopyBuffer(bufferCompressed->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
bufferNotCompressed->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
0, 0, {2048, 1, 1}, 0, 0, 0, 0, csr->getClearColorAllocation());
|
||||
blitBuffer(csr, blitProperties, true);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream, offset);
|
||||
|
||||
auto bltCmd = genCmdCast<XY_COPY_BLT *>(*(hwParser.cmdList.begin()));
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
EXPECT_EQ(bltCmd->getDestinationCompressionEnable(), XY_COPY_BLT::COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_ENABLE);
|
||||
EXPECT_EQ(bltCmd->getDestinationAuxiliarysurfacemode(), XY_COPY_BLT::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
|
||||
EXPECT_EQ(bltCmd->getDestinationCompressionFormat(), compressionFormat);
|
||||
EXPECT_EQ(bltCmd->getSourceCompressionEnable(), XY_COPY_BLT::COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_DISABLE);
|
||||
EXPECT_EQ(bltCmd->getSourceAuxiliarysurfacemode(), XY_COPY_BLT::AUXILIARY_SURFACE_MODE_AUX_NONE);
|
||||
EXPECT_EQ(bltCmd->getSourceCompressionFormat(), 0u);
|
||||
}
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(BlitXE_HP_CORETests, givenBufferWhenProgrammingBltCommandThenSetMocs) {
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
|
||||
auto &bcsEngine = clDevice->getEngine(aub_stream::EngineType::ENGINE_BCS, EngineUsage::Regular);
|
||||
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(bcsEngine.commandStreamReceiver);
|
||||
MockContext context(clDevice.get());
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto buffer = clUniquePtr<Buffer>(Buffer::create(&context, CL_MEM_READ_WRITE, 1, nullptr, retVal));
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopyBuffer(buffer->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
buffer->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
0, 0, {1, 1, 1}, 0, 0, 0, 0, csr->getClearColorAllocation());
|
||||
|
||||
blitBuffer(csr, blitProperties, true);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream);
|
||||
|
||||
auto bltCmd = genCmdCast<XY_COPY_BLT *>(*(hwParser.cmdList.begin()));
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
auto mocsIndex = clDevice->getRootDeviceEnvironment().getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
|
||||
|
||||
EXPECT_EQ(mocsIndex, bltCmd->getDestinationMOCSvalue());
|
||||
EXPECT_EQ(mocsIndex, bltCmd->getSourceMOCS());
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(BlitXE_HP_CORETests, givenBufferWhenProgrammingBltCommandThenSetMocsToValueOfDebugKey) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.OverrideBlitterMocs.set(0u);
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
|
||||
auto &bcsEngine = clDevice->getEngine(aub_stream::EngineType::ENGINE_BCS, EngineUsage::Regular);
|
||||
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(bcsEngine.commandStreamReceiver);
|
||||
MockContext context(clDevice.get());
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto buffer = clUniquePtr<Buffer>(Buffer::create(&context, CL_MEM_READ_WRITE, 1, nullptr, retVal));
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopyBuffer(buffer->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
buffer->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
0, 0, {1, 1, 1}, 0, 0, 0, 0, csr->getClearColorAllocation());
|
||||
|
||||
blitBuffer(csr, blitProperties, true);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream);
|
||||
|
||||
auto bltCmd = genCmdCast<XY_COPY_BLT *>(*(hwParser.cmdList.begin()));
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
EXPECT_EQ(0u, bltCmd->getDestinationMOCSvalue());
|
||||
EXPECT_EQ(0u, bltCmd->getSourceMOCS());
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(BlitXE_HP_CORETests, givenCompressedBufferWhenResolveBlitIsCalledThenProgramSpecialOperationMode) {
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
|
||||
auto &bcsEngine = clDevice->getEngine(aub_stream::EngineType::ENGINE_BCS, EngineUsage::Regular);
|
||||
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(bcsEngine.commandStreamReceiver);
|
||||
MockContext context(clDevice.get());
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto buffer = clUniquePtr<Buffer>(Buffer::create(&context, CL_MEM_READ_WRITE, 2048, nullptr, retVal));
|
||||
auto blitProperties = BlitProperties::constructPropertiesForAuxTranslation(AuxTranslationDirection::AuxToNonAux,
|
||||
buffer->getGraphicsAllocation(clDevice->getRootDeviceIndex()), csr->getClearColorAllocation());
|
||||
|
||||
blitBuffer(csr, blitProperties, false);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream);
|
||||
|
||||
auto bltCmd = genCmdCast<XY_COPY_BLT *>(*(hwParser.cmdList.begin()));
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
EXPECT_EQ(XY_COPY_BLT::SPECIAL_MODE_OF_OPERATION::SPECIAL_MODE_OF_OPERATION_FULL_RESOLVE, bltCmd->getSpecialModeofOperation());
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(BlitXE_HP_CORETests, givenCompressedBufferWhenNonAuxToAuxBlitIsCalledThenDontProgramSourceCompression) {
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
|
||||
auto &bcsEngine = clDevice->getEngine(aub_stream::EngineType::ENGINE_BCS, EngineUsage::Regular);
|
||||
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(bcsEngine.commandStreamReceiver);
|
||||
MockContext context(clDevice.get());
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto buffer = clUniquePtr<Buffer>(Buffer::create(&context, CL_MEM_READ_WRITE, 2048, nullptr, retVal));
|
||||
auto blitProperties = BlitProperties::constructPropertiesForAuxTranslation(AuxTranslationDirection::NonAuxToAux,
|
||||
buffer->getGraphicsAllocation(clDevice->getRootDeviceIndex()), csr->getClearColorAllocation());
|
||||
|
||||
blitBuffer(csr, blitProperties, false);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream);
|
||||
|
||||
auto bltCmd = genCmdCast<XY_COPY_BLT *>(*(hwParser.cmdList.begin()));
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
EXPECT_EQ(XY_COPY_BLT::COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_DISABLE, bltCmd->getSourceCompressionEnable());
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(BlitXE_HP_CORETests, given2dBlitCommandWhenDispatchingThenSetValidSurfaceType) {
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
|
||||
auto &bcsEngine = clDevice->getEngine(aub_stream::EngineType::ENGINE_BCS, EngineUsage::Regular);
|
||||
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(bcsEngine.commandStreamReceiver);
|
||||
MockContext context(clDevice.get());
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto buffer = clUniquePtr<Buffer>(Buffer::create(&context, CL_MEM_READ_WRITE, 1, nullptr, retVal));
|
||||
auto allocation = buffer->getGraphicsAllocation(clDevice->getRootDeviceIndex());
|
||||
|
||||
size_t offset = 0;
|
||||
{
|
||||
// 1D
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopyBuffer(allocation, allocation,
|
||||
0, 0, {BlitterConstants::maxBlitWidth - 1, 1, 1}, 0, 0, 0, 0, csr->getClearColorAllocation());
|
||||
blitBuffer(csr, blitProperties, false);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream);
|
||||
|
||||
auto bltCmd = genCmdCast<XY_COPY_BLT *>(*(hwParser.cmdList.begin()));
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
EXPECT_EQ(XY_COPY_BLT::SURFACE_TYPE::SURFACE_TYPE_SURFTYPE_1D, bltCmd->getDestinationSurfaceType());
|
||||
EXPECT_EQ(XY_COPY_BLT::SURFACE_TYPE::SURFACE_TYPE_SURFTYPE_1D, bltCmd->getSourceSurfaceType());
|
||||
|
||||
EXPECT_EQ(bltCmd->getSourceSurfaceWidth(), bltCmd->getDestinationX2CoordinateRight());
|
||||
EXPECT_EQ(bltCmd->getSourceSurfaceHeight(), bltCmd->getDestinationY2CoordinateBottom());
|
||||
|
||||
EXPECT_EQ(bltCmd->getDestinationSurfaceWidth(), bltCmd->getDestinationX2CoordinateRight());
|
||||
EXPECT_EQ(bltCmd->getDestinationSurfaceHeight(), bltCmd->getDestinationY2CoordinateBottom());
|
||||
|
||||
offset = csr->commandStream.getUsed();
|
||||
}
|
||||
|
||||
{
|
||||
// 2D
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopyBuffer(allocation, allocation,
|
||||
0, 0, {(2 * BlitterConstants::maxBlitWidth) + 1, 1, 1}, 0, 0, 0, 0, csr->getClearColorAllocation());
|
||||
blitBuffer(csr, blitProperties, false);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream, offset);
|
||||
|
||||
auto bltCmd = genCmdCast<XY_COPY_BLT *>(*(hwParser.cmdList.begin()));
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
EXPECT_EQ(XY_COPY_BLT::SURFACE_TYPE::SURFACE_TYPE_SURFTYPE_2D, bltCmd->getDestinationSurfaceType());
|
||||
EXPECT_EQ(XY_COPY_BLT::SURFACE_TYPE::SURFACE_TYPE_SURFTYPE_2D, bltCmd->getSourceSurfaceType());
|
||||
|
||||
EXPECT_EQ(bltCmd->getSourceSurfaceWidth(), bltCmd->getDestinationX2CoordinateRight());
|
||||
EXPECT_EQ(bltCmd->getSourceSurfaceHeight(), bltCmd->getDestinationY2CoordinateBottom());
|
||||
|
||||
EXPECT_EQ(bltCmd->getDestinationSurfaceWidth(), bltCmd->getDestinationX2CoordinateRight());
|
||||
EXPECT_EQ(bltCmd->getDestinationSurfaceHeight(), bltCmd->getDestinationY2CoordinateBottom());
|
||||
}
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(BlitXE_HP_CORETests, givenBufferWhenProgrammingBltCommandThenSetTargetMemory) {
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
|
||||
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(clDevice->getEngine(aub_stream::EngineType::ENGINE_BCS, EngineUsage::Regular).commandStreamReceiver);
|
||||
MockContext context(clDevice.get());
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto bufferInSystemPool = clUniquePtr<Buffer>(Buffer::create(&context, CL_MEM_FORCE_HOST_MEMORY_INTEL, 2048, nullptr, retVal));
|
||||
EXPECT_TRUE(MemoryPool::isSystemMemoryPool(bufferInSystemPool->getGraphicsAllocation(clDevice->getRootDeviceIndex())->getMemoryPool()));
|
||||
auto bufferInLocalPool = clUniquePtr<Buffer>(Buffer::create(&context, CL_MEM_READ_WRITE, 2048, nullptr, retVal));
|
||||
EXPECT_FALSE(MemoryPool::isSystemMemoryPool(bufferInLocalPool->getGraphicsAllocation(clDevice->getRootDeviceIndex())->getMemoryPool()));
|
||||
|
||||
{
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopyBuffer(bufferInSystemPool->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
bufferInLocalPool->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
0, 0, {2048, 1, 1}, 0, 0, 0, 0, csr->getClearColorAllocation());
|
||||
|
||||
blitBuffer(csr, blitProperties, true);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream);
|
||||
|
||||
auto bltCmd = genCmdCast<XY_COPY_BLT *>(*(hwParser.cmdList.begin()));
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
EXPECT_EQ(bltCmd->getSourceTargetMemory(), XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_LOCAL_MEM);
|
||||
EXPECT_EQ(bltCmd->getDestinationTargetMemory(), XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
}
|
||||
|
||||
{
|
||||
auto offset = csr->commandStream.getUsed();
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopyBuffer(bufferInLocalPool->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
bufferInSystemPool->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
0, 0, {2048, 1, 1}, 0, 0, 0, 0, csr->getClearColorAllocation());
|
||||
|
||||
blitBuffer(csr, blitProperties, true);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream, offset);
|
||||
|
||||
auto bltCmd = genCmdCast<XY_COPY_BLT *>(*(hwParser.cmdList.begin()));
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
EXPECT_EQ(bltCmd->getDestinationTargetMemory(), XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_LOCAL_MEM);
|
||||
EXPECT_EQ(bltCmd->getSourceTargetMemory(), XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
}
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(BlitXE_HP_CORETests, givenBufferWhenProgrammingBltCommandThenSetTargetMemoryInCpuAccesingLocalMemoryMode) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(1);
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
PLATFORM platform = clDevice->getHardwareInfo().platform;
|
||||
auto &hwHelper = HwHelper::get(platform.eRenderCoreFamily);
|
||||
const bool isXeHPRev0 = (platform.eProductFamily == IGFX_XE_HP_SDV) &&
|
||||
(hwHelper.getSteppingFromHwRevId(clDevice->getHardwareInfo()) < REVISION_B);
|
||||
|
||||
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(clDevice->getEngine(aub_stream::EngineType::ENGINE_BCS, EngineUsage::Regular).commandStreamReceiver);
|
||||
MockContext context(clDevice.get());
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto bufferInSystemPool = clUniquePtr<Buffer>(Buffer::create(&context, CL_MEM_FORCE_HOST_MEMORY_INTEL, 2048, nullptr, retVal));
|
||||
EXPECT_TRUE(MemoryPool::isSystemMemoryPool(bufferInSystemPool->getGraphicsAllocation(clDevice->getRootDeviceIndex())->getMemoryPool()));
|
||||
auto bufferInLocalPool = clUniquePtr<Buffer>(Buffer::create(&context, CL_MEM_READ_WRITE, 2048, nullptr, retVal));
|
||||
EXPECT_FALSE(MemoryPool::isSystemMemoryPool(bufferInLocalPool->getGraphicsAllocation(clDevice->getRootDeviceIndex())->getMemoryPool()));
|
||||
|
||||
{
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopyBuffer(bufferInSystemPool->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
bufferInLocalPool->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
0, 0, {2048, 1, 1}, 0, 0, 0, 0, csr->getClearColorAllocation());
|
||||
|
||||
blitBuffer(csr, blitProperties, true);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream);
|
||||
|
||||
auto bltCmd = genCmdCast<XY_COPY_BLT *>(*(hwParser.cmdList.begin()));
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
if (isXeHPRev0) {
|
||||
EXPECT_EQ(bltCmd->getSourceTargetMemory(), XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
} else {
|
||||
EXPECT_EQ(bltCmd->getSourceTargetMemory(), XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_LOCAL_MEM);
|
||||
}
|
||||
EXPECT_EQ(bltCmd->getDestinationTargetMemory(), XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
}
|
||||
|
||||
{
|
||||
auto offset = csr->commandStream.getUsed();
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopyBuffer(bufferInLocalPool->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
bufferInSystemPool->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
0, 0, {2048, 1, 1}, 0, 0, 0, 0, csr->getClearColorAllocation());
|
||||
|
||||
blitBuffer(csr, blitProperties, true);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream, offset);
|
||||
|
||||
auto bltCmd = genCmdCast<XY_COPY_BLT *>(*(hwParser.cmdList.begin()));
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
if (isXeHPRev0) {
|
||||
EXPECT_EQ(bltCmd->getDestinationTargetMemory(), XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
} else {
|
||||
EXPECT_EQ(bltCmd->getDestinationTargetMemory(), XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_LOCAL_MEM);
|
||||
}
|
||||
EXPECT_EQ(bltCmd->getSourceTargetMemory(), XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
}
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(BlitXE_HP_CORETests, givenBufferWhenProgrammingBltCommandThenSetTargetMemoryToSystemWhenDebugKeyPresent) {
|
||||
DebugManagerStateRestore restorer;
|
||||
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
|
||||
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(clDevice->getEngine(aub_stream::EngineType::ENGINE_BCS, EngineUsage::Regular).commandStreamReceiver);
|
||||
MockContext context(clDevice.get());
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto bufferInSystemPool = clUniquePtr<Buffer>(Buffer::create(&context, CL_MEM_FORCE_HOST_MEMORY_INTEL, 2048, nullptr, retVal));
|
||||
EXPECT_TRUE(MemoryPool::isSystemMemoryPool(bufferInSystemPool->getGraphicsAllocation(clDevice->getRootDeviceIndex())->getMemoryPool()));
|
||||
auto bufferInLocalPool = clUniquePtr<Buffer>(Buffer::create(&context, CL_MEM_READ_WRITE, 2048, nullptr, retVal));
|
||||
EXPECT_FALSE(MemoryPool::isSystemMemoryPool(bufferInLocalPool->getGraphicsAllocation(clDevice->getRootDeviceIndex())->getMemoryPool()));
|
||||
|
||||
DebugManager.flags.OverrideBlitterTargetMemory.set(0u);
|
||||
{
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopyBuffer(bufferInSystemPool->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
bufferInLocalPool->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
0, 0, {2048, 1, 1}, 0, 0, 0, 0, csr->getClearColorAllocation());
|
||||
|
||||
blitBuffer(csr, blitProperties, true);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream);
|
||||
|
||||
auto bltCmd = genCmdCast<XY_COPY_BLT *>(*(hwParser.cmdList.begin()));
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
EXPECT_EQ(bltCmd->getDestinationTargetMemory(), XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
EXPECT_EQ(bltCmd->getSourceTargetMemory(), XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
}
|
||||
DebugManager.flags.OverrideBlitterTargetMemory.set(1u);
|
||||
{
|
||||
auto offset = csr->commandStream.getUsed();
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopyBuffer(bufferInLocalPool->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
bufferInSystemPool->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
0, 0, {2048, 1, 1}, 0, 0, 0, 0, csr->getClearColorAllocation());
|
||||
|
||||
blitBuffer(csr, blitProperties, true);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream, offset);
|
||||
|
||||
auto bltCmd = genCmdCast<XY_COPY_BLT *>(*(hwParser.cmdList.begin()));
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
EXPECT_EQ(bltCmd->getDestinationTargetMemory(), XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_LOCAL_MEM);
|
||||
EXPECT_EQ(bltCmd->getSourceTargetMemory(), XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_LOCAL_MEM);
|
||||
}
|
||||
|
||||
DebugManager.flags.OverrideBlitterTargetMemory.set(2u);
|
||||
{
|
||||
auto offset = csr->commandStream.getUsed();
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopyBuffer(bufferInLocalPool->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
bufferInSystemPool->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
0, 0, {2048, 1, 1}, 0, 0, 0, 0, csr->getClearColorAllocation());
|
||||
|
||||
blitBuffer(csr, blitProperties, true);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream, offset);
|
||||
|
||||
auto bltCmd = genCmdCast<XY_COPY_BLT *>(*(hwParser.cmdList.begin()));
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
EXPECT_EQ(bltCmd->getDestinationTargetMemory(), XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_LOCAL_MEM);
|
||||
EXPECT_EQ(bltCmd->getSourceTargetMemory(), XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
}
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(BlitXE_HP_CORETests, givenBufferWhenProgrammingBltCommandAndRevisionB0ThenSetTargetMemory) {
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
HardwareInfo *hwInfo = clDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
auto &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
|
||||
hwInfo->platform.usRevId = hwHelper.getHwRevIdFromStepping(REVISION_B, *hwInfo);
|
||||
|
||||
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(clDevice->getEngine(aub_stream::EngineType::ENGINE_BCS, EngineUsage::Regular).commandStreamReceiver);
|
||||
MockContext context(clDevice.get());
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto bufferInSystemPool = clUniquePtr<Buffer>(Buffer::create(&context, CL_MEM_FORCE_HOST_MEMORY_INTEL, 2048, nullptr, retVal));
|
||||
EXPECT_TRUE(MemoryPool::isSystemMemoryPool(bufferInSystemPool->getGraphicsAllocation(clDevice->getRootDeviceIndex())->getMemoryPool()));
|
||||
auto bufferInLocalPool = clUniquePtr<Buffer>(Buffer::create(&context, CL_MEM_READ_WRITE, 2048, nullptr, retVal));
|
||||
EXPECT_FALSE(MemoryPool::isSystemMemoryPool(bufferInLocalPool->getGraphicsAllocation(clDevice->getRootDeviceIndex())->getMemoryPool()));
|
||||
|
||||
{
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopyBuffer(bufferInSystemPool->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
bufferInLocalPool->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
0, 0, {2048, 1, 1}, 0, 0, 0, 0, csr->getClearColorAllocation());
|
||||
|
||||
blitBuffer(csr, blitProperties, true);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream);
|
||||
|
||||
auto bltCmd = genCmdCast<XY_COPY_BLT *>(*(hwParser.cmdList.begin()));
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
EXPECT_EQ(bltCmd->getSourceTargetMemory(), XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_LOCAL_MEM);
|
||||
EXPECT_EQ(bltCmd->getDestinationTargetMemory(), XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
}
|
||||
|
||||
{
|
||||
auto offset = csr->commandStream.getUsed();
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopyBuffer(bufferInLocalPool->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
bufferInSystemPool->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
0, 0, {2048, 1, 1}, 0, 0, 0, 0, csr->getClearColorAllocation());
|
||||
|
||||
blitBuffer(csr, blitProperties, true);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream, offset);
|
||||
|
||||
auto bltCmd = genCmdCast<XY_COPY_BLT *>(*(hwParser.cmdList.begin()));
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
EXPECT_EQ(bltCmd->getDestinationTargetMemory(), XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_LOCAL_MEM);
|
||||
EXPECT_EQ(bltCmd->getSourceTargetMemory(), XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
}
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(BlitXE_HP_CORETests, givenDebugFlagSetWhenCompressionIsUsedThenForceCompressionEnableFields) {
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
auto blitCmd = FamilyType::cmdInitXyCopyBlt;
|
||||
|
||||
auto gmm = std::make_unique<MockGmm>();
|
||||
gmm->isCompressionEnabled = true;
|
||||
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast<void *>(0x1234),
|
||||
0x1000, 0, sizeof(uint32_t), MemoryPool::System4KBPages, mockMaxOsContextCount);
|
||||
mockAllocation.setGmm(gmm.get(), 0);
|
||||
|
||||
BlitProperties properties = {};
|
||||
properties.srcAllocation = &mockAllocation;
|
||||
properties.dstAllocation = &mockAllocation;
|
||||
properties.clearColorAllocation = &mockAllocation;
|
||||
|
||||
{
|
||||
DebugManager.flags.ForceCompressionDisabledForCompressedBlitCopies.set(1);
|
||||
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsForBuffer(properties, blitCmd, *clDevice->getExecutionEnvironment()->rootDeviceEnvironments[clDevice->getRootDeviceIndex()]);
|
||||
|
||||
EXPECT_EQ(blitCmd.getDestinationCompressionEnable(), XY_COPY_BLT::COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_ENABLE);
|
||||
EXPECT_EQ(blitCmd.getDestinationAuxiliarysurfacemode(), XY_COPY_BLT::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
|
||||
|
||||
EXPECT_EQ(blitCmd.getSourceCompressionEnable(), XY_COPY_BLT::COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_ENABLE);
|
||||
EXPECT_EQ(blitCmd.getSourceAuxiliarysurfacemode(), XY_COPY_BLT::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
|
||||
}
|
||||
|
||||
{
|
||||
DebugManager.flags.ForceCompressionDisabledForCompressedBlitCopies.set(0);
|
||||
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsForBuffer(properties, blitCmd, *clDevice->getExecutionEnvironment()->rootDeviceEnvironments[clDevice->getRootDeviceIndex()]);
|
||||
|
||||
EXPECT_EQ(blitCmd.getDestinationCompressionEnable(), XY_COPY_BLT::COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_DISABLE);
|
||||
EXPECT_EQ(blitCmd.getDestinationAuxiliarysurfacemode(), XY_COPY_BLT::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
|
||||
|
||||
EXPECT_EQ(blitCmd.getSourceCompressionEnable(), XY_COPY_BLT::COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_DISABLE);
|
||||
EXPECT_EQ(blitCmd.getSourceAuxiliarysurfacemode(), XY_COPY_BLT::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
|
||||
}
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(BlitXE_HP_CORETests, givenDebugFlagForClearColorNotSetWhenProgrammingBlitCommandForBuffersThenClearColorAddressIsNotProgrammed) {
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.UseClearColorAllocationForBlitter.set(false);
|
||||
auto blitCmd = FamilyType::cmdInitXyCopyBlt;
|
||||
|
||||
MockGraphicsAllocation mockAllocation;
|
||||
BlitProperties properties = {};
|
||||
properties.srcAllocation = &mockAllocation;
|
||||
properties.dstAllocation = &mockAllocation;
|
||||
properties.clearColorAllocation = &mockAllocation;
|
||||
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsForBuffer(properties, blitCmd, *clDevice->getExecutionEnvironment()->rootDeviceEnvironments[clDevice->getRootDeviceIndex()]);
|
||||
|
||||
EXPECT_EQ(blitCmd.getSourceClearValueEnable(), XY_COPY_BLT::CLEAR_VALUE_ENABLE::CLEAR_VALUE_ENABLE_DISABLE);
|
||||
EXPECT_EQ(0u, blitCmd.getSourceClearAddressLow());
|
||||
EXPECT_EQ(0u, blitCmd.getSourceClearAddressHigh());
|
||||
|
||||
EXPECT_EQ(blitCmd.getDestinationClearValueEnable(), XY_COPY_BLT::CLEAR_VALUE_ENABLE::CLEAR_VALUE_ENABLE_DISABLE);
|
||||
EXPECT_EQ(0u, blitCmd.getDestinationClearAddressLow());
|
||||
EXPECT_EQ(0u, blitCmd.getDestinationClearAddressHigh());
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(BlitXE_HP_CORETests, givenDebugFlagForClearColorSetWhenProgrammingBlitCommandForBuffersThenClearColorAddressIsProgrammed) {
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.UseClearColorAllocationForBlitter.set(true);
|
||||
auto blitCmd = FamilyType::cmdInitXyCopyBlt;
|
||||
|
||||
MockGraphicsAllocation mockAllocation;
|
||||
BlitProperties properties = {};
|
||||
properties.srcAllocation = &mockAllocation;
|
||||
properties.dstAllocation = &mockAllocation;
|
||||
properties.clearColorAllocation = &mockAllocation;
|
||||
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsForBuffer(properties, blitCmd, *clDevice->getExecutionEnvironment()->rootDeviceEnvironments[clDevice->getRootDeviceIndex()]);
|
||||
|
||||
auto addressLow = static_cast<uint32_t>(mockAllocation.getGpuAddress() & 0xFFFFFFFFULL);
|
||||
auto addressHigh = static_cast<uint32_t>(mockAllocation.getGpuAddress() >> 32);
|
||||
|
||||
EXPECT_EQ(blitCmd.getSourceClearValueEnable(), XY_COPY_BLT::CLEAR_VALUE_ENABLE::CLEAR_VALUE_ENABLE_ENABLE);
|
||||
EXPECT_EQ(addressLow, blitCmd.getSourceClearAddressLow());
|
||||
EXPECT_EQ(addressHigh, blitCmd.getSourceClearAddressHigh());
|
||||
|
||||
EXPECT_EQ(blitCmd.getDestinationClearValueEnable(), XY_COPY_BLT::CLEAR_VALUE_ENABLE::CLEAR_VALUE_ENABLE_ENABLE);
|
||||
EXPECT_EQ(addressLow, blitCmd.getDestinationClearAddressLow());
|
||||
EXPECT_EQ(addressHigh, blitCmd.getDestinationClearAddressHigh());
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(BlitXE_HP_CORETests, givenDebugFlagForClearColorNotSetWhenProgrammingBlitCommandForImagesThenClearColorAddressIsNotProgrammed) {
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.UseClearColorAllocationForBlitter.set(false);
|
||||
auto blitCmd = FamilyType::cmdInitXyCopyBlt;
|
||||
|
||||
MockGraphicsAllocation mockAllocation;
|
||||
BlitProperties properties = {};
|
||||
properties.srcAllocation = &mockAllocation;
|
||||
properties.dstAllocation = &mockAllocation;
|
||||
properties.clearColorAllocation = &mockAllocation;
|
||||
uint32_t srcSlicePitch = 0u;
|
||||
uint32_t dstSlicePitch = 0u;
|
||||
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsForImages(properties, blitCmd, *clDevice->getExecutionEnvironment()->rootDeviceEnvironments[clDevice->getRootDeviceIndex()], srcSlicePitch, dstSlicePitch);
|
||||
|
||||
EXPECT_EQ(blitCmd.getSourceClearValueEnable(), XY_COPY_BLT::CLEAR_VALUE_ENABLE::CLEAR_VALUE_ENABLE_DISABLE);
|
||||
EXPECT_EQ(0u, blitCmd.getSourceClearAddressLow());
|
||||
EXPECT_EQ(0u, blitCmd.getSourceClearAddressHigh());
|
||||
|
||||
EXPECT_EQ(blitCmd.getDestinationClearValueEnable(), XY_COPY_BLT::CLEAR_VALUE_ENABLE::CLEAR_VALUE_ENABLE_DISABLE);
|
||||
EXPECT_EQ(0u, blitCmd.getDestinationClearAddressLow());
|
||||
EXPECT_EQ(0u, blitCmd.getDestinationClearAddressHigh());
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(BlitXE_HP_CORETests, givenDebugFlagForClearColorSetWhenProgrammingBlitCommandForImagesThenClearColorAddressIsProgrammed) {
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.UseClearColorAllocationForBlitter.set(true);
|
||||
auto blitCmd = FamilyType::cmdInitXyCopyBlt;
|
||||
|
||||
MockGraphicsAllocation mockAllocation;
|
||||
BlitProperties properties = {};
|
||||
properties.srcAllocation = &mockAllocation;
|
||||
properties.dstAllocation = &mockAllocation;
|
||||
properties.clearColorAllocation = &mockAllocation;
|
||||
uint32_t srcSlicePitch = 0;
|
||||
uint32_t dstSlicePitch = 0;
|
||||
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsForImages(properties, blitCmd, *clDevice->getExecutionEnvironment()->rootDeviceEnvironments[clDevice->getRootDeviceIndex()], srcSlicePitch, dstSlicePitch);
|
||||
|
||||
auto addressLow = static_cast<uint32_t>(mockAllocation.getGpuAddress() & 0xFFFFFFFFULL);
|
||||
auto addressHigh = static_cast<uint32_t>(mockAllocation.getGpuAddress() >> 32);
|
||||
|
||||
EXPECT_EQ(blitCmd.getSourceClearValueEnable(), XY_COPY_BLT::CLEAR_VALUE_ENABLE::CLEAR_VALUE_ENABLE_ENABLE);
|
||||
EXPECT_EQ(addressLow, blitCmd.getSourceClearAddressLow());
|
||||
EXPECT_EQ(addressHigh, blitCmd.getSourceClearAddressHigh());
|
||||
|
||||
EXPECT_EQ(blitCmd.getDestinationClearValueEnable(), XY_COPY_BLT::CLEAR_VALUE_ENABLE::CLEAR_VALUE_ENABLE_ENABLE);
|
||||
EXPECT_EQ(addressLow, blitCmd.getDestinationClearAddressLow());
|
||||
EXPECT_EQ(addressHigh, blitCmd.getDestinationClearAddressHigh());
|
||||
}
|
263
opencl/test/unit_test/xe_hp_core/hw_helper_tests_xe_hp_core.cpp
Normal file
263
opencl/test/unit_test/xe_hp_core/hw_helper_tests_xe_hp_core.cpp
Normal file
@ -0,0 +1,263 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
|
||||
#include "opencl/source/helpers/cl_hw_helper.h"
|
||||
#include "opencl/source/program/kernel_info.h"
|
||||
#include "opencl/test/unit_test/helpers/hw_helper_tests.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_hw_helper.h"
|
||||
|
||||
using HwHelperTestXE_HP_CORE = HwHelperTest;
|
||||
|
||||
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenGenHelperWhenKernelArgumentIsNotPureStatefulThenRequireNonAuxMode) {
|
||||
auto &clHwHelper = ClHwHelper::get(renderCoreFamily);
|
||||
|
||||
for (auto isPureStateful : {false, true}) {
|
||||
ArgDescPointer argAsPtr{};
|
||||
argAsPtr.accessedUsingStatelessAddressingMode = !isPureStateful;
|
||||
|
||||
EXPECT_EQ(!argAsPtr.isPureStateful(), clHwHelper.requiresNonAuxMode(argAsPtr));
|
||||
}
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenGenHelperWhenEnableStatelessCompressionThenDontRequireNonAuxMode) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.EnableStatelessCompression.set(true);
|
||||
|
||||
auto &clHwHelper = ClHwHelper::get(renderCoreFamily);
|
||||
|
||||
for (auto isPureStateful : {false, true}) {
|
||||
ArgDescPointer argAsPtr{};
|
||||
argAsPtr.accessedUsingStatelessAddressingMode = !isPureStateful;
|
||||
EXPECT_FALSE(clHwHelper.requiresNonAuxMode(argAsPtr));
|
||||
}
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenXE_HP_COREThenAuxTranslationIsRequired) {
|
||||
auto &clHwHelper = ClHwHelper::get(renderCoreFamily);
|
||||
|
||||
for (auto isPureStateful : {false, true}) {
|
||||
KernelInfo kernelInfo{};
|
||||
kernelInfo.kernelDescriptor.payloadMappings.explicitArgs.resize(1);
|
||||
kernelInfo.kernelDescriptor.payloadMappings.explicitArgs[0].as<ArgDescPointer>(true).accessedUsingStatelessAddressingMode = !isPureStateful;
|
||||
EXPECT_EQ(!isPureStateful, clHwHelper.requiresAuxResolves(kernelInfo));
|
||||
}
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenXE_HP_COREWhenEnableStatelessCompressionThenAuxTranslationIsNotRequired) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.EnableStatelessCompression.set(true);
|
||||
|
||||
auto &clHwHelper = ClHwHelper::get(renderCoreFamily);
|
||||
KernelInfo kernelInfo{};
|
||||
|
||||
EXPECT_FALSE(clHwHelper.requiresAuxResolves(kernelInfo));
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenDifferentBufferSizesWhenEnableStatelessCompressionThenEveryBufferSizeIsSuitableForRenderCompression) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.EnableStatelessCompression.set(1);
|
||||
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
|
||||
const size_t sizesToCheck[] = {1, 128, 256, 1024, 2048};
|
||||
for (size_t size : sizesToCheck) {
|
||||
EXPECT_TRUE(helper.isBufferSizeSuitableForRenderCompression(size));
|
||||
}
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenRevisionEnumAndPlatformFamilyTypeThenProperValueForIsWorkaroundRequiredIsReturned) {
|
||||
std::vector<unsigned short> steppings;
|
||||
PRODUCT_FAMILY productFamilies[] = {IGFX_XE_HP_SDV, IGFX_TIGERLAKE_LP, IGFX_UNKNOWN};
|
||||
|
||||
for (auto productFamily : productFamilies) {
|
||||
hardwareInfo.platform.eProductFamily = productFamily;
|
||||
steppings.push_back(0x0);
|
||||
steppings.push_back(0x1);
|
||||
steppings.push_back(0x4);
|
||||
steppings.push_back(0x5);
|
||||
|
||||
for (auto stepping : steppings) {
|
||||
hardwareInfo.platform.usRevId = stepping;
|
||||
HwHelper &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
|
||||
|
||||
if (hardwareInfo.platform.eProductFamily == IGFX_XE_HP_SDV) {
|
||||
if (stepping == 0x0) { //A0
|
||||
EXPECT_TRUE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo));
|
||||
EXPECT_TRUE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo));
|
||||
EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_B, REVISION_A0, hardwareInfo));
|
||||
} else if (stepping == 0x1) { //A1
|
||||
EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo));
|
||||
} else if (stepping == 0x4 || stepping == 0x5) { //B0, undefined
|
||||
EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo));
|
||||
}
|
||||
} else {
|
||||
EXPECT_FALSE(hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo));
|
||||
}
|
||||
}
|
||||
steppings.clear();
|
||||
}
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenDisablePipeControlFlagIsDefaultWhenLocalMemoryIsEnabledThenReturnFalseAndDoNotProgramPipeControl) {
|
||||
hardwareInfo.featureTable.ftrLocalMemory = true;
|
||||
|
||||
EXPECT_FALSE(MemorySynchronizationCommands<FamilyType>::isPipeControlWArequired(hardwareInfo));
|
||||
|
||||
constexpr size_t bufferSize = 128u;
|
||||
uint8_t buffer[bufferSize];
|
||||
LinearStream cmdStream(buffer, bufferSize);
|
||||
MemorySynchronizationCommands<FamilyType>::addPipeControlWA(cmdStream, 0x1000, hardwareInfo);
|
||||
EXPECT_EQ(0u, cmdStream.getUsed());
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenDisablePipeControlFlagIsDisabledWhenLocalMemoryIsEnabledThenReturnFalseAndDoNotProgramPipeControl) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.DisablePipeControlPrecedingPostSyncCommand.set(0);
|
||||
|
||||
hardwareInfo.featureTable.ftrLocalMemory = true;
|
||||
EXPECT_FALSE(MemorySynchronizationCommands<FamilyType>::isPipeControlWArequired(hardwareInfo));
|
||||
|
||||
constexpr size_t bufferSize = 128u;
|
||||
uint8_t buffer[bufferSize];
|
||||
LinearStream cmdStream(buffer, bufferSize);
|
||||
MemorySynchronizationCommands<FamilyType>::addPipeControlWA(cmdStream, 0x1000, hardwareInfo);
|
||||
EXPECT_EQ(0u, cmdStream.getUsed());
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenDisablePipeControlFlagIsEnabledWhenLocalMemoryIsEnabledThenReturnTrueAndProgramPipeControl) {
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.DisablePipeControlPrecedingPostSyncCommand.set(1);
|
||||
|
||||
hardwareInfo.featureTable.ftrLocalMemory = true;
|
||||
EXPECT_TRUE(MemorySynchronizationCommands<FamilyType>::isPipeControlWArequired(hardwareInfo));
|
||||
|
||||
constexpr size_t bufferSize = 128u;
|
||||
uint8_t buffer[bufferSize];
|
||||
LinearStream cmdStream(buffer, bufferSize);
|
||||
MemorySynchronizationCommands<FamilyType>::addPipeControlWA(cmdStream, 0x1000, hardwareInfo);
|
||||
EXPECT_EQ(sizeof(PIPE_CONTROL), cmdStream.getUsed());
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenDisablePipeControlFlagIsEnabledWhenLocalMemoryIsDisabledThenReturnTrueAndDoNotProgramPipeControl) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.DisablePipeControlPrecedingPostSyncCommand.set(1);
|
||||
|
||||
hardwareInfo.featureTable.ftrLocalMemory = false;
|
||||
EXPECT_FALSE(MemorySynchronizationCommands<FamilyType>::isPipeControlWArequired(hardwareInfo));
|
||||
|
||||
constexpr size_t bufferSize = 128u;
|
||||
uint8_t buffer[bufferSize];
|
||||
LinearStream cmdStream(buffer, bufferSize);
|
||||
MemorySynchronizationCommands<FamilyType>::addPipeControlWA(cmdStream, 0x1000, hardwareInfo);
|
||||
EXPECT_EQ(0u, cmdStream.getUsed());
|
||||
}
|
||||
|
||||
using HwInfoConfigTestXE_HP_CORE = ::testing::Test;
|
||||
|
||||
XE_HP_CORE_TEST_F(HwInfoConfigTestXE_HP_CORE, givenDebugVariableSetWhenConfigureIsCalledThenSetupBlitterOperationsSupportedFlag) {
|
||||
DebugManagerStateRestore restore;
|
||||
auto hwInfoConfig = HwInfoConfig::get(productFamily);
|
||||
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
|
||||
DebugManager.flags.EnableBlitterOperationsSupport.set(0);
|
||||
hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr);
|
||||
EXPECT_FALSE(hwInfo.capabilityTable.blitterOperationsSupported);
|
||||
|
||||
DebugManager.flags.EnableBlitterOperationsSupport.set(1);
|
||||
hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr);
|
||||
EXPECT_TRUE(hwInfo.capabilityTable.blitterOperationsSupported);
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(HwInfoConfigTestXE_HP_CORE, givenMultitileConfigWhenConfiguringHwInfoThenEnableBlitter) {
|
||||
auto hwInfoConfig = HwInfoConfig::get(productFamily);
|
||||
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
|
||||
for (uint32_t tileCount = 0; tileCount <= 4; tileCount++) {
|
||||
hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = tileCount;
|
||||
hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr);
|
||||
|
||||
EXPECT_EQ(true, hwInfo.capabilityTable.blitterOperationsSupported);
|
||||
}
|
||||
}
|
||||
|
||||
using XE_HP_CORERenderSurfaceStateDataTests = ::testing::Test;
|
||||
|
||||
XE_HP_CORE_TEST_F(XE_HP_CORERenderSurfaceStateDataTests, WhenMemoryObjectControlStateIndexToMocsTablesIsSetThenValueIsShift) {
|
||||
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
||||
auto surfaceState = FamilyType::cmdInitRenderSurfaceState;
|
||||
|
||||
uint32_t value = 4;
|
||||
surfaceState.setMemoryObjectControlStateIndexToMocsTables(value);
|
||||
|
||||
EXPECT_EQ(surfaceState.TheStructure.Common.MemoryObjectControlStateIndexToMocsTables, value >> 1);
|
||||
EXPECT_EQ(surfaceState.getMemoryObjectControlStateIndexToMocsTables(), value);
|
||||
}
|
||||
|
||||
using LriHelperTestsXE_HP_CORE = ::testing::Test;
|
||||
|
||||
XE_HP_CORE_TEST_F(LriHelperTestsXE_HP_CORE, whenProgrammingLriCommandThenExpectMmioRemapEnableCorrectlySet) {
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
std::unique_ptr<uint8_t> buffer(new uint8_t[128]);
|
||||
|
||||
LinearStream stream(buffer.get(), 128);
|
||||
uint32_t address = 0x8888;
|
||||
uint32_t data = 0x1234;
|
||||
|
||||
auto expectedLri = FamilyType::cmdInitLoadRegisterImm;
|
||||
EXPECT_FALSE(expectedLri.getMmioRemapEnable());
|
||||
expectedLri.setRegisterOffset(address);
|
||||
expectedLri.setDataDword(data);
|
||||
expectedLri.setMmioRemapEnable(true);
|
||||
|
||||
LriHelper<FamilyType>::program(&stream, address, data, true);
|
||||
MI_LOAD_REGISTER_IMM *lri = genCmdCast<MI_LOAD_REGISTER_IMM *>(buffer.get());
|
||||
ASSERT_NE(nullptr, lri);
|
||||
|
||||
EXPECT_EQ(sizeof(MI_LOAD_REGISTER_IMM), stream.getUsed());
|
||||
EXPECT_EQ(lri, stream.getCpuBase());
|
||||
EXPECT_TRUE(memcmp(lri, &expectedLri, sizeof(MI_LOAD_REGISTER_IMM)) == 0);
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, GivenVariousValuesWhenAlignSlmSizeIsCalledThenCorrectValueIsReturned) {
|
||||
EXPECT_EQ(0u, HwHelperHw<FamilyType>::get().alignSlmSize(0));
|
||||
EXPECT_EQ(1024u, HwHelperHw<FamilyType>::get().alignSlmSize(1));
|
||||
EXPECT_EQ(1024u, HwHelperHw<FamilyType>::get().alignSlmSize(1024));
|
||||
EXPECT_EQ(2048u, HwHelperHw<FamilyType>::get().alignSlmSize(1025));
|
||||
EXPECT_EQ(2048u, HwHelperHw<FamilyType>::get().alignSlmSize(2048));
|
||||
EXPECT_EQ(4096u, HwHelperHw<FamilyType>::get().alignSlmSize(2049));
|
||||
EXPECT_EQ(4096u, HwHelperHw<FamilyType>::get().alignSlmSize(4096));
|
||||
EXPECT_EQ(8192u, HwHelperHw<FamilyType>::get().alignSlmSize(4097));
|
||||
EXPECT_EQ(8192u, HwHelperHw<FamilyType>::get().alignSlmSize(8192));
|
||||
EXPECT_EQ(16384u, HwHelperHw<FamilyType>::get().alignSlmSize(8193));
|
||||
EXPECT_EQ(16384u, HwHelperHw<FamilyType>::get().alignSlmSize(16384));
|
||||
EXPECT_EQ(32768u, HwHelperHw<FamilyType>::get().alignSlmSize(16385));
|
||||
EXPECT_EQ(32768u, HwHelperHw<FamilyType>::get().alignSlmSize(32768));
|
||||
EXPECT_EQ(65536u, HwHelperHw<FamilyType>::get().alignSlmSize(32769));
|
||||
EXPECT_EQ(65536u, HwHelperHw<FamilyType>::get().alignSlmSize(65536));
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenHwHelperWhenGettingThreadsPerEUConfigsThenCorrectConfigsAreReturned) {
|
||||
auto &helper = HwHelper::get(pDevice->getHardwareInfo().platform.eRenderCoreFamily);
|
||||
EXPECT_NE(nullptr, &helper);
|
||||
|
||||
auto &configs = helper.getThreadsPerEUConfigs();
|
||||
|
||||
EXPECT_EQ(2U, configs.size());
|
||||
EXPECT_EQ(4U, configs[0]);
|
||||
EXPECT_EQ(8U, configs[1]);
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, WhenGettingDeviceIpVersionThenMakeCorrectDeviceIpVersion) {
|
||||
EXPECT_EQ(ClHwHelperMock::makeDeviceIpVersion(12, 5, 1), ClHwHelper::get(renderCoreFamily).getDeviceIpVersion(*defaultHwInfo));
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/source/helpers/state_base_address.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/unit_test/preamble/preamble_fixture.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/ult_command_stream_receiver_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
using CmdsProgrammingTestsXeHpCore = UltCommandStreamReceiverTest;
|
||||
XE_HP_CORE_TEST_F(CmdsProgrammingTestsXeHpCore, givenL1CachingOverrideWhenStateBaseAddressIsProgrammedThenItMatchesTheOverrideValue) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(0u);
|
||||
auto memoryManager = pDevice->getExecutionEnvironment()->memoryManager.get();
|
||||
AllocationProperties properties(pDevice->getRootDeviceIndex(), 1, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield());
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
|
||||
|
||||
IndirectHeap indirectHeap(allocation, 1);
|
||||
DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||
auto sbaCmd = FamilyType::cmdInitStateBaseAddress;
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(&sbaCmd, &indirectHeap, true, 0,
|
||||
pDevice->getRootDeviceEnvironment().getGmmHelper(), false,
|
||||
MemoryCompressionState::NotApplicable, true, false, 1u);
|
||||
|
||||
EXPECT_EQ(0u, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(1u);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(&sbaCmd, &indirectHeap, true, 0,
|
||||
pDevice->getRootDeviceEnvironment().getGmmHelper(), false,
|
||||
MemoryCompressionState::NotApplicable, true, false, 1u);
|
||||
|
||||
EXPECT_EQ(1u, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(CmdsProgrammingTestsXeHpCore, givenInterfaceDescriptorDataWhenBSteppingIsDetectedThenTGBatchSizeIsEqualTo3) {
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
|
||||
|
||||
INTERFACE_DESCRIPTOR_DATA iddArg;
|
||||
iddArg = FamilyType::cmdInitInterfaceDescriptorData;
|
||||
|
||||
pDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->platform.usRevId = REVISION_B;
|
||||
|
||||
EncodeDispatchKernel<FamilyType>::adjustInterfaceDescriptorData(iddArg, pDevice->getHardwareInfo());
|
||||
EXPECT_EQ(3u, iddArg.getThreadGroupDispatchSize());
|
||||
}
|
||||
|
||||
using PreambleCfeState = PreambleFixture;
|
||||
|
||||
XE_HP_CORE_TEST_F(PreambleCfeState, givenXehpBSteppingWhenCfeIsProgrammedThenOverdispatchIsDisabled) {
|
||||
using CFE_STATE = typename FamilyType::CFE_STATE;
|
||||
|
||||
auto backup = defaultHwInfo->platform.usRevId;
|
||||
defaultHwInfo->platform.usRevId = REVISION_B;
|
||||
|
||||
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
|
||||
StreamProperties streamProperties{};
|
||||
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, 0, 0, AdditionalKernelExecInfo::NotApplicable, streamProperties);
|
||||
parseCommands<FamilyType>(linearStream);
|
||||
auto cfeStateIt = find<CFE_STATE *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_NE(cmdList.end(), cfeStateIt);
|
||||
auto cfeState = reinterpret_cast<CFE_STATE *>(*cfeStateIt);
|
||||
|
||||
EXPECT_TRUE(cfeState->getComputeOverdispatchDisable());
|
||||
defaultHwInfo->platform.usRevId = backup;
|
||||
}
|
166
opencl/test/unit_test/xe_hp_core/test_device_caps_xe_hp_core.cpp
Normal file
166
opencl/test/unit_test/xe_hp_core/test_device_caps_xe_hp_core.cpp
Normal file
@ -0,0 +1,166 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
typedef Test<ClDeviceFixture> XE_HP_COREDeviceCaps;
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XE_HP_COREDeviceCaps, givenKernelWhenCanTransformImagesIsCalledThenReturnsTrue) {
|
||||
MockKernelWithInternals mockKernel(*pClDevice);
|
||||
auto retVal = mockKernel.mockKernel->Kernel::canTransformImages();
|
||||
EXPECT_FALSE(retVal);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XE_HP_COREDeviceCaps, givenKernelThatDoesStatelessWritesWhenItIsCreatedThenItHasProperFieldSet) {
|
||||
MockKernelWithInternals mockKernel(*pClDevice);
|
||||
mockKernel.mockKernel->initialize();
|
||||
bool statelessWritesEmitted = mockKernel.mockKernel->getKernelInfo().kernelDescriptor.kernelAttributes.flags.usesStatelessWrites;
|
||||
EXPECT_EQ(statelessWritesEmitted, mockKernel.mockKernel->areStatelessWritesUsed());
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(XE_HP_COREDeviceCaps, givenXE_HP_COREWhenCheckFtrSupportsInteger64BitAtomicsThenReturnTrue) {
|
||||
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsInteger64BitAtomics);
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(XE_HP_COREDeviceCaps, givenXE_HP_COREWhenCheckingImageSupportThenReturnTrue) {
|
||||
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.supportsImages);
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(XE_HP_COREDeviceCaps, givenXE_HP_COREWhenCheckingCoherencySupportThenReturnFalse) {
|
||||
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsCoherency);
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(XE_HP_COREDeviceCaps, givenXE_HP_COREWhenCheckExtensionsThenDeviceDoesNotReportClKhrSubgroupsExtension) {
|
||||
const auto &caps = pClDevice->getDeviceInfo();
|
||||
|
||||
EXPECT_THAT(caps.deviceExtensions, ::testing::Not(testing::HasSubstr(std::string("cl_khr_subgroups"))));
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(XE_HP_COREDeviceCaps, givenXE_HP_COREWhenDeviceCapsInitializedThenAddXE_HP_COREExtensions) {
|
||||
const auto &caps = pClDevice->getDeviceInfo();
|
||||
|
||||
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_dot_accumulate")));
|
||||
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_subgroup_local_block_io")));
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(XE_HP_COREDeviceCaps, givenXE_HP_COREWhenCheckingCapsThenDeviceDoesNotSupportIndependentForwardProgress) {
|
||||
const auto &caps = pClDevice->getDeviceInfo();
|
||||
|
||||
EXPECT_FALSE(caps.independentForwardProgress);
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(XE_HP_COREDeviceCaps, givenEnabledFtrPooledEuAndA0SteppingWhenCalculatingMaxEuPerSSThenDontIgnoreEuCountPerPoolMin) {
|
||||
HardwareInfo myHwInfo = *defaultHwInfo;
|
||||
GT_SYSTEM_INFO &mySysInfo = myHwInfo.gtSystemInfo;
|
||||
FeatureTable &mySkuTable = myHwInfo.featureTable;
|
||||
PLATFORM &myPlatform = myHwInfo.platform;
|
||||
auto &hwHelper = HwHelper::get(myPlatform.eRenderCoreFamily);
|
||||
|
||||
mySysInfo.EUCount = 20;
|
||||
mySysInfo.EuCountPerPoolMin = 99999;
|
||||
mySkuTable.ftrPooledEuEnabled = 1;
|
||||
myPlatform.usRevId = hwHelper.getHwRevIdFromStepping(REVISION_A0, myHwInfo);
|
||||
|
||||
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&myHwInfo));
|
||||
|
||||
auto expectedMaxWGS = mySysInfo.EuCountPerPoolMin * (mySysInfo.ThreadCount / mySysInfo.EUCount) * 8;
|
||||
expectedMaxWGS = std::min(Math::prevPowerOfTwo(expectedMaxWGS), 512u);
|
||||
|
||||
EXPECT_EQ(expectedMaxWGS, device->getDeviceInfo().maxWorkGroupSize);
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(XE_HP_COREDeviceCaps, givenDeviceThatHasHighNumberOfExecutionUnitsAndA0SteppingWhenMaxWorkgroupSizeIsComputedThenItIsLimitedTo512) {
|
||||
HardwareInfo myHwInfo = *defaultHwInfo;
|
||||
GT_SYSTEM_INFO &mySysInfo = myHwInfo.gtSystemInfo;
|
||||
PLATFORM &myPlatform = myHwInfo.platform;
|
||||
auto &hwHelper = HwHelper::get(myPlatform.eRenderCoreFamily);
|
||||
|
||||
mySysInfo.EUCount = 32;
|
||||
mySysInfo.SubSliceCount = 2;
|
||||
mySysInfo.DualSubSliceCount = 2;
|
||||
mySysInfo.ThreadCount = 32 * 8;
|
||||
myPlatform.usRevId = hwHelper.getHwRevIdFromStepping(REVISION_A0, myHwInfo);
|
||||
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&myHwInfo));
|
||||
|
||||
EXPECT_EQ(512u, device->sharedDeviceInfo.maxWorkGroupSize);
|
||||
EXPECT_EQ(device->sharedDeviceInfo.maxWorkGroupSize / 8, device->getDeviceInfo().maxNumOfSubGroups);
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(XE_HP_COREDeviceCaps, givenEnabledFtrPooledEuAndNotA0SteppingWhenCalculatingMaxEuPerSSThenDontIgnoreEuCountPerPoolMin) {
|
||||
HardwareInfo myHwInfo = *defaultHwInfo;
|
||||
GT_SYSTEM_INFO &mySysInfo = myHwInfo.gtSystemInfo;
|
||||
FeatureTable &mySkuTable = myHwInfo.featureTable;
|
||||
PLATFORM &myPlatform = myHwInfo.platform;
|
||||
auto &hwHelper = HwHelper::get(myPlatform.eRenderCoreFamily);
|
||||
|
||||
mySysInfo.EUCount = 20;
|
||||
mySysInfo.EuCountPerPoolMin = 99999;
|
||||
mySkuTable.ftrPooledEuEnabled = 1;
|
||||
myPlatform.usRevId = hwHelper.getHwRevIdFromStepping(REVISION_B, myHwInfo);
|
||||
|
||||
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&myHwInfo));
|
||||
|
||||
auto expectedMaxWGS = mySysInfo.EuCountPerPoolMin * (mySysInfo.ThreadCount / mySysInfo.EUCount) * 8;
|
||||
expectedMaxWGS = std::min(Math::prevPowerOfTwo(expectedMaxWGS), 1024u);
|
||||
|
||||
EXPECT_EQ(expectedMaxWGS, device->getDeviceInfo().maxWorkGroupSize);
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(XE_HP_COREDeviceCaps, givenDeviceThatHasHighNumberOfExecutionUnitsAndNotA0SteppingWhenMaxWorkgroupSizeIsComputedThenItIsLimitedTo1024) {
|
||||
HardwareInfo myHwInfo = *defaultHwInfo;
|
||||
GT_SYSTEM_INFO &mySysInfo = myHwInfo.gtSystemInfo;
|
||||
PLATFORM &myPlatform = myHwInfo.platform;
|
||||
auto &hwHelper = HwHelper::get(myPlatform.eRenderCoreFamily);
|
||||
|
||||
mySysInfo.EUCount = 32;
|
||||
mySysInfo.SubSliceCount = 2;
|
||||
mySysInfo.DualSubSliceCount = 2;
|
||||
mySysInfo.ThreadCount = 32 * 8; // 128 threads per subslice, in simd 8 gives 1024
|
||||
myPlatform.usRevId = hwHelper.getHwRevIdFromStepping(REVISION_B, myHwInfo);
|
||||
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&myHwInfo));
|
||||
|
||||
EXPECT_EQ(1024u, device->sharedDeviceInfo.maxWorkGroupSize);
|
||||
EXPECT_EQ(device->sharedDeviceInfo.maxWorkGroupSize / 8, device->getDeviceInfo().maxNumOfSubGroups);
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(XE_HP_COREDeviceCaps, givenHwInfoWhenRequestedComputeUnitsUsedForScratchAndMaxSubSlicesSupportedIsSmallerThanMinMaxSubSlicesSupportedThenReturnValidValue) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
GT_SYSTEM_INFO &testSysInfo = hwInfo.gtSystemInfo;
|
||||
testSysInfo.MaxSubSlicesSupported = 24;
|
||||
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
uint32_t minMaxSubSlicesSupported = 32;
|
||||
uint32_t minCalculation = minMaxSubSlicesSupported * hwInfo.gtSystemInfo.MaxEuPerSubSlice *
|
||||
hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount;
|
||||
|
||||
EXPECT_LE(testSysInfo.MaxSubSlicesSupported, minMaxSubSlicesSupported);
|
||||
EXPECT_EQ(minCalculation, hwHelper.getComputeUnitsUsedForScratch(&hwInfo));
|
||||
}
|
||||
XE_HP_CORE_TEST_F(XE_HP_COREDeviceCaps, givenHwInfoWhenRequestedComputeUnitsUsedForScratchAndMaxSubSlicesSupportedIsGreaterThanMinMaxSubSlicesSupportedThenReturnValidValue) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
GT_SYSTEM_INFO &testSysInfo = hwInfo.gtSystemInfo;
|
||||
testSysInfo.MaxSubSlicesSupported = 40;
|
||||
|
||||
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
uint32_t minMaxSubSlicesSupported = 32;
|
||||
uint32_t minCalculation = minMaxSubSlicesSupported * hwInfo.gtSystemInfo.MaxEuPerSubSlice *
|
||||
hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount;
|
||||
uint32_t properCalculation = testSysInfo.MaxSubSlicesSupported * hwInfo.gtSystemInfo.MaxEuPerSubSlice *
|
||||
hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount;
|
||||
|
||||
EXPECT_GT(testSysInfo.MaxSubSlicesSupported, minMaxSubSlicesSupported);
|
||||
EXPECT_GT(properCalculation, minCalculation);
|
||||
EXPECT_EQ(properCalculation, hwHelper.getComputeUnitsUsedForScratch(&hwInfo));
|
||||
}
|
||||
|
||||
HWTEST_EXCLUDE_PRODUCT(DeviceGetCapsTest, givenEnabledFtrPooledEuWhenCalculatingMaxEuPerSSThenDontIgnoreEuCountPerPoolMin, IGFX_XE_HP_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(DeviceGetCapsTest, givenDeviceThatHasHighNumberOfExecutionUnitsWhenMaxWorkgroupSizeIsComputedItIsLimitedTo1024, IGFX_XE_HP_CORE);
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/platform_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct XE_HP_COREPlatformCaps : public PlatformFixture, public ::testing::Test {
|
||||
void SetUp() override {
|
||||
PlatformFixture::SetUp();
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
PlatformFixture::TearDown();
|
||||
}
|
||||
};
|
||||
|
||||
HWTEST2_F(XE_HP_COREPlatformCaps, givenXeHPSkusThenItSupportFP64, IsXEHP) {
|
||||
const auto &caps = pPlatform->getPlatformInfo();
|
||||
|
||||
EXPECT_NE(std::string::npos, caps.extensions.find(std::string("cl_khr_fp64")));
|
||||
}
|
17
opencl/test/unit_test/xe_hp_core/test_sample_xe_hp_core.cpp
Normal file
17
opencl/test/unit_test/xe_hp_core/test_sample_xe_hp_core.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
typedef Test<ClDeviceFixture> XE_HP_COREOnlyTest;
|
||||
|
||||
XE_HP_CORE_TEST_F(XE_HP_COREOnlyTest, WhenGettingRenderCoreFamilyThenOnlyXeHpCoreIsReturned) {
|
||||
EXPECT_EQ(IGFX_XE_HP_CORE, pDevice->getRenderCoreFamily());
|
||||
}
|
29
opencl/test/unit_test/xe_hp_core/xehp/CMakeLists.txt
Normal file
29
opencl/test/unit_test/xe_hp_core/xehp/CMakeLists.txt
Normal file
@ -0,0 +1,29 @@
|
||||
#
|
||||
# Copyright (C) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(TESTS_XEHP)
|
||||
set(IGDRCL_SRCS_tests_xe_hp_core_xehp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/get_device_info_xehp.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_xehp.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_tests_xehp.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sampler_tests_xehp.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source_level_debugger_csr_tests_xehp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_command_stream_receiver_xehp.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_xehp.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_xehp.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_local_work_size_xehp.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_sub_devices_xehp.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_preamble_xehp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_platform_caps_xehp.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_wrapper_xehp.cpp
|
||||
)
|
||||
|
||||
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_xe_hp_core_xehp})
|
||||
add_subdirectories()
|
||||
neo_copy_test_files_with_revision(copy_test_files_xehp_0 xehp 0)
|
||||
add_dependencies(copy_test_files_per_product copy_test_files_xehp_0)
|
||||
endif()
|
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/device_info_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
HWTEST_EXCLUDE_PRODUCT(GetDeviceInfoMemCapabilitiesTest, GivenValidParametersWhenGetDeviceInfoIsCalledForXE_HP_COREThenClSuccessIsReturned, IGFX_XE_HP_SDV);
|
||||
|
||||
XEHPTEST_F(GetDeviceInfoMemCapabilitiesTest, GivenValidParametersWhenGetDeviceInfoIsCalledForXEHPThenClSuccessIsReturned) {
|
||||
std::vector<TestParams> params = {
|
||||
{CL_DEVICE_DEVICE_MEM_CAPABILITIES_INTEL,
|
||||
(CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL | CL_UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS_INTEL)},
|
||||
{CL_DEVICE_SINGLE_DEVICE_SHARED_MEM_CAPABILITIES_INTEL,
|
||||
(CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL | CL_UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS_INTEL)},
|
||||
{CL_DEVICE_CROSS_DEVICE_SHARED_MEM_CAPABILITIES_INTEL,
|
||||
(CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL | CL_UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS_INTEL)},
|
||||
{CL_DEVICE_SHARED_SYSTEM_MEM_CAPABILITIES_INTEL, 0}};
|
||||
|
||||
check(params);
|
||||
}
|
||||
|
||||
XEHPTEST_F(GetDeviceInfoMemCapabilitiesTest, GivenA0ThenUsmHostMemSupportIsEnabledByDefault) {
|
||||
std::vector<TestParams> params = {{CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL, CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL}};
|
||||
|
||||
check(params);
|
||||
}
|
||||
|
||||
XEHPTEST_F(GetDeviceInfoMemCapabilitiesTest, GivenDebugVariableIsEnabledThenUsmHostMemSupportIsEnabled) {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.EnableHostUsmSupport.set(1);
|
||||
std::vector<TestParams> params = {{CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL, CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL}};
|
||||
|
||||
check(params);
|
||||
}
|
||||
|
||||
XEHPTEST_F(GetDeviceInfoMemCapabilitiesTest, GivenDebugVariableIsDisabledThenUsmHostMemSupportIsDisabled) {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.EnableHostUsmSupport.set(0);
|
||||
std::vector<TestParams> params = {{CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL, 0}};
|
||||
std::vector<TestParams> enabledParams = {{CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL, CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL}};
|
||||
|
||||
check(params);
|
||||
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(1);
|
||||
check(params);
|
||||
|
||||
DebugManager.flags.EnableHostUsmSupport.set(1);
|
||||
check(enabledParams);
|
||||
|
||||
DebugManager.flags.EnableHostUsmSupport.set(-1);
|
||||
check(params);
|
||||
}
|
||||
|
||||
XEHPTEST_F(GetDeviceInfoMemCapabilitiesTest, GivenB0ThenUsmHostMemSupportIsSetCorrectly) {
|
||||
auto steppingSave = defaultHwInfo->platform.usRevId;
|
||||
auto &hwHelper = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily);
|
||||
defaultHwInfo->platform.usRevId = hwHelper.getHwRevIdFromStepping(REVISION_B, *defaultHwInfo);
|
||||
std::vector<TestParams> params = {{CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL, CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL}};
|
||||
std::vector<TestParams> disabledParameters = {{CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL, 0u}};
|
||||
|
||||
check(params);
|
||||
|
||||
{
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.EnableHostUsmSupport.set(0);
|
||||
check(disabledParameters);
|
||||
}
|
||||
|
||||
{
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.EnableHostUsmSupport.set(1);
|
||||
check(params);
|
||||
}
|
||||
|
||||
defaultHwInfo->platform.usRevId = steppingSave;
|
||||
}
|
122
opencl/test/unit_test/xe_hp_core/xehp/hw_helper_tests_xehp.inl
Normal file
122
opencl/test/unit_test/xe_hp_core/xehp/hw_helper_tests_xehp.inl
Normal file
@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/test/unit_test/helpers/hw_helper_tests.h"
|
||||
|
||||
using HwHelperTestsXeHP = HwHelperTest;
|
||||
|
||||
HWTEST_EXCLUDE_PRODUCT(HwHelperTest, WhenIsBankOverrideRequiredIsCalledThenFalseIsReturned, IGFX_XE_HP_SDV);
|
||||
|
||||
XEHPTEST_F(HwHelperTestsXeHP, givenXEHPWhenIsBankOverrideRequiredIsCalledThenCorrectValueIsReturned) {
|
||||
DebugManagerStateRestore restore;
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
hwInfo.gtSystemInfo.MultiTileArchInfo.IsValid = true;
|
||||
|
||||
{
|
||||
hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 4;
|
||||
hwInfo.platform.usRevId = helper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
|
||||
EXPECT_TRUE(helper.isBankOverrideRequired(hwInfo));
|
||||
}
|
||||
{
|
||||
hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 4;
|
||||
hwInfo.platform.usRevId = helper.getHwRevIdFromStepping(REVISION_B, hwInfo);
|
||||
EXPECT_FALSE(helper.isBankOverrideRequired(hwInfo));
|
||||
}
|
||||
{
|
||||
hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 2;
|
||||
hwInfo.platform.usRevId = helper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
|
||||
EXPECT_FALSE(helper.isBankOverrideRequired(hwInfo));
|
||||
}
|
||||
{
|
||||
DebugManager.flags.ForceMemoryBankIndexOverride.set(1);
|
||||
hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 1;
|
||||
hwInfo.platform.usRevId = helper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
|
||||
EXPECT_TRUE(helper.isBankOverrideRequired(hwInfo));
|
||||
}
|
||||
{
|
||||
DebugManager.flags.ForceMemoryBankIndexOverride.set(0);
|
||||
hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 4;
|
||||
hwInfo.platform.usRevId = helper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
|
||||
EXPECT_FALSE(helper.isBankOverrideRequired(hwInfo));
|
||||
}
|
||||
}
|
||||
|
||||
XEHPTEST_F(HwHelperTestsXeHP, givenXEHPWhenHeapInLocalMemIsCalledThenCorrectValueIsReturned) {
|
||||
DebugManagerStateRestore restore;
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
|
||||
{
|
||||
hwInfo.platform.usRevId = helper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
|
||||
EXPECT_FALSE(helper.heapInLocalMem(hwInfo));
|
||||
}
|
||||
{
|
||||
hwInfo.platform.usRevId = helper.getHwRevIdFromStepping(REVISION_B, hwInfo);
|
||||
EXPECT_TRUE(helper.heapInLocalMem(hwInfo));
|
||||
}
|
||||
}
|
||||
|
||||
XEHPTEST_F(HwHelperTestsXeHP, givenRcsDisabledWhenGetGpgpuEnginesCalledThenDontSetRcs) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
hwInfo.featureTable.ftrCCSNode = true;
|
||||
hwInfo.featureTable.ftrBcsInfo = 1;
|
||||
hwInfo.featureTable.ftrRcsNode = false;
|
||||
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS;
|
||||
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4;
|
||||
|
||||
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0));
|
||||
|
||||
EXPECT_EQ(8u, device->engines.size());
|
||||
auto &engines = HwHelperHw<FamilyType>::get().getGpgpuEngineInstances(hwInfo);
|
||||
EXPECT_EQ(8u, engines.size());
|
||||
|
||||
EXPECT_EQ(hwInfo.capabilityTable.defaultEngineType, engines[0].first); // low priority
|
||||
EXPECT_EQ(hwInfo.capabilityTable.defaultEngineType, engines[1].first); // internal
|
||||
EXPECT_EQ(aub_stream::ENGINE_CCS, engines[2].first);
|
||||
EXPECT_EQ(aub_stream::ENGINE_CCS1, engines[3].first);
|
||||
EXPECT_EQ(aub_stream::ENGINE_CCS2, engines[4].first);
|
||||
EXPECT_EQ(aub_stream::ENGINE_CCS3, engines[5].first);
|
||||
EXPECT_EQ(aub_stream::ENGINE_BCS, engines[6].first);
|
||||
EXPECT_EQ(aub_stream::ENGINE_BCS, engines[7].first);
|
||||
}
|
||||
|
||||
XEHPTEST_F(HwHelperTestsXeHP, givenRcsDisabledButDebugVariableSetWhenGetGpgpuEnginesCalledThenSetRcs) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
hwInfo.featureTable.ftrCCSNode = true;
|
||||
hwInfo.featureTable.ftrBcsInfo = 1;
|
||||
hwInfo.featureTable.ftrRcsNode = false;
|
||||
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS;
|
||||
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4;
|
||||
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.NodeOrdinal.set(static_cast<int32_t>(aub_stream::EngineType::ENGINE_RCS));
|
||||
|
||||
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0));
|
||||
|
||||
EXPECT_EQ(9u, device->engines.size());
|
||||
auto &engines = HwHelperHw<FamilyType>::get().getGpgpuEngineInstances(hwInfo);
|
||||
EXPECT_EQ(9u, engines.size());
|
||||
|
||||
EXPECT_EQ(aub_stream::ENGINE_RCS, engines[0].first);
|
||||
EXPECT_EQ(aub_stream::ENGINE_RCS, engines[1].first); // low priority
|
||||
EXPECT_EQ(aub_stream::ENGINE_RCS, engines[2].first); // internal
|
||||
EXPECT_EQ(aub_stream::ENGINE_CCS, engines[3].first);
|
||||
EXPECT_EQ(aub_stream::ENGINE_CCS1, engines[4].first);
|
||||
EXPECT_EQ(aub_stream::ENGINE_CCS2, engines[5].first);
|
||||
EXPECT_EQ(aub_stream::ENGINE_CCS3, engines[6].first);
|
||||
EXPECT_EQ(aub_stream::ENGINE_BCS, engines[7].first);
|
||||
EXPECT_EQ(aub_stream::ENGINE_BCS, engines[8].first);
|
||||
}
|
||||
|
||||
XEHPTEST_F(HwHelperTestsXeHP, GivenVariousValuesWhenComputeSlmSizeIsCalledThenCorrectValueIsReturned) {
|
||||
auto &hwInfo = pDevice->getHardwareInfo();
|
||||
|
||||
for (auto &testInput : computeSlmValuesXeHPPlusTestsInput) {
|
||||
EXPECT_EQ(testInput.expected, HwHelperHw<FamilyType>::get().computeSlmValues(hwInfo, testInput.slmSize));
|
||||
}
|
||||
}
|
83
opencl/test/unit_test/xe_hp_core/xehp/hw_info_tests_xehp.inl
Normal file
83
opencl/test/unit_test/xe_hp_core/xehp/hw_info_tests_xehp.inl
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
|
||||
#include "opencl/test/unit_test/helpers/gtest_helpers.h"
|
||||
#include "test.h"
|
||||
using namespace NEO;
|
||||
|
||||
using XeHPHwInfoTest = ::testing::Test;
|
||||
|
||||
XEHPTEST_F(XeHPHwInfoTest, whenSetupHardwareInfoWithSetupFeatureTableFlagTrueOrFalseIsCalledThenFeatureTableHasCorrectValues) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
FeatureTable &featureTable = hwInfo.featureTable;
|
||||
WorkaroundTable &workaroundTable = hwInfo.workaroundTable;
|
||||
GT_SYSTEM_INFO >SystemInfo = hwInfo.gtSystemInfo;
|
||||
|
||||
EXPECT_FALSE(featureTable.ftrLocalMemory);
|
||||
EXPECT_FALSE(featureTable.ftrFlatPhysCCS);
|
||||
EXPECT_FALSE(featureTable.ftrLinearCCS);
|
||||
EXPECT_FALSE(featureTable.ftrE2ECompression);
|
||||
EXPECT_FALSE(featureTable.ftrCCSNode);
|
||||
EXPECT_FALSE(featureTable.ftrCCSRing);
|
||||
EXPECT_FALSE(featureTable.ftrMultiTileArch);
|
||||
EXPECT_FALSE(featureTable.ftrCCSMultiInstance);
|
||||
EXPECT_FALSE(featureTable.ftrLinearCCS);
|
||||
EXPECT_FALSE(workaroundTable.waDefaultTile4);
|
||||
EXPECT_FALSE(gtSystemInfo.IsL3HashModeEnabled);
|
||||
EXPECT_FALSE(gtSystemInfo.IsDynamicallyPopulated);
|
||||
EXPECT_EQ(8u, gtSystemInfo.CsrSizeInMb);
|
||||
|
||||
XEHP_CONFIG::setupHardwareInfo(&hwInfo, false);
|
||||
EXPECT_FALSE(featureTable.ftrLocalMemory);
|
||||
EXPECT_FALSE(featureTable.ftrFlatPhysCCS);
|
||||
EXPECT_FALSE(featureTable.ftrLinearCCS);
|
||||
EXPECT_FALSE(featureTable.ftrE2ECompression);
|
||||
EXPECT_FALSE(featureTable.ftrCCSNode);
|
||||
EXPECT_FALSE(featureTable.ftrCCSRing);
|
||||
EXPECT_FALSE(featureTable.ftrMultiTileArch);
|
||||
EXPECT_FALSE(featureTable.ftrCCSMultiInstance);
|
||||
EXPECT_FALSE(featureTable.ftrLinearCCS);
|
||||
EXPECT_FALSE(workaroundTable.waDefaultTile4);
|
||||
EXPECT_FALSE(gtSystemInfo.IsL3HashModeEnabled);
|
||||
EXPECT_FALSE(gtSystemInfo.IsDynamicallyPopulated);
|
||||
EXPECT_EQ(8u, gtSystemInfo.CsrSizeInMb);
|
||||
|
||||
XEHP_CONFIG::setupHardwareInfo(&hwInfo, true);
|
||||
EXPECT_TRUE(featureTable.ftrLocalMemory);
|
||||
EXPECT_TRUE(featureTable.ftrFlatPhysCCS);
|
||||
EXPECT_TRUE(featureTable.ftrLinearCCS);
|
||||
EXPECT_TRUE(featureTable.ftrE2ECompression);
|
||||
EXPECT_TRUE(featureTable.ftrCCSNode);
|
||||
EXPECT_TRUE(featureTable.ftrCCSRing);
|
||||
EXPECT_TRUE(featureTable.ftrMultiTileArch);
|
||||
EXPECT_TRUE(featureTable.ftrCCSMultiInstance);
|
||||
EXPECT_TRUE(featureTable.ftrLinearCCS);
|
||||
EXPECT_FALSE(workaroundTable.waDefaultTile4);
|
||||
EXPECT_FALSE(gtSystemInfo.IsL3HashModeEnabled);
|
||||
EXPECT_FALSE(gtSystemInfo.IsDynamicallyPopulated);
|
||||
EXPECT_EQ(8u, gtSystemInfo.CsrSizeInMb);
|
||||
}
|
||||
|
||||
XEHPTEST_F(XeHPHwInfoTest, givenAlreadyInitializedHwInfoWhenSetupCalledThenDontOverride) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
|
||||
hwInfo.gtSystemInfo.SliceCount = 0;
|
||||
|
||||
XEHP_CONFIG::setupHardwareInfo(&hwInfo, false);
|
||||
|
||||
EXPECT_NE(0u, hwInfo.gtSystemInfo.SliceCount);
|
||||
|
||||
auto expectedValue = ++hwInfo.gtSystemInfo.SliceCount;
|
||||
|
||||
XEHP_CONFIG::setupHardwareInfo(&hwInfo, false);
|
||||
|
||||
EXPECT_EQ(expectedValue, hwInfo.gtSystemInfo.SliceCount);
|
||||
}
|
45
opencl/test/unit_test/xe_hp_core/xehp/sampler_tests_xehp.inl
Normal file
45
opencl/test/unit_test/xe_hp_core/xehp/sampler_tests_xehp.inl
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/unit_test/utilities/base_object_utils.h"
|
||||
|
||||
#include "opencl/source/sampler/sampler.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "test.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
typedef Test<ClDeviceFixture> XeHPSamplerTest;
|
||||
|
||||
XEHPTEST_F(XeHPSamplerTest, givenXeHPSamplerWhenUsingDefaultFilteringAndAppendSamplerStateParamsThenDisableLowQualityFilter) {
|
||||
EXPECT_FALSE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get());
|
||||
typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE;
|
||||
auto context = clUniquePtr(new MockContext());
|
||||
auto sampler = clUniquePtr(new SamplerHw<FamilyType>(context.get(), CL_FALSE, CL_ADDRESS_NONE, CL_FILTER_NEAREST));
|
||||
auto state = FamilyType::cmdInitSamplerState;
|
||||
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
|
||||
sampler->appendSamplerStateParams(&state, *defaultHwInfo);
|
||||
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
|
||||
}
|
||||
|
||||
XEHPTEST_F(XeHPSamplerTest, givenXeHPSamplerWhenForcingLowQualityFilteringAndAppendSamplerStateParamsThenEnableLowQualityFilter) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.ForceSamplerLowFilteringPrecision.set(true);
|
||||
EXPECT_TRUE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get());
|
||||
typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE;
|
||||
auto context = clUniquePtr(new MockContext());
|
||||
auto sampler = clUniquePtr(new SamplerHw<FamilyType>(context.get(), CL_FALSE, CL_ADDRESS_NONE, CL_FILTER_NEAREST));
|
||||
auto state = FamilyType::cmdInitSamplerState;
|
||||
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
|
||||
sampler->appendSamplerStateParams(&state, *defaultHwInfo);
|
||||
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE, state.getLowQualityFilter());
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/source_level_debugger/source_level_debugger.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/helpers/dispatch_flags_helper.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
|
||||
#include "opencl/source/command_queue/command_queue_hw.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "opencl/test/unit_test/source_level_debugger/source_level_debugger_csr_tests.h"
|
||||
#include "test.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
using CommandStreamReceiverWithActiveDebuggerXehpTest = CommandStreamReceiverWithActiveDebuggerTest;
|
||||
|
||||
XEHPTEST_F(CommandStreamReceiverWithActiveDebuggerXehpTest, GivenASteppingAndActiveDebuggerAndWhenFlushTaskIsCalledThenAlwaysProgramStateBaseAddressAndGlobalSip) {
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||
using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END;
|
||||
using MI_NOOP = typename FamilyType::MI_NOOP;
|
||||
|
||||
hwInfo = platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getMutableHardwareInfo();
|
||||
HwHelper &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
|
||||
hwInfo->platform.usRevId = hwHelper.getHwRevIdFromStepping(REVID::REVISION_A0, *hwInfo);
|
||||
|
||||
auto mockCsr = createCSR<FamilyType>();
|
||||
mockCsr->overrideDispatchPolicy(DispatchMode::ImmediateDispatch);
|
||||
|
||||
CommandQueueHw<FamilyType> commandQueue(nullptr, device.get(), 0, false);
|
||||
auto &commandStream = commandQueue.getCS(4096u);
|
||||
auto &csrStream = mockCsr->getCS(0);
|
||||
|
||||
DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||
|
||||
void *buffer = alignedMalloc(MemoryConstants::pageSize, MemoryConstants::pageSize64k);
|
||||
|
||||
std::unique_ptr<MockGraphicsAllocation> allocation(new MockGraphicsAllocation(buffer, MemoryConstants::pageSize));
|
||||
std::unique_ptr<IndirectHeap> heap(new IndirectHeap(allocation.get()));
|
||||
|
||||
auto &neoDevice = device->getDevice();
|
||||
|
||||
mockCsr->flushTask(commandStream,
|
||||
0,
|
||||
*heap.get(),
|
||||
*heap.get(),
|
||||
*heap.get(),
|
||||
0,
|
||||
dispatchFlags,
|
||||
neoDevice);
|
||||
|
||||
mockCsr->flushBatchedSubmissions();
|
||||
|
||||
auto noops = reinterpret_cast<MI_NOOP *>(commandStream.getSpace(8 * sizeof(MI_NOOP)));
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
noops[i] = FamilyType::cmdInitNoop;
|
||||
}
|
||||
|
||||
mockCsr->flushTask(commandStream,
|
||||
0,
|
||||
*heap.get(),
|
||||
*heap.get(),
|
||||
*heap.get(),
|
||||
0,
|
||||
dispatchFlags,
|
||||
neoDevice);
|
||||
|
||||
auto sipAllocation = SipKernel::getSipKernel(neoDevice).getSipAllocation();
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csrStream);
|
||||
hwParser.parseCommands<FamilyType>(commandStream);
|
||||
|
||||
auto itorStateBaseAddr = find<STATE_BASE_ADDRESS *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
|
||||
auto itorBbEnd = find<MI_BATCH_BUFFER_END *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
|
||||
auto itorStateBaseAddr2 = find<STATE_BASE_ADDRESS *>(std::next(itorStateBaseAddr), hwParser.cmdList.end());
|
||||
|
||||
ASSERT_NE(hwParser.cmdList.end(), itorStateBaseAddr);
|
||||
ASSERT_NE(hwParser.cmdList.end(), itorStateBaseAddr2);
|
||||
|
||||
auto itorGlobalSip1 = findMmio<FamilyType>(itorStateBaseAddr, itorBbEnd, GlobalSipRegister<FamilyType>::registerOffset);
|
||||
auto itorGlobalSip2 = findMmio<FamilyType>(std::next(itorGlobalSip1), itorBbEnd, GlobalSipRegister<FamilyType>::registerOffset);
|
||||
auto itorGlobalSip3 = findMmio<FamilyType>(itorBbEnd, hwParser.cmdList.end(), GlobalSipRegister<FamilyType>::registerOffset);
|
||||
auto itorGlobalSip4 = findMmio<FamilyType>(std::next(itorGlobalSip3), hwParser.cmdList.end(), GlobalSipRegister<FamilyType>::registerOffset);
|
||||
|
||||
ASSERT_NE(hwParser.cmdList.end(), itorGlobalSip1);
|
||||
ASSERT_NE(hwParser.cmdList.end(), itorGlobalSip2);
|
||||
ASSERT_NE(hwParser.cmdList.end(), itorGlobalSip3);
|
||||
ASSERT_NE(hwParser.cmdList.end(), itorGlobalSip4);
|
||||
|
||||
EXPECT_NE(itorGlobalSip1, itorGlobalSip2);
|
||||
|
||||
auto expectedSipPosition = --itorBbEnd;
|
||||
EXPECT_EQ(expectedSipPosition, itorGlobalSip2);
|
||||
|
||||
auto itorBbEnd2 = find<MI_BATCH_BUFFER_END *>(itorGlobalSip3, hwParser.cmdList.end());
|
||||
|
||||
expectedSipPosition = --itorBbEnd2;
|
||||
EXPECT_EQ(expectedSipPosition, itorGlobalSip4);
|
||||
|
||||
MI_LOAD_REGISTER_IMM *globalSip = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itorGlobalSip1);
|
||||
|
||||
auto sipAddress = globalSip->getDataDword();
|
||||
EXPECT_EQ(sipAllocation->getGpuAddressToPatch(), sipAddress & 0xfffffff8);
|
||||
|
||||
globalSip = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itorGlobalSip2);
|
||||
auto sipAddress2 = globalSip->getDataDword();
|
||||
EXPECT_EQ(0u, sipAddress2);
|
||||
|
||||
globalSip = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itorGlobalSip3);
|
||||
|
||||
sipAddress = globalSip->getDataDword();
|
||||
EXPECT_EQ(sipAllocation->getGpuAddressToPatch(), sipAddress & 0xfffffff8);
|
||||
|
||||
globalSip = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itorGlobalSip4);
|
||||
sipAddress2 = globalSip->getDataDword();
|
||||
EXPECT_EQ(0u, sipAddress2);
|
||||
|
||||
alignedFree(buffer);
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_csr.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
class CommandStreamReceiverHwTestWithLocalMemory : public ClDeviceFixture,
|
||||
public HardwareParse,
|
||||
public ::testing::Test {
|
||||
public:
|
||||
void SetUp() override {
|
||||
dbgRestore = std::make_unique<DebugManagerStateRestore>();
|
||||
DebugManager.flags.EnableLocalMemory.set(1);
|
||||
ClDeviceFixture::SetUp();
|
||||
HardwareParse::SetUp();
|
||||
}
|
||||
void TearDown() override {
|
||||
HardwareParse::TearDown();
|
||||
ClDeviceFixture::TearDown();
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<DebugManagerStateRestore> dbgRestore;
|
||||
};
|
||||
|
||||
XEHPTEST_F(CommandStreamReceiverHwTestWithLocalMemory, givenUseClearColorAllocationForBlitterIsNotSetWhenCallingGetClearColorAllocationThenClearAllocationIsNotCreated) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.UseClearColorAllocationForBlitter.set(false);
|
||||
|
||||
MockCsrHw<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
commandStreamReceiver.setupContext(pDevice->getGpgpuCommandStreamReceiver().getOsContext());
|
||||
|
||||
auto gfxAllocation = commandStreamReceiver.getClearColorAllocation();
|
||||
EXPECT_EQ(nullptr, gfxAllocation);
|
||||
}
|
||||
|
||||
XEHPTEST_F(CommandStreamReceiverHwTestWithLocalMemory, givenUseClearColorAllocationForBlitterIsSetWhenCallingGetClearColorAllocationThenClearAllocationIsCreated) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.UseClearColorAllocationForBlitter.set(true);
|
||||
|
||||
MockCsrHw<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
commandStreamReceiver.setupContext(pDevice->getGpgpuCommandStreamReceiver().getOsContext());
|
||||
|
||||
auto gfxAllocation = commandStreamReceiver.getClearColorAllocation();
|
||||
ASSERT_NE(nullptr, gfxAllocation);
|
||||
EXPECT_TRUE(gfxAllocation->storageInfo.readOnlyMultiStorage);
|
||||
}
|
||||
|
||||
XEHPTEST_F(CommandStreamReceiverHwTestWithLocalMemory, givenUseClearColorAllocationForBlitterIsSetWhenClearColorAllocationIsAlreadyCreatedThenCallingGetClearColorAllocationReturnsAlreadyCreatedAllocation) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.UseClearColorAllocationForBlitter.set(true);
|
||||
|
||||
MockCsrHw<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
commandStreamReceiver.setupContext(pDevice->getGpgpuCommandStreamReceiver().getOsContext());
|
||||
|
||||
auto mockAllocation = std::make_unique<MockGraphicsAllocation>();
|
||||
auto expectedResult = mockAllocation.get();
|
||||
|
||||
commandStreamReceiver.clearColorAllocation = mockAllocation.release();
|
||||
|
||||
auto gfxAllocation = commandStreamReceiver.getClearColorAllocation();
|
||||
EXPECT_EQ(expectedResult, gfxAllocation);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
struct MockCsrHwWithRace : public MockCsrHw<GfxFamily> {
|
||||
MockCsrHwWithRace() = delete;
|
||||
MockCsrHwWithRace(ExecutionEnvironment &executionEnvironment,
|
||||
uint32_t rootDeviceIndex,
|
||||
const DeviceBitfield deviceBitfield) : MockCsrHw<GfxFamily>(executionEnvironment, rootDeviceIndex, deviceBitfield) {
|
||||
mockGraphicsAllocation.reset(new MockGraphicsAllocation());
|
||||
}
|
||||
|
||||
std::unique_lock<CommandStreamReceiver::MutexType> obtainUniqueOwnership() override {
|
||||
if (raceLost) {
|
||||
this->clearColorAllocation = mockGraphicsAllocation.release();
|
||||
}
|
||||
return MockCsrHw<GfxFamily>::obtainUniqueOwnership();
|
||||
}
|
||||
|
||||
bool raceLost = false;
|
||||
std::unique_ptr<MockGraphicsAllocation> mockGraphicsAllocation;
|
||||
};
|
||||
|
||||
XEHPTEST_F(CommandStreamReceiverHwTestWithLocalMemory, givenUseClearColorAllocationForBlitterIsSetWhenCallingGetClearColorAllocationAndRaceIsWonThenClearAllocationIsCreatedInCurrentThread) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.UseClearColorAllocationForBlitter.set(true);
|
||||
|
||||
MockCsrHwWithRace<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
commandStreamReceiver.setupContext(pDevice->getGpgpuCommandStreamReceiver().getOsContext());
|
||||
|
||||
auto gfxAllocation = commandStreamReceiver.getClearColorAllocation();
|
||||
EXPECT_EQ(commandStreamReceiver.clearColorAllocation, gfxAllocation);
|
||||
EXPECT_NE(commandStreamReceiver.mockGraphicsAllocation.get(), gfxAllocation);
|
||||
}
|
||||
|
||||
XEHPTEST_F(CommandStreamReceiverHwTestWithLocalMemory, givenUseClearColorAllocationForBlitterIsSetWhenCallingGetClearColorAllocationAndRaceIsLostThenClearAllocationIsNotCreatedInCurrentThread) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.UseClearColorAllocationForBlitter.set(true);
|
||||
|
||||
MockCsrHwWithRace<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
commandStreamReceiver.setupContext(pDevice->getGpgpuCommandStreamReceiver().getOsContext());
|
||||
commandStreamReceiver.raceLost = true;
|
||||
|
||||
auto expectedClearColorAllocation = commandStreamReceiver.mockGraphicsAllocation.get();
|
||||
auto gfxAllocation = commandStreamReceiver.getClearColorAllocation();
|
||||
EXPECT_EQ(commandStreamReceiver.clearColorAllocation, gfxAllocation);
|
||||
EXPECT_EQ(expectedClearColorAllocation, gfxAllocation);
|
||||
}
|
||||
|
||||
XEHPTEST_F(CommandStreamReceiverHwTestWithLocalMemory, givenEnableStatelessCompressionWhenCallingGetMemoryCompressionStateThenReturnCorrectValue) {
|
||||
DebugManagerStateRestore restore;
|
||||
CommandStreamReceiverHw<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
|
||||
DebugManager.flags.EnableStatelessCompression.set(0);
|
||||
for (bool auxTranslationRequired : {false, true}) {
|
||||
auto memoryCompressionState = commandStreamReceiver.getMemoryCompressionState(auxTranslationRequired);
|
||||
EXPECT_EQ(MemoryCompressionState::NotApplicable, memoryCompressionState);
|
||||
}
|
||||
|
||||
DebugManager.flags.EnableStatelessCompression.set(1);
|
||||
for (bool auxTranslationRequired : {false, true}) {
|
||||
auto memoryCompressionState = commandStreamReceiver.getMemoryCompressionState(auxTranslationRequired);
|
||||
if (auxTranslationRequired) {
|
||||
EXPECT_EQ(MemoryCompressionState::Disabled, memoryCompressionState);
|
||||
} else {
|
||||
EXPECT_EQ(MemoryCompressionState::Enabled, memoryCompressionState);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
typedef Test<ClDeviceFixture> XeHPUsDeviceIdTest;
|
||||
|
||||
XEHPTEST_F(XeHPUsDeviceIdTest, WhenGettingHardwareInfoThenProductFamilyIsXeHpSdv) {
|
||||
EXPECT_EQ(IGFX_XE_HP_SDV, pDevice->getHardwareInfo().platform.eProductFamily);
|
||||
}
|
||||
|
||||
XEHPTEST_F(XeHPUsDeviceIdTest, givenXeHPWhenCheckftr64KBpagesThenTrue) {
|
||||
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.ftr64KBpages);
|
||||
}
|
||||
|
||||
XEHPTEST_F(XeHPUsDeviceIdTest, WheCheckingIsSimulationThenFalseIsReturned) {
|
||||
EXPECT_FALSE(pDevice->isSimulation());
|
||||
}
|
||||
|
||||
XEHPTEST_F(XeHPUsDeviceIdTest, givenXeHPSkusThenItSupportCorrectlyRoundedDivSqrtBit) {
|
||||
EXPECT_TRUE(pClDevice->getHardwareInfo().capabilityTable.ftrSupports64BitMath);
|
||||
cl_device_fp_config actual = pClDevice->getDeviceInfo().singleFpConfig & CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT;
|
||||
EXPECT_NE(0ull, actual);
|
||||
}
|
||||
|
||||
XEHPTEST_F(XeHPUsDeviceIdTest, givenXeHPWhenCheckSupportCacheFlushAfterWalkerThenTrue) {
|
||||
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.supportCacheFlushAfterWalker);
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
|
||||
#include "opencl/source/command_queue/command_queue_hw.h"
|
||||
#include "opencl/test/unit_test/helpers/hw_helper_tests.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "test.h"
|
||||
|
||||
HWTEST_EXCLUDE_PRODUCT(HwHelperTest, WhenAllowRenderCompressionIsCalledThenTrueIsReturned, IGFX_XE_HP_SDV);
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using XeHPHwInfoConfig = ::testing::Test;
|
||||
|
||||
XEHPTEST_F(XeHPHwInfoConfig, givenConfigStringWhenSettingUpHardwareThenThrow) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
GT_SYSTEM_INFO >SystemInfo = hwInfo.gtSystemInfo;
|
||||
|
||||
uint64_t config = 0xdeadbeef;
|
||||
gtSystemInfo = {0};
|
||||
EXPECT_ANY_THROW(hardwareInfoSetup[productFamily](&hwInfo, false, config));
|
||||
EXPECT_EQ(0u, gtSystemInfo.SliceCount);
|
||||
EXPECT_EQ(0u, gtSystemInfo.SubSliceCount);
|
||||
EXPECT_EQ(0u, gtSystemInfo.DualSubSliceCount);
|
||||
EXPECT_EQ(0u, gtSystemInfo.EUCount);
|
||||
}
|
||||
|
||||
XEHPTEST_F(XeHPHwInfoConfig, givenXeHPMultiConfigWhenConfigureHardwareCustomIsCalledThenCapabilityTableIsSetProperly) {
|
||||
auto hwInfoConfig = HwInfoConfig::get(productFamily);
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
hwInfo.featureTable.ftrE2ECompression = true;
|
||||
|
||||
hwInfo.gtSystemInfo.EUCount = 256u;
|
||||
hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr);
|
||||
EXPECT_FALSE(hwInfo.capabilityTable.ftrRenderCompressedBuffers);
|
||||
EXPECT_FALSE(hwInfo.capabilityTable.ftrRenderCompressedImages);
|
||||
|
||||
hwInfo.gtSystemInfo.EUCount = 512u;
|
||||
hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr);
|
||||
EXPECT_TRUE(hwInfo.capabilityTable.ftrRenderCompressedBuffers);
|
||||
EXPECT_TRUE(hwInfo.capabilityTable.ftrRenderCompressedImages);
|
||||
}
|
||||
|
||||
XEHPTEST_F(XeHPHwInfoConfig, givenXeHPWhenConfiguringThenDisableRcs) {
|
||||
auto hwInfoConfig = HwInfoConfig::get(productFamily);
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
|
||||
hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr);
|
||||
EXPECT_FALSE(hwInfo.featureTable.ftrRcsNode);
|
||||
}
|
||||
|
||||
XEHPTEST_F(XeHPHwInfoConfig, givenDebugVariableSetWhenConfiguringThenEnableRcs) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.NodeOrdinal.set(static_cast<int32_t>(aub_stream::EngineType::ENGINE_RCS));
|
||||
|
||||
auto hwInfoConfig = HwInfoConfig::get(productFamily);
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
|
||||
hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr);
|
||||
EXPECT_TRUE(hwInfo.featureTable.ftrRcsNode);
|
||||
}
|
||||
|
||||
using XeHPHwHelperTest = HwHelperTest;
|
||||
|
||||
XEHPTEST_F(XeHPHwHelperTest, givenXeHPMultiConfigWhenAllowRenderCompressionIsCalledThenCorrectValueIsReturned) {
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
|
||||
hwInfo.gtSystemInfo.EUCount = 512u;
|
||||
EXPECT_TRUE(helper.allowRenderCompression(hwInfo));
|
||||
|
||||
hwInfo.gtSystemInfo.EUCount = 256u;
|
||||
EXPECT_FALSE(helper.allowRenderCompression(hwInfo));
|
||||
}
|
@ -0,0 +1,166 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
|
||||
#include "opencl/source/command_queue/gpgpu_walker.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_buffer.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using XeHPComputeWorkgroupSizeTest = Test<ClDeviceFixture>;
|
||||
|
||||
XEHPTEST_F(XeHPComputeWorkgroupSizeTest, givenXeHPAndForceWorkgroupSize1x1x1FlagWhenComputeWorkgroupSizeIsCalledThenExpectedLwsIsReturned) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
|
||||
auto program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
|
||||
|
||||
MockKernelWithInternals mockKernel(*pClDevice);
|
||||
|
||||
GraphicsAllocation localMemoryAllocation(0, GraphicsAllocation::AllocationType::BUFFER, nullptr, 123, 456, 789, MemoryPool::LocalMemory);
|
||||
MockBuffer buffer(localMemoryAllocation);
|
||||
cl_mem clMem = &buffer;
|
||||
auto &kernel = *mockKernel.mockKernel;
|
||||
auto &kernelInfo = mockKernel.kernelInfo;
|
||||
kernelInfo.addArgBuffer(0, 0);
|
||||
kernel.isBuiltIn = true;
|
||||
kernel.initialize();
|
||||
kernel.setArgBuffer(0, sizeof(cl_mem *), &clMem);
|
||||
|
||||
auto hwInfo = pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
auto &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
|
||||
EXPECT_FALSE(pDevice->isSimulation());
|
||||
|
||||
Vec3<size_t> elws{0, 0, 0};
|
||||
Vec3<size_t> gws{128, 128, 128};
|
||||
Vec3<size_t> offset{0, 0, 0};
|
||||
DispatchInfo dispatchInfo{pClDevice, &kernel, 3, gws, elws, offset};
|
||||
|
||||
{
|
||||
DebugManager.flags.ForceWorkgroupSize1x1x1.set(0);
|
||||
auto expectedLws = computeWorkgroupSize(dispatchInfo);
|
||||
EXPECT_NE(1u, expectedLws.x * expectedLws.y * expectedLws.z);
|
||||
}
|
||||
{
|
||||
DebugManager.flags.ForceWorkgroupSize1x1x1.set(1);
|
||||
auto expectedLws = computeWorkgroupSize(dispatchInfo);
|
||||
EXPECT_EQ(1u, expectedLws.x * expectedLws.y * expectedLws.z);
|
||||
}
|
||||
{
|
||||
DebugManager.flags.ForceWorkgroupSize1x1x1.set(-1);
|
||||
hwInfo->platform.usRevId = hwHelper.getHwRevIdFromStepping(REVISION_A0, *hwInfo);
|
||||
auto expectedLws = computeWorkgroupSize(dispatchInfo);
|
||||
EXPECT_NE(1u, expectedLws.x * expectedLws.y * expectedLws.z);
|
||||
}
|
||||
{
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(1);
|
||||
hwInfo->platform.usRevId = hwHelper.getHwRevIdFromStepping(REVISION_A0, *hwInfo);
|
||||
auto expectedLws = computeWorkgroupSize(dispatchInfo);
|
||||
EXPECT_EQ(1u, expectedLws.x * expectedLws.y * expectedLws.z);
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(-1);
|
||||
}
|
||||
|
||||
{
|
||||
hwInfo->platform.usRevId = hwHelper.getHwRevIdFromStepping(REVISION_B, *hwInfo);
|
||||
auto expectedLws = computeWorkgroupSize(dispatchInfo);
|
||||
EXPECT_NE(1u, expectedLws.x * expectedLws.y * expectedLws.z);
|
||||
}
|
||||
{
|
||||
hwInfo->platform.usRevId = hwHelper.getHwRevIdFromStepping(REVISION_A0, *hwInfo);
|
||||
hwInfo->featureTable.ftrSimulationMode = true;
|
||||
auto expectedLws = computeWorkgroupSize(dispatchInfo);
|
||||
EXPECT_NE(1u, expectedLws.x * expectedLws.y * expectedLws.z);
|
||||
EXPECT_TRUE(pDevice->isSimulation());
|
||||
}
|
||||
{
|
||||
hwInfo->featureTable.ftrSimulationMode = false;
|
||||
kernel.setAuxTranslationDirection(AuxTranslationDirection::NonAuxToAux);
|
||||
auto expectedLws = computeWorkgroupSize(dispatchInfo);
|
||||
EXPECT_NE(1u, expectedLws.x * expectedLws.y * expectedLws.z);
|
||||
}
|
||||
{
|
||||
kernelInfo.kernelDescriptor.payloadMappings.explicitArgs.clear();
|
||||
kernelInfo.addArgImage(0, 0);
|
||||
kernel.setAuxTranslationDirection(AuxTranslationDirection::None);
|
||||
auto expectedLws = computeWorkgroupSize(dispatchInfo);
|
||||
EXPECT_NE(1u, expectedLws.x * expectedLws.y * expectedLws.z);
|
||||
}
|
||||
{
|
||||
kernelInfo.kernelDescriptor.payloadMappings.explicitArgs.clear();
|
||||
kernelInfo.addArgImmediate(0);
|
||||
auto expectedLws = computeWorkgroupSize(dispatchInfo);
|
||||
EXPECT_NE(1u, expectedLws.x * expectedLws.y * expectedLws.z);
|
||||
}
|
||||
}
|
||||
XEHPTEST_F(XeHPComputeWorkgroupSizeTest, giveXeHpWhenKernelIsaIsBelowThresholdAndThereAreNoImageBarriersAndSlmThenSmallWorkgorupSizeIsSelected) {
|
||||
auto program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
|
||||
|
||||
MockKernelWithInternals mockKernel(*pClDevice);
|
||||
auto &kernel = *mockKernel.mockKernel;
|
||||
|
||||
kernel.initialize();
|
||||
|
||||
Vec3<size_t> elws{0, 0, 0};
|
||||
Vec3<size_t> gws{1024, 1, 1};
|
||||
Vec3<size_t> offset{0, 0, 0};
|
||||
DispatchInfo dispatchInfo{pClDevice, &kernel, 1, gws, elws, offset};
|
||||
|
||||
{
|
||||
auto expectedLws = computeWorkgroupSize(dispatchInfo);
|
||||
EXPECT_EQ(64u, expectedLws.x * expectedLws.y * expectedLws.z);
|
||||
EXPECT_EQ(64u, expectedLws.x);
|
||||
}
|
||||
|
||||
mockKernel.mockKernel->slmTotalSize = 1000u;
|
||||
|
||||
{
|
||||
auto expectedLws = computeWorkgroupSize(dispatchInfo);
|
||||
EXPECT_EQ(512u, expectedLws.x * expectedLws.y * expectedLws.z);
|
||||
EXPECT_EQ(512u, expectedLws.x);
|
||||
}
|
||||
|
||||
mockKernel.mockKernel->slmTotalSize = 0u;
|
||||
mockKernel.kernelInfo.kernelDescriptor.kernelAttributes.barrierCount = 1u;
|
||||
|
||||
{
|
||||
auto expectedLws = computeWorkgroupSize(dispatchInfo);
|
||||
EXPECT_EQ(512u, expectedLws.x * expectedLws.y * expectedLws.z);
|
||||
EXPECT_EQ(512u, expectedLws.x);
|
||||
}
|
||||
|
||||
mockKernel.kernelInfo.kernelDescriptor.kernelAttributes.barrierCount = 0u;
|
||||
//on B0 algorithm is disabled
|
||||
pClDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->platform.usRevId = REVISION_B;
|
||||
{
|
||||
auto expectedLws = computeWorkgroupSize(dispatchInfo);
|
||||
EXPECT_EQ(512u, expectedLws.x * expectedLws.y * expectedLws.z);
|
||||
EXPECT_EQ(512u, expectedLws.x);
|
||||
}
|
||||
}
|
||||
|
||||
XEHPTEST_F(XeHPComputeWorkgroupSizeTest, givenSmallKernelAndGwsThatIsNotDivisableBySmallerLimitWhenLwsIsComputedThenBigWorgkroupIsSelected) {
|
||||
auto program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
|
||||
|
||||
MockKernelWithInternals mockKernel(*pClDevice);
|
||||
auto &kernel = *mockKernel.mockKernel;
|
||||
|
||||
kernel.initialize();
|
||||
|
||||
Vec3<size_t> elws{0, 0, 0};
|
||||
Vec3<size_t> gws{636056, 1, 1};
|
||||
Vec3<size_t> offset{0, 0, 0};
|
||||
DispatchInfo dispatchInfo{pClDevice, &kernel, 1, gws, elws, offset};
|
||||
|
||||
{
|
||||
auto expectedLws = computeWorkgroupSize(dispatchInfo);
|
||||
EXPECT_EQ(344u, expectedLws.x * expectedLws.y * expectedLws.z);
|
||||
EXPECT_EQ(344u, expectedLws.x);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/platform_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct XE_HP_COREPlatformCaps : public PlatformFixture, public ::testing::Test {
|
||||
void SetUp() override {
|
||||
PlatformFixture::SetUp();
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
PlatformFixture::TearDown();
|
||||
}
|
||||
};
|
||||
|
||||
XEHPTEST_F(XE_HP_COREPlatformCaps, givenXeHPSkusThenItSupportFP64) {
|
||||
const auto &caps = pPlatform->getPlatformInfo();
|
||||
|
||||
EXPECT_NE(std::string::npos, caps.extensions.find(std::string("cl_khr_fp64")));
|
||||
}
|
83
opencl/test/unit_test/xe_hp_core/xehp/test_preamble_xehp.cpp
Normal file
83
opencl/test/unit_test/xe_hp_core/xehp/test_preamble_xehp.cpp
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/unit_test/preamble/preamble_fixture.h"
|
||||
|
||||
#include "opencl/source/helpers/hardware_commands_helper.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using PreambleCfeState = PreambleFixture;
|
||||
HWTEST2_F(PreambleCfeState, givenXehpAndFlagCFEWeightedDispatchModeDisableSetFalseWhenCallingProgramVFEStateThenFieldWeightedDispatchModeDisableAreNotSet, IsXEHP) {
|
||||
using CFE_STATE = typename FamilyType::CFE_STATE;
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.CFEWeightedDispatchModeDisable.set(false);
|
||||
|
||||
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
|
||||
StreamProperties streamProperties{};
|
||||
streamProperties.frontEndState.setProperties(false, false, *defaultHwInfo);
|
||||
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, 0, 0, AdditionalKernelExecInfo::NotApplicable, streamProperties);
|
||||
parseCommands<FamilyType>(linearStream);
|
||||
auto cfeStateIt = find<CFE_STATE *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_NE(cmdList.end(), cfeStateIt);
|
||||
auto cfeState = reinterpret_cast<CFE_STATE *>(*cfeStateIt);
|
||||
|
||||
EXPECT_FALSE(cfeState->getWeightedDispatchModeDisable());
|
||||
}
|
||||
HWTEST2_F(PreambleCfeState, givenXehpAndFlagCFEWeightedDispatchModeDisableSetTrueWhenCallingProgramVFEStateThenFieldWeightedDispatchModeDisableAreSet, IsXEHP) {
|
||||
using CFE_STATE = typename FamilyType::CFE_STATE;
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.CFEWeightedDispatchModeDisable.set(true);
|
||||
|
||||
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
|
||||
StreamProperties streamProperties{};
|
||||
streamProperties.frontEndState.setProperties(false, false, *defaultHwInfo);
|
||||
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, 0, 0, AdditionalKernelExecInfo::NotApplicable, streamProperties);
|
||||
parseCommands<FamilyType>(linearStream);
|
||||
auto cfeStateIt = find<CFE_STATE *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_NE(cmdList.end(), cfeStateIt);
|
||||
auto cfeState = reinterpret_cast<CFE_STATE *>(*cfeStateIt);
|
||||
|
||||
EXPECT_TRUE(cfeState->getWeightedDispatchModeDisable());
|
||||
}
|
||||
|
||||
HWTEST2_F(PreambleCfeState, givenXehpAndFlagCFEComputeOverdispatchDisableSetFalseWhenCallingProgramVFEStateThenFieldComputeOverdispatchDisableAreNotSet, IsXEHP) {
|
||||
using CFE_STATE = typename FamilyType::CFE_STATE;
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.CFEComputeOverdispatchDisable.set(false);
|
||||
|
||||
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
|
||||
StreamProperties streamProperties{};
|
||||
streamProperties.frontEndState.setProperties(false, false, *defaultHwInfo);
|
||||
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, 0, 0, AdditionalKernelExecInfo::NotApplicable, streamProperties);
|
||||
parseCommands<FamilyType>(linearStream);
|
||||
auto cfeStateIt = find<CFE_STATE *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_NE(cmdList.end(), cfeStateIt);
|
||||
auto cfeState = reinterpret_cast<CFE_STATE *>(*cfeStateIt);
|
||||
|
||||
EXPECT_FALSE(cfeState->getComputeOverdispatchDisable());
|
||||
}
|
||||
HWTEST2_F(PreambleCfeState, givenXehpAndFlagCFEComputeOverdispatchDisableSetTrueWhenCallingProgramVFEStateThenFieldComputeOverdispatchDisableAreSet, IsXEHP) {
|
||||
using CFE_STATE = typename FamilyType::CFE_STATE;
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.CFEComputeOverdispatchDisable.set(true);
|
||||
|
||||
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
|
||||
StreamProperties streamProperties{};
|
||||
streamProperties.frontEndState.setProperties(false, false, *defaultHwInfo);
|
||||
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, 0, 0, AdditionalKernelExecInfo::NotApplicable, streamProperties);
|
||||
parseCommands<FamilyType>(linearStream);
|
||||
auto cfeStateIt = find<CFE_STATE *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_NE(cmdList.end(), cfeStateIt);
|
||||
auto cfeState = reinterpret_cast<CFE_STATE *>(*cfeStateIt);
|
||||
|
||||
EXPECT_TRUE(cfeState->getComputeOverdispatchDisable());
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_memory_manager.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using XeHPUsDeviceIdTest = Test<ClDeviceFixture>;
|
||||
|
||||
HWTEST_EXCLUDE_PRODUCT(SubDeviceTests, givenCCSEngineWhenCallingGetDefaultEngineWithWaThenTheSameEngineIsReturned, IGFX_XE_HP_SDV);
|
||||
|
||||
XEHPTEST_F(XeHPUsDeviceIdTest, givenRevisionAWhenCreatingEngineWithSubdevicesThenEngineTypeIsSetToCCS) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.CreateMultipleSubDevices.set(2);
|
||||
|
||||
auto executionEnvironment = new MockExecutionEnvironment;
|
||||
MockDevice device(executionEnvironment, 0);
|
||||
EXPECT_EQ(0u, device.engines.size());
|
||||
device.createSubDevices();
|
||||
EXPECT_EQ(2u, device.getNumAvailableDevices());
|
||||
|
||||
auto hwInfo = device.getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
auto &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
|
||||
hwInfo->platform.usRevId = hwHelper.getHwRevIdFromStepping(REVISION_A0, *hwInfo);
|
||||
device.createEngines();
|
||||
auto engines = device.getEngines();
|
||||
for (auto engine : engines) {
|
||||
EXPECT_EQ(aub_stream::ENGINE_CCS, engine.osContext->getEngineType());
|
||||
}
|
||||
}
|
||||
|
||||
XEHPTEST_F(XeHPUsDeviceIdTest, givenRevisionBWhenCreatingEngineWithSubdevicesThenEngineTypeIsSetToCCS) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.CreateMultipleSubDevices.set(2);
|
||||
|
||||
auto executionEnvironment = new MockExecutionEnvironment;
|
||||
MockDevice device(executionEnvironment, 0);
|
||||
EXPECT_EQ(0u, device.engines.size());
|
||||
device.createSubDevices();
|
||||
EXPECT_EQ(2u, device.getNumAvailableDevices());
|
||||
|
||||
auto hwInfo = device.getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
auto &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
|
||||
hwInfo->platform.usRevId = hwHelper.getHwRevIdFromStepping(REVISION_B, *hwInfo);
|
||||
device.createEngines();
|
||||
auto engines = device.getEngines();
|
||||
for (auto engine : engines) {
|
||||
EXPECT_EQ(aub_stream::ENGINE_CCS, engine.osContext->getEngineType());
|
||||
}
|
||||
}
|
17
opencl/test/unit_test/xe_hp_core/xehp/test_wrapper_xehp.cpp
Normal file
17
opencl/test/unit_test/xe_hp_core/xehp/test_wrapper_xehp.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "get_device_info_xehp.inl"
|
||||
#include "hw_helper_tests_xehp.inl"
|
||||
#include "hw_info_tests_xehp.inl"
|
||||
#include "sampler_tests_xehp.inl"
|
||||
#include "test_command_stream_receiver_xehp.inl"
|
||||
#include "test_device_caps_xehp.inl"
|
||||
#include "test_hw_info_config_xehp.inl"
|
||||
#include "test_local_work_size_xehp.inl"
|
||||
#include "test_platform_caps_xehp.inl"
|
||||
#include "test_sub_devices_xehp.inl"
|
Reference in New Issue
Block a user