Page MenuHomePhabricator

[Polly][Isl] Use the function unsignedFromIslSize to manage a isl::size object. NFCI
ClosedPublic

Authored by patacca on Wed, Nov 3, 6:26 AM.

Details

Summary

This is part of an effort to reduce the differences between the custom C++ bindings used right now by polly in lib/External/isl/include/isl/isl-noxceptions.h and the official isl C++ interface.
In the official interface the type isl::size cannot be casted to an unsigned without previously having checked if it contains a valid value with the function isl::size::is_error().
For this reason two helping functions have been added:

  • IslAssert: assert that no errors are present in debug builds and just disables the mandatory error check in non-debug builds
  • unisgnedFromIslSIze: cast the isl::size object to unsigned

Changes made:

  • Add the functions IslAssert and unsignedFromIslSize
  • Add the utility function rangeIslSize()
  • Retype MaxDisjunctsInDomain from int to unsigned
  • Retype RunTimeChecksMaxAccessDisjuncts from int to unsigned
  • Retype MaxDimensionsInAccessRange from int to unsigned
  • Replaced some usages of isl_size to unsigned since we aim not to use isl_size anymore
  • isl-noexceptions.h has been generated by https://github.com/patacca/isl/commit/e704f73c88f0b4d88e62e447bdb732cf5914094b

No functional change intended.

Diff Detail

Event Timeline

patacca created this revision.Wed, Nov 3, 6:26 AM
patacca updated this revision to Diff 384510.Wed, Nov 3, 10:25 AM

Fix code style

patacca published this revision for review.Wed, Nov 3, 12:08 PM
patacca retitled this revision from [Polly][Isl] Introduce unsignedFromIslSize and islAssert. NFCI to [Polly][Isl] Use the function unsignedFromIslSize to manage a isl::size object. NFCI.
patacca edited the summary of this revision. (Show Details)
patacca added a reviewer: Meinersbur.
patacca added a project: Restricted Project.
patacca edited the summary of this revision. (Show Details)
patacca added a subscriber: pollydev.
Herald added a project: Restricted Project. · View Herald TranscriptWed, Nov 3, 12:09 PM

I've tested it with the llvm test suite and it's showing 1 test failing but it's not related to this patch (MultiSource/Applications/lambda-0.1.3/lambda.test)

I added the IslAssert function with the idea that it might be useful but in the end we just use unsignedFromIslSize so tell me if you think it's better to remove it

bmahjour removed a subscriber: bmahjour.Wed, Nov 3, 12:19 PM

Nice one!

I've tested it with the llvm test suite and it's showing 1 test failing but it's not related to this patch (MultiSource/Applications/lambda-0.1.3/lambda.test)

I remember I fixed the lambda failure. The buildbot shows green (http://meinersbur.de:8011/#/builders/76/builds/1306). Have you tested with the latest version of LLVM/Polly?

polly/include/polly/Support/ISLTools.h
26

Suggestion for an explanation on why calling a getter disables error checking.

27

Although is_error it doesn't have a [[nodiscard]] attribute (yet), adding (void) marks that we are intentionally ignoring the result.

525–530

nice!

polly/lib/Analysis/ScopBuilder.cpp
201–202

The coding standard rule is to only use auto if the type already appears on the right. Since you are removing <isl_size>, auto should be replaced by the concrete type.

polly/lib/External/isl/include/isl/isl-noexceptions.h
201

unrelated change?

polly/lib/Transform/ScheduleTreeTransform.cpp
1188–1189
1189

[nit] Updating changed line to the latest coding standard.

patacca added a comment.EditedThu, Nov 4, 7:01 AM

I've tested it with the llvm test suite and it's showing 1 test failing but it's not related to this patch (MultiSource/Applications/lambda-0.1.3/lambda.test)

I remember I fixed the lambda failure. The buildbot shows green (http://meinersbur.de:8011/#/builders/76/builds/1306). Have you tested with the latest version of LLVM/Polly?

For some reason I cannot reach the link you posted. Anyway after I tested it again with a fresh new build of llvm-suite the error in the lambda test disappeared.

polly/lib/External/isl/include/isl/isl-noexceptions.h
201

This one was a leftover blank space that was removed in this commit https://github.com/patacca/isl/commit/e704f73c88f0b4d88e62e447bdb732cf5914094b
Since then nobody actually updated isl-noexceptions.h

patacca updated this revision to Diff 384741.Thu, Nov 4, 7:09 AM
  • Fix coding style (replace auto with unsigned)
  • Better explainatory comment for islAssert
  • Mark the result of intentionally discarded value with void casting
Meinersbur accepted this revision.Thu, Nov 4, 9:00 AM

LGTM, thanks for picking this up again.

polly/lib/External/isl/include/isl/isl-noexceptions.h
201

Seems that was me. Different editors have different understanding of whether \n is a line terminator (i.e. even the last line ends with \n) or line separator (i.e. no \n on last line). See https://en.wikipedia.org/wiki/Newline#Interpretation

This revision is now accepted and ready to land.Thu, Nov 4, 9:00 AM
foad added a subscriber: foad.Wed, Nov 10, 1:33 AM

Hi, this seems to have introduced a couple of warnings in my LLVM build (a release build with polly enabled, using clang 10 as the host compiler):

[3071/3609] Building CXX object tools/polly/lib/CMakeFiles/obj.Polly.dir/Support/ISLTools.cpp.o
/home/jayfoad2/git/llvm-project/polly/lib/Support/ISLTools.cpp:220:14: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
  assert(Pos < NumDims && "Dimension index must be in range");
         ~~~ ^ ~~~~~~~
/usr/include/assert.h:93:27: note: expanded from macro 'assert'
     (static_cast <bool> (expr)                                         \
                          ^~~~
/home/jayfoad2/git/llvm-project/polly/lib/Support/ISLTools.cpp:241:14: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
  assert(Pos < NumDims && "Dimension index must be in range");
         ~~~ ^ ~~~~~~~
/usr/include/assert.h:93:27: note: expanded from macro 'assert'
     (static_cast <bool> (expr)                                         \
                          ^~~~
2 warnings generated.