1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
/*========================== begin_copyright_notice ============================
Copyright (C) 2017-2021 Intel Corporation
SPDX-License-Identifier: MIT
============================= end_copyright_notice ===========================*/
#ifndef COMMON_ISA_FRAMEWORK
#define COMMON_ISA_FRAMEWORK
#include <cstdio>
#include <fstream>
#include <list>
#include <map>
#include <sstream>
#include <string>
#include <vector>
#include "Common_ISA.h"
#include "IsaDescription.h"
#include "IsaVerification.h"
#include "Mem_Manager.h"
#include "visa_igc_common_header.h"
#define CISA_INVALID_ADDR_ID -1
#define CISA_INVALID_PRED_ID -1
#define CISA_INVALID_VAR_ID ((unsigned)-1)
#define CISA_INVALID_SURFACE_ID -1
#define CISA_INVALID_SAMPLER_ID -1
#define INVALID_LABEL_ID -1
// reserve p0 for the case of no predication
#define COMMON_ISA_NUM_PREDEFINED_PRED 1
#if 0
#define DEBUG_PRINT_SIZE(msg, value) \
{ std::cout << msg << value << "\n"; }
#define DEBUG_PRINT_SIZE_INSTRUCTION(msg, inst, value) \
{ std::cerr << msg << ISA_Inst_Table[inst].str << " : " << value << "\n"; }
#else
#define DEBUG_PRINT_SIZE(msg, value)
#define DEBUG_PRINT_SIZE_INSTRUCTION(msg, inst, value)
#endif
struct attr_gen_struct {
const char *name;
bool isInt;
int value;
const char *string_val;
bool attr_set;
};
class VISAKernel;
class VISAKernelImpl;
class CISA_IR_Builder;
namespace CisaFramework {
// Wrapper for CISA_INST that also keeps track of its size in vISA binary.
class CisaInst {
public:
CisaInst(vISA::Mem_Manager &mem) : m_mem(mem), m_size(0) {
memset(&m_cisa_instruction, 0, sizeof(CISA_INST));
m_size = 1; // opcode size
}
virtual ~CisaInst() {}
CISA_INST m_cisa_instruction;
const VISA_INST_Desc* m_inst_desc = nullptr;
int createCisaInstruction(ISA_Opcode opcode, unsigned char exec_size,
unsigned char modifier, PredicateOpnd pred,
VISA_opnd **opnd, int numOpnds,
const VISA_INST_Desc *inst_desc,
vISAVerifier *verifier = nullptr);
int getSize() const { return m_size; }
CISA_INST *getCISAInst() { return &m_cisa_instruction; }
const VISA_INST_Desc *getCISAInstDesc() const { return m_inst_desc; }
void *operator new(size_t sz, vISA::Mem_Manager &m) { return m.alloc(sz); }
private:
vISA::Mem_Manager &m_mem;
short m_size;
};
bool allowDump(const Options &options, const std::string &fileName);
} // namespace CisaFramework
#endif
|