[llvm-commits] dependence analysis (of multi dimensional arrays)
David Tweed
david.tweed at arm.com
Tue Sep 25 05:14:59 PDT 2012
A general comment: Obviously there's two stages
1. extracting "independence" information implicit in C like languages,
eg, that an expression is actually a well-behaved multidimensional index
2. figuring out what further, possibly platform specific,
optimizations to do once you've got an "independent" representation
Naturally there's a lot of interest in dealing with existing+new codes
written in C-type languages, but there's also compiling from other languages
where the semantics already assures many of these properties. It would be
helpful if there was a semi-stable LLVM-IR+metadata representation that
systems for those languages could output directly. (I'm thinking of things
like being able to state directly that loop interchange doesn't affect the
semantics, as inference of this fact may well fail in some moderately
complex cases, particularly if the "high-level" compiler does aggressive
"array re-use".)
Regards,
David
From: llvm-commits-bounces at cs.uiuc.edu
[mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Preston Briggs
Sent: 25 September 2012 04:24
To: Sebastian Pop
Cc: Tobias Grosser; llvm-commits at cs.uiuc.edu
Subject: Re: [llvm-commits] dependence analysis (of multi dimensional
arrays)
I think we should do two things:
1. We should write code to automatically delinearize where ever
possible, and
2. We should change the IR (extend the GEP instruction) so that Clang
doesn't have to linearize all multi-dimensional array references.
I think we need (1) because much existing code is already linearized. I
think we need (2) because delinearization isn't able to handle all
subscripts and we'll lose information. In particular, delinearization can't
handle couple subscripts (I believe), things like:
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
A[i][j] = ...
... = A[j][i];
}
}
Of course, we can begin with delinearization, extending the GEP later. My
thought would be to build delinearization into the dependence analyzer,
using it to attack MIV subscripts only.
I'll reread Maslov (Wolfe's book also discusses the topic in Section 7.2.4)
and see if I can get back up to speed.
To extend the GEP, it seems like we need to provide 2 fields for every
dimension: size and subscript, where size is loop invariant.
Preston
On Mon, Sep 24, 2012 at 2:15 PM, Sebastian Pop <spop at codeaurora.org> wrote:
> Hi Preston,
>
> +// In addition, the implementation depends on the GEP instruction to
> +// differentiate subscripts. Unfortunately, since Clang linearizes
subscripts
> +// for most arrays, this will be inadequate. We trust that the GEP
instruction
> +// will eventually be extended.
> +//
> +// In the meantime, we should explore Maslov's ideas about
delinearization.
>
> I haven't had the chance to discuss with you about the linearized
> multi-dimensional
> array problem, and Tobias Grosser was also interested to know your point
of view
> on reconstructing the higher level representation based on the linear
form.
>
> Could you please provide more details on what should be done to address
this
> problem in LLVM or Clang?
>
> Thanks,
> Sebastian
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> hosted by The Linux Foundation
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120925/cf4291c2/attachment.html>
More information about the llvm-commits
mailing list