From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id 59F453858D26 for ; Sat, 8 Jun 2024 19:50:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 59F453858D26 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 59F453858D26 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::635 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717876242; cv=none; b=XVbD/+WnQdAfdglC0yCFZ9HMmboTxOoWAA9SbtTtHjtwJZGjw2HCUojMMW7UT8Karep2OE2RadpaopRr9Scn92WF4m31KL0wT0mzVz1YQwpBPdM6jpmbSsRIz3viIrpdXdTG9hO7seHpY0GpnuxQq1dO6VppOkajmFe9aQ7HdZA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717876242; c=relaxed/simple; bh=q4KIPlB/OQ4kidFa9t/3BVE311aDGi132BAc0R9zE80=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=OsFr/M6HicR+5dtL9oB3K9/mCVYJBi8l6cQqVAfGXcQCHbzZNx6ld//plAR8X0+yu7aJN2zNWU/uV7v+jaaE+m5bPc58sGWKxyGD0bq+wlqZZuEqm5okom1qMON5/LrTxQs/6MUog/HbxHyuFCtiUqhaGII5DzlS+u2gjZJrdk0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1f6dfc17006so11145765ad.0 for ; Sat, 08 Jun 2024 12:50:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717876239; x=1718481039; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=trkuDfViDoTg4rHkJTHcVXZp3IfVhbWgT3Bgj+P4V7s=; b=DggXxPcejFBcvM/9XDjJQ2EUmK8lBquC+KOJdaOS6nRqjd6UnRIizlw3L4NkKf1RX2 6cHoOS0sLBRPOOmt5Xz8MF5ReGvSaop12usEdNrB4KtpYzPgEBMuggAmxCWZy/5ultux dY8uYdfyNt8PYM2nKCDhysuq0dcsRQyRItJq6WWXQ4dsU03qBPwGBka9YJ7O4HjTgvFm 5V9TZquaIvI8fJk8FKP+otmKbFH6yV1trMlXXJsdw6kP76uvNb1uLU/gY+WuH/OA/d4D eWSZHaZ/iSDDYEumNBXPh7QSefT2B9ZMEds6LLLyvHj5bbwhkG/dNfGS4GFq4gjK8+/q BeUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717876239; x=1718481039; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=trkuDfViDoTg4rHkJTHcVXZp3IfVhbWgT3Bgj+P4V7s=; b=N2Ff0P4+aQjHnKlP6h558NQHIOOSjoT6l+RqW2fT5oZazQPTkQxgSJqBYe2V1T9Kw6 ZXrKacNd/aNkrQtE7Qgd6Fv6MfMf40KYaqa+3QRKEO5f30f8NSIX6JUPTCpmPzxA4FWi lLSBy+OzZRtqaa8UcFk+D8VA+iCUYCIz2D4k2KEXP6dvbMA1AiOBh2TGUFFRDd3qXroH bLYtEXmi3sy/mDL2IC05YwOYYnCXtvZVj3Qzh1SfWL/bs13AkdSkNv8Xv798zgOE9xSU uCKnnxS/Typ3iEmsbvV4BQow6EVAf48BVps2PUilRANAj1P398vFpfWlPHMRkRHKQk2F xjzQ== X-Forwarded-Encrypted: i=1; AJvYcCWB1wkcYsQ8Txe7rxqhNokJft9QONP7Bi3xzEW+qIfPzMTB5BlNZHgVzYqm0jgO2Kuc3UjI5dYmuD4bCJoSPyATWmvQqRbAcg== X-Gm-Message-State: AOJu0Yy9Bmc13uDEaSmeR7633gJHl7WThxljomeM9DsvhHc0m2e0xDci zeGT1yt0YJbD6NZ7lClNhRu97cZo3IPObuo+gtMXi/QHsbR7XVCL X-Google-Smtp-Source: AGHT+IEjmWM0YsCM8VX421jLFgcf2dO0Of/YD+iWVDoz/x4K1RVV+xokS7BiVv7V/JAqYmn3eNUUIQ== X-Received: by 2002:a17:902:d2ca:b0:1f6:7f0c:6c3e with SMTP id d9443c01a7336-1f6d02d3acamr70548495ad.12.1717876239031; Sat, 08 Jun 2024 12:50:39 -0700 (PDT) Received: from [172.31.0.109] ([136.36.72.243]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6bd7fd25fsm55843235ad.280.2024.06.08.12.50.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 08 Jun 2024 12:50:38 -0700 (PDT) Message-ID: <4dd759d6-549d-4fc3-bb86-ea868e675b69@gmail.com> Date: Sat, 8 Jun 2024 13:50:34 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH] haifa-sched: Avoid the fusion priority of the fused insn to affect the subsequent insn sequence. Content-Language: en-US To: Jin Ma , gcc-patches Cc: palmer , "richard.sandiford" , "kito.cheng" , "christoph.muellner" , "rdapp.gcc" , "juzhe.zhong" , "jinma.contrib" References: <20240605023717.668-1-jinma@linux.alibaba.com> From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 6/6/24 8:51 PM, Jin Ma wrote: > > I am very sorry that I did not check the commit information carefully. The statement is somewhat inaccurate. > >> When the insn 1 and 2, 3 and 4 can be fusioned, then there is the >> following sequence: >> >> ;;    insn | >> ;;      1  | sp=sp-0x18 >> ;;  +   2  | [sp+0x10]=ra >> ;;      3  | [sp+0x8]=s0 >> ;;      4  | [sp+0x0]=s1 > >> The fusion priority of the insn 2, 3, and 4 are the same. According to >> the current algorithm, since abs(0x10-0x8)> is followed by the insn 3. It is obviously unreasonable to do so. >> >> Therefore, when we issue the insn 3 and 4, we should consider the fusion >> priority of the insn 1 instead of the insn 2. And the final instruction >> sequence is as follows: > >> ;;    insn | >> ;;      1  | sp=sp-0x18 >> ;;  +   2  | [sp+0x10]=ra >> ;;      4  | [sp+0x8]=s1 >> ;;  +   3  | [sp+0x0]=s0 >> >> gcc/ChangeLog: > >> * haifa-sched.cc (rank_for_schedule): Likewise. > > When the insn 1 and 2, 4 and 3 can be fusioned, then there is the > following sequence: > > ;;    insn | > ;;      1  | sp=sp-0x18 > ;;  +   2  | [sp+0x10]=ra > ;;      3  | [sp+0x8]=s0 > ;;      4  | [sp+0x0]=s1 > > The fusion priority of the insn 2, 3, and 4 are the same. According to > the current algorithm, since abs(0x10-0x8) is followed by the insn 3. It is obviously unreasonable to do so. > > Therefore, when we issue the insn 3 and 4, we should consider the fusion > priority of the insn 1 instead of the insn 2. And the final instruction > sequence is as follows: > > ;;    insn | > ;;      1  | sp=sp-0x18 > ;;  +   2  | [sp+0x10]=ra > ;;      4  | [sp+0x0]=s1 > ;;  +   3  | [sp+0x8]=s0 > > gcc/ChangeLog: > > * haifa-sched.cc (rank_for_schedule): Likewise. I'd really love to see a testcase here, particularly since I'm still having trouble understanding the code you're currently getting vs the code you want. Furthermore, I think I need to understand the end motivation here. I always think of fusion priority has bringing insns consecutive so that peephole pass can then squash two more more insns into a single insn. THe canonical case being load/store pairs. If you're trying to generate pairs, then that's fine. I just want to make sure I understand the goal. And if you're trying to generate pairs what actually can be paired? I must admit I don't have any notable experience with the thead core extensions. If you're just trying to keep the instructions consecutive in the IL, then I don't think fusion priorities are a significant concern. Much more important for that case is the fusion pair detection (which I think is about to get a lot more attention in the near future). Jeff