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
TypeART \[[TA18](#ref-typeart-2018)\] is a type and memory allocation tracking sanitizer.
4
-
It consists of an LLVM compiler pass and a corresponding runtime to track relevant memory allocation information during the execution of a target program.
5
-
It instruments heap, stack and global variable allocations with a callback to our runtime.
6
-
The callback consists of the runtime memory pointer value, what type (built-ins, user-defined structs etc.) and extent of the value.
7
-
This allows users of our runtime to query detailed type information behind arbritary memory locations, as long as they are mapped.
3
+
TypeART \[[TA18](#ref-typeart-2018); [TA20](#ref-typeart-2020)\] is a type and memory allocation tracking sanitizer. It
4
+
consists of an LLVM compiler pass and a corresponding runtime to track relevant memory allocation information during the
5
+
execution of a target program. It instruments heap, stack and global variable allocations with a callback to our
6
+
runtime. The callback consists of the runtime memory pointer value, what type (built-ins, user-defined structs etc.) and
7
+
extent of the value. This allows users of our runtime to query detailed type information behind arbitrary memory
8
+
locations, as long as they are mapped.
8
9
9
10
### Use Case: MUST - A dynamic MPI correctness checker
10
11
11
-
TypeART is used in conjunction with MUST \[[MU13](#ref-must-2013)\] to track memory (de-)allocation relevant to MPI communication.
12
-
Thus, MUST can check for type compatibility between the type-less communication buffer and the declared MPI datatype at all phases of the MPI communication, namely message assembly, message transfer and message disassembly into the receiving buffer.
13
-
A brief summary is given in a subsequent section and more information can be found in our publication:
12
+
TypeART is used in conjunction with MUST \[[MU13](#ref-must-2013)\] to track memory (de-)allocation relevant to MPI
13
+
communication. Thus, MUST can check for type compatibility between the type-less communication buffer and the declared
14
+
MPI datatype at all phases of the MPI communication, namely message assembly, message transfer and message disassembly
15
+
into the receiving buffer. A brief summary is given in a subsequent section and more information can be found in our
16
+
publication:
14
17
15
18
#### References
16
19
@@ -23,6 +26,14 @@ A brief summary is given in a subsequent section and more information can be fou
23
26
In <i>2nd International Workshop on Software Correctness for HPC Applications (Correctness)</i>,
1. Compile and instrument the target code with our LLVM passes, and,
61
-
2. execute the target program with a runtime library (based on the TypeART runtime) to accept the callbacks from the instrumented code and actually do some useful analysis.
94
+
1. Compile and instrument the target code with our LLVM passes, and,
95
+
2. execute the target program with a runtime library (based on the TypeART runtime) to accept the callbacks from the
96
+
instrumented code and actually do some useful analysis.
62
97
63
-
To that end, the interface [RuntimeInterface.h](runtime/RuntimeInterface.h) can be used to query type information during the target code execution.
98
+
To that end, the interface [RuntimeInterface.h](runtime/RuntimeInterface.h) can be used to query type information during
99
+
the target code execution.
64
100
65
101
#### Example: MPI Demo
66
102
67
-
The folder [demo](demo) contains an example of MPI related type errors that can be detected using TypeART.
68
-
The code is compiled with our instrumentation, and executed by preloading the MPI related check library implemented in [tool.c](demo/tool.c), which is linked against the TypeART runtime and uses the aforementioned query interface.
69
-
It overloads the required MPI calls and checks that the passed `void* buffer` is correct.
103
+
The folder [demo](demo) contains an example of MPI related type errors that can be detected using TypeART. The code is
104
+
compiled with our instrumentation, and executed by preloading the MPI related check library implemented
105
+
in [tool.c](demo/tool.c), which is linked against the TypeART runtime and uses the aforementioned query interface. It
106
+
overloads the required MPI calls and checks that the passed `void* buffer` is correct.
70
107
71
108
## LLVM pass
72
109
73
-
The necessary allocation sites and type information are extracted in LLVM passes.
74
-
TypeART analyzes:
110
+
The necessary allocation sites and type information are extracted in LLVM passes. TypeART analyzes:
75
111
76
112
- Calls to ```malloc``` and ```free``` to keep track of active pointers referring to objects allocated on the heap,
77
-
- relevant stack space allocations, i.e., allocations that cannot be proven to never lead to ```MPI``` functions,
113
+
- relevant stack space allocations, i.e., allocations that cannot be proven to never lead to ```MPI``` functions,
78
114
- built-in as well as user-defined types to retrieve type size and the size of the allocation, e.g., for arrays.
79
115
80
-
The type information is necessary to correlate the type of the buffer passed to an MPI call with the MPI datatype the user declared.
81
-
In this prototype we restrict ourselves to:
116
+
The type information is necessary to correlate the type of the buffer passed to an MPI call with the MPI datatype the
117
+
user declared. In this prototype we restrict ourselves to:
To instrument relevant allocations and extract the necessary type information, the LLVM pass searches for specific patterns, e.g., how calls to ```malloc``` look like in LLVM IR.
90
-
Calls to the ```malloc``` function are typically call instructions followed by a ```bitcast``` instruction to cast the returned pointer to the desired type.
125
+
To instrument relevant allocations and extract the necessary type information, the LLVM pass searches for specific
126
+
patterns, e.g., how calls to ```malloc``` look like in LLVM IR. Calls to the ```malloc``` function are typically call
127
+
instructions followed by a ```bitcast``` instruction to cast the returned pointer to the desired type.
91
128
92
129
~~~{.ll}
93
130
; %0 == n * sizeof(float)
94
131
%1 = tail call i8* @malloc(i64 %0)
95
132
%2 = bitcast i8* %1 to float *
96
133
~~~
97
134
98
-
The patterns has all the information we require for our instrumentation.
99
-
Our transformation first detects the type that the returned pointer is casted to, then it computes the extent of the allocation.
100
-
The information is passed to our instrumentation function.
135
+
The patterns has all the information we require for our instrumentation. Our transformation first detects the type that
136
+
the returned pointer is casted to, then it computes the extent of the allocation. The information is passed to our
0 commit comments