Diese Seite wurde vollständig KI-generiert auf Basis von SWS Safe Hardware Acceleration (R25-11) — kein offizieller AUTOSAR-Text und keine automatisch extrahierte API-Seite wie die übrigen Module. Als Interpretation gekennzeichnete Aussagen sind Schlussfolgerungen aus den Quellen.
160 API-Records in Kapitel 8: 18 Klassen, 120 Funktionen, 4 Enumerationen und 3 Typ-Aliasse.
User GuideAI-GENERATED
Enables safe offloading of compute-intensive tasks to specialized hardware accelerators.
AI-GENERATEDunreviewedModel: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 94872e9e2305ProvenanceOpen questions (2)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original
Enables safe offloading of compute-intensive tasks to specialized hardware accelerators.
Namespace ara::shwa provides interfaces for safe hardware acceleration and enables targeted offloading of parallel computing tasks to devices such as GPUs or CPUs via target format Target ([AP_SWS_SHWA_00102]). Applications select accelerators via selectors, create exclusively managed execution queues, and control memory access via buffer accessors. As a central constraint, a strict ownership model with non-copyable resources as well as exception-free error signaling via ShwaErrorCode ([AP_SWS_SHWA_01301]) applies.
Context
Within the AUTOSAR Adaptive Platform, the namespace ara::shwa (Safe Hardware Acceleration) provides interfaces to offload computationally intensive tasks to specialized hardware accelerators. The module enables the integration of different accelerator types such as graphics processing units (GPU), digital signal processors, or dedicated central processing units (CPU).
Detection of the system environment is performed via the Platform class, which discovers the hardware platforms available on the ECU and lists the associated Device instances. The selection of a suitable device can be controlled dynamically or statically via specialized selectors: DeviceSelector acts as a callable function object for prioritizing available units based on an integer rank, while CpuSelector, GpuSelector, and AcceleratorSelector specifically target specific execution units. The current operating state of an accelerator is represented via the enumeration DeviceStatus ([AP_SWS_SHWA_00103]).
The Queue is responsible for the parallel execution of computational operations. Computation tasks are encapsulated via TaskHandler, where the execution location is specified via Target ([AP_SWS_SHWA_00102]) optionally on the accelerator (kDevice) or on the host CPU (kHostTask). Memory regions for input and output data are allocated via Buffer using the dimension specification Range. Access to these buffers is governed by Accessor objects, which restrict the access mode via AccessMode ([AP_SWS_SHWA_00101]).
The resource and lifecycle model in ara::shwa strictly distinguishes between resource-owning objects, descriptive handles, and queue-dependent components:
Resource-owning classes:Queue, Buffer, and Accessor manage hardware resources and memory areas exclusively. They are not copyable (not copyable) and must be managed via std::unique_ptr. Passing or transferring them is permitted exclusively via move semantics.
Descriptive handles and utility classes:Platform, Device, DeviceMonitor, Id, Range, and PropertyList do not own hardware resources exclusively. They are designed to be copyable. An instance of Device merely represents an access interface to a device, but does not control it exclusively. Interpretation: The initialization of an execution queue (Queue) binds to a specific, previously selected Device, since Queue manages resources exclusively. Question Q-c38811a811f133d0 (open)
Dependent components: The classes Event (for synchronization) and TaskHandler (for task processing) can be created exclusively within a Queue; outside the context of a queue, they have no functional significance.
The lifecycle of a device is reflected in DeviceStatus ([AP_SWS_SHWA_00103]): in addition to the operational state kReady, a device can be indicated as not accessible (kNotAccesible), faulty (kFailure), or unknown (kUnknown). Interpretation: State changes of a device between kReady, kNotAccesible, and kFailure are detected at runtime via utility classes such as the DeviceMonitor or the platform. Question Q-8fc0dc95534dc8bc (open)
Usage Path
The typical usage of ara::shwa to execute an accelerated computation is divided into five steps:
Platform and device selection: The application retrieves the existing hardware platforms and their assigned Device instances via Platform. A selector (such as DeviceSelector, GpuSelector, or CpuSelector) determines the most suitable device whose DeviceStatus ([AP_SWS_SHWA_00103]) exhibits the status kReady.
Instantiating the queue: For the selected Device, a Queue is created and held as std::unique_ptr.
Allocating and preparing memory: For input and output data, a Buffer with the required dimensions is created via Range. For population or evaluation, the application requests a Accessor, where the access mode is declared via AccessMode ([AP_SWS_SHWA_00101]) as kRead, kWrite, or kReadWrite.
Registering and executing the task: Within the Queue, a TaskHandler is created. Execution is started, where Target ([AP_SWS_SHWA_00102]) specifies whether the task runs on the accelerator (kDevice) or on the host (kHostTask).
Synchronization: The Queue provides a Event with which the host application monitors the asynchronous completion of computations on the hardware accelerator and synchronizes data alignment.
The application programming interface of ara::shwa is designed to be exception-free (exception-free). Error states are returned synchronously via ara::core::ErrorCode. Error codes are created via the factory function MakeErrorCode ([AP_SWS_SHWA_01312]) with reference to the error domain GetShwaDomain ([AP_SWS_SHWA_01311]). If the application architecture provides an exception-based error model, the error code can be converted into a ShwaException and thrown.
The enumeration ShwaErrorCode ([AP_SWS_SHWA_01301]) specifies standardized error causes:
Memory and access issues: If the allocation of main memory fails, this results in kMemoryNotAllocated. If the data consistency of a buffer cannot be maintained, kIntegrityCorrupted is reported. Invalid access modes or failing operations on Accessor objects lead to kInvalidAccessMode or kAccessorFailure, respectively.
Execution and synchronization errors: If the processing of a task on the target device fails, kTaskExecutionFailure is signaled. Illegal operations on synchronization objects lead to kEventInvalidOperation, while blocked resources trigger kResourceBusy. If configured execution times are exceeded, kTimedOut is returned.
Invalid parameters and object states: Calling methods on destroyed or invalid objects leads to kInvalidObject. Invalid indices or parameters are rejected via kInvalidIndex or kInvalidParameter, respectively. Unsupported functions report kFeatureNotSupported, while general errors are captured via kRuntime.
The ErrorHandler class is used for handling errors that occur during asynchronous computations on the accelerator.
This guide is based exclusively on the specification for ara::shwa in AUTOSAR R25-11.
CpuSelector manages CPU selection for operations on HWA if available Allows to get a device from any supported backends for which the device type is CPU.
Class allowing to choose the most appropriate device of the available ones. This is a callable object taking a device reference and returning an integer rank. One of the device with the highest non-negative value is selected.
Platform class is responsible for extracting different HWA platforms available for current application and listing Devices bind to each platform. Designed as copyable since not owning resources.
Accessor manages read and write access to allocated memory by Buffer. Designed as not copyable, since it’s owning resources. Intended to be managed exclusively by std::unique_ptr, which may be moved. ≙ std::unique_ptr
Buffer manages memory allocation for operations on the host or/and HWA. Designed as not copyable, since it’s owning resources. Intended to be managed exclusively by std::unique_ptr, which may be moved. ≙ std::unique_ptr
Event class helps to manage task execution synchronization between HWA and Host application. Can be created only inside of the Queue otherwise it’s meaningless.
Queue API provides the functionality for parallel processing on selected Device. Designed as not copyable, since it’s owning resources. Intended to be managed exclusively by std::unique_ ptr, which may be moved. ≙ std::unique_
Exception type could be thrown by application or other FC using Safe Hardware Acceleration. Safe Hardware Acceleration API is exception free and can only return an ErrorCode, but user code can transform this error to exception and throw if it’s alligned with system error handling architecture.
Property List class is designed to enable vendor specific SHWA functionality extension and adjustment. Properties are not standardized and can be defined by Vendor. Class using Property list is obliged to have HasProperty() and GetProperty() methods defined.
gemini-3.8-flash-low· 2026-10-13 · German original