Files
compute-runtime/shared/offline_compiler/source/ocloc_concat.h
Krystian Chmielewski 7982e26ae7 feat(ocloc concat): allow device binary
Allow for use of device binary in ocloc concat. Previously only
AR files could be concatenated.
This feature only works for zebin with AOT Product Config note.

Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
2023-02-10 17:45:00 +01:00

55 lines
1.5 KiB
C++

/*
* Copyright (C) 2022-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/utilities/arrayref.h"
#include "shared/source/utilities/const_stringref.h"
#include <string>
#include <vector>
namespace AOT {
enum PRODUCT_CONFIG : uint32_t;
}
class OclocArgHelper;
namespace NEO {
namespace Ar {
struct Ar;
}
class OclocConcat {
public:
using ErrorCode = uint32_t;
OclocConcat() = delete;
OclocConcat(const OclocConcat &) = delete;
OclocConcat &operator=(const OclocConcat &) = delete;
OclocConcat(OclocArgHelper *argHelper) : argHelper(argHelper){};
ErrorCode initialize(const std::vector<std::string> &args);
ErrorCode concatenate();
void printHelp();
static constexpr ConstStringRef commandStr = "concat";
static constexpr ConstStringRef helpMessage = R"===(
ocloc concat - concatenates fat binary files
Usage: ocloc concat <fat binary> <fat binary> ... [-out <concatenated fat binary file name>]
)===";
protected:
ErrorCode checkIfFatBinariesExist();
MOCKABLE_VIRTUAL Ar::Ar decodeAr(ArrayRef<const uint8_t> arFile, std::string &outErrors, std::string &outWarnings);
AOT::PRODUCT_CONFIG getAOTProductConfigFromBinary(ArrayRef<const uint8_t> binary, std::string &outErrors);
ErrorCode parseArguments(const std::vector<std::string> &args);
void printMsg(ConstStringRef fileName, const std::string &message);
OclocArgHelper *argHelper;
std::vector<std::string> fileNamesToConcat;
std::string fatBinaryName = "concat.ar";
};
} // namespace NEO