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

optimizer: improve general code quality #42357

Merged
merged 1 commit into from
Sep 29, 2021
Merged

optimizer: improve general code quality #42357

merged 1 commit into from
Sep 29, 2021

Conversation

aviatesk
Copy link
Member

Built on top of #42355:

  • add more type signatures, add @nospecialize decls for callbacks
  • remove dead code
  • add some docs on SROA pass

@aviatesk aviatesk requested review from vtjnash and Keno September 23, 2021 04:39
@aviatesk aviatesk added the compiler:optimizer Optimization passes (mostly in base/compiler/ssair/) label Sep 23, 2021
@aviatesk aviatesk changed the title improve general optimizer code quality optimizer: improve general code quality Sep 23, 2021
Base automatically changed from avi/sroa to master September 23, 2021 18:44
@@ -110,7 +110,8 @@ function compute_value_for_use(ir::IRCode, domtree::DomTree, allblocks::Vector{I
end
end

function simple_walk(compact::IncrementalCompact, @nospecialize(defssa#=::AnySSAValue=#), pi_callback=(pi, idx)->false)
function simple_walk(compact::IncrementalCompact, @nospecialize(defssa::AnySSAValue),
Copy link
Member

Choose a reason for hiding this comment

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

Declaring a type on a @nospecialize argument is normally a bad idea, as it may severely penalize the call

Copy link
Member Author

Choose a reason for hiding this comment

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

Would you mind elaborating it ?
@nospecialize influences dispatches only at this moment, and I think every call of this function will be statically resolved anyway. And so I don't think there is any other effects than now we can get MethodError for wrong defssa types.

Copy link
Member

Choose a reason for hiding this comment

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

it removes it from the dispatch cache

@@ -148,12 +149,12 @@ function simple_walk(compact::IncrementalCompact, @nospecialize(defssa#=::AnySSA
end
end

function simple_walk_constraint(compact::IncrementalCompact, @nospecialize(defidx), @nospecialize(typeconstraint) = types(compact)[defidx])
function simple_walk_constraint(compact::IncrementalCompact, @nospecialize(defssa::AnySSAValue), @nospecialize(typeconstraint) = types(compact)[defssa])
Copy link
Member

Choose a reason for hiding this comment

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

same here

Comment on lines +759 to +763
# global assertion_counter
# assertion_counter::Int += 1
Copy link
Member

Choose a reason for hiding this comment

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

🙀

Copy link
Member Author

Choose a reason for hiding this comment

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

We need another optimizer that optimizes our optimizer :p

Copy link
Member Author

Choose a reason for hiding this comment

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

A bit seriously, we may want to put more efforts on integrating JET with Julia base.

@aviatesk aviatesk force-pushed the avi/sroa2 branch 3 times, most recently from a023da6 to d936b81 Compare September 28, 2021 14:51
@aviatesk
Copy link
Member Author

Should be good to go once CI passes successfully.

@aviatesk aviatesk added the merge me PR is reviewed. Merge when all tests are passing label Sep 28, 2021
Built on top of #42355:
- add more type signatures
- add more `@nospecialize` decls
- remove dead/debug code
- add some docs on SROA and ADCE passes
@aviatesk aviatesk closed this Sep 29, 2021
@aviatesk aviatesk reopened this Sep 29, 2021
@aviatesk aviatesk merged commit 2fd4d2b into master Sep 29, 2021
@aviatesk aviatesk deleted the avi/sroa2 branch September 29, 2021 17:32
@aviatesk aviatesk removed the merge me PR is reviewed. Merge when all tests are passing label Sep 29, 2021
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Feb 22, 2022
- add more type signatures
- add more `@nospecialize` decls
- remove dead/debug code
- add some docs on SROA and ADCE passes
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Mar 8, 2022
- add more type signatures
- add more `@nospecialize` decls
- remove dead/debug code
- add some docs on SROA and ADCE passes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:optimizer Optimization passes (mostly in base/compiler/ssair/)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants