SYCL Building Blocks for C++ Libraries Maria Rovatsou, SYCL Specification Editor Principal Software Engineer, Codeplay Software

Total Page:16

File Type:pdf, Size:1020Kb

SYCL Building Blocks for C++ Libraries Maria Rovatsou, SYCL Specification Editor Principal Software Engineer, Codeplay Software SYCL Building Blocks for C++ libraries Maria Rovatsou, SYCL specification editor Principal Software Engineer, Codeplay Software © Copyright Khronos Group 2014 SYCL Building Blocks for C++ libraries Overview SYCL standard What is the SYCL toolkit for? C++ libraries using SYCL: Under construction SYCL Building blocks asynchronous execution on multiple SYCL devices command groups for embedding computational kernels in a library buffers and accessors for data storage and access vector classes shared between host and device pipes hierarchical command group execution printing on device using cl::sycl::stream © Copyright Khronos Group 2014 SYCL standard © Copyright Khronos Group 2014 Khronos royalty-free open standard that works with OpenCLTM SYCLTM for OpenCLTM 1.2 is a published specification that can be found at: https://www.khronos.org/registry/sycl/specs/sycl-1.2.pdf SYCLTM for OpenCLTM 2.2 is a published provisional specification that the group would like feedback on: https://www.khronos.org/registry/sycl/specs/sycl-2.2.pdf © Copyright Khronos Group 2014 What is the SYCL toolkit for? © Copyright Khronos Group 2014 What is the SYCL toolkit for? Performance Heterogeneous Programmability Power efficiency system Longevity of software written for Best h/w architecture integrating host multi-core CPU custom architectures per application with GPUs and Use existing C++ frameworks on Harness processing power in accelerators new targets, e.g. from HPC to order to create much more mobile and embedded and vice powerful applications versa © Copyright Khronos Group 2014 C++ libraries using SYCL building blocks: Under construction © Copyright Khronos Group 2014 C++ libraries using SYCL building blocks: VisionCpp 1 auto q = get_queue<gpu_selector>(); 2 cv::VideoCapture cap(0); 3 cap >> frame; 4 std::shared_ptr<unsigned char> ptr; 5 auto a = Node<sBGR, rows,cols,Image>(frame.data); 6 auto b = Node<sBGR2sRGB>(a); 7 auto c = Node<sRGB2lRGB>(b); 8 auto d = Node<lRGB2lHSV>(c); VisionCpp is a templated 9 auto e = Node<DegradeH>(d); 10 auto f = Node<lHSV2lRGB>(e); library with a domain 11 auto g = Node<lRGB2sRGB>(f); 12 auto h = Node<sRGB2sBGR>(g); specific C++ dialect focused 13 for (;;) { 14 auto fused_kernel = execute<Fuse>(h, q); on providing a framework 15 ptr = fused_kernel.getData(); 16 cv::imshow("Colour Degragation", ooo); for efficient Machine Vision 17 if (cv::waitKey(30) >= 0) 18 break; algorithms 19 cap >> frame; // get a new frame from camera 20 } © Copyright Khronos Group 2014 C++ libraries using SYCL building blocks: Eigen Tensor Library 1 // use gpu 2 cl::sycl::gpu_selector s; 3 cl::sycl::queue q(s); 4 Eigen::SyclDevice sycl_device(q); 5 // create a tensor range Eigen is a C++ 6 Eigen::array<int, 3> tensorRange = {{100, 100, 100}}; 7 // create tensors templated library 8 Eigen::Tensor<float, 3> in1(tensorRange); for linear 9 Eigen::Tensor<float, 3> in2(tensorRange); 10 Eigen::Tensor<float, 3> in3(tensorRange); algebra. 11 Eigen::Tensor<float, 3> out(tensorRange); 12 // create random data for each tensor The Tensor 13 in1 = in1.random(); 14 in2 = in2.random(); module SYCL 15 in3 = in3.random(); support is in 16 // create a map veiw for each tensor 17 Eigen::TensorMap<Eigen::Tensor<float, 3> > gpu_in1(in1.data(), tensorRange); progress. 18 Eigen::TensorMap<Eigen::Tensor<float, 3> > gpu_in2(in2.data(), tensorRange); 19 Eigen::TensorMap<Eigen::Tensor<float, 3> > gpu_in3(in3.data(), tensorRange); 20 Eigen::TensorMap<Eigen::Tensor<float, 3> > gpu_out(out.data(), tensorRange); 21 // assign operator invokes executor 22 gpu_out.device(sycl_device) = gpu_in1 * gpu_in2 + gpu_in3; © Copyright Khronos Group 2014 C++ libraries using SYCL building blocks: Parallel STL Parallel STL is the next version of the C++ standard library which is starting to add support for parallel algorithms. 1 vector <int > data = { 8, 9, 1, 4 }; 2 std :: sort ( sycl_policy , v. begin () , v. end ()); 3 if ( is_sorted ( data )) { 4 cout << " Data is sorted ! " << endl ; 5 } © Copyright Khronos Group 2014 SYCL building blocks © Copyright Khronos Group 2014 SYCL Building Blocks: asynchronous execution on multiple SYCL devices buffers device_selector accessors command groups for atomically parallel_for functions for encapsulating kernels over an scheduling computational kernels index space of work items on queues asynchronous error handling single-source offline multiple host/device compiler solutions event mechanism C++ lambdas or functors compiled for SYCL asynchronous queue devices. © Copyright Khronos Group 2014 SYCL Building Blocks: command groups for embedding computational kernels in a library The data movement is command group lambda or functor managed by buffers and accessors. 1 auto myCommandGroup = ([&](cl::sycl::execution_handler& cgh) { 2 auto acc = buffer.get_access<cl::sycl::access::mode::read_write>(cgh); 3 cgh.single_task<class lambda_or_functor_kernel>( 4 cl::sycl::nd_range<2>(range<2>(16, 16), range<2>(4, 4)), 5 [=](cl::sycl::nd_item<1> idx) { 6 group my_group = idx.get_group(); 7 int x = a_function(); 8 int sum = my_group.reduce<work_group_op::add>(x); 9 //.. 10 }); 11 }); On submit the kernel and its access requirements are 1 queue myQueue; scheduled for execution on an asynchronous queue. 2 auto myEvent = myQueue.submit(myCommandGroup); © Copyright Khronos Group 2014 SYCL Building Blocks: buffers and accessors for data storage and access Data is managed 1 buffer<pos_t, 1> positionsBuf(positions.data(), across host and 2 range<1>(number_objects)); device using the 3 buffer<vel_t, 1> velocitiesBuf(velocities.data(), 4 range<1>(number_objects)); buffer class. The buffer on destruction waits for all usage of its data by the SYCL The buffer class takes runtime to be completed. ownership of the data. © Copyright Khronos Group 2014 SYCL Building Blocks: accessors for data storage and access Accessor class The SYCL runtime is effectively constructing an asynchronous runtime gives access to a graph that schedules all the command groups and their memory buffer in a transfers. command group 1 auto cg = [&](handler &ch) { 2 auto posAcc = positionsBuf.get_access<access::mode::read>(ch); 3 auto velAcc = velocitiesBuf.get_access<access::mode::read_write>(ch); 4 auto newPosAcc = newposBuf.get_access<access::mode::read_write>(ch); 5 ch.parallel_for<class nbody_kernel>( Host accessors 6 nd_range<1>(range<1>(number_objects), range<1>(256)), force 7 ([=](nd_item<1> item_) { 8 unsigned int i = item_.get_global_linear_id(); synchronisation of 9 // Computation and update of velocities[ ... ] all copies of the 10 // Compute the new positions 11 newPosAcc[i][0] = posAcc[i][0] + dtCube * velAcc[i][0] + 0.5f a[0]; buffer on devices 12 newPosAcc[i][1] = posAcc[i][1] + dtCube * velAcc[i][1] + 0.5f * a[1]; with the host. 13 newPosAcc[i][2] = posAcc[i][2] + dtCube * velAcc[i][2] + 0.5f * a[2]; 14 })); 15 }; © Copyright Khronos Group 2014 SYCL Building Blocks: accessors for data storage and access 1 cl::sycl::svm_allocator<int, cl::sycl::svm_fine_grain> fineGrainAllocator( svm_allocator 2 fineGrainedContext); 3 /* Use the instance of the svm_allocator with any custom container, for provides allocation 4 * example, with std::shared_ptr. capabilities for 5 */ SYCL 2.2 devices 6 std::shared_ptr<int> svmFineBuffer = 7 std::allocate_shared<int>(fineGrainAllocator, numElements); with fine grained 8 /* Initialize the pointer on the host */ SVM capabilities. 9 *svmFineBuffer = 66; 1 q.submit([&]( 2 cl::sycl::execution_handler<svm_fine_grain< 3 cl::sycl::svm_sharing::buffer, cl::sycl::svm_atomics::none>>& cgh) { Registered usage 4 auto rawSvmFinePointer = svmFineBuffer.get(); of the SVM 5 cgh.register_access<cl::sycl::access::mode::read_write>(rawSvmFinePointer); 6 cgh.single_task<class svm_fine_grained_kernel>( allocated 7 range<1>(1), [=](id<1> index) { rawSvmFinePointer[index]++; }); pointer. 8 }); 1 int result = *svmFineBuffer; Direct Usage of SVM allocated fine grained buffer pointer on the host. © Copyright Khronos Group 2014 SYCL Building Blocks: SIMD vector classes available on host and device 1 for (int i = 0; i < 64; i++) { The vec<class T, int S> class 2 dataA[i] = float4(2.0f, 1.0f, 1.0f, static_cast<float>(i)); can be used on host and 3 dataB[i] = float3(0.0f, 0.0f, 0.0f); device. 4 } 1 myQueue.submit([&](handler& cgh) { 2 auto ptrA = bufA.get_access<access::mode::read_write>(cgh); 3 auto ptrB = bufB.get_access<access::mode::read_write>(cgh); Swizzles are 4 supported as 5 cgh.parallel_for<class vector_example>(range<3>(4, 4, 4), [=](item<3> item) { 6 float4 in = ptrA[item.get_linear_id()]; functions, as 7 float w = in.w(); well as all the 8 float3 swizzle = in.xyz(); 9 float3 trans = swizzle * w; common 10 ptrB[item.get_linear_id()] = trans; operators for 11 }); 12 }); vectors. © Copyright Khronos Group 2014 SYCL Building Blocks: pipes 1 cl::sycl::static_pipe<float, 4> p; 2 3 // Launch the producer to stream A to the pipe 4 q.submit([&](cl::sycl::execution_handle &cgh) { 5 // Get write access to the pipe 6 auto kp = p.get_access<cl::sycl::access::write>(cgh); Pipes are available in SYCL 7 // Get read access to the data 8 auto ka = ba.get_access<cl::sycl::access::read>(cgh); 2.2 for OpenCL 2.2 devices. 9 10 cgh.single_task<class producer_using_pipes>([=] { 11 for (int i = 0; i != N; i++) Pipes are a memory object 12 // Try to write to the pipe up to success 13 while (!(kp.write(ka[i]))); with a sequential ordering of 14 }); data that cannot be accessed 15 }); from the host. The static_pipe is a pipe with constexpr capacity that is defined only for one target device. This is
Recommended publications
  • The Importance of Data
    The landscape of Parallel Programing Models Part 2: The importance of Data Michael Wong and Rod Burns Codeplay Software Ltd. Distiguished Engineer, Vice President of Ecosystem IXPUG 2020 2 © 2020 Codeplay Software Ltd. Distinguished Engineer Michael Wong ● Chair of SYCL Heterogeneous Programming Language ● C++ Directions Group ● ISOCPP.org Director, VP http://isocpp.org/wiki/faq/wg21#michael-wong ● [email protected][email protected] Ported ● Head of Delegation for C++ Standard for Canada Build LLVM- TensorFlow to based ● Chair of Programming Languages for Standards open compilers for Council of Canada standards accelerators Chair of WG21 SG19 Machine Learning using SYCL Chair of WG21 SG14 Games Dev/Low Latency/Financial Trading/Embedded Implement Releasing open- ● Editor: C++ SG5 Transactional Memory Technical source, open- OpenCL and Specification standards based AI SYCL for acceleration tools: ● Editor: C++ SG1 Concurrency Technical Specification SYCL-BLAS, SYCL-ML, accelerator ● MISRA C++ and AUTOSAR VisionCpp processors ● Chair of Standards Council Canada TC22/SC32 Electrical and electronic components (SOTIF) ● Chair of UL4600 Object Tracking ● http://wongmichael.com/about We build GPU compilers for semiconductor companies ● C++11 book in Chinese: Now working to make AI/ML heterogeneous acceleration safe for https://www.amazon.cn/dp/B00ETOV2OQ autonomous vehicle 3 © 2020 Codeplay Software Ltd. Acknowledgement and Disclaimer Numerous people internal and external to the original C++/Khronos group, in industry and academia, have made contributions, influenced ideas, written part of this presentations, and offered feedbacks to form part of this talk. But I claim all credit for errors, and stupid mistakes. These are mine, all mine! You can’t have them.
    [Show full text]
  • Introduction to GPU Computing
    Introduction to GPU Computing J. Austin Harris Scientific Computing Group Oak Ridge National Laboratory ORNL is managed by UT-Battelle for the US Department of Energy Performance Development in Top500 • Yardstick for measuring 1 Exaflop/s performance in HPC – Solve Ax = b – Measure floating-point operations per second (Flop/s) • U.S. targeting Exaflop system as early as 2022 – Building on recent trend of using GPUs https://www.top500.org/statistics/perfdevel 2 J. Austin Harris --- JETSCAPE --- 2020 Hardware Trends • Scaling number of cores/chip instead of clock speed • Power is the root cause – Power density limits clock speed • Goal has shifted to performance through parallelism • Performance is now a software concern Figure from Kathy Yelick, “Ten Ways to Waste a Parallel Computer.” Data from Kunle Olukotun, Lance Hammond, Herb Sutter, Burton Smith, Chris Batten, and Krste Asanoviç. 3 J. Austin Harris --- JETSCAPE --- 2020 GPUs for Computation • Excellent at graphics rendering – Fast computation (e.g., TV refresh rate) – High degree of parallelism (millions of independent pixels) – Needs high memory bandwidth • Often sacrifices latency, but this can be ameliorated • This computation pattern common in many scientific applications 4 J. Austin Harris --- JETSCAPE --- 2020 GPUs for Computation • CPU Strengths • GPU Strengths – Large memory – High mem. BW – Fast clock speeds – Latency tolerant via – Large cache for parallelism latency optimization – More compute – Small number of resources (cores) threads that can run – High perf./watt very quickly • GPU Weaknesses • CPU Weaknesses – Low mem. Capacity – Low mem. bandwidth – Low per-thread perf. – Costly cache misses – Low perf./watt Slide from Jeff Larkin, “Fundamentals of GPU Computing” 5 J.
    [Show full text]
  • Intel® Oneapi Programming Guide
    Intel® oneAPI Programming Guide Intel Corporation www.intel.com Notices and Disclaimers Contents Notices and Disclaimers....................................................................... 5 Chapter 1: Introduction oneAPI Programming Model Overview ..........................................................7 Data Parallel C++ (DPC++)................................................................8 oneAPI Toolkit Distribution..................................................................9 About This Guide.......................................................................................9 Related Documentation ..............................................................................9 Chapter 2: oneAPI Programming Model Sample Program ..................................................................................... 10 Platform Model........................................................................................ 14 Execution Model ...................................................................................... 15 Memory Model ........................................................................................ 17 Memory Objects.............................................................................. 19 Accessors....................................................................................... 19 Synchronization .............................................................................. 20 Unified Shared Memory.................................................................... 20 Kernel Programming
    [Show full text]
  • Opencl SYCL 2.2 Specification
    SYCLTM Provisional Specification SYCL integrates OpenCL devices with modern C++ using a single source design Version 2.2 Revision Date: – 2016/02/15 Khronos OpenCL Working Group — SYCL subgroup Editor: Maria Rovatsou Copyright 2011-2016 The Khronos Group Inc. All Rights Reserved Contents 1 Introduction 13 2 SYCL Architecture 15 2.1 Overview . 15 2.2 The SYCL Platform and Device Model . 15 2.2.1 Platform Mixed Version Support . 16 2.3 SYCL Execution Model . 17 2.3.1 Execution Model: Queues, Command Groups and Contexts . 18 2.3.2 Execution Model: Command Queues . 19 2.3.3 Execution Model: Mapping work-items onto an nd range . 21 2.3.4 Execution Model: Execution of kernel-instances . 22 2.3.5 Execution Model: Hierarchical Parallelism . 24 2.3.6 Execution Model: Device-side enqueue . 25 2.3.7 Execution Model: Synchronization . 25 2.4 Memory Model . 26 2.4.1 Access to memory . 27 2.4.2 Memory consistency . 28 2.4.3 Atomic operations . 28 2.5 The SYCL programming model . 28 2.5.1 Basic data parallel kernels . 30 2.5.2 Work-group data parallel kernels . 30 2.5.3 Hierarchical data parallel kernels . 30 2.5.4 Kernels that are not launched over parallel instances . 31 2.5.5 Synchronization . 31 2.5.6 Error handling . 32 2.5.7 Scheduling of kernels and data movement . 32 2.5.8 Managing object lifetimes . 34 2.5.9 Device discovery and selection . 35 2.5.10 Interfacing with OpenCL . 35 2.6 Anatomy of a SYCL application .
    [Show full text]
  • Of the Threading Building Blocks Flow Graph API, a C++ API for Expressing Dependency, Streaming and Data Flow Applications
    Episode 15: A Proving Ground for Open Standards Host: Nicole Huesman, Intel Guests: Mike Voss, Intel; Andrew Lumsdaine, Northwest Institute for Advanced Computing ___________________________________________________________________________ Nicole Huesman: Welcome to Code Together, an interview series exploring the possibilities of cross- architecture development with those who live it. I’m your host, Nicole Huesman. In earlier episodes, we’ve talked about the need to make it easier for developers to build code for heterogeneous environments in the face of increasingly diverse and data-intensive workloads. And the industry shift to modern C++ with the C++11 release. Today, we’ll continue that conversation, exploring parallelism and heterogeneous computing from a user’s perspective with: Andrew Lumsdaine. As Chief Scientist at the Northwest Institute for Advanced Computing, Andrew wears at least two hats: Laboratory Fellow at Pacific Northwest National Lab, and Affiliate Professor in the Paul G. Allen School of Computer Science and Engineering at the University of Washington. By spanning a university and a national lab, Andrew has the opportunity to work on research questions, and then translate those results into practice. His primary research interest is High Performance Computing, with a particular attention to scalable graph algorithms. I should also note that Andrew is a member of the oneAPI Technical Advisory Board. Andrew, so great to have you with us! Andrew Lumsdaine: Thank you. It’s great to be here. Nicole Huesman: And Mike Voss. Mike is a Principal Engineer at Intel, and was the original architect of the Threading Building Blocks flow graph API, a C++ API for expressing dependency, streaming and data flow applications.
    [Show full text]
  • SYCL – Introduction and Hands-On
    SYCL – Introduction and Hands-on Thomas Applencourt + people on next slide - [email protected] Argonne Leadership Computing Facility Argonne National Laboratory 9700 S. Cass Ave Argonne, IL 60349 Book Keeping Get the example and the presentation: 1 git clone https://github.com/alcf-perfengr/sycltrain 2 cd sycltrain/presentation/2020_07_30_ATPESC People who are here to help: • Collen Bertoni - [email protected] • Brian Homerding - [email protected] • Nevin ”:)” Liber [email protected] • Ben Odom - [email protected] • Dan Petre - [email protected]) 1/17 Table of contents 1. Introduction 2. Theory 3. Hands-on 4. Conclusion 2/17 Introduction What programming model to use to target GPU? • OpenMP (pragma based) • Cuda (proprietary) • Hip (low level) • OpenCL (low level) • Kokkos, RAJA, OCCA (high level, abstraction layer, academic projects) 3/17 What is SYCL™?1 1. Target C++ programmers (template, lambda) 1.1 No language extension 1.2 No pragmas 1.3 No attribute 2. Borrow lot of concept from battle tested OpenCL (platform, device, work-group, range) 3. Single Source (two compilations passes) 4. High level data-transfer 5. SYCL is a Specification developed by the Khronos Group (OpenCL, SPIR, Vulkan, OpenGL) 1SYCL Doesn’t mean ”Someone You Couldn’t Love”. Sadly. 4/17 SYCL Implementations 2 2Credit: Khronos groups (https://www.khronos.org/sycl/) 5/17 Goal of this presentation 1. Give you a feel of SYCL 2. Go through code examples (and make you do some homework) 3. Teach you enough so that can search for the rest if you interested 4. Question are welcomed! 3 3Please just talk, or use slack 6/17 Theory A picture is worth a thousand words4 4and this is a UML diagram so maybe more! 7/17 Memory management: SYCL innovation 1.
    [Show full text]
  • Under the Hood of SYCL – an Initial Performance Analysis with an Unstructured-Mesh CFD Application
    Under the Hood of SYCL – An Initial Performance Analysis With an Unstructured-mesh CFD Application Istvan Z. Reguly1;2, Andrew M.B. Owenson2, Archie Powell2, Stephen A. Jarvis3, and Gihan R. Mudalige2 1 Faculty of Information Technology and Bionics, Pazmany Peter Catholic University, Budapest, Hungary [email protected] 2 University of Warwick, Coventry, UK {a.m.b.owenson, a.powell.3, g.mudalige}@warwick.ac.uk 3 University of Birmingham, Birmingham, UK [email protected] Abstract. As the computing hardware landscape gets more diverse, and the com- plexity of hardware grows, the need for a general purpose parallel programming model capable of developing (performance) portable codes have become highly attractive. Intel’s OneAPI suite, which is based on the SYCL standard aims to fill this gap using a modern C++ API. In this paper, we use SYCL to parallelize MG- CFD, an unstructured-mesh computational fluid dynamics (CFD) code, to explore current performance of SYCL. The code is benchmarked on several modern pro- cessor systems from Intel (including CPUs and the latest Xe LP GPU), AMD, ARM and Nvidia, making use of a variety of current SYCL compilers, with a par- ticular focus on OneAPI and how it maps to Intel’s CPU and GPU architectures. We compare performance with other parallelisations available in OP2, including SIMD, OpenMP, MPI and CUDA. The results are mixed; the performance of this class of applications, when parallelized with SYCL, highly depends on the target architecture and the compiler, but in many cases comes close to the performance of currently prevalent parallel programming models.
    [Show full text]
  • Resyclator: Transforming CUDA C++ Source Code Into SYCL
    ReSYCLator: Transforming CUDA C++ source code into SYCL Tobias Stauber Peter Sommerlad [email protected] [email protected] IFS Institute for Software at FHO-HSR Hochschule für Technik Rapperswil, Switzerland Figure 1: Transforming CUDA C++ code to SYCL using C++ AST Rewriting. ABSTRACT ReSYCLator is a plug-in for the C++ IDE Cevelop[2], that is CUDA™ while very popular, is not as flexible with respect to tar- itself an extension of Eclipse-CDT. ReSYCLator bridges the gap get devices as OpenCL™. While parallel algorithm research might between algorithm availability and portability, by providing au- address problems first with a CUDA C++ solution, those results are tomatic transformation of CUDA C++ code to SYCL C++. A first ® not easily portable to a target not directly supported by CUDA. In attempt basing the transformation on NVIDIA ’s Nsight™ Eclipse contrast, a SYCL™ C++ solution can operate on the larger variety CDT plug-in showed that Nsight™’s weak integration into CDT’s of platforms supported by OpenCL. static analysis and refactoring infrastructure is insufficient. There- fore, an own CUDA-C++ parser and CUDA language support for Eclipse CDT was developed (CRITTER) that is a sound platform Permission to make digital or hard copies of all or part of this work for personal or for transformations from CUDA C++ programs to SYCL based on 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 AST transformations. on the first page. Copyrights for components of this work owned by others than the author(s) must be honored.
    [Show full text]
  • Trisycl Open Source C++17 & Openmp-Based Opencl SYCL Prototype
    triSYCL Open Source C++17 & OpenMP-based OpenCL SYCL prototype Ronan Keryell Khronos OpenCL SYCL committee 05/12/2015 — IWOCL 2015 SYCL Tutorial • I OpenCL SYCL committee work... • Weekly telephone meeting • Define new ways for modern heterogeneous computing with C++ I Single source host + kernel I Replace specific syntax by pure C++ abstractions • Write SYCL specifications • Write SYCL conformance test • Communication & evangelism triSYCL — Open Source C++17 & OpenMP-based OpenCL SYCL prototype IWOCL 2015 2 / 23 • I SYCL relies on advanced C++ • Latest C++11, C++14... • Metaprogramming • Implicit type conversion • ... Difficult to know what is feasible or even correct... ;• Need a prototype to experiment with the concepts • Double-check the specification • Test the examples Same issue with C++ standard and GCC or Clang/LLVM triSYCL — Open Source C++17 & OpenMP-based OpenCL SYCL prototype IWOCL 2015 3 / 23 • I Solving the meta-problem • SYCL specification I Includes header files descriptions I Beautified .hpp I Tables describing the semantics of classes and methods • Generate Doxygen-like web pages Generate parts of specification and documentation from a reference implementation ; triSYCL — Open Source C++17 & OpenMP-based OpenCL SYCL prototype IWOCL 2015 4 / 23 • I triSYCL (I) • Started in April 2014 as a side project • Open Source for community purpose & dissemination • Pure C++ implementation I DSEL (Domain Specific Embedded Language) I Rely on STL & Boost for zen style I Use OpenMP 3.1 to leverage CPU parallelism I No compiler cannot generate kernels on GPU yet • Use Doxygen to generate I Documentation; of triSYCL implementation itself with implementation details I SYCL API by hiding implementation details with macros & Doxygen configuration • Python script to generate parts of LaTeX specification from Doxygen LaTeX output triSYCL — Open Source C++17 & OpenMP-based OpenCL SYCL prototype IWOCL 2015 5 / 23 • I Automatic generation of SYCL specification is a failure..
    [Show full text]
  • SYCL for CUDA
    DPC++ on Nvidia GPUs DPC++ on Nvidia GPUs Ruyman Reyes Castro Stuart Adams, CTO Staff Software Engineer IXPUG/TACC Products Markets High Performance Compute (HPC) Integrates all the industry C++ platform via the SYCL™ Automotive ADAS, IoT, Cloud Compute standard technologies needed open standard, enabling vision Smartphones & Tablets to support a very wide range & machine learning e.g. of AI and HPC TensorFlow™ Medical & Industrial Technologies: Artificial Intelligence Vision Processing The heart of Codeplay's Machine Learning compute technology enabling Big Data Compute OpenCL™, SPIR-V™, HSA™ and Vulkan™ Enabling AI & HPC to be Open, Safe & Company Customers Accessible to All Leaders in enabling high-performance software solutions for new AI processing systems Enabling the toughest processors with tools and middleware based on open standards Established 2002 in Scotland with ~80 employees And many more! 3 © 2020 Codeplay Software Ltd. Summary • What is DPC++ and SYCL • Using SYCL for CUDA • Design of SYCL for CUDA • Implementation of SYCL for CUDA • Interoperability with existing libraries • Using oneMKL on CUDA • Conclusions and future work 4 © 2020 Codeplay Software Ltd. What is DPC++? Intel’s DPC++ • Data Parallel C++ (DPC++) is an open, standards-based alternative to single-architecture proprietary languages, part of oneAPI spec. SYCL 2020 • It is based on C++ and SYCL, allowing developers to reuse code across hardware targets (CPUs and accelerators such as GPUs and FPGAs) and also perform custom tuning for SYCL 1.2.1 a specific accelerator. 5 © 2020 Codeplay Software Ltd. Codeplay and SYCL • Codeplay has been part of the SYCL community from the beginning • Our team has helped to shape the SYCL open standard • We implemented the first conformant SYCL product 6 © 2020 Codeplay Software Ltd.
    [Show full text]
  • Investigation of the Opencl SYCL Programming Model
    Investigation of the OpenCL SYCL Programming Model Angelos Trigkas August 22, 2014 MSc in High Performance Computing The University of Edinburgh Year of Presentation: 2014 Abstract OpenCL SYCL is a new heterogeneous and parallel programming framework created by the Khronos Group that tries to bring OpenCL programming into C++. In particular, it enables C++ developers to create OpenCL kernels, using all the popular C++ features, such as classes, inheritance and templates. What is more, it dramatically reduces programming effort and complexity, by letting the runtime system handle system resources and data transfers. In this project we investigate Syclone, a prototype SYCL implementation that we acquired from Codeplay Ltd. To do that we compare SYCL in terms of both programmability and performance with another two established parallel programming models, OpenCL and OpenMP. In particular, we have chosen six scientific applications and ported them in all three models. Then we run benchmarking experiments to assess their performance on an Intel Xeon Phi based platform. The results have shown that SYCL does great from a programmability perspective. However, its performance still does not match that of OpenCL or OpenMP. Contents Chapter 1 Introduction .......................................................................................................... 1 1.1 Motivation ...................................................................................................................................... 1 1.2 Project Goals ................................................................................................................................
    [Show full text]
  • Comparing SYCL with HPX, Kokkos, Raja and C++ Executors the Future of ISO C++ Heterogeneous Computing
    Comparing SYCL with HPX, Kokkos, Raja and C++ Executors The future of ISO C++ Heterogeneous Computing Michael Wong (Codeplay Software, VP of Research and Development), Andrew Richards, CEO ISOCPP.org Director, VP http://isocpp.org/wiki/faq/wg21#michael-wong Head of Delegation for C++ Standard for Canada Vice Chair of Programming Languages for Standards Council of Canada Chair of WG21 SG5 Transactional Memory Chair of WG21 SG14 Games Dev/Low Latency/Financial Trading/Embedded Editor: C++ SG5 Transactional Memory Technical Specification Editor: C++ SG1 Concurrency Technical Specification http:://wongmichael.com/about SC2016 Agenda • Heterogensous Computing for ISO C++ • SYCL • HPX (slides thanks to Hartmut Kaiser) • Kokkos (slides thanks to Carter Edwards, Christian Trott) • Raja (Slides thanks to David Beckingsale) • State of C++ Concurrency and Parallelism • C++ Executors coming in C++20 • C++ simd/vector coming in C++20 2 © 2016 Codeplay Software Ltd. The goal for C++ •Great support for cpu latency computations through concurrency TS- •Great support for cpu throughput through parallelism TS •Great support for Heterogeneous throughput computation in future 3 © 2016 Codeplay Software Ltd. Many alternatives for Massive dispatch/heterogeneous • Programming Languages Usage experience • OpenGL • DirectX • OpenMP/OpenACC • CUDA • HPC • OpenCL • SYCL • OpenMP • OpenCL • OpenACC • CUDA • C++ AMP • HPX • HSA • SYCL • Vulkan 4 © 2016 Codeplay Software Ltd. Not that far away from a Grand Unified Theory •GUT is achievable •What we have is only missing 20% of where we want to be •It is just not designed with an integrated view in mind ... Yet •Need more focus direction on each proposal for GUT, whatever that is, and add a few elements 5 © 2016 Codeplay Software Ltd.
    [Show full text]