-
Notifications
You must be signed in to change notification settings - Fork 50
GEMM+GEMM migraphx integration #1791
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
bd2c24e to
54237b0
Compare
2b1e306 to
5fb22e3
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1791 +/- ##
===========================================
- Coverage 78.60% 78.49% -0.11%
===========================================
Files 99 100 +1
Lines 29389 29885 +496
Branches 4379 4451 +72
===========================================
+ Hits 23100 23458 +358
- Misses 4492 4591 +99
- Partials 1797 1836 +39
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| // ALLOW_RETRIES: 2 | ||
| // CHECK: [1 1 1] | ||
| module { | ||
| func.func private @mlir_gemm_gemm(%arg0: !migraphx.shaped<1x64x64xf32, 4096x64x1> {mhal.read_access}, %arg1: !migraphx.shaped<1x64x64xf32, 4096x64x1> {mhal.read_access}, %arg2: !migraphx.shaped<1x64x64xf32, 4096x64x1> {mhal.read_access}) -> (!migraphx.shaped<1x64x64xf32, 4096x64x1> {mhal.write_access}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the Fp32 i think if you just use --clone-harness it should work without running into any accuracy issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, the reason it's like this is because I copied the tests from mixr-attention.mlir. I'll change it.
| @@ -0,0 +1,14 @@ | |||
| // RUN: rocmlir-gen -fut mlir_gemm_gemm_where --arch %arch --clone-harness %s | rocmlir-driver -kernel-pipeline=migraphx | rocmlir-driver -host-pipeline=migraphx,highlevel | rocmlir-gen -ph -rand 1 -rand_type float -fut mlir_gemm_gemm_where_wrapper --verifier clone - | rocmlir-driver -host-pipeline mhal -kernel-pipeline full | xmir-runner --shared-libs=%linalg_test_lib_dir/libmlir_rocm_runtime%shlibext,%conv_validation_wrapper_library_dir/libconv-validation-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext,%linalg_test_lib_dir/libmlir_float16_utils%shlibext,%linalg_test_lib_dir/libmlir_c_runner_utils%shlibext,%linalg_test_lib_dir/libmlir_async_runtime%shlibext --entry-point-result=void | FileCheck %s | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: it is More like gemm_where_gemm and not gemm_gemm_where
| // ALLOW_RETRIES: 2 | ||
| // CHECK: [1 1 1] | ||
| module { | ||
| func.func private @mlir_gemm_gemm(%arg0: !migraphx.shaped<1x4x32x32xf32, 4096x1024x32x1> {mhal.read_access}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why you need to attach mhal.read_access etc. if you are using clone-harness
| // ALLOW_RETRIES: 2 | ||
| // CHECK: [1 1 1] | ||
| module { | ||
| func.func private @mlir_gemm_gemm(%arg0: !migraphx.shaped<1x7x3xf32, 21x3x1> {mhal.read_access}, %arg1: !migraphx.shaped<1x3x7xf32, 21x7x1> {mhal.read_access}, %arg2: !migraphx.shaped<1x7x3xf32, 21x3x1> {mhal.read_access}) -> (!migraphx.shaped<1x7x3xf32, 21x3x1> {mhal.write_access}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you creating wrapper spearately and not using --clone-harness ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, just copied some existing attention tests and adapted to gemm+gemm. I'll change it.
3f02a22 to
d7ad776
Compare
5fb22e3 to
0fe28f6
Compare
4821b84 to
8d27a5c
Compare
0fe28f6 to
ef9080c
Compare
| } | ||
| }; | ||
|
|
||
| struct GemmElementwiseGemmRewritePattern |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there opportunity to use GemmGemmWrapperInterface here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I was about to push some changes re this
| func.func private @mlir_gemm_gemm(%arg0: !migraphx.shaped<1x7x3xf32, 21x3x1> {mhal.read_access}, | ||
| %arg1: !migraphx.shaped<1x3x7xf32, 21x7x1> {mhal.read_access}, | ||
| %arg2: !migraphx.shaped<1x7x3xf32, 21x3x1> {mhal.read_access}, | ||
| %arg3: !migraphx.shaped<1x7x7xf32, 49x7x1> {mhal.read_access}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need mhal stuff here ?
d3372a5 to
b04068b
Compare
b04068b to
ad9a71b
Compare
This PR depends on #1774, that PR needs to be merged first.
In this PR we add migraphx integration and end-to-end tests in migraphx dialect. The end-to-end tests are based on attention tests.
TODO: