@@ -38,15 +38,8 @@ class CISA_IR_Builder : public VISABuilder
38
38
CISA_IR_Builder (
39
39
VISA_BUILDER_OPTION buildOption, vISABuilderMode mode,
40
40
int majorVersion, int minorVersion, const WA_TABLE *pWaTable)
41
- : m_builderMode(mode), m_mem(4096 ), m_pWaTable(pWaTable)
41
+ : mBuildOption (buildOption), m_builderMode(mode), m_mem(4096 ), m_pWaTable(pWaTable)
42
42
{
43
- memset (&m_header, 0 , sizeof (m_header));
44
-
45
- mBuildOption = buildOption;
46
- m_kernel_count = 0 ;
47
- m_function_count = 0 ;
48
- m_prevKernel = nullptr ;
49
-
50
43
m_header.major_version = majorVersion;
51
44
m_header.minor_version = minorVersion;
52
45
m_header.magic_number = COMMON_ISA_MAGIC_NUM;
@@ -67,40 +60,40 @@ class CISA_IR_Builder : public VISABuilder
67
60
const char * flags[],
68
61
const WA_TABLE *pWaTable = nullptr );
69
62
static int DestroyBuilder (CISA_IR_Builder *builder);
70
- VISA_BUILDER_API virtual int AddKernel (VISAKernel *& kernel, const char * kernelName);
71
- VISA_BUILDER_API virtual int SetPrevKernel (VISAKernel *& prevKernel);
72
- VISA_BUILDER_API virtual int AddFunction (VISAFunction *& function, const char * functionName);
73
- VISA_BUILDER_API virtual int AddPayloadSection (VISAFunction *& function, const char * functionName);
74
- VISA_BUILDER_API virtual int Compile (const char * isaFileNameint, std::ostream * os = nullptr , bool emit_visa_only = false );
63
+ VISA_BUILDER_API int AddKernel (VISAKernel *& kernel, const char * kernelName) override ;
64
+ VISA_BUILDER_API int SetPrevKernel (VISAKernel *& prevKernel) override ;
65
+ VISA_BUILDER_API int AddFunction (VISAFunction *& function, const char * functionName) override ;
66
+ VISA_BUILDER_API int AddPayloadSection (VISAFunction *& function, const char * functionName) override ;
67
+ VISA_BUILDER_API int Compile (const char * isaFileNameint, std::ostream * os = nullptr , bool emit_visa_only = false ) override ;
75
68
76
- VISA_BUILDER_API void SetOption (vISAOptions option, bool val) { m_options.setOption (option, val); }
77
- VISA_BUILDER_API void SetOption (vISAOptions option, uint32_t val) { m_options.setOption (option, val); }
78
- VISA_BUILDER_API void SetOption (vISAOptions option, const char *val) { m_options.setOption (option, val); }
69
+ VISA_BUILDER_API void SetOption (vISAOptions option, bool val) override { m_options.setOption (option, val); }
70
+ VISA_BUILDER_API void SetOption (vISAOptions option, uint32_t val) override { m_options.setOption (option, val); }
71
+ VISA_BUILDER_API void SetOption (vISAOptions option, const char *val) override { m_options.setOption (option, val); }
79
72
80
73
// Used for inline asm code generation
81
- VISA_BUILDER_API virtual int ParseVISAText (const std::string& visaText, const std::string& visaTextFile);
82
- VISA_BUILDER_API virtual int ParseVISAText (const std::string& visaFile);
83
- VISA_BUILDER_API std::stringstream& GetAsmTextStream () { return m_ssIsaAsm; }
84
- VISA_BUILDER_API virtual VISAKernel* GetVISAKernel (const std::string& kernelName);
85
- VISA_BUILDER_API virtual int ClearAsmTextStreams ();
74
+ VISA_BUILDER_API int ParseVISAText (const std::string& visaText, const std::string& visaTextFile) override ;
75
+ VISA_BUILDER_API int ParseVISAText (const std::string& visaFile) override ;
76
+ VISA_BUILDER_API std::stringstream& GetAsmTextStream () override { return m_ssIsaAsm; }
77
+ VISA_BUILDER_API VISAKernel* GetVISAKernel (const std::string& kernelName) override ;
78
+ VISA_BUILDER_API int ClearAsmTextStreams () override ;
86
79
87
80
/* *************END VISA BUILDER API*************************/
88
81
89
82
string_pool_entry** branch_targets;
90
- common_isa_header m_header;
83
+ common_isa_header m_header {} ;
91
84
92
85
// the current vISA kernel/function being processed
93
86
VISAKernelImpl *m_kernel;
94
- VISAKernelImpl *m_prevKernel;
87
+ VISAKernelImpl *m_prevKernel = nullptr ;
95
88
CisaFramework::CisaBinary *m_cisaBinary;
96
- VISAKernelImpl * get_kernel () { return m_kernel; }
89
+ VISAKernelImpl * get_kernel () const { return m_kernel; }
97
90
98
91
std::stringstream& criticalMsgStream ()
99
92
{
100
93
return criticalMsg;
101
94
}
102
95
103
- std::string GetCriticalMsg ()
96
+ std::string GetCriticalMsg () override
104
97
{
105
98
return criticalMsg.str ();
106
99
}
@@ -135,7 +128,7 @@ class CISA_IR_Builder : public VISABuilder
135
128
criticalMsg << m_errorMessage << " \n " ;
136
129
}
137
130
bool HasParseError () const {return !m_errorMessage.empty ();}
138
- std::string GetParseError () {return m_errorMessage;}
131
+ std::string GetParseError () const {return m_errorMessage;}
139
132
140
133
template <typename ...Ts>
141
134
void RecordParseWarning (int lineNum, Ts...ts)
@@ -155,7 +148,7 @@ class CISA_IR_Builder : public VISABuilder
155
148
// holds the %DispatchSimdSize attribute
156
149
int m_dispatchSimdSize = -1 ;
157
150
158
- const WA_TABLE *getWATable () { return m_pWaTable; }
151
+ const WA_TABLE *getWATable () const { return m_pWaTable; }
159
152
160
153
uint8_t getMajorVersion () const { return m_header.major_version ; }
161
154
uint8_t getMinorVersion () const { return m_header.minor_version ; }
@@ -870,12 +863,12 @@ class CISA_IR_Builder : public VISABuilder
870
863
private:
871
864
872
865
vISA::Mem_Manager m_mem;
873
- VISA_BUILDER_OPTION mBuildOption ;
866
+ const VISA_BUILDER_OPTION mBuildOption ;
874
867
// FIXME: we need to make 3D/media per kernel instead of per builder
875
868
const vISABuilderMode m_builderMode;
876
869
877
- unsigned int m_kernel_count;
878
- unsigned int m_function_count;
870
+ unsigned int m_kernel_count = 0 ;
871
+ unsigned int m_function_count = 0 ;
879
872
880
873
// list of kernels and functions added to this builder
881
874
std::list<VISAKernelImpl *> m_kernelsAndFunctions;
0 commit comments