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

committed by
Compute-Runtime-Automation

parent
c324279bf5
commit
d8a2704b7e
@ -124,6 +124,11 @@ set(IGDRCL_SRCS_tests_api
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cl_unload_compiler_tests.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cl_unload_platform_compiler_tests.inl
|
||||
)
|
||||
|
||||
if(TESTS_PVC_AND_LATER)
|
||||
list(APPEND IGDRCL_SRCS_tests_api ${CMAKE_CURRENT_SOURCE_DIR}/cl_get_device_info_pvc_and_later_tests.cpp)
|
||||
endif()
|
||||
|
||||
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_api})
|
||||
|
||||
add_subdirectories()
|
||||
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/test/unit_test/api/cl_api_tests.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using clGetDeviceInfoPvcAndLater = api_tests;
|
||||
using matcherPvcAndLater = IsAtLeastXeHpcCore;
|
||||
namespace ULT {
|
||||
HWTEST2_F(clGetDeviceInfoPvcAndLater, givenClDeviceSupportedThreadArbitrationPolicyIntelWhenPvcAndLatereAndCallClGetDeviceInfoThenProperArrayIsReturned, matcherPvcAndLater) {
|
||||
cl_device_info paramName = 0;
|
||||
cl_uint paramValue[4];
|
||||
size_t paramSize = sizeof(paramValue);
|
||||
size_t paramRetSize = 0;
|
||||
|
||||
paramName = CL_DEVICE_SUPPORTED_THREAD_ARBITRATION_POLICY_INTEL;
|
||||
cl_uint expectedRetValue[] = {CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_OLDEST_FIRST_INTEL, CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_ROUND_ROBIN_INTEL, CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_AFTER_DEPENDENCY_ROUND_ROBIN_INTEL, CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_STALL_BASED_ROUND_ROBIN_INTEL};
|
||||
|
||||
retVal = clGetDeviceInfo(
|
||||
testedClDevice,
|
||||
paramName,
|
||||
paramSize,
|
||||
paramValue,
|
||||
¶mRetSize);
|
||||
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_EQ(sizeof(expectedRetValue), paramRetSize);
|
||||
EXPECT_TRUE(memcmp(expectedRetValue, paramValue, sizeof(expectedRetValue)) == 0);
|
||||
}
|
||||
|
||||
} // namespace ULT
|
@ -108,5 +108,11 @@ if(TESTS_DG2_AND_LATER)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TESTS_PVC_AND_LATER)
|
||||
list(APPEND IGDRCL_SRCS_tests_command_queue
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/command_queue_tests_pvc_and_later.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_command_queue})
|
||||
add_subdirectories()
|
||||
|
@ -0,0 +1,429 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/engine_node_helper.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_buffer.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using CommandQueuePvcAndLaterTests = ::testing::Test;
|
||||
|
||||
HWTEST2_F(CommandQueuePvcAndLaterTests, givenMultipleBcsEnginesWhenGetBcsCommandStreamReceiverIsCalledThenReturnProperCsrs, IsAtLeastXeHpcCore) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9);
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = true;
|
||||
MockDevice *device = MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0);
|
||||
MockClDevice clDevice{device};
|
||||
MockContext context{&clDevice};
|
||||
|
||||
MockCommandQueue queue{context};
|
||||
queue.clearBcsEngines();
|
||||
ASSERT_EQ(0u, queue.countBcsEngines());
|
||||
queue.insertBcsEngine(aub_stream::EngineType::ENGINE_BCS);
|
||||
queue.insertBcsEngine(aub_stream::EngineType::ENGINE_BCS3);
|
||||
queue.insertBcsEngine(aub_stream::EngineType::ENGINE_BCS7);
|
||||
ASSERT_EQ(3u, queue.countBcsEngines());
|
||||
|
||||
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS, queue.getBcsCommandStreamReceiver(aub_stream::EngineType::ENGINE_BCS)->getOsContext().getEngineType());
|
||||
EXPECT_EQ(nullptr, queue.getBcsCommandStreamReceiver(aub_stream::EngineType::ENGINE_BCS1));
|
||||
EXPECT_EQ(nullptr, queue.getBcsCommandStreamReceiver(aub_stream::EngineType::ENGINE_BCS2));
|
||||
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS3, queue.getBcsCommandStreamReceiver(aub_stream::EngineType::ENGINE_BCS3)->getOsContext().getEngineType());
|
||||
EXPECT_EQ(nullptr, queue.getBcsCommandStreamReceiver(aub_stream::EngineType::ENGINE_BCS4));
|
||||
EXPECT_EQ(nullptr, queue.getBcsCommandStreamReceiver(aub_stream::EngineType::ENGINE_BCS5));
|
||||
EXPECT_EQ(nullptr, queue.getBcsCommandStreamReceiver(aub_stream::EngineType::ENGINE_BCS6));
|
||||
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS7, queue.getBcsCommandStreamReceiver(aub_stream::EngineType::ENGINE_BCS7)->getOsContext().getEngineType());
|
||||
EXPECT_EQ(nullptr, queue.getBcsCommandStreamReceiver(aub_stream::EngineType::ENGINE_BCS8));
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandQueuePvcAndLaterTests, givenAdditionalBcsWhenCreatingCommandQueueThenUseCorrectEngine, IsAtLeastXeHpcCore) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9);
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = true;
|
||||
MockDevice *device = MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0);
|
||||
MockClDevice clDevice{device};
|
||||
MockContext context{&clDevice};
|
||||
|
||||
const auto familyIndex = device->getEngineGroupIndexFromEngineGroupType(EngineGroupType::LinkedCopy);
|
||||
cl_command_queue_properties queueProperties[5] = {
|
||||
CL_QUEUE_FAMILY_INTEL,
|
||||
familyIndex,
|
||||
CL_QUEUE_INDEX_INTEL,
|
||||
0,
|
||||
0,
|
||||
};
|
||||
|
||||
queueProperties[3] = 0;
|
||||
auto queue = std::make_unique<MockCommandQueue>(&context, context.getDevice(0), queueProperties, false);
|
||||
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS1, queue->bcsEngines[EngineHelpers::getBcsIndex(aub_stream::ENGINE_BCS1)]->getEngineType());
|
||||
EXPECT_EQ(1u, queue->countBcsEngines());
|
||||
|
||||
queueProperties[3] = 4;
|
||||
queue = std::make_unique<MockCommandQueue>(&context, context.getDevice(0), queueProperties, false);
|
||||
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS5, queue->bcsEngines[EngineHelpers::getBcsIndex(aub_stream::ENGINE_BCS5)]->getEngineType());
|
||||
EXPECT_EQ(1u, queue->countBcsEngines());
|
||||
|
||||
queueProperties[3] = 7;
|
||||
queue = std::make_unique<MockCommandQueue>(&context, context.getDevice(0), queueProperties, false);
|
||||
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS8, queue->bcsEngines[EngineHelpers::getBcsIndex(aub_stream::ENGINE_BCS8)]->getEngineType());
|
||||
EXPECT_EQ(1u, queue->countBcsEngines());
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandQueuePvcAndLaterTests, givenQueueWithMainBcsIsReleasedWhenNewQueueIsCreatedThenMainBcsCanBeUsedAgain, IsAtLeastXeHpcCore) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9);
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = true;
|
||||
MockDevice *device = MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0);
|
||||
MockClDevice clDevice{device};
|
||||
cl_device_id clDeviceId = static_cast<cl_device_id>(&clDevice);
|
||||
ClDeviceVector clDevices{&clDeviceId, 1u};
|
||||
cl_int retVal{};
|
||||
auto context = std::unique_ptr<Context>{Context::create<Context>(nullptr, clDevices, nullptr, nullptr, retVal)};
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
auto queue1 = std::make_unique<MockCommandQueue>(*context);
|
||||
auto queue2 = std::make_unique<MockCommandQueue>(*context);
|
||||
auto queue3 = std::make_unique<MockCommandQueue>(*context);
|
||||
auto queue4 = std::make_unique<MockCommandQueue>(*context);
|
||||
|
||||
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS, queue1->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS)->getOsContext().getEngineType());
|
||||
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS1, queue2->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS1)->getOsContext().getEngineType());
|
||||
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS2, queue3->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS2)->getOsContext().getEngineType());
|
||||
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS1, queue4->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS1)->getOsContext().getEngineType());
|
||||
|
||||
// Releasing main BCS. Next creation should be able to grab it
|
||||
queue1.reset();
|
||||
queue1 = std::make_unique<MockCommandQueue>(*context);
|
||||
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS, queue1->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS)->getOsContext().getEngineType());
|
||||
|
||||
// Releasing link BCS. Shouldn't change anything
|
||||
queue2.reset();
|
||||
queue2 = std::make_unique<MockCommandQueue>(*context);
|
||||
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS2, queue2->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS2)->getOsContext().getEngineType());
|
||||
}
|
||||
|
||||
struct BcsCsrSelectionCommandQueueTests : ::testing::Test {
|
||||
void SetUp() override {
|
||||
HardwareInfo hwInfo = *::defaultHwInfo;
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = true;
|
||||
hwInfo.featureTable.ftrBcsInfo = maxNBitValue(bcsInfoMaskSize);
|
||||
|
||||
device = MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo);
|
||||
clDevice = std::make_unique<MockClDevice>(device);
|
||||
context = std::make_unique<MockContext>(clDevice.get());
|
||||
}
|
||||
|
||||
std::unique_ptr<MockCommandQueue> createQueueWithEngines(std::initializer_list<aub_stream::EngineType> engineTypes) {
|
||||
auto queue = createQueue(nullptr);
|
||||
queue->clearBcsEngines();
|
||||
for (auto engineType : engineTypes) {
|
||||
queue->insertBcsEngine(engineType);
|
||||
}
|
||||
EXPECT_EQ(engineTypes.size(), queue->countBcsEngines());
|
||||
return queue;
|
||||
}
|
||||
|
||||
std::unique_ptr<MockCommandQueue> createQueueWithLinkBcsSelectedWithQueueFamilies(size_t linkBcsIndex) {
|
||||
cl_command_queue_properties queueProperties[5] = {};
|
||||
queueProperties[0] = CL_QUEUE_FAMILY_INTEL;
|
||||
queueProperties[1] = device->getEngineGroupIndexFromEngineGroupType(EngineGroupType::LinkedCopy);
|
||||
queueProperties[2] = CL_QUEUE_INDEX_INTEL;
|
||||
queueProperties[3] = linkBcsIndex;
|
||||
auto queue = createQueue(queueProperties);
|
||||
EXPECT_EQ(1u, queue->countBcsEngines());
|
||||
return queue;
|
||||
}
|
||||
|
||||
std::unique_ptr<MockCommandQueue> createQueue(const cl_queue_properties *properties) {
|
||||
return std::make_unique<MockCommandQueue>(context.get(), clDevice.get(), properties, false);
|
||||
}
|
||||
|
||||
MockDevice *device;
|
||||
std::unique_ptr<MockClDevice> clDevice;
|
||||
std::unique_ptr<MockContext> context;
|
||||
};
|
||||
|
||||
HWTEST2_F(BcsCsrSelectionCommandQueueTests, givenBcsSelectedWithQueueFamiliesWhenSelectingCsrThenSelectProperBcs, IsAtLeastXeHpcCore) {
|
||||
DebugManagerStateRestore restore{};
|
||||
DebugManager.flags.EnableBlitterForEnqueueOperations.set(1);
|
||||
|
||||
BuiltinOpParams builtinOpParams{};
|
||||
MockGraphicsAllocation srcGraphicsAllocation{};
|
||||
MockGraphicsAllocation dstGraphicsAllocation{};
|
||||
MockBuffer srcMemObj{srcGraphicsAllocation};
|
||||
MockBuffer dstMemObj{dstGraphicsAllocation};
|
||||
builtinOpParams.srcMemObj = &srcMemObj;
|
||||
builtinOpParams.dstMemObj = &dstMemObj;
|
||||
|
||||
constexpr auto linkBcsType = aub_stream::ENGINE_BCS6;
|
||||
constexpr auto linkBcsIndex = 5;
|
||||
auto queue = createQueueWithLinkBcsSelectedWithQueueFamilies(linkBcsIndex);
|
||||
{
|
||||
srcGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||
dstGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||
CommandStreamReceiver &selectedCsr = queue->selectCsrForBuiltinOperation(args);
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(linkBcsType), &selectedCsr);
|
||||
EXPECT_EQ(linkBcsType, selectedCsr.getOsContext().getEngineType());
|
||||
}
|
||||
{
|
||||
srcGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||
CommandStreamReceiver &selectedCsr = queue->selectCsrForBuiltinOperation(args);
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(linkBcsType), &selectedCsr);
|
||||
EXPECT_EQ(linkBcsType, selectedCsr.getOsContext().getEngineType());
|
||||
}
|
||||
{
|
||||
srcGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||
dstGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||
CommandStreamReceiver &selectedCsr = queue->selectCsrForBuiltinOperation(args);
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(linkBcsType), &selectedCsr);
|
||||
EXPECT_EQ(linkBcsType, selectedCsr.getOsContext().getEngineType());
|
||||
}
|
||||
{
|
||||
srcGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||
CommandStreamReceiver &selectedCsr = queue->selectCsrForBuiltinOperation(args);
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(linkBcsType), &selectedCsr);
|
||||
EXPECT_EQ(linkBcsType, selectedCsr.getOsContext().getEngineType());
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(BcsCsrSelectionCommandQueueTests, givenBcsSelectedWithForceBcsEngineIndexWhenSelectingCsrThenSelectProperBcs, IsAtLeastXeHpcCore) {
|
||||
DebugManagerStateRestore restore{};
|
||||
DebugManager.flags.EnableBlitterForEnqueueOperations.set(1);
|
||||
|
||||
BuiltinOpParams builtinOpParams{};
|
||||
MockGraphicsAllocation srcGraphicsAllocation{};
|
||||
MockGraphicsAllocation dstGraphicsAllocation{};
|
||||
MockBuffer srcMemObj{srcGraphicsAllocation};
|
||||
MockBuffer dstMemObj{dstGraphicsAllocation};
|
||||
builtinOpParams.srcMemObj = &srcMemObj;
|
||||
builtinOpParams.dstMemObj = &dstMemObj;
|
||||
|
||||
constexpr auto linkBcsType = aub_stream::ENGINE_BCS5;
|
||||
constexpr auto linkBcsIndex = 5;
|
||||
DebugManager.flags.ForceBcsEngineIndex.set(linkBcsIndex);
|
||||
auto queue = createQueue(nullptr);
|
||||
{
|
||||
srcGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||
dstGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||
CommandStreamReceiver &selectedCsr = queue->selectCsrForBuiltinOperation(args);
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(linkBcsType), &selectedCsr);
|
||||
EXPECT_EQ(linkBcsType, selectedCsr.getOsContext().getEngineType());
|
||||
}
|
||||
{
|
||||
srcGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||
CommandStreamReceiver &selectedCsr = queue->selectCsrForBuiltinOperation(args);
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(linkBcsType), &selectedCsr);
|
||||
EXPECT_EQ(linkBcsType, selectedCsr.getOsContext().getEngineType());
|
||||
}
|
||||
{
|
||||
srcGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||
dstGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||
CommandStreamReceiver &selectedCsr = queue->selectCsrForBuiltinOperation(args);
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(linkBcsType), &selectedCsr);
|
||||
EXPECT_EQ(linkBcsType, selectedCsr.getOsContext().getEngineType());
|
||||
}
|
||||
{
|
||||
srcGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||
CommandStreamReceiver &selectedCsr = queue->selectCsrForBuiltinOperation(args);
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(linkBcsType), &selectedCsr);
|
||||
EXPECT_EQ(linkBcsType, selectedCsr.getOsContext().getEngineType());
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(BcsCsrSelectionCommandQueueTests, givenBcsSelectedWithQueueFamiliesAndForceBcsIndexIsUsedWhenSelectingCsrThenUseBcsFromQueueFamilies, IsAtLeastXeHpcCore) {
|
||||
DebugManagerStateRestore restore{};
|
||||
DebugManager.flags.EnableBlitterForEnqueueOperations.set(1);
|
||||
|
||||
BuiltinOpParams builtinOpParams{};
|
||||
MockGraphicsAllocation srcGraphicsAllocation{};
|
||||
MockGraphicsAllocation dstGraphicsAllocation{};
|
||||
MockBuffer srcMemObj{srcGraphicsAllocation};
|
||||
MockBuffer dstMemObj{dstGraphicsAllocation};
|
||||
builtinOpParams.srcMemObj = &srcMemObj;
|
||||
builtinOpParams.dstMemObj = &dstMemObj;
|
||||
|
||||
constexpr auto linkBcsType = aub_stream::ENGINE_BCS6;
|
||||
constexpr auto linkBcsIndex = 5;
|
||||
DebugManager.flags.ForceBcsEngineIndex.set(2); // this should be ignored, because of queue families
|
||||
auto queue = createQueueWithLinkBcsSelectedWithQueueFamilies(linkBcsIndex);
|
||||
{
|
||||
srcGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||
dstGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||
CommandStreamReceiver &selectedCsr = queue->selectCsrForBuiltinOperation(args);
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(linkBcsType), &selectedCsr);
|
||||
EXPECT_EQ(linkBcsType, selectedCsr.getOsContext().getEngineType());
|
||||
}
|
||||
{
|
||||
srcGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||
CommandStreamReceiver &selectedCsr = queue->selectCsrForBuiltinOperation(args);
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(linkBcsType), &selectedCsr);
|
||||
EXPECT_EQ(linkBcsType, selectedCsr.getOsContext().getEngineType());
|
||||
}
|
||||
{
|
||||
srcGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||
dstGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||
CommandStreamReceiver &selectedCsr = queue->selectCsrForBuiltinOperation(args);
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(linkBcsType), &selectedCsr);
|
||||
EXPECT_EQ(linkBcsType, selectedCsr.getOsContext().getEngineType());
|
||||
}
|
||||
{
|
||||
srcGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||
CommandStreamReceiver &selectedCsr = queue->selectCsrForBuiltinOperation(args);
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(linkBcsType), &selectedCsr);
|
||||
EXPECT_EQ(linkBcsType, selectedCsr.getOsContext().getEngineType());
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(BcsCsrSelectionCommandQueueTests, givenOneBcsEngineInQueueWhenSelectingCsrThenTheBcs, IsAtLeastXeHpcCore) {
|
||||
DebugManagerStateRestore restore{};
|
||||
DebugManager.flags.EnableBlitterForEnqueueOperations.set(1);
|
||||
|
||||
BuiltinOpParams builtinOpParams{};
|
||||
MockGraphicsAllocation srcGraphicsAllocation{};
|
||||
MockGraphicsAllocation dstGraphicsAllocation{};
|
||||
MockBuffer srcMemObj{srcGraphicsAllocation};
|
||||
MockBuffer dstMemObj{dstGraphicsAllocation};
|
||||
builtinOpParams.srcMemObj = &srcMemObj;
|
||||
builtinOpParams.dstMemObj = &dstMemObj;
|
||||
|
||||
constexpr auto linkBcsType = aub_stream::ENGINE_BCS6;
|
||||
auto queue = createQueueWithEngines({linkBcsType});
|
||||
{
|
||||
srcGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||
dstGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||
CommandStreamReceiver &selectedCsr = queue->selectCsrForBuiltinOperation(args);
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(linkBcsType), &selectedCsr);
|
||||
EXPECT_EQ(linkBcsType, selectedCsr.getOsContext().getEngineType());
|
||||
}
|
||||
{
|
||||
srcGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||
CommandStreamReceiver &selectedCsr = queue->selectCsrForBuiltinOperation(args);
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(linkBcsType), &selectedCsr);
|
||||
EXPECT_EQ(linkBcsType, selectedCsr.getOsContext().getEngineType());
|
||||
}
|
||||
{
|
||||
srcGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||
dstGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||
CommandStreamReceiver &selectedCsr = queue->selectCsrForBuiltinOperation(args);
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(linkBcsType), &selectedCsr);
|
||||
EXPECT_EQ(linkBcsType, selectedCsr.getOsContext().getEngineType());
|
||||
}
|
||||
{
|
||||
srcGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||
CommandStreamReceiver &selectedCsr = queue->selectCsrForBuiltinOperation(args);
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(linkBcsType), &selectedCsr);
|
||||
EXPECT_EQ(linkBcsType, selectedCsr.getOsContext().getEngineType());
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(BcsCsrSelectionCommandQueueTests, givenMultipleEnginesInQueueWhenSelectingCsrForLocalToLocalOperationThenSelectProperBcsCsr, IsAtLeastXeHpcCore) {
|
||||
DebugManagerStateRestore restore{};
|
||||
DebugManager.flags.EnableBlitterForEnqueueOperations.set(1);
|
||||
|
||||
BuiltinOpParams builtinOpParams{};
|
||||
MockGraphicsAllocation srcGraphicsAllocation{};
|
||||
MockGraphicsAllocation dstGraphicsAllocation{};
|
||||
MockBuffer srcMemObj{srcGraphicsAllocation};
|
||||
MockBuffer dstMemObj{dstGraphicsAllocation};
|
||||
builtinOpParams.srcMemObj = &srcMemObj;
|
||||
builtinOpParams.dstMemObj = &dstMemObj;
|
||||
srcGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||
|
||||
{
|
||||
auto queue = createQueueWithEngines({
|
||||
aub_stream::ENGINE_BCS,
|
||||
aub_stream::ENGINE_BCS1,
|
||||
aub_stream::ENGINE_BCS2,
|
||||
aub_stream::ENGINE_BCS3,
|
||||
aub_stream::ENGINE_BCS4,
|
||||
aub_stream::ENGINE_BCS5,
|
||||
aub_stream::ENGINE_BCS6,
|
||||
aub_stream::ENGINE_BCS7,
|
||||
aub_stream::ENGINE_BCS8,
|
||||
});
|
||||
CommandStreamReceiver &selectedCsr = queue->selectCsrForBuiltinOperation(args);
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS), &selectedCsr);
|
||||
EXPECT_EQ(aub_stream::ENGINE_BCS, selectedCsr.getOsContext().getEngineType());
|
||||
}
|
||||
{
|
||||
auto queue = createQueueWithEngines({
|
||||
aub_stream::ENGINE_BCS5,
|
||||
aub_stream::ENGINE_BCS6,
|
||||
aub_stream::ENGINE_BCS7,
|
||||
aub_stream::ENGINE_BCS8,
|
||||
});
|
||||
CommandStreamReceiver &selectedCsr = queue->selectCsrForBuiltinOperation(args);
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS5), &selectedCsr);
|
||||
EXPECT_EQ(aub_stream::ENGINE_BCS5, selectedCsr.getOsContext().getEngineType());
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(BcsCsrSelectionCommandQueueTests, givenMultipleEnginesInQueueWhenSelectingCsrForNonLocalToLocalOperationThenSelectProperBcsCsr, IsAtLeastXeHpcCore) {
|
||||
DebugManagerStateRestore restore{};
|
||||
DebugManager.flags.EnableBlitterForEnqueueOperations.set(1);
|
||||
|
||||
BuiltinOpParams builtinOpParams{};
|
||||
MockGraphicsAllocation srcGraphicsAllocation{};
|
||||
MockGraphicsAllocation dstGraphicsAllocation{};
|
||||
MockBuffer srcMemObj{srcGraphicsAllocation};
|
||||
MockBuffer dstMemObj{dstGraphicsAllocation};
|
||||
builtinOpParams.srcMemObj = &srcMemObj;
|
||||
builtinOpParams.dstMemObj = &dstMemObj;
|
||||
srcGraphicsAllocation.memoryPool = MemoryPool::System4KBPages;
|
||||
dstGraphicsAllocation.memoryPool = MemoryPool::LocalMemory;
|
||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||
|
||||
{
|
||||
auto queue = createQueueWithEngines({
|
||||
aub_stream::ENGINE_BCS,
|
||||
aub_stream::ENGINE_BCS1,
|
||||
aub_stream::ENGINE_BCS2,
|
||||
aub_stream::ENGINE_BCS3,
|
||||
aub_stream::ENGINE_BCS4,
|
||||
aub_stream::ENGINE_BCS5,
|
||||
aub_stream::ENGINE_BCS6,
|
||||
aub_stream::ENGINE_BCS7,
|
||||
aub_stream::ENGINE_BCS8,
|
||||
});
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS1), &queue->selectCsrForBuiltinOperation(args));
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS2), &queue->selectCsrForBuiltinOperation(args));
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS1), &queue->selectCsrForBuiltinOperation(args));
|
||||
EXPECT_EQ(queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS2), &queue->selectCsrForBuiltinOperation(args));
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@ set(IGDRCL_SRCS_tests_command_stream
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tbx_command_stream_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tbx_command_stream_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tbx_stream_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}thread_arbitration_policy_helper.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/thread_arbitration_policy_helper.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/thread_arbitration_policy_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compute_mode_tests.h
|
||||
)
|
||||
@ -65,5 +65,11 @@ if(TESTS_DG2_AND_LATER)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TESTS_PVC_AND_LATER)
|
||||
list(APPEND IGDRCL_SRCS_tests_command_stream
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compute_mode_tests_pvc_and_later.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_command_stream})
|
||||
add_subdirectories()
|
||||
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/test/unit_test/command_stream/compute_mode_tests.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using ComputeModeRequirementsPvcAndLater = ComputeModeRequirements;
|
||||
|
||||
HWTEST2_F(ComputeModeRequirementsPvcAndLater, givenComputeModeCmdSizeWhenLargeGrfModeChangeIsRequiredThenSCMAndPcCommandsSizeIsCalculated, IsXeHpcCore) {
|
||||
SetUpImpl<FamilyType>();
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
auto cmdSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
|
||||
|
||||
overrideComputeModeRequest<FamilyType>(false, false, false, false, 128u);
|
||||
auto retSize = getCsrHw<FamilyType>()->getCmdSizeForComputeMode();
|
||||
EXPECT_EQ(cmdSize, retSize);
|
||||
|
||||
overrideComputeModeRequest<FamilyType>(false, false, false, true, 256u);
|
||||
retSize = getCsrHw<FamilyType>()->getCmdSizeForComputeMode();
|
||||
EXPECT_EQ(cmdSize, retSize);
|
||||
|
||||
overrideComputeModeRequest<FamilyType>(true, false, false, true, 256u);
|
||||
retSize = getCsrHw<FamilyType>()->getCmdSizeForComputeMode();
|
||||
EXPECT_EQ(cmdSize, retSize);
|
||||
}
|
@ -16,7 +16,7 @@ uint32_t getNewKernelArbitrationPolicy(uint32_t policy) {
|
||||
return ThreadArbitrationPolicy::RoundRobin;
|
||||
} else if (policy == CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_OLDEST_FIRST_INTEL) {
|
||||
return ThreadArbitrationPolicy::AgeBased;
|
||||
} else if (policy == CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_AFTER_DEPENDENCY_ROUND_ROBIN_INTEL) {
|
||||
} else if (policy == CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_STALL_BASED_ROUND_ROBIN_INTEL || policy == CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_AFTER_DEPENDENCY_ROUND_ROBIN_INTEL) {
|
||||
return ThreadArbitrationPolicy::RoundRobinAfterDependency;
|
||||
} else {
|
||||
return ThreadArbitrationPolicy::NotPresent;
|
||||
|
@ -64,6 +64,12 @@ if(TESTS_DG2_AND_LATER)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TESTS_PVC_AND_LATER)
|
||||
list(APPEND IGDRCL_SRCS_tests_helpers
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_pvc_and_later.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
get_property(NEO_CORE_PREAMBLE_TESTS GLOBAL PROPERTY NEO_CORE_PREAMBLE_TESTS)
|
||||
|
||||
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_helpers})
|
||||
|
209
opencl/test/unit_test/helpers/hw_helper_tests_pvc_and_later.cpp
Normal file
209
opencl/test/unit_test/helpers/hw_helper_tests_pvc_and_later.cpp
Normal file
@ -0,0 +1,209 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/helpers/engine_node_helper.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/hw_helper_tests.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
using HwHelperTestPvcAndLater = HwHelperTest;
|
||||
|
||||
HWTEST2_F(HwHelperTestPvcAndLater, givenVariousCachesRequestsThenProperMocsIndexesAreBeingReturned, IsAtLeastXeHpcCore) {
|
||||
DebugManagerStateRestore restore;
|
||||
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
auto gmmHelper = this->pDevice->getRootDeviceEnvironment().getGmmHelper();
|
||||
auto expectedMocsForL3off = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1;
|
||||
auto expectedMocsForL3on = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1;
|
||||
|
||||
auto mocsIndex = helper.getMocsIndex(*gmmHelper, false, true);
|
||||
EXPECT_EQ(expectedMocsForL3off, mocsIndex);
|
||||
|
||||
mocsIndex = helper.getMocsIndex(*gmmHelper, true, false);
|
||||
EXPECT_EQ(expectedMocsForL3on, mocsIndex);
|
||||
|
||||
mocsIndex = helper.getMocsIndex(*gmmHelper, true, true);
|
||||
EXPECT_EQ(expectedMocsForL3on, mocsIndex);
|
||||
}
|
||||
|
||||
HWTEST2_F(HwHelperTestPvcAndLater, givenRenderEngineWhenRemapCalledThenUseCccs, IsAtLeastXeHpcCore) {
|
||||
hardwareInfo.featureTable.flags.ftrCCSNode = false;
|
||||
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
helper.adjustDefaultEngineType(&hardwareInfo);
|
||||
|
||||
EXPECT_EQ(aub_stream::EngineType::ENGINE_CCCS, EngineHelpers::remapEngineTypeToHwSpecific(aub_stream::EngineType::ENGINE_RCS, hardwareInfo));
|
||||
EXPECT_EQ(aub_stream::EngineType::ENGINE_CCCS, EngineHelpers::remapEngineTypeToHwSpecific(aub_stream::EngineType::ENGINE_CCCS, hardwareInfo));
|
||||
EXPECT_EQ(aub_stream::EngineType::ENGINE_CCS, EngineHelpers::remapEngineTypeToHwSpecific(aub_stream::EngineType::ENGINE_CCS, hardwareInfo));
|
||||
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS, EngineHelpers::remapEngineTypeToHwSpecific(aub_stream::EngineType::ENGINE_BCS, hardwareInfo));
|
||||
}
|
||||
|
||||
HWTEST2_F(HwHelperTestPvcAndLater, GivenVariousValuesWhenCallingCalculateAvailableThreadCountThenCorrectValueIsReturned, IsAtLeastXeHpcCore) {
|
||||
struct TestInput {
|
||||
uint32_t grfCount;
|
||||
uint32_t expectedThreadCountPerEu;
|
||||
};
|
||||
|
||||
std::vector<TestInput> grfTestInputs = {
|
||||
{64, 16},
|
||||
{96, 10},
|
||||
{128, 8},
|
||||
{160, 6},
|
||||
{192, 5},
|
||||
{256, 4},
|
||||
};
|
||||
|
||||
auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
|
||||
|
||||
for (auto &testInput : grfTestInputs) {
|
||||
auto expected = testInput.expectedThreadCountPerEu * hardwareInfo.gtSystemInfo.EUCount;
|
||||
auto result = hwHelper.calculateAvailableThreadCount(
|
||||
hardwareInfo.platform.eProductFamily,
|
||||
testInput.grfCount,
|
||||
hardwareInfo.gtSystemInfo.EUCount,
|
||||
hardwareInfo.gtSystemInfo.ThreadCount / hardwareInfo.gtSystemInfo.EUCount);
|
||||
EXPECT_EQ(expected, result);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(HwHelperTestPvcAndLater, GivenVariousValuesWhenCallingGetBarriersCountFromHasBarrierThenCorrectValueIsReturned, IsAtLeastXeHpcCore) {
|
||||
auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
|
||||
|
||||
EXPECT_EQ(0u, hwHelper.getBarriersCountFromHasBarriers(0u));
|
||||
EXPECT_EQ(1u, hwHelper.getBarriersCountFromHasBarriers(1u));
|
||||
|
||||
EXPECT_EQ(2u, hwHelper.getBarriersCountFromHasBarriers(2u));
|
||||
EXPECT_EQ(4u, hwHelper.getBarriersCountFromHasBarriers(3u));
|
||||
EXPECT_EQ(8u, hwHelper.getBarriersCountFromHasBarriers(4u));
|
||||
EXPECT_EQ(16u, hwHelper.getBarriersCountFromHasBarriers(5u));
|
||||
EXPECT_EQ(24u, hwHelper.getBarriersCountFromHasBarriers(6u));
|
||||
EXPECT_EQ(32u, hwHelper.getBarriersCountFromHasBarriers(7u));
|
||||
}
|
||||
|
||||
HWTEST2_F(HwHelperTestPvcAndLater, givenCooperativeContextSupportedWhenGetEngineInstancesThenReturnCorrectAmountOfCooperativeCcs, IsAtLeastXeHpcCore) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 2;
|
||||
hwInfo.featureTable.flags.ftrCCSNode = true;
|
||||
auto &hwHelper = HwHelperHw<FamilyType>::get();
|
||||
auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
|
||||
uint32_t revisions[] = {REVISION_A0, REVISION_B};
|
||||
for (auto &revision : revisions) {
|
||||
auto hwRevId = hwInfoConfig.getHwRevIdFromStepping(revision, hwInfo);
|
||||
if (hwRevId == CommonConstants::invalidStepping) {
|
||||
continue;
|
||||
}
|
||||
hwInfo.platform.usRevId = hwRevId;
|
||||
auto engineInstances = hwHelper.getGpgpuEngineInstances(hwInfo);
|
||||
size_t ccsCount = 0u;
|
||||
size_t cooperativeCcsCount = 0u;
|
||||
for (auto &engineInstance : engineInstances) {
|
||||
if (EngineHelpers::isCcs(engineInstance.first)) {
|
||||
if (engineInstance.second == EngineUsage::Regular) {
|
||||
ccsCount++;
|
||||
} else if (engineInstance.second == EngineUsage::Cooperative) {
|
||||
cooperativeCcsCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(2u, ccsCount);
|
||||
if (hwHelper.isCooperativeEngineSupported(hwInfo)) {
|
||||
EXPECT_EQ(ccsCount, cooperativeCcsCount);
|
||||
} else {
|
||||
EXPECT_EQ(0u, cooperativeCcsCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(HwHelperTestPvcAndLater, givenComputeEngineAndCooperativeUsageWhenGetEngineGroupTypeIsCalledThenCooperativeComputeGroupTypeIsReturned, IsAtLeastXeHpcCore) {
|
||||
auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
|
||||
auto hwInfo = *::defaultHwInfo;
|
||||
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4;
|
||||
aub_stream::EngineType engineTypes[] = {aub_stream::EngineType::ENGINE_CCS, aub_stream::EngineType::ENGINE_CCS1,
|
||||
aub_stream::EngineType::ENGINE_CCS2, aub_stream::EngineType::ENGINE_CCS3};
|
||||
EngineUsage engineUsages[] = {EngineUsage::Regular, EngineUsage::LowPriority, EngineUsage::Internal, EngineUsage::Cooperative};
|
||||
|
||||
for (auto engineType : engineTypes) {
|
||||
for (auto engineUsage : engineUsages) {
|
||||
if (engineUsage == EngineUsage::Cooperative) {
|
||||
EXPECT_EQ(EngineGroupType::CooperativeCompute, hwHelper.getEngineGroupType(engineType, engineUsage, hwInfo));
|
||||
} else {
|
||||
EXPECT_EQ(EngineGroupType::Compute, hwHelper.getEngineGroupType(engineType, engineUsage, hwInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(HwHelperTestPvcAndLater, givenPVCAndLaterPlatformWhenCheckingIfEngineTypeRemappingIsRequiredThenReturnTrue, IsAtLeastXeHpcCore) {
|
||||
const auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
|
||||
EXPECT_TRUE(hwHelper.isEngineTypeRemappingToHwSpecificRequired());
|
||||
}
|
||||
|
||||
HWTEST2_F(HwHelperTestPvcAndLater, WhenIsRcsAvailableIsCalledThenCorrectValueIsReturned, IsAtLeastXeHpcCore) {
|
||||
auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
|
||||
auto hwInfo = *::defaultHwInfo;
|
||||
aub_stream::EngineType defaultEngineTypes[] = {aub_stream::EngineType::ENGINE_RCS, aub_stream::EngineType::ENGINE_CCCS,
|
||||
aub_stream::EngineType::ENGINE_BCS, aub_stream::EngineType::ENGINE_BCS2,
|
||||
aub_stream::EngineType::ENGINE_CCS, aub_stream::EngineType::ENGINE_CCS2};
|
||||
for (auto defaultEngineType : defaultEngineTypes) {
|
||||
hwInfo.capabilityTable.defaultEngineType = defaultEngineType;
|
||||
for (auto ftrRcsNode : ::testing::Bool()) {
|
||||
hwInfo.featureTable.flags.ftrRcsNode = ftrRcsNode;
|
||||
if (ftrRcsNode ||
|
||||
(defaultEngineType == aub_stream::EngineType::ENGINE_RCS) ||
|
||||
(defaultEngineType == aub_stream::EngineType::ENGINE_CCCS)) {
|
||||
EXPECT_TRUE(hwHelper.isRcsAvailable(hwInfo));
|
||||
} else {
|
||||
EXPECT_FALSE(hwHelper.isRcsAvailable(hwInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(HwHelperTestPvcAndLater, WhenIsCooperativeDispatchSupportedThenCorrectValueIsReturned, IsAtLeastXeHpcCore) {
|
||||
struct MockHwHelper : NEO::HwHelperHw<FamilyType> {
|
||||
bool isCooperativeEngineSupported(const HardwareInfo &hwInfo) const override {
|
||||
return isCooperativeEngineSupportedValue;
|
||||
}
|
||||
bool isRcsAvailable(const HardwareInfo &hwInfo) const override {
|
||||
return isRcsAvailableValue;
|
||||
}
|
||||
bool isCooperativeEngineSupportedValue = true;
|
||||
bool isRcsAvailableValue = true;
|
||||
};
|
||||
MockHwHelper hwHelper{};
|
||||
|
||||
auto hwInfo = *::defaultHwInfo;
|
||||
for (auto isCooperativeEngineSupported : ::testing::Bool()) {
|
||||
hwHelper.isCooperativeEngineSupportedValue = isCooperativeEngineSupported;
|
||||
for (auto isRcsAvailable : ::testing::Bool()) {
|
||||
hwHelper.isRcsAvailableValue = isRcsAvailable;
|
||||
for (auto engineGroupType : {EngineGroupType::RenderCompute, EngineGroupType::Compute,
|
||||
EngineGroupType::CooperativeCompute}) {
|
||||
|
||||
auto isCooperativeDispatchSupported = hwHelper.isCooperativeDispatchSupported(engineGroupType, hwInfo);
|
||||
if (isCooperativeEngineSupported) {
|
||||
switch (engineGroupType) {
|
||||
case EngineGroupType::RenderCompute:
|
||||
EXPECT_FALSE(isCooperativeDispatchSupported);
|
||||
break;
|
||||
case EngineGroupType::Compute:
|
||||
EXPECT_EQ(!isRcsAvailable, isCooperativeDispatchSupported);
|
||||
break;
|
||||
default: // EngineGroupType::CooperativeCompute
|
||||
EXPECT_TRUE(isCooperativeDispatchSupported);
|
||||
}
|
||||
} else {
|
||||
EXPECT_TRUE(isCooperativeDispatchSupported);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -38,5 +38,11 @@ if(TESTS_XEHP_AND_LATER)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TESTS_PVC_AND_LATER)
|
||||
list(APPEND IGDRCL_SRCS_tests_kernel
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel_tests_pvc_and_later.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_kernel})
|
||||
add_subdirectories()
|
||||
|
21
opencl/test/unit_test/kernel/kernel_tests_pvc_and_later.cpp
Normal file
21
opencl/test/unit_test/kernel/kernel_tests_pvc_and_later.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using KernelTestPvcAndLater = ::testing::Test;
|
||||
using isAtLeastPvc = IsAtLeastGfxCore<IGFX_XE_HPC_CORE>;
|
||||
HWTEST2_F(KernelTestPvcAndLater, givenPolicyWhenSetKernelThreadArbitrationPolicyThenExpectedClValueIsReturned, isAtLeastPvc) {
|
||||
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
|
||||
MockKernelWithInternals kernel(*device);
|
||||
|
||||
EXPECT_EQ(CL_SUCCESS, kernel.mockKernel->setKernelThreadArbitrationPolicy(CL_KERNEL_EXEC_INFO_THREAD_ARBITRATION_POLICY_STALL_BASED_ROUND_ROBIN_INTEL));
|
||||
}
|
@ -50,5 +50,12 @@ if(TESTS_XEHP_AND_LATER)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TESTS_PVC_AND_LATER)
|
||||
list(APPEND IGDRCL_SRCS_tests_mem_obj
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/buffer_tests_pvc_and_later.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image_tests_pvc_and_later.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_mem_obj})
|
||||
add_subdirectories()
|
||||
|
126
opencl/test/unit_test/mem_obj/buffer_tests_pvc_and_later.cpp
Normal file
126
opencl/test/unit_test/mem_obj/buffer_tests_pvc_and_later.cpp
Normal file
@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
#include "shared/test/unit_test/utilities/base_object_utils.h"
|
||||
|
||||
#include "opencl/extensions/public/cl_ext_private.h"
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
#include "opencl/source/mem_obj/buffer.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_platform.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using PvcAndLaterBufferTests = ::testing::Test;
|
||||
|
||||
HWTEST2_F(PvcAndLaterBufferTests, WhenAllocatingBufferThenGpuAddressIsFromHeapExtended, IsAtLeastXeHpcCore) {
|
||||
if (is32bit || defaultHwInfo->capabilityTable.gpuAddressSpace != maxNBitValue(57)) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.EnableLocalMemory.set(true);
|
||||
|
||||
initPlatform();
|
||||
|
||||
MockContext context(platform()->getClDevice(0));
|
||||
|
||||
size_t size = 0x1000;
|
||||
auto retVal = CL_SUCCESS;
|
||||
auto buffer = std::unique_ptr<Buffer>(
|
||||
Buffer::create(
|
||||
&context,
|
||||
CL_MEM_READ_WRITE,
|
||||
size,
|
||||
nullptr,
|
||||
retVal));
|
||||
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
auto graphicsAllocation = buffer->getGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex());
|
||||
ASSERT_NE(nullptr, graphicsAllocation);
|
||||
|
||||
auto gpuAddress = GmmHelper::decanonize(graphicsAllocation->getGpuAddress());
|
||||
auto extendedHeapBase = context.memoryManager->getGfxPartition(0)->getHeapBase(HeapIndex::HEAP_EXTENDED);
|
||||
auto extendedHeapLimit = context.memoryManager->getGfxPartition(0)->getHeapLimit(HeapIndex::HEAP_EXTENDED);
|
||||
|
||||
EXPECT_EQ(extendedHeapBase, maxNBitValue(57 - 1) + 1);
|
||||
EXPECT_EQ(extendedHeapLimit, extendedHeapBase + maxNBitValue(48));
|
||||
|
||||
EXPECT_GT(gpuAddress, extendedHeapBase);
|
||||
EXPECT_LT(gpuAddress, extendedHeapLimit);
|
||||
}
|
||||
|
||||
HWTEST2_F(PvcAndLaterBufferTests, WhenAllocatingRtBufferThenGpuAddressFromHeapStandard64Kb, IsAtLeastXeHpcCore) {
|
||||
if (is32bit || defaultHwInfo->capabilityTable.gpuAddressSpace != maxNBitValue(57)) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.EnableLocalMemory.set(true);
|
||||
|
||||
initPlatform();
|
||||
|
||||
MockContext context(platform()->getClDevice(0));
|
||||
|
||||
auto retVal = CL_SUCCESS;
|
||||
std::unique_ptr<Buffer> rtBuffer;
|
||||
rtBuffer.reset(Buffer::create(&context,
|
||||
ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, CL_MEM_48BIT_RESOURCE_INTEL, 0,
|
||||
&context.getDevice(0)->getDevice()),
|
||||
CL_MEM_READ_WRITE,
|
||||
CL_MEM_48BIT_RESOURCE_INTEL,
|
||||
MemoryConstants::pageSize, nullptr, retVal));
|
||||
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, rtBuffer);
|
||||
|
||||
EXPECT_TRUE(isValueSet(rtBuffer->getFlagsIntel(), CL_MEM_48BIT_RESOURCE_INTEL));
|
||||
|
||||
auto graphicsAllocation = rtBuffer->getGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex());
|
||||
ASSERT_NE(nullptr, graphicsAllocation);
|
||||
|
||||
auto gpuAddress = GmmHelper::decanonize(graphicsAllocation->getGpuAddress());
|
||||
auto standard64KbHeapBase = context.memoryManager->getGfxPartition(0)->getHeapBase(HeapIndex::HEAP_STANDARD64KB);
|
||||
auto standard64KbHeapLimit = context.memoryManager->getGfxPartition(0)->getHeapLimit(HeapIndex::HEAP_STANDARD64KB);
|
||||
|
||||
EXPECT_GT(gpuAddress, standard64KbHeapBase);
|
||||
EXPECT_LT(gpuAddress, standard64KbHeapLimit);
|
||||
}
|
||||
|
||||
HWTEST2_F(PvcAndLaterBufferTests, givenCompressedBufferInSystemAndBlitterSupportedWhenCreatingBufferThenDoNotUseBlitterLogicForLocalMem, IsAtLeastXeHpcCore) {
|
||||
DebugManagerStateRestore restore;
|
||||
VariableBackup<HardwareInfo> backupHwInfo(defaultHwInfo.get());
|
||||
VariableBackup<BlitHelperFunctions::BlitMemoryToAllocationFunc> blitMemoryToAllocationFuncBackup{
|
||||
&BlitHelperFunctions::blitMemoryToAllocation};
|
||||
DebugManager.flags.RenderCompressedBuffersEnabled.set(true);
|
||||
defaultHwInfo->capabilityTable.blitterOperationsSupported = true;
|
||||
|
||||
UltClDeviceFactory deviceFactory{1, 0};
|
||||
auto pDevice = deviceFactory.rootDevices[0];
|
||||
auto pMockContext = std::make_unique<MockContext>(pDevice);
|
||||
|
||||
static_cast<MockMemoryManager *>(pDevice->getExecutionEnvironment()->memoryManager.get())->enable64kbpages[0] = true;
|
||||
static_cast<MockMemoryManager *>(pDevice->getExecutionEnvironment()->memoryManager.get())->localMemorySupported[0] = false;
|
||||
|
||||
blitMemoryToAllocationFuncBackup = [](const NEO::Device &device, NEO::GraphicsAllocation *memory, size_t offset,
|
||||
const void *hostPtr, Vec3<size_t> size) -> NEO::BlitOperationResult {
|
||||
ADD_FAILURE();
|
||||
return BlitOperationResult::Fail;
|
||||
};
|
||||
cl_mem_flags flags = CL_MEM_COPY_HOST_PTR | CL_MEM_COMPRESSED_HINT_INTEL;
|
||||
uint32_t hostPtr = 0;
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto bufferForBlt = clUniquePtr(Buffer::create(pMockContext.get(), flags, 2000, &hostPtr, retVal));
|
||||
}
|
102
opencl/test/unit_test/mem_obj/image_tests_pvc_and_later.cpp
Normal file
102
opencl/test/unit_test/mem_obj/image_tests_pvc_and_later.cpp
Normal file
@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
#include "shared/test/common/test_macros/test_checks_shared.h"
|
||||
|
||||
#include "opencl/source/api/api.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_image.h"
|
||||
#include "test.h"
|
||||
|
||||
namespace NEO {
|
||||
extern ImageFactoryFuncs imageFactory[IGFX_MAX_CORE];
|
||||
}
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using PvcAndLaterImageTests = ::testing::Test;
|
||||
|
||||
template <typename T>
|
||||
struct MockImage : public ImageHw<T> {
|
||||
using ImageHw<T>::transferData;
|
||||
using ImageHw<T>::ImageHw;
|
||||
|
||||
static Image *createMockImage(Context *context,
|
||||
const MemoryProperties &memoryProperties,
|
||||
uint64_t flags,
|
||||
uint64_t flagsIntel,
|
||||
size_t size,
|
||||
void *hostPtr,
|
||||
const cl_image_format &imageFormat,
|
||||
const cl_image_desc &imageDesc,
|
||||
bool zeroCopy,
|
||||
MultiGraphicsAllocation multiGraphicsAllocation,
|
||||
bool isObjectRedescribed,
|
||||
uint32_t baseMipLevel,
|
||||
uint32_t mipCount,
|
||||
const ClSurfaceFormatInfo *surfaceFormatInfo,
|
||||
const SurfaceOffsets *surfaceOffsets) {
|
||||
auto memoryStorage = multiGraphicsAllocation.getDefaultGraphicsAllocation()->getUnderlyingBuffer();
|
||||
return new MockImage<T>(context, memoryProperties, flags, flagsIntel, size, memoryStorage, hostPtr, imageFormat, imageDesc,
|
||||
zeroCopy, std::move(multiGraphicsAllocation), isObjectRedescribed, baseMipLevel, mipCount,
|
||||
*surfaceFormatInfo, surfaceOffsets);
|
||||
}
|
||||
|
||||
void transferData(void *dst, size_t dstRowPitch, size_t dstSlicePitch,
|
||||
void *src, size_t srcRowPitch, size_t srcSlicePitch,
|
||||
std::array<size_t, 3> copyRegion, std::array<size_t, 3> copyOrigin) override {
|
||||
transferDataDestinationPointers.push_back(dst);
|
||||
ImageHw<T>::transferData(dst, dstRowPitch, dstSlicePitch, src, srcRowPitch, srcSlicePitch, copyRegion, copyOrigin);
|
||||
}
|
||||
|
||||
std::vector<void *> transferDataDestinationPointers;
|
||||
};
|
||||
|
||||
HWTEST2_F(PvcAndLaterImageTests, givenNoImagesSupportLocalMemoryEnabledAndCopyHostPtrWhenCreatingLinearImageThenMemoryIsTransferredOverCpu, IsAtLeastXeHpcCore) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.EnableLocalMemory.set(true);
|
||||
auto eRenderCoreFamily = defaultHwInfo->platform.eRenderCoreFamily;
|
||||
VariableBackup<bool> supportsImagesBackup{&defaultHwInfo->capabilityTable.supportsImages, false};
|
||||
VariableBackup<ImageCreatFunc> createImageFunctionBackup{&imageFactory[eRenderCoreFamily].createImageFunction};
|
||||
createImageFunctionBackup = MockImage<FamilyType>::createMockImage;
|
||||
|
||||
uint32_t devicesCount = 1;
|
||||
UltClDeviceFactory clDeviceFactory{devicesCount, 0};
|
||||
cl_device_id devices[] = {clDeviceFactory.rootDevices[0]};
|
||||
MockContext context{ClDeviceVector{devices, 1}};
|
||||
uint8_t imageMemory[5] = {1, 2, 3, 4, 5};
|
||||
cl_int retVal = CL_INVALID_VALUE;
|
||||
cl_image_format format = {0};
|
||||
format.image_channel_data_type = CL_UNSIGNED_INT8;
|
||||
format.image_channel_order = CL_R;
|
||||
cl_image_desc desc{0};
|
||||
desc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
desc.image_width = 5;
|
||||
desc.image_height = 1;
|
||||
desc.image_depth = 1;
|
||||
cl_mem image = clCreateImageWithPropertiesINTEL(&context, nullptr, CL_MEM_COPY_HOST_PTR | CL_MEM_FORCE_LINEAR_STORAGE_INTEL, &format, &desc, imageMemory, &retVal);
|
||||
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_NE(nullptr, image);
|
||||
|
||||
auto &mockImage = *static_cast<MockImage<FamilyType> *>(image);
|
||||
auto &graphicsAllocations = mockImage.getMultiGraphicsAllocation().getGraphicsAllocations();
|
||||
EXPECT_FALSE(graphicsAllocations[0]->isLocked());
|
||||
|
||||
auto &mockMemoryManager = static_cast<MockMemoryManager &>(*clDeviceFactory.rootDevices[0]->getMemoryManager());
|
||||
EXPECT_EQ(graphicsAllocations.size(), mockMemoryManager.lockResourceCalled);
|
||||
EXPECT_EQ(graphicsAllocations.size(), mockMemoryManager.unlockResourceCalled);
|
||||
|
||||
EXPECT_EQ(devicesCount, mockMemoryManager.lockResourcePointers.size());
|
||||
EXPECT_EQ(devicesCount, mockImage.transferDataDestinationPointers.size());
|
||||
EXPECT_EQ(mockMemoryManager.lockResourcePointers[0], mockImage.transferDataDestinationPointers[0]);
|
||||
|
||||
clReleaseMemObject(image);
|
||||
}
|
42
opencl/test/unit_test/xe_hpc_core/CMakeLists.txt
Normal file
42
opencl/test/unit_test/xe_hpc_core/CMakeLists.txt
Normal file
@ -0,0 +1,42 @@
|
||||
#
|
||||
# Copyright (C) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(TESTS_XE_HPC_CORE)
|
||||
set(IGDRCL_SRCS_tests_xe_hpc_core_excludes
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/excludes_xe_hpc_core.cpp
|
||||
)
|
||||
set_property(GLOBAL APPEND PROPERTY IGDRCL_SRCS_tests_excludes ${IGDRCL_SRCS_tests_xe_hpc_core_excludes})
|
||||
|
||||
set(IGDRCL_SRCS_tests_xe_hpc_core
|
||||
${IGDRCL_SRCS_tests_xe_hpc_core_excludes}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_command_stream_receiver_2_tests_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_tests_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_cmds_programming_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/copy_engine_tests_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_hw_tests_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/dispatch_walker_tests_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/enqueue_tests_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_platform_caps_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_sample_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_preamble_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/api_tests_xe_hpc_core.cpp
|
||||
)
|
||||
|
||||
if(DEFINED AUB_STREAM_PROJECT_NAME)
|
||||
list(APPEND IGDRCL_SRCS_tests_xe_hpc_core
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_center_using_aubstream_lib_tests_xe_hpc_core.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
get_property(NEO_CORE_TESTS_XE_HPC_CORE GLOBAL PROPERTY NEO_CORE_TESTS_XE_HPC_CORE)
|
||||
list(APPEND IGDRCL_SRCS_tests_xe_hpc_core ${NEO_CORE_TESTS_XE_HPC_CORE})
|
||||
|
||||
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_xe_hpc_core})
|
||||
add_subdirectories()
|
||||
endif()
|
32
opencl/test/unit_test/xe_hpc_core/api_tests_xe_hpc_core.cpp
Normal file
32
opencl/test/unit_test/xe_hpc_core/api_tests_xe_hpc_core.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
|
||||
#include "opencl/test/unit_test/api/cl_api_tests.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using EnqueueKernelTestGenXeHpcCore = api_tests;
|
||||
|
||||
XE_HPC_CORETEST_F(EnqueueKernelTestGenXeHpcCore, givenCommandQueueWithCCCSEngineAndRevisionBWhenCallingClEnqueueNDCountKernelINTELThenInvalidCommandQueueIsReturned) {
|
||||
size_t workgroupCount[3] = {2, 1, 1};
|
||||
size_t localWorkSize[3] = {256, 1, 1};
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
|
||||
auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
auto &hwConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
hwInfo.platform.usRevId = hwConfig.getHwRevIdFromStepping(REVISION_B, hwInfo);
|
||||
|
||||
pProgram->mockKernelInfo.kernelDescriptor.kernelAttributes.flags.usesSyncBuffer = true;
|
||||
pCommandQueue->getGpgpuEngine().osContext = pCommandQueue->getDevice().getEngine(aub_stream::ENGINE_CCCS, EngineUsage::Regular).osContext;
|
||||
retVal = pMultiDeviceKernel->setKernelExecutionType(CL_KERNEL_EXEC_INFO_CONCURRENT_TYPE_INTEL);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
retVal = clEnqueueNDCountKernelINTEL(pCommandQueue, pMultiDeviceKernel, 1, nullptr, workgroupCount, localWorkSize, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_INVALID_COMMAND_QUEUE, retVal);
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#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 "shared/test/common/mocks/mock_aub_center.h"
|
||||
|
||||
#include "test.h"
|
||||
using namespace NEO;
|
||||
using XeHpcCoreAubCenterTests = ::testing::Test;
|
||||
|
||||
XE_HPC_CORETEST_F(XeHpcCoreAubCenterTests, GivenUseAubStreamDebugVariableSetWhenAubCenterIsCreatedThenAubCenterCreatesAubManager) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseAubStream.set(true);
|
||||
|
||||
GmmHelper gmmHelper(nullptr, defaultHwInfo.get());
|
||||
|
||||
MockAubCenter aubCenter(defaultHwInfo.get(), gmmHelper, false, "", CommandStreamReceiverType::CSR_AUB);
|
||||
|
||||
EXPECT_NE(nullptr, aubCenter.aubManager.get());
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/aub_mem_dump/aub_alloc_dump.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
||||
#include "shared/test/common/mocks/mock_aub_csr.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/aub_command_stream_receiver_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_os_context.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using AubCommandStreamReceiverXeHpcCoreTests = ::testing::Test;
|
||||
|
||||
XE_HPC_CORETEST_F(AubCommandStreamReceiverXeHpcCoreTests, givenLinkBcsEngineWhenDumpAllocationCalledThenIgnore) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.AUBDumpBufferFormat.set("BIN");
|
||||
|
||||
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
|
||||
|
||||
auto memoryManager = device->getMemoryManager();
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({device->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, device->getDeviceBitfield()});
|
||||
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
|
||||
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
|
||||
|
||||
auto engineDescriptor = EngineDescriptorHelper::getDefaultDescriptor();
|
||||
|
||||
for (uint32_t i = aub_stream::EngineType::ENGINE_BCS1; i <= aub_stream::EngineType::ENGINE_BCS8; i++) {
|
||||
MockAubCsr<FamilyType> aubCsr("", true, *device->getExecutionEnvironment(), device->getRootDeviceIndex(), device->getDeviceBitfield());
|
||||
|
||||
engineDescriptor.engineTypeUsage.first = static_cast<aub_stream::EngineType>(i);
|
||||
|
||||
MockOsContext osContext(0, engineDescriptor);
|
||||
aubCsr.setupContext(osContext);
|
||||
|
||||
aubCsr.dumpAllocation(*gfxAllocation);
|
||||
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
|
||||
EXPECT_FALSE(mockHardwareContext->dumpSurfaceCalled);
|
||||
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
|
||||
}
|
||||
|
||||
memoryManager->freeGraphicsMemory(gfxAllocation);
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using CmdParseTestsXeHpcCore = ::testing::Test;
|
||||
|
||||
XE_HPC_CORETEST_F(CmdParseTestsXeHpcCore, givenMiMemFenceCmdWhenParsingThenFindCommandAndsItsName) {
|
||||
using MI_MEM_FENCE = typename FamilyType::MI_MEM_FENCE;
|
||||
|
||||
uint32_t buffer[64] = {};
|
||||
LinearStream cmdStream(buffer, sizeof(buffer));
|
||||
|
||||
auto miMemFenceCmd = cmdStream.getSpaceForCmd<MI_MEM_FENCE>();
|
||||
miMemFenceCmd->init();
|
||||
|
||||
EXPECT_NE(nullptr, genCmdCast<MI_MEM_FENCE *>(buffer));
|
||||
|
||||
auto commandName = CmdParse<FamilyType>::getCommandName(buffer);
|
||||
EXPECT_EQ(0, strcmp(commandName, "MI_MEM_FENCE"));
|
||||
|
||||
HardwareParse hwParser;
|
||||
|
||||
hwParser.parseCommands<FamilyType>(cmdStream, 0);
|
||||
|
||||
EXPECT_EQ(1u, hwParser.cmdList.size());
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(CmdParseTestsXeHpcCore, givenStateSystemMemFenceAddrCmdWhenParsingThenFindCommandAndsItsName) {
|
||||
using STATE_SYSTEM_MEM_FENCE_ADDRESS = typename FamilyType::STATE_SYSTEM_MEM_FENCE_ADDRESS;
|
||||
|
||||
uint32_t buffer[64] = {};
|
||||
LinearStream cmdStream(buffer, sizeof(buffer));
|
||||
|
||||
auto stateSystemMemFenceCmd = cmdStream.getSpaceForCmd<STATE_SYSTEM_MEM_FENCE_ADDRESS>();
|
||||
stateSystemMemFenceCmd->init();
|
||||
|
||||
EXPECT_NE(nullptr, genCmdCast<STATE_SYSTEM_MEM_FENCE_ADDRESS *>(buffer));
|
||||
|
||||
auto commandName = CmdParse<FamilyType>::getCommandName(buffer);
|
||||
EXPECT_EQ(0, strcmp(commandName, "STATE_SYSTEM_MEM_FENCE_ADDRESS"));
|
||||
|
||||
HardwareParse hwParser;
|
||||
|
||||
hwParser.parseCommands<FamilyType>(cmdStream, 0);
|
||||
|
||||
EXPECT_EQ(1u, hwParser.cmdList.size());
|
||||
}
|
@ -0,0 +1,305 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/linear_stream.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
|
||||
#include "opencl/source/command_queue/gpgpu_walker.h"
|
||||
#include "opencl/source/command_queue/hardware_interface.h"
|
||||
#include "opencl/test/unit_test/fixtures/ult_command_stream_receiver_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_mdi.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_timestamp_container.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct MemorySynchronizationViaMiSemaphoreWaitTest : public UltCommandStreamReceiverTest {
|
||||
void SetUp() override {
|
||||
DebugManager.flags.EnableLocalMemory.set(1);
|
||||
DebugManager.flags.ProgramGlobalFenceAsMiMemFenceCommandInCommandStream.set(0);
|
||||
DebugManager.flags.ProgramGlobalFenceAsPostSyncOperationInComputeWalker.set(0);
|
||||
DebugManager.flags.ProgramGlobalFenceAsKernelInstructionInEUKernel.set(0);
|
||||
UltCommandStreamReceiverTest::SetUp();
|
||||
}
|
||||
DebugManagerStateRestore restore;
|
||||
};
|
||||
|
||||
XE_HPC_CORETEST_F(MemorySynchronizationViaMiSemaphoreWaitTest, givenMemorySynchronizationViaMiSemaphoreWaitWhenProgramEnginePrologueIsCalledThenNoCommandIsProgrammed) {
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
EXPECT_FALSE(commandStreamReceiver.isEnginePrologueSent);
|
||||
|
||||
auto requiredSize = commandStreamReceiver.getCmdSizeForPrologue();
|
||||
EXPECT_EQ(0u, requiredSize);
|
||||
|
||||
StackVec<char, 4096> buffer(requiredSize);
|
||||
LinearStream cmdStream(buffer.begin(), buffer.size());
|
||||
|
||||
commandStreamReceiver.programEnginePrologue(cmdStream);
|
||||
EXPECT_TRUE(commandStreamReceiver.isEnginePrologueSent);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(cmdStream);
|
||||
EXPECT_EQ(0u, hwParser.cmdList.size());
|
||||
}
|
||||
|
||||
struct SystemMemoryFenceInDisabledConfigurationTest : public UltCommandStreamReceiverTest {
|
||||
void SetUp() override {
|
||||
DebugManager.flags.ProgramGlobalFenceAsMiMemFenceCommandInCommandStream.set(0);
|
||||
DebugManager.flags.ProgramGlobalFenceAsPostSyncOperationInComputeWalker.set(0);
|
||||
DebugManager.flags.ProgramGlobalFenceAsKernelInstructionInEUKernel.set(0);
|
||||
UltCommandStreamReceiverTest::SetUp();
|
||||
}
|
||||
DebugManagerStateRestore restore;
|
||||
};
|
||||
|
||||
XE_HPC_CORETEST_F(SystemMemoryFenceInDisabledConfigurationTest, givenNoSystemMemoryFenceWhenEnqueueKernelIsCalledThenDontGenerateFenceCommands) {
|
||||
using STATE_SYSTEM_MEM_FENCE_ADDRESS = typename FamilyType::STATE_SYSTEM_MEM_FENCE_ADDRESS;
|
||||
using COMPUTE_WALKER = typename FamilyType::COMPUTE_WALKER;
|
||||
using MI_MEM_FENCE = typename FamilyType::MI_MEM_FENCE;
|
||||
|
||||
MockKernelWithInternals kernel(*pClDevice);
|
||||
MockContext context(pClDevice);
|
||||
MockCommandQueueHw<FamilyType> commandQueue(&context, pClDevice, nullptr);
|
||||
|
||||
size_t globalWorkSize[3] = {1, 1, 1};
|
||||
commandQueue.enqueueKernel(kernel, 1, nullptr, globalWorkSize, nullptr, 0, nullptr, nullptr);
|
||||
|
||||
ClHardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(commandQueue);
|
||||
|
||||
auto itorSystemMemFenceAddress = find<STATE_SYSTEM_MEM_FENCE_ADDRESS *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
|
||||
EXPECT_EQ(hwParser.cmdList.end(), itorSystemMemFenceAddress);
|
||||
|
||||
auto itorComputeWalker = find<COMPUTE_WALKER *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
|
||||
ASSERT_NE(hwParser.cmdList.end(), itorComputeWalker);
|
||||
auto walkerCmd = genCmdCast<COMPUTE_WALKER *>(*itorComputeWalker);
|
||||
auto &postSyncData = walkerCmd->getPostSync();
|
||||
EXPECT_FALSE(postSyncData.getSystemMemoryFenceRequest());
|
||||
|
||||
auto itorMiMemFence = find<MI_MEM_FENCE *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
|
||||
EXPECT_EQ(hwParser.cmdList.end(), itorMiMemFence);
|
||||
}
|
||||
|
||||
struct SystemMemoryFenceViaMiMemFenceTest : public UltCommandStreamReceiverTest {
|
||||
void SetUp() override {
|
||||
DebugManager.flags.EnableLocalMemory.set(1);
|
||||
DebugManager.flags.ProgramGlobalFenceAsMiMemFenceCommandInCommandStream.set(1);
|
||||
UltCommandStreamReceiverTest::SetUp();
|
||||
}
|
||||
DebugManagerStateRestore restore;
|
||||
};
|
||||
|
||||
XE_HPC_CORETEST_F(SystemMemoryFenceViaMiMemFenceTest, givenCommadStreamReceiverWhenProgramEnginePrologueIsCalledThenIsEnginePrologueSentIsSetToTrue) {
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
EXPECT_FALSE(commandStreamReceiver.isEnginePrologueSent);
|
||||
|
||||
auto requiredSize = commandStreamReceiver.getCmdSizeForPrologue();
|
||||
StackVec<char, 4096> buffer(requiredSize);
|
||||
LinearStream cmdStream(buffer.begin(), buffer.size());
|
||||
|
||||
commandStreamReceiver.programEnginePrologue(cmdStream);
|
||||
EXPECT_TRUE(commandStreamReceiver.isEnginePrologueSent);
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(SystemMemoryFenceViaMiMemFenceTest, givenIsEnginePrologueSentIsSetToTrueWhenGetRequiredCmdStreamSizeIsCalledThenSizeForEnginePrologueIsNotIncluded) {
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
auto dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||
|
||||
EXPECT_FALSE(commandStreamReceiver.isEnginePrologueSent);
|
||||
auto sizeForEnginePrologue = commandStreamReceiver.getCmdSizeForPrologue();
|
||||
|
||||
auto sizeWhenEnginePrologueIsNotSent = commandStreamReceiver.getRequiredCmdStreamSize(dispatchFlags, *pDevice);
|
||||
|
||||
commandStreamReceiver.isEnginePrologueSent = true;
|
||||
auto sizeWhenEnginePrologueIsSent = commandStreamReceiver.getRequiredCmdStreamSize(dispatchFlags, *pDevice);
|
||||
|
||||
EXPECT_EQ(sizeForEnginePrologue, sizeWhenEnginePrologueIsNotSent - sizeWhenEnginePrologueIsSent);
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(SystemMemoryFenceViaMiMemFenceTest, givenSystemMemoryFenceGeneratedAsMiFenceCommandInCommandStreamWhenBlitBufferIsCalledThenSystemMemFenceAddressIsProgrammed) {
|
||||
using STATE_SYSTEM_MEM_FENCE_ADDRESS = typename FamilyType::STATE_SYSTEM_MEM_FENCE_ADDRESS;
|
||||
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
auto &cmdStream = commandStreamReceiver.getCS(0);
|
||||
|
||||
EXPECT_FALSE(commandStreamReceiver.isEnginePrologueSent);
|
||||
|
||||
BlitPropertiesContainer blitPropertiesContainer;
|
||||
commandStreamReceiver.blitBuffer(blitPropertiesContainer, false, false, *pDevice);
|
||||
EXPECT_TRUE(commandStreamReceiver.isEnginePrologueSent);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(cmdStream);
|
||||
auto itorSystemMemFenceAddress = find<STATE_SYSTEM_MEM_FENCE_ADDRESS *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
|
||||
ASSERT_NE(hwParser.cmdList.end(), itorSystemMemFenceAddress);
|
||||
|
||||
auto systemMemFenceAddressCmd = genCmdCast<STATE_SYSTEM_MEM_FENCE_ADDRESS *>(*itorSystemMemFenceAddress);
|
||||
EXPECT_EQ(commandStreamReceiver.globalFenceAllocation->getGpuAddress(), systemMemFenceAddressCmd->getSystemMemoryFenceAddress());
|
||||
}
|
||||
|
||||
struct SystemMemoryFenceViaComputeWalkerTest : public UltCommandStreamReceiverTest {
|
||||
void SetUp() override {
|
||||
DebugManager.flags.EnableLocalMemory.set(1);
|
||||
DebugManager.flags.ProgramGlobalFenceAsMiMemFenceCommandInCommandStream.set(0);
|
||||
DebugManager.flags.ProgramGlobalFenceAsPostSyncOperationInComputeWalker.set(1);
|
||||
DebugManager.flags.ProgramGlobalFenceAsKernelInstructionInEUKernel.set(0);
|
||||
UltCommandStreamReceiverTest::SetUp();
|
||||
}
|
||||
DebugManagerStateRestore restore;
|
||||
};
|
||||
|
||||
XE_HPC_CORETEST_F(SystemMemoryFenceViaComputeWalkerTest, givenSystemMemoryFenceGeneratedAsPostSyncOperationInComputeWalkerWhenProgramEnginePrologueIsCalledThenSystemMemFenceAddressIsProgrammed) {
|
||||
using STATE_SYSTEM_MEM_FENCE_ADDRESS = typename FamilyType::STATE_SYSTEM_MEM_FENCE_ADDRESS;
|
||||
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
EXPECT_FALSE(commandStreamReceiver.isEnginePrologueSent);
|
||||
|
||||
auto requiredSize = commandStreamReceiver.getCmdSizeForPrologue();
|
||||
StackVec<char, 4096> buffer(requiredSize);
|
||||
LinearStream cmdStream(buffer.begin(), buffer.size());
|
||||
|
||||
commandStreamReceiver.programEnginePrologue(cmdStream);
|
||||
EXPECT_TRUE(commandStreamReceiver.isEnginePrologueSent);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(cmdStream);
|
||||
auto itorSystemMemFenceAddress = find<STATE_SYSTEM_MEM_FENCE_ADDRESS *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
|
||||
ASSERT_NE(hwParser.cmdList.end(), itorSystemMemFenceAddress);
|
||||
|
||||
auto systemMemFenceAddressCmd = genCmdCast<STATE_SYSTEM_MEM_FENCE_ADDRESS *>(*itorSystemMemFenceAddress);
|
||||
EXPECT_EQ(commandStreamReceiver.globalFenceAllocation->getGpuAddress(), systemMemFenceAddressCmd->getSystemMemoryFenceAddress());
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(SystemMemoryFenceViaComputeWalkerTest, givenSystemMemoryFenceGeneratedAsPostSyncOperationInComputeWalkerWhenDispatchWalkerIsCalledThenSystemMemoryFenceRequestInPostSyncDataIsProgrammed) {
|
||||
using COMPUTE_WALKER = typename FamilyType::COMPUTE_WALKER;
|
||||
|
||||
MockKernelWithInternals kernel(*pClDevice);
|
||||
MockMultiDispatchInfo multiDispatchInfo(pClDevice, kernel.mockKernel);
|
||||
MockContext context(pClDevice);
|
||||
MockCommandQueue commandQueue(&context, pClDevice, nullptr, false);
|
||||
auto &cmdStream = commandQueue.getCS(0);
|
||||
MockTimestampPacketContainer timestampPacket(*pClDevice->getGpgpuCommandStreamReceiver().getTimestampPacketAllocator(), 1);
|
||||
|
||||
HardwareInterface<FamilyType>::dispatchWalker(
|
||||
commandQueue,
|
||||
multiDispatchInfo,
|
||||
CsrDependencies(),
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
×tampPacket,
|
||||
CL_COMMAND_NDRANGE_KERNEL);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(cmdStream);
|
||||
auto itorComputeWalker = find<COMPUTE_WALKER *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
|
||||
ASSERT_NE(hwParser.cmdList.end(), itorComputeWalker);
|
||||
|
||||
auto walkerCmd = genCmdCast<COMPUTE_WALKER *>(*itorComputeWalker);
|
||||
auto &postSyncData = walkerCmd->getPostSync();
|
||||
EXPECT_TRUE(postSyncData.getSystemMemoryFenceRequest());
|
||||
}
|
||||
|
||||
struct SystemMemoryFenceViaKernelInstructionTest : public UltCommandStreamReceiverTest {
|
||||
void SetUp() override {
|
||||
DebugManager.flags.EnableLocalMemory.set(1);
|
||||
DebugManager.flags.ProgramGlobalFenceAsMiMemFenceCommandInCommandStream.set(0);
|
||||
DebugManager.flags.ProgramGlobalFenceAsPostSyncOperationInComputeWalker.set(0);
|
||||
DebugManager.flags.ProgramGlobalFenceAsKernelInstructionInEUKernel.set(1);
|
||||
UltCommandStreamReceiverTest::SetUp();
|
||||
}
|
||||
DebugManagerStateRestore restore;
|
||||
};
|
||||
|
||||
XE_HPC_CORETEST_F(SystemMemoryFenceViaKernelInstructionTest, givenSystemMemoryFenceGeneratedAsKernelInstructionInKernelCodeWhenProgramEnginePrologueIsCalledThenSystemMemFenceAddressIsProgrammed) {
|
||||
using STATE_SYSTEM_MEM_FENCE_ADDRESS = typename FamilyType::STATE_SYSTEM_MEM_FENCE_ADDRESS;
|
||||
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
EXPECT_FALSE(commandStreamReceiver.isEnginePrologueSent);
|
||||
|
||||
auto requiredSize = commandStreamReceiver.getCmdSizeForPrologue();
|
||||
StackVec<char, 4096> buffer(requiredSize);
|
||||
LinearStream cmdStream(buffer.begin(), buffer.size());
|
||||
|
||||
commandStreamReceiver.programEnginePrologue(cmdStream);
|
||||
EXPECT_TRUE(commandStreamReceiver.isEnginePrologueSent);
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(cmdStream);
|
||||
auto itorSystemMemFenceAddress = find<STATE_SYSTEM_MEM_FENCE_ADDRESS *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
|
||||
ASSERT_NE(hwParser.cmdList.end(), itorSystemMemFenceAddress);
|
||||
|
||||
auto systemMemFenceAddressCmd = genCmdCast<STATE_SYSTEM_MEM_FENCE_ADDRESS *>(*itorSystemMemFenceAddress);
|
||||
EXPECT_EQ(commandStreamReceiver.globalFenceAllocation->getGpuAddress(), systemMemFenceAddressCmd->getSystemMemoryFenceAddress());
|
||||
}
|
||||
|
||||
struct SystemMemoryFenceInDefaultConfigurationTest : public UltCommandStreamReceiverTest {
|
||||
void SetUp() override {
|
||||
DebugManager.flags.EnableLocalMemory.set(1);
|
||||
DebugManager.flags.ProgramGlobalFenceAsMiMemFenceCommandInCommandStream.set(-1);
|
||||
DebugManager.flags.ProgramGlobalFenceAsPostSyncOperationInComputeWalker.set(-1);
|
||||
DebugManager.flags.ProgramGlobalFenceAsKernelInstructionInEUKernel.set(-1);
|
||||
UltCommandStreamReceiverTest::SetUp();
|
||||
}
|
||||
DebugManagerStateRestore restore;
|
||||
};
|
||||
|
||||
XE_HPC_CORETEST_F(SystemMemoryFenceInDefaultConfigurationTest, whenEnqueueKernelIsCalledThenFenceCommandsCanBeGenerated) {
|
||||
using STATE_SYSTEM_MEM_FENCE_ADDRESS = typename FamilyType::STATE_SYSTEM_MEM_FENCE_ADDRESS;
|
||||
using COMPUTE_WALKER = typename FamilyType::COMPUTE_WALKER;
|
||||
using MI_MEM_FENCE = typename FamilyType::MI_MEM_FENCE;
|
||||
|
||||
VariableBackup<unsigned short> revisionId(&defaultHwInfo->platform.usRevId);
|
||||
unsigned short revisions[] = {0x0, 0x3};
|
||||
for (auto revision : revisions) {
|
||||
revisionId = revision;
|
||||
UltClDeviceFactory ultClDeviceFactory{1, 0};
|
||||
auto isPvcXlA0Stepping = (revision == 0x0);
|
||||
auto &clDevice = *ultClDeviceFactory.rootDevices[0];
|
||||
|
||||
MockKernelWithInternals kernel(clDevice);
|
||||
MockContext context(&clDevice);
|
||||
MockCommandQueueHw<FamilyType> commandQueue(&context, &clDevice, nullptr);
|
||||
auto &commandStreamReceiver = clDevice.getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
size_t globalWorkSize[3] = {1, 1, 1};
|
||||
commandQueue.enqueueKernel(kernel, 1, nullptr, globalWorkSize, nullptr, 0, nullptr, nullptr);
|
||||
|
||||
ClHardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(commandQueue);
|
||||
|
||||
auto itorSystemMemFenceAddress = find<STATE_SYSTEM_MEM_FENCE_ADDRESS *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
|
||||
ASSERT_NE(hwParser.cmdList.end(), itorSystemMemFenceAddress);
|
||||
auto systemMemFenceAddressCmd = genCmdCast<STATE_SYSTEM_MEM_FENCE_ADDRESS *>(*itorSystemMemFenceAddress);
|
||||
EXPECT_EQ(commandStreamReceiver.globalFenceAllocation->getGpuAddress(), systemMemFenceAddressCmd->getSystemMemoryFenceAddress());
|
||||
|
||||
auto itorComputeWalker = find<COMPUTE_WALKER *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
|
||||
ASSERT_NE(hwParser.cmdList.end(), itorComputeWalker);
|
||||
auto walkerCmd = genCmdCast<COMPUTE_WALKER *>(*itorComputeWalker);
|
||||
auto &postSyncData = walkerCmd->getPostSync();
|
||||
|
||||
auto itorMiMemFence = find<MI_MEM_FENCE *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
|
||||
if (isPvcXlA0Stepping) {
|
||||
EXPECT_FALSE(postSyncData.getSystemMemoryFenceRequest());
|
||||
EXPECT_EQ(hwParser.cmdList.end(), itorMiMemFence);
|
||||
} else {
|
||||
EXPECT_TRUE(postSyncData.getSystemMemoryFenceRequest());
|
||||
ASSERT_NE(hwParser.cmdList.end(), itorMiMemFence);
|
||||
auto fenceCmd = genCmdCast<MI_MEM_FENCE *>(*itorMiMemFence);
|
||||
ASSERT_NE(nullptr, fenceCmd);
|
||||
EXPECT_EQ(MI_MEM_FENCE::FENCE_TYPE::FENCE_TYPE_RELEASE, fenceCmd->getAFenceType());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,269 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/aub_command_stream_receiver.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/libult/ult_command_stream_receiver.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/unit_test/utilities/base_object_utils.h"
|
||||
|
||||
#include "opencl/source/command_queue/command_queue_hw.h"
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct BlitXeHpcCoreTests : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
if (is32bit) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
DebugManager.flags.RenderCompressedBuffersEnabled.set(true);
|
||||
DebugManager.flags.EnableLocalMemory.set(true);
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = true;
|
||||
|
||||
clDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
|
||||
}
|
||||
|
||||
uint32_t blitBuffer(CommandStreamReceiver *csr, const BlitProperties &blitProperties, bool blocking, Device &device) {
|
||||
BlitPropertiesContainer blitPropertiesContainer;
|
||||
blitPropertiesContainer.push_back(blitProperties);
|
||||
|
||||
return csr->blitBuffer(blitPropertiesContainer, blocking, false, device);
|
||||
}
|
||||
|
||||
std::unique_ptr<MockClDevice> clDevice;
|
||||
TimestampPacketContainer timestampPacketContainer;
|
||||
CsrDependencies csrDependencies;
|
||||
DebugManagerStateRestore debugRestorer;
|
||||
};
|
||||
|
||||
XE_HPC_CORETEST_F(BlitXeHpcCoreTests, givenCompressedBufferWhenProgrammingBltCommandThenSetCompressionFields) {
|
||||
using MEM_COPY = typename FamilyType::MEM_COPY;
|
||||
|
||||
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;
|
||||
MockGraphicsAllocation clearColorAlloc;
|
||||
|
||||
{
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopy(bufferNotCompressed->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
bufferCompressed->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
0, 0, {2048, 1, 1}, 0, 0, 0, 0, &clearColorAlloc);
|
||||
|
||||
blitBuffer(csr, blitProperties, true, clDevice->getDevice());
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream);
|
||||
|
||||
auto itorBltCmd = find<MEM_COPY *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
|
||||
ASSERT_NE(hwParser.cmdList.end(), itorBltCmd);
|
||||
MEM_COPY *bltCmd = (MEM_COPY *)*itorBltCmd;
|
||||
|
||||
EXPECT_EQ(bltCmd->getDestinationCompressionEnable(), MEM_COPY::DESTINATION_COMPRESSION_ENABLE::DESTINATION_COMPRESSION_ENABLE_DISABLE);
|
||||
EXPECT_EQ(bltCmd->getDestinationCompressible(), MEM_COPY::DESTINATION_COMPRESSIBLE::DESTINATION_COMPRESSIBLE_NOT_COMPRESSIBLE);
|
||||
EXPECT_EQ(bltCmd->getSourceCompressible(), MEM_COPY::SOURCE_COMPRESSIBLE::SOURCE_COMPRESSIBLE_COMPRESSIBLE);
|
||||
}
|
||||
|
||||
{
|
||||
auto offset = csr->commandStream.getUsed();
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopy(bufferCompressed->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
bufferNotCompressed->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
0, 0, {2048, 1, 1}, 0, 0, 0, 0, &clearColorAlloc);
|
||||
|
||||
blitBuffer(csr, blitProperties, true, clDevice->getDevice());
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream, offset);
|
||||
|
||||
auto bltCmd = genCmdCast<MEM_COPY *>(*(hwParser.cmdList.begin()));
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
EXPECT_EQ(bltCmd->getDestinationCompressionEnable(), MEM_COPY::DESTINATION_COMPRESSION_ENABLE::DESTINATION_COMPRESSION_ENABLE_ENABLE);
|
||||
EXPECT_EQ(bltCmd->getDestinationCompressible(), MEM_COPY::DESTINATION_COMPRESSIBLE::DESTINATION_COMPRESSIBLE_COMPRESSIBLE);
|
||||
EXPECT_EQ(bltCmd->getSourceCompressible(), MEM_COPY::SOURCE_COMPRESSIBLE::SOURCE_COMPRESSIBLE_NOT_COMPRESSIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(BlitXeHpcCoreTests, givenBufferWhenProgrammingBltCommandThenSetMocs) {
|
||||
using MEM_COPY = typename FamilyType::MEM_COPY;
|
||||
|
||||
auto &bcsEngine = clDevice->getEngine(aub_stream::EngineType::ENGINE_BCS, EngineUsage::Regular);
|
||||
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(bcsEngine.commandStreamReceiver);
|
||||
MockContext context(clDevice.get());
|
||||
MockGraphicsAllocation clearColorAlloc;
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto buffer = clUniquePtr<Buffer>(Buffer::create(&context, CL_MEM_READ_WRITE, 1, nullptr, retVal));
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopy(buffer->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
buffer->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
0, 0, {1, 1, 1}, 0, 0, 0, 0, &clearColorAlloc);
|
||||
|
||||
blitBuffer(csr, blitProperties, true, clDevice->getDevice());
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream);
|
||||
|
||||
auto itorBltCmd = find<MEM_COPY *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
|
||||
ASSERT_NE(hwParser.cmdList.end(), itorBltCmd);
|
||||
MEM_COPY *bltCmd = (MEM_COPY *)*itorBltCmd;
|
||||
|
||||
auto mocsL3enabled = 0x10u;
|
||||
EXPECT_EQ(mocsL3enabled, bltCmd->getDestinationMOCS());
|
||||
EXPECT_EQ(mocsL3enabled, bltCmd->getSourceMOCS());
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(BlitXeHpcCoreTests, givenBufferWhenProgrammingBltCommandThenSetMocsToValueOfDebugKey) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.OverrideBlitterMocs.set(0u);
|
||||
using MEM_COPY = typename FamilyType::MEM_COPY;
|
||||
MockGraphicsAllocation clearColorAlloc;
|
||||
|
||||
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::constructPropertiesForCopy(buffer->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
buffer->getGraphicsAllocation(clDevice->getRootDeviceIndex()),
|
||||
0, 0, {1, 1, 1}, 0, 0, 0, 0, &clearColorAlloc);
|
||||
|
||||
blitBuffer(csr, blitProperties, true, clDevice->getDevice());
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream);
|
||||
|
||||
auto itorBltCmd = find<MEM_COPY *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
|
||||
ASSERT_NE(hwParser.cmdList.end(), itorBltCmd);
|
||||
MEM_COPY *bltCmd = (MEM_COPY *)*itorBltCmd;
|
||||
|
||||
EXPECT_EQ(0u, bltCmd->getDestinationMOCS());
|
||||
EXPECT_EQ(0u, bltCmd->getSourceMOCS());
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(BlitXeHpcCoreTests, givenCompressedBufferWhenResolveBlitIsCalledThenProgramSpecialOperationMode) {
|
||||
using MEM_COPY = typename FamilyType::MEM_COPY;
|
||||
|
||||
auto &bcsEngine = clDevice->getEngine(aub_stream::EngineType::ENGINE_BCS, EngineUsage::Regular);
|
||||
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(bcsEngine.commandStreamReceiver);
|
||||
MockContext context(clDevice.get());
|
||||
MockGraphicsAllocation clearColorAlloc;
|
||||
|
||||
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()), &clearColorAlloc);
|
||||
|
||||
blitBuffer(csr, blitProperties, false, clDevice->getDevice());
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream);
|
||||
|
||||
auto itorBltCmd = find<MEM_COPY *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
|
||||
ASSERT_NE(hwParser.cmdList.end(), itorBltCmd);
|
||||
MEM_COPY *bltCmd = (MEM_COPY *)*itorBltCmd;
|
||||
|
||||
EXPECT_EQ(bltCmd->getDestinationCompressionEnable(), MEM_COPY::DESTINATION_COMPRESSION_ENABLE::DESTINATION_COMPRESSION_ENABLE_DISABLE);
|
||||
EXPECT_EQ(bltCmd->getDestinationCompressible(), MEM_COPY::DESTINATION_COMPRESSIBLE::DESTINATION_COMPRESSIBLE_COMPRESSIBLE);
|
||||
EXPECT_EQ(bltCmd->getSourceCompressible(), MEM_COPY::SOURCE_COMPRESSIBLE::SOURCE_COMPRESSIBLE_COMPRESSIBLE);
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(BlitXeHpcCoreTests, given2dBlitCommandWhenDispatchingThenSetValidSurfaceType) {
|
||||
using MEM_COPY = typename FamilyType::MEM_COPY;
|
||||
|
||||
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());
|
||||
MockGraphicsAllocation clearColorAlloc;
|
||||
|
||||
size_t offset = 0;
|
||||
{
|
||||
// 1D
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopy(allocation, allocation,
|
||||
0, 0, {BlitterConstants::maxBlitWidth - 1, 1, 1}, 0, 0, 0, 0, &clearColorAlloc);
|
||||
blitBuffer(csr, blitProperties, false, clDevice->getDevice());
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream);
|
||||
|
||||
auto cmdIterator = find<MEM_COPY *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
|
||||
ASSERT_NE(hwParser.cmdList.end(), cmdIterator);
|
||||
|
||||
auto bltCmd = genCmdCast<MEM_COPY *>(*cmdIterator);
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
EXPECT_EQ(MEM_COPY::COPY_TYPE::COPY_TYPE_LINEAR_COPY, bltCmd->getCopyType());
|
||||
|
||||
offset = csr->commandStream.getUsed();
|
||||
MockGraphicsAllocation clearColorAlloc;
|
||||
}
|
||||
|
||||
{
|
||||
// 2D
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopy(allocation, allocation,
|
||||
0, 0, {(2 * BlitterConstants::maxBlitWidth) + 1, 1, 1}, 0, 0, 0, 0, &clearColorAlloc);
|
||||
blitBuffer(csr, blitProperties, false, clDevice->getDevice());
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(csr->commandStream, offset);
|
||||
|
||||
auto cmdIterator = find<MEM_COPY *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
|
||||
ASSERT_NE(hwParser.cmdList.end(), cmdIterator);
|
||||
|
||||
auto bltCmd = genCmdCast<MEM_COPY *>(*cmdIterator);
|
||||
EXPECT_NE(nullptr, bltCmd);
|
||||
|
||||
EXPECT_EQ(MEM_COPY::COPY_TYPE::COPY_TYPE_MATRIX_COPY, bltCmd->getCopyType());
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_EXCLUDE_PRODUCT(CommandQueueHwTest, givenCommandQueueWhenAskingForCacheFlushOnBcsThenReturnTrue, IGFX_XE_HPC_CORE);
|
||||
|
||||
using XeHpcCoreCopyEngineTests = ::testing::Test;
|
||||
XE_HPC_CORETEST_F(XeHpcCoreCopyEngineTests, givenCommandQueueWhenAskingForCacheFlushOnBcsThenReturnFalse) {
|
||||
auto clDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
|
||||
MockContext context(clDevice.get());
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto commandQueue = std::unique_ptr<CommandQueue>(CommandQueue::create(&context, clDevice.get(), nullptr, false, retVal));
|
||||
auto commandQueueHw = static_cast<CommandQueueHw<FamilyType> *>(commandQueue.get());
|
||||
|
||||
EXPECT_FALSE(commandQueueHw->isCacheFlushForBcsRequired());
|
||||
}
|
||||
XE_HPC_CORETEST_F(XeHpcCoreCopyEngineTests, givenDebugFlagSetWhenCheckingBcsCacheFlushRequirementThenReturnCorrectValueForGen12p8) {
|
||||
DebugManagerStateRestore restorer;
|
||||
auto clDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
|
||||
MockContext context(clDevice.get());
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto commandQueue = std::unique_ptr<CommandQueue>(CommandQueue::create(&context, clDevice.get(), nullptr, false, retVal));
|
||||
auto commandQueueHw = static_cast<CommandQueueHw<FamilyType> *>(commandQueue.get());
|
||||
|
||||
DebugManager.flags.ForceCacheFlushForBcs.set(0);
|
||||
EXPECT_FALSE(commandQueueHw->isCacheFlushForBcsRequired());
|
||||
|
||||
DebugManager.flags.ForceCacheFlushForBcs.set(1);
|
||||
EXPECT_TRUE(commandQueueHw->isCacheFlushForBcsRequired());
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/os_interface/device_factory.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/mocks/mock_platform.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using WalkerDispatchTestsXeHpcCore = ::testing::Test;
|
||||
|
||||
XE_HPC_CORETEST_F(WalkerDispatchTestsXeHpcCore, whenEncodeAdditionalWalkerFieldsThenPostSyncDataIsCorrectlySet) {
|
||||
struct {
|
||||
unsigned short revisionId;
|
||||
int32_t programGlobalFenceAsPostSyncOperationInComputeWalker;
|
||||
bool expectSystemMemoryFenceRequest;
|
||||
} testInputs[] = {
|
||||
{0x0, -1, false},
|
||||
{0x3, -1, true},
|
||||
{0x0, 0, false},
|
||||
{0x3, 0, false},
|
||||
{0x0, 1, true},
|
||||
{0x3, 1, true},
|
||||
};
|
||||
|
||||
DebugManagerStateRestore debugRestorer;
|
||||
auto walkerCmd = FamilyType::cmdInitGpgpuWalker;
|
||||
auto &postSyncData = walkerCmd.getPostSync();
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
|
||||
for (auto &testInput : testInputs) {
|
||||
hwInfo.platform.usRevId = testInput.revisionId;
|
||||
DebugManager.flags.ProgramGlobalFenceAsPostSyncOperationInComputeWalker.set(
|
||||
testInput.programGlobalFenceAsPostSyncOperationInComputeWalker);
|
||||
|
||||
postSyncData.setSystemMemoryFenceRequest(false);
|
||||
|
||||
EncodeDispatchKernel<FamilyType>::encodeAdditionalWalkerFields(hwInfo, walkerCmd, KernelExecutionType::Default);
|
||||
EXPECT_EQ(testInput.expectSystemMemoryFenceRequest, postSyncData.getSystemMemoryFenceRequest());
|
||||
}
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(WalkerDispatchTestsXeHpcCore, givenPvcWhenEncodeAdditionalWalkerFieldsIsCalledThenComputeDispatchAllIsCorrectlySet) {
|
||||
using COMPUTE_WALKER = typename FamilyType::COMPUTE_WALKER;
|
||||
DebugManagerStateRestore debugRestorer;
|
||||
auto walkerCmd = FamilyType::cmdInitGpgpuWalker;
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
|
||||
{
|
||||
EncodeDispatchKernel<FamilyType>::encodeAdditionalWalkerFields(hwInfo, walkerCmd, KernelExecutionType::Default);
|
||||
EXPECT_FALSE(walkerCmd.getComputeDispatchAllWalkerEnable());
|
||||
}
|
||||
|
||||
{
|
||||
DebugManager.flags.ComputeDispatchAllWalkerEnableInComputeWalker.set(1);
|
||||
EncodeDispatchKernel<FamilyType>::encodeAdditionalWalkerFields(hwInfo, walkerCmd, KernelExecutionType::Default);
|
||||
EXPECT_TRUE(walkerCmd.getComputeDispatchAllWalkerEnable());
|
||||
}
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(WalkerDispatchTestsXeHpcCore, givenPvcXtTemporaryWhenEncodeAdditionalWalkerFieldsIsCalledThenComputeDispatchAllIsCorrectlySet) {
|
||||
using COMPUTE_WALKER = typename FamilyType::COMPUTE_WALKER;
|
||||
DebugManagerStateRestore debugRestorer;
|
||||
DebugManager.flags.ForceDeviceId.set("0x0BE5");
|
||||
|
||||
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(*executionEnvironment);
|
||||
auto hwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo();
|
||||
auto walkerCmd = FamilyType::cmdInitGpgpuWalker;
|
||||
|
||||
{
|
||||
EncodeDispatchKernel<FamilyType>::encodeAdditionalWalkerFields(hwInfo, walkerCmd, KernelExecutionType::Default);
|
||||
EXPECT_FALSE(walkerCmd.getComputeDispatchAllWalkerEnable());
|
||||
}
|
||||
|
||||
{
|
||||
EncodeDispatchKernel<FamilyType>::encodeAdditionalWalkerFields(hwInfo, walkerCmd, KernelExecutionType::Concurrent);
|
||||
EXPECT_TRUE(walkerCmd.getComputeDispatchAllWalkerEnable());
|
||||
}
|
||||
}
|
175
opencl/test/unit_test/xe_hpc_core/enqueue_tests_xe_hpc_core.cpp
Normal file
175
opencl/test/unit_test/xe_hpc_core/enqueue_tests_xe_hpc_core.cpp
Normal file
@ -0,0 +1,175 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.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/common/mocks/mock_graphics_allocation.h"
|
||||
|
||||
#include "opencl/source/command_queue/hardware_interface.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct EnqueueFixtureXeHpcCore : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
DebugManager.flags.EnableMemoryPrefetch.set(1);
|
||||
|
||||
clDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get(), mockRootDeviceIndex));
|
||||
context = std::make_unique<MockContext>(clDevice.get());
|
||||
|
||||
mockKernel = std::make_unique<MockKernelWithInternals>(*clDevice, context.get());
|
||||
mockKernel->kernelInfo.createKernelAllocation(clDevice->getDevice(), false);
|
||||
|
||||
dispatchInfo = {clDevice.get(), mockKernel->mockKernel, 1, 0, 0, 0};
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
clDevice->getMemoryManager()->freeGraphicsMemory(mockKernel->kernelInfo.getGraphicsAllocation());
|
||||
}
|
||||
|
||||
template <typename FamilyType>
|
||||
std::unique_ptr<MockCommandQueueHw<FamilyType>> createCommandQueue() {
|
||||
return std::make_unique<MockCommandQueueHw<FamilyType>>(context.get(), clDevice.get(), nullptr);
|
||||
}
|
||||
|
||||
DebugManagerStateRestore restore;
|
||||
std::unique_ptr<MockClDevice> clDevice;
|
||||
std::unique_ptr<MockContext> context;
|
||||
std::unique_ptr<MockKernelWithInternals> mockKernel;
|
||||
DispatchInfo dispatchInfo;
|
||||
};
|
||||
|
||||
using MemoryPrefetchTestsXeHpcCore = EnqueueFixtureXeHpcCore;
|
||||
|
||||
XE_HPC_CORETEST_F(MemoryPrefetchTestsXeHpcCore, givenKernelWhenWalkerIsProgrammedThenPrefetchIsaBeforeWalker) {
|
||||
using COMPUTE_WALKER = typename FamilyType::COMPUTE_WALKER;
|
||||
using STATE_PREFETCH = typename FamilyType::STATE_PREFETCH;
|
||||
|
||||
auto commandQueue = createCommandQueue<FamilyType>();
|
||||
auto &commandStream = commandQueue->getCS(1024);
|
||||
|
||||
auto &heap = commandQueue->getIndirectHeap(IndirectHeap::Type::DYNAMIC_STATE, 1);
|
||||
size_t workSize[] = {1, 1, 1};
|
||||
Vec3<size_t> wgInfo = {1, 1, 1};
|
||||
|
||||
uint32_t iddIndex = 0;
|
||||
mockKernel->kernelInfo.heapInfo.KernelHeapSize = 1;
|
||||
HardwareInterface<FamilyType>::programWalker(commandStream, *mockKernel->mockKernel, *commandQueue,
|
||||
nullptr, heap, heap, heap, workSize, workSize,
|
||||
PreemptionMode::Disabled, 0, iddIndex,
|
||||
dispatchInfo, 0, wgInfo, wgInfo);
|
||||
|
||||
HardwareParse hwParse;
|
||||
hwParse.parseCommands<FamilyType>(commandStream, 0);
|
||||
auto itorWalker = find<COMPUTE_WALKER *>(hwParse.cmdList.begin(), hwParse.cmdList.end());
|
||||
EXPECT_NE(hwParse.cmdList.end(), itorWalker);
|
||||
|
||||
auto itorStatePrefetch = find<STATE_PREFETCH *>(hwParse.cmdList.begin(), itorWalker);
|
||||
EXPECT_NE(itorWalker, itorStatePrefetch);
|
||||
|
||||
auto statePrefetchCmd = genCmdCast<STATE_PREFETCH *>(*itorStatePrefetch);
|
||||
EXPECT_NE(nullptr, statePrefetchCmd);
|
||||
|
||||
EXPECT_EQ(mockKernel->kernelInfo.getGraphicsAllocation()->getGpuAddress(), statePrefetchCmd->getAddress());
|
||||
EXPECT_TRUE(statePrefetchCmd->getKernelInstructionPrefetch());
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(MemoryPrefetchTestsXeHpcCore, givenPrefetchEnabledWhenEstimatingCommandsSizeThenAddStatePrefetch) {
|
||||
auto commandQueue = createCommandQueue<FamilyType>();
|
||||
|
||||
size_t numPipeControls = MemorySynchronizationCommands<FamilyType>::isPipeControlWArequired(clDevice->getHardwareInfo()) ? 2 : 1;
|
||||
|
||||
size_t expected = sizeof(typename FamilyType::COMPUTE_WALKER) +
|
||||
(sizeof(typename FamilyType::PIPE_CONTROL) * numPipeControls) +
|
||||
HardwareCommandsHelper<FamilyType>::getSizeRequiredCS() +
|
||||
EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(mockKernel->kernelInfo.heapInfo.KernelHeapSize);
|
||||
|
||||
EXPECT_EQ(expected, EnqueueOperation<FamilyType>::getSizeRequiredCS(CL_COMMAND_NDRANGE_KERNEL, false, false, *commandQueue, mockKernel->mockKernel, {}));
|
||||
}
|
||||
|
||||
using ProgramWalkerTestsXeHpcCore = EnqueueFixtureXeHpcCore;
|
||||
|
||||
XE_HPC_CORETEST_F(ProgramWalkerTestsXeHpcCore, givenDebugVariableSetWhenProgrammingWalkerThenSetL3Prefetch) {
|
||||
using COMPUTE_WALKER = typename FamilyType::COMPUTE_WALKER;
|
||||
|
||||
auto commandQueue = createCommandQueue<FamilyType>();
|
||||
auto &commandStream = commandQueue->getCS(1024);
|
||||
|
||||
auto &heap = commandQueue->getIndirectHeap(IndirectHeap::Type::DYNAMIC_STATE, 1);
|
||||
size_t workSize[] = {1, 1, 1};
|
||||
Vec3<size_t> wgInfo = {1, 1, 1};
|
||||
|
||||
uint32_t iddIndex = 0;
|
||||
size_t commandsOffset = 0;
|
||||
|
||||
{
|
||||
// default
|
||||
|
||||
HardwareInterface<FamilyType>::programWalker(commandStream, *mockKernel->mockKernel, *commandQueue,
|
||||
nullptr, heap, heap, heap, workSize, workSize,
|
||||
PreemptionMode::Disabled, 0, iddIndex,
|
||||
dispatchInfo, 0, wgInfo, wgInfo);
|
||||
|
||||
HardwareParse hwParse;
|
||||
hwParse.parseCommands<FamilyType>(commandStream, 0);
|
||||
auto itorWalker = find<COMPUTE_WALKER *>(hwParse.cmdList.begin(), hwParse.cmdList.end());
|
||||
EXPECT_NE(hwParse.cmdList.end(), itorWalker);
|
||||
auto walkerCmd = genCmdCast<COMPUTE_WALKER *>(*itorWalker);
|
||||
EXPECT_NE(nullptr, walkerCmd);
|
||||
|
||||
EXPECT_FALSE(walkerCmd->getL3PrefetchDisable());
|
||||
}
|
||||
|
||||
{
|
||||
// debug flag == 1
|
||||
|
||||
commandsOffset = commandStream.getUsed();
|
||||
DebugManager.flags.ForceL3PrefetchForComputeWalker.set(1);
|
||||
|
||||
HardwareInterface<FamilyType>::programWalker(commandStream, *mockKernel->mockKernel, *commandQueue,
|
||||
nullptr, heap, heap, heap, workSize, workSize,
|
||||
PreemptionMode::Disabled, 0, iddIndex,
|
||||
dispatchInfo, 0, wgInfo, wgInfo);
|
||||
|
||||
HardwareParse hwParse;
|
||||
hwParse.parseCommands<FamilyType>(commandStream, commandsOffset);
|
||||
auto itorWalker = find<COMPUTE_WALKER *>(hwParse.cmdList.begin(), hwParse.cmdList.end());
|
||||
EXPECT_NE(hwParse.cmdList.end(), itorWalker);
|
||||
auto walkerCmd = genCmdCast<COMPUTE_WALKER *>(*itorWalker);
|
||||
EXPECT_NE(nullptr, walkerCmd);
|
||||
|
||||
EXPECT_FALSE(walkerCmd->getL3PrefetchDisable());
|
||||
}
|
||||
|
||||
{
|
||||
// debug flag == 0
|
||||
|
||||
commandsOffset = commandStream.getUsed();
|
||||
DebugManager.flags.ForceL3PrefetchForComputeWalker.set(0);
|
||||
|
||||
HardwareInterface<FamilyType>::programWalker(commandStream, *mockKernel->mockKernel, *commandQueue,
|
||||
nullptr, heap, heap, heap, workSize, workSize,
|
||||
PreemptionMode::Disabled, 0, iddIndex,
|
||||
dispatchInfo, 0, wgInfo, wgInfo);
|
||||
|
||||
HardwareParse hwParse;
|
||||
hwParse.parseCommands<FamilyType>(commandStream, commandsOffset);
|
||||
auto itorWalker = find<COMPUTE_WALKER *>(hwParse.cmdList.begin(), hwParse.cmdList.end());
|
||||
EXPECT_NE(hwParse.cmdList.end(), itorWalker);
|
||||
auto walkerCmd = genCmdCast<COMPUTE_WALKER *>(*itorWalker);
|
||||
EXPECT_NE(nullptr, walkerCmd);
|
||||
|
||||
EXPECT_TRUE(walkerCmd->getL3PrefetchDisable());
|
||||
}
|
||||
}
|
56
opencl/test/unit_test/xe_hpc_core/excludes_xe_hpc_core.cpp
Normal file
56
opencl/test/unit_test/xe_hpc_core/excludes_xe_hpc_core.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "test.h"
|
||||
|
||||
HWTEST_EXCLUDE_PRODUCT(BufferSetSurfaceTests, givenAlignedCacheableReadOnlyBufferThenChoseOclBufferPolicy, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(BufferSetSurfaceTests, givenBufferSetSurfaceThatMemoryIsUnalignedToCachelineButReadOnlyThenL3CacheShouldBeStillOn, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(HwHelperTestXeHPAndLater, givenVariousCachesRequestProperMOCSIndexesAreBeingReturned, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(ThreadArbitrationXeHPAndLater, givenPolicyWhenThreadArbitrationProgrammedThenDoNothing, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenComputeModeProgrammingWhenLargeGrfModeDoesntChangeThenSCMIsNotAdded, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenCoherencyWithoutSharedHandlesWhenCommandSizeIsCalculatedThenCorrectCommandSizeIsReturned, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenCoherencyWithSharedHandlesWhenCommandSizeIsCalculatedThenCorrectCommandSizeIsReturned, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenCoherencyWithoutSharedHandlesWhenComputeModeIsProgrammedThenCorrectCommandsAreAdded_ForceNonCoherentSupportedMatcher, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenCoherencyWithSharedHandlesWhenComputeModeIsProgrammedThenCorrectCommandsAreAdded_ForceNonCoherentSupportedMatcher, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenComputeModeCmdSizeWhenLargeGrfModeChangeIsRequiredThenSCMCommandSizeIsCalculated, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenComputeModeProgrammingWhenLargeGrfModeChangeIsRequiredThenCorrectCommandsAreAdded_ForceNonCoherentSupportedMatcher, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenComputeModeProgrammingWhenRequiredGRFNumberIsLowerThan128ThenSmallGRFModeIsProgrammed_ForceNonCoherentSupportedMatcher, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenComputeModeProgrammingWhenRequiredGRFNumberIsGreaterThan128ThenLargeGRFModeIsProgrammed_ForceNonCoherentSupportedMatcher, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(PipeControlHelperTestsXeHPAndLater, WhenAddingPipeControlWAThenCorrectCommandsAreProgrammed, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(QueueFamilyNameTest, givenRcsWhenGettingQueueFamilyNameThenReturnProperValue, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenVariousValuesWhenConvertingHwRevIdAndSteppingThenConversionIsCorrect, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(PipeControlHelperTests, givenHwHelperwhenAskingForDcFlushThenReturnTrue, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(MultiRootDeviceCommandStreamReceiverBufferTests, givenMultipleEventInMultiRootDeviceEnvironmentWhenTheyArePassedToEnqueueWithSubmissionThenCsIsWaitingForEventsFromPreviousDevices, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(EnqueueCopyBufferToImageStatelessTest, givenBigBufferWhenCopyingBufferToImageStatelessThenSuccessIsReturned, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(EnqueueCopyImageToBufferHwStatelessTest, givenBigBufferWhenCopyingImageToBufferStatelessThenSuccessIsReturned, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(BuiltInTests, givenBigOffsetAndSizeWhenBuilderCopyImageToBufferStatelessIsUsedThenParamsAreCorrect, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(DrmMemoryManagerTest, givenDrmAllocationWithHostPtrWhenItIsCreatedWithIncorrectCacheRegionThenReturnNull, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(DrmMemoryManagerTest, givenDrmAllocationWithWithAlignmentFromUserptrWhenItIsCreatedWithIncorrectCacheRegionThenReturnNull, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(ClDeviceHelperTests, givenDeviceWithoutClosBasedCacheReservationSupportWhenQueryingNumCacheClosDeviceInfoThenReturnZeroCacheClosRegions, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(HwHelperTest, whenGettingNumberOfCacheRegionsThenReturnZero, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(HwHelperTest, givenHwHelperWhenGettingISAPaddingThenCorrectValueIsReturned, IGFX_PVC);
|
||||
HWTEST_EXCLUDE_PRODUCT(LocalWorkSizeTest, givenDispatchInfoWhenWorkSizeInfoIsCreatedThenTestEuFusionFtr, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, whenCallingGetDeviceMemoryNameThenDdrIsReturned, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHardwareInfoWhenCallingIsMaxThreadsForWorkgroupWARequiredThenFalseIsReturned, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfPipeControlPriorToNonPipelinedStateCommandsWARequiredThenFalseIsReturned, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(CommandStreamReceiverFlushTasDg2AndLaterTests, givenProgramPipeControlPriorToNonPipelinedStateCommandWhenPerDssBackedBufferThenThereIsPipeControlPriorToIt_MatcherIsRTCapable, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(CommandStreamReceiverHwTestDg2AndLater, givenGen12AndLaterWhenRayTracingEnabledThenCommandIsAddedToBatchBuffer_MatcherIsRTCapable, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(CommandStreamReceiverHwTestDg2AndLater, givenGen12AndLaterWhenRayTracingEnabledButAlreadySentThenCommandIsNotAddedToBatchBuffer_MatcherIsRTCapable, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfTile64With3DSurfaceOnBCSIsSupportedThenTrueIsReturned, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(HardwareCommandsTest, GivenVariousValuesWhenAlignSlmSizeIsCalledThenCorrectValueIsReturned, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(HardwareCommandsTest, GivenVariousValuesWhenComputeSlmSizeIsCalledThenCorrectValueIsReturned, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(XeHPAndLaterDeviceCapsTests, givenHwInfoWhenSlmSizeIsRequiredThenReturnCorrectValue, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(DeviceGetCapsTest, givenDeviceWhenAskingForSubGroupSizesThenReturnCorrectValues, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(HwHelperTestXeHPAndLater, givenAllFlagsSetWhenGetGpgpuEnginesThenReturnThreeRcsEnginesFourCcsEnginesAndOneBcsEngine, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(HwHelperTestXeHPAndLater, givenCcsDisabledWhenGetGpgpuEnginesThenReturnRcsAndOneBcsEngine, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(HwHelperTestXeHPAndLater, givenBcsDisabledWhenGetGpgpuEnginesThenReturnThreeRcsEnginesFourCcsEngines, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(HwHelperTestXeHPAndLater, givenCcsDisabledAndNumberOfCcsEnabledWhenGetGpgpuEnginesThenReturnRcsAndOneBcsEngine, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(HwHelperTest, givenDefaultHwHelperHwWhenMinimalSIMDSizeIsQueriedThen8IsReturned, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(PipeControlHelperTestsXeHPAndLater, WhenGettingSizeForAdditionalSynchronizationThenCorrectValueIsReturned, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(HwHelperTest, whenQueryingMaxNumSamplersThenReturnSixteen, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(MemoryManagerGetAlloctionDataTests, givenCommandBufferAllocationTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(MultiDeviceStorageInfoTest, givenSingleTileCsrWhenAllocatingCsrSpecificAllocationsThenStoreThemInSystemMemory, IGFX_XE_HPC_CORE);
|
1068
opencl/test/unit_test/xe_hpc_core/hw_helper_tests_xe_hpc_core.cpp
Normal file
1068
opencl/test/unit_test/xe_hpc_core/hw_helper_tests_xe_hpc_core.cpp
Normal file
File diff suppressed because it is too large
Load Diff
24
opencl/test/unit_test/xe_hpc_core/pvc/CMakeLists.txt
Normal file
24
opencl/test/unit_test/xe_hpc_core/pvc/CMakeLists.txt
Normal file
@ -0,0 +1,24 @@
|
||||
#
|
||||
# Copyright (C) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(TESTS_PVC)
|
||||
set(IGDRCL_SRCS_tests_xe_hpc_core_pvc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_hw_tests_pvc.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compute_mode_tests_pvc.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/engine_node_helper_tests_pvc.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/get_device_info_pvc.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sampler_tests_pvc.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_pvc.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_pvc.cpp
|
||||
)
|
||||
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_xe_hpc_core_pvc})
|
||||
add_subdirectories()
|
||||
neo_copy_test_files_with_revision(copy_test_files_pvc_0 pvc 0)
|
||||
neo_copy_test_files_with_revision(copy_test_files_pvc_3 pvc 3)
|
||||
add_dependencies(copy_test_files_per_product copy_test_files_pvc_0)
|
||||
add_dependencies(copy_test_files_per_product copy_test_files_pvc_3)
|
||||
endif()
|
@ -0,0 +1,316 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/command_stream_receiver_hw.h"
|
||||
#include "shared/source/command_stream/thread_arbitration_policy.h"
|
||||
#include "shared/source/gmm_helper/client_context/gmm_client_context.h"
|
||||
#include "shared/source/gmm_helper/resource_info.h"
|
||||
#include "shared/source/helpers/blit_commands_helper.h"
|
||||
#include "shared/source/helpers/engine_node_helper.h"
|
||||
#include "shared/source/helpers/preamble.h"
|
||||
#include "shared/source/os_interface/device_factory.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/libult/ult_aub_command_stream_receiver.h"
|
||||
#include "shared/test/unit_test/utilities/base_object_utils.h"
|
||||
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/fixtures/multi_root_device_fixture.h"
|
||||
#include "opencl/test/unit_test/fixtures/ult_command_stream_receiver_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_event.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_program.h"
|
||||
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
HWTEST_EXCLUDE_PRODUCT(CommandStreamReceiverFlushTaskTests, givenOverrideThreadArbitrationPolicyDebugVariableSetWhenFlushingThenRequestRequiredMode, IGFX_PVC);
|
||||
HWTEST_EXCLUDE_PRODUCT(XeHPAndLaterAubCommandStreamReceiverWithoutFixtureTests, GivenCopyHostPtrAndHostNoAccessAndReadOnlyFlagsWhenAllocatingBufferThenAllocationIsCopiedToEveryTile, IGFX_PVC);
|
||||
HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenCoherencyWithSharedHandlesWhenCommandSizeIsCalculatedThenCorrectCommandSizeIsReturned, IGFX_PVC);
|
||||
|
||||
using PvcCommandStreamReceiverFlushTaskTests = UltCommandStreamReceiverTest;
|
||||
PVCTEST_F(PvcCommandStreamReceiverFlushTaskTests, givenOverrideThreadArbitrationPolicyDebugVariableSetForPvcWhenFlushingThenRequestRequiredMode) {
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
DebugManagerStateRestore restore;
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
commandStreamReceiver.requiredThreadArbitrationPolicy = commandStreamReceiver.lastSentThreadArbitrationPolicy = static_cast<uint32_t>(STATE_COMPUTE_MODE::EU_THREAD_SCHEDULING_MODE_OVERRIDE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_HW_DEFAULT);
|
||||
|
||||
DebugManager.flags.OverrideThreadArbitrationPolicy.set(ThreadArbitrationPolicy::RoundRobin);
|
||||
|
||||
flushTask(commandStreamReceiver);
|
||||
|
||||
EXPECT_EQ(ThreadArbitrationPolicy::RoundRobin, commandStreamReceiver.lastSentThreadArbitrationPolicy);
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcCommandStreamReceiverFlushTaskTests, givenNotExistPolicyWhenFlushingThenDefaultPolicyIsProgrammed) {
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
char buff[1024] = {0};
|
||||
LinearStream stream(buff, 1024);
|
||||
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||
uint32_t notExistPolicy = -2;
|
||||
commandStreamReceiver.requiredThreadArbitrationPolicy = notExistPolicy;
|
||||
|
||||
flushTask(commandStreamReceiver);
|
||||
|
||||
EXPECT_EQ(notExistPolicy, commandStreamReceiver.lastSentThreadArbitrationPolicy);
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcCommandStreamReceiverFlushTaskTests, givenRevisionBAndAboveWhenLastSpecialPipelineSelectModeIsTrueAndFlushTaskIsCalledThenDontReprogramPipelineSelect) {
|
||||
auto hwInfo = pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
flushTaskFlags.pipelineSelectArgs.specialPipelineSelectMode = true;
|
||||
flushTaskFlags.pipelineSelectArgs.mediaSamplerRequired = false;
|
||||
|
||||
struct {
|
||||
unsigned short revId;
|
||||
bool expectedValue;
|
||||
} testInputs[] = {
|
||||
{0x0, true},
|
||||
{0x1, true},
|
||||
{0x3, true},
|
||||
{0x5, false},
|
||||
{0x6, false},
|
||||
{0x7, false},
|
||||
};
|
||||
for (auto &testInput : testInputs) {
|
||||
hwInfo->platform.usRevId = testInput.revId;
|
||||
commandStreamReceiver.isPreambleSent = true;
|
||||
commandStreamReceiver.lastMediaSamplerConfig = false;
|
||||
|
||||
flushTask(commandStreamReceiver);
|
||||
|
||||
EXPECT_EQ(testInput.expectedValue, commandStreamReceiver.lastSpecialPipelineSelectMode);
|
||||
commandStreamReceiver.lastSpecialPipelineSelectMode = false;
|
||||
}
|
||||
}
|
||||
|
||||
struct PVcBcsTests : public UltCommandStreamReceiverTest {
|
||||
void SetUp() override {
|
||||
DebugManager.flags.EnableLocalMemory.set(true);
|
||||
UltCommandStreamReceiverTest::SetUp();
|
||||
context = std::make_unique<MockContext>(pClDevice);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
context.reset();
|
||||
UltCommandStreamReceiverTest::TearDown();
|
||||
}
|
||||
|
||||
DebugManagerStateRestore restore;
|
||||
std::unique_ptr<MockContext> context;
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
};
|
||||
|
||||
PVCTEST_F(PVcBcsTests, givenCompressibleBuffersWhenStatefulCompressionIsEnabledThenProgramBlitterWithStatefulCompressionSettings) {
|
||||
DebugManager.flags.RenderCompressedBuffersEnabled.set(1);
|
||||
|
||||
using MEM_COPY = typename FamilyType::MEM_COPY;
|
||||
char buff[1024] = {0};
|
||||
LinearStream stream(buff, 1024);
|
||||
MockGraphicsAllocation clearColorAlloc;
|
||||
|
||||
auto srcBuffer = clUniquePtr<Buffer>(Buffer::create(context.get(), {}, MemoryConstants::pageSize64k, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
auto dstBuffer = clUniquePtr<Buffer>(Buffer::create(context.get(), {}, MemoryConstants::pageSize64k, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
auto srcAllocation = srcBuffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex());
|
||||
EXPECT_TRUE(srcAllocation->getDefaultGmm()->isCompressionEnabled);
|
||||
|
||||
auto dstAllocation = dstBuffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex());
|
||||
EXPECT_TRUE(dstAllocation->getDefaultGmm()->isCompressionEnabled);
|
||||
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopy(srcAllocation, dstAllocation, 0, 0,
|
||||
{BlitterConstants::maxBlitWidth - 1, 1, 1}, 0, 0, 0, 0, &clearColorAlloc);
|
||||
auto bltCmd = stream.getSpaceForCmd<MEM_COPY>();
|
||||
*bltCmd = FamilyType::cmdInitXyCopyBlt;
|
||||
|
||||
platformsImpl->clear();
|
||||
EXPECT_EQ(platform(), nullptr);
|
||||
|
||||
const auto &rootDeviceEnvironment = context->getDevice(0)->getRootDeviceEnvironment();
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsForBuffer(blitProperties, *bltCmd, rootDeviceEnvironment);
|
||||
|
||||
EXPECT_EQ(bltCmd->getDestinationCompressionEnable(), MEM_COPY::DESTINATION_COMPRESSION_ENABLE::DESTINATION_COMPRESSION_ENABLE_ENABLE);
|
||||
EXPECT_EQ(bltCmd->getDestinationCompressible(), MEM_COPY::DESTINATION_COMPRESSIBLE::DESTINATION_COMPRESSIBLE_COMPRESSIBLE);
|
||||
EXPECT_EQ(bltCmd->getSourceCompressible(), MEM_COPY::SOURCE_COMPRESSIBLE::SOURCE_COMPRESSIBLE_COMPRESSIBLE);
|
||||
|
||||
auto resourceFormat = srcAllocation->getDefaultGmm()->gmmResourceInfo->getResourceFormat();
|
||||
auto compressionFormat = rootDeviceEnvironment.getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat);
|
||||
|
||||
EXPECT_EQ(compressionFormat, bltCmd->getCompressionFormat());
|
||||
}
|
||||
|
||||
PVCTEST_F(PVcBcsTests, givenBufferInDeviceMemoryWhenStatelessCompressionIsEnabledThenBlitterForBufferUsesStatelessCompressedSettings) {
|
||||
using MEM_COPY = typename FamilyType::MEM_COPY;
|
||||
char buff[1024] = {0};
|
||||
LinearStream stream(buff, 1024);
|
||||
MockGraphicsAllocation clearColorAlloc;
|
||||
|
||||
auto buffer = clUniquePtr<Buffer>(Buffer::create(context.get(), {}, MemoryConstants::pageSize64k, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
auto allocation = buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex());
|
||||
EXPECT_TRUE(!MemoryPool::isSystemMemoryPool(allocation->getMemoryPool()));
|
||||
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopy(allocation, allocation,
|
||||
0, 0, {BlitterConstants::maxBlitWidth - 1, 1, 1}, 0, 0, 0, 0, &clearColorAlloc);
|
||||
auto bltCmd = stream.getSpaceForCmd<MEM_COPY>();
|
||||
*bltCmd = FamilyType::cmdInitXyCopyBlt;
|
||||
|
||||
DebugManager.flags.EnableStatelessCompressionWithUnifiedMemory.set(true);
|
||||
platformsImpl->clear();
|
||||
EXPECT_EQ(platform(), nullptr);
|
||||
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsForBuffer(blitProperties, *bltCmd, context->getDevice(0)->getRootDeviceEnvironment());
|
||||
|
||||
EXPECT_EQ(bltCmd->getDestinationCompressionEnable(), MEM_COPY::DESTINATION_COMPRESSION_ENABLE::DESTINATION_COMPRESSION_ENABLE_ENABLE);
|
||||
EXPECT_EQ(bltCmd->getDestinationCompressible(), MEM_COPY::DESTINATION_COMPRESSIBLE::DESTINATION_COMPRESSIBLE_COMPRESSIBLE);
|
||||
EXPECT_EQ(bltCmd->getSourceCompressible(), MEM_COPY::SOURCE_COMPRESSIBLE::SOURCE_COMPRESSIBLE_COMPRESSIBLE);
|
||||
EXPECT_EQ(static_cast<uint32_t>(DebugManager.flags.FormatForStatelessCompressionWithUnifiedMemory.get()), bltCmd->getCompressionFormat());
|
||||
}
|
||||
|
||||
PVCTEST_F(PVcBcsTests, givenBufferInSystemMemoryWhenStatelessCompressionIsEnabledThenBlitterForBufferDoesntUseStatelessCompressedSettings) {
|
||||
using MEM_COPY = typename FamilyType::MEM_COPY;
|
||||
char buff[1024] = {0};
|
||||
LinearStream stream(buff, 1024);
|
||||
MockGraphicsAllocation clearColorAlloc;
|
||||
|
||||
auto buffer = clUniquePtr<Buffer>(Buffer::create(context.get(), CL_MEM_FORCE_HOST_MEMORY_INTEL, MemoryConstants::pageSize64k, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
auto allocation = buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex());
|
||||
EXPECT_TRUE(MemoryPool::isSystemMemoryPool(allocation->getMemoryPool()));
|
||||
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopy(allocation, allocation,
|
||||
0, 0, {BlitterConstants::maxBlitWidth - 1, 1, 1}, 0, 0, 0, 0, &clearColorAlloc);
|
||||
auto bltCmd = stream.getSpaceForCmd<MEM_COPY>();
|
||||
*bltCmd = FamilyType::cmdInitXyCopyBlt;
|
||||
|
||||
DebugManager.flags.EnableStatelessCompressionWithUnifiedMemory.set(true);
|
||||
platformsImpl->clear();
|
||||
EXPECT_EQ(platform(), nullptr);
|
||||
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsForBuffer(blitProperties, *bltCmd, context->getDevice(0)->getRootDeviceEnvironment());
|
||||
|
||||
EXPECT_EQ(bltCmd->getDestinationCompressionEnable(), MEM_COPY::DESTINATION_COMPRESSION_ENABLE::DESTINATION_COMPRESSION_ENABLE_DISABLE);
|
||||
EXPECT_EQ(bltCmd->getDestinationCompressible(), MEM_COPY::DESTINATION_COMPRESSIBLE::DESTINATION_COMPRESSIBLE_NOT_COMPRESSIBLE);
|
||||
EXPECT_EQ(bltCmd->getSourceCompressible(), MEM_COPY::SOURCE_COMPRESSIBLE::SOURCE_COMPRESSIBLE_NOT_COMPRESSIBLE);
|
||||
EXPECT_EQ(0u, bltCmd->getCompressionFormat());
|
||||
}
|
||||
|
||||
using PvcMultiRootDeviceCommandStreamReceiverBufferTests = MultiRootDeviceFixture;
|
||||
|
||||
PVCTEST_F(PvcMultiRootDeviceCommandStreamReceiverBufferTests, givenMultipleEventInMultiRootDeviceEnvironmentOnPvcWhenTheyArePassedToEnqueueWithSubmissionThenCsIsWaitingForEventsFromPreviousDevices) {
|
||||
REQUIRE_SVM_OR_SKIP(device1);
|
||||
REQUIRE_SVM_OR_SKIP(device2);
|
||||
|
||||
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
|
||||
cl_int retVal = 0;
|
||||
size_t offset = 0;
|
||||
size_t size = 1;
|
||||
|
||||
auto pCmdQ1 = context.get()->getSpecialQueue(1u);
|
||||
auto pCmdQ2 = context.get()->getSpecialQueue(2u);
|
||||
|
||||
std::unique_ptr<MockProgram> program(Program::createBuiltInFromSource<MockProgram>("FillBufferBytes", context.get(), context.get()->getDevices(), &retVal));
|
||||
program->build(program->getDevices(), nullptr, false);
|
||||
std::unique_ptr<MockKernel> kernel(Kernel::create<MockKernel>(program.get(), program->getKernelInfoForKernel("FillBufferBytes"), *context.get()->getDevice(0), &retVal));
|
||||
|
||||
size_t svmSize = 4096;
|
||||
void *svmPtr = alignedMalloc(svmSize, MemoryConstants::pageSize);
|
||||
MockGraphicsAllocation svmAlloc(svmPtr, svmSize);
|
||||
|
||||
Event event1(pCmdQ1, CL_COMMAND_NDRANGE_KERNEL, 5, 15);
|
||||
Event event2(nullptr, CL_COMMAND_NDRANGE_KERNEL, 6, 16);
|
||||
Event event3(pCmdQ1, CL_COMMAND_NDRANGE_KERNEL, 4, 20);
|
||||
Event event4(pCmdQ2, CL_COMMAND_NDRANGE_KERNEL, 3, 4);
|
||||
Event event5(pCmdQ2, CL_COMMAND_NDRANGE_KERNEL, 2, 7);
|
||||
UserEvent userEvent1(&pCmdQ1->getContext());
|
||||
UserEvent userEvent2(&pCmdQ2->getContext());
|
||||
|
||||
userEvent1.setStatus(CL_COMPLETE);
|
||||
userEvent2.setStatus(CL_COMPLETE);
|
||||
|
||||
cl_event eventWaitList[] =
|
||||
{
|
||||
&event1,
|
||||
&event2,
|
||||
&event3,
|
||||
&event4,
|
||||
&event5,
|
||||
&userEvent1,
|
||||
&userEvent2,
|
||||
};
|
||||
cl_uint numEventsInWaitList = sizeof(eventWaitList) / sizeof(eventWaitList[0]);
|
||||
|
||||
{
|
||||
kernel->setSvmKernelExecInfo(&svmAlloc);
|
||||
|
||||
retVal = pCmdQ1->enqueueKernel(
|
||||
kernel.get(),
|
||||
1,
|
||||
&offset,
|
||||
&size,
|
||||
&size,
|
||||
numEventsInWaitList,
|
||||
eventWaitList,
|
||||
nullptr);
|
||||
|
||||
HardwareParse csHwParser;
|
||||
csHwParser.parseCommands<FamilyType>(pCmdQ1->getCS(0));
|
||||
auto semaphores = findAll<MI_SEMAPHORE_WAIT *>(csHwParser.cmdList.begin(), csHwParser.cmdList.end());
|
||||
|
||||
EXPECT_EQ(3u, semaphores.size());
|
||||
|
||||
auto semaphoreCmd0 = genCmdCast<MI_SEMAPHORE_WAIT *>(*(semaphores[0]));
|
||||
EXPECT_EQ(4u, semaphoreCmd0->getSemaphoreDataDword());
|
||||
EXPECT_EQ(reinterpret_cast<uint64_t>(pCmdQ2->getGpgpuCommandStreamReceiver().getTagAddress()), semaphoreCmd0->getSemaphoreGraphicsAddress());
|
||||
|
||||
auto semaphoreCmd1 = genCmdCast<MI_SEMAPHORE_WAIT *>(*(semaphores[1]));
|
||||
EXPECT_EQ(7u, semaphoreCmd1->getSemaphoreDataDword());
|
||||
EXPECT_EQ(reinterpret_cast<uint64_t>(pCmdQ2->getGpgpuCommandStreamReceiver().getTagAddress()), semaphoreCmd1->getSemaphoreGraphicsAddress());
|
||||
}
|
||||
|
||||
{
|
||||
kernel->setSvmKernelExecInfo(&svmAlloc);
|
||||
|
||||
retVal = pCmdQ2->enqueueKernel(
|
||||
kernel.get(),
|
||||
1,
|
||||
&offset,
|
||||
&size,
|
||||
&size,
|
||||
numEventsInWaitList,
|
||||
eventWaitList,
|
||||
nullptr);
|
||||
|
||||
HardwareParse csHwParser;
|
||||
csHwParser.parseCommands<FamilyType>(pCmdQ2->getCS(0));
|
||||
auto semaphores = findAll<MI_SEMAPHORE_WAIT *>(csHwParser.cmdList.begin(), csHwParser.cmdList.end());
|
||||
|
||||
EXPECT_EQ(3u, semaphores.size());
|
||||
|
||||
auto semaphoreCmd0 = genCmdCast<MI_SEMAPHORE_WAIT *>(*(semaphores[0]));
|
||||
EXPECT_EQ(15u, semaphoreCmd0->getSemaphoreDataDword());
|
||||
EXPECT_EQ(reinterpret_cast<uint64_t>(pCmdQ1->getGpgpuCommandStreamReceiver().getTagAddress()), semaphoreCmd0->getSemaphoreGraphicsAddress());
|
||||
|
||||
auto semaphoreCmd1 = genCmdCast<MI_SEMAPHORE_WAIT *>(*(semaphores[1]));
|
||||
EXPECT_EQ(20u, semaphoreCmd1->getSemaphoreDataDword());
|
||||
EXPECT_EQ(reinterpret_cast<uint64_t>(pCmdQ1->getGpgpuCommandStreamReceiver().getTagAddress()), semaphoreCmd1->getSemaphoreGraphicsAddress());
|
||||
}
|
||||
alignedFree(svmPtr);
|
||||
}
|
446
opencl/test/unit_test/xe_hpc_core/pvc/compute_mode_tests_pvc.cpp
Normal file
446
opencl/test/unit_test/xe_hpc_core/pvc/compute_mode_tests_pvc.cpp
Normal file
@ -0,0 +1,446 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/state_compute_mode_helper.h"
|
||||
#include "shared/source/kernel/grf_config.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
#include "shared/test/common/mocks/mock_allocation_properties.h"
|
||||
|
||||
#include "opencl/test/unit_test/command_stream/compute_mode_tests.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using ThreadArbitrationPvc = ::testing::Test;
|
||||
PVCTEST_F(ThreadArbitrationPvc, givenPvcWhenCallgetDefaultThreadArbitrationPolicyThenAgeBasedisReturned) {
|
||||
EXPECT_EQ(ThreadArbitrationPolicy::AgeBased, HwHelperHw<FamilyType>::get().getDefaultThreadArbitrationPolicy());
|
||||
}
|
||||
|
||||
using PvcComputeModeRequirements = ComputeModeRequirements;
|
||||
|
||||
PVCTEST_F(PvcComputeModeRequirements, givenNewRequiredThreadArbitrationPolicyWhenComputeModeIsProgrammedThenStateComputeIsProgrammedAgain) {
|
||||
SetUpImpl<FamilyType>();
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
using EU_THREAD_SCHEDULING_MODE_OVERRIDE = typename STATE_COMPUTE_MODE::EU_THREAD_SCHEDULING_MODE_OVERRIDE;
|
||||
|
||||
auto cmdsSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
|
||||
char buff[1024] = {0};
|
||||
LinearStream stream(buff, 1024);
|
||||
auto newEuThreadSchedulingMode = ThreadArbitrationPolicy::RoundRobin;
|
||||
auto expectedEuThreadSchedulingMode = static_cast<EU_THREAD_SCHEDULING_MODE_OVERRIDE>(UnitTestHelper<FamilyType>::getAppropriateThreadArbitrationPolicy(newEuThreadSchedulingMode));
|
||||
|
||||
auto expectedScmCmd = FamilyType::cmdInitStateComputeMode;
|
||||
expectedScmCmd.setForceNonCoherent(STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT);
|
||||
expectedScmCmd.setMaskBits(FamilyType::stateComputeModeForceNonCoherentMask | FamilyType::stateComputeModeLargeGrfModeMask | FamilyType::stateComputeModeEuThreadSchedulingModeOverrideMask);
|
||||
expectedScmCmd.setEuThreadSchedulingModeOverride(expectedEuThreadSchedulingMode);
|
||||
|
||||
getCsrHw<FamilyType>()->lastSentThreadArbitrationPolicy = ThreadArbitrationPolicy::NotPresent;
|
||||
getCsrHw<FamilyType>()->requiredThreadArbitrationPolicy = newEuThreadSchedulingMode;
|
||||
|
||||
overrideComputeModeRequest<FamilyType>(false, false, false);
|
||||
getCsrHw<FamilyType>()->programComputeMode(stream, flags, *defaultHwInfo);
|
||||
EXPECT_EQ(cmdsSize, stream.getUsed());
|
||||
|
||||
auto scmCmd = reinterpret_cast<STATE_COMPUTE_MODE *>(ptrOffset(stream.getCpuBase(), sizeof(PIPE_CONTROL)));
|
||||
EXPECT_TRUE(memcmp(&expectedScmCmd, scmCmd, sizeof(STATE_COMPUTE_MODE)) == 0);
|
||||
|
||||
EXPECT_EQ(expectedEuThreadSchedulingMode, static_cast<STATE_COMPUTE_MODE *>(ptrOffset(stream.getCpuBase(), sizeof(PIPE_CONTROL)))->getEuThreadSchedulingModeOverride());
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcComputeModeRequirements, givenRequiredThreadArbitrationPolicyAlreadySetWhenComputeModeIsProgrammedThenStateComputeIsNotProgrammedAgain) {
|
||||
SetUpImpl<FamilyType>();
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
|
||||
auto cmdsSize = 0u;
|
||||
char buff[1024] = {0};
|
||||
LinearStream stream(buff, 1024);
|
||||
|
||||
auto expectedScmCmd = FamilyType::cmdInitStateComputeMode;
|
||||
expectedScmCmd.setForceNonCoherent(STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT);
|
||||
expectedScmCmd.setMaskBits(FamilyType::stateComputeModeForceNonCoherentMask | FamilyType::stateComputeModeLargeGrfModeMask);
|
||||
|
||||
overrideComputeModeRequest<FamilyType>(false, false, false, true);
|
||||
|
||||
getCsrHw<FamilyType>()->programComputeMode(stream, flags, *defaultHwInfo);
|
||||
EXPECT_EQ(cmdsSize, stream.getUsed());
|
||||
|
||||
auto scmCmd = reinterpret_cast<STATE_COMPUTE_MODE *>(stream.getCpuBase());
|
||||
EXPECT_FALSE(memcmp(&expectedScmCmd, scmCmd, sizeof(STATE_COMPUTE_MODE)) == 0);
|
||||
|
||||
EXPECT_NE(STATE_COMPUTE_MODE::EU_THREAD_SCHEDULING_MODE_OVERRIDE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_ROUND_ROBIN, static_cast<STATE_COMPUTE_MODE *>(stream.getCpuBase())->getEuThreadSchedulingModeOverride());
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcComputeModeRequirements, givenCoherencyWithoutSharedHandlesWhenCommandSizeIsCalculatedThenCorrectCommandSizeIsReturned) {
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
SetUpImpl<FamilyType>();
|
||||
|
||||
auto cmdsSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
|
||||
|
||||
getCsrHw<FamilyType>()->lastSentThreadArbitrationPolicy = getCsrHw<FamilyType>()->requiredThreadArbitrationPolicy;
|
||||
overrideComputeModeRequest<FamilyType>(false, false, false);
|
||||
auto retSize = getCsrHw<FamilyType>()->getCmdSizeForComputeMode();
|
||||
EXPECT_EQ(0u, retSize);
|
||||
|
||||
getCsrHw<FamilyType>()->lastSentThreadArbitrationPolicy = ThreadArbitrationPolicy::NotPresent;
|
||||
overrideComputeModeRequest<FamilyType>(false, false, false);
|
||||
retSize = getCsrHw<FamilyType>()->getCmdSizeForComputeMode();
|
||||
EXPECT_EQ(cmdsSize, retSize);
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcComputeModeRequirements, givenNumGrfRequiredChangedWhenCommandSizeIsCalculatedThenCorrectCommandSizeIsReturned) {
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
SetUpImpl<FamilyType>();
|
||||
auto updateLastSentThreadArbitrationPolicy = true;
|
||||
overrideComputeModeRequest<FamilyType>(false, false, false, updateLastSentThreadArbitrationPolicy);
|
||||
|
||||
auto numGrfRequired = 128u;
|
||||
auto numGrfRequiredChanged = false;
|
||||
overrideComputeModeRequest<FamilyType>(false, false, false, numGrfRequiredChanged, numGrfRequired);
|
||||
EXPECT_EQ(0u, getCsrHw<FamilyType>()->getCmdSizeForComputeMode());
|
||||
|
||||
numGrfRequiredChanged = true;
|
||||
overrideComputeModeRequest<FamilyType>(false, false, false, numGrfRequiredChanged, numGrfRequired);
|
||||
EXPECT_EQ(sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL), getCsrHw<FamilyType>()->getCmdSizeForComputeMode());
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcComputeModeRequirements, givenComputeModeProgrammingWhenLargeGrfModeDoesntChangeButRequiredThreadArbitrationPolicyIsNewThenSCMIsReloaded) {
|
||||
SetUpImpl<FamilyType>();
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
char buff[1024];
|
||||
LinearStream stream(buff, 1024);
|
||||
auto cmdsSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
|
||||
|
||||
overrideComputeModeRequest<FamilyType>(false, false, false, false);
|
||||
getCsrHw<FamilyType>()->programComputeMode(stream, flags, *defaultHwInfo);
|
||||
EXPECT_EQ(cmdsSize, stream.getUsed());
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcComputeModeRequirements, givenComputeModeProgrammingWhenLargeGrfModeChangedThenSCMIsReloadedAndLargeGrfModeProgrammed) {
|
||||
SetUpImpl<FamilyType>();
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
char buff[1024];
|
||||
LinearStream stream(buff, 1024);
|
||||
auto cmdsSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
|
||||
uint32_t numGrfRequired = GrfConfig::LargeGrfNumber;
|
||||
|
||||
getCsrHw<FamilyType>()->lastSentThreadArbitrationPolicy = ThreadArbitrationPolicy::NotPresent;
|
||||
overrideComputeModeRequest<FamilyType>(false, false, false, true, numGrfRequired);
|
||||
getCsrHw<FamilyType>()->programComputeMode(stream, flags, *defaultHwInfo);
|
||||
EXPECT_EQ(cmdsSize, stream.getUsed());
|
||||
|
||||
EXPECT_TRUE(static_cast<STATE_COMPUTE_MODE *>(ptrOffset(stream.getCpuBase(), sizeof(PIPE_CONTROL)))->getLargeGrfMode());
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcComputeModeRequirements, givenComputeModeProgrammingWhenLargeGrfRequiredChangedButValueIsDefaultThenSCMIsReloadedButLargeGrfModeNotProgrammed) {
|
||||
SetUpImpl<FamilyType>();
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
char buff[1024];
|
||||
LinearStream stream(buff, 1024);
|
||||
auto cmdsSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
|
||||
uint32_t numGrfRequired = GrfConfig::DefaultGrfNumber;
|
||||
|
||||
getCsrHw<FamilyType>()->lastSentThreadArbitrationPolicy = ThreadArbitrationPolicy::NotPresent;
|
||||
overrideComputeModeRequest<FamilyType>(false, false, false, true, numGrfRequired);
|
||||
getCsrHw<FamilyType>()->programComputeMode(stream, flags, *defaultHwInfo);
|
||||
EXPECT_EQ(cmdsSize, stream.getUsed());
|
||||
EXPECT_FALSE(static_cast<STATE_COMPUTE_MODE *>(stream.getCpuBase())->getLargeGrfMode());
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcComputeModeRequirements, giventhreadArbitrationPolicyWithoutSharedHandlesWhenFlushTaskCalledThenProgramCmdOnlyIfChanged) {
|
||||
SetUpImpl<FamilyType>();
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
auto startOffset = getCsrHw<FamilyType>()->commandStream.getUsed();
|
||||
|
||||
auto graphicAlloc = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
IndirectHeap stream(graphicAlloc);
|
||||
|
||||
auto flushTask = [&](bool threadArbitrationPolicyChanged) {
|
||||
getCsrHw<FamilyType>()->lastSentThreadArbitrationPolicy = threadArbitrationPolicyChanged ? ThreadArbitrationPolicy::NotPresent : getCsrHw<FamilyType>()->lastSentThreadArbitrationPolicy;
|
||||
startOffset = getCsrHw<FamilyType>()->commandStream.getUsed();
|
||||
csr->flushTask(stream, 0, stream, stream, stream, 0, flags, *device);
|
||||
};
|
||||
|
||||
auto findCmd = [&](bool expectToBeProgrammed) {
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(getCsrHw<FamilyType>()->commandStream, startOffset);
|
||||
bool foundOne = false;
|
||||
|
||||
uint32_t expectedCoherentMask = FamilyType::stateComputeModeForceNonCoherentMask | FamilyType::stateComputeModeLargeGrfModeMask | FamilyType::stateComputeModeEuThreadSchedulingModeOverrideMask;
|
||||
|
||||
for (auto it = hwParser.cmdList.begin(); it != hwParser.cmdList.end(); it++) {
|
||||
auto cmd = genCmdCast<STATE_COMPUTE_MODE *>(*it);
|
||||
if (cmd) {
|
||||
|
||||
EXPECT_EQ(expectedCoherentMask, cmd->getMaskBits());
|
||||
EXPECT_FALSE(foundOne);
|
||||
foundOne = true;
|
||||
auto pc = genCmdCast<PIPE_CONTROL *>(*(++it));
|
||||
EXPECT_EQ(nullptr, pc);
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(expectToBeProgrammed, foundOne);
|
||||
};
|
||||
|
||||
flushTask(true);
|
||||
findCmd(true); // first time
|
||||
|
||||
flushTask(false);
|
||||
findCmd(false); // not changed
|
||||
|
||||
flushTask(true);
|
||||
findCmd(true); // changed
|
||||
|
||||
csr->getMemoryManager()->freeGraphicsMemory(graphicAlloc);
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcComputeModeRequirements, givenCoherencyWithoutSharedHandlesWhenComputeModeIsProgrammedThenCorrectCommandsAreAdded) {
|
||||
SetUpImpl<FamilyType>();
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
auto cmdsSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
|
||||
char buff[1024] = {0};
|
||||
LinearStream stream(buff, 1024);
|
||||
|
||||
auto expectedScmCmd = FamilyType::cmdInitStateComputeMode;
|
||||
expectedScmCmd.setForceNonCoherent(STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT);
|
||||
expectedScmCmd.setEuThreadSchedulingModeOverride(STATE_COMPUTE_MODE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_OLDEST_FIRST);
|
||||
expectedScmCmd.setMaskBits(FamilyType::stateComputeModeForceNonCoherentMask | FamilyType::stateComputeModeLargeGrfModeMask |
|
||||
FamilyType::stateComputeModeEuThreadSchedulingModeOverrideMask);
|
||||
|
||||
overrideComputeModeRequest<FamilyType>(true, false, false, true);
|
||||
getCsrHw<FamilyType>()->programComputeMode(stream, flags, *defaultHwInfo);
|
||||
EXPECT_EQ(cmdsSize, stream.getUsed());
|
||||
|
||||
auto scmCmd = reinterpret_cast<STATE_COMPUTE_MODE *>(ptrOffset(stream.getCpuBase(), sizeof(PIPE_CONTROL)));
|
||||
EXPECT_TRUE(memcmp(&expectedScmCmd, scmCmd, sizeof(STATE_COMPUTE_MODE)) == 0);
|
||||
|
||||
auto startOffset = stream.getUsed() + sizeof(PIPE_CONTROL);
|
||||
|
||||
overrideComputeModeRequest<FamilyType>(true, true, false, true);
|
||||
getCsrHw<FamilyType>()->programComputeMode(stream, flags, *defaultHwInfo);
|
||||
EXPECT_EQ(cmdsSize * 2, stream.getUsed());
|
||||
|
||||
expectedScmCmd = FamilyType::cmdInitStateComputeMode;
|
||||
expectedScmCmd.setForceNonCoherent(STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_DISABLED);
|
||||
expectedScmCmd.setEuThreadSchedulingModeOverride(STATE_COMPUTE_MODE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_OLDEST_FIRST);
|
||||
expectedScmCmd.setMaskBits(FamilyType::stateComputeModeForceNonCoherentMask | FamilyType::stateComputeModeLargeGrfModeMask |
|
||||
FamilyType::stateComputeModeEuThreadSchedulingModeOverrideMask);
|
||||
scmCmd = reinterpret_cast<STATE_COMPUTE_MODE *>(ptrOffset(stream.getCpuBase(), startOffset));
|
||||
EXPECT_TRUE(memcmp(&expectedScmCmd, scmCmd, sizeof(STATE_COMPUTE_MODE)) == 0);
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcComputeModeRequirements, givenCoherencyWithSharedHandlesWhenComputeModeIsProgrammedThenCorrectCommandsAreAdded) {
|
||||
SetUpImpl<FamilyType>();
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
auto cmdsSize = sizeof(STATE_COMPUTE_MODE) + 2 * sizeof(PIPE_CONTROL);
|
||||
char buff[1024] = {0};
|
||||
LinearStream stream(buff, 1024);
|
||||
|
||||
auto expectedScmCmd = FamilyType::cmdInitStateComputeMode;
|
||||
expectedScmCmd.setForceNonCoherent(STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT);
|
||||
expectedScmCmd.setEuThreadSchedulingModeOverride(STATE_COMPUTE_MODE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_OLDEST_FIRST);
|
||||
expectedScmCmd.setMaskBits(FamilyType::stateComputeModeForceNonCoherentMask | FamilyType::stateComputeModeLargeGrfModeMask |
|
||||
FamilyType::stateComputeModeEuThreadSchedulingModeOverrideMask);
|
||||
|
||||
auto expectedPcCmd = FamilyType::cmdInitPipeControl;
|
||||
|
||||
overrideComputeModeRequest<FamilyType>(true, false, true, true);
|
||||
getCsrHw<FamilyType>()->programComputeMode(stream, flags, *defaultHwInfo);
|
||||
EXPECT_EQ(cmdsSize, stream.getUsed());
|
||||
|
||||
auto scmCmd = reinterpret_cast<STATE_COMPUTE_MODE *>(ptrOffset(stream.getCpuBase(), sizeof(PIPE_CONTROL)));
|
||||
EXPECT_TRUE(memcmp(&expectedScmCmd, scmCmd, sizeof(STATE_COMPUTE_MODE)) == 0);
|
||||
|
||||
auto pcCmd = reinterpret_cast<PIPE_CONTROL *>(ptrOffset(stream.getCpuBase(), sizeof(PIPE_CONTROL) + sizeof(STATE_COMPUTE_MODE)));
|
||||
EXPECT_TRUE(memcmp(&expectedPcCmd, pcCmd, sizeof(PIPE_CONTROL)) == 0);
|
||||
|
||||
auto startOffset = stream.getUsed();
|
||||
|
||||
overrideComputeModeRequest<FamilyType>(true, true, true, true);
|
||||
getCsrHw<FamilyType>()->programComputeMode(stream, flags, *defaultHwInfo);
|
||||
EXPECT_EQ(cmdsSize * 2, stream.getUsed());
|
||||
|
||||
expectedScmCmd = FamilyType::cmdInitStateComputeMode;
|
||||
expectedScmCmd.setForceNonCoherent(STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_DISABLED);
|
||||
expectedScmCmd.setEuThreadSchedulingModeOverride(STATE_COMPUTE_MODE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_OLDEST_FIRST);
|
||||
expectedScmCmd.setMaskBits(FamilyType::stateComputeModeForceNonCoherentMask | FamilyType::stateComputeModeLargeGrfModeMask |
|
||||
FamilyType::stateComputeModeEuThreadSchedulingModeOverrideMask);
|
||||
scmCmd = reinterpret_cast<STATE_COMPUTE_MODE *>(ptrOffset(stream.getCpuBase(), sizeof(PIPE_CONTROL) + startOffset));
|
||||
EXPECT_TRUE(memcmp(&expectedScmCmd, scmCmd, sizeof(STATE_COMPUTE_MODE)) == 0);
|
||||
|
||||
pcCmd = reinterpret_cast<PIPE_CONTROL *>(ptrOffset(stream.getCpuBase(), sizeof(PIPE_CONTROL) + startOffset + sizeof(STATE_COMPUTE_MODE)));
|
||||
EXPECT_TRUE(memcmp(&expectedPcCmd, pcCmd, sizeof(PIPE_CONTROL)) == 0);
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcComputeModeRequirements, givenComputeModeProgrammingWhenLargeGrfModeChangeIsRequiredThenCorrectCommandsAreAdded) {
|
||||
SetUpImpl<FamilyType>();
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
auto cmdsSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
|
||||
char buff[1024];
|
||||
LinearStream stream(buff, 1024);
|
||||
|
||||
auto expectedScmCmd = FamilyType::cmdInitStateComputeMode;
|
||||
expectedScmCmd.setLargeGrfMode(true);
|
||||
expectedScmCmd.setForceNonCoherent(STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT);
|
||||
expectedScmCmd.setEuThreadSchedulingModeOverride(STATE_COMPUTE_MODE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_OLDEST_FIRST);
|
||||
expectedScmCmd.setMaskBits(FamilyType::stateComputeModeForceNonCoherentMask | FamilyType::stateComputeModeLargeGrfModeMask |
|
||||
FamilyType::stateComputeModeEuThreadSchedulingModeOverrideMask);
|
||||
|
||||
overrideComputeModeRequest<FamilyType>(false, false, false, true, 256u);
|
||||
getCsrHw<FamilyType>()->programComputeMode(stream, flags, *defaultHwInfo);
|
||||
EXPECT_EQ(cmdsSize, stream.getUsed());
|
||||
|
||||
auto scmCmd = reinterpret_cast<STATE_COMPUTE_MODE *>(ptrOffset(stream.getCpuBase(), sizeof(PIPE_CONTROL)));
|
||||
EXPECT_TRUE(memcmp(&expectedScmCmd, scmCmd, sizeof(STATE_COMPUTE_MODE)) == 0);
|
||||
|
||||
auto startOffset = stream.getUsed() + sizeof(PIPE_CONTROL);
|
||||
|
||||
overrideComputeModeRequest<FamilyType>(false, false, false, true, 128u);
|
||||
getCsrHw<FamilyType>()->programComputeMode(stream, flags, *defaultHwInfo);
|
||||
EXPECT_EQ(cmdsSize * 2, stream.getUsed());
|
||||
|
||||
expectedScmCmd = FamilyType::cmdInitStateComputeMode;
|
||||
expectedScmCmd.setLargeGrfMode(false);
|
||||
expectedScmCmd.setForceNonCoherent(STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT);
|
||||
expectedScmCmd.setEuThreadSchedulingModeOverride(STATE_COMPUTE_MODE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_OLDEST_FIRST);
|
||||
expectedScmCmd.setMaskBits(FamilyType::stateComputeModeForceNonCoherentMask | FamilyType::stateComputeModeLargeGrfModeMask |
|
||||
FamilyType::stateComputeModeEuThreadSchedulingModeOverrideMask);
|
||||
scmCmd = reinterpret_cast<STATE_COMPUTE_MODE *>(ptrOffset(stream.getCpuBase(), startOffset));
|
||||
EXPECT_TRUE(memcmp(&expectedScmCmd, scmCmd, sizeof(STATE_COMPUTE_MODE)) == 0);
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcComputeModeRequirements, givenComputeModeProgrammingWhenRequiredGRFNumberIsLowerThan128ThenSmallGRFModeIsProgrammed) {
|
||||
SetUpImpl<FamilyType>();
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
auto cmdsSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
|
||||
char buff[1024];
|
||||
LinearStream stream(buff, 1024);
|
||||
|
||||
auto expectedScmCmd = FamilyType::cmdInitStateComputeMode;
|
||||
expectedScmCmd.setLargeGrfMode(false);
|
||||
expectedScmCmd.setForceNonCoherent(STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT);
|
||||
expectedScmCmd.setEuThreadSchedulingModeOverride(STATE_COMPUTE_MODE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_OLDEST_FIRST);
|
||||
expectedScmCmd.setMaskBits(FamilyType::stateComputeModeForceNonCoherentMask | FamilyType::stateComputeModeLargeGrfModeMask |
|
||||
FamilyType::stateComputeModeEuThreadSchedulingModeOverrideMask);
|
||||
|
||||
overrideComputeModeRequest<FamilyType>(false, false, false, true, 127u);
|
||||
getCsrHw<FamilyType>()->programComputeMode(stream, flags, *defaultHwInfo);
|
||||
EXPECT_EQ(cmdsSize, stream.getUsed());
|
||||
|
||||
auto scmCmd = reinterpret_cast<STATE_COMPUTE_MODE *>(ptrOffset(stream.getCpuBase(), sizeof(PIPE_CONTROL)));
|
||||
EXPECT_TRUE(memcmp(&expectedScmCmd, scmCmd, sizeof(STATE_COMPUTE_MODE)) == 0);
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcComputeModeRequirements, givenComputeModeProgrammingThenCorrectCommandsAreAdded) {
|
||||
SetUpImpl<FamilyType>();
|
||||
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
auto cmdsSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
|
||||
char buff[1024] = {0};
|
||||
LinearStream stream(buff, 1024);
|
||||
|
||||
auto expectedScmCmd = FamilyType::cmdInitStateComputeMode;
|
||||
expectedScmCmd.setForceNonCoherent(STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT);
|
||||
expectedScmCmd.setEuThreadSchedulingModeOverride(STATE_COMPUTE_MODE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_OLDEST_FIRST);
|
||||
expectedScmCmd.setMaskBits(FamilyType::stateComputeModeForceNonCoherentMask | FamilyType::stateComputeModeLargeGrfModeMask |
|
||||
FamilyType::stateComputeModeEuThreadSchedulingModeOverrideMask);
|
||||
|
||||
overrideComputeModeRequest<FamilyType>(true, false, false, false);
|
||||
getCsrHw<FamilyType>()->programComputeMode(stream, flags, *defaultHwInfo);
|
||||
EXPECT_EQ(cmdsSize, stream.getUsed());
|
||||
|
||||
auto startOffset = getCsrHw<FamilyType>()->commandStream.getUsed();
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(stream, startOffset);
|
||||
|
||||
auto pipeControlIterator = find<PIPE_CONTROL *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
|
||||
auto pipeControlCmd = genCmdCast<PIPE_CONTROL *>(*pipeControlIterator);
|
||||
|
||||
EXPECT_TRUE(pipeControlCmd->getHdcPipelineFlush());
|
||||
EXPECT_TRUE(pipeControlCmd->getAmfsFlushEnable());
|
||||
EXPECT_TRUE(pipeControlCmd->getCommandStreamerStallEnable());
|
||||
EXPECT_TRUE(pipeControlCmd->getInstructionCacheInvalidateEnable());
|
||||
EXPECT_TRUE(pipeControlCmd->getTextureCacheInvalidationEnable());
|
||||
EXPECT_TRUE(pipeControlCmd->getUnTypedDataPortCacheFlush());
|
||||
EXPECT_TRUE(pipeControlCmd->getConstantCacheInvalidationEnable());
|
||||
EXPECT_TRUE(pipeControlCmd->getStateCacheInvalidationEnable());
|
||||
|
||||
auto stateComputeModelCmd = reinterpret_cast<STATE_COMPUTE_MODE *>(ptrOffset(stream.getCpuBase(), sizeof(PIPE_CONTROL)));
|
||||
expectedScmCmd.setMaskBits(stateComputeModelCmd->getMaskBits());
|
||||
EXPECT_TRUE(memcmp(&expectedScmCmd, stateComputeModelCmd, sizeof(STATE_COMPUTE_MODE)) == 0);
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcComputeModeRequirements, givenProgramPipeControlPriorToNonPipelinedStateCommandThenCorrectCommandsAreAdded) {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.ProgramPipeControlPriorToNonPipelinedStateCommand.set(true);
|
||||
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1;
|
||||
|
||||
SetUpImpl<FamilyType>(&hwInfo);
|
||||
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
auto cmdsSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
|
||||
char buff[1024] = {0};
|
||||
LinearStream stream(buff, 1024);
|
||||
|
||||
auto expectedScmCmd = FamilyType::cmdInitStateComputeMode;
|
||||
expectedScmCmd.setForceNonCoherent(STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT);
|
||||
expectedScmCmd.setEuThreadSchedulingModeOverride(STATE_COMPUTE_MODE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_OLDEST_FIRST);
|
||||
expectedScmCmd.setMaskBits(FamilyType::stateComputeModeForceNonCoherentMask | FamilyType::stateComputeModeLargeGrfModeMask |
|
||||
FamilyType::stateComputeModeEuThreadSchedulingModeOverrideMask);
|
||||
|
||||
overrideComputeModeRequest<FamilyType>(true, false, false, false);
|
||||
getCsrHw<FamilyType>()->programComputeMode(stream, flags, hwInfo);
|
||||
EXPECT_EQ(cmdsSize, stream.getUsed());
|
||||
|
||||
auto startOffset = getCsrHw<FamilyType>()->commandStream.getUsed();
|
||||
|
||||
HardwareParse hwParser;
|
||||
hwParser.parseCommands<FamilyType>(stream, startOffset);
|
||||
|
||||
auto pipeControlIterator = find<PIPE_CONTROL *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
|
||||
auto pipeControlCmd = genCmdCast<PIPE_CONTROL *>(*pipeControlIterator);
|
||||
|
||||
EXPECT_TRUE(pipeControlCmd->getHdcPipelineFlush());
|
||||
EXPECT_TRUE(pipeControlCmd->getAmfsFlushEnable());
|
||||
EXPECT_TRUE(pipeControlCmd->getCommandStreamerStallEnable());
|
||||
EXPECT_TRUE(pipeControlCmd->getInstructionCacheInvalidateEnable());
|
||||
EXPECT_TRUE(pipeControlCmd->getTextureCacheInvalidationEnable());
|
||||
EXPECT_TRUE(pipeControlCmd->getUnTypedDataPortCacheFlush());
|
||||
EXPECT_TRUE(pipeControlCmd->getConstantCacheInvalidationEnable());
|
||||
EXPECT_TRUE(pipeControlCmd->getStateCacheInvalidationEnable());
|
||||
|
||||
auto stateComputeModelCmd = reinterpret_cast<STATE_COMPUTE_MODE *>(ptrOffset(stream.getCpuBase(), sizeof(PIPE_CONTROL)));
|
||||
expectedScmCmd.setMaskBits(stateComputeModelCmd->getMaskBits());
|
||||
EXPECT_TRUE(memcmp(&expectedScmCmd, stateComputeModelCmd, sizeof(STATE_COMPUTE_MODE)) == 0);
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/engine_node_helper.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
using EngineNodeHelperPvcTests = ::Test<ClDeviceFixture>;
|
||||
|
||||
PVCTEST_F(EngineNodeHelperPvcTests, WhenGetBcsEngineTypeIsCalledForPVCThenCorrectBcsEngineIsReturned) {
|
||||
using namespace aub_stream;
|
||||
|
||||
auto pHwInfo = pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
auto deviceBitfield = pDevice->getDeviceBitfield();
|
||||
|
||||
pHwInfo->featureTable.ftrBcsInfo = 1;
|
||||
auto &selectorCopyEngine = pDevice->getNearestGenericSubDevice(0)->getSelectorCopyEngine();
|
||||
selectorCopyEngine.isMainUsed.store(true);
|
||||
EXPECT_EQ(ENGINE_BCS, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, false));
|
||||
|
||||
pHwInfo->featureTable.ftrBcsInfo = 0b111;
|
||||
EXPECT_EQ(ENGINE_BCS2, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, false));
|
||||
EXPECT_EQ(ENGINE_BCS1, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, false));
|
||||
EXPECT_EQ(ENGINE_BCS2, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, false));
|
||||
EXPECT_EQ(ENGINE_BCS1, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, false));
|
||||
|
||||
pHwInfo->featureTable.ftrBcsInfo = 0b11;
|
||||
EXPECT_EQ(ENGINE_BCS1, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, false));
|
||||
EXPECT_EQ(ENGINE_BCS1, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, false));
|
||||
|
||||
pHwInfo->featureTable.ftrBcsInfo = 0b101;
|
||||
EXPECT_EQ(ENGINE_BCS2, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, false));
|
||||
EXPECT_EQ(ENGINE_BCS2, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, false));
|
||||
}
|
||||
|
||||
PVCTEST_F(EngineNodeHelperPvcTests, givenPvcBaseDieA0AndTile1WhenGettingBcsEngineTypeThenDoNotUseBcs1) {
|
||||
using namespace aub_stream;
|
||||
|
||||
auto pHwInfo = pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
pHwInfo->featureTable.ftrBcsInfo = 0b11111;
|
||||
auto deviceBitfield = 0b10;
|
||||
auto &selectorCopyEngine = pDevice->getNearestGenericSubDevice(0)->getSelectorCopyEngine();
|
||||
|
||||
EXPECT_EQ(ENGINE_BCS2, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, true));
|
||||
EXPECT_EQ(ENGINE_BCS4, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, true));
|
||||
EXPECT_EQ(ENGINE_BCS2, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, true));
|
||||
EXPECT_EQ(ENGINE_BCS4, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, true));
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/device_info_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
HWTEST_EXCLUDE_PRODUCT(GetDeviceInfoMemCapabilitiesTest, GivenValidParametersWhenGetDeviceInfoIsCalledForXE_HP_COREThenClSuccessIsReturned, IGFX_PVC);
|
||||
|
||||
PVCTEST_F(GetDeviceInfoMemCapabilitiesTest, GivenValidParametersWhenGetDeviceInfoIsCalledForPVCThenClSuccessIsReturned) {
|
||||
std::vector<TestParams> params = {
|
||||
{CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL, CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL},
|
||||
{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);
|
||||
}
|
14
opencl/test/unit_test/xe_hpc_core/pvc/linux/CMakeLists.txt
Normal file
14
opencl/test/unit_test/xe_hpc_core/pvc/linux/CMakeLists.txt
Normal file
@ -0,0 +1,14 @@
|
||||
#
|
||||
# Copyright (C) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
set(IGDRCL_SRCS_tests_xe_hp_core_pvc_linux
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_tests_pvc.cpp
|
||||
)
|
||||
if(UNIX)
|
||||
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_xe_hp_core_pvc_linux})
|
||||
add_subdirectories()
|
||||
endif()
|
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/libult/linux/drm_mock.h"
|
||||
|
||||
#include "opencl/test/unit_test/helpers/gtest_helpers.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/hw_info_config_linux_tests.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct HwInfoConfigTestLinuxPvc : HwInfoConfigTestLinux {
|
||||
void SetUp() override {
|
||||
HwInfoConfigTestLinux::SetUp();
|
||||
|
||||
drm = new DrmMock(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
osInterface->setDriverModel(std::unique_ptr<DriverModel>(drm));
|
||||
|
||||
drm->storedDeviceID = 0x0BD0;
|
||||
drm->setGtType(GTTYPE_GT4);
|
||||
}
|
||||
};
|
||||
|
||||
PVCTEST_F(HwInfoConfigTestLinuxPvc, WhenConfiguringHwInfoThenZeroIsReturned) {
|
||||
auto hwInfoConfig = HwInfoConfig::get(productFamily);
|
||||
int ret = hwInfoConfig->configureHwInfoDrm(&pInHwInfo, &outHwInfo, osInterface);
|
||||
EXPECT_EQ(0, ret);
|
||||
}
|
||||
|
||||
PVCTEST_F(HwInfoConfigTestLinuxPvc, given57bAddressSpaceWhenConfiguringHwInfoThenSetFtrFlag) {
|
||||
auto hwInfoConfig = HwInfoConfig::get(productFamily);
|
||||
outHwInfo.featureTable.flags.ftr57bGPUAddressing = false;
|
||||
outHwInfo.platform.eRenderCoreFamily = defaultHwInfo->platform.eRenderCoreFamily;
|
||||
|
||||
outHwInfo.capabilityTable.gpuAddressSpace = maxNBitValue(48);
|
||||
int ret = hwInfoConfig->configureHardwareCustom(&outHwInfo, osInterface);
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_FALSE(outHwInfo.featureTable.flags.ftr57bGPUAddressing);
|
||||
|
||||
outHwInfo.capabilityTable.gpuAddressSpace = maxNBitValue(57);
|
||||
ret = hwInfoConfig->configureHardwareCustom(&outHwInfo, osInterface);
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_TRUE(outHwInfo.featureTable.flags.ftr57bGPUAddressing);
|
||||
}
|
||||
|
||||
PVCTEST_F(HwInfoConfigTestLinuxPvc, GivenPvcWhenConfigureHardwareCustomThenKmdNotifyIsEnabled) {
|
||||
HwInfoConfig *hwInfoConfig = HwInfoConfig::get(productFamily);
|
||||
|
||||
OSInterface osIface;
|
||||
hwInfoConfig->configureHardwareCustom(&pInHwInfo, &osIface);
|
||||
EXPECT_TRUE(pInHwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify);
|
||||
EXPECT_EQ(20ll, pInHwInfo.capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);
|
||||
}
|
43
opencl/test/unit_test/xe_hpc_core/pvc/sampler_tests_pvc.cpp
Normal file
43
opencl/test/unit_test/xe_hpc_core/pvc/sampler_tests_pvc.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#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/cl_device_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
typedef Test<ClDeviceFixture> PvcSamplerTest;
|
||||
|
||||
PVCTEST_F(PvcSamplerTest, givenPvcSamplerWhenUsingDefaultFilteringAndAppendSamplerStateParamsThenDisableLowQualityFilter) {
|
||||
EXPECT_FALSE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get());
|
||||
typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE;
|
||||
|
||||
auto state = FamilyType::cmdInitSamplerState;
|
||||
|
||||
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
|
||||
HwInfoConfig::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&state, *defaultHwInfo);
|
||||
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcSamplerTest, givenPvcSamplerWhenForcingLowQualityFilteringAndAppendSamplerStateParamsThenEnableLowQualityFilter) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.ForceSamplerLowFilteringPrecision.set(true);
|
||||
EXPECT_TRUE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get());
|
||||
typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE;
|
||||
|
||||
auto state = FamilyType::cmdInitSamplerState;
|
||||
|
||||
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
|
||||
HwInfoConfig::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&state, *defaultHwInfo);
|
||||
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE, state.getLowQualityFilter());
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
using PvcDeviceCapsTests = Test<ClDeviceFixture>;
|
||||
|
||||
PVCTEST_F(PvcDeviceCapsTests, givenPvcProductWhenCheckBlitterOperationsSupportThenReturnFalse) {
|
||||
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.blitterOperationsSupported);
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcDeviceCapsTests, givenPvcProductWhenCheckingSldSupportThenReturnFalse) {
|
||||
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.debuggerSupported);
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcDeviceCapsTests, givenPvcWhenAskingForCacheFlushAfterWalkerThenReturnFalse) {
|
||||
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.supportCacheFlushAfterWalker);
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcDeviceCapsTests, givenPvcProductWhenCheckImagesSupportThenReturnFalse) {
|
||||
EXPECT_FALSE(PVC::hwInfo.capabilityTable.supportsImages);
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcDeviceCapsTests, givenPvcProductWhenMaxWorkgroupSizeIsQueriedThenItIsEqualTo1024u) {
|
||||
EXPECT_EQ(4096u, pDevice->getHardwareInfo().gtSystemInfo.ThreadCount);
|
||||
EXPECT_EQ(1024u, pDevice->getDeviceInfo().maxWorkGroupSize);
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcDeviceCapsTests, givenPvcProductWhenDeviceCapsInitializedThenAddPvcExtensions) {
|
||||
const auto &dInfo = pClDevice->getDeviceInfo();
|
||||
EXPECT_THAT(dInfo.deviceExtensions, testing::HasSubstr(std::string("cl_intel_create_buffer_with_properties")));
|
||||
EXPECT_THAT(dInfo.deviceExtensions, testing::HasSubstr(std::string("cl_intel_dot_accumulate")));
|
||||
EXPECT_THAT(dInfo.deviceExtensions, testing::HasSubstr(std::string("cl_intel_subgroup_local_block_io")));
|
||||
EXPECT_THAT(dInfo.deviceExtensions, testing::HasSubstr(std::string("cl_intel_subgroup_matrix_multiply_accumulate_for_PVC")));
|
||||
EXPECT_THAT(dInfo.deviceExtensions, testing::HasSubstr(std::string("cl_khr_subgroup_named_barrier")));
|
||||
EXPECT_THAT(dInfo.deviceExtensions, testing::HasSubstr(std::string("cl_intel_subgroup_extended_block_read")));
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/compiler_hw_info_config.h"
|
||||
#include "shared/source/helpers/constants.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using PvcHwInfoConfig = ::testing::Test;
|
||||
|
||||
PVCTEST_F(PvcHwInfoConfig, givenErrorneousConfigStringThenThrow) {
|
||||
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);
|
||||
EXPECT_EQ(0u, gtSystemInfo.ThreadCount);
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcHwInfoConfig, givenPvcWhenCallingGetDeviceMemoryNameThenHbmIsReturned) {
|
||||
auto hwInfoConfig = HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
||||
auto deviceMemoryName = hwInfoConfig->getDeviceMemoryName();
|
||||
EXPECT_THAT(deviceMemoryName, testing::HasSubstr(std::string("HBM")));
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcHwInfoConfig, givenHwInfoConfigWhenAdditionalKernelExecInfoSupportCheckedThenCorrectValueIsReturned) {
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
EXPECT_FALSE(hwInfoConfig.isDisableOverdispatchAvailable(hwInfo));
|
||||
|
||||
hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo);
|
||||
EXPECT_TRUE(hwInfoConfig.isDisableOverdispatchAvailable(hwInfo));
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcHwInfoConfig, givenHwInfoConfigWhenAskedIfPipeControlPriorToNonPipelinedStateCommandsWARequiredThenTrueIsReturned) {
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
auto isRcs = false;
|
||||
|
||||
EXPECT_TRUE(hwInfoConfig.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs));
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcHwInfoConfig, givenPvcHwInfoConfigWhenCheckDirectSubmissionSupportedThenTrueIsReturned) {
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
EXPECT_TRUE(hwInfoConfig.isDirectSubmissionSupported(hwInfo));
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcHwInfoConfig, givenHwInfoConfigAndProgramPipeControlPriorToNonPipelinedStateCommandDisabledWhenAskedIfPipeControlPriorToNonPipelinedStateCommandsWARequiredThenFalseIsReturned) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.ProgramPipeControlPriorToNonPipelinedStateCommand.set(0);
|
||||
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
auto isRcs = false;
|
||||
|
||||
EXPECT_FALSE(hwInfoConfig.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs));
|
||||
}
|
||||
|
||||
using PvcHwInfo = ::testing::Test;
|
||||
|
||||
PVCTEST_F(PvcHwInfo, givenPvcWhenConfiguringThenDisableCccs) {
|
||||
auto hwInfoConfig = HwInfoConfig::get(productFamily);
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
|
||||
hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr);
|
||||
EXPECT_FALSE(hwInfo.featureTable.flags.ftrRcsNode);
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcHwInfo, givenDebugVariableSetWhenConfiguringThenEnableCccs) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.NodeOrdinal.set(static_cast<int32_t>(aub_stream::EngineType::ENGINE_CCCS));
|
||||
|
||||
auto hwInfoConfig = HwInfoConfig::get(productFamily);
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
|
||||
hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr);
|
||||
EXPECT_TRUE(hwInfo.featureTable.flags.ftrRcsNode);
|
||||
}
|
||||
|
||||
PVCTEST_F(PvcHwInfo, givenVariousValuesWhenConvertingHwRevIdAndSteppingThenConversionIsCorrect) {
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
|
||||
uint32_t deviceIds[] = {FamilyType::pvcXlDeviceId, FamilyType::pvcXtDeviceIds[0], FamilyType::pvcXtDeviceIds[1], FamilyType::pvcXtDeviceIds[2], FamilyType::pvcXtTemporaryDeviceId};
|
||||
for (uint32_t testValue = 0; testValue < 0xFF; testValue++) {
|
||||
for (auto deviceId : deviceIds) {
|
||||
hwInfo.platform.usDeviceID = deviceId;
|
||||
auto hwRevIdFromStepping = hwInfoConfig.getHwRevIdFromStepping(testValue, hwInfo);
|
||||
if (hwRevIdFromStepping != CommonConstants::invalidStepping) {
|
||||
hwInfo.platform.usRevId = hwRevIdFromStepping;
|
||||
EXPECT_EQ(testValue, hwInfoConfig.getSteppingFromHwRevId(hwInfo));
|
||||
}
|
||||
}
|
||||
|
||||
hwInfo.platform.usRevId = testValue;
|
||||
auto steppingFromHwRevId = hwInfoConfig.getSteppingFromHwRevId(hwInfo);
|
||||
if (steppingFromHwRevId != CommonConstants::invalidStepping) {
|
||||
bool anyMatchAfterConversionFromStepping = false;
|
||||
for (auto deviceId : deviceIds) {
|
||||
hwInfo.platform.usDeviceID = deviceId;
|
||||
auto hwRevId = hwInfoConfig.getHwRevIdFromStepping(steppingFromHwRevId, hwInfo);
|
||||
EXPECT_NE(CommonConstants::invalidStepping, hwRevId);
|
||||
// expect values to match. 0x1 and 0x0 translate to the same stepping so they are interpreted as a match too.
|
||||
if (((testValue & FamilyType::pvcSteppingBits) == (hwRevId & FamilyType::pvcSteppingBits)) ||
|
||||
(((testValue & FamilyType::pvcSteppingBits) == 0x1) && ((hwRevId & FamilyType::pvcSteppingBits) == 0x0))) {
|
||||
anyMatchAfterConversionFromStepping = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(anyMatchAfterConversionFromStepping);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,147 @@
|
||||
/*
|
||||
* 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_helper.h"
|
||||
#include "shared/source/helpers/state_base_address.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
#include "opencl/test/unit_test/fixtures/ult_command_stream_receiver_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
using CmdsProgrammingTestsXeHpcCore = UltCommandStreamReceiverTest;
|
||||
|
||||
XE_HPC_CORETEST_F(CmdsProgrammingTestsXeHpcCore, givenL3ToL1DebugFlagWhenStatelessMocsIsProgrammedThenItHasL1CachingOn) {
|
||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.ForceL1Caching.set(1u);
|
||||
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
flushTask(commandStreamReceiver);
|
||||
|
||||
HardwareParse hwParserCsr;
|
||||
hwParserCsr.parseCommands<FamilyType>(commandStreamReceiver.commandStream, 0);
|
||||
hwParserCsr.findHardwareCommands<FamilyType>();
|
||||
ASSERT_NE(nullptr, hwParserCsr.cmdStateBaseAddress);
|
||||
|
||||
auto stateBaseAddress = static_cast<STATE_BASE_ADDRESS *>(hwParserCsr.cmdStateBaseAddress);
|
||||
|
||||
auto actualL1CachePolocy = static_cast<uint8_t>(stateBaseAddress->getL1CachePolicyL1CacheControl());
|
||||
|
||||
const uint8_t expectedL1CachePolicy = 0;
|
||||
EXPECT_EQ(expectedL1CachePolicy, actualL1CachePolocy);
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(CmdsProgrammingTestsXeHpcCore, givenSpecificProductFamilyWhenAppendingSbaThenProgramWtL1CachePolicy) {
|
||||
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(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(CmdsProgrammingTestsXeHpcCore, 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_HPC_CORETEST_F(CmdsProgrammingTestsXeHpcCore, whenAppendingRssThenProgramWtL1CachePolicy) {
|
||||
auto memoryManager = pDevice->getExecutionEnvironment()->memoryManager.get();
|
||||
size_t allocationSize = MemoryConstants::pageSize;
|
||||
AllocationProperties properties(pDevice->getRootDeviceIndex(), allocationSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield());
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
|
||||
|
||||
auto rssCmd = FamilyType::cmdInitRenderSurfaceState;
|
||||
|
||||
MockContext context(pClDevice);
|
||||
auto multiGraphicsAllocation = MultiGraphicsAllocation(pClDevice->getRootDeviceIndex());
|
||||
multiGraphicsAllocation.addAllocation(allocation);
|
||||
|
||||
std::unique_ptr<BufferHw<FamilyType>> buffer(static_cast<BufferHw<FamilyType> *>(
|
||||
BufferHw<FamilyType>::create(&context, {}, 0, 0, allocationSize, nullptr, nullptr, multiGraphicsAllocation, false, false, false)));
|
||||
|
||||
NEO::EncodeSurfaceStateArgs args;
|
||||
args.outMemory = &rssCmd;
|
||||
args.graphicsAddress = allocation->getGpuAddress();
|
||||
args.size = allocation->getUnderlyingBufferSize();
|
||||
args.mocs = buffer->getMocsValue(false, false, pClDevice->getRootDeviceIndex());
|
||||
args.numAvailableDevices = pClDevice->getNumGenericSubDevices();
|
||||
args.allocation = allocation;
|
||||
args.gmmHelper = pClDevice->getGmmHelper();
|
||||
args.areMultipleSubDevicesInContext = true;
|
||||
|
||||
EncodeSurfaceState<FamilyType>::encodeBuffer(args);
|
||||
|
||||
EXPECT_EQ(FamilyType::RENDER_SURFACE_STATE::L1_CACHE_POLICY_WBP, rssCmd.getL1CachePolicyL1CacheControl());
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(CmdsProgrammingTestsXeHpcCore, givenAlignedCacheableReadOnlyBufferThenChoseOclBufferConstPolicy) {
|
||||
MockContext context;
|
||||
const auto size = MemoryConstants::pageSize;
|
||||
const auto ptr = (void *)alignedMalloc(size * 2, MemoryConstants::pageSize);
|
||||
const auto flags = CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY;
|
||||
|
||||
auto retVal = CL_SUCCESS;
|
||||
auto buffer = std::unique_ptr<Buffer>(Buffer::create(
|
||||
&context,
|
||||
flags,
|
||||
size,
|
||||
ptr,
|
||||
retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
|
||||
buffer->setArgStateful(&surfaceState, false, false, false, false, context.getDevice(0)->getDevice(), false, false);
|
||||
|
||||
const auto expectedMocs = context.getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
|
||||
const auto actualMocs = surfaceState.getMemoryObjectControlState();
|
||||
EXPECT_EQ(expectedMocs, actualMocs);
|
||||
|
||||
auto actualL1CachePolocy = static_cast<uint8_t>(surfaceState.getL1CachePolicyL1CacheControl());
|
||||
|
||||
const uint8_t expectedL1CachePolicy = 0;
|
||||
EXPECT_EQ(expectedL1CachePolicy, actualL1CachePolocy);
|
||||
|
||||
alignedFree(ptr);
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
|
||||
#include "opencl/source/helpers/hardware_commands_helper.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/fixtures/device_info_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
typedef Test<ClDeviceFixture> XeHpcCoreDeviceCaps;
|
||||
|
||||
XE_HPC_CORETEST_F(XeHpcCoreDeviceCaps, givenXeHpcCoreWhenCheckFtrSupportsInteger64BitAtomicsThenReturnTrue) {
|
||||
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsInteger64BitAtomics);
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(XeHpcCoreDeviceCaps, givenXeHpcCoreWhenCheckingImageSupportThenReturnFalse) {
|
||||
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.supportsImages);
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(XeHpcCoreDeviceCaps, givenXeHpcCoreWhenCheckingMediaBlockSupportThenReturnFalse) {
|
||||
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.supportsMediaBlock);
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(XeHpcCoreDeviceCaps, givenXeHpcCoreWhenCheckingCoherencySupportThenReturnFalse) {
|
||||
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsCoherency);
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(XeHpcCoreDeviceCaps, givenHwInfoWhenSlmSizeIsRequiredThenReturnCorrectValue) {
|
||||
EXPECT_EQ(128u, pDevice->getHardwareInfo().capabilityTable.slmSize);
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(XeHpcCoreDeviceCaps, givenXeHpcCoreWhenCheckExtensionsThenDeviceDoesNotReportClKhrSubgroupsExtension) {
|
||||
const auto &caps = pClDevice->getDeviceInfo();
|
||||
|
||||
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_khr_subgroups")));
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(XeHpcCoreDeviceCaps, givenXeHpcCoreWhenCheckingCapsThenDeviceDoesNotSupportIndependentForwardProgress) {
|
||||
const auto &caps = pClDevice->getDeviceInfo();
|
||||
|
||||
EXPECT_TRUE(caps.independentForwardProgress);
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(XeHpcCoreDeviceCaps, givenDeviceWhenAskingForSubGroupSizesThenReturnCorrectValues) {
|
||||
auto &hwHelper = HwHelper::get(pDevice->getHardwareInfo().platform.eRenderCoreFamily);
|
||||
|
||||
auto deviceSubgroups = hwHelper.getDeviceSubGroupSizes();
|
||||
|
||||
EXPECT_EQ(2u, deviceSubgroups.size());
|
||||
EXPECT_EQ(16u, deviceSubgroups[0]);
|
||||
EXPECT_EQ(32u, deviceSubgroups[1]);
|
||||
}
|
||||
|
||||
using QueueFamilyNameTestXeHpcCore = QueueFamilyNameTest;
|
||||
|
||||
XE_HPC_CORETEST_F(QueueFamilyNameTestXeHpcCore, givenCccsWhenGettingQueueFamilyNameThenReturnProperValue) {
|
||||
verify(EngineGroupType::RenderCompute, "cccs");
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(QueueFamilyNameTestXeHpcCore, givenLinkedBcsWhenGettingQueueFamilyNameThenReturnProperValue) {
|
||||
verify(EngineGroupType::LinkedCopy, "linked bcs");
|
||||
}
|
@ -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 XeHpcCorePlatformCaps : public PlatformFixture, public ::testing::Test {
|
||||
void SetUp() override {
|
||||
PlatformFixture::SetUp();
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
PlatformFixture::TearDown();
|
||||
}
|
||||
};
|
||||
|
||||
PVCTEST_F(XeHpcCorePlatformCaps, givenPvcSkusThenItSupportFP64) {
|
||||
const auto &caps = pPlatform->getPlatformInfo();
|
||||
|
||||
EXPECT_NE(std::string::npos, caps.extensions.find(std::string("cl_khr_fp64")));
|
||||
}
|
187
opencl/test/unit_test/xe_hpc_core/test_preamble_xe_hpc_core.cpp
Normal file
187
opencl/test/unit_test/xe_hpc_core/test_preamble_xe_hpc_core.cpp
Normal file
@ -0,0 +1,187 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/os_interface/device_factory.h"
|
||||
#include "shared/source/os_interface/hw_info_config.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/mocks/mock_platform.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using PreambleCfeState = PreambleFixture;
|
||||
XE_HPC_CORETEST_F(PreambleCfeState, givenPvcAndKernelExecutionTypeAndRevisionWhenCallingProgramVFEStateThenCFEStateParamsAreCorrectlySet) {
|
||||
using CFE_STATE = typename FamilyType::CFE_STATE;
|
||||
auto hwInfo = pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo->platform.eProductFamily);
|
||||
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, *hwInfo, EngineGroupType::RenderCompute);
|
||||
StreamProperties streamProperties{};
|
||||
std::array<std::pair<uint32_t, bool>, 4> revisions = {
|
||||
{{REVISION_A0, false},
|
||||
{REVISION_A0, true},
|
||||
{REVISION_B, false},
|
||||
{REVISION_B, true}}};
|
||||
|
||||
for (const auto &[revision, kernelExecutionType] : revisions) {
|
||||
hwInfo->platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(revision, *hwInfo);
|
||||
streamProperties.frontEndState.setProperties(kernelExecutionType, false, false, *hwInfo);
|
||||
|
||||
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *hwInfo, 0u, 0, 0, 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);
|
||||
|
||||
auto expectedValue = (HwInfoConfig::get(hwInfo->platform.eProductFamily)->getSteppingFromHwRevId(*hwInfo) >= REVISION_B) &&
|
||||
(!XE_HPC_CORE::isXtTemporary(*defaultHwInfo)) &&
|
||||
kernelExecutionType;
|
||||
EXPECT_EQ(expectedValue, cfeState->getComputeDispatchAllWalkerEnable());
|
||||
EXPECT_EQ(expectedValue, cfeState->getSingleSliceDispatchCcsMode());
|
||||
EXPECT_FALSE(cfeState->getComputeOverdispatchDisable());
|
||||
}
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(PreambleCfeState, givenPvcXtTemporaryAndKernelExecutionTypeConcurrentAndRevisionBWhenCallingProgramVFEStateThenAllWalkerIsDisabled) {
|
||||
using CFE_STATE = typename FamilyType::CFE_STATE;
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.ForceDeviceId.set("0x0BE5");
|
||||
|
||||
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(*executionEnvironment);
|
||||
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo();
|
||||
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo->platform.eProductFamily);
|
||||
hwInfo->platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, *hwInfo);
|
||||
|
||||
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, *hwInfo, EngineGroupType::RenderCompute);
|
||||
StreamProperties streamProperties{};
|
||||
streamProperties.frontEndState.setProperties(true, false, false, *hwInfo);
|
||||
|
||||
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *hwInfo, 0u, 0, 0, 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->getComputeDispatchAllWalkerEnable());
|
||||
EXPECT_FALSE(cfeState->getSingleSliceDispatchCcsMode());
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(PreambleCfeState, givenXeHpcCoreAndSetDebugFlagWhenPreambleCfeStateIsProgrammedThenCFEStateParamsHaveSetValue) {
|
||||
using CFE_STATE = typename FamilyType::CFE_STATE;
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
uint32_t expectedValue = 1u;
|
||||
|
||||
DebugManager.flags.CFEComputeDispatchAllWalkerEnable.set(expectedValue);
|
||||
|
||||
uint64_t expectedAddress = 1 << CFE_STATE::SCRATCHSPACEBUFFER_BIT_SHIFT;
|
||||
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
|
||||
StreamProperties emptyProperties{};
|
||||
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, expectedAddress, 16u, emptyProperties);
|
||||
|
||||
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_EQ(expectedValue, cfeState->getComputeDispatchAllWalkerEnable());
|
||||
EXPECT_FALSE(cfeState->getSingleSliceDispatchCcsMode());
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(PreambleCfeState, givenNotSetDebugFlagWhenPreambleCfeStateIsProgrammedThenCFEStateParamsHaveNotSetValue) {
|
||||
using CFE_STATE = typename FamilyType::CFE_STATE;
|
||||
|
||||
auto cfeState = reinterpret_cast<CFE_STATE *>(linearStream.getSpace(sizeof(CFE_STATE)));
|
||||
*cfeState = FamilyType::cmdInitCfeState;
|
||||
|
||||
uint32_t numberOfWalkers = cfeState->getNumberOfWalkers();
|
||||
uint32_t fusedEuDispach = cfeState->getFusedEuDispatch();
|
||||
uint32_t overDispatchControl = static_cast<uint32_t>(cfeState->getOverDispatchControl());
|
||||
uint32_t singleDispatchCcsMode = cfeState->getSingleSliceDispatchCcsMode();
|
||||
|
||||
uint64_t expectedAddress = 1 << CFE_STATE::SCRATCHSPACEBUFFER_BIT_SHIFT;
|
||||
uint32_t expectedMaxThreads = HwHelper::getMaxThreadsForVfe(*defaultHwInfo);
|
||||
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
|
||||
StreamProperties emptyProperties{};
|
||||
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, expectedAddress, expectedMaxThreads, emptyProperties);
|
||||
uint32_t maximumNumberOfThreads = cfeState->getMaximumNumberOfThreads();
|
||||
|
||||
EXPECT_EQ(numberOfWalkers, cfeState->getNumberOfWalkers());
|
||||
EXPECT_EQ(fusedEuDispach, cfeState->getFusedEuDispatch());
|
||||
EXPECT_NE(expectedMaxThreads, maximumNumberOfThreads);
|
||||
EXPECT_EQ(overDispatchControl, static_cast<uint32_t>(cfeState->getOverDispatchControl()));
|
||||
EXPECT_EQ(singleDispatchCcsMode, cfeState->getSingleSliceDispatchCcsMode());
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(PreambleCfeState, givenSetDebugFlagWhenPreambleCfeStateIsProgrammedThenCFEStateParamsHaveSetValue) {
|
||||
using CFE_STATE = typename FamilyType::CFE_STATE;
|
||||
|
||||
uint32_t expectedValue1 = 1u;
|
||||
uint32_t expectedValue2 = 2u;
|
||||
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
|
||||
DebugManager.flags.CFEFusedEUDispatch.set(expectedValue1);
|
||||
DebugManager.flags.CFEOverDispatchControl.set(expectedValue1);
|
||||
DebugManager.flags.CFESingleSliceDispatchCCSMode.set(expectedValue1);
|
||||
DebugManager.flags.CFELargeGRFThreadAdjustDisable.set(expectedValue1);
|
||||
DebugManager.flags.CFENumberOfWalkers.set(expectedValue2);
|
||||
DebugManager.flags.CFEMaximumNumberOfThreads.set(expectedValue2);
|
||||
|
||||
uint64_t expectedAddress = 1 << CFE_STATE::SCRATCHSPACEBUFFER_BIT_SHIFT;
|
||||
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
|
||||
StreamProperties emptyProperties{};
|
||||
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, expectedAddress, 16u, emptyProperties);
|
||||
|
||||
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_EQ(expectedValue1, cfeState->getSingleSliceDispatchCcsMode());
|
||||
EXPECT_EQ(expectedValue1, static_cast<uint32_t>(cfeState->getOverDispatchControl()));
|
||||
EXPECT_EQ(expectedValue1, cfeState->getLargeGRFThreadAdjustDisable());
|
||||
EXPECT_EQ(expectedValue2, cfeState->getNumberOfWalkers());
|
||||
EXPECT_EQ(expectedValue2, cfeState->getMaximumNumberOfThreads());
|
||||
}
|
||||
|
||||
using PreamblePipelineSelectState = PreambleFixture;
|
||||
XE_HPC_CORETEST_F(PreamblePipelineSelectState, givenRevisionBAndAboveWhenCallingProgramPipelineSelectThenSystolicModeDisabled) {
|
||||
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
|
||||
auto hwInfo = pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
|
||||
PipelineSelectArgs pipelineArgs;
|
||||
pipelineArgs.specialPipelineSelectMode = true;
|
||||
|
||||
struct {
|
||||
unsigned short revId;
|
||||
bool expectedValue;
|
||||
} testInputs[] = {
|
||||
{0x0, true},
|
||||
{0x1, true},
|
||||
{0x3, true},
|
||||
{0x5, false},
|
||||
{0x6, false},
|
||||
{0x7, false},
|
||||
};
|
||||
for (auto &testInput : testInputs) {
|
||||
LinearStream linearStream(&gfxAllocation);
|
||||
hwInfo->platform.usRevId = testInput.revId;
|
||||
PreambleHelper<FamilyType>::programPipelineSelect(&linearStream, pipelineArgs, *hwInfo);
|
||||
parseCommands<FamilyType>(linearStream);
|
||||
|
||||
auto itorCmd = find<PIPELINE_SELECT *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_NE(itorCmd, cmdList.end());
|
||||
|
||||
auto cmd = genCmdCast<PIPELINE_SELECT *>(*itorCmd);
|
||||
EXPECT_EQ(testInput.expectedValue, cmd->getSystolicModeEnable());
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
using PvcOnlyTest = Test<ClDeviceFixture>;
|
||||
|
||||
PVCTEST_F(PvcOnlyTest, WhenGettingHardwareInfoThenPvcIsReturned) {
|
||||
EXPECT_EQ(IGFX_PVC, pDevice->getHardwareInfo().platform.eProductFamily);
|
||||
}
|
||||
|
||||
using XeHpcCoreOnlyTest = Test<ClDeviceFixture>;
|
||||
|
||||
XE_HPC_CORETEST_F(XeHpcCoreOnlyTest, WhenGettingRenderCoreFamilyThenOnlyHpcCoreIsReturned) {
|
||||
EXPECT_EQ(IGFX_XE_HPC_CORE, pDevice->getRenderCoreFamily());
|
||||
}
|
Reference in New Issue
Block a user