Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 972b081bbc9b
Choose a base ref
...
head repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6286f817fb1f
Choose a head ref
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Mar 13, 2021

  1. OscilloscopeWindow: updated filter scheduler to avoid concurrently co…

    …mputing two clFFT operations. Workaround for suspected thread safety issue in either clFFT or NVIDIA OpenCL driver
    azonenberg committed Mar 13, 2021
    Copy the full SHA
    6286f81 View commit details
Showing with 21 additions and 2 deletions.
  1. +8 −1 CMakeLists.txt
  2. +1 −1 lib
  3. +12 −0 src/glscopeclient/OscilloscopeWindow.cpp
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -12,7 +12,14 @@ set(WARNINGS "${WARNINGS} -Wshadow -Wunsafe-loop-optimizations -Wpedantic -Wcast
set(WARNINGS "${WARNINGS} -Wmissing-declarations -Wvla")
set(CMAKE_CXX_FLAGS "-g -fopenmp ${WARNINGS} --std=c++11 -mtune=native -ffast-math")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -fsanitize=address")

# seems like asan doesn't play well with OpenCL so don't enable by default in debug modes
# (causes clGetPlatformIDs to return -1001)
if(SANITIZE)
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -fsanitize=address")
else()
set(CMAKE_CXX_FLAGS_DEBUG "-O0")
endif()

if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_USE_MATH_DEFINES -D_POSIX_THREAD_SAFE_FUNCTIONS")
12 changes: 12 additions & 0 deletions src/glscopeclient/OscilloscopeWindow.cpp
Original file line number Diff line number Diff line change
@@ -2660,11 +2660,23 @@ void OscilloscopeWindow::RefreshAllFilters()
for(int block=0; !working.empty(); block++)
{
FilterBlock current_block;
bool currentBlockUsesCLFFT = false;

for(auto w : working)
{
auto d = static_cast<Filter*>(w);

//Cannot concurrently execute two filters using clFFT, for reasons which are not obvious.
//All documentation suggests everything is fully thread safe, but we get random errors if we try.
//So far only known to fail on RTX 2080 Ti with recent-ish drivers, but let's be safe for now.
if(d->UsesCLFFT())
{
if(currentBlockUsesCLFFT)
continue;
else
currentBlockUsesCLFFT = true;
}

//Check if we have any inputs that are still in the working set.
bool ok = true;
for(size_t i=0; i<d->GetInputCount(); i++)