Merge "SWDEV-328274 - Move DLLMain from VDI layer to HIP/OCL layers" into amd-staging
[ROCm/clr commit: 4d300d1f8a]
This commit is contained in:
@@ -94,6 +94,11 @@ target_sources(amdocl PRIVATE
|
||||
cl_svm.cpp
|
||||
cl_thread_trace_amd.cpp)
|
||||
|
||||
if(WIN32)
|
||||
target_sources(amdocl PRIVATE
|
||||
cl_runtime.cpp)
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
if(WIN32)
|
||||
target_sources(amdocl PRIVATE amdocl.def)
|
||||
|
||||
@@ -491,13 +491,6 @@ RUNTIME_ENTRY(cl_int, clReleaseDevice, (cl_device_id device)) {
|
||||
}
|
||||
RUNTIME_EXIT
|
||||
|
||||
// dummy function for OCL, release resource for HIP
|
||||
namespace amd {
|
||||
|
||||
void shutDown() {}
|
||||
|
||||
} // namespace amd
|
||||
|
||||
/*! @}
|
||||
* @}
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/* Copyright (c) 2008 - 2022 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
|
||||
#include "thread/thread.hpp"
|
||||
|
||||
#include <windows.h>
|
||||
#include <iostream>
|
||||
|
||||
#ifdef DEBUG
|
||||
static int reportHook(int reportType, char* message, int* returnValue) {
|
||||
if (returnValue) {
|
||||
*returnValue = 1;
|
||||
}
|
||||
std::cerr << message;
|
||||
::exit(3);
|
||||
return TRUE;
|
||||
}
|
||||
#endif // DEBUG
|
||||
|
||||
extern "C" BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) {
|
||||
switch (reason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
#ifdef DEBUG
|
||||
if (!::getenv("AMD_OCL_ENABLE_MESSAGE_BOX")) {
|
||||
_CrtSetReportHook(reportHook);
|
||||
_set_error_mode(_OUT_TO_STDERR);
|
||||
}
|
||||
#endif // DEBUG
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
case DLL_THREAD_DETACH: {
|
||||
amd::Thread* thread = amd::Thread::current();
|
||||
delete thread;
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user