Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/812259/?format=api
{ "id": 812259, "url": "http://patchwork.ozlabs.org/api/1.2/patches/812259/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20170911090339.fa6en3twtabgrm73@virgil.suse.cz/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/1.2/projects/17/?format=api", "name": "GNU Compiler Collection", "link_name": "gcc", "list_id": "gcc-patches.gcc.gnu.org", "list_email": "gcc-patches@gcc.gnu.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170911090339.fa6en3twtabgrm73@virgil.suse.cz>", "list_archive_url": null, "date": "2017-09-11T09:03:39", "name": "[HSA,PR,82119] Make HSA resilient to side-effects of split_edge", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "802da56166b9aa60c42f5099b1bd06db54d18777", "submitter": { "id": 4351, "url": "http://patchwork.ozlabs.org/api/1.2/people/4351/?format=api", "name": "Martin Jambor", "email": "mjambor@suse.cz" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20170911090339.fa6en3twtabgrm73@virgil.suse.cz/mbox/", "series": [ { "id": 2461, "url": "http://patchwork.ozlabs.org/api/1.2/series/2461/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=2461", "date": "2017-09-11T09:03:39", "name": "[HSA,PR,82119] Make HSA resilient to side-effects of split_edge", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/2461/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/812259/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/812259/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<gcc-patches-return-461799-incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "mailing list gcc-patches@gcc.gnu.org" ], "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461799-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"F1Ku7nHk\"; dkim-atps=neutral", "sourceware.org; auth=none" ], "Received": [ "from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xrMRc73Zkz9s7G\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 11 Sep 2017 19:03:56 +1000 (AEST)", "(qmail 94835 invoked by alias); 11 Sep 2017 09:03:48 -0000", "(qmail 94743 invoked by uid 89); 11 Sep 2017 09:03:47 -0000", "from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tMon, 11 Sep 2017 09:03:45 +0000", "from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254])\tby\n\tmx1.suse.de (Postfix) with ESMTP id 290DAACAB\tfor\n\t<gcc-patches@gcc.gnu.org>; Mon, 11 Sep 2017 09:03:41 +0000 (UTC)" ], "DomainKey-Signature": "a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:subject:message-id:mime-version:content-type; q=dns; s=\n\tdefault; b=ub0IdEu6YJf/k0a/wtA2y7weMKRFfWnn5lwN/KpzHMakEQFp435Hp\n\tZFazZr6QbBF93p4I6d1xbRE6wIOQQi6ZuYzz9+rf4moQ3XCIoRv1992jEK2Mcf6U\n\ttOP07+uA3qIYz5yO152f4vkr3r6EeIS9f0mIyGwFomsY/+eQ0ZhMB0=", "DKIM-Signature": "v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:subject:message-id:mime-version:content-type; s=\n\tdefault; bh=hDdkZkCtHcqmTVF/667yPH7weis=; b=F1Ku7nHkirDG7Nalb4Za\n\thLexAOxEOfXSavRQgum31WmSfV+c35v3u9zQJKa21UEibHnZQaAkLi4WncLZincQ\n\tz75d4N+jCOtPiT1AdeGBcmuvKWNH+25+x+Dd2a+An99eMbiS8Isa7GjPwklnJlSL\n\tQLgegB7aapc48qoZKmB8IAU=", "Mailing-List": "contact gcc-patches-help@gcc.gnu.org; run by ezmlm", "Precedence": "bulk", "List-Id": "<gcc-patches.gcc.gnu.org>", "List-Unsubscribe": "<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>", "List-Archive": "<http://gcc.gnu.org/ml/gcc-patches/>", "List-Post": "<mailto:gcc-patches@gcc.gnu.org>", "List-Help": "<mailto:gcc-patches-help@gcc.gnu.org>", "Sender": "gcc-patches-owner@gcc.gnu.org", "X-Virus-Found": "No", "X-Spam-SWARE-Status": "No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=", "X-HELO": "mx1.suse.de", "Date": "Mon, 11 Sep 2017 11:03:39 +0200", "From": "Martin Jambor <mjambor@suse.cz>", "To": "GCC Patches <gcc-patches@gcc.gnu.org>", "Subject": "[HSA, PR 82119] Make HSA resilient to side-effects of split_edge", "Message-ID": "<20170911090339.fa6en3twtabgrm73@virgil.suse.cz>", "Mail-Followup-To": "GCC Patches <gcc-patches@gcc.gnu.org>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=utf-8", "Content-Disposition": "inline", "User-Agent": "NeoMutt/20170609 (1.8.3)", "X-IsSubscribed": "yes" }, "content": "Hi,\n\nin r251264 the code of split_edge was changed not to reallocate PHI\nvectors, but it reorders them along with the order of incoming edges\nto the BB. There are two places in the HSA BE where we call\nsplit_edge while iterating over PHI node arguments and those broke,\nresulting in a number of libgomp testsuite failures.\n\nFixed thusly. I have tested the patch on HSA capable APU and also did\nfull bootstrap and testing, I will commit in a few moments.\n\nMartin\n\n\n2017-09-11 Martin Jambor <mjambor@suse.cz>\n\n\tPR hsa/82119\n\t* hsa-gen.c (gen_hsa_phi_from_gimple_phi): Process ADDR_EXPRs in\n\targuments in advance.\n\t* hsa-regalloc.c (naive_process_phi): New parameter predecessors,\n\tuse it to find predecessor edges.\n\t(naive_outof_ssa): Collect vector of predecessors.\n---\n gcc/hsa-gen.c | 51 ++++++++++++++++++++++++++++++++++++++-------------\n gcc/hsa-regalloc.c | 14 +++++++++++---\n 2 files changed, 49 insertions(+), 16 deletions(-)", "diff": "diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c\nindex bd227626e83..6e054c0ce82 100644\n--- a/gcc/hsa-gen.c\n+++ b/gcc/hsa-gen.c\n@@ -5657,8 +5657,37 @@ gen_hsa_phi_from_gimple_phi (gimple *phi_stmt, hsa_bb *hbb)\n hphi = new hsa_insn_phi (count, dest);\n hphi->m_bb = hbb->m_bb;\n \n- tree lhs = gimple_phi_result (phi_stmt);\n+ auto_vec <tree, 8> aexprs;\n+ auto_vec <hsa_op_reg *, 8> aregs;\n+\n+ /* Calling split_edge when processing a PHI node messes up with the order of\n+ gimple phi node arguments (it moves the one associated with the edge to\n+ the end). We need to keep the order of edges and arguments of HSA phi\n+ node arguments consistent, so we do all required splitting as the first\n+ step, and in reverse order as to not be affected by the re-orderings. */\n+ for (unsigned j = count; j != 0; j--)\n+ {\n+ unsigned i = j - 1;\n+ tree op = gimple_phi_arg_def (phi_stmt, i);\n+ if (TREE_CODE (op) != ADDR_EXPR)\n+\tcontinue;\n \n+ edge e = gimple_phi_arg_edge (as_a <gphi *> (phi_stmt), i);\n+ hsa_bb *hbb_src = hsa_init_new_bb (split_edge (e));\n+ hsa_op_address *addr = gen_hsa_addr (TREE_OPERAND (op, 0),\n+\t\t\t\t\t hbb_src);\n+\n+ hsa_op_reg *dest\n+\t= new hsa_op_reg (hsa_get_segment_addr_type (BRIG_SEGMENT_FLAT));\n+ hsa_insn_basic *insn\n+\t= new hsa_insn_basic (2, BRIG_OPCODE_LDA, BRIG_TYPE_U64,\n+\t\t\t dest, addr);\n+ hbb_src->append_insn (insn);\n+ aexprs.safe_push (op);\n+ aregs.safe_push (dest);\n+ }\n+\n+ tree lhs = gimple_phi_result (phi_stmt);\n for (unsigned i = 0; i < count; i++)\n {\n tree op = gimple_phi_arg_def (phi_stmt, i);\n@@ -5684,18 +5713,14 @@ gen_hsa_phi_from_gimple_phi (gimple *phi_stmt, hsa_bb *hbb)\n \t }\n \t else if (TREE_CODE (op) == ADDR_EXPR)\n \t {\n-\t edge e = gimple_phi_arg_edge (as_a <gphi *> (phi_stmt), i);\n-\t hsa_bb *hbb_src = hsa_init_new_bb (split_edge (e));\n-\t hsa_op_address *addr = gen_hsa_addr (TREE_OPERAND (op, 0),\n-\t\t\t\t\t\t hbb_src);\n-\n-\t hsa_op_reg *dest\n-\t\t= new hsa_op_reg (hsa_get_segment_addr_type (BRIG_SEGMENT_FLAT));\n-\t hsa_insn_basic *insn\n-\t\t= new hsa_insn_basic (2, BRIG_OPCODE_LDA, BRIG_TYPE_U64,\n-\t\t\t\t dest, addr);\n-\t hbb_src->append_insn (insn);\n-\n+\t hsa_op_reg *dest = NULL;\n+\t for (unsigned a_idx = 0; a_idx < aexprs.length (); a_idx++)\n+\t\tif (aexprs[a_idx] == op)\n+\t\t {\n+\t\t dest = aregs[a_idx];\n+\t\t break;\n+\t\t }\n+\t gcc_assert (dest);\n \t hphi->set_op (i, dest);\n \t }\n \t else\ndiff --git a/gcc/hsa-regalloc.c b/gcc/hsa-regalloc.c\nindex 2a17254c3b2..7fc3a8afa3d 100644\n--- a/gcc/hsa-regalloc.c\n+++ b/gcc/hsa-regalloc.c\n@@ -42,7 +42,7 @@ along with GCC; see the file COPYING3. If not see\n /* Process a PHI node PHI of basic block BB as a part of naive out-f-ssa. */\n \n static void\n-naive_process_phi (hsa_insn_phi *phi)\n+naive_process_phi (hsa_insn_phi *phi, const vec<edge> &predecessors)\n {\n unsigned count = phi->operand_count ();\n for (unsigned i = 0; i < count; i++)\n@@ -55,7 +55,7 @@ naive_process_phi (hsa_insn_phi *phi)\n if (!op)\n \tbreak;\n \n- e = EDGE_PRED (phi->m_bb, i);\n+ e = predecessors[i];\n if (single_succ_p (e->src))\n \thbb = hsa_bb_for_bb (e->src);\n else\n@@ -89,10 +89,18 @@ naive_outof_ssa (void)\n hsa_bb *hbb = hsa_bb_for_bb (bb);\n hsa_insn_phi *phi;\n \n+ /* naive_process_phi can call split_edge on an incoming edge which order if\n+ the incoming edges to the basic block and thus make it inconsistent with\n+ the ordering of PHI arguments, so we collect them in advance. */\n+ auto_vec<edge, 8> predecessors;\n+ unsigned pred_count = EDGE_COUNT (bb->preds);\n+ for (unsigned i = 0; i < pred_count; i++)\n+ predecessors.safe_push (EDGE_PRED (bb, i));\n+\n for (phi = hbb->m_first_phi;\n \t phi;\n \t phi = phi->m_next ? as_a <hsa_insn_phi *> (phi->m_next) : NULL)\n- naive_process_phi (phi);\n+ naive_process_phi (phi, predecessors);\n \n /* Zap PHI nodes, they will be deallocated when everything else will. */\n hbb->m_first_phi = NULL;\n", "prefixes": [ "HSA", "PR", "82119" ] }