Add support for Cannon Lake (Gen10) platform

Change-Id: I0e63960887cdae9ba74c1ba91ad27101e22b458a
This commit is contained in:
Jacek Danecki
2018-04-06 13:48:49 +02:00
committed by sys_ocldev
parent 24ba7a0dbf
commit c238a4d31e
89 changed files with 10612 additions and 7 deletions

View File

@ -17,7 +17,7 @@ components:
branch: infra
clean_on_sync: true
dest_dir: infra
revision: 07655b0a0ddec035e6f31cc42b21cf411b20cbc4
revision: 137cb4cb7547c6effdab84108ac7734ee1b8abf7
type: git
internal:
branch: master

View File

@ -24,6 +24,7 @@ set(ALL_GEN_TYPES "")
list(APPEND ALL_GEN_TYPES "GEN8")
list(APPEND ALL_GEN_TYPES "GEN9")
list(APPEND ALL_GEN_TYPES "GEN10")
set(ALL_GEN_TYPES_REVERSED ${ALL_GEN_TYPES})
list(REVERSE ALL_GEN_TYPES_REVERSED)
@ -169,6 +170,7 @@ endmacro()
SET_FLAGS_FOR("GEN8" "BDW")
SET_FLAGS_FOR("GEN9" "SKL" "KBL" "BXT" "GLK" "CFL")
SET_FLAGS_FOR("GEN10" "CNL")
# Init lists
INIT_LIST("FAMILY_NAME" "TESTED")
@ -250,6 +252,19 @@ if(SUPPORT_GEN9)
endif()
endif(SUPPORT_GEN9)
if(SUPPORT_GEN10)
ADD_PLATFORM_FOR_GEN("SUPPORTED" "GEN10" "CNL" "CORE")
ADD_PLATFORM_FOR_GEN("SUPPORTED_2_0" "GEN10" "CNL" "CORE")
if(TESTS_GEN10)
ADD_ITEM_FOR_GEN("FAMILY_NAME" "TESTED" "GEN10" "CNLFamily")
ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED" "GEN10" "CNL")
ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED_APPVERIFIER" "GEN10" "CNL")
ADD_ITEM_FOR_GEN("CONFIGURATIONS" "AUB_TESTS" "GEN10" "cnl/2/5/8")
ADD_ITEM_FOR_GEN("CONFIGURATIONS" "MT_TESTS" "GEN10" "cnl/2/5/8")
ADD_ITEM_FOR_GEN("CONFIGURATIONS" "UNIT_TESTS" "GEN10" "cnl/2/5/8")
endif()
endif()
# Get platform lists, flag definition and set default platforms
GET_AVAILABLE_PLATFORMS("SUPPORTED" "SUPPORT" ALL_AVAILABLE_SUPPORTED_PLATFORMS)
GET_AVAILABLE_PLATFORMS("TESTED" "TESTS" ALL_AVAILABLE_TESTED_PLATFORMS)

View File

@ -98,6 +98,7 @@ struct CmdServicesMemTraceVersion {
Hsw = 9,
Bxt = 14,
Sbr = 6,
Cnl = 15,
Ivb = 7,
Chv = 13,
El = 4,

View File

@ -0,0 +1,105 @@
/*
* 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 "CL/cl.h"
#include "runtime/builtin_kernels_simulation/opencl_c.h"
#include "runtime/builtin_kernels_simulation/scheduler_simulation.h"
#include "runtime/builtin_kernels_simulation/scheduler_simulation.inl"
#include "runtime/memory_manager/graphics_allocation.h"
#include "runtime/gen10/hw_cmds.h"
#include "runtime/execution_model/device_enqueue.h"
using namespace OCLRT;
using namespace BuiltinKernelsSimulation;
namespace Gen10SchedulerSimulation {
#define SCHEDULER_EMULATION
uint GetNextPowerof2(uint number);
float __intel__getProfilingTimerResolution() {
return static_cast<float>(DEFAULT_GEN10_PLATFORM::hwInfo.capabilityTable.defaultProfilingTimerResolution);
}
#include "runtime/gen10/device_enqueue.h"
#include "runtime/gen10/scheduler_definitions.h"
#include "runtime/gen10/scheduler_igdrcl_built_in.inl"
#include "runtime/scheduler/scheduler.cl"
} // namespace Gen10SchedulerSimulation
namespace BuiltinKernelsSimulation {
template <>
void SchedulerSimulation<CNLFamily>::startScheduler(uint32_t index,
GraphicsAllocation *queue,
GraphicsAllocation *commandsStack,
GraphicsAllocation *eventsPool,
GraphicsAllocation *secondaryBatchBuffer,
GraphicsAllocation *dsh,
GraphicsAllocation *reflectionSurface,
GraphicsAllocation *queueStorageBuffer,
GraphicsAllocation *ssh,
GraphicsAllocation *debugQueue) {
threadIDToLocalIDmap.insert(std::make_pair(std::this_thread::get_id(), index));
while (!conditionReady) {
}
Gen10SchedulerSimulation::SchedulerParallel20((IGIL_CommandQueue *)queue->getUnderlyingBuffer(),
(uint *)commandsStack->getUnderlyingBuffer(),
(IGIL_EventPool *)eventsPool->getUnderlyingBuffer(),
(uint *)secondaryBatchBuffer->getUnderlyingBuffer(),
(char *)dsh->getUnderlyingBuffer(),
(IGIL_KernelDataHeader *)reflectionSurface->getUnderlyingBuffer(),
(uint *)queueStorageBuffer->getUnderlyingBuffer(),
(char *)ssh->getUnderlyingBuffer(),
debugQueue != nullptr ? (DebugDataBuffer *)debugQueue->getUnderlyingBuffer() : nullptr);
}
template <>
void SchedulerSimulation<CNLFamily>::patchGpGpuWalker(uint secondLevelBatchOffset,
__global uint *secondaryBatchBuffer,
uint interfaceDescriptorOffset,
uint simdSize,
uint totalLocalWorkSize,
uint3 dimSize,
uint3 startPoint,
uint numberOfHwThreadsPerWg,
uint indirectPayloadSize,
uint ioHoffset) {
Gen10SchedulerSimulation::patchGpGpuWalker(secondLevelBatchOffset,
secondaryBatchBuffer,
interfaceDescriptorOffset,
simdSize,
totalLocalWorkSize,
dimSize,
startPoint,
numberOfHwThreadsPerWg,
indirectPayloadSize,
ioHoffset);
}
template class SchedulerSimulation<CNLFamily>;
} // namespace BuiltinKernelsSimulation

View File

@ -21,6 +21,31 @@
*/
// clang-format off
#ifdef SUPPORT_GEN10
DEVICE( ICNL_5x8_DESK_DEVICE_F0_ID, CNL_2x5x8, GTTYPE_GT2 )
DEVICE( ICNL_5x8_DESKTOP_DEVICE_F0_ID, CNL_2x5x8, GTTYPE_GT2 )
DEVICE( ICNL_5x8_HALO_DEVICE_F0_ID, CNL_2x5x8, GTTYPE_GT2 )
DEVICE( ICNL_5x8_SUPERSKU_DEVICE_F0_ID, CNL_2x5x8, GTTYPE_GT2 )
DEVICE( ICNL_5x8_ULX_DEVICE_F0_ID, CNL_2x5x8, GTTYPE_GT2 )
DEVICE( ICNL_5x8_ULT_DEVICE_F0_ID, CNL_2x5x8, GTTYPE_GT2 )
DEVICE( ICNL_4x8_ULT_DEVICE_F0_ID, CNL_2x4x8, GTTYPE_GT2 )
DEVICE( ICNL_4x8_ULX_DEVICE_F0_ID, CNL_2x4x8, GTTYPE_GT2 )
DEVICE( ICNL_4x8_HALO_DEVICE_F0_ID, CNL_2x4x8, GTTYPE_GT2 )
DEVICE( ICNL_3x8_DESK_DEVICE_F0_ID, CNL_1x3x8, GTTYPE_GT1 )
DEVICE( ICNL_3x8_ULT_DEVICE_F0_ID, CNL_1x3x8, GTTYPE_GT1 )
DEVICE( ICNL_2x8_ULT_DEVICE_F0_ID , CNL_1x2x8, GTTYPE_GT1 )
DEVICE( ICNL_3x8_HALO_DEVICE_F0_ID, CNL_1x3x8, GTTYPE_GT1 )
DEVICE( ICNL_3x8_DESKTOP_DEVICE_F0_ID, CNL_1x3x8, GTTYPE_GT1 )
DEVICE( ICNL_3x8_ULX_DEVICE_F0_ID, CNL_1x3x8, GTTYPE_GT1 )
DEVICE( ICNL_2x8_ULX_DEVICE_F0_ID, CNL_1x2x8, GTTYPE_GT1 )
DEVICE( ICNL_2x8_HALO_DEVICE_F0_ID, CNL_1x2x8, GTTYPE_GT1 )
DEVICE( ICNL_9x8_DESK_DEVICE_F0_ID, CNL_4x9x8, GTTYPE_GT3 )
DEVICE( ICNL_9x8_ULT_DEVICE_F0_ID, CNL_4x9x8, GTTYPE_GT3 )
DEVICE( ICNL_9x8_SUPERSKU_DEVICE_F0_ID, CNL_4x9x8, GTTYPE_GT3 )
#endif
#ifdef SUPPORT_GEN9
#ifdef SUPPORT_SKL
// GT1

View File

@ -0,0 +1,41 @@
/*
* 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/aub_command_stream_receiver_hw.h"
#include "runtime/command_stream/aub_command_stream_receiver_hw.inl"
#include "runtime/helpers/base_object.h"
#include "runtime/helpers/array_count.h"
namespace OCLRT {
typedef CNLFamily Family;
static auto gfxCore = IGFX_GEN10_CORE;
template <>
void populateFactoryTable<AUBCommandStreamReceiverHw<Family>>() {
extern AubCommandStreamReceiverCreateFunc aubCommandStreamReceiverFactory[IGFX_MAX_CORE];
UNRECOVERABLE_IF(!isInRange(gfxCore, aubCommandStreamReceiverFactory));
aubCommandStreamReceiverFactory[gfxCore] = AUBCommandStreamReceiverHw<Family>::create;
}
template class AUBCommandStreamReceiverHw<Family>;
} // namespace OCLRT

View File

@ -0,0 +1,42 @@
/*
* 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.
*/
#pragma once
#include "runtime/gen_common/aub_mapper_base.h"
namespace OCLRT {
struct CNLFamily;
template <>
struct AUBFamilyMapper<CNLFamily> {
enum { device = AubMemDump::DeviceValues::Cnl };
typedef AubMemDump::Traits<device, GfxAddressBits::value> AubTraits;
static const AubMemDump::LrcaHelper *csTraits[EngineType::NUM_ENGINES];
static const MMIOList globalMMIO;
static const MMIOList *perEngineMMIO[EngineType::NUM_ENGINES];
typedef AubMemDump::AubDump<AubTraits> AUB;
};
} // namespace OCLRT

View File

@ -0,0 +1,93 @@
/*
* 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 "config.h"
#include "aub_mapper.h"
#include "runtime/aub_mem_dump/aub_mem_dump.inl"
#include "runtime/helpers/completion_stamp.h"
namespace AubMemDump {
enum {
device = DeviceValues::Cnl
};
// Instantiate these common template implementations.
template struct AubDump<Traits<device, 32>>;
template struct AubDump<Traits<device, 48>>;
template struct AubPageTableHelper32<Traits<device, 32>>;
template struct AubPageTableHelper64<Traits<device, 48>>;
} // namespace AubMemDump
namespace OCLRT {
using Family = CNLFamily;
static AubMemDump::LrcaHelperRcs rcs(0x000000);
static AubMemDump::LrcaHelperBcs bcs(0x020000);
static AubMemDump::LrcaHelperVcs vcs(0x010000);
static AubMemDump::LrcaHelperVecs vecs(0x018000);
const AubMemDump::LrcaHelper *AUBFamilyMapper<Family>::csTraits[EngineType::NUM_ENGINES] = {
&rcs,
&bcs,
&vcs,
&vecs};
const MMIOList AUBFamilyMapper<Family>::globalMMIO;
static const MMIOList mmioListRCS = {
MMIOPair(0x000020d8, 0x00020000),
MMIOPair(rcs.mmioBase + 0x229c, 0xffff8280),
MMIOPair(0x0000C800, 0x00000009),
MMIOPair(0x0000C804, 0x00000038),
MMIOPair(0x0000C808, 0x0000003B),
MMIOPair(0x0000C80C, 0x00000039),
MMIOPair(0x0000C810, 0x00000037),
MMIOPair(0x0000C814, 0x00000039),
MMIOPair(0x0000C818, 0x00000037),
MMIOPair(0x0000C81C, 0x0000001B),
MMIOPair(0x0000C820, 0x00060037),
MMIOPair(0x0000C824, 0x00000032),
MMIOPair(0x0000C828, 0x00000033),
MMIOPair(0x0000C82C, 0x0000003B),
MMIOPair(0x0000C8C0, 0x00000037),
};
static const MMIOList mmioListBCS = {
MMIOPair(bcs.mmioBase + 0x229c, 0xffff8280),
};
static const MMIOList mmioListVCS = {
MMIOPair(vcs.mmioBase + 0x229c, 0xffff8280),
};
static const MMIOList mmioListVECS = {
MMIOPair(vecs.mmioBase + 0x229c, 0xffff8280),
};
const MMIOList *AUBFamilyMapper<Family>::perEngineMMIO[EngineType::NUM_ENGINES] = {
&mmioListRCS,
&mmioListBCS,
&mmioListVCS,
&mmioListVECS};
} // namespace OCLRT

View File

@ -0,0 +1,32 @@
/*
* 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 "hw_cmds.h"
#include "runtime/mem_obj/buffer.inl"
namespace OCLRT {
typedef CNLFamily Family;
static auto gfxCore = IGFX_GEN10_CORE;
#include "runtime/mem_obj/buffer_factory_init.inl"
} // namespace OCLRT

View File

@ -0,0 +1,37 @@
/*
* 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/memory_manager/svm_memory_manager.h"
#include "runtime/command_queue/command_queue_hw.h"
#include "runtime/command_queue/command_queue_hw.inl"
namespace OCLRT {
typedef CNLFamily Family;
static auto gfxCore = IGFX_GEN10_CORE;
template <>
void populateFactoryTable<CommandQueueHw<Family>>() {
extern CommandQueueCreateFunc commandQueueFactory[IGFX_MAX_CORE];
commandQueueFactory[gfxCore] = CommandQueueHw<Family>::create;
}
} // namespace OCLRT

View File

@ -0,0 +1,83 @@
/*
* 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 "hw_info.h"
#include "hw_cmds.h"
#include "reg_configs_common.h"
#include "runtime/command_stream/device_command_stream.h"
#include "runtime/command_stream/command_stream_receiver_hw.inl"
namespace OCLRT {
typedef CNLFamily Family;
static auto gfxCore = IGFX_GEN10_CORE;
template <>
size_t CommandStreamReceiverHw<Family>::getCmdSizeForCoherency() {
if (csrSizeRequestFlags.coherencyRequestChanged) {
return sizeof(typename Family::MI_LOAD_REGISTER_IMM);
}
return 0;
}
template <>
void CommandStreamReceiverHw<Family>::programCoherency(LinearStream &stream, DispatchFlags &dispatchFlags) {
if (csrSizeRequestFlags.coherencyRequestChanged) {
LriHelper<Family>::program(&stream, gen10HdcModeRegisterAddresss, DwordBuilder::build(4, true, !dispatchFlags.requiresCoherency));
this->lastSentCoherencyRequest = static_cast<int8_t>(dispatchFlags.requiresCoherency);
}
}
template <>
void CommandStreamReceiverHw<Family>::addPipeControlWA(LinearStream &commandStream, bool flushDC) {
auto pCmd = (Family::PIPE_CONTROL *)commandStream.getSpace(sizeof(Family::PIPE_CONTROL));
*pCmd = Family::cmdInitPipeControl;
pCmd->setDcFlushEnable(flushDC);
pCmd->setCommandStreamerStallEnable(true);
}
template <>
int CommandStreamReceiverHw<Family>::getRequiredPipeControlSize() const {
return 2 * sizeof(Family::PIPE_CONTROL);
}
template <>
void CommandStreamReceiverHw<Family>::addDcFlushToPipeControl(Family::PIPE_CONTROL *pCmd, bool flushDC) {
}
template <>
void populateFactoryTable<CommandStreamReceiverHw<Family>>() {
extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE];
commandStreamReceiverFactory[gfxCore] = DeviceCommandStreamReceiver<Family>::create;
}
// Explicitly instantiate CommandStreamReceiverHw for this device family
template class CommandStreamReceiverHw<Family>;
const Family::GPGPU_WALKER Family::cmdInitGpgpuWalker = Family::GPGPU_WALKER::sInit();
const Family::INTERFACE_DESCRIPTOR_DATA Family::cmdInitInterfaceDescriptorData = Family::INTERFACE_DESCRIPTOR_DATA::sInit();
const Family::MEDIA_INTERFACE_DESCRIPTOR_LOAD Family::cmdInitMediaInterfaceDescriptorLoad = Family::MEDIA_INTERFACE_DESCRIPTOR_LOAD::sInit();
const Family::MEDIA_STATE_FLUSH Family::cmdInitMediaStateFlush = Family::MEDIA_STATE_FLUSH::sInit();
const Family::MI_BATCH_BUFFER_START Family::cmdInitBatchBufferStart = Family::MI_BATCH_BUFFER_START::sInit();
const Family::MI_BATCH_BUFFER_END Family::cmdInitBatchBufferEnd = Family::MI_BATCH_BUFFER_END::sInit();
const Family::PIPE_CONTROL Family::cmdInitPipeControl = Family::PIPE_CONTROL::sInit();
} // namespace OCLRT

View File

@ -0,0 +1,38 @@
/*
* 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.
*/
#pragma once
#include "../execution_model/device_enqueue.h"
// Uncomment this macro to build "empty" schedulers
//#define WA_DISABLE_SCHEDULERS 1
#define OCLRT_GPGPU_WALKER_CMD_DEVICE_CMD_G10 (15 * sizeof(uint))
#define OCLRT_PIPE_CONTROL_CMD_DEVICE_CMD_G10 (6 * sizeof(uint))
#define OCLRT_PIPE_CONTROL_CMD_DEVICE_CMD_G10_DWORD_OFFSET (6)
#define OCLRT_GPGPU_WALKER_CMD_DEVICE_CMD_G10_DWORD_OFFSET (15)
#define CS_PREFETCH_SIZE_G10_WA 100
#define SECOND_LEVEL_BUFFER_SPACE_FOR_EACH_ENQUEUE_GEN10 (OCLRT_SIZEOF_MEDIA_STATE_FLUSH + OCLRT_SIZEOF_MEDIA_INTERFACE_DESCRIPTOR_LOAD_DEVICE_CMD + OCLRT_PIPE_CONTROL_CMD_DEVICE_CMD_G10 + OCLRT_GPGPU_WALKER_CMD_DEVICE_CMD_G10 + OCLRT_SIZEOF_MEDIA_STATE_FLUSH + OCLRT_PIPE_CONTROL_CMD_DEVICE_CMD_G10 + CS_PREFETCH_SIZE + CS_PREFETCH_SIZE_G10_WA)
#define SECOND_LEVEL_BUFFER_NUMBER_OF_ENQUEUES_GEN10 (128)

View File

@ -0,0 +1,62 @@
/*
* 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/device_queue/device_queue_hw.h"
#include "runtime/device_queue/device_queue_hw.inl"
#include "runtime/device_queue/device_queue_hw_profiling.inl"
#include "runtime/gen10/hw_cmds.h"
namespace OCLRT {
typedef CNLFamily Family;
static auto gfxCore = IGFX_GEN10_CORE;
static const size_t csPrefetchSizeWA = 100;
template <>
size_t DeviceQueueHw<Family>::getCSPrefetchSize() {
return 512 + csPrefetchSizeWA;
}
template <>
void populateFactoryTable<DeviceQueueHw<Family>>() {
extern DeviceQueueCreateFunc deviceQueueFactory[IGFX_MAX_CORE];
deviceQueueFactory[gfxCore] = DeviceQueueHw<Family>::create;
}
template <>
size_t DeviceQueueHw<Family>::getWaCommandsSize() { return 0; }
template <>
void DeviceQueueHw<Family>::addArbCheckCmdWa() {}
template <>
void DeviceQueueHw<Family>::addMiAtomicCmdWa(uint64_t atomicOpPlaceholder) {}
template <>
void DeviceQueueHw<Family>::addLriCmdWa(bool setArbCheck) {}
template <>
void DeviceQueueHw<Family>::addPipeControlCmdWa(bool isNoopCmd) {}
template class DeviceQueueHw<Family>;
} // namespace OCLRT

View File

@ -0,0 +1,63 @@
/*
* 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 "hw_cmds.h"
#include "runtime/command_queue/command_queue_hw.h"
#include "runtime/device_queue/device_queue_hw.h"
#include "runtime/command_stream/aub_command_stream_receiver_hw.h"
#include "runtime/command_stream/tbx_command_stream_receiver_hw.h"
#include "runtime/command_stream/command_stream_receiver_hw.h"
#ifdef HAVE_INSTRUMENTATION
#include "runtime/event/perf_counter.h"
#endif
#include "runtime/mem_obj/buffer.h"
#include "runtime/mem_obj/image.h"
#include "runtime/sampler/sampler.h"
#include "runtime/helpers/hw_helper.h"
namespace OCLRT {
#ifdef HAVE_INSTRUMENTATION
static_assert(std::is_same<SInstrQueryPerfCountersLayout, SInstrQueryPerfCountersLayout_Gen10>::value, "SInstrQueryPerfCountersLayout_Gen10 mismatch");
#endif
extern HwHelper *hwHelperFactory[IGFX_MAX_CORE];
typedef CNLFamily Family;
static auto gfxFamily = IGFX_GEN10_CORE;
struct EnableGen10 {
EnableGen10() {
populateFactoryTable<AUBCommandStreamReceiverHw<Family>>();
populateFactoryTable<TbxCommandStreamReceiverHw<Family>>();
populateFactoryTable<CommandQueueHw<Family>>();
populateFactoryTable<DeviceQueueHw<Family>>();
populateFactoryTable<CommandStreamReceiverHw<Family>>();
populateFactoryTable<BufferHw<Family>>();
populateFactoryTable<ImageHw<Family>>();
populateFactoryTable<SamplerHw<Family>>();
hwHelperFactory[gfxFamily] = &HwHelperHw<Family>::get();
}
};
static EnableGen10 enable;
} // namespace OCLRT

View File

@ -0,0 +1,33 @@
/*
* 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 "hw_cmds.h"
#include "runtime/os_interface/hw_info_config.h"
#include "runtime/helpers/enable_product.inl"
namespace OCLRT {
#ifdef SUPPORT_CNL
static EnableGfxProductHw<IGFX_CANNONLAKE> enableGfxProductHwCNL;
#endif
} // namespace OCLRT

View File

@ -0,0 +1,32 @@
/*
* 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 "hw_cmds.h"
#include "runtime/os_interface/hw_info_config.h"
namespace OCLRT {
#ifdef SUPPORT_CNL
static EnableProductHwInfoConfig<IGFX_CANNONLAKE> enableCNL;
#endif
} // namespace OCLRT

View File

@ -0,0 +1,41 @@
/*
* 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 "hw_cmds.h"
#include "runtime/helpers/flat_batch_buffer_helper_hw.inl"
namespace OCLRT {
typedef CNLFamily Family;
template <>
void FlatBatchBufferHelperHw<Family>::sdiSetAddress(typename Family::MI_STORE_DATA_IMM *sdiCommand, uint64_t address) {
sdiCommand->setAddressGraphicsaddress472(address);
}
template <>
void FlatBatchBufferHelperHw<Family>::sdiSetStoreQword(typename Family::MI_STORE_DATA_IMM *sdiCommand, bool setQword) {
sdiCommand->setStoreQword(setQword);
}
template class FlatBatchBufferHelperHw<Family>;
} // namespace OCLRT

View File

@ -0,0 +1,33 @@
/*
* 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/gen10/hw_info.h"
#include "runtime/command_queue/gpgpu_walker.h"
#include "runtime/command_queue/gpgpu_walker.inl"
namespace OCLRT {
template class GpgpuWalkerHelper<CNLFamily>;
template struct EnqueueOperation<CNLFamily>;
} // namespace OCLRT

View File

@ -0,0 +1,49 @@
/*
* 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 "gtpin_ocl_interface.h"
#include "runtime/gtpin/gtpin_hw_helper.h"
#include "runtime/gtpin/gtpin_hw_helper.inl"
namespace OCLRT {
extern GTPinHwHelper *gtpinHwHelperFactory[IGFX_MAX_CORE];
typedef CNLFamily Family;
static const auto gfxFamily = IGFX_GEN10_CORE;
template <>
uint32_t GTPinHwHelperHw<Family>::getGenVersion() {
return gtpin::GTPIN_GEN_10;
}
template class GTPinHwHelperHw<Family>;
struct GTPinEnableGen10 {
GTPinEnableGen10() {
gtpinHwHelperFactory[gfxFamily] = &GTPinHwHelperHw<Family>::get();
}
};
static GTPinEnableGen10 gtpinEnable;
} // namespace OCLRT

103
runtime/gen10/hw_cmds.h Normal file
View File

@ -0,0 +1,103 @@
/*
* 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.
*/
#pragma once
#include <cstddef>
#include "runtime/commands/bxml_generator_glue.h"
#include "runtime/helpers/debug_helpers.h"
#include "hw_info.h"
#include "igfxfmid.h"
#define TILERESOURCE_CHICKENBIT_VECTOR_ADDRESS 0x4DFC
#define TILERESOURCE_CHICKENBIT_VECTOR_BITMASK (1UL << 8)
struct CnlParse;
namespace OCLRT {
struct GEN10 {
#include "runtime/gen10/hw_cmds_generated_patched.h"
#include "runtime/gen10/hw_cmds_generated.h"
};
struct CNLFamily : public GEN10 {
typedef CnlParse PARSE;
typedef CNLFamily GfxFamily;
static const GPGPU_WALKER cmdInitGpgpuWalker;
static const INTERFACE_DESCRIPTOR_DATA cmdInitInterfaceDescriptorData;
static const MEDIA_INTERFACE_DESCRIPTOR_LOAD cmdInitMediaInterfaceDescriptorLoad;
static const MEDIA_STATE_FLUSH cmdInitMediaStateFlush;
static const MI_BATCH_BUFFER_END cmdInitBatchBufferEnd;
static const MI_BATCH_BUFFER_START cmdInitBatchBufferStart;
static const PIPE_CONTROL cmdInitPipeControl;
static constexpr bool supportsCmdSet(GFXCORE_FAMILY cmdSetBaseFamily) {
return cmdSetBaseFamily == IGFX_GEN8_CORE;
}
};
struct CNL : public CNLFamily {
static const PLATFORM platform;
static const HardwareInfo hwInfo;
static const uint32_t threadsPerEu = 7;
static const uint32_t maxEuPerSubslice = 8;
static const uint32_t maxSlicesSupported = 4;
static const uint32_t maxSubslicesSupported = 9;
static const RuntimeCapabilityTable capabilityTable;
static void (*setupGtSystemInfo)(GT_SYSTEM_INFO *gtSysInfo);
};
class CNL_2x5x8 : public CNL {
public:
static void setupGtSystemInfo(GT_SYSTEM_INFO *gtSysInfo);
static const HardwareInfo hwInfo;
private:
static GT_SYSTEM_INFO gtSystemInfo;
};
class CNL_2x4x8 : public CNL {
public:
static void setupGtSystemInfo(GT_SYSTEM_INFO *gtSysInfo);
static const HardwareInfo hwInfo;
private:
static GT_SYSTEM_INFO gtSystemInfo;
};
class CNL_1x3x8 : public CNL {
public:
static void setupGtSystemInfo(GT_SYSTEM_INFO *gtSysInfo);
static const HardwareInfo hwInfo;
private:
static GT_SYSTEM_INFO gtSystemInfo;
};
class CNL_1x2x8 : public CNL {
public:
static void setupGtSystemInfo(GT_SYSTEM_INFO *gtSysInfo);
static const HardwareInfo hwInfo;
private:
static GT_SYSTEM_INFO gtSystemInfo;
};
class CNL_4x9x8 : public CNL {
public:
static void setupGtSystemInfo(GT_SYSTEM_INFO *gtSysInfo);
static const HardwareInfo hwInfo;
private:
static GT_SYSTEM_INFO gtSystemInfo;
};
} // namespace OCLRT

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,399 @@
/*
* 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.
*/
#pragma once
#pragma pack(1)
typedef struct tagMEDIA_SURFACE_STATE {
union tagTheStructure {
struct tagCommon {
uint32_t Reserved_0 : BITFIELD_RANGE(0, 29);
uint32_t Rotation : BITFIELD_RANGE(30, 31);
uint32_t Cr_VCb_UPixelOffsetVDirection : BITFIELD_RANGE(0, 1);
uint32_t PictureStructure : BITFIELD_RANGE(2, 3);
uint32_t Width : BITFIELD_RANGE(4, 17);
uint32_t Height : BITFIELD_RANGE(18, 31);
uint32_t TileMode : BITFIELD_RANGE(0, 1);
uint32_t HalfPitchForChroma : BITFIELD_RANGE(2, 2);
uint32_t SurfacePitch : BITFIELD_RANGE(3, 20);
uint32_t AddressControl : BITFIELD_RANGE(21, 21);
uint32_t MemoryCompressionEnable : BITFIELD_RANGE(22, 22);
uint32_t MemoryCompressionMode : BITFIELD_RANGE(23, 23);
uint32_t Cr_VCb_UPixelOffsetVDirectionMsb : BITFIELD_RANGE(24, 24);
uint32_t Cr_VCb_UPixelOffsetUDirection : BITFIELD_RANGE(25, 25);
uint32_t InterleaveChroma : BITFIELD_RANGE(26, 26);
uint32_t SurfaceFormat : BITFIELD_RANGE(27, 31);
uint32_t YOffsetForU_Cb : BITFIELD_RANGE(0, 13);
uint32_t Reserved_110 : BITFIELD_RANGE(14, 15);
uint32_t XOffsetForU_Cb : BITFIELD_RANGE(16, 29);
uint32_t Reserved_126 : BITFIELD_RANGE(30, 31);
uint32_t Reserved_128;
uint32_t SurfaceMemoryObjectControlState_Reserved : BITFIELD_RANGE(0, 0);
uint32_t SurfaceMemoryObjectControlState_IndexToMocsTables : BITFIELD_RANGE(1, 6);
uint32_t Reserved_167 : BITFIELD_RANGE(7, 17);
uint32_t TiledResourceMode : BITFIELD_RANGE(18, 19);
uint32_t Depth : BITFIELD_RANGE(20, 23);
uint32_t Reserved_184 : BITFIELD_RANGE(24, 29);
uint32_t VerticalLineStrideOffset : BITFIELD_RANGE(30, 30);
uint32_t VerticalLineStride : BITFIELD_RANGE(31, 31);
uint32_t SurfaceBaseAddressLow;
uint32_t SurfaceBaseAddressHigh : BITFIELD_RANGE(0, 15);
uint32_t Reserved_240 : BITFIELD_RANGE(16, 31);
} Common;
struct tagSurfaceFormatIsNotOneOfPlanarFormats {
uint32_t Reserved_0;
uint32_t Reserved_32;
uint32_t Reserved_64;
uint32_t Reserved_96;
uint32_t Reserved_128;
uint32_t Reserved_160;
uint32_t Reserved_192;
uint32_t Reserved_224;
} SurfaceFormatIsNotOneOfPlanarFormats;
struct tagSurfaceFormatIsOneOfPlanarFormats {
uint32_t Reserved_0 : BITFIELD_RANGE(0, 15);
uint32_t YOffset : BITFIELD_RANGE(16, 19);
uint32_t XOffset : BITFIELD_RANGE(20, 26);
uint32_t Reserved_27 : BITFIELD_RANGE(27, 31);
uint32_t Reserved_32;
uint32_t Reserved_64;
uint32_t Reserved_96;
uint32_t Reserved_128;
uint32_t Reserved_160;
uint32_t Reserved_192;
uint32_t Reserved_224;
} SurfaceFormatIsOneOfPlanarFormats;
struct tag_SurfaceFormatIsOneOfPlanarAnd_InterleaveChromaIs0 {
uint32_t Reserved_0;
uint32_t Reserved_32;
uint32_t Reserved_64;
uint32_t Reserved_96;
uint32_t YOffsetForV_Cr : BITFIELD_RANGE(0, 14);
uint32_t Reserved_143 : BITFIELD_RANGE(15, 15);
uint32_t XOffsetForV_Cr : BITFIELD_RANGE(16, 29);
uint32_t Reserved_158 : BITFIELD_RANGE(30, 31);
uint32_t Reserved_160;
uint32_t Reserved_192;
uint32_t Reserved_224;
} _SurfaceFormatIsOneOfPlanarAnd_InterleaveChromaIs0;
uint32_t RawData[8];
} TheStructure;
typedef enum tagROTATION {
ROTATION_NO_ROTATION_OR_0_DEGREE = 0x0,
ROTATION_90_DEGREE_ROTATION = 0x1,
ROTATION_180_DEGREE_ROTATION = 0x2,
ROTATION_270_DEGREE_ROTATION = 0x3,
} ROTATION;
typedef enum tagPICTURE_STRUCTURE {
PICTURE_STRUCTURE_FRAME_PICTURE = 0x0,
PICTURE_STRUCTURE_TOP_FIELD_PICTURE = 0x1,
PICTURE_STRUCTURE_BOTTOM_FIELD_PICTURE = 0x2,
PICTURE_STRUCTURE_INVALID_NOT_ALLOWED = 0x3,
} PICTURE_STRUCTURE;
typedef enum tagTILE_MODE {
TILE_MODE_TILEMODE_LINEAR = 0x0,
TILE_MODE_TILEMODE_XMAJOR = 0x2,
TILE_MODE_TILEMODE_YMAJOR = 0x3,
} TILE_MODE;
typedef enum tagADDRESS_CONTROL {
ADDRESS_CONTROL_CLAMP = 0x0,
ADDRESS_CONTROL_MIRROR = 0x1,
} ADDRESS_CONTROL;
typedef enum tagMEMORY_COMPRESSION_MODE {
MEMORY_COMPRESSION_MODE_HORIZONTAL_COMPRESSION_MODE = 0x0,
MEMORY_COMPRESSION_MODE_VERTICAL_COMPRESSION_MODE = 0x1,
} MEMORY_COMPRESSION_MODE;
typedef enum tagSURFACE_FORMAT {
SURFACE_FORMAT_YCRCB_NORMAL = 0x0,
SURFACE_FORMAT_YCRCB_SWAPUVY = 0x1,
SURFACE_FORMAT_YCRCB_SWAPUV = 0x2,
SURFACE_FORMAT_YCRCB_SWAPY = 0x3,
SURFACE_FORMAT_PLANAR_420_8 = 0x4,
SURFACE_FORMAT_Y8_UNORM_VA = 0x5,
SURFACE_FORMAT_Y16_SNORM = 0x6,
SURFACE_FORMAT_Y16_UNORM_VA = 0x7,
SURFACE_FORMAT_R10G10B10A2_UNORM = 0x8,
SURFACE_FORMAT_R8G8B8A8_UNORM = 0x9,
SURFACE_FORMAT_R8B8_UNORM_CRCB = 0xa,
SURFACE_FORMAT_R8_UNORM_CR_CB = 0xb,
SURFACE_FORMAT_Y8_UNORM = 0xc,
SURFACE_FORMAT_A8Y8U8V8_UNORM = 0xd,
SURFACE_FORMAT_B8G8R8A8_UNORM = 0xe,
SURFACE_FORMAT_R16G16B16A16 = 0xf,
SURFACE_FORMAT_Y1_UNORM = 0x10,
SURFACE_FORMAT_Y32_UNORM = 0x11,
SURFACE_FORMAT_PLANAR_422_8 = 0x12,
SURFACE_FORMAT_FM_STRBUF_Y1 = 0x13,
SURFACE_FORMAT_FM_STRBUF_Y8 = 0x14,
SURFACE_FORMAT_FM_STRBUF_Y16 = 0x15,
SURFACE_FORMAT_FM_STRBUF_Y32 = 0x16,
SURFACE_FORMAT_PLANAR_420_16 = 0x17,
SURFACE_FORMAT_R16B16_UNORM_CRCB = 0x18,
SURFACE_FORMAT_R16_UNORM_CR_CB = 0x19,
SURFACE_FORMAT_Y16_UNORM = 0x1a,
} SURFACE_FORMAT;
typedef enum tagSURFACE_MEMORY_OBJECT_CONTROL_STATE {
SURFACE_MEMORY_OBJECT_CONTROL_STATE_DEFAULTVAUEDESC = 0x0,
} SURFACE_MEMORY_OBJECT_CONTROL_STATE;
typedef enum tagTILED_RESOURCE_MODE {
TILED_RESOURCE_MODE_TRMODE_NONE = 0x0,
TILED_RESOURCE_MODE_TRMODE_TILEYF = 0x1,
TILED_RESOURCE_MODE_TRMODE_TILEYS = 0x2,
} TILED_RESOURCE_MODE;
typedef enum tagPATCH_CONSTANTS {
SURFACEBASEADDRESS_BYTEOFFSET = 0x18,
SURFACEBASEADDRESS_INDEX = 0x6,
SURFACEBASEADDRESSHIGH_BYTEOFFSET = 0x1c,
SURFACEBASEADDRESSHIGH_INDEX = 0x7,
} PATCH_CONSTANTS;
inline void init(void) {
memset(&TheStructure, 0, sizeof(TheStructure));
TheStructure.Common.Rotation = ROTATION_NO_ROTATION_OR_0_DEGREE;
TheStructure.Common.PictureStructure = PICTURE_STRUCTURE_FRAME_PICTURE;
TheStructure.Common.TileMode = TILE_MODE_TILEMODE_LINEAR;
TheStructure.Common.AddressControl = ADDRESS_CONTROL_CLAMP;
TheStructure.Common.MemoryCompressionMode = MEMORY_COMPRESSION_MODE_HORIZONTAL_COMPRESSION_MODE;
TheStructure.Common.SurfaceFormat = SURFACE_FORMAT_YCRCB_NORMAL;
TheStructure.Common.TiledResourceMode = TILED_RESOURCE_MODE_TRMODE_NONE;
}
static tagMEDIA_SURFACE_STATE sInit(void) {
MEDIA_SURFACE_STATE state;
state.init();
return state;
}
inline uint32_t &getRawData(const uint32_t index) {
DEBUG_BREAK_IF(index >= 8);
return TheStructure.RawData[index];
}
inline void setRotation(const ROTATION value) {
TheStructure.Common.Rotation = value;
}
inline ROTATION getRotation(void) const {
return static_cast<ROTATION>(TheStructure.Common.Rotation);
}
inline void setCrVCbUPixelOffsetVDirection(const uint32_t value) {
TheStructure.Common.Cr_VCb_UPixelOffsetVDirection = value;
}
inline uint32_t getCrVCbUPixelOffsetVDirection(void) const {
return (TheStructure.Common.Cr_VCb_UPixelOffsetVDirection);
}
inline void setPictureStructure(const PICTURE_STRUCTURE value) {
TheStructure.Common.PictureStructure = value;
}
inline PICTURE_STRUCTURE getPictureStructure(void) const {
return static_cast<PICTURE_STRUCTURE>(TheStructure.Common.PictureStructure);
}
inline void setWidth(const uint32_t value) {
TheStructure.Common.Width = value - 1;
}
inline uint32_t getWidth(void) const {
return (TheStructure.Common.Width + 1);
}
inline void setHeight(const uint32_t value) {
TheStructure.Common.Height = value - 1;
}
inline uint32_t getHeight(void) const {
return (TheStructure.Common.Height + 1);
}
inline void setTileMode(const TILE_MODE value) {
TheStructure.Common.TileMode = value;
}
inline TILE_MODE getTileMode(void) const {
return static_cast<TILE_MODE>(TheStructure.Common.TileMode);
}
inline void setHalfPitchForChroma(const bool value) {
TheStructure.Common.HalfPitchForChroma = value;
}
inline bool getHalfPitchForChroma(void) const {
return (TheStructure.Common.HalfPitchForChroma);
}
inline void setSurfacePitch(const uint32_t value) {
TheStructure.Common.SurfacePitch = value - 1;
}
inline uint32_t getSurfacePitch(void) const {
return (TheStructure.Common.SurfacePitch + 1);
}
inline void setAddressControl(const ADDRESS_CONTROL value) {
TheStructure.Common.AddressControl = value;
}
inline ADDRESS_CONTROL getAddressControl(void) const {
return static_cast<ADDRESS_CONTROL>(TheStructure.Common.AddressControl);
}
inline void setMemoryCompressionEnable(const bool value) {
TheStructure.Common.MemoryCompressionEnable = value;
}
inline bool getMemoryCompressionEnable(void) const {
return (TheStructure.Common.MemoryCompressionEnable);
}
inline void setMemoryCompressionMode(const MEMORY_COMPRESSION_MODE value) {
TheStructure.Common.MemoryCompressionMode = value;
}
inline MEMORY_COMPRESSION_MODE getMemoryCompressionMode(void) const {
return static_cast<MEMORY_COMPRESSION_MODE>(TheStructure.Common.MemoryCompressionMode);
}
inline void setCrVCbUPixelOffsetVDirectionMsb(const uint32_t value) {
TheStructure.Common.Cr_VCb_UPixelOffsetVDirectionMsb = value;
}
inline uint32_t getCrVCbUPixelOffsetVDirectionMsb(void) const {
return (TheStructure.Common.Cr_VCb_UPixelOffsetVDirectionMsb);
}
inline void setCrVCbUPixelOffsetUDirection(const uint32_t value) {
TheStructure.Common.Cr_VCb_UPixelOffsetUDirection = value;
}
inline uint32_t getCrVCbUPixelOffsetUDirection(void) const {
return (TheStructure.Common.Cr_VCb_UPixelOffsetUDirection);
}
inline void setInterleaveChroma(const bool value) {
TheStructure.Common.InterleaveChroma = value;
}
inline bool getInterleaveChroma(void) const {
return (TheStructure.Common.InterleaveChroma);
}
inline void setSurfaceFormat(const SURFACE_FORMAT value) {
TheStructure.Common.SurfaceFormat = value;
}
inline SURFACE_FORMAT getSurfaceFormat(void) const {
return static_cast<SURFACE_FORMAT>(TheStructure.Common.SurfaceFormat);
}
inline void setYOffsetForUCb(const uint32_t value) {
TheStructure.Common.YOffsetForU_Cb = value;
}
inline uint32_t getYOffsetForUCb(void) const {
return (TheStructure.Common.YOffsetForU_Cb);
}
inline void setXOffsetForUCb(const uint32_t value) {
TheStructure.Common.XOffsetForU_Cb = value;
}
inline uint32_t getXOffsetForUCb(void) const {
return (TheStructure.Common.XOffsetForU_Cb);
}
inline void setSurfaceMemoryObjectControlStateReserved(const uint32_t value) {
TheStructure.Common.SurfaceMemoryObjectControlState_Reserved = value;
}
inline uint32_t getSurfaceMemoryObjectControlStateReserved(void) const {
return (TheStructure.Common.SurfaceMemoryObjectControlState_Reserved);
}
inline void setSurfaceMemoryObjectControlStateIndexToMocsTables(const uint32_t value) {
TheStructure.Common.SurfaceMemoryObjectControlState_IndexToMocsTables = value;
}
inline uint32_t getSurfaceMemoryObjectControlStateIndexToMocsTables(void) const {
return (TheStructure.Common.SurfaceMemoryObjectControlState_IndexToMocsTables);
}
inline void setTiledResourceMode(const TILED_RESOURCE_MODE value) {
TheStructure.Common.TiledResourceMode = value;
}
inline TILED_RESOURCE_MODE getTiledResourceMode(void) const {
return static_cast<TILED_RESOURCE_MODE>(TheStructure.Common.TiledResourceMode);
}
inline void setDepth(const uint32_t value) {
TheStructure.Common.Depth = value;
}
inline uint32_t getDepth(void) const {
return (TheStructure.Common.Depth);
}
inline void setVerticalLineStrideOffset(const uint32_t value) {
TheStructure.Common.VerticalLineStrideOffset = value;
}
inline uint32_t getVerticalLineStrideOffset(void) const {
return (TheStructure.Common.VerticalLineStrideOffset);
}
inline void setVerticalLineStride(const uint32_t value) {
TheStructure.Common.VerticalLineStride = value;
}
inline uint32_t getVerticalLineStride(void) const {
return (TheStructure.Common.VerticalLineStride);
}
inline void setSurfaceBaseAddress(const uint64_t value) {
TheStructure.Common.SurfaceBaseAddressLow = static_cast<uint32_t>(value);
TheStructure.Common.SurfaceBaseAddressHigh = value >> 32;
}
inline uint64_t getSurfaceBaseAddress(void) const {
return (TheStructure.Common.SurfaceBaseAddressLow |
static_cast<uint64_t>(TheStructure.Common.SurfaceBaseAddressHigh) << 32);
}
inline void setSurfaceBaseAddressHigh(const uint32_t value) {
TheStructure.Common.SurfaceBaseAddressHigh = value;
}
inline uint32_t getSurfaceBaseAddressHigh(void) const {
return (TheStructure.Common.SurfaceBaseAddressHigh);
}
typedef enum tagYOFFSET {
YOFFSET_BIT_SHIFT = 0x2,
YOFFSET_ALIGN_SIZE = 0x4,
} YOFFSET;
inline void setYOffset(const uint32_t value) {
TheStructure.SurfaceFormatIsOneOfPlanarFormats.YOffset = value >> YOFFSET_BIT_SHIFT;
}
inline uint32_t getYOffset(void) const {
return (TheStructure.SurfaceFormatIsOneOfPlanarFormats.YOffset << YOFFSET_BIT_SHIFT);
}
typedef enum tagXOFFSET {
XOFFSET_BIT_SHIFT = 0x2,
XOFFSET_ALIGN_SIZE = 0x4,
} XOFFSET;
inline void setXOffset(const uint32_t value) {
TheStructure.SurfaceFormatIsOneOfPlanarFormats.XOffset = value >> XOFFSET_BIT_SHIFT;
}
inline uint32_t getXOffset(void) const {
return (TheStructure.SurfaceFormatIsOneOfPlanarFormats.XOffset << XOFFSET_BIT_SHIFT);
}
inline void setYOffsetForVCr(const uint32_t value) {
TheStructure._SurfaceFormatIsOneOfPlanarAnd_InterleaveChromaIs0.YOffsetForV_Cr = value;
}
inline uint32_t getYOffsetForVCr(void) const {
return (TheStructure._SurfaceFormatIsOneOfPlanarAnd_InterleaveChromaIs0.YOffsetForV_Cr);
}
inline void setXOffsetForVCr(const uint32_t value) {
TheStructure._SurfaceFormatIsOneOfPlanarAnd_InterleaveChromaIs0.XOffsetForV_Cr = value;
}
inline uint32_t getXOffsetForVCr(void) const {
return (TheStructure._SurfaceFormatIsOneOfPlanarAnd_InterleaveChromaIs0.XOffsetForV_Cr);
}
} MEDIA_SURFACE_STATE;
STATIC_ASSERT(32 == sizeof(MEDIA_SURFACE_STATE));
typedef struct tagMI_MATH {
union _DW0 {
struct _BitField {
uint32_t DwordLength : BITFIELD_RANGE(0, 5);
uint32_t Reserved : BITFIELD_RANGE(6, 22);
uint32_t InstructionOpcode : BITFIELD_RANGE(23, 28);
uint32_t InstructionType : BITFIELD_RANGE(29, 31);
} BitField;
uint32_t Value;
} DW0;
typedef enum tagMI_COMMAND_OPCODE {
MI_COMMAND_OPCODE_MI_MATH = 0x1A,
} MI_COMMAND_OPCODE;
typedef enum tagCOMMAND_TYPE {
COMMAND_TYPE_MI_COMMAND = 0x0,
} COMMAND_TYPE;
} MI_MATH;
typedef struct tagMI_MATH_ALU_INST_INLINE {
union _DW0 {
struct _BitField {
uint32_t Operand2 : BITFIELD_RANGE(0, 9);
uint32_t Operand1 : BITFIELD_RANGE(10, 19);
uint32_t ALUOpcode : BITFIELD_RANGE(20, 31);
} BitField;
uint32_t Value;
} DW0;
} MI_MATH_ALU_INST_INLINE;
#pragma pack()

View File

@ -0,0 +1,50 @@
/*
* 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/helpers/hw_helper.h"
#include "runtime/helpers/hw_helper.inl"
namespace OCLRT {
typedef CNLFamily Family;
template <>
size_t HwHelperHw<Family>::getMaxBarrierRegisterPerSlice() const {
return 32;
}
template <>
void HwHelperHw<Family>::setCapabilityCoherencyFlag(const HardwareInfo *pHwInfo, bool &coherencyFlag) {
if (pHwInfo->pPlatform->usRevId < 0x4) {
coherencyFlag = false;
} else {
coherencyFlag = true;
}
}
template <>
bool HwHelperHw<Family>::setupPreemptionRegisters(HardwareInfo *pHwInfo, bool enable) {
pHwInfo->capabilityTable.whitelistedRegisters.csChicken1_0x2580 = enable;
return pHwInfo->capabilityTable.whitelistedRegisters.csChicken1_0x2580;
}
template class HwHelperHw<Family>;
} // namespace OCLRT

45
runtime/gen10/hw_info.h Normal file
View File

@ -0,0 +1,45 @@
/*
* 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.
*/
#pragma once
#include "runtime/helpers/hw_info.h"
namespace OCLRT {
struct CNLFamily;
struct CNL;
template <>
struct GfxFamilyMapper<IGFX_GEN10_CORE> {
typedef CNLFamily GfxFamily;
static const char *name;
};
template <>
struct HwMapper<IGFX_CANNONLAKE> {
enum { gfxFamily = IGFX_GEN10_CORE };
static const char *abbreviation;
typedef GfxFamilyMapper<static_cast<GFXCORE_FAMILY>(gfxFamily)>::GfxFamily GfxFamily;
typedef CNL GfxProduct;
};
} // namespace OCLRT

View File

@ -0,0 +1,222 @@
/*
* 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 "hw_info.h"
#include "hw_cmds.h"
#include "runtime/aub_mem_dump/aub_services.h"
#include "runtime/helpers/engine_node.h"
#include "runtime/memory_manager/memory_constants.h"
namespace OCLRT {
const char *HwMapper<IGFX_CANNONLAKE>::abbreviation = "cnl";
bool isSimulationCNL(unsigned short deviceId) {
switch (deviceId) {
case ICNL_3x8_DESK_DEVICE_F0_ID:
case ICNL_5x8_DESK_DEVICE_F0_ID:
case ICNL_9x8_DESK_DEVICE_F0_ID:
case ICNL_13x8_DESK_DEVICE_F0_ID:
return true;
}
return false;
};
const PLATFORM CNL::platform = {
IGFX_CANNONLAKE,
PCH_UNKNOWN,
IGFX_GEN10_CORE,
IGFX_GEN10_CORE,
PLATFORM_NONE, // default init
0, // usDeviceID
0, // usRevId. 0 sets the stepping to A0
0, // usDeviceID_PCH
0, // usRevId_PCH
GTTYPE_UNDEFINED};
const RuntimeCapabilityTable CNL::capabilityTable{
0,
83.333,
21,
true,
true,
true,
true,
true, // ftrSupportsVmeAvcTextureSampler
true, // ftrSupportsVmeAvcPreemption
false,
PreemptionMode::MidThread,
{true, true},
&isSimulationCNL,
true,
true, // forceStatelessCompilationFor32Bit
{false, 0, false, 0, false, 0}, // KmdNotifyProperties
true, // ftr64KBpages
EngineType::ENGINE_RCS, // defaultEngineType
MemoryConstants::pageSize, //requiredPreemptionSurfaceSize
true,
true, // sourceLevelDebuggerSupported
CmdServicesMemTraceVersion::DeviceValues::Cnl};
const HardwareInfo CNL_2x5x8::hwInfo = {
&CNL::platform,
&emptySkuTable,
&emptyWaTable,
&CNL_2x5x8::gtSystemInfo,
CNL::capabilityTable,
};
GT_SYSTEM_INFO CNL_2x5x8::gtSystemInfo = {0};
void CNL_2x5x8::setupGtSystemInfo(GT_SYSTEM_INFO *gtSysInfo) {
gtSysInfo->EUCount = 39;
gtSysInfo->ThreadCount = 39 * CNL::threadsPerEu;
gtSysInfo->SliceCount = 2;
gtSysInfo->SubSliceCount = 5;
gtSysInfo->L3CacheSizeInKb = 1536;
gtSysInfo->L3BankCount = 6;
gtSysInfo->MaxFillRate = 16;
gtSysInfo->TotalVsThreads = 336;
gtSysInfo->TotalHsThreads = 336;
gtSysInfo->TotalDsThreads = 336;
gtSysInfo->TotalGsThreads = 336;
gtSysInfo->TotalPsThreadsWindowerRange = 64;
gtSysInfo->CsrSizeInMb = 8;
gtSysInfo->MaxEuPerSubSlice = CNL::maxEuPerSubslice;
gtSysInfo->MaxSlicesSupported = CNL::maxSlicesSupported;
gtSysInfo->MaxSubSlicesSupported = CNL::maxSubslicesSupported;
gtSysInfo->IsL3HashModeEnabled = false;
gtSysInfo->IsDynamicallyPopulated = false;
};
const HardwareInfo CNL_2x4x8::hwInfo = {
&CNL::platform,
&emptySkuTable,
&emptyWaTable,
&CNL_2x4x8::gtSystemInfo,
CNL::capabilityTable,
};
GT_SYSTEM_INFO CNL_2x4x8::gtSystemInfo = {0};
void CNL_2x4x8::setupGtSystemInfo(GT_SYSTEM_INFO *gtSysInfo) {
gtSysInfo->EUCount = 31;
gtSysInfo->ThreadCount = 31 * CNL::threadsPerEu;
gtSysInfo->SliceCount = 2;
gtSysInfo->SubSliceCount = 4;
gtSysInfo->L3CacheSizeInKb = 1536;
gtSysInfo->L3BankCount = 6;
gtSysInfo->MaxFillRate = 16;
gtSysInfo->TotalVsThreads = 336;
gtSysInfo->TotalHsThreads = 336;
gtSysInfo->TotalDsThreads = 336;
gtSysInfo->TotalGsThreads = 336;
gtSysInfo->TotalPsThreadsWindowerRange = 64;
gtSysInfo->CsrSizeInMb = 8;
gtSysInfo->MaxEuPerSubSlice = CNL::maxEuPerSubslice;
gtSysInfo->MaxSlicesSupported = CNL::maxSlicesSupported;
gtSysInfo->MaxSubSlicesSupported = CNL::maxSubslicesSupported;
gtSysInfo->IsL3HashModeEnabled = false;
gtSysInfo->IsDynamicallyPopulated = false;
};
const HardwareInfo CNL_1x3x8::hwInfo = {
&CNL::platform,
&emptySkuTable,
&emptyWaTable,
&CNL_1x3x8::gtSystemInfo,
CNL::capabilityTable,
};
GT_SYSTEM_INFO CNL_1x3x8::gtSystemInfo = {0};
void CNL_1x3x8::setupGtSystemInfo(GT_SYSTEM_INFO *gtSysInfo) {
gtSysInfo->EUCount = 23;
gtSysInfo->ThreadCount = 23 * CNL::threadsPerEu;
gtSysInfo->SliceCount = 1;
gtSysInfo->SubSliceCount = 3;
gtSysInfo->L3CacheSizeInKb = 1536;
gtSysInfo->L3BankCount = 6;
gtSysInfo->MaxFillRate = 16;
gtSysInfo->TotalVsThreads = 336;
gtSysInfo->TotalHsThreads = 336;
gtSysInfo->TotalDsThreads = 336;
gtSysInfo->TotalGsThreads = 336;
gtSysInfo->TotalPsThreadsWindowerRange = 64;
gtSysInfo->CsrSizeInMb = 8;
gtSysInfo->MaxEuPerSubSlice = CNL::maxEuPerSubslice;
gtSysInfo->MaxSlicesSupported = CNL::maxSlicesSupported;
gtSysInfo->MaxSubSlicesSupported = CNL::maxSubslicesSupported;
gtSysInfo->IsL3HashModeEnabled = false;
gtSysInfo->IsDynamicallyPopulated = false;
};
const HardwareInfo CNL_1x2x8::hwInfo = {
&CNL::platform,
&emptySkuTable,
&emptyWaTable,
&CNL_1x2x8::gtSystemInfo,
CNL::capabilityTable,
};
GT_SYSTEM_INFO CNL_1x2x8::gtSystemInfo = {0};
void CNL_1x2x8::setupGtSystemInfo(GT_SYSTEM_INFO *gtSysInfo) {
gtSysInfo->EUCount = 15;
gtSysInfo->ThreadCount = 15 * CNL::threadsPerEu;
gtSysInfo->SliceCount = 1;
gtSysInfo->SubSliceCount = 2;
gtSysInfo->L3CacheSizeInKb = 1536;
gtSysInfo->L3BankCount = 6;
gtSysInfo->MaxFillRate = 16;
gtSysInfo->TotalVsThreads = 336;
gtSysInfo->TotalHsThreads = 336;
gtSysInfo->TotalDsThreads = 336;
gtSysInfo->TotalGsThreads = 336;
gtSysInfo->TotalPsThreadsWindowerRange = 64;
gtSysInfo->CsrSizeInMb = 8;
gtSysInfo->MaxEuPerSubSlice = CNL::maxEuPerSubslice;
gtSysInfo->MaxSlicesSupported = CNL::maxSlicesSupported;
gtSysInfo->MaxSubSlicesSupported = CNL::maxSubslicesSupported;
gtSysInfo->IsL3HashModeEnabled = false;
gtSysInfo->IsDynamicallyPopulated = false;
};
const HardwareInfo CNL_4x9x8::hwInfo = {
&CNL::platform,
&emptySkuTable,
&emptyWaTable,
&CNL_4x9x8::gtSystemInfo,
CNL::capabilityTable,
};
GT_SYSTEM_INFO CNL_4x9x8::gtSystemInfo = {0};
void CNL_4x9x8::setupGtSystemInfo(GT_SYSTEM_INFO *gtSysInfo) {
gtSysInfo->EUCount = 71;
gtSysInfo->ThreadCount = 71 * CNL::threadsPerEu;
gtSysInfo->SliceCount = 4;
gtSysInfo->SubSliceCount = 9;
gtSysInfo->L3CacheSizeInKb = 1536;
gtSysInfo->L3BankCount = 6;
gtSysInfo->MaxFillRate = 16;
gtSysInfo->TotalVsThreads = 336;
gtSysInfo->TotalHsThreads = 336;
gtSysInfo->TotalDsThreads = 336;
gtSysInfo->TotalGsThreads = 336;
gtSysInfo->TotalPsThreadsWindowerRange = 64;
gtSysInfo->CsrSizeInMb = 8;
gtSysInfo->MaxEuPerSubSlice = CNL::maxEuPerSubslice;
gtSysInfo->MaxSlicesSupported = CNL::maxSlicesSupported;
gtSysInfo->MaxSubSlicesSupported = CNL::maxSubslicesSupported;
gtSysInfo->IsL3HashModeEnabled = false;
gtSysInfo->IsDynamicallyPopulated = false;
};
const HardwareInfo CNL::hwInfo = CNL_2x5x8::hwInfo;
void (*CNL::setupGtSystemInfo)(GT_SYSTEM_INFO *) = CNL_2x5x8::setupGtSystemInfo;
} // namespace OCLRT

View File

@ -0,0 +1,29 @@
/*
* 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.
*/
#ifdef SUPPORT_CNL
#include "hw_info_cnl.inl"
#endif
namespace OCLRT {
const char *GfxFamilyMapper<IGFX_GEN10_CORE>::name = "Gen10";
} // namespace OCLRT

View File

@ -0,0 +1,56 @@
/*
* 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 "hw_cmds.h"
#include "runtime/mem_obj/image.h"
#include "runtime/mem_obj/image.inl"
#include <map>
namespace OCLRT {
typedef CNLFamily Family;
static auto gfxCore = IGFX_GEN10_CORE;
template <typename GfxFamily>
void ImageHw<GfxFamily>::setMediaSurfaceRotation(void *memory) {
using MEDIA_SURFACE_STATE = typename GfxFamily::MEDIA_SURFACE_STATE;
using SURFACE_FORMAT = typename MEDIA_SURFACE_STATE::SURFACE_FORMAT;
auto surfaceState = reinterpret_cast<MEDIA_SURFACE_STATE *>(memory);
surfaceState->setRotation(MEDIA_SURFACE_STATE::ROTATION_NO_ROTATION_OR_0_DEGREE);
surfaceState->setXOffset(0);
surfaceState->setYOffset(0);
}
template <typename GfxFamily>
void ImageHw<GfxFamily>::setSurfaceMemoryObjectControlStateIndexToMocsTable(void *memory, uint32_t value) {
using MEDIA_SURFACE_STATE = typename GfxFamily::MEDIA_SURFACE_STATE;
using SURFACE_FORMAT = typename MEDIA_SURFACE_STATE::SURFACE_FORMAT;
auto surfaceState = reinterpret_cast<MEDIA_SURFACE_STATE *>(memory);
surfaceState->setSurfaceMemoryObjectControlStateIndexToMocsTables(value);
}
#include "runtime/mem_obj/image_factory_init.inl"
} // namespace OCLRT

View File

@ -0,0 +1,32 @@
/*
* 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/helpers/kernel_commands.h"
#include "hw_cmds.h"
#include "runtime/helpers/kernel_commands.inl"
namespace OCLRT {
template struct KernelCommandsHelper<CNLFamily>;
template <>
bool KernelCommandsHelper<CNLFamily>::isPipeControlWArequired() { return true; }
} // namespace OCLRT

View File

@ -0,0 +1,32 @@
/*
* 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/os_interface/linux/device_command_stream.inl"
#include "runtime/os_interface/linux/drm_command_stream.inl"
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.inl"
namespace OCLRT {
template class DeviceCommandStreamReceiver<CNLFamily>;
template class DrmCommandStreamReceiver<CNLFamily>;
template class CommandStreamReceiverWithAUBDump<DrmCommandStreamReceiver<CNLFamily>>;
} // namespace OCLRT

View File

@ -0,0 +1,30 @@
/*
* 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 "hw_cmds.h"
#include "runtime/os_interface/linux/drm_engine_mapper.h"
#include "runtime/os_interface/linux/drm_engine_mapper.inl"
namespace OCLRT {
template class DrmEngineMapper<CNLFamily>;
} // namespace OCLRT

View File

@ -0,0 +1,93 @@
/*
* 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/helpers/hw_info.h"
#include "runtime/os_interface/hw_info_config.h"
namespace OCLRT {
template <>
int HwInfoConfigHw<IGFX_CANNONLAKE>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
FeatureTable *pSkuTable = const_cast<FeatureTable *>(hwInfo->pSkuTable);
GT_SYSTEM_INFO *pSysInfo = const_cast<GT_SYSTEM_INFO *>(hwInfo->pSysInfo);
WorkaroundTable *pWaTable = const_cast<WorkaroundTable *>(hwInfo->pWaTable);
if (pSysInfo->SubSliceCount == 9) {
pSysInfo->SliceCount = 4;
} else if (pSysInfo->SubSliceCount > 5) {
pSysInfo->SliceCount = 3;
} else if (pSysInfo->SubSliceCount > 3) {
pSysInfo->SliceCount = 2;
} else {
pSysInfo->SliceCount = 1;
}
if ((pSysInfo->SliceCount > 1) && (pSysInfo->IsL3HashModeEnabled)) {
pSysInfo->L3BankCount--;
pSysInfo->L3CacheSizeInKb -= 256;
}
pSkuTable->ftrGpGpuMidBatchPreempt = 1;
pSkuTable->ftrGpGpuThreadGroupLevelPreempt = 1;
pSkuTable->ftrGpGpuMidThreadLevelPreempt = 0;
pSkuTable->ftr3dMidBatchPreempt = 1;
pSkuTable->ftr3dObjectLevelPreempt = 1;
pSkuTable->ftr3dMidBatchPreempt = 1;
pSkuTable->ftrGpGpuThreadGroupLevelPreempt = 1;
pSkuTable->ftrPerCtxtPreemptionGranularityControl = 1;
pSkuTable->ftrPPGTT = 1;
pSkuTable->ftrSVM = 1;
pSkuTable->ftrL3IACoherency = 1;
pSkuTable->ftrIA32eGfxPTEs = 1;
pSkuTable->ftrStandardMipTailFormat = 1;
pSkuTable->ftrDisplayYTiling = 1;
pSkuTable->ftrTranslationTable = 1;
pSkuTable->ftrUserModeTranslationTable = 1;
pSkuTable->ftrTileMappedResource = 1;
pSkuTable->ftrEnableGuC = 1;
pSkuTable->ftrFbc = 1;
pSkuTable->ftrFbc2AddressTranslation = 1;
pSkuTable->ftrFbcBlitterTracking = 1;
pSkuTable->ftrFbcCpuTracking = 1;
pSkuTable->ftrAstcHdr2D = 1;
pSkuTable->ftrAstcLdr2D = 1;
pWaTable->wa4kAlignUVOffsetNV12LinearSurface = 1;
pWaTable->waSendMIFLUSHBeforeVFE = 1;
pWaTable->waReportPerfCountUseGlobalContextID = 1;
pWaTable->waSamplerCacheFlushBetweenRedescribedSurfaceReads = 1;
if ((1 << hwInfo->pPlatform->usRevId) & 0x3) {
pWaTable->waFbcLinearSurfaceStride = 1;
}
if ((1 << hwInfo->pPlatform->usRevId) & 0x1) {
pWaTable->waEncryptedEdramOnlyPartials = 1;
}
return 0;
}
template class HwInfoConfigHw<IGFX_CANNONLAKE>;
} // namespace OCLRT

View File

@ -0,0 +1,27 @@
/*
* 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/os_interface/hw_info_config.inl"
#ifdef SUPPORT_CNL
#include "hw_info_config_cnl.inl"
#endif

View File

@ -0,0 +1,120 @@
/*
* 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/helpers/preamble.inl"
#include "runtime/command_queue/gpgpu_walker.h"
namespace OCLRT {
template <>
uint32_t PreambleHelper<CNLFamily>::getL3Config(const HardwareInfo &hwInfo, bool useSLM) {
uint32_t l3Config = 0;
switch (hwInfo.pPlatform->eProductFamily) {
case IGFX_CANNONLAKE:
l3Config = getL3ConfigHelper<IGFX_CANNONLAKE>(useSLM);
break;
default:
l3Config = getL3ConfigHelper<IGFX_CANNONLAKE>(true);
}
return l3Config;
}
template <>
uint32_t PreambleHelper<CNLFamily>::getDefaultThreadArbitrationPolicy() {
return ThreadArbitrationPolicy::RoundRobinAfterDependency;
}
template <>
void PreambleHelper<CNLFamily>::programThreadArbitration(LinearStream *pCommandStream, uint32_t requiredThreadArbitrationPolicy) {
UNRECOVERABLE_IF(requiredThreadArbitrationPolicy == ThreadArbitrationPolicy::NotPresent);
auto pipeControl = pCommandStream->getSpaceForCmd<PIPE_CONTROL>();
*pipeControl = PIPE_CONTROL::sInit();
pipeControl->setCommandStreamerStallEnable(true);
auto pCmd = pCommandStream->getSpaceForCmd<MI_LOAD_REGISTER_IMM>();
*pCmd = MI_LOAD_REGISTER_IMM::sInit();
pCmd->setRegisterOffset(RowChickenReg4::address);
pCmd->setDataDword(RowChickenReg4::regDataForArbitrationPolicy[requiredThreadArbitrationPolicy]);
}
template <>
size_t PreambleHelper<CNLFamily>::getThreadArbitrationCommandsSize() {
return sizeof(MI_LOAD_REGISTER_IMM) + sizeof(PIPE_CONTROL);
}
template <>
size_t PreambleHelper<CNLFamily>::getAdditionalCommandsSize(const Device &device) {
typedef typename CNLFamily::MI_LOAD_REGISTER_REG MI_LOAD_REGISTER_REG;
typedef typename CNLFamily::PIPE_CONTROL PIPE_CONTROL;
typedef typename CNLFamily::MI_MATH MI_MATH;
typedef typename CNLFamily::MI_MATH_ALU_INST_INLINE MI_MATH_ALU_INST_INLINE;
size_t size = PreemptionHelper::getRequiredPreambleSize<CNLFamily>(device) + sizeof(MI_LOAD_REGISTER_IMM);
size += getKernelDebuggingCommandsSize(device.isSourceLevelDebuggerActive());
return size;
}
template <>
void PreambleHelper<CNLFamily>::programGenSpecificPreambleWorkArounds(LinearStream *pCommandStream, const HardwareInfo &hwInfo) {
typedef typename CNLFamily::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
auto pCmd = reinterpret_cast<MI_LOAD_REGISTER_IMM *>(pCommandStream->getSpace(sizeof(MI_LOAD_REGISTER_IMM)));
*pCmd = MI_LOAD_REGISTER_IMM::sInit();
pCmd->setRegisterOffset(FfSliceCsChknReg2::address);
pCmd->setDataDword(FfSliceCsChknReg2::regVal);
}
template <>
uint32_t PreambleHelper<CNLFamily>::getUrbEntryAllocationSize() {
return 1024;
}
template <>
void PreambleHelper<CNLFamily>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo) {
auto pipeControl = pCommandStream->getSpaceForCmd<PIPE_CONTROL>();
*pipeControl = PIPE_CONTROL::sInit();
pipeControl->setCommandStreamerStallEnable(true);
if (hwInfo->pWaTable->waSendMIFLUSHBeforeVFE) {
pipeControl->setRenderTargetCacheFlushEnable(true);
pipeControl->setDepthCacheFlushEnable(true);
pipeControl->setDcFlushEnable(true);
}
}
template <>
void PreambleHelper<CNLFamily>::programPipelineSelect(LinearStream *pCommandStream, bool mediaSamplerRequired) {
typedef typename CNLFamily::PIPELINE_SELECT PIPELINE_SELECT;
auto pCmd = (PIPELINE_SELECT *)pCommandStream->getSpace(sizeof(PIPELINE_SELECT));
*pCmd = PIPELINE_SELECT::sInit();
auto mask = pipelineSelectEnablePipelineSelectMaskBits | pipelineSelectMediaSamplerDopClockGateMaskBits;
pCmd->setMaskBits(mask);
pCmd->setPipelineSelection(PIPELINE_SELECT::PIPELINE_SELECTION_GPGPU);
pCmd->setMediaSamplerDopClockGateEnable(!mediaSamplerRequired);
}
template struct PreambleHelper<CNLFamily>;
} // namespace OCLRT

View File

@ -0,0 +1,73 @@
/*
* 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/built_ins/built_ins.h"
#include "runtime/command_stream/preemption.h"
#include "runtime/command_stream/preemption.inl"
#include "runtime/memory_manager/graphics_allocation.h"
namespace OCLRT {
typedef CNLFamily GfxFamily;
template <>
struct PreemptionConfig<GfxFamily> {
static constexpr uint32_t mmioAddress = 0x2580;
static constexpr uint32_t maskVal = (1 << 1) | (1 << 2);
static constexpr uint32_t maskShift = 16;
static constexpr uint32_t mask = maskVal << maskShift;
static constexpr uint32_t threadGroupVal = (1 << 1);
static constexpr uint32_t cmdLevelVal = (1 << 2);
static constexpr uint32_t midThreadVal = 0;
};
template <>
size_t PreemptionHelper::getPreemptionWaCsSize<GfxFamily>(const Device &device) {
return 0;
}
template <>
void PreemptionHelper::applyPreemptionWaCmdsBegin<GfxFamily>(LinearStream *pCommandStream, const Device &device) {
}
template <>
void PreemptionHelper::applyPreemptionWaCmdsEnd<GfxFamily>(LinearStream *pCommandStream, const Device &device) {
}
template void PreemptionHelper::programCmdStream<GfxFamily>(LinearStream &cmdStream,
PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode,
GraphicsAllocation *preemptionCsr, Device &device);
template void PreemptionHelper::programPreamble<GfxFamily>(LinearStream &preambleCmdStream, Device &device, const GraphicsAllocation *preemptionCsr);
template size_t PreemptionHelper::getRequiredPreambleSize<GfxFamily>(const Device &device);
template size_t PreemptionHelper::getRequiredCmdStreamSize<GfxFamily>(PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode);
template <>
void PreemptionHelper::programInterfaceDescriptorDataPreemption<GfxFamily>(INTERFACE_DESCRIPTOR_DATA<GfxFamily> *idd, PreemptionMode preemptionMode) {
using INTERFACE_DESCRIPTOR_DATA = typename GfxFamily::INTERFACE_DESCRIPTOR_DATA;
if (preemptionMode == PreemptionMode::MidThread) {
idd->setThreadPreemptionDisable(INTERFACE_DESCRIPTOR_DATA::THREAD_PREEMPTION_DISABLE_DISABLE);
} else {
idd->setThreadPreemptionDisable(INTERFACE_DESCRIPTOR_DATA::THREAD_PREEMPTION_DISABLE_ENABLE);
}
}
} // namespace OCLRT

View File

@ -0,0 +1,42 @@
/*
* 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.
*/
#pragma once
#include "runtime/helpers/preamble.h"
namespace OCLRT {
struct CNLFamily;
template <>
struct L3CNTLREGConfig<IGFX_CANNONLAKE> {
static const uint32_t valueForSLM = 0xA0000121u;
static const uint32_t valueForNoSLM = 0xc0000140u;
};
template <>
struct L3CNTLRegisterOffset<CNLFamily> {
static const uint32_t registerOffset = 0x7034;
};
const uint32_t gen10HdcModeRegisterAddresss = 0xE5F0;
} // namespace OCLRT

View File

@ -0,0 +1,33 @@
/*
* 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 "hw_cmds.h"
#include "runtime/sampler/sampler.h"
#include "runtime/sampler/sampler.inl"
namespace OCLRT {
typedef CNLFamily Family;
static auto gfxCore = IGFX_GEN10_CORE;
#include "runtime/sampler/sampler_factory_init.inl"
} // namespace OCLRT

View File

@ -0,0 +1,42 @@
/*
* 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/scheduler/scheduler_binary.h"
namespace OCLRT {
#include "scheduler_igdrcl_built_in_cnl.h"
const auto gfxProductCnl = PRODUCT_FAMILY::IGFX_CANNONLAKE;
template <>
void populateSchedulerBinaryInfos<gfxProductCnl>() {
schedulerBinaryInfos[gfxProductCnl] = {schedulerBinary_cnl, schedulerBinarySize_cnl};
}
struct EnableGen10Scheduler {
EnableGen10Scheduler() {
populateSchedulerBinaryInfos<gfxProductCnl>();
}
};
static EnableGen10Scheduler enableGen10Scheduler;
} // namespace OCLRT

View File

@ -0,0 +1,162 @@
/*
* 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.
*/
#define SCHEDULER_COMPILATION_SIZE 8
#define SIZEOF_INTERFACE_DESCRIPTOR_DATA_G10 32
#define NUMBER_OF_INERFACE_DESCRIPTORS 64
#define IDT_BREAKDOWN (NUMBER_OF_INERFACE_DESCRIPTORS - 2)
#define MAX_WKG_SIZE 448
#define INTERFACE_DESCRIPTOR_TABLE_SIZE_G10 (NUMBER_OF_INERFACE_DESCRIPTORS * SIZEOF_INTERFACE_DESCRIPTOR_DATA_G10)
#define SIZEOF_COLOR_CALCULATOR_STATE_G10 0xC0
#define INTERFACE_DESCRIPTOR_TABLE_START_ADDRESS_G10 SIZEOF_COLOR_CALCULATOR_STATE_G10
#define OCLRT_SIZEOF_SAMPLER_STATE_G10 (16)
#define SIZEOF_COLOR_CALCULATOR_STATE SIZEOF_COLOR_CALCULATOR_STATE_G10
#define SIZEOF_INTERFACE_DESCRIPTOR_DATA SIZEOF_INTERFACE_DESCRIPTOR_DATA_G10
#define INTERFACE_DESCRIPTOR_TABLE_SIZE INTERFACE_DESCRIPTOR_TABLE_SIZE_G10
#define INTERFACE_DESCRIPTOR_TABLE_START_ADDRESS INTERFACE_DESCRIPTOR_TABLE_START_ADDRESS_G10
#define OCLRT_SIZEOF_SAMPLER_STATE OCLRT_SIZEOF_SAMPLER_STATE_G10
#define SECOND_LEVEL_BUFFER_SPACE_FOR_EACH_ENQUEUE (SECOND_LEVEL_BUFFER_SPACE_FOR_EACH_ENQUEUE_GEN10)
#define SECOND_LEVEL_BUFFER_NUMBER_OF_ENQUEUES (SECOND_LEVEL_BUFFER_NUMBER_OF_ENQUEUES_GEN10)
#define OCLRT_MEDIA_VFE_STATE_OFFSET (0)
//address is QWORD in size and starts on DWORD 1
#define MEDIA_VFE_STATE_ADDRESS_OFFSET (OCLRT_MEDIA_VFE_STATE_OFFSET + 1)
// DWORD OFFSET
#define MEDIA_STATE_FLUSH_INITIAL_OFFSET 0
//bits 0-5 of 1st DWORD
#define MEDIA_STATE_FLUSH_INITIAL_INTERFACE_DESCRIPTOR_OFFSET (MEDIA_STATE_FLUSH_INITIAL_OFFSET + 1)
#define MI_ARB_CHECK_AFTER_MEDIA_STATE_FLUSH_INITIAL_OFFSET 0
#define MI_ATOMIC_CMD_OFFSET 0
#define MEDIA_INTERFACE_DESCRIPTOR_LOAD_OFFSET (MEDIA_STATE_FLUSH_INITIAL_OFFSET + OCLRT_SIZEOF_MSFLUSH_DWORD)
// DWORD OFFSET of InterfaceDescriptor Length
// bits 0 - 16
#define MEDIA_INTERFACE_DESCRIPTOR_LOAD_INTERFACEDESCRIPTORLENGTH_OFFSET (MEDIA_INTERFACE_DESCRIPTOR_LOAD_OFFSET + 2)
// DWORD OFFSET of Interface Descriptor Start Address
#define MEDIA_INTERFACE_DESCRIPTOR_LOAD_INTERFACEDESCRIPTORSTARTADDRESS_OFFSET (MEDIA_INTERFACE_DESCRIPTOR_LOAD_OFFSET + 3)
#define PIPE_CONTROL_FOR_TIMESTAMP_START_OFFSET (MEDIA_INTERFACE_DESCRIPTOR_LOAD_OFFSET + OCLRT_SIZEOF_MEDIA_INTERFACE_DESCRIPTOR_LOAD_DEVICE_CMD_DWORD_OFFSET)
#define INTERFACE_DESCRIPTOR_SAMPLER_STATE_TABLE_DWORD 3
#define INTERFACE_DESCRIPTOR_BINDING_TABLE_POINTER_DWORD 4
#define INTERFACE_DESCRIPTOR_CONSTANT_URB_ENTRY_READ_OFFSET 5
#define INTERFACE_DESCRIPTOR_HWTHREADS_NUMBER_DWORD 6
#define INTERFACE_DESCRIPTOR_SLMSIZE_DWORD 6
#define INTERFACE_DESCRIPTOR_HWTHREADS_UPPER_BIT 9
#define SAMPLER_STATE_INDIRECT_STATE_MASK (0x7FFFFC0)
#define SAMPLER_STATE_BORDER_COLOR_MASK (0xFFFFFFE0)
#define SAMPLER_STATE_DESCRIPTOR_BORDER_COLOR_POINTER_DWORD 2
#define GPGPU_WALKER_OFFSET (PIPE_CONTROL_FOR_TIMESTAMP_START_OFFSET + OCLRT_PIPE_CONTROL_CMD_DEVICE_CMD_G10_DWORD_OFFSET)
// DWORD OFFSET of the Interface Descriptor Offset for GPGPU_WALKER
// bits 0 - 5
#define GPGPU_WALKER_INTERFACE_DESCRIPTOR_ID_OFFSET (GPGPU_WALKER_OFFSET + 1)
// DWORD OFFSET of the Indirect data length Offset for GPGPU_WALKER
// bits 0 - 16
#define GPGPU_WALKER_INDIRECT_DATA_LENGTH_OFFSET (GPGPU_WALKER_OFFSET + 2)
// DWORD OFFSET of the Indirect Start Address for GPGPU_WALKER
#define GPGPU_WALKER_INDIRECT_START_ADDRESS_OFFSET (GPGPU_WALKER_OFFSET + 3)
// DWORD OFFSET of the Thread Width Counter Maximum for GPGPU_WALKER
// bits 0 - 5
#define GPGPU_WALKER_THREAD_WIDTH_DWORD (GPGPU_WALKER_OFFSET + 4)
// DWORD OFFSET of the Thread Height Counter Maximum for GPGPU_WALKER
// bits 8 - 13
#define GPGPU_WALKER_THREAD_HEIGHT_DWORD (GPGPU_WALKER_OFFSET + 4)
// DWORD OFFSET of the Thread Depth Counter Maximum for GPGPU_WALKER
// bits 16 - 21
#define GPGPU_WALKER_THREAD_DEPTH_DWORD (GPGPU_WALKER_OFFSET + 4)
// DWORD OFFSET of the SIMD Size for GPGPU_WALKER
// bits 30 - 31
#define GPGPU_WALKER_SIMDSIZE_DWORD (GPGPU_WALKER_OFFSET + 4)
// DWORD OFFSET of the Starting in X pos for GPGPU_WALKER
//bits 0 - 31
#define GPGPU_WALKER_GROUP_ID_START_X (GPGPU_WALKER_OFFSET + 5)
// DWORD OFFSET of the X Dimension for GPGPU_WALKER
#define GPGPU_WALKER_XDIM_DWORD (GPGPU_WALKER_OFFSET + 7)
// DWORD OFFSET of the Starting in Y pos for GPGPU_WALKER
//bits 0 - 31
#define GPGPU_WALKER_GROUP_ID_START_Y (GPGPU_WALKER_OFFSET + 8)
// DWORD OFFSET of the Y Dimension for GPGPU_WALKER
#define GPGPU_WALKER_YDIM_DWORD (GPGPU_WALKER_OFFSET + 10)
// DWORD OFFSET of the Starting in Z pos for GPGPU_WALKER
//bits 0 - 31
#define GPGPU_WALKER_GROUP_ID_START_Z (GPGPU_WALKER_OFFSET + 11)
// DWORD OFFSET of the X Dimension for GPGPU_WALKER
#define GPGPU_WALKER_ZDIM_DWORD (GPGPU_WALKER_OFFSET + 12)
// DWORD OFFSET of the Right or X Mask for GPGPU_WALKER
#define GPGPU_WALKER_XMASK_DWORD (GPGPU_WALKER_OFFSET + 13)
// DWORD OFFSET of the Bottom or Y Mask for GPGPU_WALKER
#define GPGPU_WALKER_YMASK_DWORD (GPGPU_WALKER_OFFSET + 14)
#define MEDIA_STATE_FLUSH_OFFSET (GPGPU_WALKER_OFFSET + OCLRT_GPGPU_WALKER_CMD_DEVICE_CMD_G10_DWORD_OFFSET)
//bits 0-5 of 1st DWORD of M_S_F command
#define MEDIA_STATE_FLUSH_INTERFACE_DESCRIPTOR_OFFSET (MEDIA_STATE_FLUSH_OFFSET + 1)
#define PIPE_CONTROL_FOR_TIMESTAMP_END_OFFSET (MEDIA_STATE_FLUSH_OFFSET + OCLRT_SIZEOF_MSFLUSH_DWORD)
#define PIPE_CONTROL_FOR_TIMESTAMP_END_OFFSET_TO_PATCH (PIPE_CONTROL_FOR_TIMESTAMP_END_OFFSET)
#define PIPE_CONTROL_POST_SYNC_DWORD 1
#define PIPE_CONTROL_POST_SYNC_START_BIT 14
#define PIPE_CONTROL_POST_SYNC_END_BIT 15
#define PIPE_CONTROL_GENERATE_TIME_STAMP 3
#define PIPE_CONTROL_NO_POSTSYNC_OPERATION 0
#define PIPE_CONTROL_ADDRESS_FIELD_DWORD 2
#define PIPE_CONTROL_PROFILING_START_TIMESTAMP_ADDRESS_OFFSET (PIPE_CONTROL_FOR_TIMESTAMP_START_OFFSET + PIPE_CONTROL_ADDRESS_FIELD_DWORD) //DWORD 2
#define PIPE_CONTROL_GRAPHICS_ADDRESS_START_BIT 2
#define PIPE_CONTROL_GRAPHICS_ADDRESS_END_BIT 31
#define PIPE_CONTROL_GRAPHICS_ADDRESS_HIGH_START_BIT 0
#define PIPE_CONTROL_GRAPHICS_ADDRESS_HIGH_END_BIT 15
#define PIPE_CONTROL_TIME_STAMP_DWORD0 0x7A000004
#define PIPE_CONTROL_TIME_STAMP_DWORD1 0x0010C4A4
#define PIPE_CONTROL_CSTALL_DWORD0 0x7A000004
#define PIPE_CONTROL_CSTALL_DWORD1 0x001004A4
#define PIPE_CONTROL_TAG_WRITE_DWORD0 0x7A000004
#define PIPE_CONTROL_TAG_WRITE_DWORD1 0x001044A4
// the value of g_cInitMiBatchBufferStartCmdG10 DWORD0
#define OCLRT_BATCH_BUFFER_BEGIN_CMD_DWORD0 (0x18800101)
#if defined WA_LRI_COMMANDS_EXIST
#define IMM_LOAD_REGISTER_FOR_ENABLE_PREEMPTION_OFFSET (PIPE_CONTROL_FOR_TIMESTAMP_END_OFFSET + OCLRT_PIPE_CONTROL_CMD_DEVICE_CMD_G10_DWORD_OFFSET + OCLRT_PIPE_CONTROL_CMD_DEVICE_CMD_G10_DWORD_OFFSET)
#endif
#define OCLRT_LOAD_REGISTER_IMM_CMD 0x11000001
#define CTXT_PREMP_DBG_ADDRESS_VALUE 0x2248
#define CTXT_PREMP_ON_MI_ARB_CHECK_ONLY 0x00000100
#define CTXT_PREMP_DEFAULT_VALUE 0x0
#define IMM_LOAD_REGISTER_ADDRESS_DWORD_OFFSET 1
#define IMM_LOAD_REGISTER_VALUE_DWORD_OFFSET 2

View File

@ -0,0 +1,106 @@
/*
* 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.
*/
uint GetPatchValueForSLMSize(uint slMsize) {
//todo: veryfy this optimization :
//return ( SLMSize == 0 ) ? 0 : max( 33 - clz( ( SLMSize - 1 ) >> 10 ), 7 );
uint PatchValue = 0;
if (slMsize == 0) {
PatchValue = 0;
} else if (slMsize <= (1 * 1024)) {
PatchValue = 1;
} else if (slMsize <= (2 * 1024)) {
PatchValue = 2;
} else if (slMsize <= (4 * 1024)) {
PatchValue = 3;
} else if (slMsize <= (8 * 1024)) {
PatchValue = 4;
} else if (slMsize <= (16 * 1024)) {
PatchValue = 5;
} else if (slMsize <= (32 * 1024)) {
PatchValue = 6;
} else if (slMsize <= (64 * 1024)) {
PatchValue = 7;
}
return PatchValue;
}
//on SKL we have pipe control in pairs, therefore when we NOOP we need to do this for both pipe controls
void NOOPCSStallPipeControl(__global uint *secondaryBatchBuffer, uint dwordOffset, uint pipeControlOffset) {
dwordOffset += pipeControlOffset;
secondaryBatchBuffer[dwordOffset] = 0;
dwordOffset++;
secondaryBatchBuffer[dwordOffset] = 0;
dwordOffset++;
secondaryBatchBuffer[dwordOffset] = 0;
dwordOffset++;
secondaryBatchBuffer[dwordOffset] = 0;
dwordOffset++;
secondaryBatchBuffer[dwordOffset] = 0;
dwordOffset++;
secondaryBatchBuffer[dwordOffset] = 0;
dwordOffset++;
secondaryBatchBuffer[dwordOffset] = 0;
dwordOffset++;
secondaryBatchBuffer[dwordOffset] = 0;
dwordOffset++;
secondaryBatchBuffer[dwordOffset] = 0;
dwordOffset++;
secondaryBatchBuffer[dwordOffset] = 0;
dwordOffset++;
secondaryBatchBuffer[dwordOffset] = 0;
dwordOffset++;
secondaryBatchBuffer[dwordOffset] = 0;
dwordOffset++;
}
//on SKL+ with mid thread preemption we need to have 2 pipe controls instead of 1 any time we do post sync operation
void PutCSStallPipeControl(__global uint *secondaryBatchBuffer, uint dwordOffset, uint pipeControlOffset) {
dwordOffset += pipeControlOffset;
//first pipe control doing CS stall
secondaryBatchBuffer[dwordOffset] = PIPE_CONTROL_CSTALL_DWORD0;
dwordOffset++;
secondaryBatchBuffer[dwordOffset] = PIPE_CONTROL_CSTALL_DWORD1;
dwordOffset++;
secondaryBatchBuffer[dwordOffset] = 0;
dwordOffset++;
secondaryBatchBuffer[dwordOffset] = 0;
dwordOffset++;
secondaryBatchBuffer[dwordOffset] = 0;
dwordOffset++;
secondaryBatchBuffer[dwordOffset] = 0;
dwordOffset++;
//second pipe control , doing actual timestamp write
secondaryBatchBuffer[dwordOffset] = PIPE_CONTROL_CSTALL_DWORD0;
dwordOffset++;
secondaryBatchBuffer[dwordOffset] = PIPE_CONTROL_CSTALL_DWORD1;
dwordOffset++;
secondaryBatchBuffer[dwordOffset] = 0;
dwordOffset++;
secondaryBatchBuffer[dwordOffset] = 0;
dwordOffset++;
secondaryBatchBuffer[dwordOffset] = 0;
dwordOffset++;
secondaryBatchBuffer[dwordOffset] = 0;
dwordOffset++;
}

View File

@ -0,0 +1,28 @@
/*
* 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/helpers/state_base_address.h"
#include "runtime/helpers/state_base_address.inl"
namespace OCLRT {
template struct StateBaseAddressHelper<CNLFamily>;
}

View File

@ -0,0 +1,43 @@
/*
* 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 "hw_cmds.h"
#include "runtime/command_stream/tbx_command_stream_receiver_hw.h"
#include "runtime/command_stream/tbx_command_stream_receiver_hw.inl"
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.inl"
#include "runtime/helpers/base_object.h"
#include "runtime/helpers/array_count.h"
namespace OCLRT {
typedef CNLFamily Family;
static auto gfxCore = IGFX_GEN10_CORE;
template <>
void populateFactoryTable<TbxCommandStreamReceiverHw<Family>>() {
extern TbxCommandStreamReceiverCreateFunc tbxCommandStreamReceiverFactory[IGFX_MAX_CORE];
UNRECOVERABLE_IF(!isInRange(gfxCore, tbxCommandStreamReceiverFactory));
tbxCommandStreamReceiverFactory[gfxCore] = TbxCommandStreamReceiverHw<Family>::create;
}
template class TbxCommandStreamReceiverHw<Family>;
template class CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<Family>>;
} // namespace OCLRT

View File

@ -0,0 +1,32 @@
/*
* 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/os_interface/windows/device_command_stream.inl"
#include "runtime/os_interface/windows/wddm_device_command_stream.inl"
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.inl"
namespace OCLRT {
template class DeviceCommandStreamReceiver<CNLFamily>;
template class WddmCommandStreamReceiver<CNLFamily>;
template class CommandStreamReceiverWithAUBDump<WddmCommandStreamReceiver<CNLFamily>>;
} // namespace OCLRT

View File

@ -0,0 +1,38 @@
/*
* 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/helpers/hw_info.h"
#include "runtime/os_interface/hw_info_config.h"
#include "runtime/os_interface/hw_info_config.inl"
namespace OCLRT {
#ifdef SUPPORT_CNL
template <>
int HwInfoConfigHw<IGFX_CANNONLAKE>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
return 0;
}
template class HwInfoConfigHw<IGFX_CANNONLAKE>;
#endif
} // namespace OCLRT

View File

@ -0,0 +1,29 @@
/*
* 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 "hw_cmds.h"
#include "runtime/helpers/translationtable_callbacks.h"
#include "runtime/helpers/translationtable_callbacks.inl"
using namespace OCLRT;
template struct TTCallbacks<CNLFamily>;

View File

@ -0,0 +1,38 @@
/*
* 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 "hw_cmds.h"
#include "runtime/os_interface/windows/wddm/wddm.h"
#include "runtime/os_interface/windows/wddm/wddm.inl"
#include "runtime/os_interface/windows/wddm_engine_mapper.h"
#include "runtime/os_interface/windows/wddm_engine_mapper.inl"
namespace OCLRT {
typedef CNLFamily Family;
template bool Wddm::configureDeviceAddressSpace<Family>();
template bool Wddm::init<Family>();
template class WddmEngineMapper<CNLFamily>;
} // namespace OCLRT

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Intel Corporation
* 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"),
@ -27,3 +27,6 @@
#ifdef SUPPORT_GEN9
#include "runtime/gen9/aub_mapper.h"
#endif
#ifdef SUPPORT_GEN10
#include "runtime/gen10/aub_mapper.h"
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Intel Corporation
* 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"),
@ -26,4 +26,7 @@
#endif
#ifdef SUPPORT_GEN9
#include "runtime/gen9/hw_cmds.h"
#endif
#endif
#ifdef SUPPORT_GEN10
#include "runtime/gen10/hw_cmds.h"
#endif

View File

@ -27,3 +27,29 @@
#ifdef SUPPORT_GEN9
#include "runtime/gen9/reg_configs.h"
#endif
#ifdef SUPPORT_GEN10
#include "runtime/gen10/reg_configs.h"
#endif
namespace OCLRT {
namespace ThreadArbitrationPolicy {
const uint32_t RoundRobinAfterDependency = 2;
}
namespace RowChickenReg4 {
const uint32_t address = 0xE48C;
const uint32_t regDataForArbitrationPolicy[3] = {
0xC0000, // Age Based
0xC0004, // Round Robin
0xC0008, // Round Robin after dependency
};
} // namespace RowChickenReg4
namespace FfSliceCsChknReg2 {
constexpr uint32_t address = 0x20E4;
constexpr uint32_t regUpdate = (1 << 5);
constexpr uint32_t maskShift = 16;
constexpr uint32_t maskUpdate = regUpdate << maskShift;
constexpr uint32_t regVal = regUpdate | maskUpdate;
} // namespace FfSliceCsChknReg2
} // namespace OCLRT

View File

@ -0,0 +1,27 @@
# 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.
if(TESTS_GEN10)
target_sources(igdrcl_aub_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/aub_tests_configuration.cpp
)
add_subdirectories()
endif()

View File

@ -0,0 +1,28 @@
/*
* 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 "unit_tests/aub_tests/aub_tests_configuration.inl"
#include "runtime/gen_common/hw_cmds.h"
using namespace OCLRT;
template AubTestsConfig GetAubTestsConfig<CNLFamily>();

View File

@ -0,0 +1,25 @@
# 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.
target_sources(igdrcl_aub_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/aub_batch_buffer_tests_gen10.h
${CMAKE_CURRENT_SOURCE_DIR}/aub_batch_buffer_tests_gen10.cpp
)

View File

@ -0,0 +1,32 @@
/*
* 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 "aub_batch_buffer_tests_gen10.h"
#include "unit_tests/fixtures/device_fixture.h"
typedef Test<DeviceFixture> Gen10AubBatchBufferTests;
static constexpr auto gpuBatchBufferAddr = 0x800400001000; // 48-bit GPU address
GEN10TEST_F(Gen10AubBatchBufferTests, givenSimpleRCSWithBatchBufferWhenItHasMSBSetInGpuAddressThenAUBShouldBeSetupSuccessfully) {
setupAUBWithBatchBuffer<FamilyType>(pDevice, OCLRT::EngineType::ENGINE_RCS, gpuBatchBufferAddr);
}

View File

@ -0,0 +1,169 @@
/*
* 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.
*/
#pragma once
#include "unit_tests/aub_tests/command_stream/aub_mem_dump_tests.h"
template <typename FamilyType>
void setupAUBWithBatchBuffer(const OCLRT::Device *pDevice, OCLRT::EngineType engineType, uint64_t gpuBatchBufferAddr) {
typedef typename OCLRT::AUBFamilyMapper<FamilyType>::AUB AUB;
const auto &csTraits = OCLRT::AUBCommandStreamReceiverHw<FamilyType>::getCsTraits(engineType);
auto mmioBase = csTraits.mmioBase;
uint64_t physAddress = 0x10000;
OCLRT::AUBCommandStreamReceiver::AubFileStream aubFile;
std::string filePath(OCLRT::folderAUB);
filePath.append(Os::fileSeparator);
std::string baseName("simple");
baseName.append(csTraits.name);
baseName.append("WithBatchBuffer");
baseName.append(".aub");
filePath.append(getAubFileName(pDevice, baseName));
aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary);
// Header
aubFile.init(AubMemDump::SteppingValues::A, AUB::Traits::device);
aubFile.writeMMIO(mmioBase + 0x229c, 0xffff8280);
const size_t sizeHWSP = 0x1000;
const size_t alignHWSP = 0x1000;
auto pGlobalHWStatusPage = alignedMalloc(sizeHWSP, alignHWSP);
uint32_t ggttGlobalHardwareStatusPage = (uint32_t)((uintptr_t)pGlobalHWStatusPage);
AubGTTData data = {true, false};
AUB::reserveAddressGGTT(aubFile, ggttGlobalHardwareStatusPage, sizeHWSP, physAddress, data);
physAddress += sizeHWSP;
aubFile.writeMMIO(mmioBase + 0x2080, ggttGlobalHardwareStatusPage);
using MI_NOOP = typename FamilyType::MI_NOOP;
using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END;
// create a user mode batch buffer
auto physBatchBuffer = physAddress;
const auto sizeBatchBuffer = 0x1000;
auto gpuBatchBuffer = static_cast<uintptr_t>(gpuBatchBufferAddr);
physAddress += sizeBatchBuffer;
AUB::reserveAddressPPGTT(aubFile, gpuBatchBuffer, sizeBatchBuffer, physBatchBuffer, 7);
uint8_t batchBuffer[sizeBatchBuffer];
auto noop = MI_NOOP::sInit();
uint32_t noopId = 0xbaadd;
{
auto pBatchBuffer = (void *)batchBuffer;
*(MI_NOOP *)pBatchBuffer = noop;
pBatchBuffer = ptrOffset(pBatchBuffer, sizeof(MI_NOOP));
*(MI_NOOP *)pBatchBuffer = noop;
pBatchBuffer = ptrOffset(pBatchBuffer, sizeof(MI_NOOP));
*(MI_NOOP *)pBatchBuffer = noop;
pBatchBuffer = ptrOffset(pBatchBuffer, sizeof(MI_NOOP));
noop.TheStructure.Common.IdentificationNumberRegisterWriteEnable = true;
noop.TheStructure.Common.IdentificationNumber = noopId++;
*(MI_NOOP *)pBatchBuffer = noop;
pBatchBuffer = ptrOffset(pBatchBuffer, sizeof(MI_NOOP));
*(MI_BATCH_BUFFER_END *)pBatchBuffer = MI_BATCH_BUFFER_END::sInit();
pBatchBuffer = ptrOffset(pBatchBuffer, sizeof(MI_BATCH_BUFFER_END));
auto sizeBufferUsed = ptrDiff(pBatchBuffer, batchBuffer);
AUB::addMemoryWrite(aubFile, physBatchBuffer, batchBuffer, sizeBufferUsed, AubMemDump::AddressSpaceValues::TraceNonlocal, AubMemDump::DataTypeHintValues::TraceBatchBuffer);
}
const size_t sizeRing = 0x4 * 0x1000;
const size_t alignRing = 0x1000;
size_t sizeCommands = 0;
auto pRing = alignedMalloc(sizeRing, alignRing);
auto ggttRing = (uint32_t)(uintptr_t)pRing;
auto physRing = physAddress;
physAddress += sizeRing;
auto rRing = AUB::reserveAddressGGTT(aubFile, ggttRing, sizeRing, physRing, data);
ASSERT_NE(static_cast<uint64_t>(-1), rRing);
EXPECT_EQ(rRing, physRing);
auto cur = (uint32_t *)pRing;
auto bbs = MI_BATCH_BUFFER_START::sInit();
bbs.setBatchBufferStartAddressGraphicsaddress472(gpuBatchBuffer);
bbs.setAddressSpaceIndicator(MI_BATCH_BUFFER_START::ADDRESS_SPACE_INDICATOR_PPGTT);
*(MI_BATCH_BUFFER_START *)cur = bbs;
cur = ptrOffset(cur, sizeof(MI_BATCH_BUFFER_START));
noop.TheStructure.Common.IdentificationNumberRegisterWriteEnable = true;
noop.TheStructure.Common.IdentificationNumber = noopId;
*cur++ = noop.TheStructure.RawData[0];
sizeCommands = ptrDiff(cur, pRing);
AUB::addMemoryWrite(aubFile, physRing, pRing, sizeCommands, AubMemDump::AddressSpaceValues::TraceNonlocal, csTraits.aubHintCommandBuffer);
auto sizeLRCA = csTraits.sizeLRCA;
auto pLRCABase = alignedMalloc(csTraits.sizeLRCA, csTraits.alignLRCA);
csTraits.initialize(pLRCABase);
csTraits.setRingHead(pLRCABase, 0x0000);
csTraits.setRingTail(pLRCABase, static_cast<uint32_t>(sizeCommands));
csTraits.setRingBase(pLRCABase, ggttRing);
auto ringCtrl = static_cast<uint32_t>((sizeRing - 0x1000) | 1);
csTraits.setRingCtrl(pLRCABase, ringCtrl);
auto ggttLRCA = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(pLRCABase));
auto physLRCA = physAddress;
physAddress += sizeLRCA;
AUB::reserveAddressGGTT(aubFile, ggttLRCA, sizeLRCA, physLRCA, data);
AUB::addMemoryWrite(aubFile, physLRCA, pLRCABase, sizeLRCA, AubMemDump::AddressSpaceValues::TraceNonlocal, csTraits.aubHintLRCA);
typename AUB::MiContextDescriptorReg contextDescriptor = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
contextDescriptor.sData.Valid = true;
contextDescriptor.sData.ForcePageDirRestore = false;
contextDescriptor.sData.ForceRestore = false;
contextDescriptor.sData.Legacy = true;
contextDescriptor.sData.FaultSupport = 0;
contextDescriptor.sData.PrivilegeAccessOrPPGTT = true;
contextDescriptor.sData.ADor64bitSupport = AUB::Traits::addressingBits > 32;
contextDescriptor.sData.LogicalRingCtxAddress = (uintptr_t)pLRCABase / 4096;
contextDescriptor.sData.ContextID = 0;
// Submit our exec-list
aubFile.writeMMIO(mmioBase + 0x2230, 0);
aubFile.writeMMIO(mmioBase + 0x2230, 0);
aubFile.writeMMIO(mmioBase + 0x2230, contextDescriptor.ulData[1]);
aubFile.writeMMIO(mmioBase + 0x2230, contextDescriptor.ulData[0]);
// Poll until HW complete
using AubMemDump::CmdServicesMemTraceRegisterPoll;
aubFile.registerPoll(
mmioBase + 0x2234, //EXECLIST_STATUS
0x100,
0x100,
false,
CmdServicesMemTraceRegisterPoll::TimeoutActionValues::Abort);
alignedFree(pRing);
alignedFree(pLRCABase);
alignedFree(pGlobalHWStatusPage);
aubFile.fileHandle.close();
}

View File

@ -0,0 +1,24 @@
# 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.
target_sources(igdrcl_aub_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/enqueue_parent_kernel_tests_gen10.cpp
)

View File

@ -0,0 +1,134 @@
/*
* 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/built_ins/built_ins.h"
#include "runtime/mem_obj/image.h"
#include "runtime/sampler/sampler.h"
#include "unit_tests/aub_tests/fixtures/aub_parent_kernel_fixture.h"
#include "unit_tests/fixtures/buffer_fixture.h"
#include "test.h"
using namespace OCLRT;
typedef AUBParentKernelFixture GEN10AUBParentKernelFixture;
GEN10TEST_F(GEN10AUBParentKernelFixture, DISABLED_EnqueueParentKernel) {
if (pDevice->getSupportedClVersion() >= 20) {
ASSERT_NE(nullptr, pKernel);
ASSERT_TRUE(pKernel->isParentKernel);
const cl_queue_properties properties[3] = {(CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE),
0, 0};
DeviceQueue *devQueue = DeviceQueue::create(
&pCmdQ->getContext(),
pDevice,
properties[0],
retVal);
BuiltIns &builtIns = BuiltIns::getInstance();
SchedulerKernel &scheduler = builtIns.getSchedulerKernel(pCmdQ->getContext());
// Aub execution takes huge time for bigger GWS
scheduler.setGws(24);
size_t offset[3] = {0, 0, 0};
size_t gws[3] = {1, 1, 1};
size_t lws[3] = {1, 1, 1};
// clang-format off
cl_image_format imageFormat;
imageFormat.image_channel_data_type = CL_UNSIGNED_INT8;
imageFormat.image_channel_order = CL_R;
cl_image_desc desc = { 0 };
desc.image_array_size = 0;
desc.image_depth = 1;
desc.image_height = 4;
desc.image_width = 4;
desc.image_type = CL_MEM_OBJECT_IMAGE3D;
desc.image_row_pitch = 0;
desc.image_slice_pitch = 0;
// clang-format on
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imageFormat);
Image *image = Image::create(
pContext,
0,
surfaceFormat,
&desc,
nullptr,
retVal);
Buffer *buffer = BufferHelper<BufferUseHostPtr<>>::create(pContext);
cl_mem bufferMem = buffer;
cl_mem imageMem = image;
auto sampler = Sampler::create(
pContext,
CL_TRUE,
CL_ADDRESS_NONE,
CL_FILTER_LINEAR,
retVal);
size_t argScalar = 2;
pKernel->setArg(
3,
sizeof(size_t),
&argScalar);
pKernel->setArg(
2,
sizeof(cl_mem),
&bufferMem);
pKernel->setArg(
1,
sizeof(cl_mem),
&imageMem);
pKernel->setArg(
0,
sizeof(cl_sampler),
&sampler);
pCmdQ->enqueueKernel(pKernel, 1, offset, gws, lws, 0, 0, 0);
pCmdQ->finish(false);
uint32_t expectedNumberOfEnqueues = 1;
IGIL_CommandQueue *igilQueue = reinterpret_cast<IGIL_CommandQueue *>(devQueue->getQueueBuffer()->getUnderlyingBuffer());
uint64_t gpuAddress = devQueue->getQueueBuffer()->getGpuAddress();
uint32_t *pointerTonumberOfEnqueues = &igilQueue->m_controls.m_TotalNumberOfQueues;
size_t offsetToEnqueues = ptrDiff(pointerTonumberOfEnqueues, igilQueue);
gpuAddress = gpuAddress + offsetToEnqueues;
AUBCommandStreamFixture::expectMemory<FamilyType>((void *)(uintptr_t)gpuAddress, &expectedNumberOfEnqueues, sizeof(uint32_t));
AUBCommandStreamFixture::expectMemory<FamilyType>((void *)(uintptr_t)buffer->getGraphicsAllocation()->getGpuAddress(), &argScalar, sizeof(size_t));
delete devQueue;
delete image;
delete buffer;
delete sampler;
}
}

View File

@ -0,0 +1,44 @@
# 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.
if(TESTS_GEN10)
set(IGDRCL_SRCS_tests_gen10
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/coherency_tests_gen10.cpp
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_hw_tests_gen10.cpp
${CMAKE_CURRENT_SOURCE_DIR}/enqueue_kernel_gen10.cpp
${CMAKE_CURRENT_SOURCE_DIR}/enqueue_media_kernel_gen10.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_gen10.cpp
${CMAKE_CURRENT_SOURCE_DIR}/image_tests_gen10.cpp
${CMAKE_CURRENT_SOURCE_DIR}/kernel_tests_gen10.cpp
${CMAKE_CURRENT_SOURCE_DIR}/l3_helper_gen10.cpp
${CMAKE_CURRENT_SOURCE_DIR}/preamble_tests_gen10.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sampler_tests_gen10.cpp
${CMAKE_CURRENT_SOURCE_DIR}/scheduler_source_tests_gen10.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_gen10.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_device_queue_hw_gen10.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_platform_caps_gen10.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_preamble_gen10.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_preemption_gen10.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_sample_gen10.cpp
)
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_gen10})
add_subdirectories()
endif()

View File

@ -0,0 +1,489 @@
/*
* 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 "unit_tests/gen_common/gen_cmd_parse.h"
#include "unit_tests/helpers/hw_parse.h"
#include "unit_tests/helpers/hw_parse.inl"
#include "gtest/gtest.h"
// clang-format off
using namespace OCLRT;
using GPGPU_WALKER = GEN10::GPGPU_WALKER;
using MEDIA_INTERFACE_DESCRIPTOR_LOAD = GEN10::MEDIA_INTERFACE_DESCRIPTOR_LOAD;
using MEDIA_STATE_FLUSH = GEN10::MEDIA_STATE_FLUSH;
using MEDIA_VFE_STATE = GEN10::MEDIA_VFE_STATE;
using MI_ARB_CHECK = GEN10::MI_ARB_CHECK;
using MI_ATOMIC = GEN10::MI_ATOMIC;
using MI_BATCH_BUFFER_END = GEN10::MI_BATCH_BUFFER_END;
using MI_BATCH_BUFFER_START = GEN10::MI_BATCH_BUFFER_START;
using MI_LOAD_REGISTER_IMM = GEN10::MI_LOAD_REGISTER_IMM;
using MI_LOAD_REGISTER_MEM = GEN10::MI_LOAD_REGISTER_MEM;
using MI_STORE_REGISTER_MEM = GEN10::MI_STORE_REGISTER_MEM;
using MI_NOOP = GEN10::MI_NOOP;
using PIPE_CONTROL = GEN10::PIPE_CONTROL;
using PIPELINE_SELECT = GEN10::PIPELINE_SELECT;
using STATE_BASE_ADDRESS = GEN10::STATE_BASE_ADDRESS;
using MI_REPORT_PERF_COUNT = GEN10::MI_REPORT_PERF_COUNT;
using MI_LOAD_REGISTER_REG = GEN10::MI_LOAD_REGISTER_REG;
using MI_MATH = GEN10::MI_MATH;
using GPGPU_CSR_BASE_ADDRESS = GEN10::GPGPU_CSR_BASE_ADDRESS;
using STATE_SIP = GEN10::STATE_SIP;
using MI_SEMAPHORE_WAIT = GEN10::MI_SEMAPHORE_WAIT;
// clang-format on
template <>
STATE_BASE_ADDRESS *genCmdCast<STATE_BASE_ADDRESS *>(void *buffer) {
auto pCmd = reinterpret_cast<STATE_BASE_ADDRESS *>(buffer);
return STATE_BASE_ADDRESS::COMMAND_TYPE_GFXPIPE == pCmd->TheStructure.Common.CommandType &&
STATE_BASE_ADDRESS::COMMAND_SUBTYPE_GFXPIPE_COMMON == pCmd->TheStructure.Common.CommandSubtype &&
STATE_BASE_ADDRESS::_3D_COMMAND_OPCODE_GFXPIPE_NONPIPELINED == pCmd->TheStructure.Common._3DCommandOpcode &&
STATE_BASE_ADDRESS::_3D_COMMAND_SUB_OPCODE_STATE_BASE_ADDRESS == pCmd->TheStructure.Common._3DCommandSubOpcode
? pCmd
: nullptr;
}
template <>
GPGPU_WALKER *genCmdCast<GPGPU_WALKER *>(void *buffer) {
auto pCmd = reinterpret_cast<GPGPU_WALKER *>(buffer);
return GPGPU_WALKER::COMMAND_TYPE_GFXPIPE == pCmd->TheStructure.Common.CommandType &&
GPGPU_WALKER::PIPELINE_MEDIA == pCmd->TheStructure.Common.Pipeline &&
GPGPU_WALKER::MEDIA_COMMAND_OPCODE_GPGPU_WALKER == pCmd->TheStructure.Common.MediaCommandOpcode &&
GPGPU_WALKER::SUBOPCODE_GPGPU_WALKER_SUBOP == pCmd->TheStructure.Common.Subopcode
? pCmd
: nullptr;
}
template <>
MEDIA_INTERFACE_DESCRIPTOR_LOAD *genCmdCast<MEDIA_INTERFACE_DESCRIPTOR_LOAD *>(void *buffer) {
auto pCmd = reinterpret_cast<MEDIA_INTERFACE_DESCRIPTOR_LOAD *>(buffer);
return MEDIA_INTERFACE_DESCRIPTOR_LOAD::COMMAND_TYPE_GFXPIPE == pCmd->TheStructure.Common.CommandType &&
MEDIA_INTERFACE_DESCRIPTOR_LOAD::PIPELINE_MEDIA == pCmd->TheStructure.Common.Pipeline &&
MEDIA_INTERFACE_DESCRIPTOR_LOAD::MEDIA_COMMAND_OPCODE_MEDIA_INTERFACE_DESCRIPTOR_LOAD == pCmd->TheStructure.Common.MediaCommandOpcode &&
MEDIA_INTERFACE_DESCRIPTOR_LOAD::SUBOPCODE_MEDIA_INTERFACE_DESCRIPTOR_LOAD_SUBOP == pCmd->TheStructure.Common.Subopcode
? pCmd
: nullptr;
}
template <>
MEDIA_VFE_STATE *genCmdCast<MEDIA_VFE_STATE *>(void *buffer) {
auto pCmd = reinterpret_cast<MEDIA_VFE_STATE *>(buffer);
return MEDIA_VFE_STATE::COMMAND_TYPE_GFXPIPE == pCmd->TheStructure.Common.CommandType &&
MEDIA_VFE_STATE::PIPELINE_MEDIA == pCmd->TheStructure.Common.Pipeline &&
MEDIA_VFE_STATE::MEDIA_COMMAND_OPCODE_MEDIA_VFE_STATE == pCmd->TheStructure.Common.MediaCommandOpcode &&
MEDIA_VFE_STATE::SUBOPCODE_MEDIA_VFE_STATE_SUBOP == pCmd->TheStructure.Common.Subopcode
? pCmd
: nullptr;
}
template <>
MEDIA_STATE_FLUSH *genCmdCast<MEDIA_STATE_FLUSH *>(void *buffer) {
auto pCmd = reinterpret_cast<MEDIA_STATE_FLUSH *>(buffer);
return MEDIA_STATE_FLUSH::COMMAND_TYPE_GFXPIPE == pCmd->TheStructure.Common.CommandType &&
MEDIA_STATE_FLUSH::PIPELINE_MEDIA == pCmd->TheStructure.Common.Pipeline &&
MEDIA_STATE_FLUSH::MEDIA_COMMAND_OPCODE_MEDIA_STATE_FLUSH == pCmd->TheStructure.Common.MediaCommandOpcode &&
MEDIA_STATE_FLUSH::SUBOPCODE_MEDIA_STATE_FLUSH_SUBOP == pCmd->TheStructure.Common.Subopcode
? pCmd
: nullptr;
}
template <>
PIPE_CONTROL *genCmdCast<PIPE_CONTROL *>(void *buffer) {
auto pCmd = reinterpret_cast<PIPE_CONTROL *>(buffer);
return PIPE_CONTROL::COMMAND_TYPE_GFXPIPE == pCmd->TheStructure.Common.CommandType &&
PIPE_CONTROL::COMMAND_SUBTYPE_GFXPIPE_3D == pCmd->TheStructure.Common.CommandSubtype &&
PIPE_CONTROL::_3D_COMMAND_OPCODE_PIPE_CONTROL == pCmd->TheStructure.Common._3DCommandOpcode &&
PIPE_CONTROL::_3D_COMMAND_SUB_OPCODE_PIPE_CONTROL == pCmd->TheStructure.Common._3DCommandSubOpcode
? pCmd
: nullptr;
}
template <>
PIPELINE_SELECT *genCmdCast<PIPELINE_SELECT *>(void *buffer) {
auto pCmd = reinterpret_cast<PIPELINE_SELECT *>(buffer);
return PIPELINE_SELECT::COMMAND_TYPE_GFXPIPE == pCmd->TheStructure.Common.CommandType &&
PIPELINE_SELECT::COMMAND_SUBTYPE_GFXPIPE_SINGLE_DW == pCmd->TheStructure.Common.CommandSubtype &&
PIPELINE_SELECT::_3D_COMMAND_OPCODE_GFXPIPE_NONPIPELINED == pCmd->TheStructure.Common._3DCommandOpcode &&
PIPELINE_SELECT::_3D_COMMAND_SUB_OPCODE_PIPELINE_SELECT == pCmd->TheStructure.Common._3DCommandSubOpcode
? pCmd
: nullptr;
}
template <>
MI_ARB_CHECK *genCmdCast<MI_ARB_CHECK *>(void *buffer) {
auto pCmd = reinterpret_cast<MI_ARB_CHECK *>(buffer);
return MI_ARB_CHECK::MI_INSTRUCTION_TYPE_MI_INSTRUCTION == pCmd->TheStructure.Common.MiInstructionType &&
MI_ARB_CHECK::MI_INSTRUCTION_OPCODE_MI_ARB_CHECK == pCmd->TheStructure.Common.MiInstructionOpcode
? pCmd
: nullptr;
}
template <>
MI_LOAD_REGISTER_IMM *genCmdCast<MI_LOAD_REGISTER_IMM *>(void *buffer) {
auto pCmd = reinterpret_cast<MI_LOAD_REGISTER_IMM *>(buffer);
return MI_LOAD_REGISTER_IMM::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
MI_LOAD_REGISTER_IMM::MI_COMMAND_OPCODE_MI_LOAD_REGISTER_IMM == pCmd->TheStructure.Common.MiCommandOpcode
? pCmd
: nullptr;
}
template <>
MI_NOOP *genCmdCast<MI_NOOP *>(void *buffer) {
auto pCmd = reinterpret_cast<MI_NOOP *>(buffer);
return MI_NOOP::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
MI_NOOP::MI_COMMAND_OPCODE_MI_NOOP == pCmd->TheStructure.Common.MiCommandOpcode
? pCmd
: nullptr;
}
template <>
MI_ATOMIC *genCmdCast<MI_ATOMIC *>(void *buffer) {
auto pCmd = reinterpret_cast<MI_ATOMIC *>(buffer);
return MI_ATOMIC::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
MI_ATOMIC::MI_COMMAND_OPCODE_MI_ATOMIC == pCmd->TheStructure.Common.MiCommandOpcode
? pCmd
: nullptr;
}
template <>
MI_BATCH_BUFFER_END *genCmdCast<MI_BATCH_BUFFER_END *>(void *buffer) {
auto pCmd = reinterpret_cast<MI_BATCH_BUFFER_END *>(buffer);
return MI_BATCH_BUFFER_END::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
MI_BATCH_BUFFER_END::MI_COMMAND_OPCODE_MI_BATCH_BUFFER_END == pCmd->TheStructure.Common.MiCommandOpcode
? pCmd
: nullptr;
}
template <>
MI_BATCH_BUFFER_START *genCmdCast<MI_BATCH_BUFFER_START *>(void *buffer) {
auto pCmd = reinterpret_cast<MI_BATCH_BUFFER_START *>(buffer);
return MI_BATCH_BUFFER_START::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
MI_BATCH_BUFFER_START::MI_COMMAND_OPCODE_MI_BATCH_BUFFER_START == pCmd->TheStructure.Common.MiCommandOpcode
? pCmd
: nullptr;
}
template <>
MI_LOAD_REGISTER_MEM *genCmdCast<MI_LOAD_REGISTER_MEM *>(void *buffer) {
auto pCmd = reinterpret_cast<MI_LOAD_REGISTER_MEM *>(buffer);
return MI_LOAD_REGISTER_MEM::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
MI_LOAD_REGISTER_MEM::MI_COMMAND_OPCODE_MI_LOAD_REGISTER_MEM == pCmd->TheStructure.Common.MiCommandOpcode
? pCmd
: nullptr;
}
template <>
MI_STORE_REGISTER_MEM *genCmdCast<MI_STORE_REGISTER_MEM *>(void *buffer) {
auto pCmd = reinterpret_cast<MI_STORE_REGISTER_MEM *>(buffer);
return MI_STORE_REGISTER_MEM::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
MI_STORE_REGISTER_MEM::MI_COMMAND_OPCODE_MI_STORE_REGISTER_MEM == pCmd->TheStructure.Common.MiCommandOpcode
? pCmd
: nullptr;
}
template <>
MI_REPORT_PERF_COUNT *genCmdCast<MI_REPORT_PERF_COUNT *>(void *buffer) {
auto pCmd = reinterpret_cast<MI_REPORT_PERF_COUNT *>(buffer);
return MI_REPORT_PERF_COUNT::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
MI_REPORT_PERF_COUNT::MI_COMMAND_OPCODE_MI_REPORT_PERF_COUNT == pCmd->TheStructure.Common.MiCommandOpcode
? pCmd
: nullptr;
}
template <>
MI_MATH *genCmdCast<MI_MATH *>(void *buffer) {
auto pCmd = reinterpret_cast<MI_MATH *>(buffer);
return MI_MATH::COMMAND_TYPE_MI_COMMAND == pCmd->DW0.BitField.InstructionType &&
MI_MATH::MI_COMMAND_OPCODE_MI_MATH == pCmd->DW0.BitField.InstructionOpcode
? pCmd
: nullptr;
}
template <>
MI_LOAD_REGISTER_REG *genCmdCast<MI_LOAD_REGISTER_REG *>(void *buffer) {
auto pCmd = reinterpret_cast<MI_LOAD_REGISTER_REG *>(buffer);
return MI_LOAD_REGISTER_REG::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
MI_LOAD_REGISTER_REG::MI_COMMAND_OPCODE_MI_LOAD_REGISTER_REG == pCmd->TheStructure.Common.MiCommandOpcode
? pCmd
: nullptr;
}
template <>
GPGPU_CSR_BASE_ADDRESS *genCmdCast<GPGPU_CSR_BASE_ADDRESS *>(void *buffer) {
auto pCmd = reinterpret_cast<GPGPU_CSR_BASE_ADDRESS *>(buffer);
return GPGPU_CSR_BASE_ADDRESS::COMMAND_TYPE_GFXPIPE == pCmd->TheStructure.Common.CommandType &&
GPGPU_CSR_BASE_ADDRESS::COMMAND_SUBTYPE_GFXPIPE_COMMON == pCmd->TheStructure.Common.CommandSubtype &&
GPGPU_CSR_BASE_ADDRESS::_3D_COMMAND_OPCODE_GFXPIPE_NONPIPELINED == pCmd->TheStructure.Common._3DCommandOpcode &&
GPGPU_CSR_BASE_ADDRESS::_3D_COMMAND_SUB_OPCODE_GPGPU_CSR_BASE_ADDRESS == pCmd->TheStructure.Common._3DCommandSubOpcode
? pCmd
: nullptr;
}
template <>
STATE_SIP *genCmdCast<STATE_SIP *>(void *buffer) {
auto pCmd = reinterpret_cast<STATE_SIP *>(buffer);
return STATE_SIP::COMMAND_TYPE_GFXPIPE == pCmd->TheStructure.Common.CommandType &&
STATE_SIP::COMMAND_SUBTYPE_GFXPIPE_COMMON == pCmd->TheStructure.Common.CommandSubtype &&
STATE_SIP::_3D_COMMAND_OPCODE_GFXPIPE_NONPIPELINED == pCmd->TheStructure.Common._3DCommandOpcode &&
STATE_SIP::_3D_COMMAND_SUB_OPCODE_STATE_SIP == pCmd->TheStructure.Common._3DCommandSubOpcode
? pCmd
: nullptr;
}
template <>
MI_SEMAPHORE_WAIT *genCmdCast<MI_SEMAPHORE_WAIT *>(void *buffer) {
auto pCmd = reinterpret_cast<MI_SEMAPHORE_WAIT *>(buffer);
return MI_SEMAPHORE_WAIT::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
MI_SEMAPHORE_WAIT::MI_COMMAND_OPCODE_MI_SEMAPHORE_WAIT == pCmd->TheStructure.Common.MiCommandOpcode
? pCmd
: nullptr;
}
size_t CnlParse::getCommandLength(void *cmd) {
{
auto pCmd = genCmdCast<STATE_BASE_ADDRESS *>(cmd);
if (pCmd)
return pCmd->TheStructure.Common.DwordLength + 2;
}
{
auto pCmd = genCmdCast<GPGPU_WALKER *>(cmd);
if (pCmd)
return pCmd->TheStructure.Common.DwordLength + 2;
}
{
auto pCmd = genCmdCast<PIPE_CONTROL *>(cmd);
if (pCmd)
return pCmd->TheStructure.Common.DwordLength + 2;
}
{
auto pCmd = genCmdCast<MI_ARB_CHECK *>(cmd);
if (pCmd)
return SIZE32(*pCmd);
}
{
auto pCmd = genCmdCast<MI_ATOMIC *>(cmd);
if (pCmd)
return pCmd->TheStructure.Common.DwordLength + 2;
}
{
auto pCmd = genCmdCast<MI_BATCH_BUFFER_END *>(cmd);
if (pCmd)
return SIZE32(*pCmd);
}
{
auto pCmd = genCmdCast<MI_BATCH_BUFFER_START *>(cmd);
if (pCmd)
return pCmd->TheStructure.Common.DwordLength + 2;
}
{
auto pCmd = genCmdCast<MI_LOAD_REGISTER_IMM *>(cmd);
if (pCmd)
return pCmd->TheStructure.Common.DwordLength + 2;
}
{
auto pCmd = genCmdCast<MI_LOAD_REGISTER_MEM *>(cmd);
if (pCmd)
return pCmd->TheStructure.Common.DwordLength + 2;
}
{
auto pCmd = genCmdCast<MI_STORE_REGISTER_MEM *>(cmd);
if (pCmd)
return pCmd->TheStructure.Common.DwordLength + 2;
}
{
auto pCmd = genCmdCast<MI_NOOP *>(cmd);
if (pCmd)
return SIZE32(*pCmd);
}
{
auto pCmd = genCmdCast<PIPELINE_SELECT *>(cmd);
if (pCmd)
return SIZE32(*pCmd);
}
{
auto pCmd = genCmdCast<MEDIA_INTERFACE_DESCRIPTOR_LOAD *>(cmd);
if (pCmd)
return pCmd->TheStructure.Common.DwordLength + 2;
}
{
auto pCmd = genCmdCast<MEDIA_VFE_STATE *>(cmd);
if (pCmd)
return pCmd->TheStructure.Common.DwordLength + 2;
}
{
auto pCmd = genCmdCast<MEDIA_STATE_FLUSH *>(cmd);
if (pCmd)
return pCmd->TheStructure.Common.DwordLength + 2;
}
{
auto pCmd = genCmdCast<MI_REPORT_PERF_COUNT *>(cmd);
if (pCmd)
return pCmd->TheStructure.Common.DwordLength + 2;
}
{
auto pCmd = genCmdCast<MI_LOAD_REGISTER_REG *>(cmd);
if (pCmd)
return pCmd->TheStructure.Common.DwordLength + 2;
}
{
auto pCmd = genCmdCast<MI_MATH *>(cmd);
if (pCmd)
return pCmd->DW0.BitField.DwordLength + 2;
}
{
auto pCmd = genCmdCast<GPGPU_CSR_BASE_ADDRESS *>(cmd);
if (pCmd)
return pCmd->TheStructure.Common.DwordLength + 2;
}
{
auto pCmd = genCmdCast<STATE_SIP *>(cmd);
if (pCmd)
return pCmd->TheStructure.Common.DwordLength + 2;
}
{
auto pCmd = genCmdCast<MI_SEMAPHORE_WAIT *>(cmd);
if (pCmd)
return pCmd->TheStructure.Common.DwordLength + 2;
}
return 0;
}
bool CnlParse::parseCommandBuffer(GenCmdList &cmds, void *buffer, size_t length) {
if (!buffer || length % sizeof(uint32_t)) {
return false;
}
void *bufferEnd = reinterpret_cast<uint8_t *>(buffer) + length;
while (buffer < bufferEnd) {
size_t length = getCommandLength(buffer);
if (!length) {
return false;
}
cmds.push_back(buffer);
buffer = reinterpret_cast<uint32_t *>(buffer) + length;
}
return buffer == bufferEnd;
}
// MIDL should have a MSF between it and a previous walker
template <>
void CnlParse::validateCommand<MEDIA_INTERFACE_DESCRIPTOR_LOAD *>(GenCmdList::iterator itorBegin, GenCmdList::iterator itorEnd) {
auto itorCurrent = itorBegin;
auto itorWalker = itorEnd;
// Find last GPGPU_WALKER prior to itorCmd
while (itorCurrent != itorEnd) {
if (genCmdCast<GPGPU_WALKER *>(*itorCurrent)) {
itorWalker = itorCurrent;
}
++itorCurrent;
}
// If we don't find a GPGPU_WALKER, assume the beginning of a cmd list
itorWalker = itorWalker == itorEnd
? itorBegin
: itorWalker;
// Look for MEDIA_STATE_FLUSH between last GPGPU_WALKER and MIDL.
auto itorMSF = itorEnd;
itorCurrent = itorWalker;
++itorCurrent;
while (itorCurrent != itorEnd) {
if (genCmdCast<MEDIA_STATE_FLUSH *>(*itorCurrent)) {
itorMSF = itorCurrent;
break;
}
++itorCurrent;
}
ASSERT_FALSE(itorMSF == itorEnd) << "A MEDIA_STATE_FLUSH is required before a MEDIA_INTERFACE_DESCRIPTOR_LOAD.";
}
template <>
void CnlParse::validateCommand<STATE_BASE_ADDRESS *>(GenCmdList::iterator itorBegin, GenCmdList::iterator itorEnd) {
}
// MVFES should have a stalling PC between it and a previous walker
template <>
void CnlParse::validateCommand<MEDIA_VFE_STATE *>(GenCmdList::iterator itorBegin, GenCmdList::iterator itorEnd) {
auto itorCurrent = itorBegin;
auto itorWalker = itorEnd;
// Find last GPGPU_WALKER prior to itorCmd
while (itorCurrent != itorEnd) {
if (genCmdCast<GPGPU_WALKER *>(*itorCurrent)) {
itorWalker = itorCurrent;
}
++itorCurrent;
}
// If we don't find a GPGPU_WALKER, assume the beginning of a cmd list
itorWalker = itorWalker == itorEnd
? itorBegin
: itorWalker;
// Look for PIPE_CONTROL between last GPGPU_WALKER and MVFES.
itorCurrent = itorWalker;
++itorCurrent;
while (itorCurrent != itorEnd) {
if (genCmdCast<PIPE_CONTROL *>(*itorCurrent)) {
auto pPC = genCmdCast<PIPE_CONTROL *>(*itorCurrent);
if (pPC->getCommandStreamerStallEnable()) {
return;
}
}
++itorCurrent;
}
ASSERT_TRUE(false) << "A PIPE_CONTROL w/ CS stall is required before a MEDIA_VFE_STATE.";
}
namespace OCLRT {
template void HardwareParse::findHardwareCommands<CNLFamily>();
template const void *HardwareParse::getStatelessArgumentPointer<CNLFamily>(const Kernel &kernel, uint32_t indexArg, IndirectHeap &ioh);
} // namespace OCLRT

View File

@ -0,0 +1,170 @@
/*
* 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_hw.h"
#include "runtime/gen10/reg_configs.h"
#include "runtime/helpers/hw_helper.h"
#include "unit_tests/mocks/mock_device.h"
#include "unit_tests/helpers/hw_parse.h"
#include "test.h"
using namespace OCLRT;
struct Gen10CoherencyRequirements : public ::testing::Test {
typedef typename CNLFamily::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
struct myCsr : public CommandStreamReceiverHw<CNLFamily> {
using CommandStreamReceiver::commandStream;
myCsr() : CommandStreamReceiverHw<CNLFamily>(*platformDevices[0]){};
CsrSizeRequestFlags *getCsrRequestFlags() { return &csrSizeRequestFlags; }
};
void overrideCoherencyRequest(bool requestChanged, bool requireCoherency) {
csr->getCsrRequestFlags()->coherencyRequestChanged = requestChanged;
flags.requiresCoherency = requireCoherency;
}
void SetUp() override {
csr = new myCsr();
device.reset(Device::create<MockDevice>(platformDevices[0]));
device->resetCommandStreamReceiver(csr);
}
myCsr *csr = nullptr;
std::unique_ptr<MockDevice> device;
DispatchFlags flags = {};
};
GEN10TEST_F(Gen10CoherencyRequirements, coherencyCmdSize) {
auto lriSize = sizeof(MI_LOAD_REGISTER_IMM);
overrideCoherencyRequest(false, false);
auto retSize = csr->getCmdSizeForCoherency();
EXPECT_EQ(0u, retSize);
overrideCoherencyRequest(false, true);
retSize = csr->getCmdSizeForCoherency();
EXPECT_EQ(0u, retSize);
overrideCoherencyRequest(true, true);
retSize = csr->getCmdSizeForCoherency();
EXPECT_EQ(lriSize, retSize);
overrideCoherencyRequest(true, false);
retSize = csr->getCmdSizeForCoherency();
EXPECT_EQ(lriSize, retSize);
}
GEN10TEST_F(Gen10CoherencyRequirements, coherencyCmdValues) {
auto lriSize = sizeof(MI_LOAD_REGISTER_IMM);
char buff[MemoryConstants::pageSize];
LinearStream stream(buff, MemoryConstants::pageSize);
auto expectedCmd = MI_LOAD_REGISTER_IMM::sInit();
expectedCmd.setRegisterOffset(gen10HdcModeRegisterAddresss);
expectedCmd.setDataDword(DwordBuilder::build(4, true));
overrideCoherencyRequest(true, false);
csr->programCoherency(stream, flags);
EXPECT_EQ(lriSize, stream.getUsed());
auto cmd = reinterpret_cast<MI_LOAD_REGISTER_IMM *>(stream.getCpuBase());
EXPECT_TRUE(memcmp(&expectedCmd, cmd, lriSize) == 0);
overrideCoherencyRequest(true, true);
csr->programCoherency(stream, flags);
EXPECT_EQ(lriSize * 2, stream.getUsed());
cmd = reinterpret_cast<MI_LOAD_REGISTER_IMM *>(ptrOffset(stream.getCpuBase(), lriSize));
expectedCmd.setDataDword(DwordBuilder::build(4, true, false));
EXPECT_TRUE(memcmp(&expectedCmd, cmd, lriSize) == 0);
}
struct Gen10CoherencyProgramingTest : public Gen10CoherencyRequirements {
void SetUp() override {
Gen10CoherencyRequirements::SetUp();
startOffset = csr->commandStream.getUsed();
}
void flushTask(bool coherencyRequired) {
flags.requiresCoherency = coherencyRequired;
auto graphicAlloc = csr->getMemoryManager()->allocateGraphicsMemory(MemoryConstants::pageSize);
IndirectHeap stream(graphicAlloc);
startOffset = csr->commandStream.getUsed();
csr->flushTask(stream, 0, stream, stream, stream, 0, flags);
csr->getMemoryManager()->freeGraphicsMemory(graphicAlloc);
};
void findMmio(bool expectToBeProgrammed) {
HardwareParse hwParser;
hwParser.parseCommands<CNLFamily>(csr->commandStream, startOffset);
bool foundOne = false;
for (auto it = hwParser.cmdList.begin(); it != hwParser.cmdList.end(); it++) {
auto cmd = genCmdCast<MI_LOAD_REGISTER_IMM *>(*it);
if (cmd && cmd->getRegisterOffset() == gen10HdcModeRegisterAddresss) {
EXPECT_FALSE(foundOne);
foundOne = true;
}
}
EXPECT_EQ(expectToBeProgrammed, foundOne);
};
size_t startOffset;
};
GEN10TEST_F(Gen10CoherencyProgramingTest, givenCsrWhenFlushFirstTaskWithoutCoherencyRequiredThenProgramMmio) {
flushTask(false);
findMmio(true);
}
GEN10TEST_F(Gen10CoherencyProgramingTest, givenCsrWhenFlushFirstTaskWithCoherencyRequiredThenProgramMmio) {
flushTask(true);
findMmio(true);
}
GEN10TEST_F(Gen10CoherencyProgramingTest, givenCsrWithFlushedFirstTaskWithCoherencyRequiredWhenFlushNextTaskWithoutChangingCoherencyRequirementThenDoNotProgramMmio) {
flushTask(true);
flushTask(true);
findMmio(false);
}
GEN10TEST_F(Gen10CoherencyProgramingTest, givenCsrWithFlushedFirstTaskWithoutCoherencyRequiredWhenFlushNextTaskWithoutChangingCoherencyRequirementThenDoNotProgramMmio) {
flushTask(false);
flushTask(false);
findMmio(false);
}
GEN10TEST_F(Gen10CoherencyProgramingTest, givenCsrWithFlushedFirstTaskWithCoherencyRequiredWhenFlushNextTaskWithChangingCoherencyRequirementThenProgramMmio) {
flushTask(true);
flushTask(false);
findMmio(true);
}
GEN10TEST_F(Gen10CoherencyProgramingTest, givenCsrWithFlushedFirstTaskWithoutCoherencyRequiredWhenFlushNextTaskWithChangingCoherencyRequirementThenProgramMmio) {
flushTask(false);
flushTask(true);
findMmio(true);
}

View File

@ -0,0 +1,51 @@
/*
* 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_queue/command_queue_hw.h"
#include "runtime/command_stream/command_stream_receiver.h"
#include "runtime/command_stream/linear_stream.h"
#include "reg_configs_common.h"
#include "unit_tests/fixtures/device_fixture.h"
#include "unit_tests/helpers/hw_parse.h"
#include "unit_tests/mocks/mock_event.h"
#include "unit_tests/mocks/mock_kernel.h"
#include "unit_tests/mocks/mock_command_queue.h"
#include "unit_tests/mocks/mock_context.h"
#include "unit_tests/mocks/mock_csr.h"
#include "test.h"
#include "gtest/gtest.h"
using namespace OCLRT;
#include "unit_tests/command_stream/command_stream_receiver_hw_tests.inl"
using CommandStreamReceiverHwTestGen10 = CommandStreamReceiverHwTest<CNLFamily>;
GEN10TEST_F(CommandStreamReceiverHwTestGen10, GivenKernelWithSlmWhenPreviousNOSLML3WasSentThenProgramL3WithSLML3Config) {
givenKernelWithSlmWhenPreviousNOSLML3WasSentThenProgramL3WithSLML3ConfigImpl();
}
GEN10TEST_F(CommandStreamReceiverHwTestGen10, GivenBlockedKernelWithSlmWhenPreviousNOSLML3WasSentThenProgramL3WithSLML3ConfigAfterUnblocking) {
givenBlockedKernelWithSlmWhenPreviousNOSLML3WasSentThenProgramL3WithSLML3ConfigAfterUnblockingImpl();
}

View File

@ -0,0 +1,67 @@
/*
* 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_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<DeviceFixture>;
GEN10TEST_F(Gen10EnqueueTest, givenKernelRequiringIndependentForwardProgressWhenKernelIsSubmittedThenDefaultPolicyIsProgrammed) {
MockContext mc;
CommandQueueHw<FamilyType> 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<FamilyType>(cmdQ);
auto cmd = findMmioCmd<FamilyType>(hwParser.cmdList.begin(), hwParser.cmdList.end(), RowChickenReg4::address);
ASSERT_NE(nullptr, cmd);
EXPECT_EQ(RowChickenReg4::regDataForArbitrationPolicy[PreambleHelper<FamilyType>::getDefaultThreadArbitrationPolicy()], cmd->getDataDword());
EXPECT_EQ(1U, countMmio<FamilyType>(hwParser.cmdList.begin(), hwParser.cmdList.end(), RowChickenReg4::address));
}
GEN10TEST_F(Gen10EnqueueTest, givenKernelNotRequiringIndependentForwardProgressWhenKernelIsSubmittedThenAgeBasedPolicyIsProgrammed) {
MockContext mc;
CommandQueueHw<FamilyType> 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<FamilyType>(cmdQ);
auto cmd = findMmioCmd<FamilyType>(hwParser.cmdList.begin(), hwParser.cmdList.end(), RowChickenReg4::address);
ASSERT_NE(nullptr, cmd);
EXPECT_EQ(RowChickenReg4::regDataForArbitrationPolicy[ThreadArbitrationPolicy::AgeBased], cmd->getDataDword());
EXPECT_EQ(1U, countMmio<FamilyType>(hwParser.cmdList.begin(), hwParser.cmdList.end(), RowChickenReg4::address));
}
} // namespace OCLRT

View File

@ -0,0 +1,196 @@
/*
* 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 "unit_tests/fixtures/media_kernel_fixture.h"
#include "runtime/helpers/preamble.h"
#include "test.h"
using namespace OCLRT;
typedef MediaKernelFixture<HelloWorldFixtureFactory> MediaKernelTest;
GEN10TEST_F(MediaKernelTest, givenGen10CsrWhenEnqueueBlockedVmeKernelFirstTimeThenProgramPipelineSelectionAndMediaSampler) {
typedef typename CNLFamily::PIPELINE_SELECT PIPELINE_SELECT;
cl_uint workDim = 1;
size_t globalWorkOffset[3] = {0, 0, 0};
size_t globalWorkSize[3] = {1, 1, 1};
UserEvent userEvent(context);
cl_event blockedEvent = &userEvent;
auto retVal = pCmdQ->enqueueKernel(
pVmeKernel,
workDim,
globalWorkOffset,
globalWorkSize,
nullptr,
1,
&blockedEvent,
nullptr);
ASSERT_EQ(CL_SUCCESS, retVal);
userEvent.setStatus(CL_COMPLETE);
parseCommands<CNLFamily>(*pCmdQ);
ASSERT_NE(cmdPipelineSelect, nullptr);
auto *pCmd = genCmdCast<PIPELINE_SELECT *>(cmdPipelineSelect);
auto expectedMask = pipelineSelectEnablePipelineSelectMaskBits | pipelineSelectMediaSamplerDopClockGateMaskBits;
auto expectedPipelineSelection = PIPELINE_SELECT::PIPELINE_SELECTION_GPGPU;
EXPECT_EQ(expectedMask, pCmd->getMaskBits());
EXPECT_EQ(expectedPipelineSelection, pCmd->getPipelineSelection());
EXPECT_FALSE(pCmd->getMediaSamplerDopClockGateEnable());
}
GEN10TEST_F(MediaKernelTest, givenGen10CsrWhenEnqueueBlockedNonVmeKernelFirstTimeThenProgramPipelineSelectionAndMediaSampler) {
typedef typename CNLFamily::PIPELINE_SELECT PIPELINE_SELECT;
cl_uint workDim = 1;
size_t globalWorkOffset[3] = {0, 0, 0};
size_t globalWorkSize[3] = {1, 1, 1};
UserEvent userEvent(context);
cl_event blockedEvent = &userEvent;
auto retVal = pCmdQ->enqueueKernel(
pKernel,
workDim,
globalWorkOffset,
globalWorkSize,
nullptr,
1,
&blockedEvent,
nullptr);
ASSERT_EQ(CL_SUCCESS, retVal);
userEvent.setStatus(CL_COMPLETE);
parseCommands<CNLFamily>(*pCmdQ);
ASSERT_NE(cmdPipelineSelect, nullptr);
auto *pCmd = genCmdCast<PIPELINE_SELECT *>(cmdPipelineSelect);
auto expectedMask = pipelineSelectEnablePipelineSelectMaskBits | pipelineSelectMediaSamplerDopClockGateMaskBits;
auto expectedPipelineSelection = PIPELINE_SELECT::PIPELINE_SELECTION_GPGPU;
EXPECT_EQ(expectedMask, pCmd->getMaskBits());
EXPECT_EQ(expectedPipelineSelection, pCmd->getPipelineSelection());
EXPECT_TRUE(pCmd->getMediaSamplerDopClockGateEnable());
}
GEN10TEST_F(MediaKernelTest, givenGen10CsrWhenEnqueueVmeKernelFirstTimeThenProgramPipelineSelectionAndMediaSampler) {
typedef typename CNLFamily::PIPELINE_SELECT PIPELINE_SELECT;
enqueueVmeKernel<CNLFamily>();
auto numCommands = getCommandsList<PIPELINE_SELECT>().size();
EXPECT_EQ(1u, numCommands);
auto pCmd = getCommand<PIPELINE_SELECT>();
auto expectedMask = pipelineSelectEnablePipelineSelectMaskBits | pipelineSelectMediaSamplerDopClockGateMaskBits;
auto expectedPipelineSelection = PIPELINE_SELECT::PIPELINE_SELECTION_GPGPU;
EXPECT_EQ(expectedMask, pCmd->getMaskBits());
EXPECT_EQ(expectedPipelineSelection, pCmd->getPipelineSelection());
EXPECT_FALSE(pCmd->getMediaSamplerDopClockGateEnable());
}
GEN10TEST_F(MediaKernelTest, givenGen10CsrWhenEnqueueNonVmeKernelFirstTimeThenProgramPipelineSelectionAndMediaSampler) {
typedef typename CNLFamily::PIPELINE_SELECT PIPELINE_SELECT;
enqueueRegularKernel<CNLFamily>();
auto numCommands = getCommandsList<PIPELINE_SELECT>().size();
EXPECT_EQ(1u, numCommands);
auto pCmd = getCommand<PIPELINE_SELECT>();
auto expectedMask = pipelineSelectEnablePipelineSelectMaskBits | pipelineSelectMediaSamplerDopClockGateMaskBits;
auto expectedPipelineSelection = PIPELINE_SELECT::PIPELINE_SELECTION_GPGPU;
EXPECT_EQ(expectedMask, pCmd->getMaskBits());
EXPECT_EQ(expectedPipelineSelection, pCmd->getPipelineSelection());
EXPECT_TRUE(pCmd->getMediaSamplerDopClockGateEnable());
}
GEN10TEST_F(MediaKernelTest, givenGen10CsrWhenEnqueueVmeKernelTwiceThenProgramPipelineSelectOnce) {
typedef typename CNLFamily::PIPELINE_SELECT PIPELINE_SELECT;
enqueueVmeKernel<CNLFamily>();
auto numCommands = getCommandsList<PIPELINE_SELECT>().size();
EXPECT_EQ(1u, numCommands);
}
GEN10TEST_F(MediaKernelTest, givenGen10CsrWhenEnqueueNonVmeKernelTwiceThenProgramPipelineSelectOnce) {
typedef typename CNLFamily::PIPELINE_SELECT PIPELINE_SELECT;
enqueueVmeKernel<CNLFamily>();
auto numCommands = getCommandsList<PIPELINE_SELECT>().size();
EXPECT_EQ(1u, numCommands);
}
GEN10TEST_F(MediaKernelTest, givenGen10CsrWhenEnqueueVmeKernelAfterNonVmeKernelThenProgramPipelineSelectionAndMediaSamplerTwice) {
typedef typename CNLFamily::PIPELINE_SELECT PIPELINE_SELECT;
enqueueRegularKernel<CNLFamily>();
enqueueVmeKernel<CNLFamily>();
auto commands = getCommandsList<PIPELINE_SELECT>();
EXPECT_EQ(2u, commands.size());
auto pCmd = static_cast<PIPELINE_SELECT *>(commands.back());
auto expectedMask = pipelineSelectEnablePipelineSelectMaskBits | pipelineSelectMediaSamplerDopClockGateMaskBits;
EXPECT_EQ(expectedMask, pCmd->getMaskBits());
EXPECT_FALSE(pCmd->getMediaSamplerDopClockGateEnable());
}
GEN10TEST_F(MediaKernelTest, givenGen10CsrWhenEnqueueNonVmeKernelAfterVmeKernelThenProgramProgramPipelineSelectionAndMediaSamplerTwice) {
typedef typename CNLFamily::PIPELINE_SELECT PIPELINE_SELECT;
enqueueVmeKernel<CNLFamily>();
enqueueRegularKernel<CNLFamily>();
auto commands = getCommandsList<PIPELINE_SELECT>();
EXPECT_EQ(2u, commands.size());
auto pCmd = static_cast<PIPELINE_SELECT *>(commands.back());
auto expectedMask = pipelineSelectEnablePipelineSelectMaskBits | pipelineSelectMediaSamplerDopClockGateMaskBits;
EXPECT_EQ(expectedMask, pCmd->getMaskBits());
EXPECT_TRUE(pCmd->getMediaSamplerDopClockGateEnable());
}
GEN10TEST_F(MediaKernelTest, givenGen10CsrWhenEnqueueVmeKernelThenVmeSubslicesConfigDoesntChangeToFalse) {
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(&pDevice->getCommandStreamReceiver());
csr->lastVmeSubslicesConfig = true;
enqueueVmeKernel<FamilyType>();
EXPECT_TRUE(csr->lastVmeSubslicesConfig);
}
GEN10TEST_F(MediaKernelTest, givenGen10CsrWhenEnqueueVmeKernelThenVmeSubslicesConfigDoesntChangeToTrue) {
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(&pDevice->getCommandStreamReceiver());
csr->lastVmeSubslicesConfig = false;
enqueueVmeKernel<FamilyType>();
EXPECT_FALSE(csr->lastVmeSubslicesConfig);
}
GEN10TEST_F(MediaKernelTest, gen10CmdSizeForVme) {
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(&pDevice->getCommandStreamReceiver());
csr->lastVmeSubslicesConfig = false;
EXPECT_EQ(0u, csr->getCmdSizeForMediaSampler(false));
EXPECT_EQ(0u, csr->getCmdSizeForMediaSampler(true));
csr->lastVmeSubslicesConfig = true;
EXPECT_EQ(0u, csr->getCmdSizeForMediaSampler(false));
EXPECT_EQ(0u, csr->getCmdSizeForMediaSampler(true));
}

View File

@ -0,0 +1,33 @@
/*
* 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.
*/
#pragma once
#include "unit_tests/gen_common/gen_cmd_parse_base.h"
struct CnlParse : public OCLRT::CNL {
static size_t getCommandLength(void *cmd);
static bool parseCommandBuffer(GenCmdList &_cmds, void *_buffer, size_t _length);
template <typename CmdType>
static void validateCommand(GenCmdList::iterator itorBegin, GenCmdList::iterator itorEnd);
};

View File

@ -0,0 +1,82 @@
/*
* 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 "unit_tests/helpers/hw_helper_tests.h"
typedef HwHelperTest HwHelperTestCnl;
GEN10TEST_F(HwHelperTestCnl, getMaxBarriersPerSliceReturnsCorrectSize) {
auto &helper = HwHelper::get(renderCoreFamily);
EXPECT_EQ(32u, helper.getMaxBarrierRegisterPerSlice());
}
GEN10TEST_F(HwHelperTestCnl, whenCnlRevIdForStepCThenSetCapabilityCoherencyFlagFalse) {
auto &helper = HwHelper::get(renderCoreFamily);
bool coherency = true;
HardwareInfo testHwInfo = hwInfo;
PLATFORM testPlatform = *hwInfo.pPlatform;
testHwInfo.pPlatform = &testPlatform;
testPlatform.usRevId = 0x3;
helper.setCapabilityCoherencyFlag(&testHwInfo, coherency);
EXPECT_FALSE(coherency);
}
GEN10TEST_F(HwHelperTestCnl, whenCnlRevIdForStepDThenSetCapabilityCoherencyFlagTrue) {
auto &helper = HwHelper::get(renderCoreFamily);
bool coherency = false;
HardwareInfo testHwInfo = hwInfo;
PLATFORM testPlatform = *hwInfo.pPlatform;
testHwInfo.pPlatform = &testPlatform;
testPlatform.usRevId = 0x4;
helper.setCapabilityCoherencyFlag(&testHwInfo, coherency);
EXPECT_TRUE(coherency);
}
GEN10TEST_F(HwHelperTestCnl, setupPreemptionRegisters) {
auto &helper = HwHelper::get(renderCoreFamily);
bool preemption = false;
preemption = helper.setupPreemptionRegisters(&hwInfo, preemption);
EXPECT_FALSE(preemption);
EXPECT_FALSE(hwInfo.capabilityTable.whitelistedRegisters.csChicken1_0x2580);
preemption = true;
preemption = helper.setupPreemptionRegisters(&hwInfo, preemption);
EXPECT_TRUE(preemption);
EXPECT_TRUE(hwInfo.capabilityTable.whitelistedRegisters.csChicken1_0x2580);
}
GEN10TEST_F(HwHelperTestCnl, adjustDefaultEngineType) {
auto engineType = hwInfo.capabilityTable.defaultEngineType;
auto &helper = HwHelper::get(renderCoreFamily);
helper.adjustDefaultEngineType(&hwInfo);
EXPECT_EQ(engineType, hwInfo.capabilityTable.defaultEngineType);
}
GEN10TEST_F(HwHelperTestCnl, givenGen10PlatformWhenSetupHardwareCapabilitiesIsCalledThenDefaultImplementationIsUsed) {
auto &helper = HwHelper::get(renderCoreFamily);
// Test default method implementation
testDefaultImplementationOfSetupHardwareCapabilities(helper);
}

View File

@ -0,0 +1,76 @@
/*
* 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 "unit_tests/fixtures/image_fixture.h"
#include "unit_tests/mocks/mock_context.h"
#include "test.h"
using namespace OCLRT;
typedef ::testing::Test gen10ImageTests;
GEN10TEST_F(gen10ImageTests, appendSurfaceStateParamsDoesNothing) {
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
MockContext context;
auto image = std::unique_ptr<Image>(ImageHelper<Image1dDefaults>::create(&context));
auto surfaceStateBefore = RENDER_SURFACE_STATE::sInit();
auto surfaceStateAfter = RENDER_SURFACE_STATE::sInit();
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
EXPECT_EQ(0, memcmp(&surfaceStateBefore, &surfaceStateAfter, sizeof(RENDER_SURFACE_STATE)));
imageHw->appendSurfaceStateParams(&surfaceStateAfter);
EXPECT_EQ(0, memcmp(&surfaceStateBefore, &surfaceStateAfter, sizeof(RENDER_SURFACE_STATE)));
}
GEN10TEST_F(gen10ImageTests, WhenGetHostPtrRowOrSlicePitchForMapIsCalledWithMipLevelZeroThenReturnHostPtrRowPitchAndSlicePitch) {
MockContext context;
cl_image_desc imageDesc{};
imageDesc.image_type = CL_MEM_OBJECT_IMAGE3D;
imageDesc.image_width = 5;
imageDesc.image_height = 5;
imageDesc.image_array_size = 5;
imageDesc.num_mip_levels = 2;
std::unique_ptr<Image> image(ImageHelper<Image3dDefaults>::create(&context, &imageDesc));
auto rowPitch = image->getHostPtrRowPitchForMap(0u);
auto slicePitch = image->getHostPtrSlicePitchForMap(0u);
EXPECT_EQ(image->getHostPtrRowPitch(), rowPitch);
EXPECT_EQ(image->getHostPtrSlicePitch(), slicePitch);
}
GEN10TEST_F(gen10ImageTests, WhenGetHostPtrRowOrSlicePitchForMapIsCalledWithMipLevelNonZeroThenReturnHostPtrRowPitchAndSlicePitch) {
MockContext context;
cl_image_desc imageDesc{};
imageDesc.image_type = CL_MEM_OBJECT_IMAGE3D;
imageDesc.image_width = 5;
imageDesc.image_height = 5;
imageDesc.image_array_size = 5;
imageDesc.num_mip_levels = 2;
std::unique_ptr<Image> image(ImageHelper<Image3dDefaults>::create(&context, &imageDesc));
auto rowPitch = image->getHostPtrRowPitchForMap(1u);
auto slicePitch = image->getHostPtrSlicePitchForMap(1u);
EXPECT_EQ(image->getHostPtrRowPitch(), rowPitch);
EXPECT_EQ(image->getHostPtrSlicePitch(), slicePitch);
}

View File

@ -0,0 +1,34 @@
/*
* 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 "unit_tests/fixtures/device_fixture.h"
#include "unit_tests/mocks/mock_kernel.h"
#include "test.h"
using namespace OCLRT;
using Gen10KernelTest = Test<DeviceFixture>;
GEN10TEST_F(Gen10KernelTest, givenKernelWhenCanTransformImagesIsCalledThenReturnsTrue) {
MockKernelWithInternals mockKernel(*pDevice);
auto retVal = mockKernel.mockKernel->Kernel::canTransformImages();
EXPECT_TRUE(retVal);
}

View File

@ -0,0 +1,30 @@
/*
* 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/gen10/hw_info.h"
#include "unit_tests/helpers/l3_helper.h"
#include "unit_tests/helpers/l3_helper.inl"
namespace OCLRT {
template struct L3Helper<CNLFamily>;
} // namespace OCLRT

View File

@ -0,0 +1,30 @@
# 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.
set(IGDRCL_SRCS_tests_gen10_linux
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/device_factory_tests_gen10.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drm_mapper_tests_gen10.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_tests_gen10.cpp
)
if(UNIX)
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_gen10_linux})
add_subdirectory(dll)
endif()

View File

@ -0,0 +1,53 @@
/*
* 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 "unit_tests/os_interface/linux/device_factory_tests.h"
typedef DeviceFactoryLinuxTest DeviceFactoryLinuxTestCnl;
GEN10TEST_F(DeviceFactoryLinuxTestCnl, queryWhitelistedPreemptionRegister) {
pDrm->StoredPreemptionSupport = 1;
HardwareInfo *hwInfo = nullptr;
size_t numDevices = 0;
bool success = DeviceFactory::getDevices(&hwInfo, numDevices);
EXPECT_TRUE(success);
#if defined(I915_PARAM_HAS_PREEMPTION)
EXPECT_TRUE(hwInfo->capabilityTable.whitelistedRegisters.csChicken1_0x2580);
#else
EXPECT_FALSE(hwInfo->capabilityTable.whitelistedRegisters.csChicken1_0x2580);
#endif
DeviceFactory::releaseDevices();
}
GEN10TEST_F(DeviceFactoryLinuxTestCnl, queryNotWhitelistedPreemptionRegister) {
pDrm->StoredPreemptionSupport = 0;
HardwareInfo *hwInfo = nullptr;
size_t numDevices = 0;
bool success = DeviceFactory::getDevices(&hwInfo, numDevices);
EXPECT_TRUE(success);
EXPECT_FALSE(hwInfo->capabilityTable.whitelistedRegisters.csChicken1_0x2580);
DeviceFactory::releaseDevices();
}

View File

@ -0,0 +1,25 @@
# 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.
set(IGDRCL_SRCS_linux_dll_tests_gen10
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/device_id_tests_gen10.cpp
)
target_sources(igdrcl_linux_dll_tests PRIVATE ${IGDRCL_SRCS_linux_dll_tests_gen10})

View File

@ -0,0 +1,73 @@
/*
* 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 "hw_cmds.h"
#include "runtime/os_interface/linux/drm_neo.h"
#include "test.h"
#include <array>
using namespace OCLRT;
TEST(CnlDeviceIdTest, supportedDeviceId) {
std::array<DeviceDescriptor, 20> expectedDescriptors = {{
{ICNL_5x8_DESK_DEVICE_F0_ID, &CNL_2x5x8::hwInfo, &CNL_2x5x8::setupGtSystemInfo, GTTYPE_GT2},
{ICNL_5x8_DESKTOP_DEVICE_F0_ID, &CNL_2x5x8::hwInfo, &CNL_2x5x8::setupGtSystemInfo, GTTYPE_GT2},
{ICNL_5x8_HALO_DEVICE_F0_ID, &CNL_2x5x8::hwInfo, &CNL_2x5x8::setupGtSystemInfo, GTTYPE_GT2},
{ICNL_5x8_SUPERSKU_DEVICE_F0_ID, &CNL_2x5x8::hwInfo, &CNL_2x5x8::setupGtSystemInfo, GTTYPE_GT2},
{ICNL_5x8_ULX_DEVICE_F0_ID, &CNL_2x5x8::hwInfo, &CNL_2x5x8::setupGtSystemInfo, GTTYPE_GT2},
{ICNL_5x8_ULT_DEVICE_F0_ID, &CNL_2x5x8::hwInfo, &CNL_2x5x8::setupGtSystemInfo, GTTYPE_GT2},
{ICNL_4x8_ULT_DEVICE_F0_ID, &CNL_2x4x8::hwInfo, &CNL_2x4x8::setupGtSystemInfo, GTTYPE_GT2},
{ICNL_4x8_ULX_DEVICE_F0_ID, &CNL_2x4x8::hwInfo, &CNL_2x4x8::setupGtSystemInfo, GTTYPE_GT2},
{ICNL_4x8_HALO_DEVICE_F0_ID, &CNL_2x4x8::hwInfo, &CNL_2x4x8::setupGtSystemInfo, GTTYPE_GT2},
{ICNL_3x8_DESK_DEVICE_F0_ID, &CNL_1x3x8::hwInfo, &CNL_1x3x8::setupGtSystemInfo, GTTYPE_GT1},
{ICNL_3x8_ULT_DEVICE_F0_ID, &CNL_1x3x8::hwInfo, &CNL_1x3x8::setupGtSystemInfo, GTTYPE_GT1},
{ICNL_2x8_ULT_DEVICE_F0_ID, &CNL_1x2x8::hwInfo, &CNL_1x2x8::setupGtSystemInfo, GTTYPE_GT1},
{ICNL_3x8_HALO_DEVICE_F0_ID, &CNL_1x3x8::hwInfo, &CNL_1x3x8::setupGtSystemInfo, GTTYPE_GT1},
{ICNL_3x8_DESKTOP_DEVICE_F0_ID, &CNL_1x3x8::hwInfo, &CNL_1x3x8::setupGtSystemInfo, GTTYPE_GT1},
{ICNL_3x8_ULX_DEVICE_F0_ID, &CNL_1x3x8::hwInfo, &CNL_1x3x8::setupGtSystemInfo, GTTYPE_GT1},
{ICNL_2x8_ULX_DEVICE_F0_ID, &CNL_1x2x8::hwInfo, &CNL_1x2x8::setupGtSystemInfo, GTTYPE_GT1},
{ICNL_2x8_HALO_DEVICE_F0_ID, &CNL_1x2x8::hwInfo, &CNL_1x2x8::setupGtSystemInfo, GTTYPE_GT1},
{ICNL_9x8_DESK_DEVICE_F0_ID, &CNL_4x9x8::hwInfo, &CNL_4x9x8::setupGtSystemInfo, GTTYPE_GT3},
{ICNL_9x8_ULT_DEVICE_F0_ID, &CNL_4x9x8::hwInfo, &CNL_4x9x8::setupGtSystemInfo, GTTYPE_GT3},
{ICNL_9x8_SUPERSKU_DEVICE_F0_ID, &CNL_4x9x8::hwInfo, &CNL_4x9x8::setupGtSystemInfo, GTTYPE_GT3},
}};
auto compareStructs = [](const DeviceDescriptor *first, const DeviceDescriptor *second) {
return first->deviceId == second->deviceId && first->pHwInfo == second->pHwInfo &&
first->setupGtSystemInfo == second->setupGtSystemInfo && first->eGtType == second->eGtType;
};
size_t startIndex = 0;
while (!compareStructs(&expectedDescriptors[0], &deviceDescriptorTable[startIndex]) &&
deviceDescriptorTable[startIndex].deviceId != 0) {
startIndex++;
};
EXPECT_NE(0u, deviceDescriptorTable[startIndex].deviceId);
for (auto &expected : expectedDescriptors) {
EXPECT_TRUE(compareStructs(&expected, &deviceDescriptorTable[startIndex]));
startIndex++;
}
}

View File

@ -0,0 +1,50 @@
/*
* 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 "unit_tests/helpers/gtest_helpers.h"
#include "test.h"
#include "hw_cmds.h"
#include "runtime/os_interface/linux/drm_engine_mapper.h"
#include "drm/i915_drm.h"
using namespace OCLRT;
using namespace std;
struct DrmMapperTestsGen10 : public ::testing::Test {
void SetUp() override {}
void TearDown() override {}
};
GEN10TEST_F(DrmMapperTestsGen10, engineNodeMapPass) {
unsigned int flag = I915_EXEC_RING_MASK;
unsigned int expected = I915_EXEC_RENDER;
bool ret = DrmEngineMapper<CNLFamily>::engineNodeMap(EngineType::ENGINE_RCS, flag);
EXPECT_TRUE(ret);
EXPECT_EQ(expected, flag);
}
GEN10TEST_F(DrmMapperTestsGen10, engineNodeMapNegative) {
unsigned int flag = I915_EXEC_RING_MASK;
bool ret = DrmEngineMapper<CNLFamily>::engineNodeMap(EngineType::ENGINE_BCS, flag);
EXPECT_FALSE(ret);
}

View File

@ -0,0 +1,224 @@
/*
* 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 "unit_tests/helpers/gtest_helpers.h"
#include "unit_tests/os_interface/linux/hw_info_config_linux_tests.h"
using namespace OCLRT;
using namespace std;
struct HwInfoConfigTestLinuxCnl : HwInfoConfigTestLinux {
void SetUp() override {
HwInfoConfigTestLinux::SetUp();
drm->StoredDeviceID = ICNL_5x8_SUPERSKU_DEVICE_F0_ID;
drm->setGtType(GTTYPE_GT2);
drm->StoredSSVal = 3;
}
};
CNLTEST_F(HwInfoConfigTestLinuxCnl, configureHwInfo) {
auto hwInfoConfig = HwInfoConfig::get(productFamily);
int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID);
EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId);
EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount);
EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount);
EXPECT_EQ(1u, outHwInfo.pSysInfo->SliceCount);
EXPECT_EQ(EngineType::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType);
EXPECT_EQ(GTTYPE_GT2, outHwInfo.pPlatform->eGTType);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGT2);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX);
//constant sysInfo/ftr flags
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGpGpuMidBatchPreempt);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGpGpuThreadGroupLevelPreempt);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGpGpuMidThreadLevelPreempt);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftr3dMidBatchPreempt);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftr3dObjectLevelPreempt);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftr3dMidBatchPreempt);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGpGpuThreadGroupLevelPreempt);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrPerCtxtPreemptionGranularityControl);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrPPGTT);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrSVM);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrL3IACoherency);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrIA32eGfxPTEs);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrStandardMipTailFormat);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrDisplayYTiling);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrTranslationTable);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrUserModeTranslationTable);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrTileMappedResource);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrEnableGuC);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrFbc);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrFbc2AddressTranslation);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrFbcBlitterTracking);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrFbcCpuTracking);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrAstcHdr2D);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrAstcLdr2D);
ReleaseOutHwInfoStructs();
drm->StoredDeviceID = ICNL_3x8_ULT_DEVICE_F0_ID;
drm->StoredSSVal = 4;
drm->setGtType(GTTYPE_GT1);
ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID);
EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId);
EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount);
EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount);
EXPECT_EQ(2u, outHwInfo.pSysInfo->SliceCount);
EXPECT_EQ(EngineType::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType);
EXPECT_EQ(GTTYPE_GT1, outHwInfo.pPlatform->eGTType);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGT1);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX);
ReleaseOutHwInfoStructs();
drm->StoredDeviceID = ICNL_3x8_ULT_DEVICE_F0_ID;
drm->StoredSSVal = 6;
drm->setGtType(GTTYPE_GT2_5);
ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID);
EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId);
EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount);
EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount);
EXPECT_EQ(3u, outHwInfo.pSysInfo->SliceCount);
EXPECT_EQ(EngineType::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType);
EXPECT_EQ(GTTYPE_GT2_5, outHwInfo.pPlatform->eGTType);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA);
ReleaseOutHwInfoStructs();
}
CNLTEST_F(HwInfoConfigTestLinuxCnl, negative) {
auto hwInfoConfig = HwInfoConfig::get(productFamily);
drm->StoredRetValForDeviceID = -1;
int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(-1, ret);
ReleaseOutHwInfoStructs();
drm->StoredRetValForDeviceID = 0;
drm->StoredRetValForDeviceRevID = -1;
ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(-1, ret);
ReleaseOutHwInfoStructs();
drm->StoredRetValForDeviceRevID = 0;
drm->StoredRetValForEUVal = -1;
ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(-1, ret);
ReleaseOutHwInfoStructs();
drm->StoredRetValForEUVal = 0;
drm->StoredRetValForSSVal = -1;
ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(-1, ret);
}
CNLTEST_F(HwInfoConfigTestLinuxCnl, configureHwInfoWaFlags) {
auto hwInfoConfig = HwInfoConfig::get(productFamily);
drm->StoredDeviceRevID = 0;
int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_EQ(1u, outHwInfo.pWaTable->waFbcLinearSurfaceStride);
EXPECT_EQ(1u, outHwInfo.pWaTable->waEncryptedEdramOnlyPartials);
EXPECT_EQ(1u, outHwInfo.pWaTable->waSamplerCacheFlushBetweenRedescribedSurfaceReads);
ReleaseOutHwInfoStructs();
drm->StoredDeviceRevID = 1;
ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_EQ(1u, outHwInfo.pWaTable->waFbcLinearSurfaceStride);
EXPECT_EQ(0u, outHwInfo.pWaTable->waEncryptedEdramOnlyPartials);
EXPECT_EQ(1u, outHwInfo.pWaTable->waSamplerCacheFlushBetweenRedescribedSurfaceReads);
ReleaseOutHwInfoStructs();
drm->StoredDeviceRevID = 2;
ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_EQ(0u, outHwInfo.pWaTable->waFbcLinearSurfaceStride);
EXPECT_EQ(0u, outHwInfo.pWaTable->waEncryptedEdramOnlyPartials);
EXPECT_EQ(1u, outHwInfo.pWaTable->waSamplerCacheFlushBetweenRedescribedSurfaceReads);
}
CNLTEST_F(HwInfoConfigTestLinuxCnl, configureHwInfoIsL3HashModeEnabled) {
auto hwInfoConfig = HwInfoConfig::get(productFamily);
uint64_t oldL3CacheSizeInKb = testSysInfo.L3CacheSizeInKb;
uint32_t oldL3BankCount = testSysInfo.L3BankCount;
testSysInfo.IsL3HashModeEnabled = true;
drm->StoredSSVal = 9;
int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_EQ((oldL3BankCount - 1), outHwInfo.pSysInfo->L3BankCount);
EXPECT_EQ_VAL((oldL3CacheSizeInKb - 256), outHwInfo.pSysInfo->L3CacheSizeInKb);
}
template <typename T>
class CnlHwInfoTests : public ::testing::Test {
};
typedef ::testing::Types<CNL_2x5x8, CNL_2x4x8, CNL_1x3x8, CNL_1x2x8, CNL_4x9x8> cnlTestTypes;
TYPED_TEST_CASE(CnlHwInfoTests, cnlTestTypes);
TYPED_TEST(CnlHwInfoTests, gtSetupIsCorrect) {
GT_SYSTEM_INFO gtSystemInfo;
memset(&gtSystemInfo, 0, sizeof(gtSystemInfo));
TypeParam::setupGtSystemInfo(&gtSystemInfo);
EXPECT_GT(gtSystemInfo.EUCount, 0u);
EXPECT_GT(gtSystemInfo.ThreadCount, 0u);
EXPECT_GT(gtSystemInfo.SliceCount, 0u);
EXPECT_GT(gtSystemInfo.SubSliceCount, 0u);
EXPECT_GT_VAL(gtSystemInfo.L3CacheSizeInKb, 0u);
EXPECT_EQ(gtSystemInfo.CsrSizeInMb, 8u);
EXPECT_FALSE(gtSystemInfo.IsDynamicallyPopulated);
}

View File

@ -0,0 +1,76 @@
/*
* 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 "unit_tests/helpers/debug_manager_state_restore.h"
#include "unit_tests/source_level_debugger/source_level_debugger_preamble_test.h"
#include "gtest/gtest.h"
using namespace OCLRT;
typedef CNLFamily GfxFamily;
#include "unit_tests/source_level_debugger/source_level_debugger_preamble_test.inl"
using PreambleTestGen10 = ::testing::Test;
GEN10TEST_F(PreambleTestGen10, givenMidThreadPreemptionAndDebuggingActiveWhenPreambleIsPrograamedThenCorrectSipKernelIsUsed) {
SourceLevelDebuggerPreambleTest<FamilyType>::givenMidThreadPreemptionAndDebuggingActiveWhenPreambleIsPrograamedThenCorrectSipKernelIsUsedTest();
}
GEN10TEST_F(PreambleTestGen10, givenMidThreadPreemptionAndDebuggingActiveWhenPreambleSizeIsQueriedThenCorrecrSizeIsReturned) {
SourceLevelDebuggerPreambleTest<FamilyType>::givenMidThreadPreemptionAndDebuggingActiveWhenPreambleSizeIsQueriedThenCorrecrSizeIsReturnedTest();
}
GEN10TEST_F(PreambleTestGen10, givenPreemptionDisabledAndDebuggingActiveWhenPreambleIsProgrammedThenCorrectSipKernelIsUsed) {
SourceLevelDebuggerPreambleTest<FamilyType>::givenPreemptionDisabledAndDebuggingActiveWhenPreambleIsProgrammedThenCorrectSipKernelIsUsedTest();
}
GEN10TEST_F(PreambleTestGen10, givenPreemptionDisabledAndDebuggingActiveWhenPreambleSizeIsQueriedThenCorrecrSizeIsReturned) {
SourceLevelDebuggerPreambleTest<FamilyType>::givenPreemptionDisabledAndDebuggingActiveWhenPreambleSizeIsQueriedThenCorrecrSizeIsReturnedTest();
}
GEN10TEST_F(PreambleTestGen10, givenMidThreadPreemptionAndDisabledDebuggingWhenPreambleIsPrograamedThenCorrectSipKernelIsUsed) {
SourceLevelDebuggerPreambleTest<FamilyType>::givenMidThreadPreemptionAndDisabledDebuggingWhenPreambleIsPrograamedThenCorrectSipKernelIsUsedTest();
}
GEN10TEST_F(PreambleTestGen10, givenMidThreadPreemptionAndDisabledDebuggingWhenPreambleSizeIsQueriedThenCorrecrSizeIsReturned) {
SourceLevelDebuggerPreambleTest<FamilyType>::givenMidThreadPreemptionAndDisabledDebuggingWhenPreambleSizeIsQueriedThenCorrecrSizeIsReturnedTest();
}
GEN10TEST_F(PreambleTestGen10, givenDisabledPreemptionAndDisabledDebuggingWhenPreambleSizeIsQueriedThenCorrecrSizeIsReturned) {
SourceLevelDebuggerPreambleTest<FamilyType>::givenDisabledPreemptionAndDisabledDebuggingWhenPreambleSizeIsQueriedThenCorrecrSizeIsReturnedTest();
}
GEN10TEST_F(PreambleTestGen10, givenKernelDebuggingActiveAndDisabledPreemptionWhenGetAdditionalCommandsSizeIsCalledThen2MiLoadRegisterImmCmdsAndStateSipAreInlcuded) {
DebugManagerStateRestore dbgRestore;
DebugManager.flags.ForcePreemptionMode.set(static_cast<int32_t>(PreemptionMode::Disabled));
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(nullptr));
mockDevice->setSourceLevelDebuggerActive(false);
size_t withoutDebugging = PreambleHelper<FamilyType>::getAdditionalCommandsSize(*mockDevice);
mockDevice->setSourceLevelDebuggerActive(true);
size_t withDebugging = PreambleHelper<FamilyType>::getAdditionalCommandsSize(*mockDevice);
EXPECT_LT(withoutDebugging, withDebugging);
size_t diff = withDebugging - withoutDebugging;
size_t sizeExpected = sizeof(typename FamilyType::STATE_SIP) + 2 * sizeof(typename FamilyType::MI_LOAD_REGISTER_IMM);
EXPECT_EQ(sizeExpected, diff);
}

View File

@ -0,0 +1,42 @@
/*
* 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/sampler/sampler.h"
#include "unit_tests/fixtures/device_fixture.h"
#include "unit_tests/mocks/mock_context.h"
#include "test.h"
#include <memory>
using namespace OCLRT;
typedef Test<DeviceFixture> Gen10SamplerTest;
GEN10TEST_F(Gen10SamplerTest, appendSamplerStateParamsDoesNothing) {
typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE;
std::unique_ptr<MockContext> context(new MockContext());
std::unique_ptr<SamplerHw<FamilyType>> sampler(new SamplerHw<FamilyType>(context.get(), CL_FALSE, CL_ADDRESS_NONE, CL_FILTER_NEAREST));
auto stateWithoutAppendedParams = SAMPLER_STATE::sInit();
auto stateWithAppendedParams = SAMPLER_STATE::sInit();
EXPECT_TRUE(memcmp(&stateWithoutAppendedParams, &stateWithAppendedParams, sizeof(SAMPLER_STATE)) == 0);
sampler->appendSamplerStateParams(&stateWithAppendedParams);
EXPECT_TRUE(memcmp(&stateWithoutAppendedParams, &stateWithAppendedParams, sizeof(SAMPLER_STATE)) == 0);
}

View File

@ -0,0 +1,47 @@
/*
* 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/device_queue/device_queue_hw.h"
#include "hw_cmds.h"
// Keep the order of device_enqueue.h and scheduler_definitions.h as the latter uses defines from the first one
#include "runtime/gen10/device_enqueue.h"
#include "runtime/gen10/scheduler_definitions.h"
#include "unit_tests/scheduler/scheduler_source_tests.h"
// Keep this include below scheduler_definitions.h and device_enqueue.h headers as it depends on defines defined in them
#include "unit_tests/scheduler/scheduler_source_tests.inl"
using namespace OCLRT;
typedef SchedulerSourceTest SchedulerSourceTestGen10;
GEN10TEST_F(SchedulerSourceTestGen10, GivenDeviceQueueWhenCommandsSizeIsCalculatedThenItEqualsSpaceForEachEnqueueInSchedulerKernelCode) {
givenDeviceQueueWhenCommandsSizeIsCalculatedThenItEqualsSpaceForEachEnqueueInSchedulerKernelCodeTest<FamilyType>();
}
GEN10TEST_F(SchedulerSourceTestGen10, GivenDeviceQueueWhenSlbDummyCommandsAreBuildThenSizeUsedIsCorrect) {
givenDeviceQueueWhenSlbDummyCommandsAreBuildThenSizeUsedIsCorrectTest<FamilyType>();
}
GEN10TEST_F(SchedulerSourceTestGen10, GivenDeviceQueueThenNumberOfEnqueuesEqualsNumberOfEnqueuesInSchedulerKernelCode) {
givenDeviceQueueThenNumberOfEnqueuesEqualsNumberOfEnqueuesInSchedulerKernelCodeTest<FamilyType>();
}

View File

@ -0,0 +1,114 @@
/*
* 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/helpers/hw_helper.h"
#include "unit_tests/fixtures/device_fixture.h"
#include "test.h"
using namespace OCLRT;
typedef Test<DeviceFixture> Gen10DeviceCaps;
GEN10TEST_F(Gen10DeviceCaps, reportsOcl21) {
const auto &caps = pDevice->getDeviceInfo();
EXPECT_STREQ("OpenCL 2.1 NEO ", caps.clVersion);
EXPECT_STREQ("OpenCL C 2.0 ", caps.clCVersion);
}
GEN10TEST_F(Gen10DeviceCaps, allSkusSupportFP64) {
const auto &caps = pDevice->getDeviceInfo();
std::string extensionString = caps.deviceExtensions;
EXPECT_NE(std::string::npos, extensionString.find(std::string("cl_khr_fp64")));
EXPECT_NE(0u, caps.doubleFpConfig);
}
GEN10TEST_F(Gen10DeviceCaps, allSkusSupportCorrectlyRoundedDivideSqrt) {
const auto &caps = pDevice->getDeviceInfo();
EXPECT_NE(0u, caps.singleFpConfig & CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT);
}
GEN10TEST_F(Gen10DeviceCaps, defaultPreemptionMode) {
EXPECT_EQ(PreemptionMode::MidThread, pDevice->getHardwareInfo().capabilityTable.defaultPreemptionMode);
}
GEN10TEST_F(Gen10DeviceCaps, whitelistedRegisters) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.whitelistedRegisters.csChicken1_0x2580);
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.whitelistedRegisters.chicken0hdc_0xE5F0);
}
GEN10TEST_F(Gen10DeviceCaps, profilingTimerResolution) {
const auto &caps = pDevice->getDeviceInfo();
EXPECT_EQ(83u, caps.outProfilingTimerResolution);
}
GEN10TEST_F(Gen10DeviceCaps, compression) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrCompression);
}
GEN10TEST_F(Gen10DeviceCaps, givenHwInfoWhenRequestedComputeUnitsUsedForScratchThenReturnValidValue) {
const auto &hwInfo = pDevice->getHardwareInfo();
auto &hwHelper = HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily);
uint32_t expectedValue = hwInfo.pSysInfo->MaxSubSlicesSupported * hwInfo.pSysInfo->MaxEuPerSubSlice *
hwInfo.pSysInfo->ThreadCount / hwInfo.pSysInfo->EUCount;
EXPECT_EQ(expectedValue, hwHelper.getComputeUnitsUsedForScratch(&hwInfo));
EXPECT_EQ(expectedValue, pDevice->getDeviceInfo().computeUnitsUsedForScratch);
}
typedef Test<DeviceFixture> CnlUsDeviceIdTest;
CNLTEST_F(CnlUsDeviceIdTest, isSimulationCap) {
unsigned short cnlSimulationIds[6] = {
ICNL_3x8_DESK_DEVICE_F0_ID,
ICNL_5x8_DESK_DEVICE_F0_ID,
ICNL_9x8_DESK_DEVICE_F0_ID,
ICNL_13x8_DESK_DEVICE_F0_ID,
0, // default, non-simulation
};
OCLRT::MockDevice *mockDevice = nullptr;
for (auto id : cnlSimulationIds) {
mockDevice = createWithUsDeviceId(id);
ASSERT_NE(mockDevice, nullptr);
if (id == 0)
EXPECT_FALSE(mockDevice->isSimulation());
else
EXPECT_TRUE(mockDevice->isSimulation());
delete mockDevice;
}
}
CNLTEST_F(CnlUsDeviceIdTest, kmdNotifyMechanism) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableKmdNotify);
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleep);
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits);
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds);
}
CNLTEST_F(CnlUsDeviceIdTest, GivenCNLWhenCheckftr64KBpagesThenTrue) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.ftr64KBpages);
}

View File

@ -0,0 +1,69 @@
/*
* 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/context/context.h"
#include "unit_tests/fixtures/device_host_queue_fixture.h"
#include "unit_tests/helpers/hw_parse.h"
#include "unit_tests/mocks/mock_device_queue.h"
using namespace OCLRT;
using namespace DeviceHostQueue;
typedef DeviceQueueHwTest Gen10DeviceQueueSlb;
GEN10TEST_F(Gen10DeviceQueueSlb, expectedAllocationSize) {
deviceQueue = createQueueObject();
ASSERT_NE(deviceQueue, nullptr);
auto expectedSize = getMinimumSlbSize<FamilyType>();
expectedSize *= 128; //num of enqueues
expectedSize += sizeof(typename FamilyType::MI_BATCH_BUFFER_START);
expectedSize = alignUp(expectedSize, MemoryConstants::pageSize);
expectedSize += MockDeviceQueueHw<FamilyType>::getExecutionModelCleanupSectionSize();
expectedSize += (4 * MemoryConstants::pageSize);
expectedSize = alignUp(expectedSize, MemoryConstants::pageSize);
ASSERT_NE(deviceQueue->getSlbBuffer(), nullptr);
EXPECT_EQ(deviceQueue->getSlbBuffer()->getUnderlyingBufferSize(), expectedSize);
delete deviceQueue;
}
GEN10TEST_F(Gen10DeviceQueueSlb, SlbCommandsWa) {
auto mockDeviceQueueHw = new MockDeviceQueueHw<FamilyType>(pContext, device,
DeviceHostQueue::deviceQueueProperties::minimumProperties[0]);
EXPECT_FALSE(mockDeviceQueueHw->arbCheckWa);
EXPECT_FALSE(mockDeviceQueueHw->pipeControlWa);
EXPECT_FALSE(mockDeviceQueueHw->miAtomicWa);
EXPECT_FALSE(mockDeviceQueueHw->lriWa);
delete mockDeviceQueueHw;
}
GEN10TEST_F(DeviceQueueHwTest, CSPrefetchSizeWA) {
EXPECT_EQ(612u, DeviceQueueHw<FamilyType>::getCSPrefetchSize());
auto mockDeviceQueueHw = new MockDeviceQueueHw<FamilyType>(pContext, device,
DeviceHostQueue::deviceQueueProperties::minimumProperties[0]);
EXPECT_EQ(752u, mockDeviceQueueHw->getMinimumSlbSize() + mockDeviceQueueHw->getWaCommandsSize());
delete mockDeviceQueueHw;
}

View File

@ -0,0 +1,43 @@
/*
* 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/helpers/options.h"
#include "unit_tests/fixtures/platform_fixture.h"
#include "test.h"
using namespace OCLRT;
struct Gen10PlatformCaps : public PlatformFixture, public ::testing::Test {
void SetUp() override {
PlatformFixture::SetUp(numPlatformDevices, platformDevices);
}
void TearDown() override {
PlatformFixture::TearDown();
}
};
GEN10TEST_F(Gen10PlatformCaps, hpSkusSupportFP64) {
const auto &caps = pPlatform->getPlatformInfo();
EXPECT_NE(std::string::npos, caps.extensions.find(std::string("cl_khr_fp64")));
}

View File

@ -0,0 +1,200 @@
/*
* 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 "reg_configs_common.h"
#include "runtime/command_stream/preemption.h"
#include "runtime/gen10/reg_configs.h"
#include "unit_tests/helpers/debug_manager_state_restore.h"
#include "unit_tests/preamble/preamble_fixture.h"
#include "runtime/command_stream/preemption.h"
namespace OCLRT {
struct HardwareInfo;
extern const HardwareInfo **platformDevices;
} // namespace OCLRT
using namespace OCLRT;
typedef PreambleFixture CnlSlm;
CNLTEST_F(CnlSlm, shouldBeEnabledOnGen10) {
typedef CNLFamily::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
LinearStream &cs = linearStream;
uint32_t l3Config = PreambleHelper<FamilyType>::getL3Config(**platformDevices, true);
PreambleHelper<CNLFamily>::programL3(&cs, l3Config);
parseCommands<CNLFamily>(cs);
auto itorLRI = find<MI_LOAD_REGISTER_IMM *>(cmdList.begin(), cmdList.end());
ASSERT_NE(cmdList.end(), itorLRI);
const auto &lri = *reinterpret_cast<MI_LOAD_REGISTER_IMM *>(*itorLRI);
auto RegisterOffset = L3CNTLRegisterOffset<FamilyType>::registerOffset;
EXPECT_EQ(RegisterOffset, lri.getRegisterOffset());
EXPECT_EQ(1u, lri.getDataDword() & 1);
}
struct CnlPreambleWaCmds : public PreambleFixture {
CnlPreambleWaCmds() {
memset(reinterpret_cast<void *>(&waTable), 0, sizeof(waTable));
}
void SetUp() override {
pHwInfo = const_cast<HardwareInfo *>(*OCLRT::platformDevices);
pOldWaTable = pHwInfo->pWaTable;
pHwInfo->pWaTable = &waTable;
DeviceFixture::SetUpImpl(pHwInfo);
HardwareParse::SetUp();
if (pDevice->getPreemptionMode() == PreemptionMode::MidThread) {
preemptionLocation.reset(new GraphicsAllocation(nullptr, 0));
}
}
void TearDown() override {
preemptionLocation.reset();
pHwInfo->pWaTable = pOldWaTable;
HardwareParse::TearDown();
DeviceFixture::TearDown();
}
WorkaroundTable waTable;
HardwareInfo *pHwInfo;
const WorkaroundTable *pOldWaTable;
std::unique_ptr<GraphicsAllocation> preemptionLocation;
};
typedef PreambleFixture Gen10UrbEntryAllocationSize;
CNLTEST_F(Gen10UrbEntryAllocationSize, getUrbEntryAllocationSize) {
uint32_t actualVal = PreambleHelper<FamilyType>::getUrbEntryAllocationSize();
EXPECT_EQ(1024u, actualVal);
}
typedef PreambleVfeState Gen10PreambleVfeState;
CNLTEST_F(Gen10PreambleVfeState, WaOff) {
typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL;
testWaTable.waSendMIFLUSHBeforeVFE = 0;
LinearStream &cs = linearStream;
PreambleHelper<FamilyType>::programVFEState(&linearStream, **platformDevices, 0, 0);
parseCommands<FamilyType>(cs);
auto itorPC = find<PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
ASSERT_NE(cmdList.end(), itorPC);
const auto &pc = *reinterpret_cast<PIPE_CONTROL *>(*itorPC);
EXPECT_FALSE(pc.getRenderTargetCacheFlushEnable());
EXPECT_FALSE(pc.getDepthCacheFlushEnable());
EXPECT_FALSE(pc.getDcFlushEnable());
EXPECT_EQ(1u, pc.getCommandStreamerStallEnable());
}
CNLTEST_F(Gen10PreambleVfeState, WaOn) {
typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL;
testWaTable.waSendMIFLUSHBeforeVFE = 1;
LinearStream &cs = linearStream;
PreambleHelper<FamilyType>::programVFEState(&linearStream, **platformDevices, 0, 0);
parseCommands<FamilyType>(cs);
auto itorPC = find<PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
ASSERT_NE(cmdList.end(), itorPC);
const auto &pc = *reinterpret_cast<PIPE_CONTROL *>(*itorPC);
EXPECT_TRUE(pc.getRenderTargetCacheFlushEnable());
EXPECT_TRUE(pc.getDepthCacheFlushEnable());
EXPECT_TRUE(pc.getDcFlushEnable());
EXPECT_EQ(1u, pc.getCommandStreamerStallEnable());
}
TEST(L3CNTLREGConfig, checkValidValues) {
uint32_t validCNLNoSLMConfigs[] = {0x80000180, 0x00418180, 0x00420160, 0x00030140, 0xc0000140, 0x00428140};
uint32_t validCNLSLMConfigs[] = {0, 0xa0000121, 0x01008121, 0xc0000101};
bool noSLMConfigValid = false;
bool SLMConfigValid = false;
for (uint32_t i = 0; i < sizeof(validCNLNoSLMConfigs) / sizeof(validCNLNoSLMConfigs[0]); i++) {
if (L3CNTLREGConfig<IGFX_CANNONLAKE>::valueForNoSLM == validCNLNoSLMConfigs[i]) {
noSLMConfigValid = true;
break;
}
}
for (uint32_t i = 1; i < sizeof(validCNLSLMConfigs) / sizeof(validCNLSLMConfigs[0]); i++) {
if (L3CNTLREGConfig<IGFX_CANNONLAKE>::valueForSLM == validCNLSLMConfigs[i]) {
SLMConfigValid = true;
break;
}
}
EXPECT_TRUE(SLMConfigValid);
EXPECT_TRUE(noSLMConfigValid);
}
typedef PreambleFixture PreemptionWatermarkGen10;
GEN10TEST_F(PreemptionWatermarkGen10, givenPreambleWhenPreambleWorkAroundsIsProgrammedThenPreemptionWatermarkIsDisabled) {
typedef CNLFamily::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
typedef CNLFamily::PIPE_CONTROL PIPE_CONTROL;
PreambleHelper<FamilyType>::programGenSpecificPreambleWorkArounds(&linearStream, **platformDevices);
parseCommands<FamilyType>(linearStream);
auto cmd = findMmioCmd<FamilyType>(cmdList.begin(), cmdList.end(), FfSliceCsChknReg2::address);
ASSERT_NE(nullptr, cmd);
EXPECT_EQ(FfSliceCsChknReg2::regVal, cmd->getDataDword());
size_t expectedSize = PreemptionHelper::getRequiredPreambleSize<FamilyType>(MockDevice(*platformDevices[0])) + sizeof(MI_LOAD_REGISTER_IMM);
EXPECT_EQ(expectedSize, PreambleHelper<FamilyType>::getAdditionalCommandsSize(MockDevice(*platformDevices[0])));
}
typedef PreambleFixture ThreadArbitrationGen10;
GEN10TEST_F(ThreadArbitrationGen10, givenPreambleWhenItIsProgrammedThenThreadArbitrationIsSet) {
DebugManagerStateRestore dbgRestore;
DebugManager.flags.ForcePreemptionMode.set(static_cast<int32_t>(PreemptionMode::Disabled));
typedef CNLFamily::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
typedef CNLFamily::PIPE_CONTROL PIPE_CONTROL;
LinearStream &cs = linearStream;
uint32_t l3Config = PreambleHelper<FamilyType>::getL3Config(**platformDevices, true);
MockDevice mockDevice(**platformDevices);
PreambleHelper<FamilyType>::programPreamble(&linearStream, mockDevice, l3Config,
ThreadArbitrationPolicy::RoundRobin,
nullptr);
parseCommands<FamilyType>(cs);
auto ppC = find<PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
ASSERT_NE(ppC, cmdList.end());
auto cmd = findMmioCmd<FamilyType>(cmdList.begin(), cmdList.end(), RowChickenReg4::address);
ASSERT_NE(nullptr, cmd);
EXPECT_EQ(RowChickenReg4::regDataForArbitrationPolicy[ThreadArbitrationPolicy::RoundRobin], cmd->getDataDword());
EXPECT_EQ(sizeof(MI_LOAD_REGISTER_IMM), PreambleHelper<CNLFamily>::getAdditionalCommandsSize(MockDevice(*platformDevices[0])));
EXPECT_EQ(sizeof(MI_LOAD_REGISTER_IMM) + sizeof(PIPE_CONTROL), PreambleHelper<CNLFamily>::getThreadArbitrationCommandsSize());
}
GEN10TEST_F(ThreadArbitrationGen10, defaultArbitrationPolicy) {
EXPECT_EQ(ThreadArbitrationPolicy::RoundRobinAfterDependency, PreambleHelper<CNLFamily>::getDefaultThreadArbitrationPolicy());
}

View File

@ -0,0 +1,311 @@
/*
* 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/built_ins/built_ins.h"
#include "runtime/command_stream/preemption.h"
#include "unit_tests/command_queue/enqueue_fixture.h"
#include "unit_tests/fixtures/preemption_fixture.h"
#include "unit_tests/helpers/hw_parse.h"
#include "unit_tests/mocks/mock_command_queue.h"
#include "unit_tests/mocks/mock_csr.h"
#include "unit_tests/mocks/mock_buffer.h"
#include "unit_tests/mocks/mock_submissions_aggregator.h"
namespace OCLRT {
template <>
void HardwareParse::findCsrBaseAddress<CNLFamily>() {
typedef typename GEN10::GPGPU_CSR_BASE_ADDRESS GPGPU_CSR_BASE_ADDRESS;
itorGpgpuCsrBaseAddress = find<GPGPU_CSR_BASE_ADDRESS *>(cmdList.begin(), itorWalker);
if (itorGpgpuCsrBaseAddress != itorWalker) {
cmdGpgpuCsrBaseAddress = *itorGpgpuCsrBaseAddress;
}
}
} // namespace OCLRT
using namespace OCLRT;
using Gen10PreemptionTests = DevicePreemptionTests;
using Gen10PreemptionEnqueueKernelTest = PreemptionEnqueueKernelTest;
using Gen10MidThreadPreemptionEnqueueKernelTest = MidThreadPreemptionEnqueueKernelTest;
using Gen10ThreadGroupPreemptionEnqueueKernelTest = ThreadGroupPreemptionEnqueueKernelTest;
template <>
PreemptionTestHwDetails GetPreemptionTestHwDetails<CNLFamily>() {
PreemptionTestHwDetails ret;
ret.modeToRegValueMap[PreemptionMode::ThreadGroup] = DwordBuilder::build(1, true) | DwordBuilder::build(2, true, false);
ret.modeToRegValueMap[PreemptionMode::MidBatch] = DwordBuilder::build(2, true) | DwordBuilder::build(1, true, false);
ret.modeToRegValueMap[PreemptionMode::MidThread] = DwordBuilder::build(2, true, false) | DwordBuilder::build(1, true, false);
ret.defaultRegValue = ret.modeToRegValueMap[PreemptionMode::MidBatch];
ret.regAddress = 0x2580u;
return ret;
}
GEN10TEST_F(Gen10PreemptionTests, whenMidThreadPreemptionIsNotAvailableThenDoesNotProgramPreamble) {
device->setPreemptionMode(PreemptionMode::ThreadGroup);
size_t requiredSize = PreemptionHelper::getRequiredPreambleSize<FamilyType>(*device);
EXPECT_EQ(0U, requiredSize);
LinearStream cmdStream{nullptr, 0};
PreemptionHelper::programPreamble<FamilyType>(cmdStream, *device, nullptr);
EXPECT_EQ(0U, cmdStream.getUsed());
}
GEN10TEST_F(Gen10PreemptionTests, whenMidThreadPreemptionIsAvailableThenProgramsPreamble) {
using GPGPU_CSR_BASE_ADDRESS = typename FamilyType::GPGPU_CSR_BASE_ADDRESS;
using STATE_SIP = typename FamilyType::STATE_SIP;
device->setPreemptionMode(PreemptionMode::MidThread);
executionEnvironment->DisableMidThreadPreemption = 0;
size_t minCsrSize = device->getHardwareInfo().pSysInfo->CsrSizeInMb * MemoryConstants::megaByte;
uint64_t minCsrAlignment = 2 * 256 * MemoryConstants::kiloByte;
MockGraphicsAllocation csrSurface((void *)minCsrAlignment, minCsrSize);
// verify preamble programming
size_t requiredPreambleSize = PreemptionHelper::getRequiredPreambleSize<FamilyType>(*device);
size_t expectedPreambleSize = sizeof(GPGPU_CSR_BASE_ADDRESS) + sizeof(STATE_SIP);
EXPECT_EQ(expectedPreambleSize, requiredPreambleSize);
StackVec<char, 8192> preambleStorage(requiredPreambleSize);
ASSERT_LE(requiredPreambleSize, preambleStorage.size());
LinearStream preambleCmdStream{preambleStorage.begin(), preambleStorage.size()};
PreemptionHelper::programPreamble<FamilyType>(preambleCmdStream, *device, &csrSurface);
HardwareParse hwParsePreamble;
hwParsePreamble.parseCommands<FamilyType>(preambleCmdStream);
auto csrBaseAddressCmd = hwParsePreamble.getCommand<GPGPU_CSR_BASE_ADDRESS>();
ASSERT_NE(nullptr, csrBaseAddressCmd);
EXPECT_EQ(csrSurface.getGpuAddressToPatch(), csrBaseAddressCmd->getGpgpuCsrBaseAddress());
auto stateSipCmd = hwParsePreamble.getCommand<STATE_SIP>();
ASSERT_NE(nullptr, stateSipCmd);
EXPECT_EQ(BuiltIns::getInstance().getSipKernel(SipKernelType::Csr, *device).getSipAllocation()->getGpuAddressToPatch(), stateSipCmd->getSystemInstructionPointer());
}
GEN10TEST_F(Gen10ThreadGroupPreemptionEnqueueKernelTest, givenSecondEnqueueWithTheSamePreemptionRequestThenDontReprogram) {
pDevice->setPreemptionMode(PreemptionMode::ThreadGroup);
WhitelistedRegisters regs = {};
regs.csChicken1_0x2580 = true;
pDevice->setForceWhitelistedRegs(true, &regs);
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
csr.getMemoryManager()->setForce32BitAllocations(false);
csr.overrideMediaVFEStateDirty(false);
auto csrSurface = csr.getPreemptionCsrAllocation();
EXPECT_EQ(nullptr, csrSurface);
HardwareParse hwParser;
size_t off[3] = {0, 0, 0};
size_t gws[3] = {1, 1, 1};
MockKernelWithInternals mockKernel(*pDevice);
pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, off, gws, nullptr, 0, nullptr, nullptr);
hwParser.parseCommands<FamilyType>(csr.commandStream);
hwParser.findHardwareCommands<FamilyType>();
auto offset = csr.commandStream.getUsed();
bool foundOne = false;
for (auto it : hwParser.lriList) {
auto cmd = genCmdCast<typename FamilyType::MI_LOAD_REGISTER_IMM *>(it);
if (cmd->getRegisterOffset() == 0x2580u) {
EXPECT_FALSE(foundOne);
foundOne = true;
}
}
EXPECT_TRUE(foundOne);
hwParser.cmdList.clear();
hwParser.lriList.clear();
pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, off, gws, nullptr, 0, nullptr, nullptr);
hwParser.parseCommands<FamilyType>(csr.commandStream, offset);
hwParser.findHardwareCommands<FamilyType>();
for (auto it : hwParser.lriList) {
auto cmd = genCmdCast<typename FamilyType::MI_LOAD_REGISTER_IMM *>(it);
EXPECT_FALSE(cmd->getRegisterOffset() == 0x2580u);
}
}
GEN10TEST_F(Gen10PreemptionEnqueueKernelTest, givenValidKernelForPreemptionWhenEnqueueKernelCalledThenPassDevicePreemptionMode) {
pDevice->setPreemptionMode(PreemptionMode::ThreadGroup);
WhitelistedRegisters regs = {};
regs.csChicken1_0x2580 = true;
pDevice->setForceWhitelistedRegs(true, &regs);
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
pDevice->resetCommandStreamReceiver(mockCsr);
MockKernelWithInternals mockKernel(*pDevice);
EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(*pDevice, mockKernel.mockKernel));
size_t gws[3] = {1, 0, 0};
pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr);
pCmdQ->flush();
EXPECT_EQ(1, mockCsr->flushCalledCount);
EXPECT_EQ(PreemptionMode::ThreadGroup, mockCsr->passedDispatchFlags.preemptionMode);
}
GEN10TEST_F(Gen10PreemptionEnqueueKernelTest, givenValidKernelForPreemptionWhenEnqueueKernelCalledAndBlockedThenPassDevicePreemptionMode) {
pDevice->setPreemptionMode(PreemptionMode::ThreadGroup);
WhitelistedRegisters regs = {};
regs.csChicken1_0x2580 = true;
pDevice->setForceWhitelistedRegs(true, &regs);
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
pDevice->resetCommandStreamReceiver(mockCsr);
MockKernelWithInternals mockKernel(*pDevice);
EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(*pDevice, mockKernel.mockKernel));
UserEvent userEventObj;
cl_event userEvent = &userEventObj;
size_t gws[3] = {1, 0, 0};
pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 1, &userEvent, nullptr);
pCmdQ->flush();
EXPECT_EQ(0, mockCsr->flushCalledCount);
userEventObj.setStatus(CL_COMPLETE);
pCmdQ->flush();
EXPECT_EQ(1, mockCsr->flushCalledCount);
EXPECT_EQ(PreemptionMode::ThreadGroup, mockCsr->passedDispatchFlags.preemptionMode);
}
GEN10TEST_F(Gen10MidThreadPreemptionEnqueueKernelTest, givenSecondEnqueueWithTheSamePreemptionRequestThenDontReprogramMidThread) {
typedef typename FamilyType::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
typedef typename FamilyType::GPGPU_CSR_BASE_ADDRESS GPGPU_CSR_BASE_ADDRESS;
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
csr.getMemoryManager()->setForce32BitAllocations(false);
csr.overrideMediaVFEStateDirty(false);
auto csrSurface = csr.getPreemptionCsrAllocation();
ASSERT_NE(nullptr, csrSurface);
HardwareParse hwParser;
size_t off[3] = {0, 0, 0};
size_t gws[3] = {1, 1, 1};
MockKernelWithInternals mockKernel(*pDevice);
pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, off, gws, nullptr, 0, nullptr, nullptr);
hwParser.parseCommands<FamilyType>(csr.commandStream);
hwParser.findHardwareCommands<FamilyType>();
auto offset = csr.commandStream.getUsed();
bool foundOneLri = false;
for (auto it : hwParser.lriList) {
auto cmdLri = genCmdCast<MI_LOAD_REGISTER_IMM *>(it);
if (cmdLri->getRegisterOffset() == 0x2580u) {
EXPECT_FALSE(foundOneLri);
foundOneLri = true;
}
}
EXPECT_TRUE(foundOneLri);
hwParser.findCsrBaseAddress<FamilyType>();
ASSERT_NE(nullptr, hwParser.cmdGpgpuCsrBaseAddress);
auto cmdCsr = genCmdCast<GPGPU_CSR_BASE_ADDRESS *>(hwParser.cmdGpgpuCsrBaseAddress);
ASSERT_NE(nullptr, cmdCsr);
EXPECT_EQ(csrSurface->getGpuAddressToPatch(), cmdCsr->getGpgpuCsrBaseAddress());
hwParser.cmdList.clear();
hwParser.lriList.clear();
hwParser.cmdGpgpuCsrBaseAddress = nullptr;
pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, off, gws, nullptr, 0, nullptr, nullptr);
hwParser.parseCommands<FamilyType>(csr.commandStream, offset);
hwParser.findHardwareCommands<FamilyType>();
for (auto it : hwParser.lriList) {
auto cmd = genCmdCast<MI_LOAD_REGISTER_IMM *>(it);
EXPECT_FALSE(cmd->getRegisterOffset() == 0x2580u);
}
hwParser.findCsrBaseAddress<FamilyType>();
EXPECT_EQ(nullptr, hwParser.cmdGpgpuCsrBaseAddress);
}
GEN10TEST_F(Gen10PreemptionEnqueueKernelTest, givenDisabledPreemptionWhenEnqueueKernelCalledThenPassDisabledPreemptionMode) {
pDevice->setPreemptionMode(PreemptionMode::Disabled);
WhitelistedRegisters regs = {};
pDevice->setForceWhitelistedRegs(true, &regs);
auto mockCsr = new MockCsrHw2<FamilyType>(pDevice->getHardwareInfo());
pDevice->resetCommandStreamReceiver(mockCsr);
MockKernelWithInternals mockKernel(*pDevice);
EXPECT_EQ(PreemptionMode::Disabled, PreemptionHelper::taskPreemptionMode(*pDevice, mockKernel.mockKernel));
size_t gws[3] = {1, 0, 0};
pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr);
pCmdQ->flush();
EXPECT_EQ(1, mockCsr->flushCalledCount);
EXPECT_EQ(PreemptionMode::Disabled, mockCsr->passedDispatchFlags.preemptionMode);
}
GEN10TEST_F(Gen10PreemptionTests, getRequiredCmdQSize) {
size_t expectedSize = 0;
EXPECT_EQ(expectedSize, PreemptionHelper::getPreemptionWaCsSize<FamilyType>(*device));
}
GEN10TEST_F(Gen10PreemptionTests, applyPreemptionWaCmds) {
size_t usedSize = 0;
auto &cmdStream = cmdQ->getCS(0);
PreemptionHelper::applyPreemptionWaCmdsBegin<FamilyType>(&cmdStream, *device);
EXPECT_EQ(usedSize, cmdStream.getUsed());
PreemptionHelper::applyPreemptionWaCmdsEnd<FamilyType>(&cmdStream, *device);
EXPECT_EQ(usedSize, cmdStream.getUsed());
}
GEN10TEST_F(Gen10PreemptionTests, givenInterfaceDescriptorDataWhenMidThreadPreemptionModeThenSetDisableThreadPreemptionBitToDisable) {
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
INTERFACE_DESCRIPTOR_DATA iddArg;
iddArg = FamilyType::cmdInitInterfaceDescriptorData;
iddArg.setThreadPreemptionDisable(INTERFACE_DESCRIPTOR_DATA::THREAD_PREEMPTION_DISABLE_ENABLE);
PreemptionHelper::programInterfaceDescriptorDataPreemption<FamilyType>(&iddArg, PreemptionMode::MidThread);
EXPECT_EQ(INTERFACE_DESCRIPTOR_DATA::THREAD_PREEMPTION_DISABLE_DISABLE, iddArg.getThreadPreemptionDisable());
}
GEN10TEST_F(Gen10PreemptionTests, givenInterfaceDescriptorDataWhenNoMidThreadPreemptionModeThenSetDisableThreadPreemptionBitToEnable) {
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
INTERFACE_DESCRIPTOR_DATA iddArg;
iddArg = FamilyType::cmdInitInterfaceDescriptorData;
iddArg.setThreadPreemptionDisable(INTERFACE_DESCRIPTOR_DATA::THREAD_PREEMPTION_DISABLE_DISABLE);
PreemptionHelper::programInterfaceDescriptorDataPreemption<FamilyType>(&iddArg, PreemptionMode::Disabled);
EXPECT_EQ(INTERFACE_DESCRIPTOR_DATA::THREAD_PREEMPTION_DISABLE_ENABLE, iddArg.getThreadPreemptionDisable());
iddArg.setThreadPreemptionDisable(INTERFACE_DESCRIPTOR_DATA::THREAD_PREEMPTION_DISABLE_DISABLE);
PreemptionHelper::programInterfaceDescriptorDataPreemption<FamilyType>(&iddArg, PreemptionMode::MidBatch);
EXPECT_EQ(INTERFACE_DESCRIPTOR_DATA::THREAD_PREEMPTION_DISABLE_ENABLE, iddArg.getThreadPreemptionDisable());
iddArg.setThreadPreemptionDisable(INTERFACE_DESCRIPTOR_DATA::THREAD_PREEMPTION_DISABLE_DISABLE);
PreemptionHelper::programInterfaceDescriptorDataPreemption<FamilyType>(&iddArg, PreemptionMode::ThreadGroup);
EXPECT_EQ(INTERFACE_DESCRIPTOR_DATA::THREAD_PREEMPTION_DISABLE_ENABLE, iddArg.getThreadPreemptionDisable());
}

View File

@ -0,0 +1,40 @@
/*
* 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 "unit_tests/fixtures/device_fixture.h"
#include "test.h"
using namespace OCLRT;
typedef Test<DeviceFixture> CannonlakeOnlyTest;
CNLTEST_F(CannonlakeOnlyTest, shouldPassOnCnl) {
EXPECT_EQ(IGFX_CANNONLAKE, pDevice->getHardwareInfo().pPlatform->eProductFamily);
}
typedef Test<DeviceFixture> Gen10OnlyTest;
GEN10TEST_F(Gen10OnlyTest, shouldPassOnGen10) {
EXPECT_NE(IGFX_GEN8_CORE, pDevice->getRenderCoreFamily());
EXPECT_NE(IGFX_GEN9_CORE, pDevice->getRenderCoreFamily());
EXPECT_EQ(IGFX_GEN10_CORE, pDevice->getRenderCoreFamily());
}

View File

@ -0,0 +1,30 @@
# 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.
set(IGDRCL_SRCS_tests_gen10_windows
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/os_interface_tests_gen10.cpp
${CMAKE_CURRENT_SOURCE_DIR}/translationtable_callbacks_tests_gen10.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wddm_mapper_tests_gen10.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_tests_gen10.cpp
)
if(WIN32)
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_gen10_windows})
endif()

View File

@ -0,0 +1,38 @@
/*
* 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/os_interface/windows/os_interface.h"
#include "unit_tests/os_interface/windows/hw_info_config_win_tests.h"
using namespace OCLRT;
using namespace std;
using HwInfoConfigTestWindowsCnl = HwInfoConfigTestWindows;
CNLTEST_F(HwInfoConfigTestWindowsCnl, whenCallAdjustPlatformThenDoNothing) {
EXPECT_EQ(IGFX_CANNONLAKE, productFamily);
auto hwInfoConfig = HwInfoConfig::get(productFamily);
hwInfoConfig->adjustPlatformForProductFamily(&testHwInfo);
int ret = memcmp(outHwInfo.pPlatform, testHwInfo.pPlatform, sizeof(PLATFORM));
EXPECT_EQ(0, ret);
}

View File

@ -0,0 +1,45 @@
/*
* 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 "unit_tests/os_interface/windows/os_interface_win_tests.h"
#include "unit_tests/gen_common/test.h"
typedef OsInterfaceTest OsInterfaceTestCnl;
GEN10TEST_F(OsInterfaceTestCnl, askKmdIfPreemptionRegisterWhitelisted) {
HardwareInfo *hwInfo = nullptr;
const HardwareInfo *refHwinfo = *platformDevices;
size_t numDevices = 0;
bool success = DeviceFactory::getDevices(&hwInfo, numDevices);
EXPECT_TRUE(success);
for (size_t i = 0u; i < numDevices; i++) {
if (hwInfo[i].pWaTable->waEnablePreemptionGranularityControlByUMD) {
EXPECT_TRUE(hwInfo[i].capabilityTable.whitelistedRegisters.csChicken1_0x2580);
} else {
EXPECT_FALSE(hwInfo[i].capabilityTable.whitelistedRegisters.csChicken1_0x2580);
}
}
DeviceFactory::releaseDevices();
}

View File

@ -0,0 +1,32 @@
/*
* 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/helpers/translationtable_callbacks.h"
#include "test.h"
using namespace OCLRT;
typedef ::testing::Test Gen10TTCallbacksTests;
GEN10TEST_F(Gen10TTCallbacksTests, notSupported) {
EXPECT_EQ(0, TTCallbacks<FamilyType>::writeL3Address(nullptr, 1, 2));
}

View File

@ -0,0 +1,47 @@
/*
* 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 "unit_tests/helpers/gtest_helpers.h"
#include "test.h"
#include "hw_cmds.h"
#include "runtime/os_interface/windows/wddm_engine_mapper.h"
using namespace OCLRT;
using namespace std;
struct WddmMapperTestsGen10 : public ::testing::Test {
void SetUp() override {}
void TearDown() override {}
};
GEN10TEST_F(WddmMapperTestsGen10, engineNodeMapPass) {
GPUNODE_ORDINAL gpuNode = GPUNODE_MAX;
bool ret = WddmEngineMapper<CNLFamily>::engineNodeMap(EngineType::ENGINE_RCS, gpuNode);
EXPECT_TRUE(ret);
EXPECT_EQ(GPUNODE_3D, gpuNode);
}
GEN10TEST_F(WddmMapperTestsGen10, engineNodeMapNegative) {
GPUNODE_ORDINAL gpuNode = GPUNODE_MAX;
bool ret = WddmEngineMapper<CNLFamily>::engineNodeMap(EngineType::ENGINE_BCS, gpuNode);
EXPECT_FALSE(ret);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Intel Corporation
* 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"),
@ -27,3 +27,6 @@
#ifdef TESTS_GEN9
#include "unit_tests/gen9/gen_cmd_parse.h"
#endif
#ifdef TESTS_GEN10
#include "unit_tests/gen10/gen_cmd_parse.h"
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Intel Corporation
* 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"),
@ -43,6 +43,13 @@ extern GFXCORE_FAMILY renderCoreFamily;
#define SKL_TYPED_TEST_BODY
#define SKL_TYPED_CMDTEST_BODY
#endif
#ifdef TESTS_GEN10
#define CNL_TYPED_TEST_BODY testBodyHw<typename OCLRT::GfxFamilyMapper<IGFX_GEN10_CORE>::GfxFamily>();
#define CNL_TYPED_CMDTEST_BODY runCmdTestHwIfSupported<typename OCLRT::GfxFamilyMapper<IGFX_GEN10_CORE>::GfxFamily>();
#else
#define CNL_TYPED_TEST_BODY
#define CNL_TYPED_CMDTEST_BODY
#endif
// Macros to provide template based testing.
// Test can use FamilyType in the test -- equivalent to SKLFamily
@ -65,6 +72,9 @@ extern GFXCORE_FAMILY renderCoreFamily;
case IGFX_GEN9_CORE: \
SKL_TYPED_TEST_BODY \
break; \
case IGFX_GEN10_CORE: \
CNL_TYPED_TEST_BODY \
break; \
default: \
ASSERT_TRUE((false && "Unknown hardware family")); \
break; \
@ -121,6 +131,9 @@ extern GFXCORE_FAMILY renderCoreFamily;
case IGFX_GEN9_CORE: \
SKL_TYPED_CMDTEST_BODY \
break; \
case IGFX_GEN10_CORE: \
CNL_TYPED_CMDTEST_BODY \
break; \
default: \
ASSERT_TRUE((false && "Unknown hardware family")); \
break; \
@ -198,6 +211,9 @@ extern GFXCORE_FAMILY renderCoreFamily;
case IGFX_GEN9_CORE: \
SKL_TYPED_TEST_BODY \
break; \
case IGFX_GEN10_CORE: \
CNL_TYPED_TEST_BODY \
break; \
default: \
ASSERT_TRUE((false && "Unknown hardware family")); \
break; \
@ -251,6 +267,9 @@ extern GFXCORE_FAMILY renderCoreFamily;
case IGFX_GEN9_CORE: \
SKL_TYPED_CMDTEST_BODY \
break; \
case IGFX_GEN10_CORE: \
CNL_TYPED_CMDTEST_BODY \
break; \
default: \
ASSERT_TRUE((false && "Unknown hardware family")); \
break; \
@ -290,11 +309,17 @@ extern GFXCORE_FAMILY renderCoreFamily;
::testing::internal::GetTypeId<test_fixture>(), \
IGFX_GEN9_CORE, IGFX_MAX_PRODUCT)
#endif
#ifdef TESTS_GEN10
#define GEN10TEST_F(test_fixture, test_name) \
FAMILYTEST_TEST_(test_fixture, test_name, test_fixture, \
::testing::internal::GetTypeId<test_fixture>(), \
IGFX_GEN10_CORE, IGFX_MAX_PRODUCT)
#endif
#ifdef TESTS_GEN8
#define BDWTEST_F(test_fixture, test_name) \
FAMILYTEST_TEST_(test_fixture, test_name, test_fixture, \
::testing::internal::GetTypeId<test_fixture>(), \
IGFX_GEN8_CORE, IGFX_BROADWELL)
IGFX_GEN8_CORE, IGFX_MAX_PRODUCT)
#endif
#ifdef TESTS_SKL
#define SKLTEST_F(test_fixture, test_name) \
@ -326,6 +351,12 @@ extern GFXCORE_FAMILY renderCoreFamily;
::testing::internal::GetTypeId<test_fixture>(), \
IGFX_GEN9_CORE, IGFX_COFFEELAKE)
#endif
#ifdef TESTS_GEN10
#define CNLTEST_F(test_fixture, test_name) \
FAMILYTEST_TEST_(test_fixture, test_name, test_fixture, \
::testing::internal::GetTypeId<test_fixture>(), \
IGFX_GEN10_CORE, IGFX_CANNONLAKE)
#endif
#define HWTEST_TYPED_TEST(CaseName, TestName) \
template <typename gtest_TypeParam_> \
class GTEST_TEST_CLASS_NAME_(CaseName, TestName) : public CaseName<gtest_TypeParam_> { \
@ -343,6 +374,9 @@ extern GFXCORE_FAMILY renderCoreFamily;
case IGFX_GEN9_CORE: \
SKL_TYPED_TEST_BODY \
break; \
case IGFX_GEN10_CORE: \
CNL_TYPED_TEST_BODY \
break; \
default: \
ASSERT_TRUE((false && "Unknown hardware family")); \
break; \

View File

@ -0,0 +1,48 @@
/*
* 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/helpers/base_object.h"
#include "unit_tests/libult/ult_command_stream_receiver.h"
namespace OCLRT {
typedef CNLFamily Family;
static auto gfxCore = IGFX_GEN10_CORE;
extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE];
template <>
void populateFactoryTable<UltCommandStreamReceiver<Family>>() {
commandStreamReceiverFactory[IGFX_MAX_CORE + gfxCore] = UltCommandStreamReceiver<Family>::create;
}
struct enableGen10 {
enableGen10() {
populateFactoryTable<UltCommandStreamReceiver<Family>>();
}
};
static enableGen10 enable;
template class UltCommandStreamReceiver<CNLFamily>;
} // namespace OCLRT