Skip to content

Conversation

@parsifal-47
Copy link
Contributor

This is a fix for:
#97290
Please let me know if that is the right way to address the issue. Thank you!

@llvmbot
Copy link
Member

llvmbot commented Dec 28, 2024

@llvm/pr-subscribers-backend-amdgpu

@llvm/pr-subscribers-llvm-globalisel

Author: Renat Idrisov (parsifal-47)

Changes

This is a fix for:
#97290
Please let me know if that is the right way to address the issue. Thank you!


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

2 Files Affected:

  • (modified) llvm/lib/CodeGen/MachineVerifier.cpp (+6)
  • (added) llvm/test/CodeGen/AMDGPU/GlobalISel/test_g_load_vector_to_scalar.mir (+25)
diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp
index bec36b728ae328..1866d3ae2b285a 100644
--- a/llvm/lib/CodeGen/MachineVerifier.cpp
+++ b/llvm/lib/CodeGen/MachineVerifier.cpp
@@ -1274,6 +1274,12 @@ void MachineVerifier::verifyPreISelGenericInstruction(const MachineInstr *MI) {
         if (TypeSize::isKnownGT(MMO.getSize().getValue(),
                                 ValTy.getSizeInBytes()))
           report("load memory size cannot exceed result size", MI);
+
+        if (MMO.getRanges() && (ValTy.isVector() != MMO.getType().isVector())) {
+          report("scalar operands cannot be loaded into vector values and vice "
+                 "versa",
+                 MI);
+        }
       } else if (MI->getOpcode() == TargetOpcode::G_STORE) {
         if (TypeSize::isKnownLT(ValTy.getSizeInBytes(),
                                 MMO.getSize().getValue()))
diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/test_g_load_vector_to_scalar.mir b/llvm/test/CodeGen/AMDGPU/GlobalISel/test_g_load_vector_to_scalar.mir
new file mode 100644
index 00000000000000..95429127c30d0c
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/test_g_load_vector_to_scalar.mir
@@ -0,0 +1,25 @@
+# RUN: not --crash llc -mtriple=amdgcn-mesa-mesa3d -mcpu=tahiti -run-pass=amdgpu-prelegalizer-combiner -verify-machineinstrs %s -o -
+--- |
+  define void @range_metadata_sext_i33_signed_range_i64_load_as_v2i32() {
+    ret void
+  }
+
+  !1 = !{i64 -8589934591, i64 8589934592}
+
+...
+---
+name:            range_metadata_sext_i33_signed_range_i64_load_as_v2i32
+tracksRegLiveness: true
+body:             |
+  bb.0:
+    liveins: $vgpr0, $vgpr1
+
+    %1:_(s32) = COPY $vgpr0
+    %2:_(s32) = COPY $vgpr1
+    %0:_(p1) = G_MERGE_VALUES %1(s32), %2(s32)
+    ; CHECK: Bad machine code: scalar operands cannot be loaded into vector values
+    %3:_(<2 x s32>) = G_LOAD %0(p1) :: (volatile load (s64), align 4, !range !1, addrspace 1)
+    $vgpr0_vgpr1 = COPY %3
+    SI_RETURN implicit $vgpr0_vgpr1
+
+...

@parsifal-47
Copy link
Contributor Author

@arsenm please take a look when you have a chance, thank you!

@github-actions
Copy link

⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo.
Please turn off Keep my email addresses private setting in your account.
See LLVM Discourse for more information.

@parsifal-47
Copy link
Contributor Author

The failure does not look related to the change:

# | /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-54tww-1/llvm-project/github-pull-requests/libcxx/test/benchmarks/locale/num_get.bench.cpp:32:1: error: template specialization requires 'template<>'
# |    32 | BENCHMARK(BM_num_get<bool>);

@arsenm please take a look when you have a chance, thank you!

@@ -0,0 +1,25 @@
# RUN: not --crash llc -mtriple=amdgcn-mesa-mesa3d -mcpu=tahiti -run-pass=amdgpu-prelegalizer-combiner -verify-machineinstrs %s -o -
Copy link
Contributor

Choose a reason for hiding this comment

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

This belongs in test/MachineVerifier, and can use -run-pass=none (and does not need -verify-machineinstrs).

You should also include all the cases in the test I added to the bug (you'll probably need to merge the different MIR instructions into one function to test them in one mir file)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved and updated, thank you!

ValTy.getSizeInBytes()))
report("load memory size cannot exceed result size", MI);

if (MMO.getRanges() && (ValTy.isVector() != MMO.getType().isVector())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't quite right. You're checking a different condition than #97290 is asking for. Neither of the checked types are from MMO.getRanges. We probably should have a similar check, without requiring ranges, but I believe we're relying on the current behavior so it's beyond the scope of this patch.

Instead you should be verifying the IR type in MMO.getRanges() against ValTy and MMO.getType()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is something I likely do not understand,
I can get a type from range for example like this:
mdconst::dyn_extract<ConstantInt>(MMO.getRanges()->getOperand(0))->getType()
but there is no other option but ConstantInt, so it cannot be vector, and that was the reason I checked for range presence because I was thinking it indicates scalar nature of the value.
Let's assume, I have this type now, what should I check for, should int type of the range be equal to ValTy?
Should I check all three to be the same? Or should I just check for vector vs scalar mismatches?

Thank you for your help!

Copy link
Contributor

Choose a reason for hiding this comment

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

You get the scalar integer type out of mdconst::extract<ConstantInt>(MMO.getRanges()->getOperand(0))->getType(). You need to verify the MIR result type has the same scalar type, something like ValTy.getScalarType()->getSizeInBits() == mdconst::extract<ConstantInt>(MMO.getRanges()->getOperand(0)).getIntegerType()->getBitWidth(). Whether the MIR type is vector isn't as significant as whether the element type matches the range IR type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure I understood it correctly, if I get the bitWidth, it will be 64 in all three cases and types will be compatible, but if I take actual bits that are used by lower and higher bounds of the range, it breaks existing tests. Please take a look at the updated code and let me know what am I missing. Thank you for your patience!

Copy link
Contributor

Choose a reason for hiding this comment

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

This set of IR tests happens to only use 64-bit values

, it breaks existing tests.

It's possible there are broken tests or bugs, that's why we write these verifiers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have made fixes to two newly failing tests, please take a look if I understand the way to do it, thank you!

@parsifal-47 parsifal-47 force-pushed the machine-verifier-load-inconsistencies branch from 565ba0e to b76c3df Compare January 5, 2025 15:54
@github-actions
Copy link

github-actions bot commented Jan 6, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

%1:_(s32) = COPY $vgpr0
%2:_(s32) = COPY $vgpr1
%0:_(p1) = G_MERGE_VALUES %1(s32), %2(s32)
; CHECK: Bad machine code: range is incompatible with the value it gets assigned to
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the verifier aborts after the first function fails, but keeps printing errors in the functions. As a consequence you would need all of these cases tested in one function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure if I understood it correctly, I put them all in one function, but now they look too similar, please take a look, thank you!

ConstantInt *i = mdconst::dyn_extract<ConstantInt>(o);
if (!i->isNegative())
return i->getValue().getActiveBits();
APInt reversed(i->getValue());
Copy link
Contributor

Choose a reason for hiding this comment

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

You shouldn't need to consider anything about the value of the range, only the type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is something I still do not understand:

The verifier should reject cases like this:
...
!0 = !{i64 -4294967295, i64 4294967296}
...
%3:_(<2 x s32>) = G_LOAD %0(p1) :: (volatile load (s64), align 4, !range !0, addrspace 1)

but if we get the information about the type, it is "i64" and there is a match between 2*32 == 64, no issues, you mentioned vector or scalar is not important, what would be the reason to reject this instruction?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@arsenm could you please help me understand this piece, it looks like if I rely on type information alone, the cases that are mentioned in the description of this bug would be still legal. Thank you!

Copy link
Contributor

Choose a reason for hiding this comment

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

there is a match between 2*32 == 64

This is the problem, it's not a match. The total bitwidth is not what matters, the scalar type does. It would be OK if this was a <2 x s64> result and the range was using i64. tttt

i.e. the vectorness doesn't matter, nor the total bit width. The scalar type interpretation on both halves is what matters

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thank you for the explanation, I will get back with updated code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated, please take a look

@parsifal-47
Copy link
Contributor Author

@arsenm please take a look when you have a chance, I think I resolved all your comments, but feel free to add more, thank you!

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.

Change essentially LGTM with some rephrasing of the message and some more variety in the test

@parsifal-47
Copy link
Contributor Author

Change essentially LGTM with some rephrasing of the message and some more variety in the test

Thank you for the review and code suggestions, all should be resolved now!

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.

Close, just a little more test cleanup

!0 = !{i24 0, i24 1048575}
!1 = !{!"omnipotent char", !2}
!2 = !{!"Simple C/C++ TBAA"}
!3 = !{i32 0, i32 1048575}
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't touch the input IR. However this makes me realize we are violating the principle that we shouldn't touch the underlying IR in codegen. I guess global metadata constants could be an exception

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry, I do not understand how to resolve the comment, this test started to fail because i24 range is used on i32 value, I have forked this range with i32 to make the test pass, should I change this test or should I change the check? Thank you!

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it depends how we want to handle extending loads. As written, I think we should leave the test for now. However that means you need to adjust from checking the result memory type, to the memory type in the MachineMemOperand

Copy link
Contributor Author

Choose a reason for hiding this comment

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

got it, thank you!

!0 = !{i96 0, i96 9223372036854775808}
!1 = !{!"omnipotent char", !2}
!2 = !{!"Simple C/C++ TBAA"}
!3 = !{i32 0, i32 4294967295}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same, shouldn't need to modify the input IR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the instruction here:

    %1:_(<3 x s32>) = G_LOAD %0 :: (load (<3 x s32>), align 8, addrspace 4, !range !3)

how would you recommend to alter the test to make it pass?

}

!0 = !{i64 -4294967295, i64 4294967296}
!1 = !{i64 -8589934591, i64 8589934592}
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need 2 i64 ranges with different values. Just need one, or test multiple range types for different instruction types

Copy link
Contributor Author

Choose a reason for hiding this comment

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

range removed, thank you!

!0 = !{i24 0, i24 1048575}
!1 = !{!"omnipotent char", !2}
!2 = !{!"Simple C/C++ TBAA"}
!3 = !{i32 0, i32 1048575}
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it depends how we want to handle extending loads. As written, I think we should leave the test for now. However that means you need to adjust from checking the result memory type, to the memory type in the MachineMemOperand

ConstantInt *i =
mdconst::extract<ConstantInt>(MMO.getRanges()->getOperand(0));
if (i->getIntegerType()->getBitWidth() !=
ValTy.getScalarType().getSizeInBits()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ValTy.getScalarType().getSizeInBits()) {
MMO.getMemoryType().getScalarSizeInBits()) {

This should continue to permit the extending load case to use range metadata. Verifying the result type is trickier since we need to account for valid extending loads

Copy link
Contributor

Choose a reason for hiding this comment

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

The change to use the memory type got lost

@parsifal-47
Copy link
Contributor Author

I noticed that tests are now failing, let me check the details and get back to you

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.

LGTM

@arsenm
Copy link
Contributor

arsenm commented Jan 23, 2025

We probably should do something about verifying the result types also are consistent, but that will probably require touching the legalizer. Plus we should verify that computeKnownBits does the right thing in the extended result cases

@arsenm
Copy link
Contributor

arsenm commented Jan 24, 2025

Test still failing

@parsifal-47
Copy link
Contributor Author

Test still failing

Should be good now, but

  1. switching from checking value type to rhs makes new negative test to pass
  2. this in turn made me reverse the change for legalize-load-memory-metadata.mir
  3. multiple checks for error messages within one negative test do not work because it crashes once, I can split three negative cases in three files or keep single check for error message

Let me know what do you think, thank you!

@arsenm arsenm merged commit 11db7fb into llvm:main Jan 28, 2025
8 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jan 28, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-sie-ubuntu-fast running on sie-linux-worker while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/144/builds/16803

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: MachineVerifier/test_g_incompatible_range.mir' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: not --crash /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx942 -run-pass=none -filetype=null /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir 2>&1 | /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/FileCheck /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir
+ not --crash /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx942 -run-pass=none -filetype=null /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir
+ /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/FileCheck /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir
�[1m/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir:21:11: �[0m�[0;1;31merror: �[0m�[1mCHECK: expected string not found in input
�[0m ; CHECK: Bad machine code: range is incompatible with the result type
�[0;1;32m          ^
�[0m�[1m<stdin>:1:1: �[0m�[0;1;30mnote: �[0m�[1mscanning from here
�[0m/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/llc: error: unable to get target for 'amdgcn-amd-amdhsa', see --version and --triple.
�[0;1;32m^
�[0m�[1m<stdin>:1:122: �[0m�[0;1;30mnote: �[0m�[1mpossible intended match here
�[0m/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/llc: error: unable to get target for 'amdgcn-amd-amdhsa', see --version and --triple.
�[0;1;32m                                                                                                                         ^
�[0m
Input file: <stdin>
Check file: /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir

-dump-input=help explains the following input dump.

Input was:
<<<<<<
�[1m�[0m�[0;1;30m            1: �[0m�[1m�[0;1;46m/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/llc: error: unable to get target for 'amdgcn-amd-amdhsa', see --version and --triple. �[0m
�[0;1;31mcheck:21'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
�[0m�[0;1;35mcheck:21'1                                                                                                                              ?                                      possible intended match
�[0m>>>>>>

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Jan 28, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-aarch64-darwin running on doug-worker-5 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/13645

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: MachineVerifier/test_g_incompatible_range.mir' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: not --crash /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx942 -run-pass=none -filetype=null /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir 2>&1 | /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir
+ not --crash /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx942 -run-pass=none -filetype=null /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir
+ /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir
�[1m/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir:21:11: �[0m�[0;1;31merror: �[0m�[1mCHECK: expected string not found in input
�[0m ; CHECK: Bad machine code: range is incompatible with the result type
�[0;1;32m          ^
�[0m�[1m<stdin>:1:1: �[0m�[0;1;30mnote: �[0m�[1mscanning from here
�[0m/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/llc: error: unable to get target for 'amdgcn-amd-amdhsa', see --version and --triple.
�[0;1;32m^
�[0m�[1m<stdin>:1:104: �[0m�[0;1;30mnote: �[0m�[1mpossible intended match here
�[0m/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/llc: error: unable to get target for 'amdgcn-amd-amdhsa', see --version and --triple.
�[0;1;32m                                                                                                       ^
�[0m
Input file: <stdin>
Check file: /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir

-dump-input=help explains the following input dump.

Input was:
<<<<<<
�[1m�[0m�[0;1;30m            1: �[0m�[1m�[0;1;46m/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/llc: error: unable to get target for 'amdgcn-amd-amdhsa', see --version and --triple. �[0m
�[0;1;31mcheck:21'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
�[0m�[0;1;35mcheck:21'1                                                                                                            ?                                      possible intended match
�[0m>>>>>>

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Jan 28, 2025

LLVM Buildbot has detected a new failure on builder llvm-nvptx-nvidia-ubuntu running on as-builder-7 while building llvm at step 6 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/180/builds/12107

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: MachineVerifier/test_g_incompatible_range.mir' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: not --crash /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx942 -run-pass=none -filetype=null /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir 2>&1 | /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir
+ not --crash /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx942 -run-pass=none -filetype=null /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir
+ /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir
/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir:21:11: error: CHECK: expected string not found in input
 ; CHECK: Bad machine code: range is incompatible with the result type
          ^
<stdin>:1:1: note: scanning from here
/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/llc: error: unable to get target for 'amdgcn-amd-amdhsa', see --version and --triple.
^
<stdin>:1:127: note: possible intended match here
/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/llc: error: unable to get target for 'amdgcn-amd-amdhsa', see --version and --triple.
                                                                                                                              ^

Input file: <stdin>
Check file: /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/llc: error: unable to get target for 'amdgcn-amd-amdhsa', see --version and --triple. 
check:21'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:21'1                                                                                                                                   ?                                      possible intended match
>>>>>>

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Jan 28, 2025

LLVM Buildbot has detected a new failure on builder llvm-nvptx64-nvidia-ubuntu running on as-builder-7 while building llvm at step 6 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/160/builds/12110

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: MachineVerifier/test_g_incompatible_range.mir' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: not --crash /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx942 -run-pass=none -filetype=null /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir 2>&1 | /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir
+ not --crash /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx942 -run-pass=none -filetype=null /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir
+ /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir
/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir:21:11: error: CHECK: expected string not found in input
 ; CHECK: Bad machine code: range is incompatible with the result type
          ^
<stdin>:1:1: note: scanning from here
/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/llc: error: unable to get target for 'amdgcn-amd-amdhsa', see --version and --triple.
^
<stdin>:1:129: note: possible intended match here
/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/llc: error: unable to get target for 'amdgcn-amd-amdhsa', see --version and --triple.
                                                                                                                                ^

Input file: <stdin>
Check file: /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/MachineVerifier/test_g_incompatible_range.mir

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/llc: error: unable to get target for 'amdgcn-amd-amdhsa', see --version and --triple. 
check:21'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:21'1                                                                                                                                     ?                                      possible intended match
>>>>>>

--

********************


@parsifal-47
Copy link
Contributor Author

thank you @arsenm !
I have noticed that buildbot found something wrong with -mtriple=amdgcn-amd-amdhsa, should I change it to something else?

@arsenm
Copy link
Contributor

arsenm commented Jan 28, 2025

thank you @arsenm ! I have noticed that buildbot found something wrong with -mtriple=amdgcn-amd-amdhsa, should I change it to something else?

No, it just required the target to be build. I moved the test in ee1c6a6

@parsifal-47
Copy link
Contributor Author

No, it just required the target to be build. I moved the test in ee1c6a6

Great, thank you for your help and support!

@vvereschaka
Copy link
Contributor

@arsenm , @parsifal-47 ,

looks like these changes cause a failure of `LLVM :: CodeGen/AArch64/setcc_knownbits.ll' test on the expensive checks builder here
https://lab.llvm.org/buildbot/#/builders/187/builds/4023/steps/6/logs/FAIL__LLVM__setcc_knownbits_ll

*** Bad machine code: range is incompatible with the result type ***
- function:    logger
- basic block: %bb.2 land.rhs (0x55e1d64bd310)
- instruction: %16:_(s32) = G_LOAD %5:_(p0) :: (load (s8) from %ir.1, !range !0)
LLVM ERROR: Found 1 machine code errors.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /home/buildbot/worker/temp/build/bin/llc -mtriple=aarch64 -global-isel
1.      Running pass 'Function Pass Manager' on module '<stdin>'.
2.      Running pass 'Verify generated machine code' on function '@logger'
...

I found a problematic commit by bisecting though the commits for this buildbot's build. Reverting of these changes fixes the test.
Would you check it on your side accordingly?

@arsenm
Copy link
Contributor

arsenm commented Jan 29, 2025

Fix in #124894

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.

5 participants