[PATCH 7/8] [BRIGFE] phsa-specific optimizations
Pekka Jääskeläinen
pekka@parmance.com
Fri May 4 19:44:00 GMT 2018
Committed as r259957.
On Fri, May 4, 2018 at 5:02 PM, Pekka Jääskeläinen <pekka@parmance.com> wrote:
> Add flag -fassume-phsa that is on by default. If -fno-assume-phsa
> is given, these optimizations are disabled.
>
> With this flag, gccbrig can generate GENERIC that assumes we are
> targeting a phsa-runtime based implementation, which allows us
> to expose the work-item context accesses to retrieve WI IDs etc.
> which helps optimizers.
>
> First optimization that takes advantage of this is to get rid of
> the setworkitemid calls whenever we have non-inlined calls that
> use IDs internally.
>
> Other optimizations added in this commit:
>
> - expand absoluteid to similar level of simplicity as workitemid.
> At the moment absoluteid is the best indexing ID to end up with
> WG vectorization.
> - propagate ID variables closer to their uses. This is mainly
> to avoid known useless casts, which confuse at least scalar
> evolution analysis.
> - use signed long long for storing IDs. Unsigned integers have
> defined wraparound semantics, which confuse at least scalar
> evolution analysis, leading to unvectorizable WI loops.
> - also refactor some BRIG function generation helpers to brig_function.
> - no point in having the wi-loop as a for-loop. It's really
> a do...while and SCEV can analyze it just fine still.
> - add consts to ptrs etc. in BRIG builtin defs.
> Improves optimization opportunities.
> - add qualifiers to generated function parameters.
> Const and restrict on the hidden local/private pointers,
> the arg buffer and the context pointer help some optimizations.
> ---
> gcc/brig-builtins.def | 27 +-
> gcc/brig/brigfrontend/brig-basic-inst-handler.cc | 172 +---
> gcc/brig/brigfrontend/brig-branch-inst-handler.cc | 21 +-
> gcc/brig/brigfrontend/brig-cmp-inst-handler.cc | 6 +-
> gcc/brig/brigfrontend/brig-code-entry-handler.cc | 503 +----------
> gcc/brig/brigfrontend/brig-code-entry-handler.h | 21 -
> gcc/brig/brigfrontend/brig-control-handler.cc | 20 +-
> gcc/brig/brigfrontend/brig-cvt-inst-handler.cc | 6 +
> gcc/brig/brigfrontend/brig-function-handler.cc | 89 +-
> gcc/brig/brigfrontend/brig-function.cc | 925
> +++++++++++++++++++--
> gcc/brig/brigfrontend/brig-function.h | 43 +
> gcc/brig/brigfrontend/brig-label-handler.cc | 3 +
> gcc/brig/brigfrontend/brig-lane-inst-handler.cc | 2 +-
> gcc/brig/brigfrontend/brig-mem-inst-handler.cc | 7 +-
> gcc/brig/brigfrontend/phsa.h | 9 +
> gcc/brig/lang.opt | 5 +
> gcc/builtin-types.def | 4 +
> gcc/testsuite/brig.dg/test/gimple/smoke_test.hsail | 10 +-
> libhsail-rt/include/internal/phsa-rt.h | 1 -
> libhsail-rt/include/internal/workitems.h | 50 +-
> libhsail-rt/rt/workitems.c | 84 +-
> 21 files changed, 1195 insertions(+), 813 deletions(-)
>
More information about the Gcc-patches
mailing list