Vulkan API and CAD, 2023 update: ANARI high-level API

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
kwahoo
Posts: 680
Joined: Fri Nov 29, 2013 3:09 pm
Contact:

Vulkan API and CAD, 2023 update: ANARI high-level API

Post by kwahoo »

Nvidia talk about Vulkan at SIGGRAPH 15 conference http://on-demand.gputechconf.com/siggra ... niell.html

CAD demos are starting at 46:00. Slides (PDF).

There are some interesting points from the presentation:
- you can mix OpenGL and Vulkan in a single app and port the app step by step,
- there is only one API both on desktop and mobile (in fact the latter part of the CAD demo shows mobile SoC in action),
- Vulkan specs, driver implementations, conformance tests etc. should be released before end of this years,
- Vulkan will be available on Windows XP/7/8/10, GNU/Linux, Android (nothing about OS X),
- it can be much faster than OpenGL.

It's definitely too early to talk about porting FreeCAD to Vulkan (especially because of Coin3D), but maybe some day...
Last edited by kwahoo on Thu Aug 10, 2023 6:15 pm, edited 1 time in total.
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Vulkan API and CAD

Post by yorik »

One more API! I'll be curious to see if developers will want to use it... Worth keeping an eye on it anyway.
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Vulkan API and CAD

Post by PrzemoF »

Update:
"Vulkan 1.0 was released this morning as a surprise for those looking towards a high-performance, cross-platform (everyone but Apple) API."

http://tech.slashdot.org/story/16/02/16 ... lashdot%29
dwizeno
Posts: 18
Joined: Fri Jun 26, 2015 5:55 am

Re: Vulkan API and CAD

Post by dwizeno »

yorik wrote:One more API! I'll be curious to see if developers will want to use it... Worth keeping an eye on it anyway.
I think you'll find the OpenGL API going stale in favor of Vulcan. If not only because it likely becomes cheaper for hardware producers to make drivers.

What I absolutely like about it is the promise of less embedded functionality in driver/hardware making 3D engine output more consistent across vendors/graphic cards. How this matches to the promised performance increase is not very clear to me though.
User avatar
kwahoo
Posts: 680
Joined: Fri Nov 29, 2013 3:09 pm
Contact:

Re: Vulkan API and CAD

Post by kwahoo »

4-6 years later OpenCASCADE seems slowly adopting Vulkan https://tracker.dev.opencascade.org/pri ... g_id=30631
There are some basic benchmarks at the bottom:
Naive incomplete Vulkan prototype, 25k boxes, VSync is ON.

pload MODELING VISUALIZATION
set nx 50; set ny 50; set nz 10;
set bb {}
for {set x 1} {$x <= $nx} {incr x} { for {set y 1} {$y <= $ny} {incr y} { for {set z 1} {$z <=
$nz} {incr z} { box b${x}_${y}_${z} $x $y $z 0.5 0.5 0.5; lappend bb b${x}_${y}_${z} } } }
for {set x 1} {$x <= $nx} {incr x} { for {set y 1} {$y <= $ny} {incr y} { for {set z 1} {$z <=
$nz} {incr z} { box b${x}_${y}_${z} $x $y $z 0.5 0.5 0.5; incmesh b${x}_${y}_${z} 0.001 } } }

vclear
vinit View1 -disp vulkan
#vinit View1
vrenderparams -frustumCulling off -shadingModel phong
vdisplay -dispMode 1 {*}$bb
vfit


Radeon RX Vega, OpenGL:
FPS: 19.9
CPU: 43.5 msec

Radeon RX Vega, Vulkan:
FPS: 46.3
CPU: 19.3 msec

GeForce GTX 1060, OpenGL:
FPS: 30.0
CPU: 40.3 msec

GeForce GTX 1060, Vulkan:
FPS: 30.0
CPU: 17.5 msec

Intel(R) HD Graphics 630, OpenGL:
FPS: 17.9
CPU: 54.8 msec

Intel(R) HD Graphics 630, Vulkan:
FPS: 18.9
CPU: 22.1 msec

R9 380, OpenGL:
FPS: 19.9
CPU: 39.8 msec

R9 380, Vulkan:
FPS: 54.6
CPU: 16.2 msec
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Vulkan API and CAD

Post by Kunda1 »

Excellent post
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
kwahoo
Posts: 680
Joined: Fri Nov 29, 2013 3:09 pm
Contact:

Re: Vulkan API and CAD

Post by kwahoo »

Since FreeCAD can export GLTF now, and VulkanSceneGraph's viewer can open GLTF files directly, I did small test for fun.
Opened Mars Rover https://forum.freecadweb.org/viewtopic.php?t=30116 file in FreeCAD. Framerate was about 25 fps in mainline FreeCAD and 90 fps in Realthunder's branch.
Image

Then I exported the model to GLTF binary (.glb) and I opened in VulkanSceneGraph viewer. Framerate? Over 700 fps.
Image

Framerate is not everything, since there is different shading, bugs etc. But even more interesting is GPU utilization (Radeon 5700XT):
FreeCAD, realthunder's branch: about 75% at 45% of GPU clock (full speed clock didn't even kick in!)
vsgviewer: about 95% at full GPU clock.
FLOSS Noobie
Posts: 13
Joined: Sat Feb 27, 2021 1:17 am

Re: Vulkan API and CAD

Post by FLOSS Noobie »

Really cool test!
Did you use the new renderer (Diligent Graphics) in Realthunder´s branch? I think it´s still fairly experimental, but Realthunder is already doing some amazing stuff with it. https://github.com/realthunder/FreeCAD_ ... s/tag/0.11
User avatar
kwahoo
Posts: 680
Joined: Fri Nov 29, 2013 3:09 pm
Contact:

Re: Vulkan API and CAD

Post by kwahoo »

FLOSS Noobie wrote: Tue Jun 01, 2021 11:47 pm Did you use the new renderer (Diligent Graphics) in Realthunder´s branch? [/url]
I have set caching to "Automatic", because "Experimental" segfaults with this model.
User avatar
kwahoo
Posts: 680
Joined: Fri Nov 29, 2013 3:09 pm
Contact:

Re: Vulkan API and CAD

Post by kwahoo »

A minor update, realthunder's branch renders the Rover with Experimental caching now, and performance is quite good (Radeon 6600XT): 120-140 fps with MSAAx8

Image

In other news: Autodesk started using Vulkan with Fusion 360 https://www.khronos.org/blog/vulkan-for ... nt-compute
They use the same renderer on all platform including OS X.
For development we have tried to be as platform-agnostic as possible, this is something that Vulkan enabled us to do over any other GPU API option. We use the prebuilt Vulkan SDK provided by LunarG (except in instances where we are using M1 Macs that don’t have a pre-compiled SDK available, in that case we build the required components manually) which provides us the glslang compiler and the Vulkan headers. We also aim to be compiler independent and support recent versions of Clang/LLVM, GCC and MSVC. MoltenVK has been hugely valuable to us by providing the ability to execute our Vulkan code on Apple platforms without any discernable performance penalty versus writing a native Metal implementation but more importantly without requiring any modification of the code itself.

This portability provides us options for execution on x86 and ARM CPU architectures, Intel, AMD, Nvidia and Apple’s GPU architectures and Windows, Linux and macOS operating systems.
Post Reply