Skip to content

Commit 83b84b3

Browse files
Enahnce kernel debug ULTs
Mock ProgramWithKernelDebugging ULTs. This change is neccessary to ensure independence from binary format after incoming switching to zebinary format. Signed-off-by: Kacper Nowak <[email protected]> Related-To: NEO-6646
1 parent 0420df7 commit 83b84b3

File tree

7 files changed

+155
-80
lines changed

7 files changed

+155
-80
lines changed

opencl/source/program/build.cpp

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,6 @@ cl_int Program::build(
4141
UNRECOVERABLE_IF(defaultClDevice == nullptr);
4242
auto &defaultDevice = defaultClDevice->getDevice();
4343

44-
enum class BuildPhase {
45-
Init,
46-
SourceCodeNotification,
47-
BinaryCreation,
48-
BinaryProcessing,
49-
DebugDataNotification
50-
};
51-
5244
std::unordered_map<uint32_t, BuildPhase> phaseReached;
5345
for (const auto &clDevice : deviceVector) {
5446
phaseReached[clDevice->getRootDeviceIndex()] = BuildPhase::Init;
@@ -194,14 +186,7 @@ cl_int Program::build(
194186
}
195187

196188
if (isKernelDebugEnabled() || gtpinIsGTPinInitialized()) {
197-
for (auto &clDevice : deviceVector) {
198-
auto rootDeviceIndex = clDevice->getRootDeviceIndex();
199-
if (BuildPhase::DebugDataNotification == phaseReached[rootDeviceIndex]) {
200-
continue;
201-
}
202-
notifyDebuggerWithDebugData(clDevice);
203-
phaseReached[rootDeviceIndex] = BuildPhase::DebugDataNotification;
204-
}
189+
debugNotify(deviceVector, phaseReached);
205190
}
206191
} while (false);
207192

@@ -269,4 +254,15 @@ void Program::extractInternalOptions(const std::string &options, std::string &in
269254
}
270255
}
271256

257+
void Program::debugNotify(const ClDeviceVector &deviceVector, std::unordered_map<uint32_t, BuildPhase> &phasesReached) {
258+
for (auto &clDevice : deviceVector) {
259+
auto rootDeviceIndex = clDevice->getRootDeviceIndex();
260+
if (BuildPhase::DebugDataNotification == phasesReached[rootDeviceIndex]) {
261+
continue;
262+
}
263+
notifyDebuggerWithDebugData(clDevice);
264+
phasesReached[rootDeviceIndex] = BuildPhase::DebugDataNotification;
265+
}
266+
}
267+
272268
} // namespace NEO

opencl/source/program/program.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ namespace PatchTokenBinary {
3030
struct ProgramFromPatchtokens;
3131
}
3232

33+
enum class BuildPhase;
3334
class BuiltinDispatchInfoBuilder;
3435
class ClDevice;
3536
class Context;
@@ -72,6 +73,14 @@ class Program : public BaseObject<_cl_program> {
7273
public:
7374
static const cl_ulong objectMagic = 0x5651C89100AAACFELL;
7475

76+
enum class BuildPhase {
77+
Init,
78+
SourceCodeNotification,
79+
BinaryCreation,
80+
BinaryProcessing,
81+
DebugDataNotification
82+
};
83+
7584
enum class CreatedFrom {
7685
SOURCE,
7786
IL,
@@ -276,6 +285,7 @@ class Program : public BaseObject<_cl_program> {
276285
this->context = pContext;
277286
}
278287

288+
MOCKABLE_VIRTUAL void debugNotify(const ClDeviceVector &deviceVector, std::unordered_map<uint32_t, BuildPhase> &phasesReached);
279289
void notifyDebuggerWithDebugData(ClDevice *clDevice);
280290
MOCKABLE_VIRTUAL void createDebugZebin(uint32_t rootDeviceIndex);
281291
Debug::Segments getZebinSegments(uint32_t rootDeviceIndex);

opencl/test/unit_test/mocks/mock_program.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ class MockProgram : public Program {
189189
wasCreateDebugZebinCalled = true;
190190
}
191191

192+
void debugNotify(const ClDeviceVector &deviceVector, std::unordered_map<uint32_t, BuildPhase> &phasesReached) override {
193+
Program::debugNotify(deviceVector, phasesReached);
194+
wasDebuggerNotified = true;
195+
}
196+
192197
std::vector<NEO::ExternalFunctionInfo> externalFunctions;
193198
std::map<uint32_t, int> processGenBinaryCalledPerRootDevice;
194199
std::map<uint32_t, int> replaceDeviceBinaryCalledPerRootDevice;
@@ -198,6 +203,7 @@ class MockProgram : public Program {
198203
int isOptionValueValidOverride = -1;
199204
bool wasProcessDebugDataCalled = false;
200205
bool wasCreateDebugZebinCalled = false;
206+
bool wasDebuggerNotified = false;
201207
};
202208

203209
class MockProgramAppendKernelDebugOptions : public Program {

opencl/test/unit_test/program/process_elf_binary_tests.cpp

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
#include "shared/test/common/helpers/test_files.h"
1616
#include "shared/test/common/mocks/mock_device.h"
1717
#include "shared/test/common/mocks/mock_elf.h"
18+
#include "shared/test/unit_test/device_binary_format/elf/elf_tests_data.h"
1819
#include "shared/test/unit_test/device_binary_format/patchtokens_tests.h"
1920
#include "shared/test/unit_test/helpers/gtest_helpers.h"
2021

2122
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
2223
#include "opencl/test/unit_test/mocks/mock_program.h"
23-
#include "opencl/test/unit_test/test_files/patch_list.h"
2424

2525
#include "compiler_options.h"
2626
#include "gtest/gtest.h"
@@ -29,52 +29,6 @@
2929

3030
using namespace NEO;
3131

32-
enum class enabledIrFormat {
33-
NONE,
34-
ENABLE_SPIRV,
35-
ENABLE_LLVM
36-
};
37-
38-
template <enabledIrFormat irFormat = enabledIrFormat::NONE>
39-
struct MockElfBinaryPatchtokens {
40-
MockElfBinaryPatchtokens(const HardwareInfo &hwInfo) : MockElfBinaryPatchtokens(std::string{}, hwInfo){};
41-
MockElfBinaryPatchtokens(const std::string &buildOptions, const HardwareInfo &hwInfo) {
42-
mockDevBinaryHeader.Device = hwInfo.platform.eRenderCoreFamily;
43-
mockDevBinaryHeader.GPUPointerSizeInBytes = sizeof(void *);
44-
mockDevBinaryHeader.Version = iOpenCL::CURRENT_ICBE_VERSION;
45-
constexpr size_t mockDevBinaryDataSize = sizeof(mockDevBinaryHeader) + mockDataSize;
46-
constexpr size_t mockSpirvBinaryDataSize = sizeof(spirvMagic) + mockDataSize;
47-
constexpr size_t mockLlvmBinaryDataSize = sizeof(llvmBcMagic) + mockDataSize;
48-
49-
char mockDevBinaryData[mockDevBinaryDataSize];
50-
memcpy_s(mockDevBinaryData, mockDevBinaryDataSize, &mockDevBinaryHeader, sizeof(mockDevBinaryHeader));
51-
memset(mockDevBinaryData + sizeof(mockDevBinaryHeader), '\x01', mockDataSize);
52-
53-
char mockSpirvBinaryData[mockSpirvBinaryDataSize];
54-
memcpy_s(mockSpirvBinaryData, mockSpirvBinaryDataSize, spirvMagic.data(), spirvMagic.size());
55-
memset(mockSpirvBinaryData + spirvMagic.size(), '\x02', mockDataSize);
56-
57-
char mockLlvmBinaryData[mockLlvmBinaryDataSize];
58-
memcpy_s(mockLlvmBinaryData, mockLlvmBinaryDataSize, llvmBcMagic.data(), llvmBcMagic.size());
59-
memset(mockLlvmBinaryData + llvmBcMagic.size(), '\x03', mockDataSize);
60-
61-
Elf::ElfEncoder<Elf::EI_CLASS_64> enc;
62-
enc.getElfFileHeader().identity = Elf::ElfFileHeaderIdentity(Elf::EI_CLASS_64);
63-
enc.getElfFileHeader().type = NEO::Elf::ET_OPENCL_EXECUTABLE;
64-
enc.appendSection(Elf::SHT_OPENCL_DEV_BINARY, Elf::SectionNamesOpenCl::deviceBinary, ArrayRef<const uint8_t>::fromAny(mockDevBinaryData, mockDevBinaryDataSize));
65-
if (irFormat == enabledIrFormat::ENABLE_SPIRV)
66-
enc.appendSection(Elf::SHT_OPENCL_SPIRV, Elf::SectionNamesOpenCl::spirvObject, ArrayRef<const uint8_t>::fromAny(mockSpirvBinaryData, mockSpirvBinaryDataSize));
67-
else if (irFormat == enabledIrFormat::ENABLE_LLVM)
68-
enc.appendSection(Elf::SHT_OPENCL_LLVM_BINARY, Elf::SectionNamesOpenCl::llvmObject, ArrayRef<const uint8_t>::fromAny(mockLlvmBinaryData, mockLlvmBinaryDataSize));
69-
if (false == buildOptions.empty())
70-
enc.appendSection(Elf::SHT_OPENCL_OPTIONS, Elf::SectionNamesOpenCl::buildOptions, ArrayRef<const uint8_t>::fromAny(buildOptions.data(), buildOptions.size()));
71-
storage = enc.encode();
72-
}
73-
static constexpr size_t mockDataSize = 0x10;
74-
SProgramBinaryHeader mockDevBinaryHeader = SProgramBinaryHeader{MAGIC_CL, 0, 0, 0, 0, 0, 0};
75-
std::vector<uint8_t> storage;
76-
};
77-
7832
class ProcessElfBinaryTests : public ::testing::Test {
7933
public:
8034
void SetUp() override {

opencl/test/unit_test/program/program_with_kernel_debug_tests.cpp

Lines changed: 63 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
*
66
*/
77

8+
#include "shared/source/device_binary_format/patchtokens_decoder.h"
89
#include "shared/test/common/helpers/debug_manager_state_restore.h"
910
#include "shared/test/common/helpers/kernel_binary_helper.h"
1011
#include "shared/test/common/helpers/kernel_filename_helper.h"
1112
#include "shared/test/common/libult/global_environment.h"
1213
#include "shared/test/common/mocks/mock_source_level_debugger.h"
1314
#include "shared/test/common/test_macros/test.h"
15+
#include "shared/test/unit_test/device_binary_format/elf/elf_tests_data.h"
1416
#include "shared/test/unit_test/helpers/gtest_helpers.h"
1517

1618
#include "opencl/test/unit_test/fixtures/program_fixture.h"
@@ -20,6 +22,7 @@
2022

2123
#include "compiler_options.h"
2224
#include "gtest/gtest.h"
25+
#include "program_debug_data.h"
2326

2427
#include <algorithm>
2528
#include <memory>
@@ -300,6 +303,11 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsLinke
300303
}
301304

302305
TEST_F(ProgramWithKernelDebuggingTest, givenProgramWithKernelDebugEnabledWhenBuiltThenPatchTokenAllocateSipSurfaceHasSizeGreaterThanZero) {
306+
auto &refBin = pProgram->buildInfos[pDevice->getRootDeviceIndex()].unpackedDeviceBinary;
307+
auto refBinSize = pProgram->buildInfos[pDevice->getRootDeviceIndex()].unpackedDeviceBinarySize;
308+
if (NEO::isDeviceBinaryFormat<NEO::DeviceBinaryFormat::Zebin>(ArrayRef<const uint8_t>::fromAny(refBin.get(), refBinSize))) {
309+
GTEST_SKIP();
310+
}
303311
auto retVal = pProgram->build(pProgram->getDevices(), CompilerOptions::debugKernelEnable.data(), false);
304312
EXPECT_EQ(CL_SUCCESS, retVal);
305313

@@ -313,9 +321,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenGtpinInitializedWhenCreatingProgramF
313321
auto retVal = pProgram->build(pProgram->getDevices(), CompilerOptions::debugKernelEnable.data(), false);
314322
EXPECT_EQ(CL_SUCCESS, retVal);
315323

316-
auto kernelInfo = pProgram->getKernelInfo("CopyBuffer", pDevice->getRootDeviceIndex());
317-
EXPECT_NE(kernelInfo->debugData.vIsa, nullptr);
318-
EXPECT_NE(0u, kernelInfo->debugData.vIsaSize);
324+
EXPECT_TRUE(pProgram->wasDebuggerNotified);
319325

320326
NEO::isGTPinInitialized = gtpinInitializedBackup;
321327
}
@@ -327,9 +333,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenGtpinNotInitializedWhenCreatingProgr
327333
auto retVal = pProgram->build(pProgram->getDevices(), CompilerOptions::debugKernelEnable.data(), false);
328334
EXPECT_EQ(CL_SUCCESS, retVal);
329335

330-
auto kernelInfo = pProgram->getKernelInfo("CopyBuffer", pDevice->getRootDeviceIndex());
331-
EXPECT_EQ(kernelInfo->debugData.vIsa, nullptr);
332-
EXPECT_EQ(0u, kernelInfo->debugData.vIsaSize);
336+
EXPECT_FALSE(pProgram->wasDebuggerNotified);
333337

334338
NEO::isGTPinInitialized = gtpinInitializedBackup;
335339
}
@@ -344,25 +348,67 @@ TEST_F(ProgramWithKernelDebuggingTest, givenKernelDebugEnabledWhenProgramIsBuilt
344348
}
345349

346350
TEST_F(ProgramWithKernelDebuggingTest, givenProgramWithKernelDebugEnabledWhenProcessDebugDataIsCalledThenKernelInfosAreFilledWithDebugData) {
347-
auto retVal = pProgram->build(pProgram->getDevices(), nullptr, false);
348-
EXPECT_EQ(CL_SUCCESS, retVal);
351+
iOpenCL::SProgramDebugDataHeaderIGC debugDataHeader{};
352+
debugDataHeader.NumberOfKernels = 1u;
349353

350-
pProgram->processDebugData(pDevice->getRootDeviceIndex());
354+
char mockKernelName[] = "CopyBuffer";
355+
constexpr size_t mockKernelDebugDataSize = 0x10;
356+
PatchTokenBinary::SKernelDebugDataHeaderIGC mockKernelDebugHeader{};
357+
mockKernelDebugHeader.KernelNameSize = sizeof(mockKernelName);
358+
mockKernelDebugHeader.SizeVisaDbgInBytes = mockKernelDebugDataSize;
351359

352-
auto kernelInfo = pProgram->getKernelInfo("CopyBuffer", pDevice->getRootDeviceIndex());
360+
char mockKerneDebugData[mockKernelDebugDataSize];
361+
memset(mockKerneDebugData, '\x01', mockKernelDebugDataSize);
362+
363+
KernelInfo *mockKernelInfo = new KernelInfo{};
364+
mockKernelInfo->kernelDescriptor.kernelMetadata.kernelName = "CopyBuffer";
365+
pProgram->addKernelInfo(mockKernelInfo, pDevice->getRootDeviceIndex());
366+
367+
constexpr size_t mockDebugDataSize = sizeof(iOpenCL::SProgramDebugDataHeaderIGC) + sizeof(PatchTokenBinary::KernelFromPatchtokens) + sizeof(mockKernelName) + mockKernelDebugDataSize;
368+
369+
char *mockDebugData = new char[mockDebugDataSize];
370+
auto dataPtr = mockDebugData;
353371

354-
EXPECT_NE(0u, kernelInfo->debugData.vIsaSize);
355-
EXPECT_NE(nullptr, kernelInfo->debugData.vIsa);
372+
memcpy_s(dataPtr, mockDebugDataSize, &debugDataHeader, sizeof(iOpenCL::SProgramDebugDataHeaderIGC));
373+
dataPtr = ptrOffset(dataPtr, sizeof(iOpenCL::SProgramDebugDataHeaderIGC));
374+
memcpy_s(dataPtr, mockDebugDataSize, &mockKernelDebugHeader, sizeof(PatchTokenBinary::SKernelDebugDataHeaderIGC));
375+
dataPtr = ptrOffset(dataPtr, sizeof(PatchTokenBinary::SKernelDebugDataHeaderIGC));
376+
memcpy_s(dataPtr, mockDebugDataSize, &mockKernelName, sizeof(mockKernelName));
377+
dataPtr = ptrOffset(dataPtr, sizeof(mockKernelName));
378+
memcpy_s(dataPtr, mockDebugDataSize, mockKerneDebugData, mockKernelDebugDataSize);
379+
pProgram->buildInfos[pDevice->getRootDeviceIndex()].debugData.reset(mockDebugData);
380+
381+
pProgram->processDebugData(pDevice->getRootDeviceIndex());
382+
auto receivedKernelInfo = pProgram->getKernelInfo("CopyBuffer", pDevice->getRootDeviceIndex());
383+
384+
EXPECT_NE(0u, receivedKernelInfo->debugData.vIsaSize);
385+
EXPECT_NE(nullptr, receivedKernelInfo->debugData.vIsa);
356386
}
357387

358388
TEST_F(ProgramWithKernelDebuggingTest, givenProgramWithNonZebinaryFormatAndKernelDebugEnabledWhenProgramIsBuiltThenProcessDebugDataIsCalledAndDebuggerNotified) {
359389
MockSourceLevelDebugger *sourceLevelDebugger = new MockSourceLevelDebugger;
360390
pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->debugger.reset(sourceLevelDebugger);
361391
pProgram->enableKernelDebug();
362392

363-
cl_int retVal = pProgram->build(pProgram->getDevices(), nullptr, false);
364-
EXPECT_EQ(CL_SUCCESS, retVal);
365-
EXPECT_FALSE(pProgram->wasCreateDebugZebinCalled);
366-
EXPECT_TRUE(pProgram->wasProcessDebugDataCalled);
367-
EXPECT_EQ(1u, sourceLevelDebugger->notifyKernelDebugDataCalled);
393+
auto mockElf = std::make_unique<MockElfBinaryPatchtokens<>>(pDevice->getHardwareInfo());
394+
auto mockElfSize = mockElf->storage.size();
395+
auto mockElfData = mockElf->storage.data();
396+
397+
pProgram->buildInfos[pDevice->getRootDeviceIndex()].unpackedDeviceBinarySize = mockElfSize;
398+
pProgram->buildInfos[pDevice->getRootDeviceIndex()].unpackedDeviceBinary.reset(new char[mockElfSize]);
399+
memcpy_s(pProgram->buildInfos[pDevice->getRootDeviceIndex()].unpackedDeviceBinary.get(), pProgram->buildInfos[pDevice->getRootDeviceIndex()].unpackedDeviceBinarySize,
400+
mockElfData, mockElfSize);
401+
402+
KernelInfo *mockKernelInfo = new KernelInfo{};
403+
mockKernelInfo->kernelDescriptor.kernelMetadata.kernelName = "CopyBuffer";
404+
pProgram->addKernelInfo(mockKernelInfo, pDevice->getRootDeviceIndex());
405+
406+
auto counter = 0u;
407+
for (const auto &device : pProgram->getDevices()) {
408+
pProgram->notifyDebuggerWithDebugData(device);
409+
410+
EXPECT_FALSE(pProgram->wasCreateDebugZebinCalled);
411+
EXPECT_TRUE(pProgram->wasProcessDebugDataCalled);
412+
EXPECT_EQ(++counter, sourceLevelDebugger->notifyKernelDebugDataCalled);
413+
}
368414
}

shared/test/unit_test/device_binary_format/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ target_sources(${TARGET_NAME} PRIVATE
1616
${CMAKE_CURRENT_SOURCE_DIR}/elf/elf_decoder_tests.cpp
1717
${CMAKE_CURRENT_SOURCE_DIR}/elf/elf_encoder_tests.cpp
1818
${CMAKE_CURRENT_SOURCE_DIR}/elf/elf_tests.cpp
19+
${CMAKE_CURRENT_SOURCE_DIR}/elf/elf_tests_data.h
1920
${CMAKE_CURRENT_SOURCE_DIR}/patchtokens_decoder_tests.cpp
2021
${CMAKE_CURRENT_SOURCE_DIR}/patchtokens_dumper_tests.cpp
2122
${CMAKE_CURRENT_SOURCE_DIR}/patchtokens_tests.h
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright (C) 2022 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#pragma once
9+
10+
#include "shared/source/compiler_interface/intermediate_representations.h"
11+
#include "shared/source/device_binary_format/elf/elf_encoder.h"
12+
#include "shared/source/device_binary_format/elf/ocl_elf.h"
13+
14+
#include "patch_list.h"
15+
16+
using namespace NEO;
17+
18+
enum class enabledIrFormat {
19+
NONE,
20+
ENABLE_SPIRV,
21+
ENABLE_LLVM
22+
};
23+
24+
template <enabledIrFormat irFormat = enabledIrFormat::NONE>
25+
struct MockElfBinaryPatchtokens {
26+
MockElfBinaryPatchtokens(const HardwareInfo &hwInfo) : MockElfBinaryPatchtokens(std::string{}, hwInfo){};
27+
MockElfBinaryPatchtokens(const std::string &buildOptions, const HardwareInfo &hwInfo) {
28+
mockDevBinaryHeader.Device = hwInfo.platform.eRenderCoreFamily;
29+
mockDevBinaryHeader.GPUPointerSizeInBytes = sizeof(void *);
30+
mockDevBinaryHeader.Version = iOpenCL::CURRENT_ICBE_VERSION;
31+
constexpr size_t mockDevBinaryDataSize = sizeof(mockDevBinaryHeader) + mockDataSize;
32+
constexpr size_t mockSpirvBinaryDataSize = sizeof(spirvMagic) + mockDataSize;
33+
constexpr size_t mockLlvmBinaryDataSize = sizeof(llvmBcMagic) + mockDataSize;
34+
35+
char mockDevBinaryData[mockDevBinaryDataSize]{};
36+
memcpy_s(mockDevBinaryData, mockDevBinaryDataSize, &mockDevBinaryHeader, sizeof(mockDevBinaryHeader));
37+
memset(mockDevBinaryData + sizeof(mockDevBinaryHeader), '\x01', mockDataSize);
38+
39+
char mockSpirvBinaryData[mockSpirvBinaryDataSize]{};
40+
memcpy_s(mockSpirvBinaryData, mockSpirvBinaryDataSize, spirvMagic.data(), spirvMagic.size());
41+
memset(mockSpirvBinaryData + spirvMagic.size(), '\x02', mockDataSize);
42+
43+
char mockLlvmBinaryData[mockLlvmBinaryDataSize]{};
44+
memcpy_s(mockLlvmBinaryData, mockLlvmBinaryDataSize, llvmBcMagic.data(), llvmBcMagic.size());
45+
memset(mockLlvmBinaryData + llvmBcMagic.size(), '\x03', mockDataSize);
46+
47+
Elf::ElfEncoder<Elf::EI_CLASS_64> enc;
48+
enc.getElfFileHeader().identity = Elf::ElfFileHeaderIdentity(Elf::EI_CLASS_64);
49+
enc.getElfFileHeader().type = NEO::Elf::ET_OPENCL_EXECUTABLE;
50+
enc.appendSection(Elf::SHT_OPENCL_DEV_BINARY, Elf::SectionNamesOpenCl::deviceBinary, ArrayRef<const uint8_t>::fromAny(mockDevBinaryData, mockDevBinaryDataSize));
51+
if (irFormat == enabledIrFormat::ENABLE_SPIRV)
52+
enc.appendSection(Elf::SHT_OPENCL_SPIRV, Elf::SectionNamesOpenCl::spirvObject, ArrayRef<const uint8_t>::fromAny(mockSpirvBinaryData, mockSpirvBinaryDataSize));
53+
else if (irFormat == enabledIrFormat::ENABLE_LLVM)
54+
enc.appendSection(Elf::SHT_OPENCL_LLVM_BINARY, Elf::SectionNamesOpenCl::llvmObject, ArrayRef<const uint8_t>::fromAny(mockLlvmBinaryData, mockLlvmBinaryDataSize));
55+
if (false == buildOptions.empty())
56+
enc.appendSection(Elf::SHT_OPENCL_OPTIONS, Elf::SectionNamesOpenCl::buildOptions, ArrayRef<const uint8_t>::fromAny(buildOptions.data(), buildOptions.size()));
57+
storage = enc.encode();
58+
}
59+
static constexpr size_t mockDataSize = 0x10;
60+
iOpenCL::SProgramBinaryHeader mockDevBinaryHeader = iOpenCL::SProgramBinaryHeader{iOpenCL::MAGIC_CL, 0, 0, 0, 0, 0, 0};
61+
std::vector<uint8_t> storage;
62+
};

0 commit comments

Comments
 (0)