2020-03-05 18:49:46 +08:00
|
|
|
/*
|
2022-12-16 22:13:42 +08:00
|
|
|
* Copyright (C) 2020-2023 Intel Corporation
|
2020-03-05 18:49:46 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "shared/offline_compiler/source/ocloc_arg_helper.h"
|
|
|
|
#include "shared/offline_compiler/source/ocloc_fatbinary.h"
|
|
|
|
|
2023-02-16 02:19:30 +08:00
|
|
|
#include "gtest/gtest.h"
|
2022-02-11 23:54:41 +08:00
|
|
|
#include "mock/mock_argument_helper.h"
|
2020-03-05 18:49:46 +08:00
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
namespace NEO {
|
2022-06-14 07:13:43 +08:00
|
|
|
class OclocEnabledAcronyms : public ::testing::Test {
|
|
|
|
public:
|
2022-07-08 19:29:59 +08:00
|
|
|
std::vector<DeviceAotInfo> enabledProducts{};
|
2022-06-14 07:13:43 +08:00
|
|
|
std::vector<ConstStringRef> enabledProductsAcronyms{};
|
|
|
|
std::vector<ConstStringRef> enabledFamiliesAcronyms{};
|
|
|
|
std::vector<ConstStringRef> enabledReleasesAcronyms{};
|
|
|
|
};
|
2022-02-11 23:54:41 +08:00
|
|
|
|
2022-06-14 07:13:43 +08:00
|
|
|
class OclocFatBinaryProductAcronymsTests : public OclocEnabledAcronyms {
|
2020-03-05 18:49:46 +08:00
|
|
|
public:
|
2022-06-14 07:13:43 +08:00
|
|
|
OclocFatBinaryProductAcronymsTests() {
|
2020-03-05 18:49:46 +08:00
|
|
|
oclocArgHelperWithoutInput = std::make_unique<OclocArgHelper>();
|
|
|
|
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{true};
|
2022-06-14 07:13:43 +08:00
|
|
|
|
2022-07-08 19:29:59 +08:00
|
|
|
enabledProducts = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo();
|
|
|
|
enabledProductsAcronyms = oclocArgHelperWithoutInput->productConfigHelper->getRepresentativeProductAcronyms();
|
|
|
|
enabledFamiliesAcronyms = oclocArgHelperWithoutInput->productConfigHelper->getFamiliesAcronyms();
|
|
|
|
enabledReleasesAcronyms = oclocArgHelperWithoutInput->productConfigHelper->getReleasesAcronyms();
|
2020-03-05 18:49:46 +08:00
|
|
|
}
|
2022-06-14 07:13:43 +08:00
|
|
|
|
2020-03-05 18:49:46 +08:00
|
|
|
std::unique_ptr<OclocArgHelper> oclocArgHelperWithoutInput;
|
|
|
|
};
|
2022-02-11 23:54:41 +08:00
|
|
|
|
2022-06-14 07:13:43 +08:00
|
|
|
class OclocFatBinaryTest : public OclocEnabledAcronyms {
|
2022-02-11 23:54:41 +08:00
|
|
|
public:
|
|
|
|
OclocFatBinaryTest() {
|
|
|
|
mockArgHelperFilesMap[spirvFilename] = spirvFileContent;
|
|
|
|
mockArgHelper.interceptOutput = true;
|
2022-06-14 07:13:43 +08:00
|
|
|
|
2022-07-08 19:29:59 +08:00
|
|
|
enabledProducts = mockArgHelper.productConfigHelper->getDeviceAotInfo();
|
|
|
|
enabledProductsAcronyms = mockArgHelper.productConfigHelper->getRepresentativeProductAcronyms();
|
|
|
|
enabledFamiliesAcronyms = mockArgHelper.productConfigHelper->getFamiliesAcronyms();
|
|
|
|
enabledReleasesAcronyms = mockArgHelper.productConfigHelper->getReleasesAcronyms();
|
2022-02-11 23:54:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
constexpr static ConstStringRef archiveGenericIrName{"generic_ir"};
|
|
|
|
|
|
|
|
MockOclocArgHelper::FilesMap mockArgHelperFilesMap{};
|
|
|
|
MockOclocArgHelper mockArgHelper{mockArgHelperFilesMap};
|
|
|
|
|
|
|
|
std::string outputArchiveName{"output_archive"};
|
|
|
|
std::string spirvFilename{"input_file.spv"};
|
|
|
|
std::string spirvFileContent{"\x07\x23\x02\x03"};
|
|
|
|
};
|
|
|
|
|
2022-12-16 22:13:42 +08:00
|
|
|
struct OclocFatbinaryPerProductTests : public ::testing::TestWithParam<std::tuple<std::string, PRODUCT_FAMILY>> {
|
|
|
|
void SetUp() override {
|
|
|
|
std::tie(release, productFamily) = GetParam();
|
|
|
|
argHelper = std::make_unique<OclocArgHelper>();
|
|
|
|
argHelper->getPrinterRef() = MessagePrinter{true};
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string release;
|
|
|
|
PRODUCT_FAMILY productFamily;
|
|
|
|
std::unique_ptr<OclocArgHelper> argHelper;
|
|
|
|
};
|
|
|
|
|
2020-03-05 18:49:46 +08:00
|
|
|
} // namespace NEO
|