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

add sed script for operation renaming to allow xdsl-opt to handle maxf, fixes #142 #148

Merged
merged 6 commits into from
Jan 26, 2024

Conversation

AntonLydike
Copy link
Contributor

This fixes #142

This can probably be improved a bit, but thus far it works, and I can understand why. It works like this:

  • add a sed 's/arith.maxf/arith.maximumf/g' before each invocation of xdsl-opt, this translates the maxf we use everywhere else to the maximumf used by xdsl
  • add a sed 's/arith.maximumf/arith.maxf/g' after each invocation of xdsl-opt, translating maximumf back to maxf. Probably not needed, as the output seems to be .S and not an MLIR file, but I could be wrong?

@AntonLydike AntonLydike self-assigned this Jan 22, 2024
@AntonLydike
Copy link
Contributor Author

We can also investigate if this allows us to uncomment other tests.

Copy link

kernels baseline linalg scf_xdsl snitch_stream snrt min_llvm_mlir
conv2d_d1_s1_3x3 1x1x8x8xf64 1987 2104 1499 1486 1987
ddot 128xf64 929 1194 1582 570 550 929
dense 8x8xf64 3239 4494 2734 2709 3239
dsum 8x16xf32 1202 794 3564 194 187 794
fill 16x16xf64 370 347 2676 294 299 347
matmul 8x8xf64 4229 3816 21360 57 2304 3816
pooling_nchw_max_d1_s2_3x3 1x1x16x16xf64 1435 1201 24699 1118 1094 1201
pooling_nchw_sum_d1_s2_3x3 1x1x16x16xf64 2096 1948 24699 2000 1976 1948
relu 16x16xf64 1339 1074 5020 322 334 1074
softmax 16xf64 32611 32611

@@ -27,13 +27,14 @@ fill,16x16xf64,snrt,299
fill,16x16xf64,scf_xdsl,2676
matmul,8x8xf64,baseline,4229
matmul,8x8xf64,linalg,3816
matmul,8x8xf64,snitch_stream,2336
matmul,8x8xf64,snitch_stream,57
Copy link
Collaborator

Choose a reason for hiding this comment

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

sus

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed...

@superlopuh
Copy link
Collaborator

Do we need both? I think we should need only one, to translate to xDSL, we never go xDSL to MLIR, I don't think

@@ -1,5 +1,5 @@
module {
func.func public @relu(%arg0: memref<16x16xf64>, %arg1: memref<16x16xf64>) -> memref<16x16xf64> {
func.func public @relu(%arg0: memref<16x16xf64> {llvm.noalias}, %arg1: memref<16x16xf64> {llvm.noalias}) -> memref<16x16xf64> {
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 didn't introduce this change myself. Any idea how it got here?

Copy link
Contributor

Choose a reason for hiding this comment

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

hmm, weird, what does git blame say?

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'm still not sure what happened here, maybe I accidentally maked the file again from some other source? I didn't add them manually that's all.

After removing them and running make pivoted.csv again nothing changed, so I guess it's okay now?

Copy link

kernels baseline linalg scf_xdsl snitch_stream snrt min_llvm_mlir
conv2d_d1_s1_3x3 1x1x8x8xf64 1987 2104 1499 1486 1987
ddot 128xf64 929 1194 1582 570 550 929
dense 8x8xf64 3239 4494 2734 2709 3239
dsum 8x16xf32 1202 794 3564 194 187 794
fill 16x16xf64 370 347 2676 294 299 347
matmul 8x8xf64 4229 3816 21360 57 2304 3816
pooling_nchw_max_d1_s2_3x3 1x1x16x16xf64 1435 1201 24699 1118 1094 1201
pooling_nchw_sum_d1_s2_3x3 1x1x16x16xf64 2096 1948 24699 2000 1976 1948
relu 16x16xf64 1339 1074 5020 322 334 1074
softmax 16xf64 32611 32611

Copy link
Collaborator

@superlopuh superlopuh left a comment

Choose a reason for hiding this comment

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

Looks great! I have a feeling that a make clean and make pivoted.csv locally and pushing again should fix the CI

@AntonLydike
Copy link
Contributor Author

Looks great! I have a feeling that a make clean and make pivoted.csv locally and pushing again should fix the CI

Interesting, I thought I had done that already. I'll give it another go.

Copy link

kernels baseline linalg scf_xdsl snitch_stream snrt min_llvm_mlir
conv2d_d1_s1_3x3 1x1x8x8xf64 1559 2104 1499 1486 1559
ddot 128xf64 929 1194 1582 570 550 929
dense 8x8xf64 3239 4494 2734 2709 3239
dsum 8x16xf32 1202 794 3564 194 187 794
fill 16x16xf64 370 347 2676 294 299 347
<<<<<<< HEAD
matmul 8x8xf64 2562 3816 21360 2336 2304 2562
pooling_nchw_max_d1_s2_3x3 1x1x16x16xf64 1435 1201 1118 1094 1201
pooling_nchw_sum_d1_s2_3x3 1x1x16x16xf64 1948 1948 24699 2000 1976 1948
relu 16x16xf64 1081 1074 322 334 1074
softmax 16xf64 32613 32613
=======
matmul 8x8xf64 4229 3816 21360 57 2304 3816
pooling_nchw_max_d1_s2_3x3 1x1x16x16xf64 1435 1201 24699 1118 1094 1201
pooling_nchw_sum_d1_s2_3x3 1x1x16x16xf64 2096 1948 24699 2000 1976 1948
relu 16x16xf64 1339 1074 5020 322 334 1074
softmax 16xf64 32611 32611
>>>>>>> d9dad84 (add sed script for operation renaming to allow xdsl-opt to handle maxf)

find . -type d -name "*.x.logs" -print0 | xargs -0 rm -rf
find . -type f -name "*.S" -print0 | xargs -0 rm -f
find . -type f -name "*.ll" -print0 | xargs -0 rm -f
find . -type f -name "*.ll.mlir" -print0 | xargs -0 rm -f
Copy link
Contributor

@compor compor Jan 26, 2024

Choose a reason for hiding this comment

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

Can you please also add *.bc? for good measure

@AntonLydike
Copy link
Contributor Author

Rebased, reran all the numbers, should all be green now! Thanks everyone for your help!

Copy link

kernels baseline linalg scf_xdsl snitch_stream snrt min_llvm_mlir
conv2d_d1_s1_3x3 1x1x8x8xf64 1559 2104 1499 1486 1559
ddot 128xf64 929 1194 1582 570 550 929
dense 8x8xf64 3239 4494 2734 2709 3239
dsum 8x16xf32 1202 794 3564 194 187 794
fill 16x16xf64 370 347 2676 294 299 347
matmul 8x8xf64 2562 3816 21360 2324 2304 2562
pooling_nchw_max_d1_s2_3x3 1x1x16x16xf64 1435 1201 24699 1118 1094 1201
pooling_nchw_sum_d1_s2_3x3 1x1x16x16xf64 1948 1948 24699 2000 1976 1948
relu 16x16xf64 1081 1074 5020 322 334 1074
softmax 16xf64 32613 32613

Copy link

kernels baseline linalg scf_xdsl snitch_stream snrt min_llvm_mlir
conv2d_d1_s1_3x3 1x1x8x8xf64 1559 2104 1499 1486 1559
ddot 128xf64 929 1194 1582 570 550 929
dense 8x8xf64 3239 4494 2734 2709 3239
dsum 8x16xf32 1202 794 3564 194 187 794
fill 16x16xf64 370 347 2676 294 299 347
matmul 8x8xf64 2562 3816 21360 2324 2304 2562
pooling_nchw_max_d1_s2_3x3 1x1x16x16xf64 1435 1201 24699 1118 1094 1201
pooling_nchw_sum_d1_s2_3x3 1x1x16x16xf64 1948 1948 24699 2000 1976 1948
relu 16x16xf64 1081 1074 5020 322 334 1074
softmax 16xf64 32613 32613

@AntonLydike AntonLydike merged commit 7971d54 into main Jan 26, 2024
2 checks passed
Copy link

kernels baseline linalg scf_xdsl snitch_stream snrt min_llvm_mlir
conv2d_d1_s1_3x3 1x1x8x8xf64 1559 2104 1499 1486 1559
ddot 128xf64 929 1194 1582 570 550 929
dense 8x8xf64 3239 4494 2734 2709 3239
dsum 8x16xf32 1202 794 3564 194 187 794
fill 16x16xf64 370 347 2676 294 299 347
matmul 8x8xf64 2562 3816 21360 2324 2304 2562
pooling_nchw_max_d1_s2_3x3 1x1x16x16xf64 1435 1201 24699 1118 1094 1201
pooling_nchw_sum_d1_s2_3x3 1x1x16x16xf64 1948 1948 24699 2000 1976 1948
relu 16x16xf64 1081 1074 5020 322 334 1074
softmax 16xf64 32613 32613

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix renamed arith maximum operations
3 participants