cdl-saarland / rv

RV: A Unified Region Vectorizer for LLVM
Other
106 stars 16 forks source link

IsSupportedReduction error output #46

Closed mppf closed 4 years ago

mppf commented 4 years ago

The Chapel compiler is generating LLVM IR that, when optimized with RV, runs into the case here outputting to errs().

https://github.com/cdl-saarland/rv/blob/2a9b9541a606468bd9df5c87fb2e37ebb9e64f7c/src/transform/LoopVectorizer.cpp#L111-L123

Does this mean that there is something wrong with the LLVM IR being generated by the frontend (i.e. a correctness issue when optimized with RV)? Or is it a situation where RV figures out it cannot optimize this case and where extra debug output is present?

mppf commented 4 years ago

I observed this problem with a loop that had a loop carried dependency but that the frontend was hinting should be vectorized. I am working on getting the frontend not to hint vectorization in this case, but I'd still like to know the answer to the question.

mppf commented 4 years ago

I'll take this bit of README.md to answer my question:

Be aware that RV will exactly do as you annotated. Specifically, RV does not perform exhaustive legality checks nor is there cost modelling of any kind. You'll get what you ordered.

Meaning that there is a correctness issue.

simoll commented 4 years ago

There is an unsupported loop carried dependence in the IR. RV only supports certain kinds of loop carried dependencies and bails otherwise, as happens here for a use of a reduction value inside the loop that is being vectorized.

This is related to: https://github.com/cdl-saarland/rv/pull/43#issuecomment-633551303