This is an archive of the discontinued LLVM Phabricator instance.

[GPGPU] Collect parameter dimension used in MemoryAccesses
ClosedPublic

Authored by grosser on Aug 19 2017, 4:08 AM.

Details

Summary

When using -polly-ignore-integer-wrapping and -polly-acc-codegen-managed-memory
we add parameter dimensions lazily to the domains, which results in PPCG not
including parameter dimensions that are only used in memory accesses in the
kernel space. To make sure these parameters are still passed to the kernel, we
collect these parameter dimensions and align the kernel's parameter space
before code-generating it.

Event Timeline

grosser created this revision.Aug 19 2017, 4:08 AM
bollu requested changes to this revision.Aug 19 2017, 5:26 AM

I would like to discuss the isl::space ParamSpace issue before LGTM'ing this patch.

include/polly/CodeGen/IslNodeBuilder.h
47

Please see the comment about using isl::space * here to broadcast the fact that this is an optional member of the struct.

lib/CodeGen/IslNodeBuilder.cpp
231–237

Nit: Change the auto to MemoryAccess? It would not be obvious to someone who does not work on Polly that a statement iterator gives MemoryAccess.

306

We abuse the fact that nullptr operations just propagate nullptr in ISL. I'm trying to think of neater ways to express this. I _really_ abusing nullptr this way since it is quite literally dependent on the ISL implementation.

For now, we can make it a isl::space * to express the fact that it a choice. Ideally, we could somehow split the different "visitors" so that ISLNodeBuilder would not use the parameter visitor but GPUNodeBuilder could.

test/GPGPU/memory-only-referenced-from-access.ll
50

Please remove the metadata which is not required.

This revision now requires changes to proceed.Aug 19 2017, 5:26 AM
grosser updated this revision to Diff 111816.Aug 19 2017, 5:47 AM
grosser edited edge metadata.
grosser marked an inline comment as done.

Address Siddharth's comments

bollu accepted this revision.Aug 19 2017, 5:54 AM

Thanks! Other than nits, LGTM.

include/polly/CodeGen/IslNodeBuilder.h
47

Could you add a comment here stating why this is obvious, and maybe a FIXME for a nicer design?

lib/CodeGen/PPCGCodeGeneration.cpp
1446

Unintended space?
LI, SE,

This revision is now accepted and ready to land.Aug 19 2017, 5:54 AM
grosser accepted this revision.Aug 19 2017, 6:01 AM

Committed in r311239. I forgot to add the phab URL, hence I close it manually.

lib/CodeGen/IslNodeBuilder.cpp
231–237

This is an unrelated change. I will do it ahead of the commit.

lib/CodeGen/PPCGCodeGeneration.cpp
1446

That's a clang-format artifact. Seems the formatting choice is not totally optimal here. I leave it as it is, as I see now way to work around it.

grosser closed this revision.Aug 23 2017, 12:47 AM