DaCe Visual Studio Code Extension
The DaCe Visual Studio Code (VS Code) extension provides a rich editor for SDFGs with included profiling, debugging, static analysis, and interactive optimization. The extension is available through the built-in VS Code marketplace. The extension is maintained separately from DaCe on GitHub, where issues and feature requests can be reported.
SDFG element properties, such as schedules, names, and data types, can be changed, added, or removed in the details panel. Properties of individual elements can be viewed and edited by selecting the corresponding element in the main SDFG view, while clicking anywhere on the background in the main SDFG view brings up the top-level SDFG’s properties for editing.
The main SDFG view further allows for editing of the SDFG structure itself. Elements can be selected from the top bar and can be added to the graph by clicking on any valid position. Invalid positions are shown when the element preview under the cursor turns red, such as when trying to add an AccessNode or a Tasklet outside of an SDFG State.
Graph elements or States can be connected with edges by selecting the edge tool in the top toolbar, and then clicking on the source element, followed by the destination element.
To delete graph elements, the element or elements can be selected and removed by pressing the Delete key (keyboard).
Graph elements can be moved around freely using the move tool , which updates and saves their positions to manually change the graph layout.
Newly added elements or edges can be adjusted through the details panel. The animation below shows a demonstration of adding a new AccessNode, connecting it to an existing node through a graph edge, and then editing its properties. Further demonstrated is the removal of an existing node, as well as moving a node to a different position.
An SDFG’s performance can be analyzed in detail and subsequently optimized using transformations from witin the editor. For details, please see Using Visual Studio Code for Optimization.
Compiling and Running SDFGs
SDFGs can be compiled through the user interface, using the ‘Compile SDFG’ button
in the top right of the SDFG editor. This generates the code and corresponding library for the current
SDFG in the default location (
.dacecache folder, if not modified through the
A demonstration of compiling an SDFG can be seen below. In the example, an SDFG is compiled, the generated code for a specific graph element is opened via the details panel, a transformation is applied, tiling the map, before the graph is re-compiled and the changed generated code becomes visible.
The native VS Code launch configurations and interface can be used to run, debug, or profile SDFGs.
The recommended way of running SDFGs involves creating a
launch.json file through VS Code. For
more information on how to create a launch configuration, please refer to the current version of the
VS Code documentation.
The launch configuration preset to use is called “SDFG: Run current file”.
With this configuration selected, open the SDFG you wish to run, and start the configuration by either
pressing F5 on the keyboard, or clicking on the play button next to the configuration.
VS Code will attempt to determine the original Python source file which generated the SDFG, which will
then be used to run the optimized graph by compiling and linking against the pre-compiled graph.
If the original source file cannot be determined automatically, a prompt will appear asking the user to
provide such a file.