AuroraPerego / pixeltrack-standalone

Standalone Patatrack pixel tracking
Apache License 2.0
0 stars 0 forks source link

Local variables (shared in CUDA) don't always work #4

Open AuroraPerego opened 1 year ago

AuroraPerego commented 1 year ago

In two places the accessors didn't work as expected. It seems that their value is not updated when we do some operations on them unless we print them afterward.

To reproduce the first error (tested with dpcpp 2022.1.0):

git clone -b Aurora git@github.com:AuroraPerego/pixeltrack-standalone.git
cd pixeltrack-standalone
# change the ONEAPI base
make environment
source env.sh
make -j `nproc` sycl

Then follow the instructions in the reproducer.md

To reproduce the second error (on NVIDIA GPU):

git clone -b dev git@github.com:AuroraPerego/pixeltrack-standalone.git
cd pixeltrack-standalone
git reset --hard 0ecfbdbf3877c24ff8ee640e1edf7ca9a806d3cd
// change LLVM_BASE in the Makefile and set USE_SYCL_LLVM := true 
make environment
source env.sh
make -j `nproc` sycl
./sycl --device cuda --maxEvents 1

Printing *ibs (a local variable) at line 200 of src/sycl/SYCLCore/radixSort.h fixes the segmentation fault It looks like *ibs value is not updated unless explicitly used, declaring it volatile does not solve the issue and tracks with similar issues found in other parts of the project.

The solution for now has been to get rid of local variables and use private memory instead.

Note: if the code doesn't compile due to an unexpected intrinsic comment line 155 of src/sycl/plugin-PixelVertexFinding/gpuClusterTracksIterative.h