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
The nitpick test cases allows developers to time and compare different Directed Acyclic Graphs (DAG) of ScalarNodes for various bparser expressions.
4
+
5
+
## File structure
6
+
7
+
There are 4 different files for each case:
8
+
*`<name>_def.hh` - Defines what the parser expression is, what are the variable shapes and names and the result shape
9
+
*`<name>_gen.hh` - Autogenerated file containing a reconstruction of the parser's DAG. This file is in .gitignore
10
+
*`<name>_gen_ref.hh` - The autogenerated file before being edited.
11
+
Most likely identical to `<name>_gen.hh` but the autogenerated file can look different now than how it would generate before.
12
+
*`<name>_gen_edit.hh` - Former file, but edited. The DAG may be constructed more optimally or is using different ScalarNode operations
13
+
14
+
## Adding a case
15
+
16
+
1. Create a `<name>_def.hh` file.
17
+
* This file must define the function `void def(ExprCase&)`
18
+
* You must call the `ExprCase::parse` method to set the bparser's expression.
19
+
* You must specify the result shape using the `ExprCase::set_result_shape` method.
20
+
* You may use the `ExprCase::set_variable` and `ExprCase::set_var_copy` methods.
21
+
They are similar to `Parser::set_variable` and `Parser::set_var_copy`, except you don't need a double pointer.
22
+
* You may use `#ifndef NITPICK_IDE_IGNORE #endif` to trick the IDE into thinking something exists and/or is included. This block will not actually be compiled.
23
+
2. Declare the case in CMakeLists.txt
24
+
* Add `define_nit(<name>)` near similar definitions
25
+
3. Generate the file
26
+
* Make the `nitpick_generate_<name>` target
27
+
4. Copy the autogenerated file
28
+
* First copy should have `_ref` at the end of the filename
29
+
* Second copy should have `_edit` at the end of the filename
30
+
5. Run and compare
31
+
* Use the `nitpick_run_<name>` and `nitpick_run_<name>_edit` Make targets to run and time the original or edited file
32
+
33
+
34
+
## Timing
35
+
The nitpick_run.cc file will repeatedly:
36
+
1. Allocate \<variable_size> × vec_size for each variable set in the ExprCase object where vec_size changes every iteration
37
+
2. Run and time the autogenerated DAG for N ÷ vec_size times, where N is a very high constant integer
38
+
* This is to spend more time computing small vec_sizes
39
+
3. Deallocate memory from step 1.
40
+
41
+
This is done for every vec_size which is an array of integers set in the nitpick_run.cc file
0 commit comments