mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-31 12:11:31 +08:00
Revert "Improve build time: command_queue tests"
This reverts commit 76c78f017e.
Change-Id: Icb7eb473a17de5c072ba1833812fa084c4873465
This commit is contained in:
committed by
sys_ocldev
parent
dae9527b11
commit
049ba5c625
110
unit_tests/command_queue/finish_tests.cpp
Normal file
110
unit_tests/command_queue/finish_tests.cpp
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "unit_tests/command_queue/command_queue_fixture.h"
|
||||
#include "unit_tests/command_stream/command_stream_fixture.h"
|
||||
#include "unit_tests/mocks/mock_command_queue.h"
|
||||
#include "gen_cmd_parse.h"
|
||||
#include "unit_tests/fixtures/device_fixture.h"
|
||||
#include "unit_tests/helpers/hw_parse.h"
|
||||
#include "test.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
|
||||
struct FinishFixture : public DeviceFixture,
|
||||
public CommandQueueHwFixture,
|
||||
public CommandStreamFixture,
|
||||
public HardwareParse {
|
||||
|
||||
void SetUp() override {
|
||||
DeviceFixture::SetUp();
|
||||
CommandQueueHwFixture::SetUp(pDevice, 0);
|
||||
ASSERT_NE(nullptr, pCmdQ);
|
||||
CommandStreamFixture::SetUp(pCmdQ);
|
||||
ASSERT_NE(nullptr, pCS);
|
||||
HardwareParse::SetUp();
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
HardwareParse::TearDown();
|
||||
CommandStreamFixture::TearDown();
|
||||
CommandQueueHwFixture::TearDown();
|
||||
DeviceFixture::TearDown();
|
||||
}
|
||||
};
|
||||
|
||||
typedef Test<FinishFixture> FinishTest;
|
||||
|
||||
HWTEST_F(FinishTest, ShouldntAddPipeControl_If_CS_greater_than_CQ) {
|
||||
typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL;
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
// HW = 1, CQ = 1, CS = 2 (last PC was 1)
|
||||
// This means there is no work in CQ that needs a PC
|
||||
uint32_t originalHwTag = 1;
|
||||
uint32_t originalCSRLevel = 2;
|
||||
uint32_t originalCQLevel = 1;
|
||||
*commandStreamReceiver.getTagAddress() = originalHwTag;
|
||||
commandStreamReceiver.taskLevel = originalCSRLevel; // Must be greater than or equal to HW
|
||||
pCmdQ->taskLevel = originalCQLevel;
|
||||
|
||||
auto retVal = pCmdQ->finish(false);
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
// Don't need to artificially execute PIPE_CONTROL.
|
||||
// Nothing should have been sent
|
||||
//*pCS->getTagAddress() = originalCSRLevel;
|
||||
|
||||
EXPECT_EQ(commandStreamReceiver.peekTaskLevel(), originalCSRLevel);
|
||||
EXPECT_EQ(pCmdQ->taskLevel, originalCQLevel);
|
||||
EXPECT_GE(pCmdQ->getHwTag(), pCmdQ->taskLevel);
|
||||
|
||||
auto sizeUsed = pCS->getUsed();
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, pCmdBuffer, sizeUsed));
|
||||
|
||||
auto itorCmd = find<PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_EQ(cmdList.end(), itorCmd);
|
||||
}
|
||||
|
||||
HWTEST_F(FinishTest, doesntAddAPipecontrolToCQCommandStream) {
|
||||
typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL;
|
||||
|
||||
auto retVal = pCmdQ->finish(false);
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
// Check for PIPE_CONTROL
|
||||
parseCommands<FamilyType>(pCmdQ->getCS(1024));
|
||||
auto itorCmd = reverse_find<PIPE_CONTROL *>(cmdList.rbegin(), cmdList.rend());
|
||||
EXPECT_EQ(cmdList.rend(), itorCmd);
|
||||
}
|
||||
HWTEST_F(FinishTest, givenFreshQueueWhenFinishIsCalledThenCommandStreamIsNotAllocated) {
|
||||
MockContext contextWithMockCmdQ(pDevice, true);
|
||||
MockCommandQueueHw<FamilyType> cmdQ(&contextWithMockCmdQ, pDevice, 0);
|
||||
|
||||
auto retVal = cmdQ.finish(false);
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
EXPECT_EQ(nullptr, cmdQ.peekCommandStream());
|
||||
}
|
||||
Reference in New Issue
Block a user