Skip to content

Conversation

@devpramod
Copy link

Graph mode (torchscript) is an additional step that can further accelerate a workload that has been optimized with ipex and bfloat16 along with mixed precision. Graph mode utilizes AMX on SPR for additional speedups.

This PR modifies config file to have graphmode as an option to end users
The graph is compiled in the constructor of the embedding module such that it is ready for execution when requests arrive.

Copy link
Collaborator

@gkumbhat gkumbhat 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 contribution @devpramod ...

Couple of small housekeeping related comments for the PR:

  1. Can you rebase the PR with a sign-off, this allows github to verify and the DCO check would pass.
  2. It seems the lint and formatting checks are failing. Can you please address those.

Guidelines for contribution documenting some of these steps can be found here: https://github.com/caikit/caikit-nlp/blob/main/CONTRIBUTING.md

On the graphmode integration, couple of question and suggestions:

  1. When should the graph model be enabled? Can you add describe a bit when it is applicable, for which models etc ?
  2. How much of speedup is expected with enablement of graphmode ? Can you share some results ?

@devpramod
Copy link
Author

Hi @gkumbhat

  1. Enabling graph mode is most applicable for models that need high performance and efficiency in production. A wide range of PyTorch operations are covered in TorchScript's graph mode. It is not recommended in cases where there might be complex post processing involving custom python libraries as part of the model code.

  2. The speedups are dependent on the workload at hand. More information can be found here - https://pytorch.org/blog/optimizing-production-pytorch-performance-with-graph-transformations/
    On Intel hardware, using torchscript along with ipex optimize uses AMX an ISA with instructions to speed up AI workloads.

working on addressing 1 & 2

devpramod added 3 commits June 3, 2024 18:37
Signed-off-by: devpramod <[email protected]>
Signed-off-by: devpramod <[email protected]>
@devpramod
Copy link
Author

Hi @gkumbhat
I have resolved the formatting, linting and DCO check issues

Signed-off-by: devpramod <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants