Skip to content

Commit dca01ed

Browse files
paigealegfxbot
authored andcommitted
Revert "Fix for memory leaks"
Backout of commit 11180a6 due to Functional regression Change-Id: I2d53faf4a9526b631310bec03f6b6df5d9c9248b
1 parent 94721b3 commit dca01ed

File tree

3 files changed

+54
-30
lines changed

3 files changed

+54
-30
lines changed

IGC/CMakeLists.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3733,12 +3733,7 @@ endforeach()
37333733
"${IGC_BUILD__END_GROUP}"
37343734
)
37353735

3736-
3737-
list(REMOVE_ITEM _targetLinkLine
3738-
IGC_BUILD__LLVM_LIBS_TO_LINK
3739-
)
3740-
3741-
if(_targetIsStatic)
3736+
if(_targetIsStatic)
37423737
# Link line for projects that use IGC as static library (allows to resolve multi-circular dependencies between libraries).
37433738
set("IGC_BUILD__LINK_LINE__fcl_dll"
37443739
${_targetLinkLine}

IGC/OCLFE/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ set(IGC_BUILD__SRC__FCL
2323
"${CMAKE_CURRENT_SOURCE_DIR}/igd_fcl_mcl/source/clang_tb.cpp"
2424
"${CMAKE_CURRENT_SOURCE_DIR}/igd_fcl_mcl/source/clang_debug.cpp"
2525
"${CMAKE_CURRENT_SOURCE_DIR}/igd_fcl_mcl/source/LoadBuffer.cpp"
26+
"${CMAKE_CURRENT_SOURCE_DIR}/../common/igc_regkeys.cpp"
27+
"${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorCommon/customApi.cpp"
2628
"${IGC_BUILD__SRC__IGC_Common_CLElfLib}"
2729
)
2830

IGC/OCLFE/igd_fcl_mcl/source/clang_tb.cpp

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3434
#include "llvm/Bitcode/BitcodeReader.h"
3535
#include "llvm/Bitcode/BitcodeWriter.h"
3636
#include "common/LLVMWarningsPop.hpp"
37-
#include "iStdLib/utility.h"
3837

3938
#include "secure_mem.h"
4039
#include "secure_string.h"
41-
#include "AdaptorCommon/customApi.hpp"
4240

4341
#include <sstream>
4442
#include <stdlib.h>
@@ -50,6 +48,34 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
5048
#endif
5149

5250

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+
5379
#ifndef WIN32
5480
#include <dlfcn.h>
5581
#include <stdexcept>
@@ -263,6 +289,13 @@ namespace TC
263289
#endif
264290
}
265291

292+
#if defined(IGC_DEBUG_VARIABLES)
293+
if (success)
294+
{
295+
LoadRegistryKeys();
296+
}
297+
#endif
298+
266299
if (!success)
267300
{
268301
CClangTranslationBlock::Delete(pTranslationBlock);
@@ -544,7 +577,7 @@ namespace TC
544577
const SElf64SectionHeader* pSectionHeader = pElfReader->GetSectionHeader(1);
545578
if (NULL == pSectionHeader)
546579
{
547-
assert("pSectionHeader cannot be NULL");
580+
llvm::report_fatal_error("pSectionHeader cannot be NULL");
548581
}
549582
if (pSectionHeader->Type == SH_TYPE_OPENCL_SOURCE)
550583
{
@@ -876,11 +909,7 @@ namespace TC
876909
{
877910
const SElf64SectionHeader* pSectionHeader = pElfReader->GetSectionHeader(i);
878911
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");
884913

885914
if ((pSectionHeader->Type == SH_TYPE_OPENCL_LLVM_ARCHIVE) ||
886915
(pSectionHeader->Type == SH_TYPE_OPENCL_LLVM_BINARY))
@@ -936,8 +965,7 @@ namespace TC
936965

937966
if (!pElfReader.get())
938967
{
939-
SetErrorString("CElfReader::Create returned NULL\n", pOutputArgs);
940-
return false;
968+
llvm::report_fatal_error("CElfReader::Create returned NULL\n");
941969
}
942970

943971
if (!pElfReader->IsValidElf64(pInputArgs->pInput, pInputArgs->InputSize))
@@ -1033,20 +1061,19 @@ namespace TC
10331061
bool successTC = TranslateClang(&args, pOutputArgs, exceptString, pInputArgs->pInternalOptions);
10341062

10351063
#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);
10501077

10511078
ss << pOutputFolder;
10521079
ss << "OCL_"

0 commit comments

Comments
 (0)