谷歌浏览器插件
订阅小程序
在清言上使用

Toward a CAD Tool for SYCL programming

Erwan Fabiani,Loic Lagadec, Alexandre Skrzyniarz, Chiara Relevat, Erell Cottour, Paul Allaire

IWOCL '23: Proceedings of the 2023 International Workshop on OpenCL(2023)

引用 0|浏览16
暂无评分
摘要
This poster discusses the design and operation of a CAD tool for the SYCL standard. The availability of heterogeneous platforms combining multicore, FPGA, GPGPU, manycores, CGRA on the same chip is of growing importance. A full exploitation of the available heterogeneous computing power goes through mastering the complexity of the different underlying computing models and their interactions. The SYCL standard addresses this challenge, by standardizing the definition of computing cores and memory transfers, simplifying the portability of cores (between devices on the same platform) or their reuse on different platforms. This indeed simplifies the programming of heterogeneous platforms, yet, the design space exploration, especially driving the choice of granularity of cores and their execution device, remains a major concern. Moreover, expressing dependencies between kernels through memory transfers may induce error-prone execution. Conversely, automatic code generation based on directly expressed relationships between kernels tackles this issue. The objective of our framework is to design methods and tools to solve SYCL program design problems, by following a model-driven engineering methodology. Looking for high performances during the design phase always induces an additional complexity. Our claim is that this complexity can be gradually absorbed by mastering a good development methodology relying on an automatic step-by-step refinement during implementation. Two main problems are highlighted here. The first one concerns the correspondence between the abstract model of kernel dependencies and their expression in SYCL. Defining dependencies via memory transfers limits the analysis of existing code, hence evolution and continuous verification of its structural compliance with the initial specifications. Conversely, automatic generation of interaction code from a high-level model is a way to increase productivity and reliability. The second concerns the exploration of the space of possible solutions for an application, due to the possibility of implementing a kernel on several hardware supports. This raises the question of choosing the best solutions for a given study case by generating and scoring different variants. Manually programming these variants is time-consuming and error-prone, and naturally leads to design space pruning, leaving apart some non-trivial good candidates. Instead, having an environment to generate them automatically is part of the solution. The core of our framework is a high-level object model of all the kernels of an application and their dependencies. This model is made up of classes that reflect the structure of a SYCL program, seen as a graph whose nodes are the command groups that depend on the data they manipulate. The Data class, which characterizes an accessor, is associated with a variable (type, number of dimensions, size of each dimension) and provides its name and access mode (read, write, read_write). In the case of a dynamic construction, the access mode is automatically inferred from the expressed dependencies. The Command_group class characterizes a command group, designating a kernel and a device on which to run. An instance also contains a list of Data objects which correspond to the accessors used by the kernel. The model does not express the internal code of the kernels, which are seen as black boxes. Their SYCL code (in the form of a lambda function) is stored in independent files, which are referenced by a unique name. The Data associated with a command group must be of the same nature as the parameters used in the code of the kernel. The Node class encapsulates a Command_group and makes it possible to describe the dependencies between command groups as a directed graph (class Graph). The Graph class automatically labels the nodes in a possible order of execution with respect to the expressed dependencies. This is mandatory for the code generation phase which requires the command groups to be declared in sequence. There are two ways to express a SYCL program in our framework, so that to generate the associated object. (1) By using a SYCL code parser (on a restricted subset of the language), which promotes reusing existing code and integrate it into the framework. The parser isolates the kernel codes as independent files, analyzes the dependencies between kernels and expresses them in the generated graph. (2) By modifying (or writing) a C++ program, and using instance’s creation methods, for the expression of dependency between command groups. The framework comes with a viewer of the dependency graph of command group executions (based on Graphviz): either on the complete graph or device by device. This helps checking the expression conformity of the program against the specifications or analyzing the structure of an existing SYCL program once processed by the parser. One key objective of the project is to allow the automatic transformation of code by integrating it into the abstract model. Currently, this is done in the following two cases: The modification of the structure and characteristics of an existing program (dependencies, kernels used, devices, accessors) with no need for modifying the code itself. This is implemented via an HMI. One typical benefit would be on-demand addition of monitoring functionalities, for example to measure performances or integrate assertions. In the current version, the user can request a code generation with execution time per each command group as a metric. This happens by the automatic creation of events. Then the generation of SYCL code is done by a method which extracts all the information contained in a Graph object and integrates the code of the kernels. The order of declaration of command groups derives from the automatically calculated labeling. Prospects for further development of the framework include:
更多
查看译文
关键词
sycl programming,cad tool
AI 理解论文
溯源树
样例
生成溯源树,研究论文发展脉络
Chat Paper
正在生成论文摘要