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