[PATCH] Fix omp declare simd cloning (PR tree-optimization/60823)

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Thu May 15 12:37:00 GMT 2014


Jakub Jelinek <jakub@redhat.com> writes:

> On Tue, May 13, 2014 at 07:38:52PM +0200, Rainer Orth wrote:
>> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
>> 
>> > Jakub Jelinek <jakub@redhat.com> writes:
>> >
>> >> 2014-04-18  Jakub Jelinek  <jakub@redhat.com>
>> >>
>> >> 	PR tree-optimization/60823
>> >> 	* omp-low.c (ipa_simd_modify_function_body): Go through
>> >> 	all SSA_NAMEs and for those refering to vector arguments
>> >> 	which are going to be replaced adjust SSA_NAME_VAR and,
>> >> 	if it is a default definition, change it into a non-default
>> >> 	definition assigned at the beginning of function from new_decl.
>> >> 	(ipa_simd_modify_stmt_ops): Rewritten.
>> >> 	* tree-dfa.c (set_ssa_default_def): When removing default def,
>> >> 	check for NULL loc instead of NULL *loc.
>> >>
>> >> 	* c-c++-common/gomp/pr60823-1.c: New test.
>> >> 	* c-c++-common/gomp/pr60823-2.c: New test.
>> >> 	* c-c++-common/gomp/pr60823-3.c: New test.
>> >
>> > The second test FAILs on Solaris/x86 with Sun as:
>> >
>> > ld.so.1: pr60823-2.exe: fatal: pr60823-2.exe: hardware capability
>> > (CA_SUNW_HW_1) unsupported: 0x20000000 [ AVX ]
>> > FAIL: c-c++-common/gomp/pr60823-2.c execution test
>> >
>> > If this is expected, I can extend the code in gcc.target/i386/i386.exp
>> > (or rather move it to a new lib/clearcap.exp) to handle that via linker
>> > maps.
>> 
>> Something else seems to be amiss here: the new
>> libgomp.fortran/declare-simd-[12].f90 tests fail in just the same way,
>> although avx_runtime is false and they are only compiled with -msse2.
>
> If OpenMP declare simd doesn't work on Solaris/x86 (due to the bogus hw cap
> stuff), then supposedly vect_simd_clones effective target should fail there.

I don't think it's bogus: it guards against a similar kind of problems
as symbol versioning.  There, programs that depend on a missing
interface don't start to run instead of crashing in the middle of
execution when a function is missing.  With hwcap, programs depending on
insns not supported by the host don't even start running instead of
crashing later on.

Only if you start playing games with runtime selection of code based on
the host you're running on this gets you into trouble.  If this done
explicitly and you know what you are doing, you can still assemble with
-nH to suppress hwcaps, but if it happens implicitly, this is not an
option, at least not a user-friendly one.

> OpenMP declare simd results in cloning of the functions for SSE2, AVX and
> AVX2.

Ok, that's what I was missing.  ISTM that on Solaris with as/ld,
-fopenmp should trigger linking with a mapfile like the one currently
used in some places in the testsuite.  I envision turning this into a
general facility (-mclear-hwcap; -m is for target-specific options,
right?) which is automatically turned on by -fopenmp on Solaris.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University



More information about the Gcc-patches mailing list