mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Add static getter to retrieve platform level SIP kernel allocation
Change-Id: I2220c3b027ccb6ab52169077ef522c29476b3e68 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
877b82a8e7
commit
7b4b4eaeb1
12
core/built_ins/CMakeLists.txt
Normal file
12
core/built_ins/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
#
|
||||
# Copyright (C) 2020 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
set(NEO_CORE_BUILT_INS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sip_kernel_type.h
|
||||
)
|
||||
|
||||
set_property(GLOBAL PROPERTY NEO_CORE_BUILT_INS ${NEO_CORE_BUILT_INS})
|
21
core/built_ins/sip_kernel_type.h
Normal file
21
core/built_ins/sip_kernel_type.h
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
enum class SipKernelType : std::uint32_t {
|
||||
Csr = 0,
|
||||
DbgCsr,
|
||||
DbgCsrLocal,
|
||||
COUNT
|
||||
};
|
||||
|
||||
} // namespace NEO
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -81,8 +81,8 @@ void PreemptionHelper::programStateSip(LinearStream &preambleCmdStream, Device &
|
||||
if (isMidThreadPreemption || sourceLevelDebuggerActive) {
|
||||
auto sip = reinterpret_cast<STATE_SIP *>(preambleCmdStream.getSpace(sizeof(STATE_SIP)));
|
||||
*sip = GfxFamily::cmdInitStateSip;
|
||||
auto sipType = SipKernel::getSipKernelType(device.getHardwareInfo().platform.eRenderCoreFamily, sourceLevelDebuggerActive);
|
||||
sip->setSystemInstructionPointer(device.getExecutionEnvironment()->getBuiltIns()->getSipKernel(sipType, device).getSipAllocation()->getGpuAddressToPatch());
|
||||
auto sipAllocation = SipKernel::getSipKernelAllocation(device);
|
||||
sip->setSystemInstructionPointer(sipAllocation->getGpuAddressToPatch());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "core/built_ins/sip_kernel_type.h"
|
||||
#include "core/helpers/debug_helpers.h"
|
||||
#include "core/helpers/non_copyable_or_moveable.h"
|
||||
#include "core/helpers/vec.h"
|
||||
#include "runtime/built_ins/sip.h"
|
||||
|
||||
#include "CL/cl.h"
|
||||
#include "built_in_ops.h"
|
||||
@ -35,6 +35,7 @@ struct KernelInfo;
|
||||
struct MultiDispatchInfo;
|
||||
class Program;
|
||||
class SchedulerKernel;
|
||||
class SipKernel;
|
||||
|
||||
static constexpr ConstStringRef mediaKernelsBuildOptionsList[] = {
|
||||
"-D cl_intel_device_side_advanced_vme_enable",
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -12,7 +12,9 @@
|
||||
#include "core/helpers/ptr_math.h"
|
||||
#include "core/helpers/string.h"
|
||||
#include "core/memory_manager/graphics_allocation.h"
|
||||
#include "runtime/built_ins/built_ins.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/execution_environment/execution_environment.h"
|
||||
#include "runtime/program/kernel_info.h"
|
||||
#include "runtime/program/program.h"
|
||||
|
||||
@ -90,4 +92,10 @@ SipKernelType SipKernel::getSipKernelType(GFXCORE_FAMILY family, bool debuggingA
|
||||
auto &hwHelper = HwHelper::get(family);
|
||||
return hwHelper.getSipKernelType(debuggingActive);
|
||||
}
|
||||
|
||||
GraphicsAllocation *SipKernel::getSipKernelAllocation(Device &device) {
|
||||
auto sipType = SipKernel::getSipKernelType(device.getHardwareInfo().platform.eRenderCoreFamily, device.isSourceLevelDebuggerActive());
|
||||
return device.getExecutionEnvironment()->getBuiltIns()->getSipKernel(sipType, device).getSipAllocation();
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "core/built_ins/sip_kernel_type.h"
|
||||
#include "core/helpers/hw_info.h"
|
||||
|
||||
#include <cinttypes>
|
||||
#include <memory>
|
||||
|
||||
namespace NEO {
|
||||
@ -17,13 +17,6 @@ class Device;
|
||||
class Program;
|
||||
class GraphicsAllocation;
|
||||
|
||||
enum class SipKernelType : std::uint32_t {
|
||||
Csr = 0,
|
||||
DbgCsr,
|
||||
DbgCsrLocal,
|
||||
COUNT
|
||||
};
|
||||
|
||||
const char *getSipKernelCompilerInternalOptions(SipKernelType kernel);
|
||||
|
||||
const char *getSipLlSrc(const Device &device);
|
||||
@ -49,6 +42,7 @@ class SipKernel {
|
||||
|
||||
MOCKABLE_VIRTUAL GraphicsAllocation *getSipAllocation() const;
|
||||
static SipKernelType getSipKernelType(GFXCORE_FAMILY family, bool debuggingActive);
|
||||
static GraphicsAllocation *getSipKernelAllocation(Device &device);
|
||||
|
||||
protected:
|
||||
SipKernelType type = SipKernelType::COUNT;
|
||||
|
@ -389,8 +389,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
||||
makeResident(*preemptionAllocation);
|
||||
|
||||
if (dispatchFlags.preemptionMode == PreemptionMode::MidThread || device.isSourceLevelDebuggerActive()) {
|
||||
auto sipType = SipKernel::getSipKernelType(device.getHardwareInfo().platform.eRenderCoreFamily, device.isSourceLevelDebuggerActive());
|
||||
makeResident(*device.getExecutionEnvironment()->getBuiltIns()->getSipKernel(sipType, device).getSipAllocation());
|
||||
makeResident(*SipKernel::getSipKernelAllocation(device));
|
||||
if (debugSurface) {
|
||||
makeResident(*debugSurface);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${NEO_SOURCE_DIR}/runtime/core_files.cmake)
|
||||
|
||||
append_sources_from_properties(NEO_CORE_SOURCES
|
||||
NEO_CORE_BUILT_INS
|
||||
NEO_CORE_COMMAND_CONTAINER
|
||||
NEO_CORE_COMMAND_STREAM
|
||||
NEO_CORE_COMMANDS
|
||||
|
@ -2077,6 +2077,15 @@ TEST_F(BuiltInTests, givenSipKernelWhenItIsCreatedThenItHasGraphicsAllocationFor
|
||||
EXPECT_NE(nullptr, sipAllocation);
|
||||
}
|
||||
|
||||
TEST_F(BuiltInTests, givenSameDeviceIsUsedWhenUsingStaticGetterThenExpectRetrieveSameAllocation) {
|
||||
const SipKernel &sipKern = pDevice->getExecutionEnvironment()->getBuiltIns()->getSipKernel(SipKernelType::Csr, pContext->getDevice(0)->getDevice());
|
||||
auto sipAllocation = sipKern.getSipAllocation();
|
||||
EXPECT_NE(nullptr, sipAllocation);
|
||||
auto staticSipAllocation = SipKernel::getSipKernelAllocation(*pDevice);
|
||||
EXPECT_NE(nullptr, staticSipAllocation);
|
||||
EXPECT_EQ(sipAllocation, staticSipAllocation);
|
||||
}
|
||||
|
||||
TEST_F(BuiltInTests, givenDebugFlagForceUseSourceWhenArgIsBinaryThenReturnBuiltinCodeBinary) {
|
||||
DebugManager.flags.RebuildPrecompiledKernels.set(true);
|
||||
auto builtinsLib = std::unique_ptr<BuiltinsLib>(new BuiltinsLib());
|
||||
|
Reference in New Issue
Block a user