Adding AR support to ocloc

Related-To: NEO-3920
Change-Id: I6709d48528ab7d18fdd53c3396ff13551cce207b
This commit is contained in:
Jaroslaw Chodor
2020-02-09 23:59:57 +01:00
committed by sys_ocldev
parent 6fe4382b31
commit 046cb4c28b
15 changed files with 782 additions and 31 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 Intel Corporation
* Copyright (C) 2019-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -30,16 +30,16 @@ bool contains(const std::string &options, ConstStringRef optionToFind) {
return contains(options.c_str(), optionToFind);
}
TokenizedString tokenize(ConstStringRef src) {
TokenizedString tokenize(ConstStringRef src, char sperator) {
TokenizedString ret;
const char *it = src.begin();
while (it < src.end()) {
const char *beg = it;
while ((beg < src.end()) && (*beg == ' ')) {
while ((beg < src.end()) && (*beg == sperator)) {
++beg;
}
const char *end = beg;
while ((end < src.end()) && (*end != ' ')) {
while ((end < src.end()) && (*end != sperator)) {
++end;
}
it = end;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 Intel Corporation
* Copyright (C) 2019-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -142,6 +142,6 @@ bool contains(const char *options, ConstStringRef optionToFind);
bool contains(const std::string &options, ConstStringRef optionToFind);
using TokenizedString = StackVec<ConstStringRef, 32>;
TokenizedString tokenize(ConstStringRef src);
TokenizedString tokenize(ConstStringRef src, char sperator = ' ');
} // namespace CompilerOptions
} // namespace NEO

View File

@ -98,3 +98,17 @@ TEST(ConstStringRef, WhenCopyAsignedThenIdenticalAsOrigin) {
b = a;
EXPECT_EQ(a, b);
}
TEST(ConstStringRef, WhenCheckingForInclusionThenDoesNotReadOutOfBounds) {
static constexpr ConstStringRef str1("Text", 2);
ConstStringRef substr1("Tex");
EXPECT_FALSE(str1.contains(substr1));
static constexpr ConstStringRef str2("AabAac");
ConstStringRef substr2("Aac");
EXPECT_TRUE(str2.contains(substr2));
static constexpr ConstStringRef str3("AabAac");
ConstStringRef substr3("Aacd");
EXPECT_FALSE(str3.contains(substr3));
}

View File

@ -79,6 +79,24 @@ class ConstStringRef {
return ptr + len;
}
constexpr bool contains(const char *subString) const noexcept {
const char *findBeg = ptr;
const char *findEnd = ptr + len;
while (findBeg != findEnd) {
const char *lhs = findBeg;
const char *rhs = subString;
while ((lhs < findEnd) && (*lhs == *rhs) && ('\0' != *rhs)) {
++lhs;
++rhs;
}
if ('\0' == *rhs) {
return true;
}
++findBeg;
}
return false;
}
protected:
const char *ptr = nullptr;
size_t len = 0U;

View File

@ -7,6 +7,11 @@
project(ocloc)
set(CLOC_SRCS_LIB
${NEO_SOURCE_DIR}/core/device_binary_format/ar/ar.h
${NEO_SOURCE_DIR}/core/device_binary_format/ar/ar_decoder.h
${NEO_SOURCE_DIR}/core/device_binary_format/ar/ar_decoder.cpp
${NEO_SOURCE_DIR}/core/device_binary_format/ar/ar_encoder.h
${NEO_SOURCE_DIR}/core/device_binary_format/ar/ar_encoder.cpp
${NEO_SOURCE_DIR}/core/device_binary_format/elf/elf.h
${NEO_SOURCE_DIR}/core/device_binary_format/elf/elf_decoder.h
${NEO_SOURCE_DIR}/core/device_binary_format/elf/elf_decoder.cpp
@ -25,6 +30,8 @@ set(CLOC_SRCS_LIB
${NEO_SOURCE_DIR}/offline_compiler/decoder/helper.h
${NEO_SOURCE_DIR}/offline_compiler/decoder/iga_wrapper.h
${NEO_SOURCE_DIR}/offline_compiler/decoder/translate_platform_base.h
${NEO_SOURCE_DIR}/offline_compiler/ocloc_fatbinary.cpp
${NEO_SOURCE_DIR}/offline_compiler/ocloc_fatbinary.h
${NEO_SOURCE_DIR}/offline_compiler/offline_compiler_helper.cpp
${NEO_SOURCE_DIR}/offline_compiler/offline_compiler.cpp
${NEO_SOURCE_DIR}/offline_compiler/offline_compiler.h
@ -32,6 +39,7 @@ set(CLOC_SRCS_LIB
${NEO_SOURCE_DIR}/offline_compiler/multi_command.h
${NEO_SOURCE_DIR}/offline_compiler/offline_compiler_options.cpp
${NEO_SOURCE_DIR}/offline_compiler/${BRANCH_DIR_SUFFIX}/extra_settings.cpp
${NEO_SOURCE_DIR}/core/compiler_interface/compiler_options/compiler_options_base.cpp
${NEO_SOURCE_DIR}/core/compiler_interface/create_main.cpp
${NEO_SOURCE_DIR}/core/helpers/hw_info.cpp
${NEO_SOURCE_DIR}/runtime/platform/extensions.cpp

View File

@ -7,6 +7,7 @@
#include "core/os_interface/os_library.h"
#include "offline_compiler/multi_command.h"
#include "offline_compiler/ocloc_fatbinary.h"
#include "offline_compiler/offline_compiler.h"
#include "decoder/binary_decoder.h"
@ -84,13 +85,17 @@ int main(int numArgs, const char *argv[]) {
auto pMulti = std::unique_ptr<MultiCommand>(MultiCommand::create(allArgs, retValue));
return retValue;
} else {
if (requestedFatBinary(numArgs, argv)) {
return buildFatbinary(numArgs, argv);
}
int retVal = CL_SUCCESS;
std::vector<std::string> allArgs;
if (numArgs > 1) {
allArgs.assign(argv, argv + numArgs);
}
OfflineCompiler *pCompiler = OfflineCompiler::create(numArgs, allArgs, retVal);
OfflineCompiler *pCompiler = OfflineCompiler::create(numArgs, allArgs, true, retVal);
if (retVal == CL_SUCCESS) {
retVal = buildWithSafetyGuard(pCompiler);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 Intel Corporation
* Copyright (C) 2019-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -11,7 +11,7 @@ namespace NEO {
int MultiCommand::singleBuild(size_t numArgs, const std::vector<std::string> &allArgs) {
int retVal = CL_SUCCESS;
std::string buildLog;
OfflineCompiler *pCompiler = OfflineCompiler::create(numArgs, allArgs, retVal);
OfflineCompiler *pCompiler = OfflineCompiler::create(numArgs, allArgs, true, retVal);
if (retVal == CL_SUCCESS) {
retVal = buildWithSafetyGuard(pCompiler);

View File

@ -0,0 +1,300 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "offline_compiler/ocloc_fatbinary.h"
#include "core/device_binary_format/ar/ar_encoder.h"
#include "core/helpers/file_io.h"
#include "core/helpers/hw_info.h"
#include "offline_compiler/offline_compiler.h"
#include "offline_compiler/utilities/safety_caller.h"
#include "compiler_options.h"
#include "igfxfmid.h"
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <vector>
namespace NEO {
bool requestedFatBinary(int argc, const char *argv[]) {
for (int argIndex = 1; argIndex < argc; argIndex++) {
const auto &currArg = argv[argIndex];
const bool hasMoreArgs = (argIndex + 1 < argc);
if ((ConstStringRef("-device") == currArg) && hasMoreArgs) {
ConstStringRef deviceArg(argv[argIndex + 1], strlen(argv[argIndex + 1]));
return deviceArg.contains("*") || deviceArg.contains("-") || deviceArg.contains(",") || deviceArg.contains("gen");
}
}
return false;
}
std::vector<PRODUCT_FAMILY> getAllSupportedTargetPlatforms() {
std::vector<PRODUCT_FAMILY> ret;
for (unsigned int productId = 0; productId < IGFX_MAX_PRODUCT; ++productId) {
if (nullptr != hardwarePrefix[productId]) {
ret.push_back(static_cast<PRODUCT_FAMILY>(productId));
}
}
return ret;
}
std::vector<ConstStringRef> toProductNames(const std::vector<PRODUCT_FAMILY> &productIds) {
std::vector<ConstStringRef> ret;
for (auto prodId : productIds) {
ret.push_back(ConstStringRef(hardwarePrefix[prodId], strlen(hardwarePrefix[prodId])));
}
return ret;
}
PRODUCT_FAMILY asProductId(ConstStringRef product, const std::vector<PRODUCT_FAMILY> &allSupportedPlatforms) {
for (auto family : allSupportedPlatforms) {
if (product == hardwarePrefix[family]) {
return family;
}
}
return IGFX_UNKNOWN;
}
GFXCORE_FAMILY asGfxCoreId(ConstStringRef core) {
ConstStringRef coreIgnoreG(core.begin() + 1, core.size() - 1);
for (unsigned int coreId = 0; coreId < IGFX_MAX_CORE; ++coreId) {
if (nullptr == familyName[coreId]) {
continue;
}
if (ConstStringRef(familyName[coreId] + 1, strlen(familyName[coreId]) - 1) == coreIgnoreG) {
return static_cast<GFXCORE_FAMILY>(coreId);
}
}
return IGFX_UNKNOWN_CORE;
}
void appendPlatformsForGfxCore(GFXCORE_FAMILY core, const std::vector<PRODUCT_FAMILY> &allSupportedPlatforms, std::vector<PRODUCT_FAMILY> &out) {
for (auto family : allSupportedPlatforms) {
if (core == hardwareInfoTable[family]->platform.eRenderCoreFamily) {
out.push_back(family);
}
}
}
std::vector<ConstStringRef> getTargetPlatformsForFatbinary(ConstStringRef deviceArg) {
std::vector<PRODUCT_FAMILY> allSupportedPlatforms = getAllSupportedTargetPlatforms();
if (deviceArg == "*") {
return toProductNames(allSupportedPlatforms);
}
auto genArg = ConstStringRef("gen");
std::vector<PRODUCT_FAMILY> requestedPlatforms;
auto sets = CompilerOptions::tokenize(deviceArg, ',');
for (auto set : sets) {
if (set.contains("-")) {
auto range = CompilerOptions::tokenize(deviceArg, '-');
if (range.size() > 2) {
printf("Invalid range : %s - should be from-to or -to or from-\n", set.str().c_str());
return {};
}
if (range.size() == 1) {
// open range , from-max or min-to
if (range[0].contains("gen")) {
auto coreId = asGfxCoreId(range[0]);
if (IGFX_UNKNOWN_CORE == coreId) {
printf("Unknown device : %s\n", set.str().c_str());
return {};
}
if ('-' == set[0]) {
// to
unsigned int coreIt = IGFX_UNKNOWN_CORE;
++coreIt;
while (coreIt <= static_cast<unsigned int>(coreId)) {
appendPlatformsForGfxCore(static_cast<GFXCORE_FAMILY>(coreIt), allSupportedPlatforms, requestedPlatforms);
++coreIt;
}
} else {
// from
unsigned int coreIt = coreId;
while (coreIt < static_cast<unsigned int>(IGFX_MAX_CORE)) {
appendPlatformsForGfxCore(static_cast<GFXCORE_FAMILY>(coreIt), allSupportedPlatforms, requestedPlatforms);
++coreIt;
}
}
} else {
auto prodId = asProductId(range[0], allSupportedPlatforms);
if (IGFX_UNKNOWN == prodId) {
printf("Unknown device : %s\n", range[0].str().c_str());
return {};
}
auto prodIt = std::find(allSupportedPlatforms.begin(), allSupportedPlatforms.end(), prodId);
assert(prodIt != allSupportedPlatforms.end());
if ('-' == set[0]) {
// to
requestedPlatforms.insert(requestedPlatforms.end(), allSupportedPlatforms.begin(), prodIt + 1);
} else {
// from
requestedPlatforms.insert(requestedPlatforms.end(), prodIt, allSupportedPlatforms.end());
}
}
} else {
if (range[0].contains("gen")) {
if (false == range[1].contains("gen")) {
printf("Ranges mixing platforms and gfxCores is not supported : %s - should be genFrom-genTo or platformFrom-platformTo\n", set.str().c_str());
return {};
}
auto coreFrom = asGfxCoreId(range[0]);
auto coreTo = asGfxCoreId(range[1]);
if (IGFX_UNKNOWN_CORE == coreFrom) {
printf("Unknown device : %s\n", set.str().c_str());
return {};
}
if (IGFX_UNKNOWN_CORE == coreTo) {
printf("Unknown device : %s\n", set.str().c_str());
return {};
}
if (coreFrom > coreTo) {
std::swap(coreFrom, coreTo);
}
while (coreFrom <= coreTo) {
appendPlatformsForGfxCore(static_cast<GFXCORE_FAMILY>(coreFrom), allSupportedPlatforms, requestedPlatforms);
coreFrom = static_cast<GFXCORE_FAMILY>(static_cast<unsigned int>(coreFrom) + 1);
}
} else {
auto platformFrom = asProductId(range[0], allSupportedPlatforms);
auto platformTo = asProductId(range[1], allSupportedPlatforms);
if (IGFX_UNKNOWN == platformFrom) {
printf("Unknown device : %s\n", set.str().c_str());
return {};
}
if (IGFX_UNKNOWN == platformTo) {
printf("Unknown device : %s\n", set.str().c_str());
return {};
}
if (platformFrom > platformTo) {
std::swap(platformFrom, platformTo);
}
auto from = std::find(allSupportedPlatforms.begin(), allSupportedPlatforms.end(), platformFrom);
auto to = std::find(allSupportedPlatforms.begin(), allSupportedPlatforms.end(), platformTo) + 1;
requestedPlatforms.insert(requestedPlatforms.end(), from, to);
}
}
} else if (set.contains("gen")) {
if (set.size() == genArg.size()) {
printf("Invalid gen-based device : %s - gen should be followed by a number\n", set.str().c_str());
} else {
auto coreId = asGfxCoreId(set);
if (IGFX_UNKNOWN_CORE == coreId) {
printf("Unknown device : %s\n", set.str().c_str());
return {};
}
appendPlatformsForGfxCore(coreId, allSupportedPlatforms, requestedPlatforms);
}
} else {
auto prodId = asProductId(set, allSupportedPlatforms);
if (IGFX_UNKNOWN == prodId) {
printf("Unknown device : %s\n", set.str().c_str());
return {};
}
requestedPlatforms.push_back(prodId);
}
}
return toProductNames(requestedPlatforms);
}
int buildFatbinary(int argc, const char *argv[]) {
std::string pointerSizeInBits = (sizeof(void *) == 4) ? "32" : "64";
int deviceArgIndex = -1;
std::string inputFileName = "";
std::string outputFileName = "";
std::string outputDirectory = "";
std::vector<std::string> argsCopy;
if (argc > 1) {
argsCopy.assign(argv, argv + argc);
}
for (int argIndex = 1; argIndex < argc; argIndex++) {
const auto &currArg = argv[argIndex];
const bool hasMoreArgs = (argIndex + 1 < argc);
if ((ConstStringRef("-device") == currArg) && hasMoreArgs) {
deviceArgIndex = argIndex + 1;
++argIndex;
break;
} else if ((CompilerOptions::arch32bit == currArg) || (ConstStringRef("-32") == currArg)) {
pointerSizeInBits = "32";
} else if ((CompilerOptions::arch64bit == currArg) || (ConstStringRef("-64") == currArg)) {
pointerSizeInBits = "64";
} else if ((ConstStringRef("-file") == currArg) && hasMoreArgs) {
inputFileName = argv[argIndex + 1];
++argIndex;
} else if ((ConstStringRef("-output") == currArg) && hasMoreArgs) {
outputFileName = argv[argIndex + 1];
++argIndex;
} else if ((ConstStringRef("-out_dir") == currArg) && hasMoreArgs) {
outputDirectory = argv[argIndex + 1];
++argIndex;
}
}
std::vector<ConstStringRef> targetPlatforms;
targetPlatforms = getTargetPlatformsForFatbinary(ConstStringRef(argv[deviceArgIndex], strlen(argv[deviceArgIndex])));
if (targetPlatforms.empty()) {
printf("Failed to parse target devices from : %s\n", argv[deviceArgIndex]);
return 1;
}
NEO::Ar::ArEncoder fatbinary(true);
for (auto targetPlatform : targetPlatforms) {
int retVal = 0;
argsCopy[deviceArgIndex] = targetPlatform.str();
std::unique_ptr<OfflineCompiler> pCompiler{OfflineCompiler::create(argc, argsCopy, false, retVal)};
auto stepping = pCompiler->getHardwareInfo().platform.usRevId;
if (retVal == 0) {
retVal = buildWithSafetyGuard(pCompiler.get());
std::string buildLog = pCompiler->getBuildLog();
if (buildLog.empty() == false) {
printf("%s\n", buildLog.c_str());
}
if (retVal == 0) {
if (!pCompiler->isQuiet())
printf("Build succeeded for : %s.\n", (targetPlatform.str() + "." + std::to_string(stepping)).c_str());
} else {
printf("Build failed for : %s with error code: %d\n", (targetPlatform.str() + "." + std::to_string(stepping)).c_str(), retVal);
printf("Command was:");
for (auto i = 0; i < argc; ++i)
printf(" %s", argv[i]);
printf("\n");
}
}
if (0 != retVal) {
return retVal;
}
fatbinary.appendFileEntry(pointerSizeInBits + "." + targetPlatform.str() + "." + std::to_string(stepping), pCompiler->getPackedDeviceBinaryOutput());
}
auto fatbinaryData = fatbinary.encode();
std::string fatbinaryFileName = outputFileName;
if (outputFileName.empty() && (false == inputFileName.empty())) {
fatbinaryFileName = OfflineCompiler::getFileNameTrunk(inputFileName) + ".ar";
}
if (false == outputDirectory.empty()) {
fatbinaryFileName = outputDirectory + "/" + outputFileName;
}
writeDataToFile(fatbinaryFileName.c_str(), fatbinaryData.data(), fatbinaryData.size());
return 0;
}
} // namespace NEO

View File

@ -0,0 +1,29 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "core/utilities/const_stringref.h"
#include "igfxfmid.h"
#include <vector>
namespace NEO {
bool requestedFatBinary(int argc, const char *argv[]);
int buildFatbinary(int argc, const char *argv[]);
std::vector<PRODUCT_FAMILY> getAllSupportedTargetPlatforms();
std::vector<ConstStringRef> toProductNames(const std::vector<PRODUCT_FAMILY> &productIds);
PRODUCT_FAMILY asProductId(ConstStringRef product, const std::vector<PRODUCT_FAMILY> &allSupportedPlatforms);
GFXCORE_FAMILY asGfxCoreId(ConstStringRef core);
void appendPlatformsForGfxCore(GFXCORE_FAMILY core, const std::vector<PRODUCT_FAMILY> &allSupportedPlatforms, std::vector<PRODUCT_FAMILY> &out);
std::vector<ConstStringRef> getTargetPlatformsForFatbinary(ConstStringRef deviceArg);
} // namespace NEO

View File

@ -72,12 +72,12 @@ OfflineCompiler::~OfflineCompiler() {
delete[] genBinary;
}
OfflineCompiler *OfflineCompiler::create(size_t numArgs, const std::vector<std::string> &allArgs, int &retVal) {
OfflineCompiler *OfflineCompiler::create(size_t numArgs, const std::vector<std::string> &allArgs, bool dumpFiles, int &retVal) {
retVal = CL_SUCCESS;
auto pOffCompiler = new OfflineCompiler();
if (pOffCompiler) {
retVal = pOffCompiler->initialize(numArgs, allArgs);
retVal = pOffCompiler->initialize(numArgs, allArgs, dumpFiles);
}
if (retVal != CL_SUCCESS) {
@ -177,7 +177,9 @@ int OfflineCompiler::build() {
if (retVal == CL_SUCCESS) {
generateElfBinary();
writeOutAllFiles();
if (dumpFiles) {
writeOutAllFiles();
}
}
return retVal;
@ -233,7 +235,8 @@ std::string OfflineCompiler::getStringWithinDelimiters(const std::string &src) {
return dst;
}
int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &allArgs) {
int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &allArgs, bool dumpFiles) {
this->dumpFiles = dumpFiles;
int retVal = CL_SUCCESS;
const char *source = nullptr;
std::unique_ptr<char[]> sourceFromFile;
@ -597,7 +600,6 @@ std::string OfflineCompiler::getFileNameTrunk(std::string &filePath) {
extPos = filePath.size();
}
std::string fileName;
std::string fileTrunk = filePath.substr(slashPos, (extPos - slashPos));
return fileTrunk;

View File

@ -6,6 +6,11 @@
*/
#pragma once
#include "core/os_interface/os_library.h"
#include "core/utilities/arrayref.h"
#include "core/utilities/const_stringref.h"
#include "cif/common/cif_main.h"
#include "ocl_igc_interface/fcl_ocl_device_ctx.h"
#include "ocl_igc_interface/igc_ocl_device_ctx.h"
@ -32,7 +37,7 @@ std::string getDevicesTypes();
class OfflineCompiler {
public:
static OfflineCompiler *create(size_t numArgs, const std::vector<std::string> &allArgs, int &retVal);
static OfflineCompiler *create(size_t numArgs, const std::vector<std::string> &allArgs, bool dumpFiles, int &retVal);
int build();
std::string &getBuildLog();
void printUsage();
@ -47,14 +52,21 @@ class OfflineCompiler {
std::string parseBinAsCharArray(uint8_t *binary, size_t size, std::string &fileName);
static bool readOptionsFromFile(std::string &optionsOut, const std::string &file);
ArrayRef<const uint8_t> getPackedDeviceBinaryOutput() {
return this->elfBinary;
}
static std::string getFileNameTrunk(std::string &filePath);
const HardwareInfo &getHardwareInfo() const {
return *hwInfo;
}
protected:
OfflineCompiler();
int getHardwareInfo(const char *pDeviceName);
std::string getFileNameTrunk(std::string &filePath);
std::string getStringWithinDelimiters(const std::string &src);
int initialize(size_t numArgs, const std::vector<std::string> &allArgs);
int initialize(size_t numArgs, const std::vector<std::string> &allArgs, bool dumpFiles);
int parseCommandLine(size_t numArgs, const std::vector<std::string> &allArgs);
void setStatelessToStatefullBufferOffsetFlag();
void resolveExtraSettings();
@ -85,6 +97,7 @@ class OfflineCompiler {
std::string internalOptions;
std::string sourceCode;
std::string buildLog;
bool dumpFiles = true;
bool useLlvmText = false;
bool useLlvmBc = false;

View File

@ -11,6 +11,7 @@ set(IGDRCL_SRCS_cloc
${NEO_SOURCE_DIR}/offline_compiler/decoder/binary_decoder.cpp
${NEO_SOURCE_DIR}/offline_compiler/decoder/binary_encoder.cpp
${NEO_SOURCE_DIR}/offline_compiler/offline_compiler.cpp
${NEO_SOURCE_DIR}/offline_compiler/ocloc_fatbinary.cpp
)
set(IGDRCL_SRCS_offline_compiler_mock
@ -50,6 +51,7 @@ set(IGDRCL_SRCS_offline_compiler_tests
${CMAKE_CURRENT_SOURCE_DIR}/decoder/encoder_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/environment.h
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ocloc_fatbinary_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/offline_compiler_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/offline_compiler_tests.h
${NEO_SOURCE_DIR}/core/helpers/abort.cpp

View File

@ -34,7 +34,7 @@ class MockOfflineCompiler : public OfflineCompiler {
}
int initialize(size_t numArgs, const std::vector<std::string> &argv) {
return OfflineCompiler::initialize(numArgs, argv);
return OfflineCompiler::initialize(numArgs, argv, true);
}
int parseCommandLine(size_t numArgs, const std::vector<std::string> &argv) {

View File

@ -0,0 +1,360 @@
/*
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "core/helpers/hw_helper.h"
#include "offline_compiler/ocloc_fatbinary.h"
#include "gtest/gtest.h"
#include <unordered_set>
TEST(OclocFatBinaryRequestedFatBinary, WhenDeviceArgMissingThenReturnsFalse) {
const char *args[] = {"ocloc", "-aaa", "*", "-device", "*"};
EXPECT_FALSE(NEO::requestedFatBinary(0, nullptr));
EXPECT_FALSE(NEO::requestedFatBinary(1, args));
EXPECT_FALSE(NEO::requestedFatBinary(2, args));
EXPECT_FALSE(NEO::requestedFatBinary(3, args));
EXPECT_FALSE(NEO::requestedFatBinary(4, args));
}
TEST(OclocFatBinaryRequestedFatBinary, WhenDeviceArgProvidedAndContainsFatbinaryArgFormatThenReturnsTrue) {
const char *allPlatforms[] = {"ocloc", "-device", "*"};
const char *manyPlatforms[] = {"ocloc", "-device", "a,b"};
const char *manyGens[] = {"ocloc", "-device", "gen0,gen1"};
const char *gen[] = {"ocloc", "-device", "gen0"};
const char *rangePlatformFrom[] = {"ocloc", "-device", "skl-"};
const char *rangePlatformTo[] = {"ocloc", "-device", "-skl"};
const char *rangePlatformBounds[] = {"ocloc", "-device", "skl-icllp"};
const char *rangeGenFrom[] = {"ocloc", "-device", "gen0-"};
const char *rangeGenTo[] = {"ocloc", "-device", "-gen5"};
const char *rangeGenBounds[] = {"ocloc", "-device", "gen0-gen5"};
EXPECT_TRUE(NEO::requestedFatBinary(3, allPlatforms));
EXPECT_TRUE(NEO::requestedFatBinary(3, manyPlatforms));
EXPECT_TRUE(NEO::requestedFatBinary(3, manyGens));
EXPECT_TRUE(NEO::requestedFatBinary(3, gen));
EXPECT_TRUE(NEO::requestedFatBinary(3, rangePlatformFrom));
EXPECT_TRUE(NEO::requestedFatBinary(3, rangePlatformTo));
EXPECT_TRUE(NEO::requestedFatBinary(3, rangePlatformBounds));
EXPECT_TRUE(NEO::requestedFatBinary(3, rangeGenFrom));
EXPECT_TRUE(NEO::requestedFatBinary(3, rangeGenTo));
EXPECT_TRUE(NEO::requestedFatBinary(3, rangeGenBounds));
}
TEST(OclocFatBinaryRequestedFatBinary, WhenDeviceArgProvidedButDoesnNotContainFatbinaryArgFormatThenReturnsFalse) {
const char *skl[] = {"ocloc", "-device", "skl"};
EXPECT_FALSE(NEO::requestedFatBinary(3, skl));
}
TEST(OclocFatBinaryGetAllSupportedTargetPlatforms, WhenRequestedThenReturnsAllPlatformsWithNonNullHardwarePrefixes) {
auto platforms = NEO::getAllSupportedTargetPlatforms();
std::unordered_set<PRODUCT_FAMILY> platformsSet(platforms.begin(), platforms.end());
for (unsigned int productId = 0; productId < IGFX_MAX_PRODUCT; ++productId) {
if (nullptr != NEO::hardwarePrefix[productId]) {
EXPECT_EQ(1U, platformsSet.count(static_cast<PRODUCT_FAMILY>(productId))) << productId;
} else {
EXPECT_EQ(0U, platformsSet.count(static_cast<PRODUCT_FAMILY>(productId))) << productId;
}
}
}
TEST(OclocFatBinaryToProductNames, GivenListOfProductIdsThenReturnsListOfHardwarePrefixes) {
auto platforms = NEO::getAllSupportedTargetPlatforms();
auto names = NEO::toProductNames(platforms);
EXPECT_EQ(names.size(), platforms.size());
}
TEST(OclocFatBinaryAsProductId, GivenEnabledPlatformNameThenReturnsProperPlatformId) {
auto platforms = NEO::getAllSupportedTargetPlatforms();
auto names = NEO::toProductNames(platforms);
for (size_t i = 0; i < platforms.size(); ++i) {
auto idByName = NEO::asProductId(names[i], platforms);
EXPECT_EQ(idByName, platforms[i]) << names[i] << " : " << platforms[i] << " != " << idByName;
}
}
TEST(OclocFatBinaryAsProductId, GivenDisabledPlatformNameThenReturnsUnknownPlatformId) {
auto platforms = NEO::getAllSupportedTargetPlatforms();
auto names = NEO::toProductNames(platforms);
platforms.clear();
for (size_t i = 0; i < platforms.size(); ++i) {
auto idByName = NEO::asProductId(names[i], platforms);
EXPECT_EQ(IGFX_UNKNOWN, platforms[i]) << names[i] << " : IGFX_UNKNOWN != " << idByName;
}
}
TEST(OclocFatBinaryAsGfxCoreId, GivenEnabledGfxCoreNameThenReturnsProperGfxCoreId) {
for (unsigned int coreId = 0; coreId < IGFX_MAX_CORE; ++coreId) {
if (nullptr != NEO::familyName[coreId]) {
EXPECT_NE(IGFX_UNKNOWN_CORE, NEO::asGfxCoreId(ConstStringRef(NEO::familyName[coreId], strlen(NEO::familyName[coreId]))));
std::string caseInsesitive = NEO::familyName[coreId];
caseInsesitive[0] = 'g';
EXPECT_NE(IGFX_UNKNOWN_CORE, NEO::asGfxCoreId(caseInsesitive));
}
}
}
TEST(OclocFatBinaryAsGfxCoreId, GivenDisabledGfxCoreNameThenReturnsProperGfxCoreId) {
EXPECT_EQ(IGFX_UNKNOWN_CORE, NEO::asGfxCoreId(ConstStringRef("genA")));
EXPECT_EQ(IGFX_UNKNOWN_CORE, NEO::asGfxCoreId(ConstStringRef("gen0")));
EXPECT_EQ(IGFX_UNKNOWN_CORE, NEO::asGfxCoreId(ConstStringRef("gen1")));
EXPECT_EQ(IGFX_UNKNOWN_CORE, NEO::asGfxCoreId(ConstStringRef("gen2")));
}
TEST(OclocFatBinaryAppendPlatformsForGfxCore, GivenCoreIdThenAppendsEnabledProductIdsThatMatch) {
auto allEnabledPlatforms = NEO::getAllSupportedTargetPlatforms();
auto platform0 = allEnabledPlatforms[0];
auto gfxCore0 = NEO::hardwareInfoTable[platform0]->platform.eRenderCoreFamily;
std::vector<PRODUCT_FAMILY> appendedPlatforms;
NEO::appendPlatformsForGfxCore(gfxCore0, allEnabledPlatforms, appendedPlatforms);
std::unordered_set<PRODUCT_FAMILY> appendedPlatformsSet(appendedPlatforms.begin(), appendedPlatforms.end());
EXPECT_EQ(1U, appendedPlatformsSet.count(platform0));
for (auto platformId : allEnabledPlatforms) {
if (gfxCore0 == NEO::hardwareInfoTable[platformId]->platform.eRenderCoreFamily) {
EXPECT_EQ(1U, appendedPlatformsSet.count(platformId)) << platformId;
} else {
EXPECT_EQ(0U, appendedPlatformsSet.count(platformId)) << platformId;
}
}
NEO::appendPlatformsForGfxCore(gfxCore0, allEnabledPlatforms, appendedPlatforms);
EXPECT_EQ(2 * appendedPlatformsSet.size(), appendedPlatforms.size());
}
TEST(OclocFatBinaryGetTargetPlatformsForFatbinary, GivenAsterixThenReturnAllEnabledPlatforms) {
auto allEnabledPlatformsIds = NEO::getAllSupportedTargetPlatforms();
auto expected = NEO::toProductNames(allEnabledPlatformsIds);
auto got = NEO::getTargetPlatformsForFatbinary("*");
EXPECT_EQ(expected, got);
}
TEST(OclocFatBinaryGetTargetPlatformsForFatbinary, GivenGenThenReturnAllEnabledPlatformsThatMatch) {
auto allEnabledPlatforms = NEO::getAllSupportedTargetPlatforms();
auto platform0 = allEnabledPlatforms[0];
auto gfxCore0 = NEO::hardwareInfoTable[platform0]->platform.eRenderCoreFamily;
std::string genName = NEO::familyName[gfxCore0];
genName[0] = 'g'; // ocloc uses lower case
std::vector<PRODUCT_FAMILY> platformsForGen;
NEO::appendPlatformsForGfxCore(gfxCore0, allEnabledPlatforms, platformsForGen);
auto expected = NEO::toProductNames(platformsForGen);
auto got = NEO::getTargetPlatformsForFatbinary(genName);
EXPECT_EQ(expected, got);
}
TEST(OclocFatBinaryGetTargetPlatformsForFatbinary, GivenMutiplePlatformThenReturnThosePlatforms) {
auto allEnabledPlatforms = NEO::getAllSupportedTargetPlatforms();
if (allEnabledPlatforms.size() < 2) {
return;
}
auto platform0 = allEnabledPlatforms[0];
std::string platform0Name = NEO::hardwarePrefix[platform0];
auto platform1 = allEnabledPlatforms[1];
std::string platform1Name = NEO::hardwarePrefix[platform1];
std::vector<ConstStringRef> expected{platform0Name, platform1Name};
auto got = NEO::getTargetPlatformsForFatbinary(platform0Name + "," + platform1Name);
EXPECT_EQ(expected, got);
}
TEST(OclocFatBinaryGetTargetPlatformsForFatbinary, GivenPlatformOpenRangeFromThenReturnAllEnabledPlatformsThatMatch) {
auto allEnabledPlatforms = NEO::getAllSupportedTargetPlatforms();
if (allEnabledPlatforms.size() < 3) {
return;
}
auto platform0 = allEnabledPlatforms[allEnabledPlatforms.size() / 2];
std::string platformName = NEO::hardwarePrefix[platform0];
std::vector<PRODUCT_FAMILY> expectedPlatforms;
auto platformFrom = std::find(allEnabledPlatforms.begin(), allEnabledPlatforms.end(), platform0);
expectedPlatforms.insert(expectedPlatforms.end(), platformFrom, allEnabledPlatforms.end());
auto expected = NEO::toProductNames(expectedPlatforms);
auto got = NEO::getTargetPlatformsForFatbinary(platformName + "-");
EXPECT_EQ(expected, got);
}
TEST(OclocFatBinaryGetTargetPlatformsForFatbinary, GivenPlatformOpenRangeToThenReturnAllEnabledPlatformsThatMatch) {
auto allEnabledPlatforms = NEO::getAllSupportedTargetPlatforms();
if (allEnabledPlatforms.size() < 3) {
return;
}
auto platform0 = allEnabledPlatforms[allEnabledPlatforms.size() / 2];
std::string platformName = NEO::hardwarePrefix[platform0];
std::vector<PRODUCT_FAMILY> expectedPlatforms;
auto platformTo = std::find(allEnabledPlatforms.begin(), allEnabledPlatforms.end(), platform0);
expectedPlatforms.insert(expectedPlatforms.end(), allEnabledPlatforms.begin(), platformTo + 1);
auto expected = NEO::toProductNames(expectedPlatforms);
auto got = NEO::getTargetPlatformsForFatbinary("-" + platformName);
EXPECT_EQ(expected, got);
}
TEST(OclocFatBinaryGetTargetPlatformsForFatbinary, GivenPlatformClosedRangeThenReturnAllEnabledPlatformsThatMatch) {
auto allEnabledPlatforms = NEO::getAllSupportedTargetPlatforms();
if (allEnabledPlatforms.size() < 4) {
return;
}
auto platformFrom = allEnabledPlatforms[1];
auto platformTo = allEnabledPlatforms[allEnabledPlatforms.size() - 2];
std::string platformNameFrom = NEO::hardwarePrefix[platformFrom];
std::string platformNameTo = NEO::hardwarePrefix[platformTo];
std::vector<PRODUCT_FAMILY> expectedPlatforms;
expectedPlatforms.insert(expectedPlatforms.end(), allEnabledPlatforms.begin() + 1, allEnabledPlatforms.begin() + allEnabledPlatforms.size() - 1);
auto expected = NEO::toProductNames(expectedPlatforms);
auto got = NEO::getTargetPlatformsForFatbinary(platformNameFrom + "-" + platformNameTo);
EXPECT_EQ(expected, got);
got = NEO::getTargetPlatformsForFatbinary(platformNameTo + "-" + platformNameFrom); // swap min with max implicitly
EXPECT_EQ(expected, got);
}
std::vector<GFXCORE_FAMILY> getEnabledCores() {
std::vector<GFXCORE_FAMILY> ret;
for (unsigned int coreId = 0; coreId < IGFX_MAX_CORE; ++coreId) {
if (nullptr != NEO::familyName[coreId]) {
ret.push_back(static_cast<GFXCORE_FAMILY>(coreId));
}
}
return ret;
}
TEST(OclocFatBinaryGetTargetPlatformsForFatbinary, GivenGenOpenRangeFromThenReturnAllEnabledPlatformsThatMatch) {
auto allSupportedPlatforms = NEO::getAllSupportedTargetPlatforms();
auto allEnabledCores = getEnabledCores();
if (allEnabledCores.size() < 3) {
return;
}
auto core0 = allEnabledCores[allEnabledCores.size() / 2];
std::string genName = NEO::familyName[core0];
genName[0] = 'g'; // ocloc uses lower case
std::vector<PRODUCT_FAMILY> expectedPlatforms;
unsigned int coreIt = core0;
while (coreIt < static_cast<unsigned int>(IGFX_MAX_CORE)) {
NEO::appendPlatformsForGfxCore(static_cast<GFXCORE_FAMILY>(coreIt), allSupportedPlatforms, expectedPlatforms);
++coreIt;
}
auto expected = NEO::toProductNames(expectedPlatforms);
auto got = NEO::getTargetPlatformsForFatbinary(genName + "-");
EXPECT_EQ(expected, got);
}
TEST(OclocFatBinaryGetTargetPlatformsForFatbinary, GivenGenOpenRangeToThenReturnAllEnabledPlatformsThatMatch) {
auto allSupportedPlatforms = NEO::getAllSupportedTargetPlatforms();
auto allEnabledCores = getEnabledCores();
if (allEnabledCores.size() < 3) {
return;
}
auto core0 = allEnabledCores[allEnabledCores.size() / 2];
std::string genName = NEO::familyName[core0];
genName[0] = 'g'; // ocloc uses lower case
std::vector<PRODUCT_FAMILY> expectedPlatforms;
unsigned int coreIt = IGFX_UNKNOWN_CORE;
++coreIt;
while (coreIt <= static_cast<unsigned int>(core0)) {
NEO::appendPlatformsForGfxCore(static_cast<GFXCORE_FAMILY>(coreIt), allSupportedPlatforms, expectedPlatforms);
++coreIt;
}
auto expected = NEO::toProductNames(expectedPlatforms);
auto got = NEO::getTargetPlatformsForFatbinary("-" + genName);
EXPECT_EQ(expected, got);
}
TEST(OclocFatBinaryGetTargetPlatformsForFatbinary, GivenGenClosedRangeThenReturnAllEnabledPlatformsThatMatch) {
auto allEnabledPlatforms = NEO::getAllSupportedTargetPlatforms();
auto allEnabledCores = getEnabledCores();
if (allEnabledCores.size() < 4) {
return;
}
auto genFrom = allEnabledCores[1];
auto genTo = allEnabledCores[allEnabledCores.size() - 2];
std::string genNameFrom = NEO::familyName[genFrom];
genNameFrom[0] = 'g';
std::string genNameTo = NEO::familyName[genTo];
genNameTo[0] = 'g';
std::vector<PRODUCT_FAMILY> expectedPlatforms;
auto genIt = genFrom;
while (genIt <= genTo) {
NEO::appendPlatformsForGfxCore(static_cast<GFXCORE_FAMILY>(genIt), allEnabledPlatforms, expectedPlatforms);
genIt = static_cast<GFXCORE_FAMILY>(static_cast<unsigned int>(genIt) + 1);
}
auto expected = NEO::toProductNames(expectedPlatforms);
auto got = NEO::getTargetPlatformsForFatbinary(genNameFrom + "-" + genNameTo);
EXPECT_EQ(expected, got);
got = NEO::getTargetPlatformsForFatbinary(genNameTo + "-" + genNameFrom); // swap min with max implicitly
EXPECT_EQ(expected, got);
}
TEST(OclocFatBinaryGetTargetPlatformsForFatbinary, GivenUnkownGenThenReturnEmptyList) {
auto got = NEO::getTargetPlatformsForFatbinary("gen0");
EXPECT_TRUE(got.empty());
}
TEST(OclocFatBinaryGetTargetPlatformsForFatbinary, GivenMutiplePlatformWhenAnyOfPlatformsIsUnknownThenReturnEmptyList) {
auto allEnabledPlatforms = NEO::getAllSupportedTargetPlatforms();
auto platform0 = allEnabledPlatforms[0];
std::string platform0Name = NEO::hardwarePrefix[platform0];
auto got = NEO::getTargetPlatformsForFatbinary(platform0Name + ",unk");
EXPECT_TRUE(got.empty());
}
TEST(OclocFatBinaryGetTargetPlatformsForFatbinary, GivenPlatformOpenRangeFromWhenPlatformsIsUnkownThenReturnEmptyList) {
auto got = NEO::getTargetPlatformsForFatbinary("unk-");
EXPECT_TRUE(got.empty());
}
TEST(OclocFatBinaryGetTargetPlatformsForFatbinary, GivenPlatformOpenRangeToWhenPlatformsIsUnkownThenReturnEmptyList) {
auto got = NEO::getTargetPlatformsForFatbinary("-unk");
EXPECT_TRUE(got.empty());
}
TEST(OclocFatBinaryGetTargetPlatformsForFatbinary, GivenPlatformClosedRangeWhenAnyOfPlatformsIsUnkownThenReturnEmptyList) {
auto allEnabledPlatforms = NEO::getAllSupportedTargetPlatforms();
auto platform0 = allEnabledPlatforms[0];
std::string platform0Name = NEO::hardwarePrefix[platform0];
auto got = NEO::getTargetPlatformsForFatbinary("unk-" + platform0Name);
EXPECT_TRUE(got.empty());
got = NEO::getTargetPlatformsForFatbinary(platform0Name + "-unk");
EXPECT_TRUE(got.empty());
}
TEST(OclocFatBinaryGetTargetPlatformsForFatbinary, GivenGenOpenRangeFromWhenGenIsUnknownTheReturnEmptyList) {
auto got = NEO::getTargetPlatformsForFatbinary("gen2-");
EXPECT_TRUE(got.empty());
}
TEST(OclocFatBinaryGetTargetPlatformsForFatbinary, GivenGenOpenRangeToWhenGenIsUnknownTheReturnEmptyList) {
auto got = NEO::getTargetPlatformsForFatbinary("-gen2");
EXPECT_TRUE(got.empty());
}
TEST(OclocFatBinaryGetTargetPlatformsForFatbinary, GivenGenClosedRangeWhenAnyOfGensIsUnknownThenReturnEmptyList) {
auto allEnabledPlatforms = NEO::getAllSupportedTargetPlatforms();
auto platform0 = allEnabledPlatforms[0];
auto gfxCore0 = NEO::hardwareInfoTable[platform0]->platform.eRenderCoreFamily;
std::string genName = NEO::familyName[gfxCore0];
genName[0] = 'g'; // ocloc uses lower case
auto got = NEO::getTargetPlatformsForFatbinary("gen2-" + genName);
EXPECT_TRUE(got.empty());
got = NEO::getTargetPlatformsForFatbinary(genName + "-gen2");
EXPECT_TRUE(got.empty());
}

View File

@ -232,7 +232,7 @@ TEST_F(OfflineCompilerTests, GoodArgTest) {
"-device",
gEnvironment->devicePrefix.c_str()};
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, retVal);
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
EXPECT_NE(nullptr, pOfflineCompiler);
EXPECT_EQ(CL_SUCCESS, retVal);
@ -261,7 +261,7 @@ TEST_F(OfflineCompilerTests, GoodBuildTest) {
"-device",
gEnvironment->devicePrefix.c_str()};
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, retVal);
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
EXPECT_NE(nullptr, pOfflineCompiler);
EXPECT_EQ(CL_SUCCESS, retVal);
@ -289,7 +289,7 @@ TEST_F(OfflineCompilerTests, GoodBuildTestWithLlvmText) {
gEnvironment->devicePrefix.c_str(),
"-llvm_text"};
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, retVal);
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
EXPECT_NE(nullptr, pOfflineCompiler);
EXPECT_EQ(CL_SUCCESS, retVal);
@ -327,7 +327,7 @@ TEST_F(OfflineCompilerTests, GoodParseBinToCharArray) {
"-device",
gEnvironment->devicePrefix.c_str()};
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, retVal);
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
// clang-format off
uint8_t binary[] = {
0x02, 0x23, 0x3, 0x40, 0x56, 0x7, 0x80, 0x90, 0x1, 0x03,
@ -374,7 +374,7 @@ TEST_F(OfflineCompilerTests, GoodBuildTestWithCppFile) {
gEnvironment->devicePrefix.c_str(),
"-cpp_file"};
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, retVal);
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
EXPECT_NE(nullptr, pOfflineCompiler);
EXPECT_EQ(CL_SUCCESS, retVal);
@ -398,7 +398,7 @@ TEST_F(OfflineCompilerTests, GoodBuildTestWithOutputDir) {
"-out_dir",
"offline_compiler_test"};
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, retVal);
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
EXPECT_NE(nullptr, pOfflineCompiler);
EXPECT_EQ(CL_SUCCESS, retVal);
@ -417,7 +417,7 @@ TEST_F(OfflineCompilerTests, PrintUsage) {
"--help"};
testing::internal::CaptureStdout();
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, retVal);
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
std::string output = testing::internal::GetCapturedStdout();
EXPECT_EQ(nullptr, pOfflineCompiler);
EXPECT_STRNE("", output.c_str());
@ -435,7 +435,7 @@ TEST_F(OfflineCompilerTests, NaughtyArgTest_File) {
gEnvironment->devicePrefix.c_str()};
testing::internal::CaptureStdout();
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, retVal);
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
std::string output = testing::internal::GetCapturedStdout();
EXPECT_STRNE(output.c_str(), "");
EXPECT_EQ(nullptr, pOfflineCompiler);
@ -453,7 +453,7 @@ TEST_F(OfflineCompilerTests, NaughtyArgTest_Flag) {
gEnvironment->devicePrefix.c_str()};
testing::internal::CaptureStdout();
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, retVal);
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
std::string output = testing::internal::GetCapturedStdout();
EXPECT_STRNE(output.c_str(), "");
EXPECT_EQ(nullptr, pOfflineCompiler);
@ -469,7 +469,7 @@ TEST_F(OfflineCompilerTests, NaughtyArgTest_NumArgs) {
};
testing::internal::CaptureStdout();
pOfflineCompiler = OfflineCompiler::create(argvA.size(), argvA, retVal);
pOfflineCompiler = OfflineCompiler::create(argvA.size(), argvA, true, retVal);
std::string output = testing::internal::GetCapturedStdout();
EXPECT_STRNE(output.c_str(), "");
@ -484,7 +484,7 @@ TEST_F(OfflineCompilerTests, NaughtyArgTest_NumArgs) {
"test_files/ImANaughtyFile.cl",
"-device"};
testing::internal::CaptureStdout();
pOfflineCompiler = OfflineCompiler::create(argvB.size(), argvB, retVal);
pOfflineCompiler = OfflineCompiler::create(argvB.size(), argvB, true, retVal);
output = testing::internal::GetCapturedStdout();
EXPECT_STRNE(output.c_str(), "");
EXPECT_EQ(nullptr, pOfflineCompiler);
@ -502,7 +502,7 @@ TEST_F(OfflineCompilerTests, GivenNonexistantDeviceWhenCompilingThenExitWithErro
"foobar"};
testing::internal::CaptureStdout();
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, retVal);
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
std::string output = testing::internal::GetCapturedStdout();
EXPECT_STREQ(output.c_str(), "Error: Cannot get HW Info for device foobar.\n");
EXPECT_EQ(nullptr, pOfflineCompiler);
@ -517,7 +517,7 @@ TEST_F(OfflineCompilerTests, NaughtyKernelTest) {
"-device",
gEnvironment->devicePrefix.c_str()};
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, retVal);
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal);
EXPECT_NE(nullptr, pOfflineCompiler);
EXPECT_EQ(CL_SUCCESS, retVal);