You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At several stages of compilation the structure of the control graph may change due to adding new tasks,
177
+
reordering tasks, optimizing tasks dependencies etc. It is possible to check what exactly has changed after applying some
178
+
transformations either across several passes, within single pass or some individual routine. BarrierInfo class
179
+
offers methods to dump actual state of barrier dependencies at any stage of compilation where the concept of barriers is defined (i.e. in the VPUIP and VPURT dialects). This is typically done
180
+
as follows:
181
+
182
+
```cpp
183
+
auto& barrierInfo = getAnalysis<BarrierInfo>();
184
+
barrierInfo.dumpBarriers("beforeTransformation"); // dump state before barrier optimization
barrierInfo.dumpBarriers("afterTransformation"); // dump state after barrier optimization
187
+
```
188
+
189
+
The subsequent compilation will generate a set of files prefixed "beforeTransformation" and "afterTransformation" respectively, containing the corresponding states of the graph.
190
+
Extensions of the dumped files are as follows:
191
+
- taskUpdateBarriers - contains list of indexes of update barriers for each task in the graph. Each row starts with a unique task index.
192
+
- taskWaitBarriers - contains list of indexes of wait barriers for each task in the graph. Each row starts with a unique task index.
193
+
- barrierProducerMap - contains list of indexes of producers for each barrier in the graph. Each row starts with a unique barrier index.
194
+
- barrierConsumerMap - contains list of indexes of consumers for each barrier in the graph. Each row starts with a unique barrier index.
195
+
- slots - contains number of slots occupied by a task when it waits or updates a barrier. Each row starts with a unique task index.
196
+
- taskQueueTypeMap - contains list task indexes in each queue. Each row starts with queue name, followed by a number tasks in the queue (provided within parentheses), followed by a colon.
197
+
198
+
At times, it is also handy to print out the `module` or the main function, in order to make a connection between tasks/barriers indexes from the dump files and their IR representation. Tracing graph changes is not limited to methods of the BarrierInfo class, but an object of that class needs to be created in order to dump the graph dependencies with the actual state of the IR.
199
+
200
+
Quick investigation of the dependencies from the dump files can be easier than browsing the IR. A plotting tool (located in `tools/barrier-plotter`) can process the dump files and generate `dot` graphs, ready for viewing with e.g. `xdot`. It also exports the `dot` files to `PDF`.
This command will read dump files `beforeTransformation.taskUpdateBarriers`, `beforeTransformation.taskWaitBarriers`, `beforeTransformation.slots` and `beforeTransformation.taskQueueTypeMap` and will produce `beforeTransformation.dot` and `beforeTransformation.dot.pdf`. The output file prefix need not be identical with the dump files prefix and can be adjusted to indicate the dump point and/or compilation configuration.
208
+
174
209
**Notes**
175
210
- By default, declarations and constants are not included. To include them, add `print-declarations=true and print-const=true` to the pass options.
176
211
- The `xdot` application can be used to visualize the dot graph. For big networks however, the application may fail to show the graph. The size of the graph can be reduced by specifying which operations should be included, with the `start-after` & `stop-before` pass options. They should be configured with the exact names of the operation from the compiler IR.
0 commit comments