Skip to content

Commit fdb5761

Browse files
committed
Workaround for intel SDE crash
(float exceptions)
1 parent daaaa87 commit fdb5761

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

tests/main.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,11 @@ int main(int argc, char *argv[]) {
196196
g_minimal_output = true;
197197

198198
#if defined(_WIN32) && !defined(__clang__)
199-
const bool enable_fp_exceptions = !nocpu || full_tests;
199+
bool enable_fp_exceptions = !nocpu || full_tests;
200+
// Workaround for Intel SDE crash
201+
enable_fp_exceptions &= !preferred_arch[0] || strcmp(preferred_arch[0], "AVX") != 0;
200202
if (enable_fp_exceptions) {
201-
unsigned old_value;
202-
_controlfp_s(&old_value, _EM_INEXACT | _EM_UNDERFLOW | _EM_OVERFLOW, _MCW_EM);
203+
_controlfp_s(nullptr, _EM_INEXACT | _EM_UNDERFLOW | _EM_OVERFLOW, _MCW_EM);
203204
g_catch_flt_exceptions = true;
204205
}
205206
#endif

tests/test_scene.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,8 +1126,7 @@ void schedule_render_jobs(ThreadPool &threads, Ray::RendererBase &renderer, cons
11261126
auto render_job = [&](const int j, const int portion) {
11271127
#if defined(_WIN32)
11281128
if (g_catch_flt_exceptions) {
1129-
unsigned old_value;
1130-
_controlfp_s(&old_value, _EM_INEXACT | _EM_UNDERFLOW | _EM_OVERFLOW, _MCW_EM);
1129+
_controlfp_s(nullptr, _EM_INEXACT | _EM_UNDERFLOW | _EM_OVERFLOW, _MCW_EM);
11311130
}
11321131
#endif
11331132
for (int i = 0; i < portion; ++i) {
@@ -1138,9 +1137,7 @@ void schedule_render_jobs(ThreadPool &threads, Ray::RendererBase &renderer, cons
11381137
auto denoise_job_nlm = [&](const int j) {
11391138
#if defined(_WIN32)
11401139
if (g_catch_flt_exceptions) {
1141-
unsigned old_value;
1142-
//_controlfp_s(&old_value, _EM_INEXACT | _EM_UNDERFLOW | _EM_OVERFLOW, _MCW_EM);
1143-
_controlfp_s(&old_value, _EM_INEXACT | _EM_UNDERFLOW | _EM_OVERFLOW | _EM_INVALID, _MCW_EM);
1140+
_controlfp_s(nullptr, _EM_INEXACT | _EM_UNDERFLOW | _EM_OVERFLOW | _EM_INVALID, _MCW_EM);
11441141
}
11451142
#endif
11461143
renderer.DenoiseImage(region_contexts[j]);
@@ -1149,8 +1146,7 @@ void schedule_render_jobs(ThreadPool &threads, Ray::RendererBase &renderer, cons
11491146
auto denoise_job_unet = [&](const int pass, const int j) {
11501147
#if defined(_WIN32)
11511148
if (g_catch_flt_exceptions) {
1152-
unsigned old_value;
1153-
_controlfp_s(&old_value, _EM_INEXACT | _EM_UNDERFLOW | _EM_OVERFLOW, _MCW_EM);
1149+
_controlfp_s(nullptr, _EM_INEXACT | _EM_UNDERFLOW | _EM_OVERFLOW, _MCW_EM);
11541150
}
11551151
#endif
11561152
renderer.DenoiseImage(pass, region_contexts[j]);

0 commit comments

Comments
 (0)