1 /*========================== begin_copyright_notice ============================
2 
3 Copyright (C) 2017-2021 Intel Corporation
4 
5 SPDX-License-Identifier: MIT
6 
7 ============================= end_copyright_notice ===========================*/
8 
9 #ifndef _BINARYENCODINGIGA_H_
10 #define _BINARYENCODINGIGA_H_
11 
12 #include "G4_IR.hpp"
13 #include "FlowGraph.h"
14 #include "iga/IGALibrary/IR/Types.hpp"
15 
16 #include <string>
17 
18 namespace vISA {
19     // NOTE: IGA internals should be minimally leaked into vISA/G4
20 
21     // Encodes a G4_Kernel via the IGA assembler
22     struct EncodeResult {
23         void *binary;
24         size_t binaryLen;
25         std::string error; // in case of error
26     };
27 
28     EncodeResult EncodeKernelIGA(
29         vISA::Mem_Manager &m,
30         vISA::G4_Kernel& k,
31         const std::string &fname);
32 
33 
34     iga::SWSB_ENCODE_MODE GetIGASWSBEncodeMode(const IR_Builder& builder);
35 
36     bool InstSupportsSaturationIGA(TARGET_PLATFORM p, const G4_INST &i, const IR_Builder& builder);
37     bool InstSupportsSrcModifierIGA(TARGET_PLATFORM p, const G4_INST &i, const IR_Builder& builder);
38 
39 
40 
41     ///////////////////////////////////////////////////////////////////////////
42     // TODO: remove these in step 2
43     // const iga::Model *GetModelIGA(TARGET_PLATFORM p);
44     //
45     // std::pair<const iga::OpSpec*,iga::Subfunction> GetOpInfoIGA(
46     //    const G4_INST *inst, iga::Platform p, bool allowUnknownOp);
47 } // vISA::
48 
49 #endif //_BINARYENCODINGIGA_H_
50