mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 13:33:02 +08:00
Switch to new compiler interface to get system routine
Related-To: NEO-4773 Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
1091a5d78b
commit
09bdd2ad09
@@ -46,23 +46,22 @@ const SipKernel &BuiltIns::getSipKernel(SipKernelType type, Device &device) {
|
||||
UNRECOVERABLE_IF(ret != TranslationOutput::ErrorCode::Success);
|
||||
UNRECOVERABLE_IF(sipBinary.size() == 0);
|
||||
|
||||
ProgramInfo programInfo;
|
||||
auto blob = ArrayRef<const uint8_t>(reinterpret_cast<const uint8_t *>(sipBinary.data()), sipBinary.size());
|
||||
SingleDeviceBinary deviceBinary = {};
|
||||
deviceBinary.deviceBinary = blob;
|
||||
std::string decodeErrors;
|
||||
std::string decodeWarnings;
|
||||
const auto allocType = GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL;
|
||||
|
||||
DecodeError decodeError;
|
||||
DeviceBinaryFormat singleDeviceBinaryFormat;
|
||||
std::tie(decodeError, singleDeviceBinaryFormat) = NEO::decodeSingleDeviceBinary(programInfo, deviceBinary, decodeErrors, decodeWarnings);
|
||||
UNRECOVERABLE_IF(DecodeError::Success != decodeError);
|
||||
AllocationProperties properties = {device.getRootDeviceIndex(), sipBinary.size(), allocType, device.getDeviceBitfield()};
|
||||
properties.flags.use32BitFrontWindow = true;
|
||||
|
||||
auto success = programInfo.kernelInfos[0]->createKernelAllocation(device, true);
|
||||
UNRECOVERABLE_IF(!success);
|
||||
auto sipAllocation = device.getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
|
||||
|
||||
sipBuiltIn.first.reset(new SipKernel(type, programInfo.kernelInfos[0]->kernelAllocation));
|
||||
programInfo.kernelInfos[0]->kernelAllocation = nullptr;
|
||||
auto &hwInfo = device.getHardwareInfo();
|
||||
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
|
||||
if (sipAllocation) {
|
||||
MemoryTransferHelper::transferMemoryToAllocation(hwHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *sipAllocation),
|
||||
device, sipAllocation, 0, sipBinary.data(),
|
||||
sipBinary.size());
|
||||
}
|
||||
sipBuiltIn.first.reset(new SipKernel(type, sipAllocation));
|
||||
};
|
||||
std::call_once(sipBuiltIn.second, initializer);
|
||||
UNRECOVERABLE_IF(sipBuiltIn.first == nullptr);
|
||||
|
||||
@@ -22,51 +22,6 @@ namespace NEO {
|
||||
|
||||
const size_t SipKernel::maxDbgSurfaceSize = 0x1800000; // proper value should be taken from compiler when it's ready
|
||||
|
||||
const char *getSipKernelCompilerInternalOptions(SipKernelType kernel) {
|
||||
switch (kernel) {
|
||||
default:
|
||||
DEBUG_BREAK_IF(true);
|
||||
return "";
|
||||
case SipKernelType::Csr:
|
||||
return "-cl-include-sip-csr";
|
||||
case SipKernelType::DbgCsr:
|
||||
return "-cl-include-sip-kernel-debug -cl-include-sip-csr -cl-set-bti:0";
|
||||
case SipKernelType::DbgCsrLocal:
|
||||
return "-cl-include-sip-kernel-local-debug -cl-include-sip-csr -cl-set-bti:0";
|
||||
}
|
||||
}
|
||||
|
||||
const char *getSipLlSrc(const Device &device) {
|
||||
#define M_DUMMY_LL_SRC \
|
||||
"define void @f() { \n" \
|
||||
" ret void \n" \
|
||||
"} \n" \
|
||||
"!opencl.compiler.options = !{!0} \n" \
|
||||
"!opencl.kernels = !{!1} \n" \
|
||||
"!0 = !{} \n" \
|
||||
"!1 = !{void()* @f, !2, !3, !4, !5, !6, !7} \n" \
|
||||
"!2 = !{!\"kernel_arg_addr_space\"} \n" \
|
||||
"!3 = !{!\"kernel_arg_access_qual\"} \n" \
|
||||
"!4 = !{!\"kernel_arg_type\"} \n" \
|
||||
"!5 = !{!\"kernel_arg_type_qual\"} \n" \
|
||||
"!6 = !{!\"kernel_arg_base_type\"} \n" \
|
||||
"!7 = !{!\"kernel_arg_name\"} \n"
|
||||
|
||||
constexpr const char *llDummySrc32 =
|
||||
"target datalayout = \"e-p:32:32:32\" \n"
|
||||
"target triple = \"spir\" \n" M_DUMMY_LL_SRC;
|
||||
|
||||
constexpr const char *llDummySrc64 =
|
||||
"target datalayout = \"e-p:64:64:64\" \n"
|
||||
"target triple = \"spir64\" \n" M_DUMMY_LL_SRC;
|
||||
|
||||
#undef M_DUMMY_LL_SRC
|
||||
|
||||
const uint32_t ptrSize = device.getDeviceInfo().force32BitAddressess ? 4 : sizeof(void *);
|
||||
|
||||
return (ptrSize == 8) ? llDummySrc64 : llDummySrc32;
|
||||
}
|
||||
|
||||
SipKernel::~SipKernel() = default;
|
||||
|
||||
SipKernel::SipKernel(SipKernelType type, GraphicsAllocation *sipAlloc) : type(type), sipAllocation(sipAlloc) {
|
||||
|
||||
@@ -17,10 +17,6 @@ namespace NEO {
|
||||
class Device;
|
||||
class GraphicsAllocation;
|
||||
|
||||
const char *getSipKernelCompilerInternalOptions(SipKernelType kernel);
|
||||
|
||||
const char *getSipLlSrc(const Device &device);
|
||||
|
||||
class SipKernel {
|
||||
public:
|
||||
SipKernel(SipKernelType type, GraphicsAllocation *sipAlloc);
|
||||
|
||||
Reference in New Issue
Block a user