Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NFC][AMDGPU] Pre-commit a test case of checking register coalescer on v_pk_mov_b32 #127715

Merged
merged 3 commits into from
Feb 19, 2025

Conversation

shiltian
Copy link
Contributor

@shiltian shiltian commented Feb 18, 2025

This PR serves as a preliminary step, adding a test case for register coalescer on v_pk_mov_b32. It is intended to demonstrate the code changes introduced in an upcoming PR.

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@shiltian shiltian marked this pull request as ready for review February 18, 2025 23:15
@shiltian shiltian requested a review from arsenm February 18, 2025 23:15
@llvmbot
Copy link
Member

llvmbot commented Feb 18, 2025

@llvm/pr-subscribers-backend-amdgpu

Author: Shilei Tian (shiltian)

Changes

This PR serves as a preliminary step, adding a test case for v_pk_mov_b32 in
vgpr-remat.mir. It is intended to demonstrate the code changes introduced in
an upcoming PR.


Full diff: https://github.com/llvm/llvm-project/pull/127715.diff

1 Files Affected:

  • (modified) llvm/test/CodeGen/AMDGPU/vgpr-remat.mir (+47)
diff --git a/llvm/test/CodeGen/AMDGPU/vgpr-remat.mir b/llvm/test/CodeGen/AMDGPU/vgpr-remat.mir
index 08f5550f3b08a..0d4f779b53976 100644
--- a/llvm/test/CodeGen/AMDGPU/vgpr-remat.mir
+++ b/llvm/test/CodeGen/AMDGPU/vgpr-remat.mir
@@ -46,3 +46,50 @@ body: |
     %4.sub1:vreg_96 = COPY %2:vgpr_32
     S_ENDPGM 0, implicit %4
 ...
+
+---
+name: test_remat_v_pk_mov_b32
+tracksRegLiveness: true
+body: |
+  ; CHECK-LABEL: name: test_remat_v_pk_mov_b32
+  ; CHECK: bb.0:
+  ; CHECK-NEXT:   successors: %bb.2(0x40000000), %bb.1(0x40000000)
+  ; CHECK-NEXT:   liveins: $sgpr0
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   [[V_PK_MOV_B32_:%[0-9]+]]:vreg_64_align2 = V_PK_MOV_B32 8, 0, 8, 0, 0, 0, 0, 0, 0, implicit $exec
+  ; CHECK-NEXT:   [[COPY:%[0-9]+]]:vreg_64_align2 = COPY [[V_PK_MOV_B32_]]
+  ; CHECK-NEXT:   [[COPY1:%[0-9]+]]:vreg_64_align2 = COPY [[V_PK_MOV_B32_]]
+  ; CHECK-NEXT:   [[COPY2:%[0-9]+]]:sreg_64 = COPY $sgpr0
+  ; CHECK-NEXT:   $exec = S_MOV_B64_term [[COPY2]]
+  ; CHECK-NEXT:   S_CBRANCH_EXECZ %bb.2, implicit $exec
+  ; CHECK-NEXT:   S_BRANCH %bb.1
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT: bb.1:
+  ; CHECK-NEXT:   successors: %bb.2(0x80000000)
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   [[COPY:%[0-9]+]]:vreg_64_align2 = V_PK_ADD_F32 8, [[COPY]], 8, [[COPY]], 11, 0, 0, 0, 0, implicit $mode, implicit $exec
+  ; CHECK-NEXT:   [[COPY1:%[0-9]+]]:vreg_64_align2 = V_PK_ADD_F32 8, [[COPY1]], 8, [[COPY1]], 11, 0, 0, 0, 0, implicit $mode, implicit $exec
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT: bb.2:
+  ; CHECK-NEXT:   S_NOP 0, implicit [[COPY]]
+  ; CHECK-NEXT:   S_NOP 0, implicit [[COPY1]]
+  ; CHECK-NEXT:   S_ENDPGM 0, implicit [[V_PK_MOV_B32_]]
+  bb.0:
+    liveins: $sgpr0
+    %0:vreg_64_align2 = V_PK_MOV_B32 8, 0, 8, 0, 0, 0, 0, 0, 0, implicit $exec
+    %1:vreg_64_align2 = COPY %0:vreg_64_align2
+    %2:vreg_64_align2 = COPY %0:vreg_64_align2
+    %3:sreg_64 = COPY $sgpr0
+    $exec = S_MOV_B64_term %3:sreg_64
+    S_CBRANCH_EXECZ %bb.2, implicit $exec
+    S_BRANCH %bb.1
+
+  bb.1:
+    %1:vreg_64_align2 = V_PK_ADD_F32 8, %1, 8, %1, 11, 0, 0, 0, 0, implicit $mode, implicit $exec
+    %2:vreg_64_align2 = V_PK_ADD_F32 8, %2, 8, %2, 11, 0, 0, 0, 0, implicit $mode, implicit $exec
+
+  bb.2:
+    S_NOP 0, implicit %1
+    S_NOP 0, implicit %2
+    S_ENDPGM 0, implicit %0
+...

@@ -46,3 +46,50 @@ body: |
%4.sub1:vreg_96 = COPY %2:vgpr_32
S_ENDPGM 0, implicit %4
...

---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is running with -mcpu=gfx900, which doesn't have v_pk_mov_b32. At one point I was working on making MIR tests less permissive about mismatches, maybe should adjust the target-cpu for the run line

…t.mir`

This PR serves as a preliminary step, adding a test case for `v_pk_mov_b32` in
`vgpr-remat.mir`. It is intended to demonstrate the code changes introduced in
an upcoming PR.
@shiltian shiltian force-pushed the users/shiltian/add-v_pk_mov_b32-test-in-vgpr-remat-mir branch from 43f2ae2 to 2269c23 Compare February 19, 2025 04:38
@shiltian shiltian changed the title [NFC][AMDGPU] Pre-commit a test case for v_pk_mov_b32 in vgpr-remat.mir [NFC][AMDGPU] Pre-commit a test case of checking register coalescer for v_pk_mov_b32 Feb 19, 2025
@shiltian shiltian changed the title [NFC][AMDGPU] Pre-commit a test case of checking register coalescer for v_pk_mov_b32 [NFC][AMDGPU] Pre-commit a test case of checking register coalescer on v_pk_mov_b32 Feb 19, 2025
@shiltian shiltian merged commit 8187caf into main Feb 19, 2025
5 of 8 checks passed
@shiltian shiltian deleted the users/shiltian/add-v_pk_mov_b32-test-in-vgpr-remat-mir branch February 19, 2025 04:42
Prakhar-Dixit pushed a commit to Prakhar-Dixit/llvm-project that referenced this pull request Feb 19, 2025
…n `v_pk_mov_b32` (llvm#127715)

This PR serves as a preliminary step, adding a test case for register coalescer on v_pk_mov_b32. It is intended to demonstrate the code changes introduced in an upcoming PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants