mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 06:24:51 +08:00
Ocloc compile: return zebin format as is
If igc returns a zebin format ocloc should return it as it is.
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
af1bf59c43
commit
db371ab6b9
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2018-2020 Intel Corporation
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
@@ -61,6 +61,7 @@ set(IGDRCL_SRCS_offline_compiler_tests
|
||||
${NEO_SHARED_DIRECTORY}/helpers/file_io.cpp
|
||||
${NEO_SHARED_DIRECTORY}/memory_manager/deferred_deleter.cpp
|
||||
${NEO_SHARED_DIRECTORY}/memory_manager/deferred_deleter.h
|
||||
${NEO_SHARED_TEST_DIRECTORY}/unit_test/device_binary_format/zebin_tests.h
|
||||
${NEO_SHARED_TEST_DIRECTORY}/unit_test/helpers/test_files.cpp
|
||||
${IGDRCL_SRCS_cloc}
|
||||
${IGDRCL_SRCS_offline_compiler_mock}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/helpers/file_io.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/test/unit_test/device_binary_format/zebin_tests.h"
|
||||
#include "shared/test/unit_test/helpers/debug_manager_state_restore.h"
|
||||
|
||||
#include "opencl/source/platform/extensions.h"
|
||||
@@ -1474,5 +1475,16 @@ TEST(OclocCompile, givenNoDeviceAndInternalOptionsOptionWhenCompilingToSpirvThen
|
||||
EXPECT_EQ(0, retVal);
|
||||
EXPECT_THAT(ocloc.internalOptions.c_str(), testing::HasSubstr("-ocl-version=300 -cl-ext=-all,+cl_khr_3d_image_writes -cl-ext=+custom_param"));
|
||||
}
|
||||
TEST(OclocCompile, givenPackedDeviceBinaryFormatWhenGeneratingElfBinaryItIsReturnedAsItIs) {
|
||||
MockOfflineCompiler ocloc;
|
||||
ZebinTestData::ValidEmptyProgram zebin;
|
||||
|
||||
// genBinary is deleted in ocloc's destructor
|
||||
ocloc.genBinary = new char[zebin.storage.size()];
|
||||
ocloc.genBinarySize = zebin.storage.size();
|
||||
memcpy_s(ocloc.genBinary, ocloc.genBinarySize, zebin.storage.data(), zebin.storage.size());
|
||||
|
||||
ASSERT_EQ(true, ocloc.generateElfBinary());
|
||||
EXPECT_EQ(0, memcmp(zebin.storage.data(), ocloc.elfBinary.data(), zebin.storage.size()));
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -903,6 +903,12 @@ bool OfflineCompiler::generateElfBinary() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// return "as is" if zebin format
|
||||
if (isDeviceBinaryFormat<DeviceBinaryFormat::Zebin>(ArrayRef<uint8_t>(reinterpret_cast<uint8_t *>(genBinary), genBinarySize))) {
|
||||
this->elfBinary = std::vector<uint8_t>(genBinary, genBinary + genBinarySize);
|
||||
return true;
|
||||
}
|
||||
|
||||
SingleDeviceBinary binary = {};
|
||||
binary.buildOptions = this->options;
|
||||
binary.intermediateRepresentation = ArrayRef<const uint8_t>(reinterpret_cast<const uint8_t *>(this->irBinary), this->irBinarySize);
|
||||
|
||||
Reference in New Issue
Block a user