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

Add Add Operator::initialize API to handle customized operation init #6422

Closed
wants to merge 1 commit into from

Conversation

xiaoxmeng
Copy link
Contributor

Add operator init API to handle heavy customized operator initialization
work such as memory pool allocations. The operator init is called by
driver operator init method when the driver starts execution for the first
time. This is required as memory allocation can trigger memory arbitration
which might grab the task lock for memory reclamation. This can cause
deadlock as the driver creation is under the lock (see PR for details.
Later on, we will add memory usage check after driver creation to enforce
there is no memory allocations from memory pool on driver creation under
the task lock.

@netlify
Copy link

netlify bot commented Sep 5, 2023

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit b5a85f6
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/64f79c8e5bd05f0008883505

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 5, 2023
@@ -301,69 +301,75 @@ class Operator : public BaseRuntimeStatWriter {

virtual ~Operator() = default;

// Returns true if 'this' can accept input. Not used if operator is a source
// operator, e.g. the first operator in the pipeline.
virtual void init();
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe "initialize".

CC: @aditi-pandit

velox/exec/Operator.h Outdated Show resolved Hide resolved
velox/exec/Driver.h Outdated Show resolved Hide resolved
velox/exec/Driver.h Outdated Show resolved Hide resolved
Copy link
Contributor

@mbasmanova mbasmanova left a comment

Choose a reason for hiding this comment

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

Looks nice. Thanks.

@@ -301,69 +301,75 @@ class Operator : public BaseRuntimeStatWriter {

virtual ~Operator() = default;

// Returns true if 'this' can accept input. Not used if operator is a source
// operator, e.g. the first operator in the pipeline.
virtual void init();
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add documentation to explain that this method is for doing any construction work that requires memory allocations. Let's also comment that Operator's constructor should not allocate memory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. Thanks!

@xiaoxmeng xiaoxmeng marked this pull request as ready for review September 5, 2023 18:44
@facebook-github-bot
Copy link
Contributor

@xiaoxmeng has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@mbasmanova mbasmanova left a comment

Choose a reason for hiding this comment

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

Thanks. Please, update PR title to "Add Operator::initialize API ... "

velox/exec/Operator.h Outdated Show resolved Hide resolved
@xiaoxmeng xiaoxmeng changed the title Add operator init API to handle customized operation init Add Add Operator::initialize API to handle customized operation init Sep 5, 2023
@facebook-github-bot
Copy link
Contributor

@xiaoxmeng has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@xiaoxmeng
Copy link
Contributor Author

Thanks. Please, update PR title to "Add Operator::initialize API ... "

@mbasmanova thanks for the quick review!

@facebook-github-bot
Copy link
Contributor

@xiaoxmeng merged this pull request in 8f6be9d.

@conbench-facebook
Copy link

Conbench analyzed the 1 benchmark run on commit 8f6be9de.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

codyschierbeck pushed a commit to codyschierbeck/velox that referenced this pull request Sep 27, 2023
…acebookincubator#6422)

Summary:
Add operator init API to handle heavy customized operator initialization
work such as memory pool allocations. The operator init is called by
driver operator init method when the driver starts execution for the first
time. This is required as memory allocation can trigger memory arbitration
which might grab the task lock for memory reclamation. This can cause
deadlock as the driver creation is under the lock (see [PR](facebookincubator#6395) for details.
Later on, we will add memory usage check after driver creation to enforce
there is no memory allocations from memory pool on driver creation under
the task lock.

Pull Request resolved: facebookincubator#6422

Reviewed By: mbasmanova

Differential Revision: D48979505

Pulled By: xiaoxmeng

fbshipit-source-id: 68748ef179633c0ef6c99a5ef95fd99c2313d81d
codyschierbeck pushed a commit to codyschierbeck/velox that referenced this pull request Sep 27, 2023
…acebookincubator#6422)

Summary:
Add operator init API to handle heavy customized operator initialization
work such as memory pool allocations. The operator init is called by
driver operator init method when the driver starts execution for the first
time. This is required as memory allocation can trigger memory arbitration
which might grab the task lock for memory reclamation. This can cause
deadlock as the driver creation is under the lock (see [PR](facebookincubator#6395) for details.
Later on, we will add memory usage check after driver creation to enforce
there is no memory allocations from memory pool on driver creation under
the task lock.

Pull Request resolved: facebookincubator#6422

Reviewed By: mbasmanova

Differential Revision: D48979505

Pulled By: xiaoxmeng

fbshipit-source-id: 68748ef179633c0ef6c99a5ef95fd99c2313d81d
codyschierbeck pushed a commit to codyschierbeck/velox that referenced this pull request Sep 27, 2023
…acebookincubator#6422)

Summary:
Add operator init API to handle heavy customized operator initialization
work such as memory pool allocations. The operator init is called by
driver operator init method when the driver starts execution for the first
time. This is required as memory allocation can trigger memory arbitration
which might grab the task lock for memory reclamation. This can cause
deadlock as the driver creation is under the lock (see [PR](facebookincubator#6395) for details.
Later on, we will add memory usage check after driver creation to enforce
there is no memory allocations from memory pool on driver creation under
the task lock.

Pull Request resolved: facebookincubator#6422

Reviewed By: mbasmanova

Differential Revision: D48979505

Pulled By: xiaoxmeng

fbshipit-source-id: 68748ef179633c0ef6c99a5ef95fd99c2313d81d
ericyuliu pushed a commit to ericyuliu/velox that referenced this pull request Oct 12, 2023
…acebookincubator#6422)

Summary:
Add operator init API to handle heavy customized operator initialization
work such as memory pool allocations. The operator init is called by
driver operator init method when the driver starts execution for the first
time. This is required as memory allocation can trigger memory arbitration
which might grab the task lock for memory reclamation. This can cause
deadlock as the driver creation is under the lock (see [PR](facebookincubator#6395) for details.
Later on, we will add memory usage check after driver creation to enforce
there is no memory allocations from memory pool on driver creation under
the task lock.

Pull Request resolved: facebookincubator#6422

Reviewed By: mbasmanova

Differential Revision: D48979505

Pulled By: xiaoxmeng

fbshipit-source-id: 68748ef179633c0ef6c99a5ef95fd99c2313d81d
@xiaoxmeng xiaoxmeng deleted the init branch April 1, 2024 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants