XCore target: disable vectorization

Robert Lytton robert at xmos.com
Tue Sep 10 07:25:17 PDT 2013


(subject moved to llvm-commits from cfe-commits http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130909/088308.html)

Hi Arnold,

I have looked into getting the xcore target to incorrectly run the slp vectorizer so that I can then 'fix it' but have had no success. Any thoughts?

Attached is the suggested patch to lib/Transforms/Vectorize/LoopVectorize.cpp ( & test/Transforms/LoopVectorize/xcore/no-vector-registers.ll)

However, I also need to commit additions to the xcore target viz: lib/Target/XCore/XCoreTargetTransformInfo.cpp et al.
1) should I make a xcore target commit first & separately?
2) what tests should I be considering for the XCoreTargetTransformInfo tests?

(I will further enharnce XCoreTargetTransformInfo in later commits)

Sorry for all the basic questions - still finding my way.
Thank you

Robert
________________________________________
From: Arnold Schwaighofer [aschwaighofer at apple.com]
Sent: 09 September 2013 19:19
To: Robert Lytton
Cc: Rafael Espíndola; Nadav Rotem; cfe-commits at cs.uiuc.edu
Subject: Re: XCore target: disable vectorization

On Sep 9, 2013, at 12:49 PM, Robert Lytton <robert at xmos.com> wrote:

> Hi Arnold,
>
> In my mind there seems to be two changes needed.

No, with the TTI change you only need an llvm change - no clang change. clang will add the slp/loop-vectorizer but once they execute and ask the target whether they should vectorize (“TTI->getNumberOfRegisters(true)”) these passes immediately give up.

>
> 1) llvm to check the number of vector registers - as per the direction of this thread.
> Will I also need something similar in BBVectorize? (see below).
> I need to create some tests for the changes - not so straight forward!


You would create a test in "test/Transforms/LoopVectorize/XCore” and “test/Transforms/SLPVectorize/XCore” with “opt -mtriple=XCore- ….” and make sure that you don’t vectorize code you normally would.

> When done, I'll post to llvm-commit and cc folk for comment.
>
> 2) clang not to set the '-vectorize-loops' & '-vectorize-slp' flags
> Thus the original patch (with corrected function name) would seem reasonable.
> If others agree, I will resubmit the changes.
>
You would not need this change.

> Robert
>
> --- a/lib/Transforms/Vectorize/BBVectorize.cpp
> +++ b/lib/Transforms/Vectorize/BBVectorize.cpp
> @@ -397,6 +397,12 @@ namespace {
>       DEBUG(if (TTI) dbgs() << "BBV: using target information\n");
>
>       bool changed = false;
> +
> +      // If the target claims to have no vector registers don't attempt
> +      // vectorization.
> +      if (TTI && !TTI->getNumberOfRegisters(true))
> +        return false;
> +
>       // Iterate a sufficient number of times to merge types of size 1 bit,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PatchVectorRegisters
Type: application/octet-stream
Size: 6191 bytes
Desc: PatchVectorRegisters
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130910/918b511d/attachment.obj>


More information about the llvm-commits mailing list