Skip to content

optimizer: improve general code quality#42357

Merged
aviatesk merged 1 commit intomasterfrom
avi/sroa2
Sep 29, 2021
Merged

optimizer: improve general code quality#42357
aviatesk merged 1 commit intomasterfrom
avi/sroa2

Conversation

@aviatesk
Copy link
Copy Markdown
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 Keno and vtjnash 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
end

function simple_walk(compact::IncrementalCompact, @nospecialize(defssa#=::AnySSAValue=#), pi_callback=(pi, idx)->false)
function simple_walk(compact::IncrementalCompact, @nospecialize(defssa::AnySSAValue),
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

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
Copy Markdown
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

🙀

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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