Skip to content

Commit 070bbf4

Browse files
Optimize enqueue kernel tests.
- Switch to non param fixture for tests not requiring different params - Add limited param set for tests requiring param fixture - this decreases total test count by 100 while keeping the same scope. Change-Id: Ic10a378d3eb7a2d06114435a9bd9652756945574
1 parent 7c94409 commit 070bbf4

File tree

1 file changed

+25
-34
lines changed

1 file changed

+25
-34
lines changed

unit_tests/command_queue/enqueue_kernel_tests.cpp

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,8 @@
11
/*
2-
* Copyright (c) 2017 - 2018, Intel Corporation
2+
* Copyright (C) 2017-2018 Intel Corporation
33
*
4-
* Permission is hereby granted, free of charge, to any person obtaining a
5-
* copy of this software and associated documentation files (the "Software"),
6-
* to deal in the Software without restriction, including without limitation
7-
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8-
* and/or sell copies of the Software, and to permit persons to whom the
9-
* Software is furnished to do so, subject to the following conditions:
4+
* SPDX-License-Identifier: MIT
105
*
11-
* The above copyright notice and this permission notice shall be included
12-
* in all copies or substantial portions of the Software.
13-
*
14-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15-
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18-
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19-
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20-
* OTHER DEALINGS IN THE SOFTWARE.
216
*/
227

238
#include "runtime/built_ins/built_ins.h"
@@ -239,7 +224,10 @@ struct TestParam {
239224
{64, 1, 1, 64, 1, 1},
240225
{190, 1, 1, 95, 1, 1},
241226
{510, 1, 1, 255, 1, 1},
242-
{512, 1, 1, 256, 1, 1}};
227+
{512, 1, 1, 256, 1, 1}},
228+
OneEntryTestParamTable[] = {
229+
{1, 1, 1, 1, 1, 1},
230+
};
243231
template <typename InputType>
244232
struct EnqueueKernelTypeTest : public HelloWorldFixture<HelloWorldFixtureFactory>,
245233
public HardwareParse,
@@ -326,6 +314,7 @@ void EnqueueKernelTypeTest<TestParam>::FillValues() {
326314
}
327315

328316
typedef EnqueueKernelTypeTest<TestParam> EnqueueWorkItemTests;
317+
typedef EnqueueKernelTypeTest<TestParam> EnqueueWorkItemTestsWithLimitedParamSet;
329318

330319
HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueWorkItemTests, GPGPUWalker) {
331320
typedef typename FamilyType::PARSE PARSE;
@@ -363,57 +352,56 @@ HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueWorkItemTests, GPGPUWalker) {
363352
EXPECT_EQ(expectedWorkItems, numWorkItems);
364353
}
365354

366-
HWTEST_P(EnqueueWorkItemTests, bumpsTaskLevel) {
355+
HWTEST_F(EnqueueKernelTest, bumpsTaskLevel) {
367356
auto taskLevelBefore = pCmdQ->taskLevel;
368-
369-
enqueueKernel<FamilyType, false>();
357+
callOneWorkItemNDRKernel();
370358
EXPECT_GT(pCmdQ->taskLevel, taskLevelBefore);
371359
}
372360

373-
HWTEST_P(EnqueueWorkItemTests, alignsToCSR) {
361+
HWTEST_F(EnqueueKernelTest, alignsToCSR) {
374362
//this test case assumes IOQ
375363
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
376364
csr.taskCount = pCmdQ->taskCount + 100;
377365
csr.taskLevel = pCmdQ->taskLevel + 50;
378366

379-
enqueueKernel<FamilyType, false>();
367+
callOneWorkItemNDRKernel();
380368
EXPECT_EQ(pCmdQ->taskCount, csr.peekTaskCount());
381369
EXPECT_EQ(pCmdQ->taskLevel + 1, csr.peekTaskLevel());
382370
}
383371

384-
HWTEST_P(EnqueueWorkItemTests, addsCommands) {
372+
HWTEST_F(EnqueueKernelTest, addsCommands) {
385373
auto usedCmdBufferBefore = pCS->getUsed();
386374

387-
enqueueKernel<FamilyType, false>();
375+
callOneWorkItemNDRKernel();
388376
EXPECT_NE(usedCmdBufferBefore, pCS->getUsed());
389377
}
390378

391-
HWTEST_P(EnqueueWorkItemTests, addsIndirectData) {
379+
HWTEST_F(EnqueueKernelTest, addsIndirectData) {
392380
auto dshBefore = pDSH->getUsed();
393381
auto iohBefore = pIOH->getUsed();
394382
auto sshBefore = pSSH->getUsed();
395383

396-
enqueueKernel<FamilyType, false>();
384+
callOneWorkItemNDRKernel();
397385
EXPECT_TRUE(UnitTestHelper<FamilyType>::evaluateDshUsage(dshBefore, pDSH->getUsed(), pKernel));
398386
EXPECT_NE(iohBefore, pIOH->getUsed());
399387
if (pKernel->requiresSshForBuffers() || (pKernel->getKernelInfo().patchInfo.imageMemObjKernelArgs.size() > 0)) {
400388
EXPECT_NE(sshBefore, pSSH->getUsed());
401389
}
402390
}
403391

404-
HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueWorkItemTests, LoadRegisterImmediateL3CNTLREG) {
392+
HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueWorkItemTestsWithLimitedParamSet, LoadRegisterImmediateL3CNTLREG) {
405393
enqueueKernel<FamilyType>();
406394
validateL3Programming<FamilyType>(cmdList, itorWalker);
407395
}
408396

409-
HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueWorkItemTests, WhenEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) {
397+
HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueWorkItemTestsWithLimitedParamSet, WhenEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) {
410398
enqueueKernel<FamilyType>();
411399
validateStateBaseAddress<FamilyType>(this->pDevice->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(),
412400
pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList,
413401
context->getMemoryManager()->peekForce32BitAllocations() ? context->getMemoryManager()->allocator32Bit->getBase() : 0llu);
414402
}
415403

416-
HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueWorkItemTests, MediaInterfaceDescriptorLoad) {
404+
HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueWorkItemTestsWithLimitedParamSet, MediaInterfaceDescriptorLoad) {
417405
typedef typename FamilyType::PARSE PARSE;
418406
typedef typename PARSE::MEDIA_INTERFACE_DESCRIPTOR_LOAD MEDIA_INTERFACE_DESCRIPTOR_LOAD;
419407
typedef typename PARSE::INTERFACE_DESCRIPTOR_DATA INTERFACE_DESCRIPTOR_DATA;
@@ -441,12 +429,11 @@ HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueWorkItemTests, MediaInterfaceDescriptorLoad)
441429
PARSE::template validateCommand<MEDIA_INTERFACE_DESCRIPTOR_LOAD *>(cmdList.begin(), itorCmd);
442430
}
443431

444-
HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueWorkItemTests, InterfaceDescriptorData) {
432+
HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueWorkItemTestsWithLimitedParamSet, InterfaceDescriptorData) {
445433
typedef typename FamilyType::PARSE PARSE;
446434
typedef typename PARSE::MEDIA_INTERFACE_DESCRIPTOR_LOAD MEDIA_INTERFACE_DESCRIPTOR_LOAD;
447435
typedef typename PARSE::STATE_BASE_ADDRESS STATE_BASE_ADDRESS;
448436
typedef typename PARSE::INTERFACE_DESCRIPTOR_DATA INTERFACE_DESCRIPTOR_DATA;
449-
450437
enqueueKernel<FamilyType>();
451438

452439
// Extract the MIDL command
@@ -480,13 +467,13 @@ HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueWorkItemTests, InterfaceDescriptorData) {
480467
EXPECT_NE(0u, IDD.getConstantIndirectUrbEntryReadLength());
481468
}
482469

483-
HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueWorkItemTests, PipelineSelect) {
470+
HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueWorkItemTestsWithLimitedParamSet, PipelineSelect) {
484471
enqueueKernel<FamilyType>();
485472
int numCommands = getNumberOfPipelineSelectsThatEnablePipelineSelect<FamilyType>();
486473
EXPECT_EQ(1, numCommands);
487474
}
488475

489-
HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueWorkItemTests, MediaVFEState) {
476+
HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueWorkItemTestsWithLimitedParamSet, MediaVFEState) {
490477
enqueueKernel<FamilyType>();
491478
validateMediaVFEState<FamilyType>(&pDevice->getHardwareInfo(), cmdMediaVfeState, cmdList, itorMediaVfeState);
492479
}
@@ -495,6 +482,10 @@ INSTANTIATE_TEST_CASE_P(EnqueueKernel,
495482
EnqueueWorkItemTests,
496483
::testing::ValuesIn(TestParamTable));
497484

485+
INSTANTIATE_TEST_CASE_P(EnqueueKernel,
486+
EnqueueWorkItemTestsWithLimitedParamSet,
487+
::testing::ValuesIn(OneEntryTestParamTable));
488+
498489
typedef EnqueueKernelTypeTest<TestParam2> EnqueueScratchSpaceTests;
499490

500491
HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueScratchSpaceTests, GivenKernelRequiringScratchWhenItIsEnqueuedWithDifferentScratchSizesThenMediaVFEStateAndStateBaseAddressAreProperlyProgrammed) {

0 commit comments

Comments
 (0)