skip to main content
10.1145/3585341.3585349acmotherconferencesArticle/Chapter ViewAbstractPublication PagesiwoclConference Proceedingsconference-collections
abstract

SYCLomatic compatibility library: making migration to SYCL easier

Published: 18 April 2023 Publication History

Abstract

SYCL[1] is a royalty-free, cross-platform abstraction C++ programming model for heterogeneous computing. SYCL provides necessary programming interfaces like device, queue, kernel, memory interface including buffer, accessor as well as features like USM. As a programing model for heterogeneous computing, Intel oneAPI[2] provides a SYCL compiler and runtime to support SYCL kernel-based programing and set of optimized libraries to support API-based programming.
SYCLomatic[3] is a project to assist developers in migrating their existing code written in different programming languages to the SYCL C++ heterogeneous programming model. SYCLomatic supports source-to-source migration from existing CUDA application source code to SYCL source code by leveraging SYCL interfaces and the optimized libraries provided by Intel oneAPI. One of the major challenges of SYCLomatic is that, in some cases, due to differences in API, expressing the identical semantic of a single line of CUDA code in SYCL requires additional data structures or multiple lines of operations. To assist the migration and make the migrated code performant and maintainable, SYCLomatic implements a compatibility library, which consists of additions to SYCL interfaces and a set of compatible APIs for popular libraries. Without the dependency to SYCLomatic, the compatibility library can be used as a standalone library for SYCL programming.
In this talk, we are going to share the reason of creating the compatibility library and the design of the compatibility library.
Addressing Semantic Differences:
The first part of the compatibility library is to address the semantic differences with CUDA code by adding new functionality to SYCL interfaces like device, queue, malloc, image accessor, etc. by introducing new classes. (1) Utility features to access queues in different devices and threads: Keeping and passing around the sycl::device pointer between host functions is tedious. In the compatibility library, a singleton device manager class is introduced and used to track the usage of each device in different CPU threads.
With the device manager class, it is easy to achieve following features:
(a) Get the “current” device in a thread:
The class keeps a map between threads and the last used device in the thread. The map makes it easier to access the wanted device in a host function.
(b) Get the default queue for a device:
When offloading a task to a device, SYCL requires developer to create a new queue on the device if the pointer of previous created queue is not available. The class keeps a default queue for each device which will be available globally. When a developer needs to use the queue on a device, the class provides a convenient interface to get the default queue of the device.
(c) Device level operation (create queue, synchronize, reset):
The class records all the creation of queues and maps the queues to the devices. Therefore, device level synchronization can be achieved easily.
(2) Pointer-like memory operation for non-USM mode:
Since managing memory through pointer operations may be more convenient for some cases, emulating pointer operations with sycl::buffer provides pointer-like memory operations including malloc, free, arithmetic, etc. for the devices which do not support USM.
(3) Flexible interface to fetch Image data:
The compatibility library introduces a class which simplifies the operation of fetching image data, e.g., extracting 1 or 2 channels from the image accessor.
Compatible APIs:
The second part of the compatibility library is to provide syntactic sugar for frequently used API calls.
(1) Free functions for atomic operation:
With sycl::atomic_ref, performing an atomic operation requires following 2 steps:
(a) Construction of sycl::atomic_ref
(b) Executing the atomic operation on the sycl::atomic_ref
The compatibility library introduces a set of templated atomic calls to help developers simplify their code.
(2) Utility Classes to simplify device memory allocation:
Since sycl::malloc cannot be used to allocate a multi-dimension array and requires multiple steps to create a device-accessible static or global variable, a device memory class performs memory allocation and keeps the dimension information, also providing the following features:
(a) Simple interface to allocate a multi-dimension array and pass it to device
(b) Simple interface to create a static or global variable which can be accessed in device
(3) 2D and 3D Memory Operations (USM, non-USM):
The compatibility library provides free functions for 2D and 3D memory operations like allocation, memory copy, memory set, etc. to save efforts for developers.
(4) Compatible APIs for popular CUDA libraries:
Libraries like BLAS (Basic Linear Algebra Subprograms), CCL (Collective Communication Library), DNN (Deep Neural Network Library), STL algorithm, FFT (Fast Fourier transform), etc. are widely used in heterogeneous applications. While Intel oneAPI package provides the libraries with SYCL interfaces, there is some difference in the API design for libraries from different implementation which provide similar core functionality. The compatibility library contains APIs to bridge the usage difference and let developers implement SYCL applications with the interface they are more familiar with.
Since SYCL is a relatively young language specification, many existing heterogeneous computing applications, libraries, and frameworks may not have a SYCL interface supported. With the compatibility library addressing some of the syntax/semantic differences between SYCL and other heterogeneous computing languages, developers should be able to create SYCL-based libraries/framework with less effort.
To improve the functionality and useability of the compatibility library, there is still work to do, like making the compatibility library to co-exist with SYCL-implemented components in the aspect of device selection, queue activation, task synchronization, etc. and addressing interface differences with more APIs from popular CUDA libraries.
Notices & Disclaimers:
Intel technologies may require enabled hardware, software or service activation.
No product or component can be absolutely secure.
Your costs and results may vary.
Intel, the Intel logo and other Intel marks are trademarks of Intel Corporation or its subsidiaries. Other names and brands may be claimed as the property of others. SYCL is a registered trademark of the Khronos Group, Inc.

References

[1]
[1] 2023. https://www.khronos.org/sycl/.
[2]
2023. Intel®oneAPI Toolkit. https://www.intel.com/content/www/us/en/developer/tools/oneapi/toolkits.html.
[3]
2023. SYCLomatic. https://github.com/oneapi-src/SYCLomatic.

Cited By

View all
  • (2024)Extending the SYCL Joint Matrix for Binarized Neural Networks2024 IEEE International Parallel and Distributed Processing Symposium Workshops (IPDPSW)10.1109/IPDPSW63119.2024.00074(329-333)Online publication date: 27-May-2024
  • (2024)Enabling performance portability on the LiGen drug discovery pipelineFuture Generation Computer Systems10.1016/j.future.2024.03.045158:C(44-59)Online publication date: 1-Sep-2024
  • (2023)A Performance-Portable SYCL Implementation of CRK-HACC for ExascaleProceedings of the SC '23 Workshops of The International Conference on High Performance Computing, Network, Storage, and Analysis10.1145/3624062.3624187(1114-1125)Online publication date: 12-Nov-2023

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Other conferences
IWOCL '23: Proceedings of the 2023 International Workshop on OpenCL
April 2023
133 pages
ISBN:9798400707452
DOI:10.1145/3585341
Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for third-party components of this work must be honored. For all other uses, contact the Owner/Author.

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 18 April 2023

Check for updates

Author Tags

  1. Intel®DPC++ Compatibility Tool
  2. Intel®oneAPI Toolkit
  3. SYCL
  4. SYCLomatic

Qualifiers

  • Abstract
  • Research
  • Refereed limited

Conference

IWOCL '23
IWOCL '23: International Workshop on OpenCL
April 18 - 20, 2023
Cambridge, United Kingdom

Acceptance Rates

Overall Acceptance Rate 84 of 152 submissions, 55%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)26
  • Downloads (Last 6 weeks)2
Reflects downloads up to 04 Sep 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Extending the SYCL Joint Matrix for Binarized Neural Networks2024 IEEE International Parallel and Distributed Processing Symposium Workshops (IPDPSW)10.1109/IPDPSW63119.2024.00074(329-333)Online publication date: 27-May-2024
  • (2024)Enabling performance portability on the LiGen drug discovery pipelineFuture Generation Computer Systems10.1016/j.future.2024.03.045158:C(44-59)Online publication date: 1-Sep-2024
  • (2023)A Performance-Portable SYCL Implementation of CRK-HACC for ExascaleProceedings of the SC '23 Workshops of The International Conference on High Performance Computing, Network, Storage, and Analysis10.1145/3624062.3624187(1114-1125)Online publication date: 12-Nov-2023
  • (2023)Experience Deploying Graph Applications on GPUs with SYCLProceedings of the 52nd International Conference on Parallel Processing Workshops10.1145/3605731.3605744(30-39)Online publication date: 7-Aug-2023

View Options

Get Access

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

HTML Format

View this article in HTML Format.

HTML Format

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media