/* * Copyright (C) 2017-2018 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "runtime/command_queue/command_queue_hw.h" #include "reg_configs_common.h" #include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/helpers/hw_parse.h" #include "unit_tests/helpers/static_size3.h" #include "unit_tests/mocks/mock_kernel.h" #include "test.h" namespace OCLRT { using Gen10EnqueueTest = Test; GEN10TEST_F(Gen10EnqueueTest, givenKernelRequiringIndependentForwardProgressWhenKernelIsSubmittedThenDefaultPolicyIsProgrammed) { MockContext mc; CommandQueueHw cmdQ{&mc, pDevice, 0}; MockKernelWithInternals mockKernel(*pDevice); mockKernel.executionEnvironment.SubgroupIndependentForwardProgressRequired = true; cmdQ.enqueueKernel(mockKernel.mockKernel, 1, nullptr, StatickSize3<1, 1, 1>(), nullptr, 0, nullptr, nullptr); HardwareParse hwParser; hwParser.parseCommands(cmdQ); auto cmd = findMmioCmd(hwParser.cmdList.begin(), hwParser.cmdList.end(), RowChickenReg4::address); ASSERT_NE(nullptr, cmd); EXPECT_EQ(RowChickenReg4::regDataForArbitrationPolicy[PreambleHelper::getDefaultThreadArbitrationPolicy()], cmd->getDataDword()); EXPECT_EQ(1U, countMmio(hwParser.cmdList.begin(), hwParser.cmdList.end(), RowChickenReg4::address)); } GEN10TEST_F(Gen10EnqueueTest, givenKernelNotRequiringIndependentForwardProgressWhenKernelIsSubmittedThenAgeBasedPolicyIsProgrammed) { MockContext mc; CommandQueueHw cmdQ{&mc, pDevice, 0}; MockKernelWithInternals mockKernel(*pDevice); mockKernel.executionEnvironment.SubgroupIndependentForwardProgressRequired = false; cmdQ.enqueueKernel(mockKernel.mockKernel, 1, nullptr, StatickSize3<1, 1, 1>(), nullptr, 0, nullptr, nullptr); HardwareParse hwParser; hwParser.parseCommands(cmdQ); auto cmd = findMmioCmd(hwParser.cmdList.begin(), hwParser.cmdList.end(), RowChickenReg4::address); ASSERT_NE(nullptr, cmd); EXPECT_EQ(RowChickenReg4::regDataForArbitrationPolicy[ThreadArbitrationPolicy::AgeBased], cmd->getDataDword()); EXPECT_EQ(1U, countMmio(hwParser.cmdList.begin(), hwParser.cmdList.end(), RowChickenReg4::address)); } } // namespace OCLRT