What you'll learn:
- What is Vulkan?
- 有关Vulkan SC安全至关重要标准的详细信息。
- How much do Vulkan and the variant Vulkan SC differ?
2022年3月1日标志着安全系统世界中的关键日:Khronos Group批准了Vulkan SC API standard. “Commercial” Vulkan has been available for some time. It’s used in a diverse array of both graphics and compute applications to maximize the capabilities and performance of the underlying GPU architecture. It also offers a quick and efficient, open standards-based means to scale across diverse architectures.
However, the safety-critical (SC) variant promises to bring those same vectors to developers of safety systems while also offering a path to certifying the software stack to meet various industry safety standards, such as ISO 26262 (automotive), IEC 61508 (industrial), and DO-178C (avionics). The following aims to dispel some of the common myths surrounding the Vulkan API standard.
1.使用Vulkan SC使设计能够获得安全认证。
It’s important to keep in mind that the Vulkan SC specification has been designed to enable application developers to write safety-critical and functionally safe software. However, it doesn’t mean that any Vulkan SC implementation is automatically certifiable. The Vulkan SC implementation must be designed to the objectives of software safety standards like ISO 26262 or DO-178C.
In addition, replacing your existing GPU driver in a non-safe system with Vulkan SC will not automatically make your entire platform functionally safe. Other system software like the RTOS, BSP, and application software need to be functionally safe, and the hardware should be designed with functional safety as well.
2. Vulkan requires thousands of lines of startup code before you can draw anything.
Vulkan and Vulkan SC require you to be very explicit about the resources that you want from the GPU and how you would like the GPU to perform rendering. This means a lot of “startup” code is involved to set up the initial state and graphics/compute pipeline required by an application.
大多数此代码可以将其抽象成特定于您构建的应用程序类型的定制库中。或者,您可以使用第三方库,例如Lunarg的Vulkan框架,或者是AMD的虚拟内存分配器(VMA)来简化资源分配。
After you’ve completed your startup code, the code to render objects can be as simple as OpenGL SC. When you push your uniform state, you bind the correct resources and then make a single draw call. Overall, this allows an application to be more flexible and gives application developers the option to tweak their startup code to their specific application if needed.
3. Vulkan只是图形API。
VULKAN标准允许实现只能公开计算功能,而无需公开任何图形功能。因此,供应商可以实现一个仅能运行计算着色器的合并Vulkan驱动程序。
The compute pipeline in Vulkan is quite powerful and can be used on its own for applications that have no visualization requirements. For applications that do have visualization requirements, the API allows for easy sharing of data between the compute and graphics parts of their pipeline.
4. Vulkan Compute还不够强大,它仅是为了支持图形。
- Vulkan, as a specification, is only growing and with each new iteration its compute capabilities are increasing.
- The Khronos Vulkan Machine Learning (ML) working group continues to propose Vulkan extensions capable of supporting compute-centric AI and ML solutions.
- Khronos组正在探索并行编程的API SYCL的安全至关重要版本,该版本将与Vulkan Compute兼容。
- Coreaviis building a robust AI/ML framework that can parallel the capabilities available in well-known frameworks like TensorFlow and Caffe using Vulkan SC as the compute acceleration layer.
5. You can’t have a Vulkan compute-only implementation.
In fact, the specification says that you can’t have a graphics-only implementation of Vulkan. However, you certainly can have a compute-only implementation.
6. Vulkan和Vulkan SC完全不同.
凡尔康SC非常类似于沿袭。t的大部分he differences exist within certain parameters of common functions, where Vulkan SC introduces additional structures that define things like resource utilization.
These structures enable an application to provide the Vulkan SC implementation with a clear picture of the resources that the application will need at runtime. This is important because Vulkan SC disallows freeing memory allocations to prevent fragmentation of the memory resources. Allowing the application to specify the resources it requires ensures that the implementation will not run out of resources at runtime.
Aside from memory management, the biggest difference between SC and standard Vulkan is pipeline compilation being performed offline in Vulkan SC. This means that a Vulkan SC application will compile all of the shaders into Vulkan SC pipelines in an offline compilation process. During runtime execution, the application then can select to load and bind a precompiled pipeline object.
The advantage of offline compilation for SC software is that since the compiler/linker stages aren’t part of the runtime, this code needn’t be certified for every target system where the Vulkan SC implementation is deployed. There’s also a well-defined and deterministic way to track the shader code that will execute in the target device (e.g., GPU), since new/untested shader code can’t be compiled and launched at runtime.
7. Vulkan is designed solely for GPU programming experts.
Vulkan规范的设计目标之一是使其更容易接近,以便不熟悉GPU编程的人们能够阅读规范并了解如何控制GPU。
此外,Vulkan旨在通过更简单的接口更轻松地抽象GPU。以前的GPU的API要求驱动程序实现诸如着色器编译器之类的复杂构造。这意味着驱动程序可以轻松地在解释着色器代码的方式中有错误和怪癖,并且建筑编译器成为一个困难的问题。通过Vulkan的简化控制方法,驾驶员开发人员更容易删除错误和怪癖,并且在不同的GPU中具有一致的体验。
Lastly Vulkan has been designed to allow for functional reuse. As a result, more novice developers can use third-party libraries, or abstract their own code into libraries to simplify the development process.
8. Vulkan SC中的离线管道比Vulkan的在线管道汇编较不可能配置和灵活。
Some offline pipeline states, such as the number of render passes or the shaders being used, are fixed at compile time. They provide some safety benefits such as preventing unverified shaders and render passes from being loaded onto the GPU. Other pipeline states, e.g., clear color, are accessible through the dynamic state control.
Extensions like “VK_EXT_extended_dynamic_state” give applications even more control over the offline pipeline, such as being able to control the cull mode, viewport dimensions, scissor state, and more. This enables you to control all of the usual state in an offline pipeline, making them quite configurable and flexible.
In addition, commercial Vulkan does support “dynamic building” pipelines during the runtime of an application. However, this is a use case to be avoided, as it can be quite expensive to build pipelines during the application’s runtime. Therefore, a well-designed Vulkan application should be able to transfer over to offline pipelines with little impact.
9. Vulkan doesn’t have wide adoption.
事实并非如此 - 从游戏发动机开发人员到内容创建者工具,商业广泛采用了整个行业的广泛采用。每个主要的GPU供应商都有用于其硬件的Vulkan实施。因此,应用程序开发人员可以相信,如果他们使用Vulkan,他们的应用程序将能够在各种硬件上运行。
Vulkan SC also has started to gain wide adoption for safety-critical, functionally safe graphics and compute, with both Intel and Arm adopting the API as their standard platform for safe graphics and compute applications. Safety-critical application developers can feel confident that the only safety-critical API capable of providing graphics and compute support will be available on a variety of hardware.
10. Vulkan only works on high-end, high-power, modern GPUs.
The Vulkan standard was designed to support lots of different hardware with disparate capabilities. Khronos themselves have said that the standard will be supported by GPUs that can run OpenGL ES 3.1. This standard was designed for low-end, low-power mobile GPUs that were designed eight or more years ago. In fact, Vulkan can be a better choice for lower-power, lower-performance GPUs as the application developer has more control over the GPU and can choose the optimal execution path for that low-end hardware.
11. Vulkan is too low level for the average application developer.
Vulkan gives application developers the ability to access the “lower level” of the GPU if needed, but it’s also been designed with a “platform approach.” This means that developers can easily build abstract layers on top of Vulkan to simplify the application development process. These can vary from complete frameworks to building Vulkan applications, to small libraries to make one aspect of using Vulkan easier. Consequently, developers can take a high-level approach for speed of development and then more easily move to low-level access when they need to improve performance.
Vulkan的平台级别方法的另一个好处是,它使开发人员能够在Vulkan上实施其他API。例如,“ DXVK”项目允许您在Vulkan顶部构建Direct-X应用程序,而CoreAvi的VKCoreGL SC产品使得可以在Vulkan SC之上构建OpenGL SC应用程序。