Skip to content

Commit 29a9098

Browse files
committed
Ariels changes as in email from 06/01/2016
1 parent 5306b73 commit 29a9098

10 files changed

+123
-35
lines changed

figures/ompd-structural-overview.docx

52.3 KB
Binary file not shown.

figures/ompd-structural-overview.pdf

495 KB
Binary file not shown.

ompd-tr.pdf

492 KB
Binary file not shown.

sec_breakpoints.tex

+26-15
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ \section{Breakpoint Locations for Managing Parallel Regions and Tasks}
99
launching parallel regions or tasks,
1010
%%%% OMPD provides a routine that the debugger can invoke to
1111
%%%% determine where to place breakpoints.
12-
the OpenMP runtime must define a number of routines in which
12+
the OpenMP runtime must define a number of symbols at which
1313
the debugger may plant breakpoints to receive notification of
1414
particular events.
15-
The runtime is expected to call these routines when these events occur
16-
\emph{and} data collection for OMPD is
15+
The runtime is expected to execute through these locations when
16+
these events occur \emph{and} data collection for OMPD is
1717
enabled (see~\S\ref{runtime-interface:sec}).
18+
These locations may, but do not have to, be subroutines
19+
(see~\S\ref{structural-overview:sec}).
1820

1921
\paragraph{Advice to implementors} The debugger needs to be able to detect
2022
the beginning of OpenMP runtime code.
@@ -72,12 +74,12 @@ \section{Breakpoint Locations for Managing Parallel Regions and Tasks}
7274

7375
\subsection{Parallel Regions}
7476

75-
The OpenMP runtime must call \texttt{ompd\_bp\_parallel\_begin}
76-
when a new parallel region is launched.
77-
The call should occur after a task encounters a parallel construct,
77+
The OpenMP runtime must execute through
78+
\texttt{ompd\_bp\_parallel\_begin} when a new parallel region is launched.
79+
This should occur after a task encounters a parallel construct,
7880
but before any implicit task starts to execute the parallel
7981
region's work.
80-
The type signature for \texttt{ompd\_bp\_parallel\_begin} is:
82+
Conceptually, the type signature for \texttt{ompd\_bp\_parallel\_begin} is:
8183
\begin{quote}
8284
\begin{lstlisting}
8385
void ompd_bp_parallel_begin ( void );
@@ -103,14 +105,18 @@ \subsection{Parallel Regions}
103105
will be that of the task encountering the parallel construct.
104106
The `reenter runtime' address in the information returned by
105107
\refdef{\texttt{ompd\_get\_task\_frame}}{get-task-frame:def}
106-
will be that of the stack frame where the thread entered the OpenMP
108+
will be that of the stack frame where the thread called the OpenMP
107109
runtime to handle the parallel construct.
108110
The `exit runtime' address will be for the stack frame where the thread
109111
left the OpenMP runtime to execute the user code that encountered
110112
the parallel construct.
111113

112-
When a parallel region finishes, the OpenMP runtime will call
113-
the \texttt{ompd\_bp\_parallel\_end} routine:
114+
When a parallel region finishes, the OpenMP runtime will cause
115+
control to flow through
116+
the location \texttt{ompd\_bp\_parallel\_end}.
117+
Conceptually, \texttt{ompd\_bp\_parallel\_end} has this type
118+
signature, but as with other event notification locations
119+
does not need to be a function:
114120
\begin{quote}
115121
\begin{lstlisting}
116122
void ompd_bp_parallel_end ( void );
@@ -128,7 +134,7 @@ \subsection{Parallel Regions}
128134
terminating.
129135
The `reenter runtime' address in the frame information returned by
130136
\refdef{\texttt{ompd\_get\_task\_frame}}{get-task-frame:def}
131-
will be that for the stack frame in which the thread entered the
137+
will be that for the stack frame in which the thread called the
132138
OpenMP runtime to start the parallel construct just terminating.
133139
The `exit runtime' address will refer to the stack frame where the
134140
thread left the OpenMP runtime to execute the user code that
@@ -237,14 +243,17 @@ \subsection{Parallel Regions}
237243
\subsection{Task Regions}
238244

239245
When starting a new task region, the OpenMP runtime system
240-
calls \texttt{ompd\_bp\_task\_begin}:
246+
must allow control to pass through \texttt{ompd\_bp\_task\_begin}.
247+
Conceptually, \texttt{ompd\_bp\_task\_end} has this type
248+
signature, but as with other event notification locations
249+
does not need to be a function:
241250
\begin{quote}
242251
\begin{lstlisting}
243252
void ompd_bp_task_begin ( void );
244253
\end{lstlisting}
245254
\end{quote}
246255
\labeldef{bp-task-begin:def}
247-
The OpenMP runtime system will call this routine after the task
256+
The OpenMP runtime system will execute through this location after the task
248257
construct is encountered, but before the new explicit task starts.
249258
When the breakpoint is triggered the debugger can map the operating
250259
thread to an OpenMP handle using
@@ -256,7 +265,9 @@ \subsection{Task Regions}
256265
\refdef{\texttt{ompd\_get\_task\_function}}{get-task-function:def}.
257266

258267
When a task region completes, the OpenMP runtime system
259-
calls the \texttt{ompd\_bp\_task\_end} function:
268+
executes through the location \texttt{ompd\_bp\_task\_end}.
269+
If it is implemented as a subroutine, \texttt{ompd\_bp\_task\_end}
270+
has this signature:
260271
\begin{quote}
261272
\begin{lstlisting}
262273
void ompd_bp_task_end ( void );
@@ -269,4 +280,4 @@ \subsection{Task Regions}
269280
OpenMP thread handle.
270281
At this point
271282
\refdef{\texttt{ompd\_get\_top\_task\_region}}{get-top-task-region:def}
272-
returns the handle for the terminating task.
283+
returns the handle for the terminating task.

sec_introduction.tex

+56
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,62 @@ \subsection{Design Objectives}
9393
This includes support for OpenMP state, call frame,
9494
task and parallel region information.
9595

96+
\subsection{Structural Overview}
97+
\label{structural-overview:sec}
98+
99+
Figure~\ref{ompd-structural-overview:fig} shows how the different components
100+
fit together.
101+
The debugger loads the OMPD plugin that matches the OpenMP runtime
102+
being used by the target.
103+
The plugin exports the API defined in this document, which the debugger
104+
uses to get OpenMP information about the target.
105+
The OMPD plugin will need to look up the symbols,
106+
or read data out of the target.
107+
It does not do this directly, but instead asks the debugger to perform
108+
these operations for it using a callback interface exported by the debugger.
109+
This callback interface is also defined in this document
110+
(see Section~\ref{sec:ompd_data_types}).
111+
112+
This architectural layout insulates the debugger from the details
113+
of the internal structure of the OpenMP runtime.
114+
Similarly, the OMPD plugin does not need to be concerned about
115+
how to access the target.
116+
Decoupling the plugin and debugger in this ways allows for
117+
great flexibility in how the target and tool are deployed,
118+
so that, for example, there is no requirement that debugger
119+
and target execute on the same machine.
120+
121+
Generally the debugger does not interact directly with the OpenMP
122+
runtime in the target, and instead uses the OMPD plugin for this purpose.
123+
However, there are a few instances where the debugger does need
124+
to access the OpenMP runtime directly.
125+
These cases fall into two broad categories.
126+
The first is during initialization, where the debugger needs
127+
to be able to look up symbols and read variables in OpenMP runtime
128+
in order to identify the OPMP plugin it should use.
129+
This is discussed in Section~\ref{runtime-interface:sec}.
130+
131+
The second category relates to arranging for the debugger to be notified
132+
when certain events occur during the execution of the OpenMP program.
133+
The model used for this purpose is that the OpenMP implementation
134+
is required to define certain symbols in the runtime code.
135+
Each of these symbols corresponds to an event type.
136+
The runtime must ensure that control passes through the appropriate
137+
named location when events occur.
138+
If the debugger wants to get notification of an event, it can plant
139+
a breakpoint at the matching location.
140+
141+
The code locations can, but do not need to, be functions.
142+
They can, for example, simply be labels.
143+
However, the names must have external \texttt{C} linkage.
144+
145+
\begin{figure}
146+
\centering
147+
\includegraphics[width=6.0in,natwidth=424.8,natheight=417.6]{figures/ompd-structural-overview.pdf}
148+
\caption{OMPD: Structural overview}
149+
\label{ompd-structural-overview:fig}
150+
\end{figure}
151+
96152

97153
\subsection{Design Scope}
98154
\label{design-scope:sec}

sec_memory_mgmt.tex

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ \section{Memory Management}
1010
If the OMPD DLL is implemented in \texttt{C++}, memory management operators
1111
like \texttt{new} and \texttt{delete} in all their variants, \emph{must all} be
1212
overloaded and implemented in terms of the callbacks provided by the debugger.
13+
The OMPD DLL must be coded so that any of its definitions of \texttt{new} or
14+
\texttt{delete} do not interfere with any defined by the debugger.
1315

1416
In some cases the OMPD DLL will need to allocate memory to
1517
return results to the debugger. This memory will then be `owned' by the
@@ -27,4 +29,4 @@ \section{Memory Management}
2729

2830
Contexts are created by the debugger and passed to the OMPD implementation.
2931
The OMPD DLL does not need to release contexts; instead this will be done by
30-
the debugger after it releases any handles that may be referencing the contexts.
32+
the debugger after it releases any handles that may be referencing the contexts.

sec_ompd_interface.tex

+7-4
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,15 @@ \subsection{Runtime States}
279279

280280
The OMPD runtime states mirror those in OMPT (see Appendix~A
281281
of~\cite{ompt-tr2}).
282+
Note that there is no guarantee that the numeric values of the
283+
corresponding members of the enumerations are identical.
282284

283285
\begin{quote}
284286
\begin{lstlisting}
285287
typedef enum {
286288
/* work states (0..15) */
287289
ompd_state_work_serial = 0x00, /* working outside parallel */
288-
ompd_state_work_paralle l = 0x01, /* working within parallel */
290+
ompd_state_work_parallel = 0x01, /* working within parallel */
289291
ompd_state_work_reduction = 0x02, /* performing a reduction */
290292

291293
/* idle (16..31) */
@@ -304,8 +306,9 @@ \subsection{Runtime States}
304306
ompd_state_wait_taskgroup = 0x51, /* waiting at a taskgroup */
305307

306308
/* mutex wait states (96..111) */
307-
ompd_state_wait_lock = 0x60, /* waiting for lock */
308-
ompd_state_wait_nest_lock = 0x61, /* waiting for nest lock */
309+
ompd_state_wait_mutex = 0x60, /* waiting for any mutex kind
310+
*/
311+
ompd_state_wait_lock = 0x61, /* waiting for lock */
309312
ompd_state_wait_critical = 0x62, /* waiting for critical */
310313
ompd_state_wait_atomic = 0x63, /* waiting for atomic */
311314
ompd_state_wait_ordered = 0x64, /* waiting for ordered */
@@ -596,4 +599,4 @@ \subsection{Type Signatures for Debugger Callbacks}
596599
const char *string
597600
);
598601
\end{lstlisting}
599-
\end{quote}
602+
\end{quote}

sec_runtime_interface.tex

+16-7
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,27 @@ \section{OpenMP Runtime Interface}
4747
by loading a 32-bit OMPD that can manage a 64-bit OpenMP runtime.
4848

4949
The OpenMP runtime shall notify the debugger that
50-
\texttt{ompd\_dll\_locations} is valid by calling:
50+
\texttt{ompd\_dll\_locations} is valid by allowing execution
51+
to pass through a location identified by the symbol
52+
\texttt{ompd\_dll\_locations\_valid}.
53+
This symbol must have external, \texttt{C}, linkage.
54+
55+
Conceptually, \texttt{ompd\_dll\_locations\_valid} has the following
56+
signature:
5157
\begin{quote}
5258
\begin{lstlisting}
5359
void ompd_dll_locations_valid ( void );
5460
\end{lstlisting}
5561
\end{quote}
5662
\labeldef{dll-locations-valid:def}
63+
However, as noted in Section~\ref{structural-overview:sec},
64+
the event notification location does not need to be a function,
65+
and can instead be a labeled location in the code.
5766

5867
\noindent
5968
The debugger can receive notification of this event by planting
60-
a breakpoint in this routine.
61-
\texttt{ompd\_dll\_locations\_valid()} has \texttt{C} linkage,
69+
a breakpoint at this location.
70+
\texttt{ompd\_dll\_locations\_valid} has \texttt{C} linkage,
6271
and the debugger will not apply name mangling before searching
6372
for this routine.
6473
In order to support debugging, the OpenMP runtime may need to collect
@@ -68,10 +77,10 @@ \section{OpenMP Runtime Interface}
6877
to support OMPD debugging if:
6978
\begin{enumerate}
7079
\item
71-
the environment variable \texttt{OMP\_OMPD} is set to \texttt{on}
80+
the environment variable \texttt{OMP\_DEBUG} is set to \texttt{on}
7281
\item
7382
the target calls the
74-
\texttt{void omp\_ompd\_enable~(~void~)}\labeldef{ompd-enable:def}
83+
\texttt{void omp\_debug\_enable~(~void~)}\labeldef{ompd-enable:def}
7584
function defined in the OpenMP runtime.
7685
This function may be called by the main executable, or any of the
7786
shared libraries the executable loads, and may be made in an
@@ -83,7 +92,7 @@ \section{OpenMP Runtime Interface}
8392
\textbf{Rationale:}
8493
In some cases it may not be possible to control a target's
8594
environment.
86-
\texttt{omp\_ompd\_enable} allows a target itself to turn on
95+
\texttt{omp\_debug\_enable} allows a target itself to turn on
8796
data collection for OMPD.
8897
Allowing the function to be called from an initializer allows
8998
the call to be positioned in an otherwise empty DLL that the
@@ -99,4 +108,4 @@ \section{OpenMP Runtime Interface}
99108
%% available to an OMPD plugin, including the following types of information:
100109
%% \verb|ompt_state_t|, \verb|ompt_wait_id_t|, and \verb|ompt_frame_t|
101110
%% data structures.
102-
%% \end{comment}
111+
%% \end{comment}

sec_runtime_req.tex

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ \section{OpenMP Runtime Requirements}
1414
\refdef{\texttt{ompd\_dll\_locations}}{dll-locations:def};
1515
\item
1616
The OpenMP must define
17-
\refdef{\texttt{ompd\_dll\_locations\_valid~()}}{dll-locations-valid:def}
18-
and call it once \texttt{ompd\_dll\_locations} is ready to be
19-
read by the debugger;
17+
\refdef{\texttt{ompd\_dll\_locations\_valid}}{dll-locations-valid:def}
18+
and ensure that control flows through it once
19+
\texttt{ompd\_dll\_locations} is ready to be read by the debugger;
2020
\item
2121
In order to support debugging, the OpenMP may need to collect and
2222
maintain information about a target's execution that, perhaps for
@@ -26,18 +26,18 @@ \section{OpenMP Runtime Requirements}
2626
necessary to support OMPD:
2727
\begin{enumerate}
2828
\item
29-
the environment variable \texttt{OMP\_OMPD} is set to \texttt{on};
29+
the environment variable \texttt{OMP\_DEBUG} is set to \texttt{on};
3030
\item
3131
the \emph{target} calls
32-
\refdef{\texttt{omp\_ompd\_enable~()}}{ompd-enable:def}
32+
\refdef{\texttt{omp\_debug\_enable~()}}{ompd-enable:def}
3333
\begin{notes}
3434
ilaguna: should OMPD support any of the previous mechanisms or both of
3535
them? From the text it's not clear.
3636
\end{notes}
3737
\end{enumerate}
3838
\item
39-
The OpenMP must define the following routines and call them at the
40-
times described in Section~\ref{breakpoint-locations:sec}:
39+
The OpenMP must define the following code symbols, and execute through
40+
them at the times described in Section~\ref{breakpoint-locations:sec}:
4141
\begin{description}
4242
\item [\texttt{ompd\_bp\_parallel\_begin}]
4343
\item [\texttt{ompd\_bp\_parallel\_end}]
@@ -93,4 +93,4 @@ \section{OpenMP Runtime Requirements}
9393
%% A debugger can set a breakpoint in \verb|ompt_enable_complete| to observe
9494
%%when a tool has been enabled or disabled.
9595
%% \end{comment}
96-
\clearpage
96+
\clearpage

sec_thread_inquiries.tex

+7
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,10 @@ \subsection{Thread State Inquiry Analogue}
8989
);
9090
\end{lstlisting}
9191
\end{quote}
92+
93+
The states are represented by values of the enumeration type
94+
\refdef{\texttt{ompd\_state\_t}}{state-t:def}.
95+
The symbolic names of the members of \texttt{ompd\_state\_t} should
96+
match those of the OMPT enumeration type \texttt{omp\_state\_e}.
97+
However, there is no guarantee that the numeric values of the corresponding
98+
symbolic constants are identical.

0 commit comments

Comments
 (0)