daphne-eu / daphne

DAPHNE: An Open and Extensible System Infrastructure for Integrated Data Analysis Pipelines
Apache License 2.0
67 stars 62 forks source link

Experimental kernels folder #828

Closed philipportner closed 1 month ago

philipportner commented 2 months ago

This commit introduces the experimental/ folder for kernels. This folder will contain alternative, experimental implementations of our kernels. These experimental implementations are using the kernel catalog feature from #456.

While being experimental, the kernels are not tightly coupled to DAPHNE, e.g, they are not used per default without specifying the required kernel hint to call the kernel and they are not tested as part of our test suite or built when compiling libAllKernels.so. Once an experimental kernel is to be moved to our default kernels, passing all the tests is required.

Making kernels executable when running DAPHNE while not yet being part of our kernel library helps with development on improving kernels.

The gemv/ folder contains a simple example of such an alternative implementation. It is using AVX2 instructions to implement the SpMV kernel, making it unsuitable to be the default kernel implementation as it requires hardware-specific instructions. Additionally, it uses the LIKWID library to benchmark CPU performance counters (similar to PAPI). Without bringing these dependencies to all DAPHNE users, one can already test the kernel, compare it with the default, run benchmarks with DAPHNE using this kernel. This is a kernel I'm working on, though this is a very simple version which will be improved and eventually brought into libAllKernels.so.

Example DAPHNE script comparing the builtin kernel and the experimental kernel

t0 = now();
y = A @ x;
time_builtin = now() - t0;

t0 = now();
y = gemv::spmv_simd_parallel_omp(A, x);
time_experimental = now() - t0;

print("builtin took=" + time_builtin / 1e6);
print("spmv_simd_parallel_omp took=" + time_experimental / 1e6);

As a kernel extension needs more than one file, *.cpp, *.json, and Makefile (or similar), I would suggest adding a folder in experimental/ as is done here in the example of experimental/gemv/.

The main purpose of this PR is visibility but feel free to add your opinion or suggestions. For more information on kernel extensions see https://daphne-eu.github.io/daphne/Extensions/.