Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental kernels folder #828

Merged
merged 1 commit into from
Sep 29, 2024
Merged

Experimental kernels folder #828

merged 1 commit into from
Sep 29, 2024

Conversation

philipportner
Copy link
Collaborator

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.

  • Dependencies can be used while being experimental without having to worry about making them a requirement for all DAPHNE users
  • Prototyping and development speed is increased, as only the kernel has to be recompiled, this is drastically faster than having to compile the libAllKernels.so each time
  • Provides a playing ground for developers to try out alternative implementations
  • Makes it easy to benchmark and compare different implementations of the same kernel by using different kernel hints
  • Non-intrusive way to work on DAPHNE kernels without affecting other developers, while also giving them the possibility to use them or to contribute

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/.

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

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. 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 the development when improving kernels.

- Dependencies can be used while being experimental without having to
  worry about making them a requirement for all DAPHNE users
- Prototyping and development speed is increased, as only the kernel has
  to be recompiled this is drasticly faster than having to compile the
  `libAllKernels.so` each time
- Provides a playing ground for developers to try out alternative
  implementations
- Makes it easy to benchmark and compare different implementations of
  the same kernel by using different kernel hints

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 dependency to all DAPHNE users, one can already
test the kernel, compare it with the default, run benchmarks with DAPHNE
using this kernel. For more information on kernel extensions see
https://daphne-eu.github.io/daphne/Extensions/.
@philipportner philipportner merged commit d119b00 into main Sep 29, 2024
2 checks passed
@philipportner philipportner deleted the experimental_kernels branch September 29, 2024 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant