@@ -34,11 +34,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34
34
#include " llvm/Bitcode/BitcodeReader.h"
35
35
#include " llvm/Bitcode/BitcodeWriter.h"
36
36
#include " common/LLVMWarningsPop.hpp"
37
- #include " iStdLib/utility.h"
38
37
39
38
#include " secure_mem.h"
40
39
#include " secure_string.h"
41
- #include " AdaptorCommon/customApi.hpp"
42
40
43
41
#include < sstream>
44
42
#include < stdlib.h>
@@ -50,6 +48,34 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
50
48
#endif
51
49
52
50
51
+ #if defined(IGC_DEBUG_VARIABLES)
52
+ #include " common/Types.hpp"
53
+ #include " common/igc_regkeys.hpp"
54
+ #include " AdaptorCommon/customApi.hpp"
55
+ #include " 3d/common/iStdLib/utility.h"
56
+ #include < mutex>
57
+
58
+ namespace IGC
59
+ {
60
+ namespace Debug
61
+ {
62
+
63
+ static std::mutex stream_mutex;
64
+
65
+ void DumpLock ()
66
+ {
67
+ stream_mutex.lock ();
68
+ }
69
+
70
+ void DumpUnlock ()
71
+ {
72
+ stream_mutex.unlock ();
73
+ }
74
+
75
+ }
76
+ }
77
+ #endif
78
+
53
79
#ifndef WIN32
54
80
#include < dlfcn.h>
55
81
#include < stdexcept>
@@ -263,6 +289,13 @@ namespace TC
263
289
#endif
264
290
}
265
291
292
+ #if defined(IGC_DEBUG_VARIABLES)
293
+ if (success)
294
+ {
295
+ LoadRegistryKeys ();
296
+ }
297
+ #endif
298
+
266
299
if (!success)
267
300
{
268
301
CClangTranslationBlock::Delete (pTranslationBlock);
@@ -544,7 +577,7 @@ namespace TC
544
577
const SElf64SectionHeader* pSectionHeader = pElfReader->GetSectionHeader (1 );
545
578
if (NULL == pSectionHeader)
546
579
{
547
- assert (" pSectionHeader cannot be NULL" );
580
+ llvm::report_fatal_error (" pSectionHeader cannot be NULL" );
548
581
}
549
582
if (pSectionHeader->Type == SH_TYPE_OPENCL_SOURCE)
550
583
{
@@ -876,11 +909,7 @@ namespace TC
876
909
{
877
910
const SElf64SectionHeader* pSectionHeader = pElfReader->GetSectionHeader (i);
878
911
assert (pSectionHeader != NULL );
879
- if (pSectionHeader == NULL )
880
- {
881
- SetErrorString (" No section header" , pOutputArgs);
882
- return false ;
883
- }
912
+ if (pSectionHeader == NULL ) llvm::report_fatal_error (" No section header" );
884
913
885
914
if ((pSectionHeader->Type == SH_TYPE_OPENCL_LLVM_ARCHIVE) ||
886
915
(pSectionHeader->Type == SH_TYPE_OPENCL_LLVM_BINARY))
@@ -936,8 +965,7 @@ namespace TC
936
965
937
966
if (!pElfReader.get ())
938
967
{
939
- SetErrorString (" CElfReader::Create returned NULL\n " , pOutputArgs);
940
- return false ;
968
+ llvm::report_fatal_error (" CElfReader::Create returned NULL\n " );
941
969
}
942
970
943
971
if (!pElfReader->IsValidElf64 (pInputArgs->pInput , pInputArgs->InputSize ))
@@ -1033,20 +1061,19 @@ namespace TC
1033
1061
bool successTC = TranslateClang (&args, pOutputArgs, exceptString, pInputArgs->pInternalOptions );
1034
1062
1035
1063
#if defined(IGC_DEBUG_VARIABLES)
1036
- // if (IGC_IS_FLAG_ENABLED(ShaderDumpEnable))
1037
- if (0 )
1038
- {
1039
-
1040
- // Works for all OSes. Creates dir if necessary.
1041
- const char *pOutputFolder = " " ;// IGC::Debug::GetShaderOutputFolder();
1042
- stringstream ss;
1043
- char * pBuffer = (char *)pInputArgs->pInput ;
1044
- UINT bufferSize = pInputArgs->InputSize ;
1045
-
1046
- // Create hash based on cclang binary output (currently llvm binary; later also spirv).
1047
- // Hash computed in fcl needs to be same as the one computed in igc.
1048
- // This is to ensure easy matching .cl files dumped in fcl with .ll/.dat/.asm/... files dumoed in igc.
1049
- QWORD hash = iSTD::Hash (reinterpret_cast <const DWORD *>(pOutputArgs->pOutput ), (DWORD)(pOutputArgs->OutputSize ) / 4 );
1064
+ if (IGC_IS_FLAG_ENABLED (ShaderDumpEnable))
1065
+ {
1066
+
1067
+ // Works for all OSes. Creates dir if necessary.
1068
+ const char *pOutputFolder = IGC::Debug::GetShaderOutputFolder ();
1069
+ stringstream ss;
1070
+ char * pBuffer = (char *)pInputArgs->pInput ;
1071
+ UINT bufferSize = pInputArgs->InputSize ;
1072
+
1073
+ // Create hash based on cclang binary output (currently llvm binary; later also spirv).
1074
+ // Hash computed in fcl needs to be same as the one computed in igc.
1075
+ // This is to ensure easy matching .cl files dumped in fcl with .ll/.dat/.asm/... files dumoed in igc.
1076
+ QWORD hash = iSTD::Hash (reinterpret_cast <const DWORD *>(pOutputArgs->pOutput ), int_cast<DWORD>(pOutputArgs->OutputSize ) / 4 );
1050
1077
1051
1078
ss << pOutputFolder;
1052
1079
ss << " OCL_"
0 commit comments