Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Separate backend from hybridize and refactor optimize_for kwargs #19543

Merged
merged 5 commits into from
Nov 18, 2020

Conversation

Kh4L
Copy link
Contributor

@Kh4L Kh4L commented Nov 16, 2020

Description

This PR separates the partitioning backend from hybridize.
hybridize now clears any previous optimization, sets the CachedOp args and activate the hybridization.
optimize_for is responsible of setting the backend, backend options and running the partitioning with backend.

If the user wish to use any partitioning backend, they have use optimize_for.

It also changes the default value of optimize_for's clear arg, making the chaining of the backend the default behavior.

The PR also make the CachedOp kwargs explicit and documented : static_alloc, static_shape, inline_limit, forward_bulk_size, backward_bulk_size.

Examples

How optimize_for changed

Before

blk.optimize_for(x, backend="someBackend", backend_opts={'dedup_subgraph':True})

After

blk.optimize_for(x, backend="someBackend", dedup_subgraph=True)

How hybridize changed

Before

blk.hybridize(backend="someBackend", static_alloc=True)
blk(x)

After

Hybridize can't be used to set the backend anymore, we now have to use optimize_for, which will call hybridize internally.

blk.optimize_for(x, backend="someBackend", static_alloc=True)

How chaining backends changed

Before

blk.optimize_for(x, backend="firstBackend", static_alloc=True)
blk.optimize_for(x, backend="secondBackend", clear=False, dedup_subgraph=True)

After

clear default value is False, we simply chain them

blk.optimize_for(x, backend="firstBackend", static_alloc=True)
blk.optimize_for(x, backend="secondBackend", dedup_subgraph=True)

cc @samskalicky who helped to design the API offline and reviewed the 1.x related PR #19386
@mseth10 who helped by reviewing the 1.x PR

Signed-off-by: Serge Panev <spanev@nvidia.com>
@mxnet-bot
Copy link

Hey @Kh4L , Thanks for submitting the PR
All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands:

  • To trigger all jobs: @mxnet-bot run ci [all]
  • To trigger specific jobs: @mxnet-bot run ci [job1, job2]

CI supported jobs: [website, windows-gpu, unix-cpu, clang, windows-cpu, sanity, centos-cpu, unix-gpu, edge, centos-gpu, miscellaneous]


Note:
Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin.
All CI tests must pass before the PR can be merged.

@lanking520 lanking520 added pr-awaiting-testing PR is reviewed and waiting CI build and test pr-work-in-progress PR is still work in progress and removed pr-awaiting-testing PR is reviewed and waiting CI build and test labels Nov 16, 2020
Copy link
Contributor

@samskalicky samskalicky left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Serge Panev <spanev@nvidia.com>
@lanking520 lanking520 added pr-awaiting-testing PR is reviewed and waiting CI build and test and removed pr-work-in-progress PR is still work in progress labels Nov 17, 2020
Signed-off-by: Serge Panev <spanev@nvidia.com>
@Kh4L
Copy link
Contributor Author

Kh4L commented Nov 17, 2020

@samskalicky I updated the documentation to reflect the changes

@lanking520 lanking520 added pr-awaiting-review PR is waiting for code review and removed pr-awaiting-testing PR is reviewed and waiting CI build and test labels Nov 17, 2020
Signed-off-by: Serge Panev <spanev@nvidia.com>
@lanking520 lanking520 added pr-awaiting-testing PR is reviewed and waiting CI build and test and removed pr-awaiting-review PR is waiting for code review labels Nov 17, 2020
Copy link
Contributor

@mseth10 mseth10 left a comment

Choose a reason for hiding this comment

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

Thanks for the API cleanup @Kh4L

python/mxnet/gluon/block.py Outdated Show resolved Hide resolved
python/mxnet/gluon/block.py Outdated Show resolved Hide resolved
example/extensions/lib_pass/README.md Show resolved Hide resolved
@lanking520 lanking520 added pr-awaiting-merge Review and CI is complete. Ready to Merge and removed pr-awaiting-testing PR is reviewed and waiting CI build and test labels Nov 17, 2020
@apache apache deleted a comment from Kh4L Nov 18, 2020
Signed-off-by: Serge Panev <spanev@nvidia.com>
@lanking520 lanking520 added pr-awaiting-testing PR is reviewed and waiting CI build and test and removed pr-awaiting-merge Review and CI is complete. Ready to Merge labels Nov 18, 2020
Copy link
Contributor

@waytrue17 waytrue17 left a comment

Choose a reason for hiding this comment

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

Thanks for the great work!

@lanking520 lanking520 added pr-work-in-progress PR is still work in progress and removed pr-awaiting-testing PR is reviewed and waiting CI build and test labels Nov 18, 2020
@Kh4L
Copy link
Contributor Author

Kh4L commented Nov 18, 2020

@mxnet-bot run ci [unix-cpu]

@mxnet-bot
Copy link

Jenkins CI successfully triggered : [unix-cpu]

@lanking520 lanking520 added pr-awaiting-testing PR is reviewed and waiting CI build and test pr-work-in-progress PR is still work in progress pr-awaiting-review PR is waiting for code review and removed pr-work-in-progress PR is still work in progress pr-awaiting-testing PR is reviewed and waiting CI build and test labels Nov 18, 2020
@mseth10 mseth10 merged commit dbcd6a1 into apache:master Nov 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr-awaiting-review PR is waiting for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants