This is an experimental path tracer using C++20 and SYCL for acceleration on devices like FPGA or GPU by using a direct implementation.
This is using triSYCL for now but it might work even better on some other SYCL implementations. Contributions and optimizations welcome!
The main focus here is to study how to replace classic features like pointers or
dynamic polymorphism that does not work (well) on heterogeneous with
more modern constructs such as std::variant
and std::visit
.
- motion blur;
- depth of field;
- materials:
- smoke;
- textures;
- Lambertian material;
- dielectric material;
- metallic roughness;
- light;
- geometry:
- spheres;
- triangles;
- x/y/z-rectangles;
- boxes;
In addition to triSYCL, this project requires the following dependancies:
- the stb image manipulation library;
On Linux, there is a good chance it can be installed with your package manager :
On Ubuntu/Debian :
sudo apt install libstb-dev
On Archlinux, install the stb package from AUR.
Clone the reposity such as with:
git clone git@github.com:triSYCL/path_tracer.git
Create a build
directory for example inside the cloned repository
and jump into it.
From there, assuming you have the https://github.com/triSYCL/triSYCL repository somewhere, run:
cmake .. -DCMAKE_MODULE_PATH=<absolute_path_to>/triSYCL/cmake
The project defaults to a Release build configuration. If you wish to debug, configure your build settings as follow:
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MODULE_PATH=<absolute_path_to>/triSYCL/cmake
It is also possible to build with https://github.com/triSYCL/sycl or https://github.com/intel/llvm/tree/sycl
cmake .. --DCMAKE_MODULE_PATH=<absolute_path_to>/triSYCL/cmake -DTRISYCL_OPENMP=OFF -DSYCL_CXX_COMPILER=<path_to_sycl_build>/bin/clang++ -DSYCL_DEVICE_TRIPLE=fpga64_sw_emu
# the triple fpga64_sw_emu is only available with https://github.com/triSYCL/sycl
The triSYCL cmake path and options are required for some cmake macros they define.
For FPGA execution you might add -DUSE_SINGLE_TASK=ON
on the
previous cmake
configuration to use a SYCL execution based on a
.single_task()
instead of .parallel_for()
, probably more efficient
on FPGA.
Build the project with:
cmake --build . --verbose --parallel `nproc`
This creates the executable.
Now you can run the path tracer with:
time ./sycl-rt
This results in the image out.png
produced by the path tracer.
Some references that were tremendously useful in writing this project: