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

[WIP] Add NaiveEnginePerThread #15604

Closed
wants to merge 3 commits into from

Conversation

ZhennanQin
Copy link
Contributor

Description

Add NaiveEnginePerThread to support multi-thread inference. To address the engine issue for #15576

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant JIRA issue created (except PRs with tiny changes)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage:
  • Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
  • Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)
  • Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
  • Code is well-documented:
  • For user-facing API changes, API doc string has been updated.
  • For new C++ functions in header files, their functionalities and arguments are documented.
  • For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable
  • Check the API doc at http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

Changes

  • Feature1, tests, (and when applicable, API doc)
  • Feature2, tests, (and when applicable, API doc)

Comments

  • If this change is a backward incompatible change, why must this change be made.
  • Interesting edge cases to note here

@pengzhao-intel
Copy link
Contributor

Copy link
Contributor

@marcoabreu marcoabreu left a comment

Choose a reason for hiding this comment

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

To me this feels a bit like creating an abonimation and I'm opposed towards introducing this new engine type.

NaiveEngine is afaik intended for debugging or simple straight-forward workloads. The regular threaded engine is intended for bigger (multi-threaded) workloads. You're trying to work around the fact that our APIs are not threadsafe. The root problem should be fixed instead of working around it and creating an even bigger mess.

@karan6181
Copy link
Contributor

@mxnet-label-bot add [MKLDNN, Thread Safety, pr-awaiting-response]

@marcoabreu marcoabreu added MKLDNN pr-awaiting-response PR is reviewed and waiting for contributor to respond Thread Safety labels Jul 19, 2019
@arcadiaphy
Copy link
Member

Agree with @marcoabreu, we should focus on naive engine to make it more stateless instead of introducing new engines.

@ZhennanQin Thanks for your suggestions, I've worked out a way to do parallel inference now.

@pengzhao-intel
Copy link
Contributor

@ZhennanQin I think we can close this PR since @arcadiaphy already have the solution and we just provide one of the possible solutions.

@arcadiaphy please verify the latency performance in https://github.com/apache/incubator-mxnet/tree/master/cpp-package/example/inference with your fix.

@ZhennanQin ZhennanQin closed this Jul 22, 2019
@ZhennanQin ZhennanQin deleted the EnginePerThread branch September 16, 2019 07:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
MKLDNN pr-awaiting-response PR is reviewed and waiting for contributor to respond Thread Safety
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants