@@ -9,14 +9,15 @@ SPDX-License-Identifier: MIT
9
9
#include " BinaryEncodingIGA.h"
10
10
#include " GTGPU_RT_ASM_Interface.h"
11
11
#include " iga/IGALibrary/api/igaEncoderWrapper.hpp"
12
+ #include " iga/IGALibrary/Frontend/FormatterJSON.hpp"
12
13
#include " Timer.h"
13
14
#include " BuildIR.h"
14
15
#include " Common_ISA_framework.h"
15
16
17
+ #include < fstream>
16
18
#include < map>
17
19
#include < utility>
18
20
19
-
20
21
using namespace iga ;
21
22
using namespace vISA ;
22
23
@@ -45,6 +46,8 @@ class BinaryEncodingIGA
45
46
// translates and encodes (formerly "DoAll")
46
47
void Encode ();
47
48
49
+ void EmitJSON (int dumpJSON);
50
+
48
51
// /////////////////////////////////////////////////////////////////////////
49
52
// these function translate G4 IR to IGA IR
50
53
Instruction *translateInstruction (G4_INST *g4inst, Block*& bbNew);
@@ -1034,6 +1037,19 @@ void BinaryEncodingIGA::Encode()
1034
1037
kernel.fg .builder ->getJitInfo ()->offsetToSkipSetFFIDGP1 =
1035
1038
kernel.getComputeFFIDGP1NextOff ();
1036
1039
}
1040
+
1041
+ int dumpJSON = kernel.fg .builder ->getuint32Option (vISA_dumpIgaJson);
1042
+ if (dumpJSON) {
1043
+ EmitJSON (dumpJSON);
1044
+ }
1045
+ }
1046
+
1047
+ void BinaryEncodingIGA::EmitJSON (int dumpJSON) {
1048
+ std::string jsonFileName = fileName + " .json" ;
1049
+ std::ofstream ofs (jsonFileName, std::ofstream::out);
1050
+ FormatOpts fos (*platformModel);
1051
+ fos.printJson = true ;
1052
+ FormatJSON (ofs, fos, *IGAKernel, nullptr );
1037
1053
}
1038
1054
1039
1055
Instruction *BinaryEncodingIGA::translateInstruction (
@@ -1991,4 +2007,3 @@ bool vISA::InstSupportsSrcModifierIGA(TARGET_PLATFORM p, const G4_INST &i, const
1991
2007
return false ;
1992
2008
}
1993
2009
}
1994
-
0 commit comments