Skip to content

[AMDGPU] Add tests for SIPreAllocateWWMRegs #109963

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

Conversation

optimisan
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Sep 25, 2024

@llvm/pr-subscribers-backend-amdgpu

Author: Akshat Oke (Akshat-Oke)

Changes

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

2 Files Affected:

  • (added) llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-regs.mir (+26)
  • (added) llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-sgpr-spills.mir (+21)
diff --git a/llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-regs.mir b/llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-regs.mir
new file mode 100644
index 00000000000000..f2db299f575f5e
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-regs.mir
@@ -0,0 +1,26 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
+# RUN: llc -mtriple=amdgcn -verify-machineinstrs -run-pass=si-pre-allocate-wwm-regs -o - -mcpu=tahiti %s  | FileCheck %s
+
+---
+
+name: pre_allocate_wwm_regs_strict
+tracksRegLiveness: true
+body: |
+  bb.0:
+    liveins: $sgpr1
+    ; CHECK-LABEL: name: pre_allocate_wwm_regs_strict
+    ; CHECK: liveins: $sgpr1
+    ; CHECK-NEXT: {{  $}}
+    ; CHECK-NEXT: [[DEF:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF
+    ; CHECK-NEXT: renamable $sgpr4_sgpr5 = ENTER_STRICT_WWM -1, implicit-def $exec, implicit-def $scc, implicit $exec
+    ; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 0, implicit $exec
+    ; CHECK-NEXT: dead $vgpr0 = V_MOV_B32_dpp $vgpr0, [[DEF]], 323, 12, 15, 0, implicit $exec
+    ; CHECK-NEXT: $exec = EXIT_STRICT_WWM killed renamable $sgpr4_sgpr5
+    ; CHECK-NEXT: dead [[COPY:%[0-9]+]]:vgpr_32 = COPY [[DEF]]
+    %0:vgpr_32 = IMPLICIT_DEF
+    renamable $sgpr4_sgpr5 = ENTER_STRICT_WWM -1, implicit-def $exec, implicit-def $scc, implicit $exec
+    %24:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
+    %25:vgpr_32 = V_MOV_B32_dpp %24:vgpr_32(tied-def 0), %0:vgpr_32, 323, 12, 15, 0, implicit $exec
+    $exec = EXIT_STRICT_WWM killed renamable $sgpr4_sgpr5
+    %2:vgpr_32 = COPY %0:vgpr_32
+...
diff --git a/llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-sgpr-spills.mir b/llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-sgpr-spills.mir
new file mode 100644
index 00000000000000..f0efe74878d831
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/si-pre-allocate-wwm-sgpr-spills.mir
@@ -0,0 +1,21 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
+# RUN: llc -mtriple=amdgcn -verify-machineinstrs -amdgpu-prealloc-sgpr-spill-vgprs -run-pass=si-pre-allocate-wwm-regs -o - -mcpu=tahiti %s | FileCheck %s
+
+---
+
+name: pre_allocate_wwm_spill_to_vgpr
+tracksRegLiveness: true
+body: |
+  bb.0:
+    liveins: $sgpr1
+    ; CHECK-LABEL: name: pre_allocate_wwm_spill_to_vgpr
+    ; CHECK: liveins: $sgpr1
+    ; CHECK-NEXT: {{  $}}
+    ; CHECK-NEXT: [[DEF:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF
+    ; CHECK-NEXT: dead $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr1, 0, [[DEF]]
+    ; CHECK-NEXT: dead [[COPY:%[0-9]+]]:vgpr_32 = COPY [[DEF]]
+    %0:vgpr_32 = IMPLICIT_DEF
+    %23:vgpr_32 = SI_SPILL_S32_TO_VGPR $sgpr1, 0, %0:vgpr_32
+    %2:vgpr_32 = COPY %0:vgpr_32
+...
+

; CHECK-NEXT: dead $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr1, 0, [[DEF]]
; CHECK-NEXT: dead [[COPY:%[0-9]+]]:vgpr_32 = COPY [[DEF]]
%0:vgpr_32 = IMPLICIT_DEF
%23:vgpr_32 = SI_SPILL_S32_TO_VGPR $sgpr1, 0, %0:vgpr_32
Copy link
Contributor

Choose a reason for hiding this comment

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

Compact register numbers

@optimisan optimisan force-pushed the users/Akshat-Oke/port-lrm branch from 22bb8f0 to f2687b0 Compare October 7, 2024 10:28
@optimisan optimisan force-pushed the users/Akshat-Oke/09-25-_amdgpu_add_tests_for_sipreallocatewwmregs branch from 3d87209 to 8da3a2c Compare October 7, 2024 10:28
; CHECK2-NEXT: dead [[COPY:%[0-9]+]]:vgpr_32 = COPY [[DEF]]
%0:vgpr_32 = IMPLICIT_DEF
%1:vgpr_32 = SI_SPILL_S32_TO_VGPR $sgpr1, 0, %0
%2:vgpr_32 = COPY %0
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing ... at end of function

@optimisan optimisan force-pushed the users/Akshat-Oke/port-lrm branch from f2687b0 to cfebf02 Compare October 8, 2024 04:46
@optimisan optimisan force-pushed the users/Akshat-Oke/09-25-_amdgpu_add_tests_for_sipreallocatewwmregs branch from 8da3a2c to 131cedb Compare October 8, 2024 04:46
@optimisan optimisan force-pushed the users/Akshat-Oke/port-lrm branch from cfebf02 to ce5cb60 Compare October 14, 2024 05:44
@optimisan optimisan force-pushed the users/Akshat-Oke/09-25-_amdgpu_add_tests_for_sipreallocatewwmregs branch from 131cedb to 9bddae3 Compare October 14, 2024 05:44
Comment on lines 2 to 3
# RUN: llc -mtriple=amdgcn -verify-machineinstrs -run-pass=si-pre-allocate-wwm-regs -o - -mcpu=tahiti %s | FileCheck %s
# RUN: llc -mtriple=amdgcn -verify-machineinstrs -amdgpu-prealloc-sgpr-spill-vgprs -run-pass=si-pre-allocate-wwm-regs -o - -mcpu=tahiti %s | FileCheck %s --check-prefix=CHECK2
Copy link
Contributor

Choose a reason for hiding this comment

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

Move the -mcpu together with -mtriple

# RUN: llc -mtriple=amdgcn -verify-machineinstrs -run-pass=si-pre-allocate-wwm-regs -o - -mcpu=tahiti %s | FileCheck %s
# RUN: llc -mtriple=amdgcn -verify-machineinstrs -amdgpu-prealloc-sgpr-spill-vgprs -run-pass=si-pre-allocate-wwm-regs -o - -mcpu=tahiti %s | FileCheck %s --check-prefix=CHECK2

---
Copy link
Contributor

Choose a reason for hiding this comment

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

Add fixme to check the MachineFunctionInfo reserved register information

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it for WWM reserved registers?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But we have that already(?)

wwmReservedRegs:
  - '$vgpr0'

Copy link
Contributor

Choose a reason for hiding this comment

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

Then you need to write manual checks for it. Update_mir_test_checks doesn't currently support the function level properties

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment for the manual check.

@optimisan optimisan force-pushed the users/Akshat-Oke/09-25-_amdgpu_add_tests_for_sipreallocatewwmregs branch from 9bddae3 to 604653e Compare October 14, 2024 08:06
@@ -0,0 +1,49 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
Copy link
Contributor

Choose a reason for hiding this comment

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

Best to remote this and remove the comment then

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is remote?

@optimisan optimisan force-pushed the users/Akshat-Oke/port-lrm branch from ce5cb60 to 3f42b36 Compare October 14, 2024 13:35
@optimisan optimisan force-pushed the users/Akshat-Oke/09-25-_amdgpu_add_tests_for_sipreallocatewwmregs branch from 604653e to 43c0d2c Compare October 14, 2024 13:35
@optimisan optimisan force-pushed the users/Akshat-Oke/port-lrm branch from 3f42b36 to 6e1edfd Compare October 21, 2024 08:26
@optimisan optimisan force-pushed the users/Akshat-Oke/09-25-_amdgpu_add_tests_for_sipreallocatewwmregs branch from 43c0d2c to 2ff11f5 Compare October 21, 2024 08:26
@optimisan optimisan force-pushed the users/Akshat-Oke/port-lrm branch from 6e1edfd to 257f319 Compare October 22, 2024 09:39
@optimisan optimisan force-pushed the users/Akshat-Oke/09-25-_amdgpu_add_tests_for_sipreallocatewwmregs branch from 2ff11f5 to d2032b2 Compare October 22, 2024 09:39
@optimisan
Copy link
Contributor Author

optimisan commented Oct 22, 2024

Merge activity

  • Oct 22, 5:41 AM EDT: A user started a stack merge that includes this pull request via Graphite.
  • Oct 22, 6:00 AM EDT: Graphite rebased this pull request as part of a merge.
  • Oct 22, 6:01 AM EDT: Graphite rebased this pull request as part of a merge.
  • Oct 22, 6:03 AM EDT: A user merged this pull request with Graphite.

@optimisan optimisan force-pushed the users/Akshat-Oke/port-lrm branch from 257f319 to ee83948 Compare October 22, 2024 09:54
Base automatically changed from users/Akshat-Oke/port-lrm to main October 22, 2024 09:58
@optimisan optimisan force-pushed the users/Akshat-Oke/09-25-_amdgpu_add_tests_for_sipreallocatewwmregs branch 2 times, most recently from af68ad6 to 6169a44 Compare October 22, 2024 10:00
@optimisan optimisan merged commit f8cb526 into main Oct 22, 2024
5 of 6 checks passed
@optimisan optimisan deleted the users/Akshat-Oke/09-25-_amdgpu_add_tests_for_sipreallocatewwmregs branch October 22, 2024 10:03
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