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

AMDGPU: Pre-commit test to verify mode change in fp constrained operations #88858

Merged
merged 7 commits into from
Apr 24, 2024

Conversation

abhigargrepo
Copy link
Contributor

This test will check the mode register in case of constrained floating point operations.

This test will check the  mode register in case of
constrained floating point operations.
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 16, 2024

@llvm/pr-subscribers-backend-amdgpu

Author: Abhinav Garg (abhigargrepo)

Changes

This test will check the mode register in case of constrained floating point operations.


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

1 Files Affected:

  • (added) llvm/test/CodeGen/AMDGPU/mode-register-fpconstrain.mir (+36)
diff --git a/llvm/test/CodeGen/AMDGPU/mode-register-fpconstrain.mir b/llvm/test/CodeGen/AMDGPU/mode-register-fpconstrain.mir
new file mode 100644
index 00000000000000..fe4912c2e84cf6
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/mode-register-fpconstrain.mir
@@ -0,0 +1,36 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4
+# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -run-pass=si-mode-register -verify-machineinstrs %s -o - | FileCheck -check-prefix=GCN %s
+
+# The si-mode-register pass is changing the default mode for FP constrained  operations.
+# It must ignore strictfp functions.
+
+--- |
+  define void @ignoreStrictFpFns() #0 {
+    ret void
+  }
+
+  attributes #0 = { strictfp }
+
+...
+---
+name:            ignoreStrictFpFns
+tracksRegLiveness: true
+body:             |
+  bb.0:
+    liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
+    ; GCN-LABEL: name: ignoreStrictFpFns
+    ; GCN: liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
+    ; GCN-NEXT: {{  $}}
+    ; GCN-NEXT: S_WAITCNT 0
+    ; GCN-NEXT: S_SETREG_IMM32_B32_mode 1, 2177, implicit-def dead $mode, implicit $mode
+    ; GCN-NEXT: S_SETREG_IMM32_B32 0, 129, implicit-def $mode, implicit $mode
+    ; GCN-NEXT: renamable $vgpr0_vgpr1 = nofpexcept V_ADD_F64_e64 0, killed $vgpr0_vgpr1, 0, killed $vgpr2_vgpr3, 0, 0, implicit $mode, implicit $exec
+    ; GCN-NEXT: S_SETREG_IMM32_B32_mode 0, 2177, implicit-def dead $mode, implicit $mode
+    ; GCN-NEXT: S_SETPC_B64_return undef $sgpr30_sgpr31, implicit killed $vgpr0, implicit killed $vgpr1
+    S_WAITCNT 0
+    S_SETREG_IMM32_B32_mode 1, 2177, implicit-def dead $mode, implicit $mode
+    renamable $vgpr0_vgpr1 = nofpexcept V_ADD_F64_e64 0, killed $vgpr0_vgpr1, 0, killed $vgpr2_vgpr3, 0, 0, implicit $mode, implicit $exec
+    S_SETREG_IMM32_B32_mode 0, 2177, implicit-def dead $mode, implicit $mode
+    S_SETPC_B64_return undef $sgpr30_sgpr31, implicit killed $vgpr0, implicit killed $vgpr1
+
+...

Copy link
Contributor

@arsenm arsenm left a comment

Choose a reason for hiding this comment

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

This can be an IR test. Commit message should also be more specific

This test will check the mode register change in case of constrained floating point operations.
Copy link
Contributor

@arsenm arsenm left a comment

Choose a reason for hiding this comment

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

Patch title should be made more specific for what this is a test for

llvm/test/CodeGen/AMDGPU/mode-register-fpconstrain.ll Outdated Show resolved Hide resolved
llvm/test/CodeGen/AMDGPU/mode-register-fpconstrain.ll Outdated Show resolved Hide resolved
This test will check the mode register change in case of constrained floating point operations.
@abhigargrepo abhigargrepo changed the title Pre-commit lit test Pre-commit test to verify mode change in fp constrained operations Apr 24, 2024
@arsenm arsenm changed the title Pre-commit test to verify mode change in fp constrained operations AMDGPU: Pre-commit test to verify mode change in fp constrained operations Apr 24, 2024
This test will check the mode register change in case of constrained floating point operations.
; GCN-NEXT: v_add_f64 v[0:1], v[0:1], v[2:3]
; GCN-NEXT: s_setpc_b64 s[30:31]
entry:
call void @llvm.set.fpenv.i64(i64 4)
Copy link
Contributor

Choose a reason for hiding this comment

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

Not the most realistic source value but ok

@arsenm arsenm merged commit 007e859 into llvm:main Apr 24, 2024
3 of 4 checks passed
Copy link

@abhigargrepo Congratulations on having your first Pull Request (PR) merged into the LLVM Project!

Your changes will be combined with recent changes from other authors, then tested
by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as
the builds can include changes from many authors. It is not uncommon for your
change to be included in a build that fails due to someone else's changes, or
infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail here.

If your change does cause a problem, it may be reverted, or you can revert it yourself.
This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are working as expected, well done!

@abhigargrepo abhigargrepo deleted the bug-siMode branch April 25, 2024 16:59
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.

None yet

3 participants