P4 to Git Change 1191297 by jsjodin@alit_worker_lnx11_stg_ws on 2015/09/16 12:24:49

EPR #425397 - Fix SIGFPE filtering to be set up in the CPU device.

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpudevice.cpp#275 edit
... //depot/stg/opencl/drivers/opencl/runtime/os/os.hpp#29 edit
... //depot/stg/opencl/drivers/opencl/runtime/os/os_posix.cpp#41 edit
... //depot/stg/opencl/drivers/opencl/runtime/os/os_win32.cpp#46 edit


[ROCm/clr commit: 972644abff]
このコミットが含まれているのは:
foreman
2015-09-16 12:32:46 -04:00
コミット e43de73149
4個のファイルの変更44行の追加23行の削除
+5 -1
ファイルの表示
@@ -51,7 +51,8 @@ Device::~Device()
void
Device::tearDown()
{
aclCompilerFini(compiler_);
amd::Os::uninstallSigfpeHandler();
aclCompilerFini(compiler_);
}
bool
Device::init()
@@ -60,6 +61,9 @@ Device::init()
if (CPU_MAX_COMPUTE_UNITS == 0)
return false;
if(!amd::Os::installSigfpeHandler())
return false;
const char *library = getenv("COMPILER_LIBRARY");
aclCompilerOptions opts = {
sizeof(aclCompilerOptions_0_8),
+6
ファイルの表示
@@ -259,6 +259,12 @@ public:
//! get Application file name
static std::string getAppFileName();
//! Install SIGFPE handler for CPU device
static bool installSigfpeHandler();
//! Uninstall SIGFPE handler for CPU device
static void uninstallSigfpeHandler();
};
/*@}*/
+17 -11
ファイルの表示
@@ -124,6 +124,23 @@ static pthread_setaffinity_fn pthread_setaffinity_fptr;
static void init() __attribute__((constructor(101)));
static void init() { Os::init(); }
bool Os::installSigfpeHandler() {
// Install a SIGFPE signal handler @todo: Chain the handlers
struct sigaction sa;
sigfillset(&sa.sa_mask);
sa.sa_handler = SIG_DFL;
sa.sa_sigaction = divisionErrorHandler;
sa.sa_flags = SA_SIGINFO | SA_RESTART;
if (sigaction(SIGFPE, &sa, &oldSigAction) != 0) {
return false;
}
return true;
}
void Os::uninstallSigfpeHandler() {
}
bool
Os::init()
{
@@ -138,17 +155,6 @@ Os::init()
pageSize_ = (size_t) ::sysconf(_SC_PAGESIZE);
processorCount_ = ::sysconf(_SC_NPROCESSORS_CONF);
// Install a SIGFPE signal handler @todo: Chain the handlers
struct sigaction sa;
sigfillset(&sa.sa_mask);
sa.sa_handler = SIG_DFL;
sa.sa_sigaction = divisionErrorHandler;
sa.sa_flags = SA_SIGINFO | SA_RESTART;
if (sigaction(SIGFPE, &sa, &oldSigAction) != 0) {
return false;
}
pthread_setaffinity_fptr = (pthread_setaffinity_fn)
dlsym(RTLD_NEXT, "pthread_setaffinity_np");
+16 -11
ファイルの表示
@@ -66,10 +66,6 @@ Os::init()
QueryPerformanceFrequency(&frequency);
PerformanceFrequency = (double) frequency.QuadPart;
#ifdef _WIN64
divExceptionHandler = AddVectoredExceptionHandler(1, divExceptionFilter);
#endif // _WIN64
HMODULE handle = ::LoadLibrary("kernel32.dll");
if (handle != NULL) {
pfnSetThreadGroupAffinity = (SetThreadGroupAffinity_fn)
@@ -87,13 +83,6 @@ __declspec(allocate(".CRT$XTU")) void (*__exit)(void) = Os::tearDown;
void
Os::tearDown()
{
#ifdef _WIN64
if (divExceptionHandler != NULL) {
RemoveVectoredExceptionHandler(divExceptionHandler);
divExceptionHandler = NULL;
}
#endif // _WIN64
Thread::tearDown();
}
@@ -464,6 +453,22 @@ divExceptionFilter(struct _EXCEPTION_POINTERS* ep)
return EXCEPTION_CONTINUE_SEARCH;
}
bool Os::installSigfpeHandler() {
#ifdef _WIN64
divExceptionHandler = AddVectoredExceptionHandler(1, divExceptionFilter);
#endif // _WIN64
return true;
}
void Os::uninstallSigfpeHandler() {
#ifdef _WIN64
if (divExceptionHandler != NULL) {
RemoveVectoredExceptionHandler(divExceptionHandler);
divExceptionHandler = NULL;
}
#endif // _WIN64
}
void*
Thread::entry(Thread* thread)
{