News for hackers. Stuff that matters.
Re:Vulkan Memory Allocator by Jweb_Guru on Wednesday July 21, 2021 @10:37AM (#27906868)
Look at the state of Vulkan drivers in practice, the "fastest" ones in benchmarks of actual AAA games do tons of work that was supposed to be done in userspace (like, that was the whole point!). I agree in principle that it's important to have an API expose all the ugly low level details, but doing so and then telling people not to actually use it is pretty much obviously going to result in a suboptimal compromise like what we have today. Of course people are going to try to code against vanilla Vulkan; I think things would be different if it had shipped side by side with something like a robust implementation of WebGPU, so people who weren't able to use big name game engines had something to fall back on, but that's not what happened.
Re:Vulkan Memory Allocator by fctorial on Wednesday July 21, 2021 @12:05PM (#27908052)
> the "fastest" ones in benchmarks of actual AAA games do tons of work that was supposed to be done in userspace

Can you give some examples preferably with links to source.

Re:Vulkan Memory Allocator by flohofwoe on Wednesday July 21, 2021 @10:52AM (#27907102)
I think the counter-intuitive "hindsight-is-20/20" fact is that a higher level, more abstract API provides more wiggle room for GPU vendors to implement optimizations for their specific GPU architecture. "Abstract API" doesn't mean it has to be mess like what OpenGL became after 1.x, but one problem is that many people think that Vulkan was the only possible alternative future to OpenGL, while ignoring APIs like D3D11 and Metal which would have been a better starting point for an OpenGL successor.
Re:Vulkan Memory Allocator by skohan on Wednesday July 21, 2021 @11:19AM (#27907489)
Idk as an "intermediate" graphics programmer, the explicitness and lack of abstraction in Vulkan is one of the killer features for me. "Wiggle room" in higher-level API's like OpenGL is one of the things that made them impossible to deliver consistent results with. With Vulkan there's more typing, but once you get something working it's going to work the same pretty much everywhere.

I kind of see it as a non-issue. It seems like Vulkan's target audience was specifically elite developers who wanted the most control possible, and based on the results which have been achieved in products like Doom 2016/Eternal it seems like it's working for them.

I suspect WebGPU will be the OpenGL successor for everyone working with graphics who isn't at an AAA game studio.

Re:Vulkan Memory Allocator by flohofwoe on Wednesday July 21, 2021 @12:33PM (#27908440)
As I wrote above, OpenGL is an exeptionally bad counter example to Vulkan because it's just a massive soup of knobs and dials. D3D11 and Metal had this specific problem fixed already, and should have been used as base for an OpenGL successor instead of going all radical with Mantle.

Vulkan is basically a GPU-programming API with some support for triangle rendering, great for compute workloads, not so great for rendering triangles. At the very least, Khronos should provide additional layers on top of Vulkan to simplify traditional rendering tasks, basically providing one or more optional API layers that are closer to Metal and D3D11.

Re:Vulkan Memory Allocator by skohan on Wednesday July 21, 2021 @12:54PM (#27908777)
I would recommend watching some of the talks from around the time Vulkan was announced. The API was released very much in response to developer demand to just give them access to the GPU in an unopinionated way, and largely it has delivered on that promise.
Re:Vulkan Memory Allocator by flohofwoe on Wednesday July 21, 2021 @01:15PM (#27909105)
Yeah I was around at the time. As I remember it, the "developer demand" was a very small but very vocal cabal of AAA game rendering engineers :)

I think the general idea was the right one, the execution of that idea was the problem (e.g. Metal is the successful execution of the same idea).

Re:Vulkan Memory Allocator by shmerl on Wednesday July 21, 2021 @06:52PM (#27913176)
Metal gives no choice for the lower level. Something higher level built on Vulkan with ability still to use the lower level for those who need would be the successful execution. Metal isn't that, besides being Apple only anyway.

I.e. I'd agree with your idea if Metal was actually built by Apple on top of Vulkan as a convenience abstraction and you could use Vulkan there directly too.

Re:Vulkan Memory Allocator by flohofwoe on Thursday July 22, 2021 @03:28AM (#27916387)
The first Metal version didn't provide much low-level access, but the later Metal versions gradually added more low-level, more explicit features. The key point is that those features can be ignored if the higher level and more convenient features are good enough.
Re:Vulkan Memory Allocator by skohan on Thursday July 22, 2021 @07:33AM (#27917690)
But I think the parent comment's point is just that if you start with low-level, you can always build on top of it, but the other way around you have to wait for the API vendor to give you the low level access you need.

I hear that you are saying Metal does a better job of being a convenient graphics API than Vulkan. I am just having trouble parsing why this would be an objective problem with Vulkan, rather than you just not being the target audience of this API.

Re:Vulkan Memory Allocator by HelloNurse on Wednesday July 21, 2021 @12:15PM (#27908189)
"Wiggle room" means, for example, that OpenGL drivers might look at the name of your executable to apply different hacks and profiles. It means that you write perfect code, and then who knows what will happen. Thanks, but no thanks.
Re:Vulkan Memory Allocator by flohofwoe on Wednesday July 21, 2021 @12:38PM (#27908506)
Not what meant, besides, if you read NVIDIA and AMD driver release notes carefully, you will find that these also contain game-specific fixes in the Vulkan drivers. It's just rarer because there are not many games using Vulkan.
Re:Vulkan Memory Allocator by pjmlp on Wednesday July 21, 2021 @10:56AM (#27907158)
If you look at Khronos slideware that is kind of the official message, naturally that is what those people end up thinking, specially if they are newbies looking into learning portable 3D APIs.
Re:Vulkan Memory Allocator by shmerl on Wednesday July 21, 2021 @06:48PM (#27913137)
radv is one of the fastest ones. What does it do that it shouldn't?
Re:Vulkan Memory Allocator by Jweb_Guru on Wednesday July 21, 2021 @06:55PM (#27913201)
radv is one of the ones I'm referring to, it's open source so we can see the tricks they use. One example: it spawns a thread behind your back in order to execute command buffers in order to make the queue submit appear nonblocking (or at least fast). This is completely contrary to the spirit of the Vulkan spec which deliberately doesn't provide any convenience mechanisms for things like callbacks on command buffer completion, precisely because these would require runtime threads to be around. The user has no control over this thread, including where it spawns or its priority (how could it, when it's an implementation detail of the driver?) nor can they take advantage of this knowledge to improve synchronization on the CPU side (e.g. by removing external synchronization around queues).

Contrast this with the situation on Metal (explicit runtime that spawns threads, and explicit callbacks to be able to take advantage of that) or DirectX 12 (explicit runtime that works for the average case, with extremely fine grained control provided over the threading model, priorities, etc., including being able to turn them off completely if you really need it). Both of these are clearly much better models because they are actually exposing the detail that seems obvious in hindsight (applications need queue submission to be nonblocking) and are able to provide much more flexible, efficient, and useful APIs as a result.

By leaving everything up to the user, Vulkan in practice ends up underperforming its competitors unless the drivers patch up the work--at which point you have the unfortunate situation where you have people targeting a low-level API running on a high-level runtime. It's this, not some dumb digression about extensions, that IMO make Vulkan kind of disappointing--it's definitely not a failure, but it could've been much better than it was.

Re:Vulkan Memory Allocator by shmerl on Wednesday July 21, 2021 @07:02PM (#27913263)
As long as it doesn't violate the spec, I'd look at actual performance results of it. I.e. if it interferes with usage or creates some kind of performance degradation for the applications, then it's indeed a problem. Otherwise this requirement should have been an explicit part of the spec.

I.e. I'd imagine if this is a real problem, there should be some RFC for the updated version of the API where this is prohibited or some requirements are added about how to control it.

Re:Vulkan Memory Allocator by Jweb_Guru on Wednesday July 21, 2021 @07:14PM (#27913352)
It creates a performance degradation for applications that are correctly using Vulkan. And from conversation with Khronos people they do definitely consider this a failure (either of the spec or of the driver); among other things, it makes benchmarking rather difficult if new threads are spawning constantly as you submit command buffers. But my assertion (backed up by radv benchmarks) is that effectively nobody can use Vulkan APIs "correctly" which is why implementations like that are helpful in practice.
Re:Vulkan Memory Allocator by shmerl on Wednesday July 21, 2021 @07:20PM (#27913400)
Then I'd expect someone to actually propose to address this in the future versions. Question is how easy they can do that, given there is some backward compatibility guarantees I suppose.

I'm not sure what their approach for that is. May be they break it at some point and then the driver can offer more knobs for such features to be optional or behave differently in the newer versions.