Skip to content

Conversation

Old-cpu
Copy link
Contributor

@Old-cpu Old-cpu commented Aug 24, 2025

Improved math operation tests and modified the following file formats

  • test_sigmoid.py
  • test_relu.py
  • test_max_pool2d.py
  • test_iota.py

# CHECK: return %{{.*}}
# CHECK: }
# CHECK: }

Copy link
Member

@linuxlonelyeagle linuxlonelyeagle Aug 28, 2025

Choose a reason for hiding this comment

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

Avoid unnecessary checks whenever possible.Pay attention to the aesthetics of the formatting; the following approach should look much nicer.
Here you should not use {{.*}}; you should capture the variable name.

# CHECK-LABEL: func @forward
#       CHECK: %{{.*}} = math.erf 
#       CHECK: return %{{.*}}
#       CHECK: }

Copy link
Member

@linuxlonelyeagle linuxlonelyeagle left a comment

Choose a reason for hiding this comment

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

Leave a few simple comments.

print(graph._imported_module)

# CHECK: module {
# CHECK-LABEL: func.func @forward
Copy link
Member

Choose a reason for hiding this comment

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

The same goes for the test below; I think you can modify them together.

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 your suggestion , I'll continue to improve this PR

@linuxlonelyeagle
Copy link
Member

@Old-cpu use rebase, don't use merge

@Old-cpu
Copy link
Contributor Author

Old-cpu commented Aug 30, 2025

@Old-cpu use rebase, don't use merge
Got it, I'll edit it tomorrow

@linuxlonelyeagle
Copy link
Member

Let me give an example.

# CHECK-LABEL: func.func @forward
# CHECK: %{{[a-zA-Z0-9_]+}} = math.cos 
# CHECK: return %{{[a-zA-Z0-9_]+}}
# CHECK: }

You should let it become.

# CHECK-LABEL: func.func @forward
#       CHECK: %[[cos:.*]] = math.cos 
#       CHECK: return %[[cos]]
#       CHECK: }

@Old-cpu
Copy link
Contributor Author

Old-cpu commented Sep 1, 2025

I understand what you mean, I will modify it immediately

Copy link
Member

@linuxlonelyeagle linuxlonelyeagle left a comment

Choose a reason for hiding this comment

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

# CHECK-LABEL: func.func @forward
# CHECK: %[[cos:.*]] = math.cos
# CHECK: return %[[cos]]

Copy link
Member

Choose a reason for hiding this comment

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

I was wondering if you left two blank lines at the end—just one would suffice.

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 was wondering if you left two blank lines at the end—just one would suffice.

Yes, I left two blank lines locally, but if I only leave one blank line, there will be no blank line when I submit it.

@zhanghb97
Copy link
Member

Please check the following error from the CI:

FAIL: BUDDY :: Python/test_max_pool2d.py (79 of 97)
******************** TEST 'BUDDY :: Python/test_max_pool2d.py' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /home/buddy/miniconda3/envs/buddy/bin/python3 /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/tests/Python/test_max_pool2d.py 2>&1 | /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/llvm/build/bin/FileCheck /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/tests/Python/test_max_pool2d.py
+ /home/buddy/miniconda3/envs/buddy/bin/python3 /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/tests/Python/test_max_pool2d.py
+ /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/llvm/build/bin/FileCheck /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/tests/Python/test_max_pool2d.py
/home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/tests/Python/test_max_pool2d.py:40:10: error: CHECK: expected string not found in input
# CHECK: return %[[transpose_2]]s
         ^
<stdin>:7:21: note: scanning from here
 %4 = tosa.transpose %2, %3 : (tensor<1x214x160x3xf32>, tensor<4xi32>) -> tensor<1x3x214x160xf32>
                    ^
<stdin>:7:21: note: with "transpose_2" equal to "4"
 %4 = tosa.transpose %2, %3 : (tensor<1x214x160x3xf32>, tensor<4xi32>) -> tensor<1x3x214x160xf32>
                    ^
<stdin>:8:2: note: possible intended match here
 return %4 : tensor<1x3x214x160xf32>
 ^

Input file: <stdin>
Check file: /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/tests/Python/test_max_pool2d.py

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

Input was:
<<<<<<
            1: module { 
            2:  func.func @forward(%arg0: tensor<1x3x640x480xf32>) -> tensor<1x3x214x160xf32> { 
            3:  %0 = "tosa.const"() <{value = dense<[0, 2, 3, 1]> : tensor<4xi32>}> : () -> tensor<4xi32> 
            4:  %1 = tosa.transpose %arg0, %0 : (tensor<1x3x640x480xf32>, tensor<4xi32>) -> tensor<1x640x480x3xf32> 
            5:  %2 = tosa.max_pool2d %1 {kernel = array<i64: 5, 5>, pad = array<i64: 2, 2, 2, 2>, stride = array<i64: 3, 3>} : (tensor<1x640x480x3xf32>) -> tensor<1x214x160x3xf32> 
            6:  %3 = "tosa.const"() <{value = dense<[0, 3, 1, 2]> : tensor<4xi32>}> : () -> tensor<4xi32> 
            7:  %4 = tosa.transpose %2, %3 : (tensor<1x214x160x3xf32>, tensor<4xi32>) -> tensor<1x3x214x160xf32> 
check:40'0                         X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:40'1                                                                                                        with "transpose_2" equal to "4"
            8:  return %4 : tensor<1x3x214x160xf32> 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:40'2      ?                                    possible intended match
            9:  } 
check:40'0     ~~~
           10: } 
check:40'0     ~~
           11:  
check:40'0     ~
>>>>>>

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
********************
Failed Tests (1):
  BUDDY :: Python/test_max_pool2d.py


Testing Time: 66.88s

Total Discovered Tests: 97
  Passed: 96 (98.97%)
  Failed:  1 (1.03%)
FAILED: tests/CMakeFiles/check-tests /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/build/tests/CMakeFiles/check-tests 
cd /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/build/tests && /home/buddy/miniconda3/envs/buddy/bin/python3 /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/llvm/build/./bin/llvm-lit -sv /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/build/tests
ninja: build stopped: subcommand failed.

@zhanghb97 zhanghb97 added ci Related to CI/CD final review labels Sep 17, 2025
@Old-cpu
Copy link
Contributor Author

Old-cpu commented Sep 23, 2025

Please check the following error from the CI:请检查来自 CI 的以下错误:

FAIL: BUDDY :: Python/test_max_pool2d.py (79 of 97)
******************** TEST 'BUDDY :: Python/test_max_pool2d.py' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /home/buddy/miniconda3/envs/buddy/bin/python3 /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/tests/Python/test_max_pool2d.py 2>&1 | /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/llvm/build/bin/FileCheck /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/tests/Python/test_max_pool2d.py
+ /home/buddy/miniconda3/envs/buddy/bin/python3 /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/tests/Python/test_max_pool2d.py
+ /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/llvm/build/bin/FileCheck /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/tests/Python/test_max_pool2d.py
/home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/tests/Python/test_max_pool2d.py:40:10: error: CHECK: expected string not found in input
# CHECK: return %[[transpose_2]]s
         ^
<stdin>:7:21: note: scanning from here
 %4 = tosa.transpose %2, %3 : (tensor<1x214x160x3xf32>, tensor<4xi32>) -> tensor<1x3x214x160xf32>
                    ^
<stdin>:7:21: note: with "transpose_2" equal to "4"
 %4 = tosa.transpose %2, %3 : (tensor<1x214x160x3xf32>, tensor<4xi32>) -> tensor<1x3x214x160xf32>
                    ^
<stdin>:8:2: note: possible intended match here
 return %4 : tensor<1x3x214x160xf32>
 ^

Input file: <stdin>
Check file: /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/tests/Python/test_max_pool2d.py

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

Input was:
<<<<<<
            1: module { 
            2:  func.func @forward(%arg0: tensor<1x3x640x480xf32>) -> tensor<1x3x214x160xf32> { 
            3:  %0 = "tosa.const"() <{value = dense<[0, 2, 3, 1]> : tensor<4xi32>}> : () -> tensor<4xi32> 
            4:  %1 = tosa.transpose %arg0, %0 : (tensor<1x3x640x480xf32>, tensor<4xi32>) -> tensor<1x640x480x3xf32> 
            5:  %2 = tosa.max_pool2d %1 {kernel = array<i64: 5, 5>, pad = array<i64: 2, 2, 2, 2>, stride = array<i64: 3, 3>} : (tensor<1x640x480x3xf32>) -> tensor<1x214x160x3xf32> 
            6:  %3 = "tosa.const"() <{value = dense<[0, 3, 1, 2]> : tensor<4xi32>}> : () -> tensor<4xi32> 
            7:  %4 = tosa.transpose %2, %3 : (tensor<1x214x160x3xf32>, tensor<4xi32>) -> tensor<1x3x214x160xf32> 
check:40'0                         X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:40'1                                                                                                        with "transpose_2" equal to "4"
            8:  return %4 : tensor<1x3x214x160xf32> 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:40'2      ?                                    possible intended match
            9:  } 
check:40'0     ~~~
           10: } 
check:40'0     ~~
           11:  
check:40'0     ~
>>>>>>

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
********************
Failed Tests (1):
  BUDDY :: Python/test_max_pool2d.py


Testing Time: 66.88s

Total Discovered Tests: 97
  Passed: 96 (98.97%)
  Failed:  1 (1.03%)
FAILED: tests/CMakeFiles/check-tests /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/build/tests/CMakeFiles/check-tests 
cd /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/build/tests && /home/buddy/miniconda3/envs/buddy/bin/python3 /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/llvm/build/./bin/llvm-lit -sv /home/buddy/actions-runner/_work/buddy-mlir/buddy-mlir/build/tests
ninja: build stopped: subcommand failed.

OK, it has been modified. Please review it when you have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Related to CI/CD final review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants