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

[Misc] Upgrade to torch==2.3.0 #4454

Merged

Conversation

mgoin
Copy link
Collaborator

@mgoin mgoin commented Apr 29, 2024

Now that there is an xformers release and flash-attn release with PyTorch 2.3.0 support, we can consider upgrading to PyTorch 2.3.0.

PyTorch 2.3.0 is an useful version because it allows using torch._scaled_mm on Ada Lovelace GPUs (CUDA compute capability 8.9) for running native FP8 matmuls. (We will enable and test this in a follow-up PR)

Performance benchmarks using a Marlin quantized Llama 7B on RTX 4090:
https://docs.google.com/spreadsheets/d/1sYIzF7bLEvpcg-p9IS-6XvZhdv4h95GvjhLIbvpW1l4/edit?usp=sharing
vLLM TTFT between torch 2 2 1 and 2 3 0
vLLM TPOT between torch 2 2 1 and 2 3 0


PR Checklist (Click to Expand)

Thank you for your contribution to vLLM! Before submitting the pull request, please ensure the PR meets the following criteria. This helps vLLM maintain the code quality and improve the efficiency of the review process.

PR Title and Classification

Only specific types of PRs will be reviewed. The PR title is prefixed appropriately to indicate the type of change. Please use one of the following:

  • [Bugfix] for bug fixes.
  • [CI/Build] for build or continuous integration improvements.
  • [Doc] for documentation fixes and improvements.
  • [Model] for adding a new model or improving an existing model. Model name should appear in the title.
  • [Frontend] For changes on the vLLM frontend (e.g., OpenAI API server, LLM class, etc.)
  • [Kernel] for changes affecting CUDA kernels or other compute kernels.
  • [Core] for changes in the core vLLM logic (e.g., LLMEngine, AsyncLLMEngine, Scheduler, etc.)
  • [Hardware][Vendor] for hardware-specific changes. Vendor name should appear in the prefix (e.g., [Hardware][AMD]).
  • [Misc] for PRs that do not fit the above categories. Please use this sparingly.

Note: If the PR spans more than one category, please include all relevant prefixes.

Code Quality

The PR need to meet the following code quality standards:

  • We adhere to Google Python style guide and Google C++ style guide.
  • Pass all linter checks. Please use format.sh to format your code.
  • The code need to be well-documented to ensure future contributors can easily understand the code.
  • Include sufficient tests to ensure the project to stay correct and robust. This includes both unit tests and integration tests.
  • Please add documentation to docs/source/ if the PR modifies the user-facing behaviors of vLLM. It helps vLLM user understand and utilize the new features or changes.

Notes for Large Changes

Please keep the changes as concise as possible. For major architectural changes (>500 LOC excluding kernel/data/config/test), we would expect a GitHub issue (RFC) discussing the technical design and justification. Otherwise, we will tag it with rfc-required and might not go through the PR.

What to Expect for the Reviews

The goal of the vLLM team is to be a transparent reviewing machine. We would like to make the review process transparent and efficient and make sure no contributor feel confused or frustrated. However, the vLLM team is small, so we need to prioritize some PRs over others. Here is what you can expect from the review process:

  • After the PR is submitted, the PR will be assigned to a reviewer. Every reviewer will pick up the PRs based on their expertise and availability.
  • After the PR is assigned, the reviewer will provide status update every 2-3 days. If the PR is not reviewed within 7 days, please feel free to ping the reviewer or the vLLM team.
  • After the review, the reviewer will put an action-required label on the PR if there are changes required. The contributor should address the comments and ping the reviewer to re-review the PR.
  • Please respond to all comments within a reasonable time frame. If a comment isn't clear or you disagree with a suggestion, feel free to ask for clarification or discuss the suggestion.

Thank You

Finally, thank you for taking the time to read these guidelines and for your interest in contributing to vLLM. Your contributions make vLLM a great tool for everyone!

@mgoin mgoin changed the title [Misc] Upgrade torch==2.3.0 [Misc] Upgrade to torch==2.3.0 Apr 29, 2024
@youkaichao youkaichao self-assigned this Apr 29, 2024
@youkaichao
Copy link
Member

Be sure to check the blocks of memory we can use, before and after the upgrade.

e.g. # GPU blocks: 881, # CPU blocks: 0 in Basic Correctness Test

@youkaichao
Copy link
Member

I feel we can parse these stats and present them in the dashboard, too, especially for the GPU blocks. @simon-mo

GPU blocks: 881, # CPU blocks: 0

@mgoin
Copy link
Collaborator Author

mgoin commented Apr 29, 2024

Thanks for the suggestion @youkaichao, here are my results for kv cache block allocation using an A6000.

There is a roughly a ~1 block difference for common 7B models. The worst case is facebook/opt-125m which can allocate 75937 GPU blocks on main and 75934 GPU blocks on this PR, a difference of 3 blocks. I think this is acceptable.

Using main's current HEAD commit 73c8d67:

> python -c 'from vllm import LLM;LLM("facebook/opt-125m")'
INFO 04-29 19:12:30 gpu_executor.py:118] # GPU blocks: 75937, # CPU blocks: 7281

> python -c 'from vllm import LLM;LLM("meta-llama/Meta-Llama-3-8B-Instruct")'
INFO 04-29 19:12:48 gpu_executor.py:118] # GPU blocks: 13248, # CPU blocks: 2048

> python -c 'from vllm import LLM;LLM("teknium/OpenHermes-2.5-Mistral-7B")'
INFO 04-29 19:13:07 gpu_executor.py:118] # GPU blocks: 12735, # CPU blocks: 2048

> python -c 'from vllm import LLM;LLM("TheBloke/Llama-2-7B-GPTQ")'
INFO 04-29 19:13:19 gpu_executor.py:118] # GPU blocks: 4877, # CPU blocks: 512

> python -c 'from vllm import LLM;LLM("TheBloke/zephyr-7B-beta-AWQ")'
INFO 04-29 19:13:37 gpu_executor.py:118] # GPU blocks: 17641, # CPU blocks: 2048

> python -c 'from vllm import LLM;LLM("mgoin/phi-2-super-marlin")'
INFO 04-29 19:13:51 gpu_executor.py:118] # GPU blocks: 8214, # CPU blocks: 819

With this PR:

> python -c 'from vllm import LLM;LLM("facebook/opt-125m")'
INFO 04-29 19:03:36 gpu_executor.py:119] # GPU blocks: 75934, # CPU blocks: 7281

> python -c 'from vllm import LLM;LLM("meta-llama/Meta-Llama-3-8B-Instruct")'
INFO 04-29 19:04:43 gpu_executor.py:119] # GPU blocks: 13247, # CPU blocks: 2048

> python -c 'from vllm import LLM;LLM("teknium/OpenHermes-2.5-Mistral-7B")'
INFO 04-29 19:09:23 gpu_executor.py:119] # GPU blocks: 12734, # CPU blocks: 2048

> python -c 'from vllm import LLM;LLM("TheBloke/Llama-2-7B-GPTQ")'
INFO 04-29 19:10:47 gpu_executor.py:119] # GPU blocks: 4877, # CPU blocks: 512

> python -c 'from vllm import LLM;LLM("TheBloke/zephyr-7B-beta-AWQ")'
INFO 04-29 19:11:09 gpu_executor.py:119] # GPU blocks: 17640, # CPU blocks: 2048

> python -c 'from vllm import LLM;LLM("mgoin/phi-2-super-marlin")'
INFO 04-29 19:11:26 gpu_executor.py:119] # GPU blocks: 8213, # CPU blocks: 819

Copy link
Contributor

@zhouyuan zhouyuan 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 covering the CPU part - there's a minor performance increase in CPU backend also mostly due to torch.linear improvement in 2.3

Copy link
Member

@youkaichao youkaichao left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@robertgshaw2-neuralmagic robertgshaw2-neuralmagic merged commit d627a3d into vllm-project:main Apr 30, 2024
48 checks passed
@robertgshaw2-neuralmagic robertgshaw2-neuralmagic deleted the pytorch-2.3.0-xformers branch April 30, 2024 00:05
robertgshaw2-neuralmagic pushed a commit to neuralmagic/nm-vllm that referenced this pull request May 6, 2024
z103cb pushed a commit to z103cb/opendatahub_vllm that referenced this pull request May 7, 2024
Temirulan pushed a commit to Temirulan/vllm-whisper that referenced this pull request Sep 6, 2024
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.

4 participants