Open Hardware & RISC-V

Qualcomm documents Vulkan-OpenCL zero-copy interop for Adreno GPUs on Android

Key Takeaway

Qualcomm published a technical tutorial enabling Android developers to share GPU memory between Vulkan and OpenCL on Adreno GPUs without CPU-mediated copies, using Khronos external memory and semaphore extensions.

Summary

Qualcomm developer Zimu Guan has published a detailed tutorial demonstrating how Android applications can coordinate GPU work between Vulkan and OpenCL on Adreno GPUs without expensive CPU memory copies. The technique allows a Vulkan renderer to hand off data directly to OpenCL kernels for compute tasks such as machine learning inference, denoising, or super-resolution processing, then receive results back into Vulkan for display. The implementation relies on Khronos standard extensions for external memory and external semaphores, with Qualcomm-specific extensions handling optimal-tiling image formats.

The tutorial covers a complete round-trip workflow: Vulkan exports memory allocations as opaque file descriptors that OpenCL imports, while synchronization uses one-shot sync-fd semaphores with fresh export-import cycles at each handoff. The post includes sample code for each stage and references the opencl_interop sample in Qualcomm's Adreno GPU Vulkan Code Sample Framework. Device and driver support varies, so applications must query capabilities at runtime. A follow-up post covering Android Hardware Buffer interop is planned.

External memory and semaphore mechanics on Adreno

  • External memory export: Vulkan allocates memory and exports it as opaque file descriptors using VK_KHR_external_memory_fd, which OpenCL imports via Qualcomm's cl_qcom_external_memory_vulkan_opaque_fd extension.
  • Optimal-tiling images: The Qualcomm-specific cl_qcom_external_memory_vulkan_opaque_fd extension enables OpenCL to consume Vulkan images with optimal tiling, not just linear buffers, preserving GPU-efficient layouts.
  • Synchronization model: One-shot sync-fd semaphores (VK_KHR_external_semaphore_fd) are exported from Vulkan and imported into OpenCL at each handoff, with a fresh semaphore created per synchronization point rather than reuse.
  • Capability querying: The tutorial emphasizes runtime queries for device and driver support, as external memory and semaphore capabilities are not uniformly available across Adreno GPU generations or driver versions.
  • Sample code availability: Implementation details and complete workflow code are provided in the opencl_interop sample within the Adreno GPU Vulkan Code Sample Framework.

Why it matters

This documentation lowers the barrier for Android developers building hybrid graphics-compute pipelines on Qualcomm Snapdragon platforms, a common architecture for mobile Linux devices and ARM-based development boards. While the tutorial targets Android, the underlying Khronos extensions are cross-platform, and the techniques may inform interop patterns for Linux graphics stacks on Adreno as open-source driver support matures. For the broader open-source ecosystem, explicit documentation of vendor-specific extension behavior helps reduce fragmentation in GPU compute workflows.

Original reference: www.qualcomm.com →