alpaka-group / alpaka

Abstraction Library for Parallel Kernel Acceleration :llama:
https://alpaka.readthedocs.io
Mozilla Public License 2.0
358 stars 74 forks source link

[Meta] Consider studying Vulkan as API design input #1065

Open HadrienG2 opened 4 years ago

HadrienG2 commented 4 years ago

I do not expect alpaka to support Vulkan as a backend anytime soon, at least not without going through an abstraction layer like codeplay's SyCL-over-Vulkan implementation, because Vulkan uses a split-source programming model and this is fundamentally incompatible with alpaka's current design.

However, I think Vulkan's API design could inform alpaka's future API design direction, because it is one of the most recently designed GPU APIs and probably the lowest level GPU API to achieve wide-scale popularity in recent times. This means that it exposes a wealth of interesting concepts which are not yet all present in current-generation GPU compute APIs, but may make their way into future APIs and extensions (and indeed, already are coming in some cases).

Therefore, Vulkan provides a good largest common denominator to answer alpaka design questions such as "Is there any GPU API which violates this property?" or "Is there some place in the alpaka which could benefit from future extension headroom?".

This is meant to be a general issue for discussing whether you think that the general idea of taking inspiration from Vulkan makes sense, and which of these Vulkan features you think are particularly important for alpaka to support. If it is agreeed that particular Vulkan features should be added to alpaka's abstraction vocabulary, it would be wise to create dedicated issues about these features instead of using this issue, as otherwise the discussion thread would get very messy.


Here are particular Vulkan concepts that I think could provide valuable design input for future alpaka API evolutions [1] :


  1. This is not meant to be a full list of features which Vulkan exposes and alpaka doesn't. I'm mostly focusing on Vulkan features which I think could be of interest to the scientific computing community. In particular, I have excluded Vulkan features which are fully graphics-centric (e.g. rasterization pipeline, mesh shading...), are meant to optimize application latency rather than throughput (e.g. pipeline caches), or have been restricted to a single vendor for a long while which makes their standardization path unclear (e.g. device-generated commands).
  2. If I'm reading the spec right, the exact guarantee is that if a device has one queue that supports graphics, then it has one queue that supports both graphics and compute, and if a queue supports graphics or compute, then it supports data transfers with arbitrary granularity.
sbastrakov commented 4 years ago

Hello @HadrienG2 , thanks for the hint. I am not really familiar with Vulkan and we don't use it in our projects afaik, so having such a detailed description definitely helps! We will be having alpaka dev meeting following the workshop to discuss the feedback, and will also discuss your points raised in several issues. Thanks for providing feedback!