2020-02-10 06:59:57 +08:00
|
|
|
/*
|
2024-02-13 00:41:21 +08:00
|
|
|
* Copyright (C) 2020-2024 Intel Corporation
|
2020-02-10 06:59:57 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2024-02-13 00:41:21 +08:00
|
|
|
#include "shared/source/compiler_interface/tokenized_string.h"
|
2023-07-27 20:00:51 +08:00
|
|
|
#include "shared/source/utilities/arrayref.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/utilities/const_stringref.h"
|
2020-02-10 06:59:57 +08:00
|
|
|
|
2022-02-11 23:54:41 +08:00
|
|
|
#include <cstdint>
|
2020-05-18 17:47:20 +08:00
|
|
|
#include <string>
|
2020-02-10 06:59:57 +08:00
|
|
|
#include <vector>
|
|
|
|
|
2023-07-27 20:00:51 +08:00
|
|
|
class OclocArgHelper;
|
|
|
|
|
2020-02-10 06:59:57 +08:00
|
|
|
namespace NEO {
|
2023-07-27 20:00:51 +08:00
|
|
|
namespace Ar {
|
|
|
|
struct ArEncoder;
|
|
|
|
}
|
|
|
|
class OfflineCompiler;
|
2020-02-10 06:59:57 +08:00
|
|
|
|
2024-06-27 22:44:13 +08:00
|
|
|
bool isSpvOnly(const std::vector<std::string> &args);
|
2023-11-17 00:48:56 +08:00
|
|
|
bool requestedFatBinary(ConstStringRef deviceArg, OclocArgHelper *helper);
|
2021-04-16 21:25:00 +08:00
|
|
|
bool requestedFatBinary(const std::vector<std::string> &args, OclocArgHelper *helper);
|
|
|
|
inline bool requestedFatBinary(int argc, const char *argv[], OclocArgHelper *helper) {
|
2020-05-18 17:47:20 +08:00
|
|
|
std::vector<std::string> args;
|
|
|
|
args.assign(argv, argv + argc);
|
2021-04-16 21:25:00 +08:00
|
|
|
return requestedFatBinary(args, helper);
|
2020-05-18 17:47:20 +08:00
|
|
|
}
|
|
|
|
|
2024-06-27 22:44:13 +08:00
|
|
|
int getDeviceArgValueIdx(const std::vector<std::string> &args);
|
2020-05-18 17:47:20 +08:00
|
|
|
int buildFatBinary(const std::vector<std::string> &args, OclocArgHelper *argHelper);
|
|
|
|
inline int buildFatBinary(int argc, const char *argv[], OclocArgHelper *argHelper) {
|
|
|
|
std::vector<std::string> args;
|
|
|
|
args.assign(argv, argv + argc);
|
|
|
|
return buildFatBinary(args, argHelper);
|
|
|
|
}
|
2020-02-10 06:59:57 +08:00
|
|
|
|
2022-06-14 07:13:43 +08:00
|
|
|
template <typename Target>
|
|
|
|
void getProductsAcronymsForTarget(std::vector<NEO::ConstStringRef> &out, Target target, OclocArgHelper *argHelper);
|
2023-04-18 00:11:43 +08:00
|
|
|
std::vector<NEO::ConstStringRef> getProductsForRange(unsigned int productFrom, unsigned int productTo, OclocArgHelper *argHelper);
|
2022-06-14 07:13:43 +08:00
|
|
|
std::vector<ConstStringRef> getTargetProductsForFatbinary(ConstStringRef deviceArg, OclocArgHelper *argHelper);
|
2022-03-25 20:12:31 +08:00
|
|
|
int buildFatBinaryForTarget(int retVal, const std::vector<std::string> &argsCopy, std::string pointerSize, Ar::ArEncoder &fatbinary,
|
2022-02-10 00:37:53 +08:00
|
|
|
OfflineCompiler *pCompiler, OclocArgHelper *argHelper, const std::string &deviceConfig);
|
2023-07-11 20:21:32 +08:00
|
|
|
int appendGenericIr(Ar::ArEncoder &fatbinary, const std::string &inputFile, OclocArgHelper *argHelper, std::string options);
|
|
|
|
std::vector<uint8_t> createEncodedElfWithSpirv(const ArrayRef<const uint8_t> &spirv, const ArrayRef<const uint8_t> &options);
|
2024-02-13 00:41:21 +08:00
|
|
|
std::vector<ConstStringRef> getProductForSpecificTarget(const NEO::CompilerOptions::TokenizedString &targets, OclocArgHelper *argHelper);
|
2022-02-11 23:54:41 +08:00
|
|
|
|
2020-02-10 06:59:57 +08:00
|
|
|
} // namespace NEO
|