Skip to content
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

Incorrect outlining for C++ OpenMP code #144

Open
ouankou opened this issue Jan 3, 2023 · 1 comment
Open

Incorrect outlining for C++ OpenMP code #144

ouankou opened this issue Jan 3, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@ouankou
Copy link
Contributor

ouankou commented Jan 3, 2023

Given the input:

#pragma omp target parallel for 
for (int i = 0; i < n; ++i)
    y[i] += a * x[i];

If it's in a C file, the kernel is OK. Variable a is rewritten as *ap__ and used correctly.

__global__ void OUT__1__7822__axpy_omp__48__kernel__(long *np__,double *ap__,double *_dev_x,double *_dev_y) {
...
for (i = _dev_lower; ((long )i) <= _dev_upper; i += 1) {
        _dev_y[i] +=  *ap__ * _dev_x[I];    // *ap__ is used. Correct. 
      }
}

However, if the same OpenMP code is in a C++ file. The generated kernel would be:

__global__ void OUT__1__7822__axpy_omp__48__kernel__(long *np__,double *ap__,double *_dev_x,double *_dev_y) {
...
for (i = _dev_lower; ((long )i) <= _dev_upper; i += 1) {
        _dev_y[i] +=  ap__ * _dev_x[i];    // ap__ is used. Incorrect.
      }
}

Please notice that ap__ is used as a pointer without dereferencing.

I've checked the lowering and outlining modules. So far, no C++-specific handler has been found.

@ouankou ouankou added the bug Something isn't working label Jan 3, 2023
@yanyh15
Copy link
Member

yanyh15 commented Jan 5, 2023

You can use the outline tutorial to isolate the outline problem, for example:

rexompiler-build/tutorial/outliner$ ./outlineTutorial -rose:outline:enable_debug -rose:outline:enable_classic -rose:outline:line "12" -c /home/yyan7/compiler/rexompiler/tutorial/outliner/inputCode_OutlineLoop2.c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants