7 ms·
VkFFT – Vulkan Fast Fourier Transform library
- 29athrowaway 6y agoRendering a triangle in Vulkan will make you cry.
- slater 6y agowasn't that same joke made about OpenGL? plus ça change :)
- sudosysgen 6y agoPlus ça reste pareil! Plus, it's not even that hard, and if you really find it that hard you can always use a wrapper library.
- 29athrowaway 6y agoOpenGL 1 was very straightforward, and if you want, you can still use it. Recent version of OpenGL are more difficult. But compared to OpenGL, Vulkan is in an entirely different class of difficulty.
- exDM69 6y agoI wouldn't call it difficulty, or even complexity. Verbose is more apt. It's daunting for a beginner but for a seasoned graphics programmer it is fairly straightforward. But still really verbose.
- skocznymroczny 6y agoIt's not straightforward even for seasoned graphics programmers. It's definitely easier for them because they have good grasp on advanced concepts such as barriers, image layouts, synchronization (things you don't really have to deal with in OpenGL/DX11 style APIs), but even they make hard to debug mistakes in AAA games/engines.
- Reelin 6y agoWhat's your point? So will writing your own custom UI toolkit, or manually doing your own font rendering, or implementing a custom equivalent to TensorFlow, or writing your own implementation of the C standard library, or ... If you don't need low level control, you should be using middleware or a full blown engine (Godot, Unity, Unreal, etc).
- NL807 6y agoThat's because Vulkan is designed to render millions of triangles, not one. You wouldn't use Vulkan to render a single triangle for the same reasons why you wouldn't use a helicopter to get a bottle of milk from your local shop.
- meekrohprocess 6y agoEh, it's an investment. Debugging your first segfault will also make you cry, but it's good for you. It builds character, and prepares you for the more insidious segfaults that are lurking out in the tall grasses.
- Narann 6y agoWith OpenGL you draw a triangle, and eventually write a pipeline. With Vulkan you write a pipeline, and eventually draw a triangle.
- exDM69 6y agoBest explanation of the two APIs I've ever heard. OpenGL "hello triangle" is short only if you cut corners. If you do it the way you'd do in a production app, you're not that far off from the lines of code it takes to do it in Vulkan. It's still less, but on the same order of magnitude.
- 0-_-0 6y agoOpenGL gives you a Toyota, Vulkan gives you the parts to a Ferrari
- OneGuy123 6y agoThis is why you use a game/rendering framework/engine if you want to render a single triangle to play around. This kind of "hardcore requirements to render a single triangle" is what is needed if you wish to have AAA game titles with realistic graphics at 60fps as it gives developers the freedom to do anything they wish. More freedom -> better graphics at higher performance but more difficult to draw a single triangle. Less freedom -> easier for beginners to draw a triangle but that is irrelevant in practice because that is not what those APIs are for.
- DTolm 6y agoHello! Since the last post VkFFT has experienced a number of huge improvements and optimizations. Namely: -It now supports sequences up to 2^32 in all dimensions (algorithmically, in reality limited to allocatable memory size, switch to 64-bit addressing scheme is planned for future release) -configurations optimized for bigger range of systems and vendors -benchmarked Radeon VII and RTX 3080, shows that FFT is extremely bandwidth limited on modern GPUs -VkFFT is able to match and outperform cuFFT on the whole tested range from 2^7 to 2^28 in single precision -added double and half precision support and precision tests against FFTW on CPU -improved native zeropadding - up to 3x performance boost -switched license to MPL 2.0 Thanks for your attention! I am happy to answer any questions.
- dcgudeman 6y agowhy did you choose MPL 2.0?
- DTolm 6y agoIt is a great open-source license for library projects. For example, Eigen uses it: https://eigen.tuxfamily.org/index.php?title=News:Relicensing_to_MPL2 https://eigen.tuxfamily.org/index.php?title=News:Relicensing...!
- enriquto 6y agoAny plans for arbitrary-size transforms? (i.e., not restricted to vectors whose dimension is a power of two)
- DTolm 6y agoYes, this is indeed something I would like to add in the future. While adding different radix kernels support for small prime factors is not that hard, writing efficient scheduler is a much more challenging task (each sequence, even for power of 2 now is split differently targeting different architectures to optimize performance). The Bluestein's algorithm typically used for arbitrary prime sizes requires both zero-padding and convolutions support which are already efficiently implemented, so it is also not completely out of reach.
- p0sixlang 6y agoCan someone ELI5 what this library is useful for?
- Lichtso 6y agoSo far there have been two ways to to heavy compute tasks on GPUs: CUDA (Nvidia only) and OpenCL (all vendors). Nvidia invested a lot in software and toolchains to make CUDA the go to option for many projects (especially in the machine learning community). Meanwhile OpenCL is falling apart and sees less and less support and updates. However, the Vulkan API which is also supported by most vendors (except Apple where you have to use a compatibility layer called MoltenVK) is gaining traction in the compute sector. If you trust the benchmarks, then this library here is showing that you can get a similar performance out of Vulkan compute than what you would expect from CUDA. It is just that this library only provides a very small fraction of the features of what the CUDA ecosystem does, so the Vulkan compute ecosystem still has a lot catching up to do. Edit: In case it is not obvious from the title, the library is used to calculate the https://en.wikipedia.org/wiki/Fast_Fourier_transform https://en.wikipedia.org/wiki/Fast_Fourier_transform
- enriquto 6y agoI'm fascinated, and at the same time slightly troubled, by your usage of the word "compute".
- chrisseaton 6y agoWhy? Parts of the industry focused on computing data as opposed to storing it, or retrieving it. Do you think there aren’t people who do this or do you use another word?
- enriquto 6y agoIt's a weird word. Grammatically, it is a verb. But people use it as a noun (and sometimes even as an adjective). This usage seems relatively modern, the same concept was called differently just a few years ago.
- mrweasel 6y agoI’m don’t write C++, but isn’t the code extremely messy? Also it appears to be C++ and not C like the “Read me” says.
- DTolm 6y agoThe library only includes vkFFT.h file (in C) and a set of shaders (C-like language compiled to SPIR-V). Vulkan_FFT.cpp is only an example that shows how VkFFT can be used. It also contains the benchmark in it, but it is not a part of the library.
- mrweasel 6y agoAah, okay, I where a little confused about the Vulkan_FFT.cpp. It seemed a little weird to have everything in the .h file, and not just the functions you want to expose in the library. Again, I know no C++ and a very limited amount of C, so don’t put to much value in my comment. You seem to be very fond of switch statements, consider not stuffing to much code into each case. It make the flow hard to follow. Break the case code into functions and call those. You have a switch with 40 cases, to load the SPIR-V. I feel like there’s a better way to deal with that. Maybe just a strict naming convention, so having the ID is enough to locate the file. Impressive work in anycase.
- DTolm 6y agoThere are surely many different ways to get the job done. VkFFT.h file by itself desn't do any computations btw - it is more like a configurator that launches shaders (sth similar to kernels in CUDA). Having only one header also makes it easier to distribute the library as a code. I just like the switches as in glsl(shaders) compiler can optimize and unroll them, if the key is provided as a constant. This can provide a non-negligible algorithm speed increase. So over the course of development I came to the point that it is not hard to follow the switches logic for me.
- mrweasel 6y agoThank you for explaining. It make sense, given the nature of the library, that one would pick the method or coding style that boost performance.