-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Some application variables in OpenMP outlined regions are marked artificial #107125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@llvm/issue-subscribers-debuginfo Author: Joachim (jprotze)
Debuggers use the artificial attribute to identify compiler generated variables. If the attribute is used consistently, the debugger can show application variables while hiding artificial variables. In outlined functions, clang marks all variables as artificial:
#include <omp.h>
#include <stdio.h>
int main(int argc, char **argv) {
const int n = 100 * argc;
double a[n], total=42., c = .3;
#pragma omp parallel for reduction(+ : total)
for (int i = 0; i < n; i++) {
total += a[i] = i * c;
}
printf("total=%lf, expected:%lf, a[50]=%lf\n", total, c * n * (n - 1) / 2, a[50]);
} compiled as: clang -g -fopenmp test-dwarf.c
llvm-dwarfdump provides this output:
|
I'm not an openmp expert but took a look; adding Could you elaborate on the use case for not marking these variables artificial (they have after all been transformed) -- i.e. is there a particular debugger that won't show you relevant information, that can't otherwise be recovered? (This'll clarify whether there are mismatched expectations or whether it's a bug). |
Putting a breakpoint to the body of the for-loop of my code example, gdb reports all local variables, including all compiler-generated variables:
For this small test case already a lot of variables are introduced and all are reported by gdb. Notably, gdb prints the thread-local value of Totalview by default does not show variables marked as artificial to allow focusing on the actual application variables. At the same breakpoint as above, Totalview only shows some of the function parameters (which are the only variables not marked as artificial):
The types don't match the application semantics and I think with the right dwarf information, the debugger should be able to display the right type (I'll create a separate issue for this). From a programmers perspective I'd like to be able to see the local values of the variables according to OpenMP semantics:
According to OpenMP semantics, @alexey-bataev suggested to file this issue and probably he can comment more from the perspective of the OpenMP codegen. |
Debuggers use the artificial attribute to identify compiler generated variables. If the attribute is used consistently, the debugger can show application variables while hiding artificial variables. In outlined functions, clang marks all variables as artificial:
compiled as:
provides this output:
i
is clearly a local variable and there is no argument for marking it artificial.total
is also an application variable and should not be marked artifical. Other variables likea
andc
are not marked artificial.The text was updated successfully, but these errors were encountered: