Page MenuHomePhabricator

Please use GitHub pull requests for new patches. Phabricator shutdown timeline

lcvon007 (lcvon)
User

Projects

User does not belong to any projects.

User Details

User Since
Aug 7 2023, 1:19 AM (7 w, 2 d)

Recent Activity

Sun, Sep 24

lcvon007 added a comment to D158623: [RISCV] Reorder the stack frame objects..

May you help me review again? and Phabricator will be read-only after October 1, thanks very much. @craig.topper
@reames

Sun, Sep 24, 7:04 PM · Restricted Project, Restricted Project

Thu, Sep 21

lcvon007 added a comment to D158623: [RISCV] Reorder the stack frame objects..

ping

Thu, Sep 21, 5:39 PM · Restricted Project, Restricted Project

Mon, Sep 18

lcvon007 added inline comments to D158623: [RISCV] Reorder the stack frame objects..
Mon, Sep 18, 1:56 AM · Restricted Project, Restricted Project
lcvon007 added inline comments to D158623: [RISCV] Reorder the stack frame objects..
Mon, Sep 18, 1:49 AM · Restricted Project, Restricted Project
lcvon007 updated the diff for D158623: [RISCV] Reorder the stack frame objects..

update isCompressibleLdOrSt to fix craig.topper's opinions.

Mon, Sep 18, 1:49 AM · Restricted Project, Restricted Project

Thu, Sep 14

lcvon007 added a comment to D158623: [RISCV] Reorder the stack frame objects..

hi reames, craig, may you help me review my patch again? review opinions have all been fixed, thanks very much @reames @craig.topper

Thu, Sep 14, 8:45 AM · Restricted Project, Restricted Project

Tue, Sep 5

lcvon007 added a comment to D158623: [RISCV] Reorder the stack frame objects..

hi reames, craig, may you help me review my patch again? review opinions have all been fixed, thanks very much @reames @craig.topper

Tue, Sep 5, 8:03 PM · Restricted Project, Restricted Project

Mon, Sep 4

lcvon007 updated the diff for D158623: [RISCV] Reorder the stack frame objects..

rebase main

Mon, Sep 4, 7:30 PM · Restricted Project, Restricted Project
lcvon007 updated the diff for D159431: [RISCV] adjust first sp size to use c.addi16sp..

rebase master

Mon, Sep 4, 7:00 PM · Restricted Project, Restricted Project
lcvon007 requested review of D159431: [RISCV] adjust first sp size to use c.addi16sp..
Mon, Sep 4, 6:26 AM · Restricted Project, Restricted Project

Fri, Sep 1

lcvon007 added inline comments to D158623: [RISCV] Reorder the stack frame objects..
Fri, Sep 1, 1:23 AM · Restricted Project, Restricted Project
lcvon007 added inline comments to D158623: [RISCV] Reorder the stack frame objects..
Fri, Sep 1, 1:07 AM · Restricted Project, Restricted Project
lcvon007 added inline comments to D158623: [RISCV] Reorder the stack frame objects..
Fri, Sep 1, 1:07 AM · Restricted Project, Restricted Project
lcvon007 added inline comments to D158623: [RISCV] Reorder the stack frame objects..
Fri, Sep 1, 1:05 AM · Restricted Project, Restricted Project
lcvon007 added inline comments to D158623: [RISCV] Reorder the stack frame objects..
Fri, Sep 1, 1:02 AM · Restricted Project, Restricted Project
lcvon007 updated the diff for D158623: [RISCV] Reorder the stack frame objects..
  1. Use switch to implement isCompressibleLdOrSt
  2. refine sort alorithm from sorting the whole objects into sorting each group with same alignment size.
  3. use sperate map for frame index mapping.
Fri, Sep 1, 12:50 AM · Restricted Project, Restricted Project

Thu, Aug 31

lcvon007 added inline comments to D158623: [RISCV] Reorder the stack frame objects..
Thu, Aug 31, 5:42 AM · Restricted Project, Restricted Project
lcvon007 updated the diff for D158623: [RISCV] Reorder the stack frame objects..

enable opt in Oz and Os.

Thu, Aug 31, 5:40 AM · Restricted Project, Restricted Project

Wed, Aug 30

lcvon007 added inline comments to D158623: [RISCV] Reorder the stack frame objects..
Wed, Aug 30, 7:44 AM · Restricted Project, Restricted Project
lcvon007 added inline comments to D158623: [RISCV] Reorder the stack frame objects..
Wed, Aug 30, 7:43 AM · Restricted Project, Restricted Project
lcvon007 added inline comments to D158623: [RISCV] Reorder the stack frame objects..
Wed, Aug 30, 7:40 AM · Restricted Project, Restricted Project
lcvon007 added inline comments to D158623: [RISCV] Reorder the stack frame objects..
Wed, Aug 30, 7:40 AM · Restricted Project, Restricted Project
lcvon007 added inline comments to D158623: [RISCV] Reorder the stack frame objects..
Wed, Aug 30, 7:34 AM · Restricted Project, Restricted Project
lcvon007 updated the diff for D158623: [RISCV] Reorder the stack frame objects..

Use lamda for sort function and add Debug codes for the result of frame reorder.

Wed, Aug 30, 7:30 AM · Restricted Project, Restricted Project

Aug 28 2023

lcvon007 added a comment to D158623: [RISCV] Reorder the stack frame objects..

please help review(reivew opinions have been done), thanks very much. @craig.topper @wangpc

Aug 28 2023, 7:27 PM · Restricted Project, Restricted Project
lcvon007 updated the diff for D158623: [RISCV] Reorder the stack frame objects..

combine check if lw/sw/ld/sd are comprssible and update testcase removing extra mattr 'c' because
reorder has effect even without C extension. NFC

Aug 28 2023, 7:25 PM · Restricted Project, Restricted Project

Aug 27 2023

lcvon007 added inline comments to D158623: [RISCV] Reorder the stack frame objects..
Aug 27 2023, 7:58 PM · Restricted Project, Restricted Project
lcvon007 added inline comments to D158623: [RISCV] Reorder the stack frame objects..
Aug 27 2023, 7:57 PM · Restricted Project, Restricted Project
lcvon007 updated the diff for D158623: [RISCV] Reorder the stack frame objects..

Inline compressible ld/st check function by hand. NFC

Aug 27 2023, 7:42 PM · Restricted Project, Restricted Project

Aug 24 2023

lcvon007 added inline comments to D158623: [RISCV] Reorder the stack frame objects..
Aug 24 2023, 7:45 AM · Restricted Project, Restricted Project
lcvon007 updated the diff for D158623: [RISCV] Reorder the stack frame objects..

add function to check if a ld/st is compressible and remove
the check for c extension because it may improve the code size
even target doesn't support c extension.

Aug 24 2023, 7:28 AM · Restricted Project, Restricted Project

Aug 23 2023

lcvon007 added inline comments to D158623: [RISCV] Reorder the stack frame objects..
Aug 23 2023, 8:55 PM · Restricted Project, Restricted Project
lcvon007 updated the diff for D158623: [RISCV] Reorder the stack frame objects..

add a { } for if condition, NFC

Aug 23 2023, 7:55 PM · Restricted Project, Restricted Project
lcvon007 added a comment to D158623: [RISCV] Reorder the stack frame objects..

Can you describe the cost model in the patch description?

Aug 23 2023, 7:32 PM · Restricted Project, Restricted Project
lcvon007 added inline comments to D158623: [RISCV] Reorder the stack frame objects..
Aug 23 2023, 7:31 PM · Restricted Project, Restricted Project
lcvon007 updated the diff for D158623: [RISCV] Reorder the stack frame objects..

add decription for cost model and modify the typo.

Aug 23 2023, 7:30 PM · Restricted Project, Restricted Project
lcvon007 retitled D158623: [RISCV] Reorder the stack frame objects. from [RISCV] Reorder the stack objects. to [RISCV] Reorder the stack frame objects..
Aug 23 2023, 7:13 PM · Restricted Project, Restricted Project
lcvon007 added a comment to D158623: [RISCV] Reorder the stack frame objects..

the optimization data for code size in Oz(strip the symbol table)

Aug 23 2023, 7:51 AM · Restricted Project, Restricted Project
lcvon007 requested review of D158623: [RISCV] Reorder the stack frame objects..
Aug 23 2023, 7:47 AM · Restricted Project, Restricted Project

Aug 17 2023

lcvon007 added inline comments to D157373: [RISCV] add a compress optimization for stack inst..
Aug 17 2023, 6:21 PM · Restricted Project, Restricted Project
lcvon007 added a comment to D157373: [RISCV] add a compress optimization for stack inst..

I think 2048 * 2 + 512 is not 3 addis with the new code. After adding 512, we can't do the remaining 4096 in two addis. We can only do a maximum of 4094 with 2 addis.

Aug 17 2023, 1:51 AM · Restricted Project, Restricted Project
lcvon007 updated the diff for D157373: [RISCV] add a compress optimization for stack inst..

update 2048 into 2047 considering the positive offset of addi.

Aug 17 2023, 1:50 AM · Restricted Project, Restricted Project

Aug 16 2023

lcvon007 added inline comments to D157373: [RISCV] add a compress optimization for stack inst..
Aug 16 2023, 7:35 PM · Restricted Project, Restricted Project
lcvon007 added inline comments to D157373: [RISCV] add a compress optimization for stack inst..
Aug 16 2023, 7:30 PM · Restricted Project, Restricted Project
lcvon007 updated the diff for D157373: [RISCV] add a compress optimization for stack inst..

add more comments in the code and remove the CSI.size check as craig.topper says.

Aug 16 2023, 7:27 PM · Restricted Project, Restricted Project
lcvon007 added a comment to D157373: [RISCV] add a compress optimization for stack inst..

hi @craig.topper , the review opinions you say have been solved yet, may you help check if this commit is ok now?

Aug 16 2023, 7:20 AM · Restricted Project, Restricted Project

Aug 15 2023

lcvon007 added inline comments to D157373: [RISCV] add a compress optimization for stack inst..
Aug 15 2023, 10:29 PM · Restricted Project, Restricted Project
lcvon007 updated the diff for D157373: [RISCV] add a compress optimization for stack inst..

refine the function name in testcases and add one extra tests for
stacksize that is in (2048 * 2 -StackAlign, 2048 * 2 + 512].

Aug 15 2023, 10:22 PM · Restricted Project, Restricted Project
lcvon007 updated the diff for D157373: [RISCV] add a compress optimization for stack inst..

add extra compression condition.

Aug 15 2023, 9:07 AM · Restricted Project, Restricted Project
lcvon007 added inline comments to D157373: [RISCV] add a compress optimization for stack inst..
Aug 15 2023, 8:30 AM · Restricted Project, Restricted Project
lcvon007 updated the diff for D157373: [RISCV] add a compress optimization for stack inst..

rebase main

Aug 15 2023, 4:38 AM · Restricted Project, Restricted Project
lcvon007 updated the diff for D157373: [RISCV] add a compress optimization for stack inst..

rebase main branch

Aug 15 2023, 4:17 AM · Restricted Project, Restricted Project

Aug 14 2023

lcvon007 added inline comments to D157373: [RISCV] add a compress optimization for stack inst..
Aug 14 2023, 10:19 PM · Restricted Project, Restricted Project
lcvon007 updated the diff for D157373: [RISCV] add a compress optimization for stack inst..

NFC, update testcase to simplify it.

Aug 14 2023, 10:15 PM · Restricted Project, Restricted Project
lcvon007 added inline comments to D157373: [RISCV] add a compress optimization for stack inst..
Aug 14 2023, 9:03 PM · Restricted Project, Restricted Project
lcvon007 added inline comments to D157373: [RISCV] add a compress optimization for stack inst..
Aug 14 2023, 4:40 PM · Restricted Project, Restricted Project
lcvon007 added a comment to D157373: [RISCV] add a compress optimization for stack inst..

For the program's performance, it has not got obvious profit or regression(I only test them in O2 and run with one copy about spec cpu2006), I also disassemblers each binary and see that they 're almost same except some cases like the follows(no extra instructions generated.): @wangpc

  1. auipc + jalr => jal(optimized version)
  2. li a7, 7, slli a7, a7, 0xb => lui a7, 0x4, addiw a7, a7, -528(optimized version)
  3. addi a0, a0, -104 => mv a0, a0
Aug 14 2023, 6:42 AM · Restricted Project, Restricted Project
lcvon007 added inline comments to D157373: [RISCV] add a compress optimization for stack inst..
Aug 14 2023, 6:34 AM · Restricted Project, Restricted Project
lcvon007 added inline comments to D157373: [RISCV] add a compress optimization for stack inst..
Aug 14 2023, 6:30 AM · Restricted Project, Restricted Project
lcvon007 added inline comments to D157373: [RISCV] add a compress optimization for stack inst..
Aug 14 2023, 6:29 AM · Restricted Project, Restricted Project
lcvon007 added a comment to D157373: [RISCV] add a compress optimization for stack inst..
Aug 14 2023, 6:25 AM · Restricted Project, Restricted Project
lcvon007 updated the diff for D157373: [RISCV] add a compress optimization for stack inst..

Add Zca condition and change << into normal multiplication.

Aug 14 2023, 6:12 AM · Restricted Project, Restricted Project

Aug 13 2023

lcvon007 added a comment to D157373: [RISCV] add a compress optimization for stack inst..

I just found a regression:

--- a/llvm/test/CodeGen/RISCV/stack-realignment.ll
+++ b/llvm/test/CodeGen/RISCV/stack-realignment.ll
@@ -1,7 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
+; RUN: llc -mtriple=riscv32 -mattr=+c -verify-machineinstrs < %s \
 ; RUN:   | FileCheck %s -check-prefix=RV32I
-; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \
+; RUN: llc -mtriple=riscv64 -mattr=+c -verify-machineinstrs < %s \
 ; RUN:   | FileCheck %s -check-prefix=RV64I
 
 declare void @callee(ptr)
@@ -529,56 +529,58 @@ define void @caller_no_realign2048() "no-realign-stack" {
 define void @caller4096() {
 ; RV32I-LABEL: caller4096:
 ; RV32I:       # %bb.0:
-; RV32I-NEXT:    addi sp, sp, -2032
-; RV32I-NEXT:    .cfi_def_cfa_offset 2032
-; RV32I-NEXT:    sw ra, 2028(sp) # 4-byte Folded Spill
-; RV32I-NEXT:    sw s0, 2024(sp) # 4-byte Folded Spill
+; RV32I-NEXT:    addi sp, sp, -256
+; RV32I-NEXT:    .cfi_def_cfa_offset 256
+; RV32I-NEXT:    sw ra, 252(sp) # 4-byte Folded Spill
+; RV32I-NEXT:    sw s0, 248(sp) # 4-byte Folded Spill
 ; RV32I-NEXT:    .cfi_offset ra, -4
 ; RV32I-NEXT:    .cfi_offset s0, -8
-; RV32I-NEXT:    addi s0, sp, 2032
+; RV32I-NEXT:    addi s0, sp, 256
 ; RV32I-NEXT:    .cfi_def_cfa s0, 0
-; RV32I-NEXT:    lui a0, 2
-; RV32I-NEXT:    addi a0, a0, -2032
+; RV32I-NEXT:    li a0, 31
+; RV32I-NEXT:    slli a0, a0, 8
 ; RV32I-NEXT:    sub sp, sp, a0
 ; RV32I-NEXT:    srli a0, sp, 12
 ; RV32I-NEXT:    slli sp, a0, 12
 ; RV32I-NEXT:    lui a0, 1
-; RV32I-NEXT:    add a0, sp, a0
+; RV32I-NEXT:    add a0, a0, sp
 ; RV32I-NEXT:    call callee@plt
 ; RV32I-NEXT:    lui a0, 2
 ; RV32I-NEXT:    sub sp, s0, a0
-; RV32I-NEXT:    addi a0, a0, -2032
+; RV32I-NEXT:    li a0, 31
+; RV32I-NEXT:    slli a0, a0, 8
 ; RV32I-NEXT:    add sp, sp, a0
-; RV32I-NEXT:    lw ra, 2028(sp) # 4-byte Folded Reload
-; RV32I-NEXT:    lw s0, 2024(sp) # 4-byte Folded Reload
-; RV32I-NEXT:    addi sp, sp, 2032
+; RV32I-NEXT:    lw ra, 252(sp) # 4-byte Folded Reload
+; RV32I-NEXT:    lw s0, 248(sp) # 4-byte Folded Reload
+; RV32I-NEXT:    addi sp, sp, 256
 ; RV32I-NEXT:    ret
 ;
 ; RV64I-LABEL: caller4096:
 ; RV64I:       # %bb.0:
-; RV64I-NEXT:    addi sp, sp, -2032
-; RV64I-NEXT:    .cfi_def_cfa_offset 2032
-; RV64I-NEXT:    sd ra, 2024(sp) # 8-byte Folded Spill
-; RV64I-NEXT:    sd s0, 2016(sp) # 8-byte Folded Spill
+; RV64I-NEXT:    addi sp, sp, -512
+; RV64I-NEXT:    .cfi_def_cfa_offset 512
+; RV64I-NEXT:    sd ra, 504(sp) # 8-byte Folded Spill
+; RV64I-NEXT:    sd s0, 496(sp) # 8-byte Folded Spill
 ; RV64I-NEXT:    .cfi_offset ra, -8
 ; RV64I-NEXT:    .cfi_offset s0, -16
-; RV64I-NEXT:    addi s0, sp, 2032
+; RV64I-NEXT:    addi s0, sp, 512
 ; RV64I-NEXT:    .cfi_def_cfa s0, 0
-; RV64I-NEXT:    lui a0, 2
-; RV64I-NEXT:    addiw a0, a0, -2032
+; RV64I-NEXT:    li a0, 15
+; RV64I-NEXT:    slli a0, a0, 9
 ; RV64I-NEXT:    sub sp, sp, a0
 ; RV64I-NEXT:    srli a0, sp, 12
 ; RV64I-NEXT:    slli sp, a0, 12
 ; RV64I-NEXT:    lui a0, 1
-; RV64I-NEXT:    add a0, sp, a0
+; RV64I-NEXT:    add a0, a0, sp
 ; RV64I-NEXT:    call callee@plt
 ; RV64I-NEXT:    lui a0, 2
 ; RV64I-NEXT:    sub sp, s0, a0
-; RV64I-NEXT:    addiw a0, a0, -2032
+; RV64I-NEXT:    li a0, 15
+; RV64I-NEXT:    slli a0, a0, 9
 ; RV64I-NEXT:    add sp, sp, a0
-; RV64I-NEXT:    ld ra, 2024(sp) # 8-byte Folded Reload
-; RV64I-NEXT:    ld s0, 2016(sp) # 8-byte Folded Reload
-; RV64I-NEXT:    addi sp, sp, 2032
+; RV64I-NEXT:    ld ra, 504(sp) # 8-byte Folded Reload
+; RV64I-NEXT:    ld s0, 496(sp) # 8-byte Folded Reload
+; RV64I-NEXT:    addi sp, sp, 512
 ; RV64I-NEXT:    ret
   %1 = alloca i8, align 4096
   call void @callee(ptr %1)

I think that is because we need to do a larger second stack adjustment if we do a small first stack adjustment.
So the impact on performance should be evalated so that we can decide whether this optimization should be enabled under -Os/-Oz only. :-)

Aug 13 2023, 7:41 PM · Restricted Project, Restricted Project
lcvon007 updated the diff for D157373: [RISCV] add a compress optimization for stack inst..

submit codes for craig.topper's review opinion

Aug 13 2023, 2:23 AM · Restricted Project, Restricted Project

Aug 12 2023

lcvon007 added a comment to D157373: [RISCV] add a compress optimization for stack inst..

It seems that compiler doesn't generate the best code, and it can generate addi a0, a0, -256 like addi a0, a0, -2032, but it generates li a0, 31, slli a0, a0, 8 => 31 << 8 = 2 * 4096 -256, so I think threre is another optimization point here @wangpc

Aug 12 2023, 7:59 AM · Restricted Project, Restricted Project

Aug 10 2023

lcvon007 added a comment to D157373: [RISCV] add a compress optimization for stack inst..

hi, I have seen some performance degradattion in my first implementation, and I update the logic to adjust the FirstSP amount conservatively so that it will not increase extra instructions, please help review, thanks very much. @wangpc

Aug 10 2023, 7:02 AM · Restricted Project, Restricted Project
lcvon007 updated the diff for D157373: [RISCV] add a compress optimization for stack inst..

Update the method to adjust the FirstSP mount to avoid
adding extra insts.

Aug 10 2023, 6:56 AM · Restricted Project, Restricted Project

Aug 8 2023

lcvon007 edited reviewers for D157373: [RISCV] add a compress optimization for stack inst., added: wangpc; removed: frasercrmck.
Aug 8 2023, 8:32 PM · Restricted Project, Restricted Project
lcvon007 added a comment to D157373: [RISCV] add a compress optimization for stack inst..

Have you evaluated impact on performance? It seems we will generate more instructions to adjust stack.

Aug 8 2023, 7:04 PM · Restricted Project, Restricted Project
lcvon007 added a comment to D157373: [RISCV] add a compress optimization for stack inst..

code size before and after optimization about spec CPU2006:
400.perlbench : 1146568, 1145352, decrease 1216
403.gcc: 3556640, 3555280, decrease 1360
445.gobmk: 4437552, 4433280 decrease 4272

  1. h264ref: 586776, 585304 decrease 1472

483.xalancbmk: 8011104, 8008944 decrease 2160
435.gromacs: 870344, 867832, decrease 2512
444.namd: 212224, 207936, decrease 4288
447.dealII: 4741400, 4736792, decrease 4608
453.povray: 1075832, 1073400, decrease 2432

Aug 8 2023, 3:53 AM · Restricted Project, Restricted Project
lcvon007 requested review of D157373: [RISCV] add a compress optimization for stack inst..
Aug 8 2023, 1:34 AM · Restricted Project, Restricted Project