From patchwork Fri Oct 20 11:51:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 156081 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp996774vqb; Fri, 20 Oct 2023 04:51:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGfwJhZEXsA9GZtxxnxbt6v/F4Ag33oMGvmXLpbcfe8kGScKVp0BrUlVk2a6NF+pmj2ThhS X-Received: by 2002:ac8:7fc5:0:b0:418:fc1:1e9f with SMTP id b5-20020ac87fc5000000b004180fc11e9fmr1677076qtk.52.1697802700509; Fri, 20 Oct 2023 04:51:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697802700; cv=pass; d=google.com; s=arc-20160816; b=a/5IuqyFNybr7yjEpfE+gMi2UKODgORmwV3OECAQCEcs81ntf9U9rwb53OZEJFbj+F EmTxn8Cq0v3MUxbb0N4cHYaYM5uAdLXFkzmvvioC+DRIaAU1qBNMJ94AT7Yv/KQDkikU LlMDzXRKp898IxtI1/wmSef5nzXJL/RzF8E3pvWeqUfD4MFxZztXDiMcrPZRUmzfqRW0 Y3S09LmEQYgPprCxfzGjex1Usns0xz0Yc/jYpte+s7SX+uCZQetldeXREYcFTItU7uVM 1YZLpJg6Iw8dJ7HOloHbC7HMiC2Dw5HfZqJFWVyBEp4UFJG6agITMYK32bdXXTvKECEt 9mUA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:to:subject:from :content-language:user-agent:mime-version:date:message-id :ironport-sdr:arc-filter:dmarc-filter:delivered-to; bh=uGG703geBfqNzn0t0U7jzOLW7WmkLmLq3BfMN0Y4uug=; fh=XNn3asQvIblazGK92GBt13dVv+YmGV3pBS0JC29ZQco=; b=MsVHiSe/I8y9cvIPuhP+8Rc0VW1aEcevm+MPzAgB06nAGXXQy40CO7oLLjw/hPyVDM RqbgVQk4tFCuVZfP7QAqglsOZttcLd/iFPMDWPABClTBubTS9o4YrbJ8Ol522DA+YuKQ A3phsw7gvhf8fHgG+YzQ2YXnNpVbKoyVjiBDI8xP+XIomfKps/OK5t1i0a+B/JbjNdT8 5cmNDjeBQGGM9ixgsUR03Dj/+gP+kSuglDBnmQAZuEK7BNfiOPQjk3twxb/uMsEc9NRt 18Lg2FFWmK8k2ZXOmjkN1K7WDFfWa5OzIaN2AnX2cCIwIAs+oUGM63wghn5OtS1E24nm 6lKA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id g11-20020ac87d0b000000b00419ce76ad38si1137363qtb.76.2023.10.20.04.51.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 04:51:40 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4477B3858418 for ; Fri, 20 Oct 2023 11:51:40 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 192373858D20 for ; Fri, 20 Oct 2023 11:51:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 192373858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 192373858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.129.153 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697802674; cv=none; b=kJJP1PN7Mydu0DBaWVHbIZCMYUNwLBPALHkkO9RAgjnup2NCTdPUtwWoQvh1NyqTRqV+pY/Td6DL+tANolD8Ptf2opSIIX+Lt2L76Eg8DdrDFkLr1AX3UuEBLTHvT2ym5QvBhI8YXXqNXbOeOXtpmqCLaIb9JjyLqoaE/CEQwy4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697802674; c=relaxed/simple; bh=tCbvf+/9u4U6ktDO/bCa6lRI/cnXGGlqhrUi14YnNxI=; h=Message-ID:Date:MIME-Version:From:Subject:To; b=JAuTkOhqyWOCuEp8qVz22eVNHmz46e4I7noq8f8zRjWaPfgIS9R3wl5AUb5zE71ALXhW5k2DFWCQDI0aDzz2CEMiEVwEo6sem5XCERofULawUs8VA2+624c1I4mpMqUZpbaz99D5M0Z8Ot261brnO1iOfegeGJQwcA5Zr4LqNoA= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: eAkZ6IcDRwaZI45pVbW/EQ== X-CSE-MsgGUID: ztUL0PCeSMmTLL8kIUoVsg== X-IronPort-AV: E=Sophos;i="6.03,238,1694764800"; d="scan'208";a="22872336" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 20 Oct 2023 03:51:08 -0800 IronPort-SDR: raxiloHlFVU3LFJRB6HxKCUHv9HZ3kFCWdf+CoityzyXAg9l02Fw6EhaLPl5XQ4EQh7GKrMEiM 42VVScd13thjDvSVBQE7X3324V3ZWtywE9w4SQ7Wumra9bf2YRxKk//mE9HKXB3g9CGckWdck3 6vtFmL0HsfFDUV29a3iR6kszZL3VfpoGKR1LTGSLuApQeQArhfZP002NldGyNcylBUyZuPsOjs FBNk5wYPEyrOorcriMnZFiZi0KcnkrM0hv5VvfAiO0uK5LFpqRQVnWe2nlTiWfLT/+QISaFAVY Gf0= Message-ID: Date: Fri, 20 Oct 2023 12:51:03 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-GB From: Andrew Stubbs Subject: [committed] amdgcn: add -march=gfx1030 EXPERIMENTAL To: "gcc-patches@gcc.gnu.org" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) To svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780275164733110271 X-GMAIL-MSGID: 1780275164733110271 I've committed this patch that allows building binaries for AMD gfx1030 GPUs. I can't actually test it, however, so somebody else will have to debug it (or wait for me to get my hands on a device). Richi reports that it does not execute correctly, as is. This is an experimental broken feature, so the multilib is deliberatly not built in the default configuration, and not (yet) documented. If you want to try it you will also need to apply the attached Newlib patch. I shall submit that to the Newlib list shortly. Then configure the accelerator compiler as follows: --with-arch=gfx1030. Andrew amdgcn: remove unnecessary scalar cache flush The exit code isn't actually written via the scalar cache so the cache flush is not actually needed. amdgcn: add -march=gfx1030 EXPERIMENTAL Accept the architecture configure option and resolve build failures. This is enough to build binaries, but I've not got a device to test it on, so there are probably runtime issues to fix. The cache control instructions might be unsafe (or too conservative), and the kernel metadata might be off. Vector reductions will need to be reworked for RDNA2. In principle, it would be better to use wavefrontsize32 for this architecture, but that would mean switching everything to allow SImode masks, so wavefrontsize64 it is. The multilib is not included in the default configuration so either configure --with-arch=gfx1030 or include it in --with-multilib-list=gfx1030,.... The majority of this patch has no effect on other devices, but changing from using scalar writes for the exit value to vector writes means we don't need the scalar cache write-back instruction anywhere (which doesn't exist in RDNA2). gcc/ChangeLog: * config.gcc: Allow --with-arch=gfx1030. * config/gcn/gcn-hsa.h (NO_XNACK): gfx1030 does not support xnack. (ASM_SPEC): gfx1030 needs -mattr=+wavefrontsize64 set. * config/gcn/gcn-opts.h (enum processor_type): Add PROCESSOR_GFX1030. (TARGET_GFX1030): New. (TARGET_RDNA2): New. * config/gcn/gcn-valu.md (@dpp_move): Disable for RDNA2. (addc3): Add RDNA2 syntax variant. (subc3): Likewise. (2_exec): Add RDNA2 alternatives. (vec_cmpdi): Likewise. (vec_cmpdi): Likewise. (vec_cmpdi_exec): Likewise. (vec_cmpdi_exec): Likewise. (vec_cmpdi_dup): Likewise. (vec_cmpdi_dup_exec): Likewise. (reduc__scal_): Disable for RDNA2. (*_dpp_shr_): Likewise. (*plus_carry_dpp_shr_): Likewise. (*plus_carry_in_dpp_shr_): Likewise. * config/gcn/gcn.cc (gcn_option_override): Recognise gfx1030. (gcn_global_address_p): RDNA2 only allows smaller offsets. (gcn_addr_space_legitimate_address_p): Likewise. (gcn_omp_device_kind_arch_isa): Recognise gfx1030. (gcn_expand_epilogue): Use VGPRs instead of SGPRs. (output_file_start): Configure gfx1030. * config/gcn/gcn.h (TARGET_CPU_CPP_BUILTINS): Add __RDNA2__; (ASSEMBLER_DIALECT): New. * config/gcn/gcn.md (rdna): New define_attr. (enabled): Use "rdna" attribute. (gcn_return): Remove s_dcache_wb. (addcsi3_scalar): Add RDNA2 syntax variant. (addcsi3_scalar_zero): Likewise. (addptrdi3): Likewise. (mulsi3): v_mul_lo_i32 should be v_mul_lo_u32 on all ISA. (*memory_barrier): Add RDNA2 syntax variant. (atomic_load): Add RDNA2 cache control variants, and disable scalar atomics for RDNA2. (atomic_store): Likewise. (atomic_exchange): Likewise. * config/gcn/gcn.opt (gpu_type): Add gfx1030. * config/gcn/mkoffload.cc (EF_AMDGPU_MACH_AMDGCN_GFX1030): New. (main): Recognise -march=gfx1030. * config/gcn/t-omp-device: Add gfx1030 isa. libgcc/ChangeLog: * config/gcn/amdgcn_veclib.h (CDNA3_PLUS): Set false for __RDNA2__. libgomp/ChangeLog: * plugin/plugin-gcn.c (EF_AMDGPU_MACH_AMDGCN_GFX1030): New. (isa_hsa_name): Recognise gfx1030. (isa_code): Likewise. * team.c (defined): Remove s_endpgm. diff --git a/gcc/config.gcc b/gcc/config.gcc index 9c397156868..0782cbc6e91 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -4529,7 +4529,7 @@ case "${target}" in for which in arch tune; do eval "val=\$with_$which" case ${val} in - "" | fiji | gfx900 | gfx906 | gfx908 | gfx90a) + "" | fiji | gfx900 | gfx906 | gfx908 | gfx90a | gfx1030) # OK ;; *) diff --git a/gcc/config/gcn/gcn-hsa.h b/gcc/config/gcn/gcn-hsa.h index 0b5610bbcbe..aa1294cf48f 100644 --- a/gcc/config/gcn/gcn-hsa.h +++ b/gcc/config/gcn/gcn-hsa.h @@ -75,7 +75,7 @@ extern unsigned int gcn_local_sym_hash (const char *name); supported for gcn. */ #define GOMP_SELF_SPECS "" -#define NO_XNACK "!march=*:;march=fiji:;" +#define NO_XNACK "!march=*:;march=fiji:;march=gfx1030:;" #define NO_SRAM_ECC "!march=*:;march=fiji:;march=gfx900:;march=gfx906:;" /* In HSACOv4 no attribute setting means the binary supports "any" hardware @@ -92,6 +92,7 @@ extern unsigned int gcn_local_sym_hash (const char *name); "%{!march=*|march=fiji:--amdhsa-code-object-version=3} " \ "%{" NO_XNACK XNACKOPT "}" \ "%{" NO_SRAM_ECC SRAMOPT "} " \ + "%{march=gfx1030:-mattr=+wavefrontsize64} " \ "-filetype=obj" #define LINK_SPEC "--pie --export-dynamic" #define LIB_SPEC "-lc" diff --git a/gcc/config/gcn/gcn-opts.h b/gcc/config/gcn/gcn-opts.h index f780a7c17fe..b4f494d868c 100644 --- a/gcc/config/gcn/gcn-opts.h +++ b/gcc/config/gcn/gcn-opts.h @@ -24,7 +24,8 @@ enum processor_type PROCESSOR_VEGA10, // gfx900 PROCESSOR_VEGA20, // gfx906 PROCESSOR_GFX908, - PROCESSOR_GFX90a + PROCESSOR_GFX90a, + PROCESSOR_GFX1030 }; #define TARGET_FIJI (gcn_arch == PROCESSOR_FIJI) @@ -32,12 +33,14 @@ enum processor_type #define TARGET_VEGA20 (gcn_arch == PROCESSOR_VEGA20) #define TARGET_GFX908 (gcn_arch == PROCESSOR_GFX908) #define TARGET_GFX90a (gcn_arch == PROCESSOR_GFX90a) +#define TARGET_GFX1030 (gcn_arch == PROCESSOR_GFX1030) /* Set in gcn_option_override. */ extern enum gcn_isa { ISA_UNKNOWN, ISA_GCN3, ISA_GCN5, + ISA_RDNA2, ISA_CDNA1, ISA_CDNA2 } gcn_isa; @@ -50,6 +53,8 @@ extern enum gcn_isa { #define TARGET_CDNA1_PLUS (gcn_isa >= ISA_CDNA1) #define TARGET_CDNA2 (gcn_isa == ISA_CDNA2) #define TARGET_CDNA2_PLUS (gcn_isa >= ISA_CDNA2) +#define TARGET_RDNA2 (gcn_isa == ISA_RDNA2) + #define TARGET_M0_LDS_LIMIT (TARGET_GCN3) #define TARGET_PACKED_WORK_ITEMS (TARGET_CDNA2_PLUS) diff --git a/gcc/config/gcn/gcn-valu.md b/gcc/config/gcn/gcn-valu.md index 32b170e8522..c128c819c89 100644 --- a/gcc/config/gcn/gcn-valu.md +++ b/gcc/config/gcn/gcn-valu.md @@ -1412,7 +1412,7 @@ (define_insn "@dpp_move" [(match_operand:V_noHI 1 "register_operand" " v") (match_operand:SI 2 "const_int_operand" " n")] UNSPEC_MOV_DPP_SHR))] - "" + "!TARGET_RDNA2" { return gcn_expand_dpp_shr_insn (mode, "v_mov_b32", UNSPEC_MOV_DPP_SHR, INTVAL (operands[2])); @@ -1548,7 +1548,7 @@ (define_insn "addc3" (match_dup 1)) (match_dup 1))))] "" - "v_addc%^_u32\t%0, %4, %2, %1, %3" + "{v_addc%^_u32|v_add_co_ci_u32}\t%0, %4, %2, %1, %3" [(set_attr "type" "vop2,vop3b") (set_attr "length" "4,8")]) @@ -1613,10 +1613,10 @@ (define_insn "subc3" (match_dup 1))))] "" "@ - v_subb%^_u32\t%0, %4, %1, %2, %3 - v_subb%^_u32\t%0, %4, %1, %2, %3 - v_subbrev%^_u32\t%0, %4, %2, %1, %3 - v_subbrev%^_u32\t%0, %4, %2, %1, %3" + {v_subb%^_u32|v_sub_co_ci_u32}\t%0, %4, %1, %2, %3 + {v_subb%^_u32|v_sub_co_ci_u32}\t%0, %4, %1, %2, %3 + {v_subbrev%^_u32|v_subrev_co_ci_u32}\t%0, %4, %2, %1, %3 + {v_subbrev%^_u32|v_subrev_co_ci_u32}\t%0, %4, %2, %1, %3" [(set_attr "type" "vop2,vop3b,vop2,vop3b") (set_attr "length" "4,8,4,8")]) @@ -3667,11 +3667,11 @@ (define_insn_and_split "2_exec" ;; {{{ Vector comparison/merge (define_insn "vec_cmpdi" - [(set (match_operand:DI 0 "register_operand" "=cV,cV, e, e,Sg,Sg") + [(set (match_operand:DI 0 "register_operand" "=cV,cV, e, e,Sg,Sg, e, e") (match_operator:DI 1 "gcn_fp_compare_operator" - [(match_operand:V_noQI 2 "gcn_alu_operand" "vSv, B,vSv, B, v,vA") - (match_operand:V_noQI 3 "gcn_vop3_operand" " v, v, v, v,vA, v")])) - (clobber (match_scratch:DI 4 "= X, X, cV,cV, X, X"))] + [(match_operand:V_noQI 2 "gcn_alu_operand" "vSv, B,vSv, B, v,vA,vSv, B") + (match_operand:V_noQI 3 "gcn_vop3_operand" " v, v, v, v,vA, v, v, v")])) + (clobber (match_scratch:DI 4 "= X, X, cV,cV, X, X, X, X"))] "" "@ v_cmp%E1\tvcc, %2, %3 @@ -3679,9 +3679,12 @@ (define_insn "vec_cmpdi" v_cmpx%E1\tvcc, %2, %3 v_cmpx%E1\tvcc, %2, %3 v_cmp%E1\t%0, %2, %3 - v_cmp%E1\t%0, %2, %3" - [(set_attr "type" "vopc,vopc,vopc,vopc,vop3a,vop3a") - (set_attr "length" "4,8,4,8,8,8")]) + v_cmp%E1\t%0, %2, %3 + v_cmpx%E1\t%2, %3 + v_cmpx%E1\t%2, %3" + [(set_attr "type" "vopc,vopc,vopc,vopc,vop3a,vop3a,vopc,vopc") + (set_attr "length" "4,8,4,8,8,8,4,8") + (set_attr "rdna" "*,*,no,no,*,*,yes,yes")]) (define_expand "vec_cmpudi" [(match_operand:DI 0 "register_operand") @@ -3716,13 +3719,13 @@ (define_expand "vec_cmpdi" }) (define_insn "vec_cmpdi_exec" - [(set (match_operand:DI 0 "register_operand" "=cV,cV, e, e,Sg,Sg") + [(set (match_operand:DI 0 "register_operand" "=cV,cV, e, e,Sg,Sg, e, e") (and:DI (match_operator 1 "gcn_fp_compare_operator" - [(match_operand:V_noQI 2 "gcn_alu_operand" "vSv, B,vSv, B, v,vA") - (match_operand:V_noQI 3 "gcn_vop3_operand" " v, v, v, v,vA, v")]) - (match_operand:DI 4 "gcn_exec_reg_operand" " e, e, e, e, e, e"))) - (clobber (match_scratch:DI 5 "= X, X, cV,cV, X, X"))] + [(match_operand:V_noQI 2 "gcn_alu_operand" "vSv, B,vSv, B, v,vA,vSv, B") + (match_operand:V_noQI 3 "gcn_vop3_operand" " v, v, v, v,vA, v, v, v")]) + (match_operand:DI 4 "gcn_exec_reg_operand" " e, e, e, e, e, e, e, e"))) + (clobber (match_scratch:DI 5 "= X, X, cV,cV, X, X, X, X"))] "" "@ v_cmp%E1\tvcc, %2, %3 @@ -3730,9 +3733,12 @@ (define_insn "vec_cmpdi_exec" v_cmpx%E1\tvcc, %2, %3 v_cmpx%E1\tvcc, %2, %3 v_cmp%E1\t%0, %2, %3 - v_cmp%E1\t%0, %2, %3" - [(set_attr "type" "vopc,vopc,vopc,vopc,vop3a,vop3a") - (set_attr "length" "4,8,4,8,8,8")]) + v_cmp%E1\t%0, %2, %3 + v_cmpx%E1\t%2, %3 + v_cmpx%E1\t%2, %3" + [(set_attr "type" "vopc,vopc,vopc,vopc,vop3a,vop3a,vopc,vopc") + (set_attr "length" "4,8,4,8,8,8,4,8") + (set_attr "rdna" "*,*,no,no,*,*,yes,yes")]) (define_expand "vec_cmpudi_exec" [(match_operand:DI 0 "register_operand") @@ -3772,42 +3778,48 @@ (define_expand "vec_cmpdi_exec" }) (define_insn "vec_cmpdi_dup" - [(set (match_operand:DI 0 "register_operand" "=cV,cV, e,e,Sg") + [(set (match_operand:DI 0 "register_operand" "=cV,cV, e,e,Sg, e,e") (match_operator:DI 1 "gcn_fp_compare_operator" [(vec_duplicate:V_noQI (match_operand: 2 "gcn_alu_operand" - " Sv, B,Sv,B, A")) - (match_operand:V_noQI 3 "gcn_vop3_operand" " v, v, v,v, v")])) - (clobber (match_scratch:DI 4 "= X,X,cV,cV, X"))] + " Sv, B,Sv,B, A,Sv,B")) + (match_operand:V_noQI 3 "gcn_vop3_operand" " v, v, v,v, v, v,v")])) + (clobber (match_scratch:DI 4 "= X,X,cV,cV, X, X,X"))] "" "@ v_cmp%E1\tvcc, %2, %3 v_cmp%E1\tvcc, %2, %3 v_cmpx%E1\tvcc, %2, %3 v_cmpx%E1\tvcc, %2, %3 - v_cmp%E1\t%0, %2, %3" - [(set_attr "type" "vopc,vopc,vopc,vopc,vop3a") - (set_attr "length" "4,8,4,8,8")]) + v_cmp%E1\t%0, %2, %3 + v_cmpx%E1\t%2, %3 + v_cmpx%E1\t%2, %3" + [(set_attr "type" "vopc,vopc,vopc,vopc,vop3a,vopc,vopc") + (set_attr "length" "4,8,4,8,8,4,8") + (set_attr "rdna" "*,*,no,no,*,yes,yes")]) (define_insn "vec_cmpdi_dup_exec" - [(set (match_operand:DI 0 "register_operand" "=cV,cV, e,e,Sg") + [(set (match_operand:DI 0 "register_operand" "=cV,cV, e,e,Sg, e,e") (and:DI (match_operator 1 "gcn_fp_compare_operator" [(vec_duplicate:V_noQI (match_operand: 2 "gcn_alu_operand" - " Sv, B,Sv,B, A")) - (match_operand:V_noQI 3 "gcn_vop3_operand" " v, v, v,v, v")]) - (match_operand:DI 4 "gcn_exec_reg_operand" " e, e, e,e, e"))) - (clobber (match_scratch:DI 5 "= X,X,cV,cV, X"))] + " Sv, B,Sv,B, A,Sv,B")) + (match_operand:V_noQI 3 "gcn_vop3_operand" " v, v, v,v, v, v,v")]) + (match_operand:DI 4 "gcn_exec_reg_operand" " e, e, e,e, e, e,e"))) + (clobber (match_scratch:DI 5 "= X,X,cV,cV, X, X,X"))] "" "@ v_cmp%E1\tvcc, %2, %3 v_cmp%E1\tvcc, %2, %3 v_cmpx%E1\tvcc, %2, %3 v_cmpx%E1\tvcc, %2, %3 - v_cmp%E1\t%0, %2, %3" - [(set_attr "type" "vopc,vopc,vopc,vopc,vop3a") - (set_attr "length" "4,8,4,8,8")]) + v_cmp%E1\t%0, %2, %3 + v_cmpx%E1\t%2, %3 + v_cmpx%E1\t%2, %3" + [(set_attr "type" "vopc,vopc,vopc,vopc,vop3a,vopc,vopc") + (set_attr "length" "4,8,4,8,8,4,8") + (set_attr "rdna" "*,*,no,no,*,yes,yes")]) (define_expand "vcond_mask_di" [(parallel @@ -4176,7 +4188,7 @@ (define_expand "reduc__scal_" (unspec: [(match_operand:V_ALL 1 "register_operand")] REDUC_UNSPEC))] - "" + "!TARGET_RDNA2" { rtx tmp = gcn_expand_reduc_scalar (mode, operands[1], ); @@ -4229,7 +4241,8 @@ (define_insn "*_dpp_shr_" REDUC_UNSPEC))] ; GCN3 requires a carry out, GCN5 not "!(TARGET_GCN3 && SCALAR_INT_MODE_P (mode) - && == UNSPEC_PLUS_DPP_SHR)" + && == UNSPEC_PLUS_DPP_SHR) + && !TARGET_RDNA2" { return gcn_expand_dpp_shr_insn (mode, "", , INTVAL (operands[3])); @@ -4274,7 +4287,7 @@ (define_insn "*plus_carry_dpp_shr_" (match_operand:SI 3 "const_int_operand" "n")] UNSPEC_PLUS_CARRY_DPP_SHR)) (clobber (reg:DI VCC_REG))] - "" + "!TARGET_RDNA2" { return gcn_expand_dpp_shr_insn (mode, "v_add%^_u32", UNSPEC_PLUS_CARRY_DPP_SHR, @@ -4292,7 +4305,7 @@ (define_insn "*plus_carry_in_dpp_shr_" (match_operand:DI 4 "register_operand" "cV")] UNSPEC_PLUS_CARRY_IN_DPP_SHR)) (clobber (reg:DI VCC_REG))] - "" + "!TARGET_RDNA2" { return gcn_expand_dpp_shr_insn (mode, "v_addc%^_u32", UNSPEC_PLUS_CARRY_IN_DPP_SHR, diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc index ef3b6472a52..6f85f55803c 100644 --- a/gcc/config/gcn/gcn.cc +++ b/gcc/config/gcn/gcn.cc @@ -136,6 +136,7 @@ gcn_option_override (void) : gcn_arch == PROCESSOR_VEGA20 ? ISA_GCN5 : gcn_arch == PROCESSOR_GFX908 ? ISA_CDNA1 : gcn_arch == PROCESSOR_GFX90a ? ISA_CDNA2 + : gcn_arch == PROCESSOR_GFX1030 ? ISA_RDNA2 : ISA_UNKNOWN); gcc_assert (gcn_isa != ISA_UNKNOWN); @@ -1616,6 +1617,7 @@ gcn_global_address_p (rtx addr) { rtx base = XEXP (addr, 0); rtx offset = XEXP (addr, 1); + int offsetbits = (TARGET_RDNA2 ? 11 : 12); bool immediate_p = (CONST_INT_P (offset) && INTVAL (offset) >= -(1 << 12) && INTVAL (offset) < (1 << 12)); @@ -1748,10 +1750,11 @@ gcn_addr_space_legitimate_address_p (machine_mode mode, rtx x, bool strict, rtx base = XEXP (x, 0); rtx offset = XEXP (x, 1); + int offsetbits = (TARGET_RDNA2 ? 11 : 12); bool immediate_p = (GET_CODE (offset) == CONST_INT - /* Signed 13-bit immediate. */ - && INTVAL (offset) >= -(1 << 12) - && INTVAL (offset) < (1 << 12) + /* Signed 12/13-bit immediate. */ + && INTVAL (offset) >= -(1 << offsetbits) + && INTVAL (offset) < (1 << offsetbits) /* The low bits of the offset are ignored, even when they're meant to realign the pointer. */ && !(INTVAL (offset) & 0x3)); @@ -3029,6 +3032,8 @@ gcn_omp_device_kind_arch_isa (enum omp_device_kind_arch_isa trait, return gcn_arch == PROCESSOR_GFX908; if (strcmp (name, "gfx90a") == 0) return gcn_arch == PROCESSOR_GFX90a; + if (strcmp (name, "gfx1030") == 0) + return gcn_arch == PROCESSOR_GFX1030; return 0; default: gcc_unreachable (); @@ -3610,9 +3615,11 @@ gcn_expand_epilogue (void) set_mem_addr_space (retptr_mem, ADDR_SPACE_SCALAR_FLAT); emit_move_insn (kernarg_reg, retptr_mem); - rtx retval_mem = gen_rtx_MEM (SImode, kernarg_reg); - rtx scalar_retval = gen_rtx_REG (SImode, FIRST_PARM_REG); - set_mem_addr_space (retval_mem, ADDR_SPACE_SCALAR_FLAT); + rtx retval_addr = gen_rtx_REG (DImode, FIRST_VPARM_REG); + emit_move_insn (retval_addr, kernarg_reg); + rtx retval_mem = gen_rtx_MEM (SImode, retval_addr); + rtx scalar_retval = gen_rtx_REG (SImode, FIRST_VPARM_REG + 2); + set_mem_addr_space (retval_mem, ADDR_SPACE_FLAT); emit_move_insn (scalar_retval, gen_rtx_REG (SImode, RETURN_VALUE_REG)); emit_move_insn (retval_mem, scalar_retval); } @@ -6454,6 +6461,11 @@ output_file_start (void) case PROCESSOR_GFX90a: cpu = "gfx90a"; break; + case PROCESSOR_GFX1030: + cpu = "gfx1030"; + xnack = ""; + sram_ecc = ""; + break; default: gcc_unreachable (); } diff --git a/gcc/config/gcn/gcn.h b/gcc/config/gcn/gcn.h index 4ff9a5d4d12..6372f49d379 100644 --- a/gcc/config/gcn/gcn.h +++ b/gcc/config/gcn/gcn.h @@ -28,6 +28,8 @@ builtin_define ("__CDNA1__"); \ else if (TARGET_CDNA2) \ builtin_define ("__CDNA2__"); \ + else if (TARGET_RDNA2) \ + builtin_define ("__RDNA2__"); \ if (TARGET_FIJI) \ { \ builtin_define ("__fiji__"); \ @@ -43,6 +45,8 @@ builtin_define ("__gfx90a__"); \ } while (0) +#define ASSEMBLER_DIALECT (TARGET_RDNA2 ? 1 : 0) + /* Support for a compile-time default architecture and tuning. The rules are: --with-arch is ignored if -march is specified. diff --git a/gcc/config/gcn/gcn.md b/gcc/config/gcn/gcn.md index 30fe9e34a35..a3d8beefd6d 100644 --- a/gcc/config/gcn/gcn.md +++ b/gcc/config/gcn/gcn.md @@ -285,9 +285,16 @@ (define_attr "length" "" ; Disable alternatives that only apply to specific ISA variants. (define_attr "gcn_version" "gcn3,gcn5" (const_string "gcn3")) +(define_attr "rdna" "any,no,yes" (const_string "any")) (define_attr "enabled" "" - (cond [(eq_attr "gcn_version" "gcn3") (const_int 1) + (cond [(and (eq_attr "rdna" "no") + (ne (symbol_ref "TARGET_RDNA2") (const_int 0))) + (const_int 0) + (and (eq_attr "rdna" "yes") + (eq (symbol_ref "TARGET_RDNA2") (const_int 0))) + (const_int 0) + (eq_attr "gcn_version" "gcn3") (const_int 1) (and (eq_attr "gcn_version" "gcn5") (ne (symbol_ref "TARGET_GCN5_PLUS") (const_int 0))) (const_int 1)] @@ -812,7 +819,7 @@ (define_insn "gcn_return" if (cfun && cfun->machine && cfun->machine->normal_function) return "s_setpc_b64\ts[18:19]"; else - return "s_waitcnt\tlgkmcnt(0)\;s_dcache_wb\;s_endpgm"; + return "s_waitcnt\tlgkmcnt(0)\;s_endpgm"; } [(set_attr "type" "sop1") (set_attr "length" "12")]) @@ -1179,7 +1186,7 @@ (define_insn "addcsi3_scalar" "" "@ s_addc_u32\t%0, %1, %2 - v_addc%^_u32\t%0, vcc, %2, %1, vcc" + {v_addc%^_u32|v_add_co_ci_u32}\t%0, vcc, %2, %1, vcc" [(set_attr "type" "sop2,vop2") (set_attr "length" "8,4")]) @@ -1195,7 +1202,7 @@ (define_insn "addcsi3_scalar_zero" "" "@ s_addc_u32\t%0, %1, 0 - v_addc%^_u32\t%0, vcc, 0, %1, vcc" + {v_addc%^_u32|v_add_co_ci_u32}\t%0, vcc, 0, %1, vcc" [(set_attr "type" "sop2,vop2") (set_attr "length" "4")]) @@ -1225,7 +1232,8 @@ (define_insn "addptrdi3" gen_rtx_REG (DImode, CC_SAVE_REG) }; output_asm_insn ("v_add%^_u32\t%L0, %3, %L2, %L1", new_operands); - output_asm_insn ("v_addc%^_u32\t%H0, %3, %H2, %H1, %3", new_operands); + output_asm_insn ("{v_addc%^_u32|v_add_co_ci_u32}\t%H0, %3, %H2, %H1, %3", + new_operands); } else { @@ -1363,7 +1371,7 @@ (define_insn "mulsi3" s_mul_i32\t%0, %1, %2 s_mulk_i32\t%0, %2 s_mul_i32\t%0, %1, %2 - v_mul_lo_i32\t%0, %1, %2" + v_mul_lo_u32\t%0, %1, %2" [(set_attr "type" "sop2,sopk,sop2,vop3a") (set_attr "length" "4,4,8,4")]) @@ -1885,7 +1893,7 @@ (define_insn "*memory_barrier" [(set (match_operand:BLK 0) (unspec:BLK [(match_dup 0)] UNSPEC_MEMORY_BARRIER))] "" - "buffer_wbinvl1_vol" + "{buffer_wbinvl1_vol|buffer_gl0_inv}" [(set_attr "type" "mubuf") (set_attr "length" "4")]) @@ -2004,6 +2012,7 @@ (define_insn "atomic_load" (use (match_operand:SIDI 2 "immediate_operand" " i, i, i"))] "" { + /* FIXME: RDNA cache instructions may be too conservative? */ switch (INTVAL (operands[2])) { case MEMMODEL_RELAXED: @@ -2026,11 +2035,17 @@ (define_insn "atomic_load" return "s_load%o0\t%0, %A1 glc\;s_waitcnt\tlgkmcnt(0)\;" "s_dcache_wb_vol"; case 1: - return "flat_load%o0\t%0, %A1%O1 glc\;s_waitcnt\t0\;" - "buffer_wbinvl1_vol"; + return (TARGET_RDNA2 + ? "flat_load%o0\t%0, %A1%O1 glc\;s_waitcnt\t0\;" + "buffer_gl0_inv" + : "flat_load%o0\t%0, %A1%O1 glc\;s_waitcnt\t0\;" + "buffer_wbinvl1_vol"); case 2: - return "global_load%o0\t%0, %A1%O1 glc\;s_waitcnt\tvmcnt(0)\;" - "buffer_wbinvl1_vol"; + return (TARGET_RDNA2 + ? "global_load%o0\t%0, %A1%O1 glc\;s_waitcnt\tvmcnt(0)\;" + "buffer_gl0_inv" + : "global_load%o0\t%0, %A1%O1 glc\;s_waitcnt\tvmcnt(0)\;" + "buffer_wbinvl1_vol"); } break; case MEMMODEL_ACQ_REL: @@ -2042,11 +2057,17 @@ (define_insn "atomic_load" return "s_dcache_wb_vol\;s_load%o0\t%0, %A1 glc\;" "s_waitcnt\tlgkmcnt(0)\;s_dcache_inv_vol"; case 1: - return "buffer_wbinvl1_vol\;flat_load%o0\t%0, %A1%O1 glc\;" - "s_waitcnt\t0\;buffer_wbinvl1_vol"; + return (TARGET_RDNA2 + ? "buffer_gl0_inv\;flat_load%o0\t%0, %A1%O1 glc\;" + "s_waitcnt\t0\;buffer_gl0_inv" + : "buffer_wbinvl1_vol\;flat_load%o0\t%0, %A1%O1 glc\;" + "s_waitcnt\t0\;buffer_wbinvl1_vol"); case 2: - return "buffer_wbinvl1_vol\;global_load%o0\t%0, %A1%O1 glc\;" - "s_waitcnt\tvmcnt(0)\;buffer_wbinvl1_vol"; + return (TARGET_RDNA2 + ? "buffer_gl0_inv\;global_load%o0\t%0, %A1%O1 glc\;" + "s_waitcnt\tvmcnt(0)\;buffer_gl0_inv" + : "buffer_wbinvl1_vol\;global_load%o0\t%0, %A1%O1 glc\;" + "s_waitcnt\tvmcnt(0)\;buffer_wbinvl1_vol"); } break; } @@ -2054,7 +2075,8 @@ (define_insn "atomic_load" } [(set_attr "type" "smem,flat,flat") (set_attr "length" "20") - (set_attr "gcn_version" "gcn5,*,gcn5")]) + (set_attr "gcn_version" "gcn5,*,gcn5") + (set_attr "rdna" "no,*,*")]) (define_insn "atomic_store" [(set (match_operand:SIDI 0 "memory_operand" "=RS,RF,RM") @@ -2084,9 +2106,13 @@ (define_insn "atomic_store" case 0: return "s_dcache_wb_vol\;s_store%o1\t%1, %A0 glc"; case 1: - return "buffer_wbinvl1_vol\;flat_store%o1\t%A0, %1%O0 glc"; + return (TARGET_RDNA2 + ? "buffer_gl0_inv\;flat_store%o1\t%A0, %1%O0 glc" + : "buffer_wbinvl1_vol\;flat_store%o1\t%A0, %1%O0 glc"); case 2: - return "buffer_wbinvl1_vol\;global_store%o1\t%A0, %1%O0 glc"; + return (TARGET_RDNA2 + ? "buffer_gl0_inv\;global_store%o1\t%A0, %1%O0 glc" + : "buffer_wbinvl1_vol\;global_store%o1\t%A0, %1%O0 glc"); } break; case MEMMODEL_ACQ_REL: @@ -2098,11 +2124,17 @@ (define_insn "atomic_store" return "s_dcache_wb_vol\;s_store%o1\t%1, %A0 glc\;" "s_waitcnt\tlgkmcnt(0)\;s_dcache_inv_vol"; case 1: - return "buffer_wbinvl1_vol\;flat_store%o1\t%A0, %1%O0 glc\;" - "s_waitcnt\t0\;buffer_wbinvl1_vol"; + return (TARGET_RDNA2 + ? "buffer_gl0_inv\;flat_store%o1\t%A0, %1%O0 glc\;" + "s_waitcnt\t0\;buffer_gl0_inv" + : "buffer_wbinvl1_vol\;flat_store%o1\t%A0, %1%O0 glc\;" + "s_waitcnt\t0\;buffer_wbinvl1_vol"); case 2: - return "buffer_wbinvl1_vol\;global_store%o1\t%A0, %1%O0 glc\;" - "s_waitcnt\tvmcnt(0)\;buffer_wbinvl1_vol"; + return (TARGET_RDNA2 + ? "buffer_gl0_inv\;global_store%o1\t%A0, %1%O0 glc\;" + "s_waitcnt\tvmcnt(0)\;buffer_gl0_inv" + : "buffer_wbinvl1_vol\;global_store%o1\t%A0, %1%O0 glc\;" + "s_waitcnt\tvmcnt(0)\;buffer_wbinvl1_vol"); } break; } @@ -2110,7 +2142,8 @@ (define_insn "atomic_store" } [(set_attr "type" "smem,flat,flat") (set_attr "length" "20") - (set_attr "gcn_version" "gcn5,*,gcn5")]) + (set_attr "gcn_version" "gcn5,*,gcn5") + (set_attr "rdna" "no,*,*")]) (define_insn "atomic_exchange" [(set (match_operand:SIDI 0 "register_operand" "=Sm, v, v") @@ -2145,11 +2178,17 @@ (define_insn "atomic_exchange" return "s_atomic_swap\t%0, %1, %2 glc\;s_waitcnt\tlgkmcnt(0)\;" "s_dcache_wb_vol\;s_dcache_inv_vol"; case 1: - return "flat_atomic_swap\t%0, %1, %2 glc\;s_waitcnt\t0\;" - "buffer_wbinvl1_vol"; + return (TARGET_RDNA2 + ? "flat_atomic_swap\t%0, %1, %2 glc\;s_waitcnt\t0\;" + "buffer_gl0_inv" + : "flat_atomic_swap\t%0, %1, %2 glc\;s_waitcnt\t0\;" + "buffer_wbinvl1_vol"); case 2: - return "global_atomic_swap\t%0, %A1, %2%O1 glc\;" - "s_waitcnt\tvmcnt(0)\;buffer_wbinvl1_vol"; + return (TARGET_RDNA2 + ? "global_atomic_swap\t%0, %A1, %2%O1 glc\;" + "s_waitcnt\tvmcnt(0)\;buffer_gl0_inv" + : "global_atomic_swap\t%0, %A1, %2%O1 glc\;" + "s_waitcnt\tvmcnt(0)\;buffer_wbinvl1_vol"); } break; case MEMMODEL_RELEASE: @@ -2160,12 +2199,19 @@ (define_insn "atomic_exchange" return "s_dcache_wb_vol\;s_atomic_swap\t%0, %1, %2 glc\;" "s_waitcnt\tlgkmcnt(0)"; case 1: - return "buffer_wbinvl1_vol\;flat_atomic_swap\t%0, %1, %2 glc\;" - "s_waitcnt\t0"; + return (TARGET_RDNA2 + ? "buffer_gl0_inv\;flat_atomic_swap\t%0, %1, %2 glc\;" + "s_waitcnt\t0" + : "buffer_wbinvl1_vol\;flat_atomic_swap\t%0, %1, %2 glc\;" + "s_waitcnt\t0"); case 2: - return "buffer_wbinvl1_vol\;" - "global_atomic_swap\t%0, %A1, %2%O1 glc\;" - "s_waitcnt\tvmcnt(0)"; + return (TARGET_RDNA2 + ? "buffer_gl0_inv\;" + "global_atomic_swap\t%0, %A1, %2%O1 glc\;" + "s_waitcnt\tvmcnt(0)" + : "buffer_wbinvl1_vol\;" + "global_atomic_swap\t%0, %A1, %2%O1 glc\;" + "s_waitcnt\tvmcnt(0)"); } break; case MEMMODEL_ACQ_REL: @@ -2177,12 +2223,19 @@ (define_insn "atomic_exchange" return "s_dcache_wb_vol\;s_atomic_swap\t%0, %1, %2 glc\;" "s_waitcnt\tlgkmcnt(0)\;s_dcache_inv_vol"; case 1: - return "buffer_wbinvl1_vol\;flat_atomic_swap\t%0, %1, %2 glc\;" - "s_waitcnt\t0\;buffer_wbinvl1_vol"; + return (TARGET_RDNA2 + ? "buffer_gl0_inv\;flat_atomic_swap\t%0, %1, %2 glc\;" + "s_waitcnt\t0\;buffer_gl0_inv" + : "buffer_wbinvl1_vol\;flat_atomic_swap\t%0, %1, %2 glc\;" + "s_waitcnt\t0\;buffer_wbinvl1_vol"); case 2: - return "buffer_wbinvl1_vol\;" - "global_atomic_swap\t%0, %A1, %2%O1 glc\;" - "s_waitcnt\tvmcnt(0)\;buffer_wbinvl1_vol"; + return (TARGET_RDNA2 + ? "buffer_gl0_inv\;" + "global_atomic_swap\t%0, %A1, %2%O1 glc\;" + "s_waitcnt\tvmcnt(0)\;buffer_gl0_inv" + : "buffer_wbinvl1_vol\;" + "global_atomic_swap\t%0, %A1, %2%O1 glc\;" + "s_waitcnt\tvmcnt(0)\;buffer_wbinvl1_vol"); } break; } @@ -2190,7 +2243,8 @@ (define_insn "atomic_exchange" } [(set_attr "type" "smem,flat,flat") (set_attr "length" "20") - (set_attr "gcn_version" "gcn5,*,gcn5")]) + (set_attr "gcn_version" "gcn5,*,gcn5") + (set_attr "rdna" "no,*,*")]) ;; }}} ;; {{{ OpenACC / OpenMP diff --git a/gcc/config/gcn/gcn.opt b/gcc/config/gcn/gcn.opt index 36c2b535284..7a852c51c84 100644 --- a/gcc/config/gcn/gcn.opt +++ b/gcc/config/gcn/gcn.opt @@ -40,6 +40,9 @@ Enum(gpu_type) String(gfx908) Value(PROCESSOR_GFX908) EnumValue Enum(gpu_type) String(gfx90a) Value(PROCESSOR_GFX90a) +EnumValue +Enum(gpu_type) String(gfx1030) Value(PROCESSOR_GFX1030) + march= Target RejectNegative Joined ToLower Enum(gpu_type) Var(gcn_arch) Init(PROCESSOR_FIJI) Specify the name of the target GPU. diff --git a/gcc/config/gcn/mkoffload.cc b/gcc/config/gcn/mkoffload.cc index 8b608bf024e..f6d56b798e1 100644 --- a/gcc/config/gcn/mkoffload.cc +++ b/gcc/config/gcn/mkoffload.cc @@ -57,6 +57,8 @@ #define EF_AMDGPU_MACH_AMDGCN_GFX908 0x30 #undef EF_AMDGPU_MACH_AMDGCN_GFX90a #define EF_AMDGPU_MACH_AMDGCN_GFX90a 0x3f +#undef EF_AMDGPU_MACH_AMDGCN_GFX1030 +#define EF_AMDGPU_MACH_AMDGCN_GFX1030 0x36 #define EF_AMDGPU_FEATURE_XNACK_V4 0x300 /* Mask. */ #define EF_AMDGPU_FEATURE_XNACK_UNSUPPORTED_V4 0x000 @@ -942,6 +944,8 @@ main (int argc, char **argv) elf_arch = EF_AMDGPU_MACH_AMDGCN_GFX908; else if (strcmp (argv[i], "-march=gfx90a") == 0) elf_arch = EF_AMDGPU_MACH_AMDGCN_GFX90a; + else if (strcmp (argv[i], "-march=gfx1030") == 0) + elf_arch = EF_AMDGPU_MACH_AMDGCN_GFX1030; #define STR "-mstack-size=" else if (startswith (argv[i], STR)) gcn_stack_size = atoi (argv[i] + strlen (STR)); diff --git a/gcc/config/gcn/t-omp-device b/gcc/config/gcn/t-omp-device index 538624f7ec7..b1cd998a8b1 100644 --- a/gcc/config/gcn/t-omp-device +++ b/gcc/config/gcn/t-omp-device @@ -1,4 +1,4 @@ omp-device-properties-gcn: $(srcdir)/config/gcn/gcn.cc echo kind: gpu > $@ echo arch: amdgcn gcn >> $@ - echo isa: fiji gfx803 gfx900 gfx906 gfx908 gfx90a >> $@ + echo isa: fiji gfx803 gfx900 gfx906 gfx908 gfx90a gfx1030 >> $@ diff --git a/libgcc/config/gcn/amdgcn_veclib.h b/libgcc/config/gcn/amdgcn_veclib.h index 15ea20bcd55..88df5c7df91 100644 --- a/libgcc/config/gcn/amdgcn_veclib.h +++ b/libgcc/config/gcn/amdgcn_veclib.h @@ -229,7 +229,8 @@ do { \ #if defined (__GCN3__) || defined (__GCN5__) \ - || defined (__CDNA1__) || defined (__CDNA2__) + || defined (__CDNA1__) || defined (__CDNA2__) \ + || defined (__RDNA2__) #define CDNA3_PLUS 0 #else #define CDNA3_PLUS 1 diff --git a/libgomp/plugin/plugin-gcn.c b/libgomp/plugin/plugin-gcn.c index ef22d48da79..4328d3de14e 100644 --- a/libgomp/plugin/plugin-gcn.c +++ b/libgomp/plugin/plugin-gcn.c @@ -377,7 +377,8 @@ typedef enum { EF_AMDGPU_MACH_AMDGCN_GFX900 = 0x02c, EF_AMDGPU_MACH_AMDGCN_GFX906 = 0x02f, EF_AMDGPU_MACH_AMDGCN_GFX908 = 0x030, - EF_AMDGPU_MACH_AMDGCN_GFX90a = 0x03f + EF_AMDGPU_MACH_AMDGCN_GFX90a = 0x03f, + EF_AMDGPU_MACH_AMDGCN_GFX1030 = 0x036 } EF_AMDGPU_MACH; const static int EF_AMDGPU_MACH_MASK = 0x000000ff; @@ -1633,6 +1634,7 @@ const static char *gcn_gfx900_s = "gfx900"; const static char *gcn_gfx906_s = "gfx906"; const static char *gcn_gfx908_s = "gfx908"; const static char *gcn_gfx90a_s = "gfx90a"; +const static char *gcn_gfx1030_s = "gfx1030"; const static int gcn_isa_name_len = 6; /* Returns the name that the HSA runtime uses for the ISA or NULL if we do not @@ -1652,6 +1654,8 @@ isa_hsa_name (int isa) { return gcn_gfx908_s; case EF_AMDGPU_MACH_AMDGCN_GFX90a: return gcn_gfx90a_s; + case EF_AMDGPU_MACH_AMDGCN_GFX1030: + return gcn_gfx1030_s; } return NULL; } @@ -1691,6 +1695,9 @@ isa_code(const char *isa) { if (!strncmp (isa, gcn_gfx90a_s, gcn_isa_name_len)) return EF_AMDGPU_MACH_AMDGCN_GFX90a; + if (!strncmp (isa, gcn_gfx1030_s, gcn_isa_name_len)) + return EF_AMDGPU_MACH_AMDGCN_GFX1030; + return -1; } diff --git a/libgomp/team.c b/libgomp/team.c index b4fd6f2704c..0edc6e5bf28 100644 --- a/libgomp/team.c +++ b/libgomp/team.c @@ -253,8 +253,7 @@ gomp_free_pool_helper (void *thread_pool) #elif defined(__nvptx__) asm ("exit;"); #elif defined(__AMDGCN__) - asm ("s_dcache_wb\n\t" - "s_endpgm"); + asm ("s_endpgm"); #else #error gomp_free_pool_helper must terminate the thread #endif diff --git a/newlib/libc/machine/amdgcn/exit-value.h b/newlib/libc/machine/amdgcn/exit-value.h index 7aa2508bb..6b9d2411b 100644 --- a/newlib/libc/machine/amdgcn/exit-value.h +++ b/newlib/libc/machine/amdgcn/exit-value.h @@ -32,7 +32,6 @@ exit_with_int (int val) *return_value = val; /* Terminate the current kernel. */ - asm ("s_dcache_wb"); asm ("s_endpgm"); __builtin_unreachable (); }