@@ -26,6 +26,7 @@ class vISAVerifier
2626 const common_isa_header& isaHeader;
2727 const print_format_provider_t * header;
2828 Options* options;
29+ const vISA::IR_Builder* irBuilder = nullptr ; // for capability check
2930
3031 std::vector<std::string> kerror_list;
3132 std::vector<std::string> error_list;
@@ -34,26 +35,31 @@ class vISAVerifier
3435 // false -- a label is used in the kernel but not yet defined
3536 std::map<int , bool > labelDefs;
3637
37- const vISA::IR_Builder* irBuilder = nullptr ; // for capability check
3838
3939public:
4040
41- vISAVerifier (const common_isa_header& vISAHeader, const print_format_provider_t * kernelHeader, Options* opt) :
42- isaHeader (vISAHeader), header(kernelHeader), options(opt) {}
41+ vISAVerifier (const common_isa_header& vISAHeader, const print_format_provider_t * kernelHeader, Options* opt, const vISA::IR_Builder* ir_Builder ) :
42+ isaHeader (vISAHeader), header(kernelHeader), options(opt), irBuilder(ir_Builder) {}
4343
4444 virtual ~vISAVerifier () = default ;
4545
4646 void run (VISAKernelImpl* kernel);
4747
48+ void verifyInstruction (const CISA_INST* inst);
49+
4850 bool hasErrors () const { return kerror_list.size () + error_list.size () > 0 ; }
4951 size_t getNumErrors () const { return kerror_list.size () + error_list.size (); }
5052
5153 void writeReport (const char * filename);
5254
55+ std::optional<std::string> getLastErrorFound () const {
56+ if (error_list.empty ()) return std::nullopt ;
57+ return error_list.back ();
58+ }
59+
5360 private:
5461
5562 void verifyKernelHeader ();
56- void verifyInstruction (const CISA_INST* inst);
5763
5864 // checks that can only be done once the whole kernel is processed.
5965 void finalize ();
0 commit comments