2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2021-05-16 20:51:16 +02:00
|
|
|
* Copyright (C) 2018-2021 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-19 20:54:29 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
*/
|
2018-09-19 20:54:29 -07:00
|
|
|
|
2020-02-23 15:20:22 +01:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_program.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/compiler_interface/compiler_cache.h"
|
|
|
|
#include "shared/source/device_binary_format/patchtokens_decoder.h"
|
|
|
|
#include "shared/source/helpers/hash.h"
|
|
|
|
#include "shared/source/program/program_info_from_patchtokens.h"
|
2021-01-21 13:10:13 +01:00
|
|
|
#include "shared/test/common/helpers/default_hw_info.h"
|
|
|
|
#include "shared/test/common/mocks/mock_compiler_interface.h"
|
|
|
|
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
2020-02-24 10:22:30 +01:00
|
|
|
|
2020-02-22 22:50:57 +01:00
|
|
|
#include "opencl/source/context/context.h"
|
|
|
|
#include "opencl/source/program/create.inl"
|
|
|
|
#include "opencl/source/program/kernel_info.h"
|
2020-02-23 15:20:22 +01:00
|
|
|
#include "opencl/test/unit_test/helpers/ult_limits.h"
|
2020-10-08 11:36:31 +02:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
2020-02-23 15:20:22 +01:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_compilers.h"
|
2020-02-22 09:28:27 +01:00
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2020-10-16 15:00:28 +02:00
|
|
|
ClDeviceVector toClDeviceVector(ClDevice &clDevice) {
|
|
|
|
ClDeviceVector deviceVector;
|
|
|
|
deviceVector.push_back(&clDevice);
|
|
|
|
return deviceVector;
|
|
|
|
}
|
2020-12-02 10:22:27 +00:00
|
|
|
|
2020-10-30 11:10:00 +01:00
|
|
|
int MockProgram::initInternalOptionsCalled = 0;
|
2020-01-14 14:32:11 +01:00
|
|
|
|
2018-07-31 11:01:13 +02:00
|
|
|
std::string MockProgram::getCachedFileName() const {
|
|
|
|
auto hwInfo = this->context->getDevice(0)->getHardwareInfo();
|
|
|
|
auto input = ArrayRef<const char>(this->sourceCode.c_str(), this->sourceCode.size());
|
|
|
|
auto opts = ArrayRef<const char>(this->options.c_str(), this->options.size());
|
2020-10-30 11:10:00 +01:00
|
|
|
auto internalOptions = getInitInternalOptions();
|
|
|
|
auto internalOpts = ArrayRef<const char>(internalOptions.c_str(), internalOptions.size());
|
2019-10-21 15:47:04 +02:00
|
|
|
return CompilerCache::getCachedFileName(hwInfo, input, opts, internalOpts);
|
2018-05-14 11:25:18 +02:00
|
|
|
}
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|