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

Addition of driver-level parallel looping pragma in SCCAnnotate is fragile #203

Open
skarppinen opened this issue Dec 21, 2023 · 0 comments

Comments

@skarppinen
Copy link
Contributor

skarppinen commented Dec 21, 2023

Hello, filing an issue by request of @reuterbal.

The issue is that in annotate_driver of SCCAnnotate, the following code is used to place the driver-level looping pragma (i.e "acc parallel loop gang vector_length(...)"):

if driver_loop.pragma is None or (len(driver_loop.pragma) == 1 and
driver_loop.pragma[0].keyword.lower() == "loki" and
driver_loop.pragma[0].content.lower() == "driver-loop"):
p_content = f'parallel loop gang{private_clause}{vector_length_clause}'
driver_loop._update(pragma=(ir.Pragma(keyword='acc', content=p_content),))
driver_loop._update(pragma_post=(ir.Pragma(keyword='acc', content='end parallel loop'),))
# add acc parallel loop gang if the only existing pragma is acc data
elif len(driver_loop.pragma) == 1:
if (driver_loop.pragma[0].keyword == 'acc' and
driver_loop.pragma[0].content.lower().lstrip().startswith('data ')):
p_content = f'parallel loop gang{private_clause}{vector_length_clause}'
driver_loop._update(pragma=(driver_loop.pragma[0], ir.Pragma(keyword='acc', content=p_content)))
driver_loop._update(pragma_post=(ir.Pragma(keyword='acc', content='end parallel loop'),
driver_loop.pragma_post[0]))

The condition of the IF statement can easily be missed. For example, I ran into this issue when I used the driver loop as a guide for adding two pragmas ($loki data and $loki update_host, for purposes of DataOffloadTransformation and GlobalVarOffloadTransformation) just above the driver loop. Consequently, these pragmas ended up in driver_loop.pragma, with len(driver_loop.pragma) != 1, and thus no parallel loop pragma appeared as a result of the SCC transformation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant