Skip to content

[AMDGPU] Do not rewrite or approximate math functions on ROCm - #20222

Merged
bjacob merged 1 commit into
iree-org:mainfrom
bjacob:reland
Mar 12, 2025
Merged

bjacob merged 1 commit into
iree-org:mainfrom
bjacob:reland

Conversation

@bjacob

@bjacob bjacob commented Mar 12, 2025 •

Copy link
Copy Markdown
Collaborator

This is the re-landing of #19970 which was rolled back due to a ONNX test failure which we want to accept as its root cause is a torch-mlir bug:
llvm/torch-mlir#4091

This reverts commit 00e8873.

This is the re-landing iree-org#19970 which was rolled back
due to a ONNX test failure which we want to accept
as its root cause is a torch-mlir bug:
llvm/torch-mlir#4091

This reverts commit 00e8873.

Signed-off-by: Benoit Jacob <[email protected]>
@bjacob
bjacob marked this pull request as ready for review March 12, 2025 15:55
@bjacob
bjacob requested a review from hanhanW as a code owner March 12, 2025 15:55
@bjacob
bjacob requested a review from qedawkins March 12, 2025 16:23
@bjacob
bjacob enabled auto-merge (squash) March 12, 2025 16:23
@bjacob
bjacob merged commit db5b69a into iree-org:main Mar 12, 2025
@ScottTodd ScottTodd mentioned this pull request Mar 14, 2025
5 of 6 tasks
@AmosLewis

AmosLewis commented Mar 17, 2025 •

Copy link
Copy Markdown
Contributor

This patch led to llama3.1 input lenth 128 benchmark time drop from 27.5ms to 29.8ms. Here is the bisect command and log to locate the regression: bisect-log-3.12-3.13-00e-445.sh, In the log I also list the mlir file and benchmark command and inputs to run it. @bjacob could you take a look at, this has to be fixed this week for llama performance submission on March 24.

bisect on iree-3.3.0rc20250316
https://github.com/iree-org/iree/blob/main/build_tools/pkgci/bisect/bisect_packages.py
https://github.com/iree-org/iree/blob/main/build_tools/pkgci/bisect/README.md

@bjacob

bjacob commented Mar 17, 2025

Copy link
Copy Markdown
Collaborator Author

@AmosLewis , thanks for the report. In order to reproduce, I seem to need a file named fp8_attn.irpa. Where could I download it ?

@AmosLewis

Copy link
Copy Markdown
Contributor

@AmosLewis , thanks for the report. In order to reproduce, I seem to need a file named fp8_attn.irpa. Where could I download it ?

It has been list in the link, here is it
wget https://sharkpublic.blob.core.windows.net/sharkpublic/chi/llama/atten/fp8_attn.mlir

@bjacob

bjacob commented Mar 17, 2025

Copy link
Copy Markdown
Collaborator Author

@AmosLewis , this should be fixed by #20281.

Also, it seems that with that fix, the net effect of this PR should become positive on your workload: I am getting 27.1 ms now, while your above #20222 (comment) mentioned 27.5 ms before the regression.

bjacob added a commit that referenced this pull request Mar 17, 2025
When in #20222 we dropped all math rewrites on ROCm, we lost an
important rewrite of `math.fpowi` to multiplications. This caused the
regression flagged by @AmosLewis in
#20222 (comment).

Signed-off-by: Benoit Jacob <[email protected]>
Eliasj42 pushed a commit that referenced this pull request Mar 24, 2025
When in #20222 we dropped all math rewrites on ROCm, we lost an
important rewrite of `math.fpowi` to multiplications. This caused the
regression flagged by @AmosLewis in
#20222 (comment).

Signed-off-by: Benoit Jacob <[email protected]>
Signed-off-by: Elias Joseph <[email protected]>
AWoloszyn pushed a commit that referenced this pull request Dec 1, 2025
This is the re-landing of #19970 which was rolled back due to a ONNX
test failure which we want to accept as its root cause is a torch-mlir
bug:
llvm/torch-mlir#4091

This reverts commit 00e8873.

Signed-off-by: Benoit Jacob <[email protected]>
AWoloszyn pushed a commit that referenced this pull request Dec 1, 2025
When in #20222 we dropped all math rewrites on ROCm, we lost an
important rewrite of `math.fpowi` to multiplications. This caused the
regression flagged by @AmosLewis in
#20222 (comment).

Signed-off-by: Benoit Jacob <[email protected]>
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.

3 participants