mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-26 23:33:20 +08:00
Add cache flush command after WALKER command
Change-Id: I3983dc6c0797047e17cc8189655a22a22e85892b
This commit is contained in:
committed by
sys_ocldev
parent
9e81469d9f
commit
3dca095ccf
@@ -78,11 +78,11 @@ struct DispatchWalkerTest : public CommandQueueFixture, public DeviceFixture, pu
|
||||
|
||||
std::unique_ptr<MockProgram> program;
|
||||
|
||||
SKernelBinaryHeaderCommon kernelHeader;
|
||||
SPatchDataParameterStream dataParameterStream;
|
||||
SPatchExecutionEnvironment executionEnvironment;
|
||||
SPatchThreadPayload threadPayload;
|
||||
SPatchSamplerStateArray samplerArray;
|
||||
SKernelBinaryHeaderCommon kernelHeader = {};
|
||||
SPatchDataParameterStream dataParameterStream = {};
|
||||
SPatchExecutionEnvironment executionEnvironment = {};
|
||||
SPatchThreadPayload threadPayload = {};
|
||||
SPatchSamplerStateArray samplerArray = {};
|
||||
|
||||
KernelInfo kernelInfo;
|
||||
KernelInfo kernelInfoWithSampler;
|
||||
@@ -111,7 +111,7 @@ HWTEST_F(DispatchWalkerTest, shouldntChangeCommandStreamMemory) {
|
||||
|
||||
// Consume all memory except what is needed for this enqueue
|
||||
auto sizeDispatchWalkerNeeds = sizeof(typename FamilyType::WALKER_TYPE) +
|
||||
KernelCommandsHelper<FamilyType>::getSizeRequiredCS();
|
||||
KernelCommandsHelper<FamilyType>::getSizeRequiredCS(&kernel);
|
||||
|
||||
//cs has a minimum required size
|
||||
auto sizeThatNeedsToBeSubstracted = sizeDispatchWalkerNeeds + CSRequirements::minCommandQueueCommandStreamSize;
|
||||
@@ -160,7 +160,7 @@ HWTEST_F(DispatchWalkerTest, noLocalIdsShouldntCrash) {
|
||||
|
||||
// Consume all memory except what is needed for this enqueue
|
||||
auto sizeDispatchWalkerNeeds = sizeof(typename FamilyType::WALKER_TYPE) +
|
||||
KernelCommandsHelper<FamilyType>::getSizeRequiredCS();
|
||||
KernelCommandsHelper<FamilyType>::getSizeRequiredCS(&kernel);
|
||||
|
||||
//cs has a minimum required size
|
||||
auto sizeThatNeedsToBeSubstracted = sizeDispatchWalkerNeeds + CSRequirements::minCommandQueueCommandStreamSize;
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
#include "runtime/memory_manager/allocations_list.h"
|
||||
#include "unit_tests/command_queue/enqueue_fixture.h"
|
||||
#include "unit_tests/fixtures/hello_world_fixture.h"
|
||||
#include "unit_tests/gen_common/gen_cmd_parse.h"
|
||||
#include "unit_tests/gen_common/gen_commands_common_validation.h"
|
||||
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "unit_tests/helpers/hw_parse.h"
|
||||
#include "unit_tests/mocks/mock_csr.h"
|
||||
#include "unit_tests/mocks/mock_command_queue.h"
|
||||
@@ -843,3 +845,30 @@ HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueAuxKernelTests, givenParentKernelWhenAuxTrans
|
||||
EXPECT_EQ(1u, cmdQ.waitCalled);
|
||||
}
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueKernelTest, givenCacheFlushAfterWalkerEnabledWhenAllocationRequiresCacheFlushThenFlushCommandPresentAfterWalker) {
|
||||
using GPGPU_WALKER = typename FamilyType::GPGPU_WALKER;
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.EnableCacheFlushAfterWalker.set(1);
|
||||
|
||||
MockKernelWithInternals mockKernel(*pDevice, context);
|
||||
CommandQueueHw<FamilyType> cmdQ(context, pDevice, nullptr);
|
||||
|
||||
size_t gws[3] = {1, 0, 0};
|
||||
|
||||
mockKernel.mockKernel->svmAllocationsRequireCacheFlush = true;
|
||||
|
||||
cmdQ.enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr);
|
||||
|
||||
HardwareParse hwParse;
|
||||
hwParse.parseCommands<FamilyType>(cmdQ.getCS(0), 0);
|
||||
auto itorCmd = find<GPGPU_WALKER *>(hwParse.cmdList.begin(), hwParse.cmdList.end());
|
||||
ASSERT_NE(hwParse.cmdList.end(), itorCmd);
|
||||
++itorCmd;
|
||||
auto pipeControl = genCmdCast<PIPE_CONTROL *>(*itorCmd);
|
||||
ASSERT_NE(nullptr, pipeControl);
|
||||
EXPECT_TRUE(pipeControl->getCommandStreamerStallEnable());
|
||||
EXPECT_TRUE(pipeControl->getDcFlushEnable());
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ struct EnqueueSvmMemCopyTest : public DeviceFixture,
|
||||
void SetUp() override {
|
||||
DeviceFixture::SetUp();
|
||||
CommandQueueFixture::SetUp(pDevice, 0);
|
||||
srcSvmPtr = context->getSVMAllocsManager()->createSVMAlloc(256);
|
||||
srcSvmPtr = context->getSVMAllocsManager()->createSVMAlloc(256, false, false);
|
||||
ASSERT_NE(nullptr, srcSvmPtr);
|
||||
dstSvmPtr = context->getSVMAllocsManager()->createSVMAlloc(256);
|
||||
dstSvmPtr = context->getSVMAllocsManager()->createSVMAlloc(256, false, false);
|
||||
ASSERT_NE(nullptr, dstSvmPtr);
|
||||
srcSvmAlloc = context->getSVMAllocsManager()->getSVMAlloc(srcSvmPtr);
|
||||
ASSERT_NE(nullptr, srcSvmAlloc);
|
||||
|
||||
@@ -27,7 +27,7 @@ struct EnqueueSvmMemFillTest : public DeviceFixture,
|
||||
CommandQueueFixture::SetUp(pDevice, 0);
|
||||
patternSize = (size_t)GetParam();
|
||||
ASSERT_TRUE((0 < patternSize) && (patternSize <= 128));
|
||||
svmPtr = context->getSVMAllocsManager()->createSVMAlloc(256, true);
|
||||
svmPtr = context->getSVMAllocsManager()->createSVMAlloc(256, true, false);
|
||||
ASSERT_NE(nullptr, svmPtr);
|
||||
svmAlloc = context->getSVMAllocsManager()->getSVMAlloc(svmPtr);
|
||||
ASSERT_NE(nullptr, svmAlloc);
|
||||
|
||||
@@ -33,7 +33,7 @@ struct EnqueueSvmTest : public DeviceFixture,
|
||||
void SetUp() override {
|
||||
DeviceFixture::SetUp();
|
||||
CommandQueueFixture::SetUp(pDevice, 0);
|
||||
ptrSVM = context->getSVMAllocsManager()->createSVMAlloc(256);
|
||||
ptrSVM = context->getSVMAllocsManager()->createSVMAlloc(256, false, false);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
@@ -238,7 +238,7 @@ TEST_F(EnqueueSvmTest, enqueueSVMMemcpy_InvalidValueDstPtrIsNull) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.EnableAsyncEventsHandler.set(false);
|
||||
void *pDstSVM = nullptr;
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(256);
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(256, false, false);
|
||||
retVal = this->pCmdQ->enqueueSVMMemcpy(
|
||||
false, // cl_bool blocking_copy
|
||||
pDstSVM, // void *dst_ptr
|
||||
@@ -269,7 +269,7 @@ TEST_F(EnqueueSvmTest, enqueueSVMMemcpy_InvalidValueSrcPtrIsNull) {
|
||||
|
||||
TEST_F(EnqueueSvmTest, enqueueSVMMemcpy_Success) {
|
||||
void *pDstSVM = ptrSVM;
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(256);
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(256, false, false);
|
||||
retVal = this->pCmdQ->enqueueSVMMemcpy(
|
||||
false, // cl_bool blocking_copy
|
||||
pDstSVM, // void *dst_ptr
|
||||
@@ -285,7 +285,7 @@ TEST_F(EnqueueSvmTest, enqueueSVMMemcpy_Success) {
|
||||
|
||||
TEST_F(EnqueueSvmTest, enqueueSVMMemcpyBlocking_Success) {
|
||||
void *pDstSVM = ptrSVM;
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(256);
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(256, false, false);
|
||||
retVal = this->pCmdQ->enqueueSVMMemcpy(
|
||||
true, // cl_bool blocking_copy
|
||||
pDstSVM, // void *dst_ptr
|
||||
@@ -301,7 +301,7 @@ TEST_F(EnqueueSvmTest, enqueueSVMMemcpyBlocking_Success) {
|
||||
|
||||
TEST_F(EnqueueSvmTest, enqueueSVMMemcpyBlockedOnEvent_Success) {
|
||||
void *pDstSVM = ptrSVM;
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(256);
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(256, false, false);
|
||||
UserEvent uEvent;
|
||||
cl_event eventWaitList[] = {&uEvent};
|
||||
retVal = this->pCmdQ->enqueueSVMMemcpy(
|
||||
@@ -319,7 +319,7 @@ TEST_F(EnqueueSvmTest, enqueueSVMMemcpyBlockedOnEvent_Success) {
|
||||
|
||||
TEST_F(EnqueueSvmTest, enqueueSVMMemcpyCoherent_Success) {
|
||||
void *pDstSVM = ptrSVM;
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(256, true);
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(256, true, false);
|
||||
retVal = this->pCmdQ->enqueueSVMMemcpy(
|
||||
false, // cl_bool blocking_copy
|
||||
pDstSVM, // void *dst_ptr
|
||||
@@ -335,7 +335,7 @@ TEST_F(EnqueueSvmTest, enqueueSVMMemcpyCoherent_Success) {
|
||||
|
||||
TEST_F(EnqueueSvmTest, enqueueSVMMemcpyCoherentBlockedOnEvent_Success) {
|
||||
void *pDstSVM = ptrSVM;
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(256, true);
|
||||
void *pSrcSVM = context->getSVMAllocsManager()->createSVMAlloc(256, true, false);
|
||||
UserEvent uEvent;
|
||||
cl_event eventWaitList[] = {&uEvent};
|
||||
retVal = this->pCmdQ->enqueueSVMMemcpy(
|
||||
@@ -522,7 +522,7 @@ TEST_F(EnqueueSvmTest, concurentMapAccess) {
|
||||
|
||||
auto allocSvm = [&](uint32_t from, uint32_t to) {
|
||||
for (uint32_t i = from; i <= to; i++) {
|
||||
svmPtrs[i] = context->getSVMAllocsManager()->createSVMAlloc(1);
|
||||
svmPtrs[i] = context->getSVMAllocsManager()->createSVMAlloc(1, false, false);
|
||||
auto ga = context->getSVMAllocsManager()->getSVMAlloc(svmPtrs[i]);
|
||||
EXPECT_NE(nullptr, ga);
|
||||
EXPECT_EQ(ga->getUnderlyingBuffer(), svmPtrs[i]);
|
||||
|
||||
@@ -757,8 +757,8 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, enqueueFillImageWhenZeroSizeEnqueueIsDetect
|
||||
HWTEST_F(ZeroSizeEnqueueHandlerTest, enqueueSVMMemcpyWhenZeroSizeEnqueueIsDetectedThenCommandMarkerShouldBeEnqueued) {
|
||||
auto mockCmdQ = std::unique_ptr<MockCommandQueueHw<FamilyType>>(new MockCommandQueueHw<FamilyType>(&context, pDevice, 0));
|
||||
|
||||
void *pSrcSVM = context.getSVMAllocsManager()->createSVMAlloc(256);
|
||||
void *pDstSVM = context.getSVMAllocsManager()->createSVMAlloc(256);
|
||||
void *pSrcSVM = context.getSVMAllocsManager()->createSVMAlloc(256, false, false);
|
||||
void *pDstSVM = context.getSVMAllocsManager()->createSVMAlloc(256, false, false);
|
||||
size_t zeroSize = 0;
|
||||
mockCmdQ->enqueueSVMMemcpy(false, pSrcSVM, pDstSVM, zeroSize, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(static_cast<cl_command_type>(CL_COMMAND_MARKER), mockCmdQ->lastCommandType);
|
||||
@@ -771,8 +771,8 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, enqueueSVMMemcpyWhenZeroSizeEnqueueIsDetect
|
||||
auto mockCmdQ = std::unique_ptr<MockCommandQueueHw<FamilyType>>(new MockCommandQueueHw<FamilyType>(&context, pDevice, 0));
|
||||
|
||||
cl_event event;
|
||||
void *pSrcSVM = context.getSVMAllocsManager()->createSVMAlloc(256);
|
||||
void *pDstSVM = context.getSVMAllocsManager()->createSVMAlloc(256);
|
||||
void *pSrcSVM = context.getSVMAllocsManager()->createSVMAlloc(256, false, false);
|
||||
void *pDstSVM = context.getSVMAllocsManager()->createSVMAlloc(256, false, false);
|
||||
size_t zeroSize = 0;
|
||||
mockCmdQ->enqueueSVMMemcpy(false, pSrcSVM, pDstSVM, zeroSize, 0, nullptr, &event);
|
||||
EXPECT_EQ(static_cast<cl_command_type>(CL_COMMAND_MARKER), mockCmdQ->lastCommandType);
|
||||
@@ -793,7 +793,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, enqueueSVMMemcpyWhenZeroSizeEnqueueIsDetect
|
||||
HWTEST_F(ZeroSizeEnqueueHandlerTest, enqueueSVMMemFillWhenZeroSizeEnqueueIsDetectedThenCommandMarkerShouldBeEnqueued) {
|
||||
auto mockCmdQ = std::unique_ptr<MockCommandQueueHw<FamilyType>>(new MockCommandQueueHw<FamilyType>(&context, pDevice, 0));
|
||||
|
||||
void *pSVM = context.getSVMAllocsManager()->createSVMAlloc(256);
|
||||
void *pSVM = context.getSVMAllocsManager()->createSVMAlloc(256, false, false);
|
||||
const float pattern[1] = {1.2345f};
|
||||
size_t zeroSize = 0;
|
||||
mockCmdQ->enqueueSVMMemFill(pSVM, &pattern, sizeof(pattern), zeroSize, 0, nullptr, nullptr);
|
||||
@@ -806,7 +806,7 @@ HWTEST_F(ZeroSizeEnqueueHandlerTest, enqueueSVMMemFillWhenZeroSizeEnqueueIsDetec
|
||||
auto mockCmdQ = std::unique_ptr<MockCommandQueueHw<FamilyType>>(new MockCommandQueueHw<FamilyType>(&context, pDevice, 0));
|
||||
|
||||
cl_event event;
|
||||
void *pSVM = context.getSVMAllocsManager()->createSVMAlloc(256);
|
||||
void *pSVM = context.getSVMAllocsManager()->createSVMAlloc(256, false, false);
|
||||
const float pattern[1] = {1.2345f};
|
||||
size_t zeroSize = 0;
|
||||
mockCmdQ->enqueueSVMMemFill(pSVM, &pattern, sizeof(pattern), zeroSize, 0, nullptr, &event);
|
||||
|
||||
Reference in New Issue
Block a user