ParaToolsInc / salt

2 stars 0 forks source link

Create a FrontEnd driver tool #20

Open zbeekman opened 1 month ago

zbeekman commented 1 month ago

Follow along with the example here to create a front end driver plugin for flang. Use this to parse code and identify requested procedures for profiling. This proof of concept instrumentor can be built in parallel with work done for #18 to develop a libTooling for Flang.

Blocked by #16 or #17

For this task, we will implement an instrumentor that will insert TAU instrumentation around code regions of interest. This will perform certain types of common transformation, such as starting a timer upon entry to a procedure and stopping the timer at every exit point, and utilize the libTooling for Flang library developed in Task 1. The deliverable from this task is a SALT-FM instrumentor tool that can parse and instrument ba- sic Fortran programs such as the NAS Parallel Bench- marks and other simple and mixed Fortran and C/C++ programs using more modern Fortran language fea- tures. From previous work with SALT, we have found that it is useful to separate the parsing and instrumenting tasks into their own libraries and to use an interme- diary query library. The basic design and data flow of SALT can be seen in Figure 5, and will likely be adopted for SALT-FM eventually. The instrumentation library will generate Instrumentation Requests, which a Query Library will use to identify source locations in the Fortran source. Transformed source files will be gener- ated, likely by calls into Flang’s parse tree unparser. During Phase I, these components will not necessarily be split into individual libraries nor are they expected to be fully robust and generic. However, the previous development of SALT will guide our design choices, and the prototype will be designed in a modular way so that these tasks can be abstracted into their own libraries during follow on efforts, if not during this Phase I effort. Follow on Phase II efforts will further develop and abstract these components to be more robust and generic. This includes factoring out a SALT-FM Query Library that takes a Flang syntax tree(s) as input and outputs Instrumentation Request objects that identify source locations for later transformation, in addition to the library for the simplified API onto the Flang parse tree discussed in Task 1.