From patchwork Mon Dec 22 11:48:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 423367 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 255F714007D for ; Mon, 22 Dec 2014 22:48:33 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; q=dns; s=default; b=ulhAM1ZNlm5XtY4U Gl4uznv2HHLQ5YWviEdNn+xpw+EX8oVxsog5HvaiZMF+miNNm5mD2HQO5Kkb+i7Z QOJWk17Uwex/4+Rwt7TFGUrgb/f5KU9/wH7PxOJeFiFPt1yUVBtFv9dUFqYFfMme JfHkCei+VuTx8KzwsZR70949hEM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=default; bh=A2w/7KBzebJIlCOZjHcvO9 LKdpU=; b=iZcediNCLHtyxIG+9ZpPnhTdKPb9k1+01lNLJcM8MCFFKVAxS3iEOj mpdaId2xvDo0E+LYm6BjkilGuJJBY79tc1Wfu/t6uRNYe1JhZcXYaRMB4Msaaaas /UV8gCzh+Ln+TR/jMSbZWXCVvFXbZxL1d1Z+gakEDp+M2SIWX7W6k= Received: (qmail 24592 invoked by alias); 22 Dec 2014 11:48:24 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 24582 invoked by uid 89); 22 Dec 2014 11:48:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 22 Dec 2014 11:48:19 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1Y31TD-0002Nb-66 from Thomas_Schwinge@mentor.com ; Mon, 22 Dec 2014 03:48:15 -0800 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.181.6; Mon, 22 Dec 2014 11:48:13 +0000 From: Thomas Schwinge To: Ilya Verbin , Jakub Jelinek CC: Kirill Yukhin , Andrey Turetskiy , gcc Subject: Re: [PATCH 4/4] OpenMP 4.0 offloading to Intel MIC: non-fallback testing In-Reply-To: References: <20141021171323.GA47586@msticlxl57.ims.intel.com> <20141030114001.GA34120@msticlxl57.ims.intel.com> <87tx0t0yh5.fsf@kepler.schwinge.homeip.net> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) Date: Mon, 22 Dec 2014 12:48:08 +0100 Message-ID: <87oaqvzz0n.fsf@kepler.schwinge.homeip.net> MIME-Version: 1.0 Hi! On Thu, 18 Dec 2014 18:41:18 +0100, Ilya Verbin wrote: > 2014-12-18 16:27 GMT+01:00 Thomas Schwinge : > > On Thu, 30 Oct 2014 14:40:01 +0300, Ilya Verbin wrote: > >> This patch allows to run non-fallback 'make check-target-libgomp'. It passes to > >> the host compiler additional -B options with the paths to the offload compilers, > >> since non-installed host compiler doesn't know where to find mkoffload tools. > >> Also in case of intelmic offload targets it appends paths to liboffloadmic lib. > > > >> --- a/libgomp/configure.ac > >> +++ b/libgomp/configure.ac > >> @@ -280,9 +280,13 @@ else > >> multilib_arg= > >> fi > >> > >> +# Get accel target and path to install tree of accel compiler > >> +offload_additional_options= > >> +offload_additional_lib_paths= > >> offload_targets= > >> if test x"$enable_offload_targets" != x; then > >> for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do > >> + tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'` > >> tgt=`echo $tgt | sed 's/=.*//'` > >> case $tgt in > >> *-intelmic-* | *-intelmicemul-*) > >> @@ -295,10 +299,20 @@ if test x"$enable_offload_targets" != x; then > >> else > >> offload_targets=$offload_targets,$tgt_name > >> fi > >> + if test x"$tgt_dir" != x; then > >> + offload_additional_options="$offload_additional_options -B$tgt_dir/libexec/gcc/\$(target_alias)/\$(gcc_version) -B$tgt_dir/bin" > >> + offload_additional_lib_paths="$offload_additional_lib_paths:$tgt_dir/lib64:$tgt_dir/lib" > >> + else > >> + offload_additional_options="$offload_additional_options -B\$(libexecdir)/gcc/\$(target_alias)/\$(gcc_version) -B\$(bindir)" > >> + offload_additional_lib_paths="$offload_additional_lib_paths:$toolexeclibdir" > >> + fi > >> done > >> fi > > > > Hmm, maybe I'm seeing a problem where there isn't one, but in case I'm > > not: how will this work if there is more than one offloading compiler > > configured? Won't you get conflicting -B paths added to > > offload_additional_options in this case? > In this place I don't see any problems, at least for the case with > installed offloading compilers. > One -B allows to find mkoffload in lto-wrapper:compile_offload_image. > This function tries to open all paths + '/accel/target_name/mkoffload' > suffix. So, there should be no conflicts. > Another -B allows mkoffload to find target driver. It tries to open > 'host_name-accel-target_name-gcc', so, there also should be no > conflicts. Aha, thanks for the explanation, and yes, that seems all good. What is the reason for adding paths if $tgt_dir is empty? (I mean, if properly installed and $tgt_dir empty, this should just work, because that's what a user will be doing, so why does the libgomp testsuite have to do differently?) These paths will (basically) point to GCC's configured --prefix=[...] -- which may not actually match where the installed offloading compilers are to be found, for example, in the common case that DESTDIR is used with make install. And, isn't it that GCC by default will already be looking into "$prefix" installation directories, or is this solving an actual problem for you? If not, is it then OK to remove the cases for empty $tgt_dir? > However, I still did not tried to enable 'make check' with > non-installed offloading compilers. I'm working of that (with low priority, though). In my understanding, we'd like to support the modes that either all compilers are installed (which is what a user will be using), or all are tested from their build trees. Or, do we also have to support the mode that only the offloading compilers are installed, but the target (offloading host) compiler is not? (Doesn't make much sense to me.) Here is a patch to correctly match intelmic in $offload_targets; OK to commit, I assume? I suppose I'm the first one to ever do build-tree testing? (Jakub?) Grüße, Thomas --- libgomp/testsuite/lib/libgomp.exp +++ libgomp/testsuite/lib/libgomp.exp @@ -115,8 +115,7 @@ proc libgomp_init { args } { # Add liboffloadmic build directory in LD_LIBRARY_PATH to support # non-fallback testing for Intel MIC targets - if { [string match "*-intelmic-*" $offload_targets] - || [string match "*-intelmicemul-*" $offload_targets] } { + if { [string match "*,intelmic,*" ",$offload_targets,"] } { append always_ld_library_path ":${blddir}/../liboffloadmic/.libs" append always_ld_library_path ":${blddir}/../liboffloadmic/plugin/.libs" # libstdc++ is required by liboffloadmic Such things also need to be guarded to be done for build-tree testing only; I'll address this later on, where missing. Here is a patch to fix 32-bit x86 Intel MIC offloading; OK to commit, I assume? [...] spawn [...]/build-gcc/gcc/xgcc -B[...]/build-gcc/gcc/ [...]/source-gcc/libgomp/testsuite/libgomp.c/examples-4/e.50.1.c -B[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/ -B[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/.libs -I[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp -I[...]/source-gcc/libgomp/testsuite/.. -march=i486 -fmessage-length=0 -fno-diagnostics-show-caret -fdiagnostics-color=never -B[...]/install/offload-x86_64-intelmicemul-linux-gnu/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0 -B[...]/install/offload-x86_64-intelmicemul-linux-gnu/bin -fopenmp -O2 -L[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/.libs -lm -m32 -o ./e.50.1.exe PASS: libgomp.c/examples-4/e.50.1.c (test for excess errors) Setting LD_LIBRARY_PATH to .:[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/../liboffloadmic/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/../liboffloadmic/plugin/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/../libstdc++-v3/src/.libs:[...]/install/offload-x86_64-intelmicemul-linux-gnu/lib64:[...]/install/offload-x86_64-intelmicemul-linux-gnu/lib:[...]/build-gcc/gcc:[...]/build-gcc/gcc/32:.:[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/../liboffloadmic/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/../liboffloadmic/plugin/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/32/libgomp/../libstdc++-v3/src/.libs:[...]/install/offload-x86_64-intelmicemul-linux-gnu/lib64:[...]/install/offload-x86_64-intelmicemul-linux-gnu/lib:[...]/build-gcc/gcc:[...]/build-gcc/gcc/32:[...]/build-gcc/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/libsanitizer/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/libvtv/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/libcilkrts/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/liboffloadmic/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/libssp/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/libgomp/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/libitm/.libs:[...]/build-gcc/x86_64-unknown-linux-gnu/libatomic/.libs:[...]/build-gcc/./gcc:[...]/build-gcc/./prev-gcc spawn [open ...] /tmp/offload_WCXKRZ/offload_target_main: error while loading shared libraries: liboffloadmic_target.so.5: wrong ELF class: ELFCLASS64 WARNING: program timed out. FAIL: libgomp.c/examples-4/e.50.1.c execution test [...] (It is bad that testing is running into loooong timeouts for every single offloading test case, but I'm not addressing that with my patch.) This is a "standard" GCC configuration: x86_64-intelmicemul-linux-gnu with (default) multilibs enabled: $ find -name liboffloadmic_target.so.5 ./install/offload-x86_64-intelmicemul-linux-gnu/lib64/liboffloadmic_target.so.5 ./install/offload-x86_64-intelmicemul-linux-gnu/lib32/liboffloadmic_target.so.5 ./build-gcc-offload-x86_64-intelmicemul-linux-gnu/x86_64-intelmicemul-linux-gnu/32/liboffloadmic/.libs/liboffloadmic_target.so.5 ./build-gcc-offload-x86_64-intelmicemul-linux-gnu/x86_64-intelmicemul-linux-gnu/liboffloadmic/.libs/liboffloadmic_target.so.5 --- libgomp/configure.ac +++ libgomp/configure.ac @@ -304,7 +304,7 @@ if test x"$enable_offload_targets" != x; then fi if test x"$tgt_dir" != x; then offload_additional_options="$offload_additional_options -B$tgt_dir/libexec/gcc/\$(target_alias)/\$(gcc_version) -B$tgt_dir/bin" - offload_additional_lib_paths="$offload_additional_lib_paths:$tgt_dir/lib64:$tgt_dir/lib" + offload_additional_lib_paths="$offload_additional_lib_paths:$tgt_dir/lib64:$tgt_dir/lib:$tgt_dir/lib32" else offload_additional_options="$offload_additional_options -B\$(libexecdir)/gcc/\$(target_alias)/\$(gcc_version) -B\$(bindir)" offload_additional_lib_paths="$offload_additional_lib_paths:$toolexeclibdir"