From patchwork Fri Nov 16 16:28:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 999063 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-490300-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="H5kOlDvx"; dkim-atps=neutral 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 42xNx816yYz9sBN for ; Sat, 17 Nov 2018 03:29:47 +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:subject:date:message-id:in-reply-to:references:mime-version :content-type; q=dns; s=default; b=EmDrmEzNh2rku3rgKFqYbAysrXIw8 vroZ8LMPEs699co0LYdjvkw/8XIFFLEFt9T1VGZvMO5v3gbSUs6nodPS+BYV0JF0 Sgtv4dwp5fdRbQ6wv1YnkSzjMd5VQ1o3BfXhQmhQlJiwDVNRL71SHlVTa6kJpw22 72M0x8zYCRNUS0= 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:subject:date:message-id:in-reply-to:references:mime-version :content-type; s=default; bh=9SOkmZ3QQUvun3L5UjW1eeubbDs=; b=H5k OlDvxcXNT9pJ/9xIan9r1Tt0CnbgU5V5tgHmBB5XiZ6un87FHKM716zWbVpsvrMI Kx7hE8XrenoOUySRRmXnWOTQzI3UGvcv1yKLqBvlIRxHUhzIDr8M9cJrsSIp7Fv/ sxS2bOwb8alyRJvau4PFcq3AinrI9AMgpIn9+P2c= Received: (qmail 53733 invoked by alias); 16 Nov 2018 16:28:48 -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 53600 invoked by uid 89); 16 Nov 2018 16:28:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=dlopen 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; Fri, 16 Nov 2018 16:28:40 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-03.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1gNgz0-0001G6-Tq from Andrew_Stubbs@mentor.com for gcc-patches@gcc.gnu.org; Fri, 16 Nov 2018 08:28:38 -0800 Received: from build6-trusty-cs.sje.mentorg.com (137.202.0.90) by SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Fri, 16 Nov 2018 16:28:35 +0000 From: Andrew Stubbs To: Subject: [PATCH 06/10] GCN back-end config Date: Fri, 16 Nov 2018 16:28:19 +0000 Message-ID: <30e5af6bb22bdb4ac2bd7617e8d91b72ad765e98.1542381960.git.ams@codesourcery.com> In-Reply-To: References: MIME-Version: 1.0 This patch contains the configuration adjustments needed to enable the GCN back-end. The new configure check for dlopen is required to allow building the new gcn-run tool. This tool uses libdl to load the HSA runtime libraries, which are required to run programs on the GPU. The tool is disabled if libdl is not available. 2018-11-16 Andrew Stubbs Kwok Cheung Yeung Julian Brown Tom de Vries Jan Hubicka Martin Jambor * config.sub: Recognize amdgcn*-*-amdhsa. * configure.ac: Likewise. * configure: Regenerate. * contrib/config-list.mk: Add amdgcn-amdhsa. gcc/ * config.gcc: Add amdgcn*-*-amdhsa configuration. * configure.ac: Check for dlopen. * configure: Regenerate. --- config.sub | 9 +++++++ configure | 2 ++ configure.ac | 2 ++ contrib/config-list.mk | 1 + gcc/config.gcc | 41 ++++++++++++++++++++++++++++++ gcc/configure | 68 ++++++++++++++++++++++++++++++++++++++++++++++++-- gcc/configure.ac | 8 ++++++ 7 files changed, 129 insertions(+), 2 deletions(-) diff --git a/config.sub b/config.sub index c95acc6..33115a5 100755 --- a/config.sub +++ b/config.sub @@ -572,6 +572,7 @@ case $basic_machine in | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ + | amdgcn \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv6m | armv[78][arm] \ | avr | avr32 \ @@ -909,6 +910,9 @@ case $basic_machine in fx2800) basic_machine=i860-alliant ;; + amdgcn) + basic_machine=amdgcn-unknown + ;; genix) basic_machine=ns32k-ns ;; @@ -1524,6 +1528,8 @@ case $os in ;; *-eabi) ;; + amdhsa) + ;; *) echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 @@ -1548,6 +1554,9 @@ case $basic_machine in spu-*) os=elf ;; + amdgcn-*) + os=-amdhsa + ;; *-acorn) os=riscix1.2 ;; diff --git a/configure b/configure index 480f4ae..e8a52a7 100755 --- a/configure +++ b/configure @@ -3645,6 +3645,8 @@ case "${target}" in noconfigdirs="$noconfigdirs ld gas gdb gprof" noconfigdirs="$noconfigdirs sim target-rda" ;; + amdgcn*-*-*) + ;; arm-*-darwin*) noconfigdirs="$noconfigdirs ld gas gdb gprof" noconfigdirs="$noconfigdirs sim target-rda" diff --git a/configure.ac b/configure.ac index b841c99..87e0bbd 100644 --- a/configure.ac +++ b/configure.ac @@ -934,6 +934,8 @@ case "${target}" in noconfigdirs="$noconfigdirs ld gas gdb gprof" noconfigdirs="$noconfigdirs sim target-rda" ;; + amdgcn*-*-*) + ;; arm-*-darwin*) noconfigdirs="$noconfigdirs ld gas gdb gprof" noconfigdirs="$noconfigdirs sim target-rda" diff --git a/contrib/config-list.mk b/contrib/config-list.mk index cbb9e28b..de0226b 100644 --- a/contrib/config-list.mk +++ b/contrib/config-list.mk @@ -33,6 +33,7 @@ GCC_SRC_DIR=../../gcc LIST = aarch64-elf aarch64-linux-gnu aarch64-rtems \ alpha-linux-gnu alpha-netbsd alpha-openbsd \ alpha64-dec-vms alpha-dec-vms \ + amdgcn-amdhsa \ arc-elf32OPT-with-cpu=arc600 arc-elf32OPT-with-cpu=arc700 \ arc-linux-uclibcOPT-with-cpu=arc700 arceb-linux-uclibcOPT-with-cpu=arc700 \ arm-wrs-vxworks arm-netbsdelf \ diff --git a/gcc/config.gcc b/gcc/config.gcc index 8525cb5..62a9915 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -325,6 +325,10 @@ alpha*-*-*) cpu_type=alpha extra_options="${extra_options} g.opt" ;; +amdgcn*) + cpu_type=gcn + use_gcc_stdint=wrap + ;; am33_2.0-*-linux*) cpu_type=mn10300 ;; @@ -1406,6 +1410,25 @@ ft32-*-elf) tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}" tmake_file="${tmake_file} ft32/t-ft32" ;; +amdgcn-*-amdhsa) + tm_file="elfos.h gcn/gcn-hsa.h gcn/gcn.h newlib-stdint.h" + tmake_file="gcn/t-gcn-hsa" + native_system_header_dir=/include + extra_modes=gcn/gcn-modes.def + extra_objs="${extra_objs} gcn-tree.o" + extra_gcc_objs="driver-gcn.o" + case "$host" in + x86_64*-*-linux-gnu ) + if test "$ac_cv_search_dlopen" != no; then + extra_programs="${extra_programs} gcn-run\$(exeext)" + fi + ;; + esac + if test x$enable_as_accelerator = xyes; then + extra_programs="${extra_programs} mkoffload\$(exeext)" + tm_file="${tm_file} gcn/offload.h" + fi + ;; moxie-*-elf) gas=yes gnu_ld=yes @@ -4127,6 +4150,24 @@ case "${target}" in esac ;; + amdgcn-*-*) + supported_defaults="arch tune" + + for which in arch tune; do + eval "val=\$with_$which" + case ${val} in + "" | carrizo | fiji | gfx900 ) + # OK + ;; + *) + echo "Unknown cpu used in --with-$which=$val." 1>&2 + exit 1 + ;; + esac + done + [ "x$with_arch" = x ] && with_arch=fiji + ;; + hppa*-*-*) supported_defaults="arch schedule" diff --git a/gcc/configure b/gcc/configure index 8957362..e0eef63 100755 --- a/gcc/configure +++ b/gcc/configure @@ -781,6 +781,7 @@ manext LIBICONV_DEP LTLIBICONV LIBICONV +DL_LIB LDEXP_LIB EXTRA_GCC_LIBS GNAT_LIBEXC @@ -9725,6 +9726,69 @@ LDEXP_LIB="$LIBS" LIBS="$save_LIBS" +# Some systems need dlopen +save_LIBS="$LIBS" +LIBS= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 +$as_echo_n "checking for library containing dlopen... " >&6; } +if ${ac_cv_search_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +for ac_lib in '' dl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_search_dlopen=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_dlopen+:} false; then : + break +fi +done +if ${ac_cv_search_dlopen+:} false; then : + +else + ac_cv_search_dlopen=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 +$as_echo "$ac_cv_search_dlopen" >&6; } +ac_res=$ac_cv_search_dlopen +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +DL_LIB="$LIBS" +LIBS="$save_LIBS" + + # Use only if it exists, # doesn't clash with , declares intmax_t and defines # PRId64 @@ -18572,7 +18636,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18575 "configure" +#line 18639 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -18678,7 +18742,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18681 "configure" +#line 18745 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/gcc/configure.ac b/gcc/configure.ac index 260d987..1d631c2 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1228,6 +1228,14 @@ LDEXP_LIB="$LIBS" LIBS="$save_LIBS" AC_SUBST(LDEXP_LIB) +# Some systems need dlopen +save_LIBS="$LIBS" +LIBS= +AC_SEARCH_LIBS(dlopen, dl) +DL_LIB="$LIBS" +LIBS="$save_LIBS" +AC_SUBST(DL_LIB) + # Use only if it exists, # doesn't clash with , declares intmax_t and defines # PRId64