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

[mono][interp] Add some missing opcodes for cfold #99055

Merged
merged 1 commit into from
Feb 29, 2024

Conversation

BrzVlad
Copy link
Member

@BrzVlad BrzVlad commented Feb 28, 2024

This regression was introduced by SSA change. Before SSA change we were adding superinstructions at the very end of the compilation process, so we would never encounter super instructions during cprop phase when cfolding takes place. This is no longer the case so we need to be able to fold patterns like ct + add.imm.

Fixes Normalize ASCII regression from wasm bench suite

This regression was introduced by SSA change. Before SSA change we were adding superinstructions at the very end of the compilation process, we would never encounter super instructions during cprop phase when cfolding takes place. This is no longer the case so we need to be able to fold patterns like `ct + add.imm`.

Fixes Normalize ASCII regression from wasm bench suite
@ghost
Copy link

ghost commented Feb 28, 2024

Tagging subscribers to this area: @BrzVlad, @kotlarmilos
See info in area-owners.md if you want to be subscribed.

Issue Details

This regression was introduced by SSA change. Before SSA change we were adding superinstructions at the very end of the compilation process, so we would never encounter super instructions during cprop phase when cfolding takes place. This is no longer the case so we need to be able to fold patterns like ct + add.imm.

Fixes Normalize ASCII regression from wasm bench suite

Author: BrzVlad
Assignees: BrzVlad
Labels:

area-Codegen-Interpreter-mono

Milestone: -

@BrzVlad BrzVlad merged commit 2c4dc3f into dotnet:main Feb 29, 2024
109 of 111 checks passed
BrzVlad added a commit to BrzVlad/runtime that referenced this pull request Mar 5, 2024
We will avoid running it if we know will do another iteration later (especially useful when first iteration is ssa disabled). It can still happen for it to run multiple times (when bblock optimization requests retry), but this should be very rare. This will save compilation time and should also remove the necessity of handling super instructions in constant folding pass.

Reverts dotnet#99055 since it is no longer necessary.
BrzVlad added a commit to BrzVlad/runtime that referenced this pull request Mar 5, 2024
We will avoid running it if we know will do another iteration later (especially useful when first iteration is ssa disabled). It can still happen for it to run multiple times (when bblock optimization requests retry), but this should be very rare. This will save compilation time and should also remove the necessity of handling super instructions in constant folding pass.

Reverts dotnet#99055 since it is no longer necessary.
BrzVlad added a commit to BrzVlad/runtime that referenced this pull request Mar 6, 2024
We will avoid running it if we know will do another iteration later (especially useful when first iteration is ssa disabled). It can still happen for it to run multiple times (when bblock optimization requests retry), but this should be very rare. This will save compilation time and should also remove the necessity of handling super instructions in constant folding pass.

Reverts dotnet#99055 since it is no longer necessary.
BrzVlad added a commit that referenced this pull request Mar 7, 2024
* [mono][interp] Remove most of hardcoded LDC instructions

They have little benefit. Also fix oversight which resulted in using MINT_LDC_I4_S only for byte sized integers.

* [mono][interp] Refactor fetching of immediate value for superinstructions

Make `get_sreg_imm` more flexible, by returning the immediate value and the mint type that this value can fit in.
Simplify return immediate handling by also applying conversion to immediate value, if necessary.

* [mono][interp] Avoid running super instruction pass more than once

We will avoid running it if we know will do another iteration later (especially useful when first iteration is ssa disabled). It can still happen for it to run multiple times (when bblock optimization requests retry), but this should be very rare. This will save compilation time and should also remove the necessity of handling super instructions in constant folding pass.

Reverts #99055 since it is no longer necessary.

* [mono][interp] Add a few super instructions with 32 bit immediates

Also add instructions for and/or + immediates.

* [mono][interp] Fix MINT_SHL_AND_ generation

and + ldc will already be transformed to a superinstruction, so this can also be simplified.

* Implement new superinsns in jiterpreter

* [mono][interp] Add explicit cast for clarity

---------

Co-authored-by: Katelyn Gadd <[email protected]>
Co-authored-by: Larry Ewing <[email protected]>
@github-actions github-actions bot locked and limited conversation to collaborators Mar 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants