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

[Bug]: Test_skip_speculation fails in distributed execution #5814

Open
wooyeonlee0 opened this issue Jun 25, 2024 · 10 comments
Open

[Bug]: Test_skip_speculation fails in distributed execution #5814

wooyeonlee0 opened this issue Jun 25, 2024 · 10 comments
Labels
bug Something isn't working stale

Comments

@wooyeonlee0
Copy link
Contributor

Your current environment

Collecting environment information...
PyTorch version: 2.3.0+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.3 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.29.5
Libc version: glibc-2.35

Python version: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (64-bit runtime)
Python platform: Linux-5.4.0-113-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 12.3.52
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration:
GPU 0: NVIDIA A100-SXM4-80GB
GPU 1: NVIDIA A100-SXM4-80GB
GPU 2: NVIDIA A100-SXM4-80GB
GPU 3: NVIDIA A100-SXM4-80GB

Nvidia driver version: 510.73.08
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.9.6
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.9.6
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.9.6
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.9.6
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.9.6
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.9.6
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.9.6
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Address sizes:                   48 bits physical, 48 bits virtual
Byte Order:                      Little Endian
CPU(s):                          256
On-line CPU(s) list:             0-254
Off-line CPU(s) list:            255
Vendor ID:                       AuthenticAMD
Model name:                      AMD EPYC 7742 64-Core Processor
CPU family:                      23
Model:                           49
Thread(s) per core:              2
Core(s) per socket:              64
Socket(s):                       2
Stepping:                        0
BogoMIPS:                        4491.93
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr wbnoinvd arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif umip rdpid overflow_recov succor smca
Virtualization:                  AMD-V
L1d cache:                       4 MiB (128 instances)
L1i cache:                       4 MiB (128 instances)
L2 cache:                        64 MiB (128 instances)
L3 cache:                        512 MiB (32 instances)
NUMA node(s):                    8
NUMA node0 CPU(s):               0-15,128-143
NUMA node1 CPU(s):               16-31,144-159
NUMA node2 CPU(s):               32-47,160-175
NUMA node3 CPU(s):               48-63,176-191
NUMA node4 CPU(s):               64-79,192-207
NUMA node5 CPU(s):               80-95,208-223
NUMA node6 CPU(s):               96-111,224-239
NUMA node7 CPU(s):               112-127,240-254
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP conditional, RSB filling
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected

Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] nvidia-nccl-cu12==2.20.5
[pip3] torch==2.3.0
[pip3] transformers==4.41.2
[pip3] triton==2.3.0
[conda] Could not collect
ROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: 0.5.0
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:

🐛 Describe the bug

test_skip_speculation is to verify that vllm can work seamlessly by skipping speculation when the sequence length becomes larger than the max model len of the draft model.
Since it's in 'test_multistep_correctness.py', it's been tested only for single GPU setup, not multi-GPU setup.
And I checked and the test failed in the multi-GPU setup. CI fail result link

The reason for the test failure is that the skipping feature does not consider the multiple draft worker situation.
related comment, code to check (Thanks to @cadedaniel @comaniac )

This bug was found during #5414

@cadedaniel
Copy link
Collaborator

BTW, my suspicion is that this will go away once we have SPMD workers in vLLM/spec decode. that will happen after #5408

@wooyeonlee0
Copy link
Contributor Author

BTW, my suspicion is that this will go away once we have SPMD workers in vLLM/spec decode. that will happen after #5408

That's great. I'll re-check this bug after that.

@wooyeonlee0
Copy link
Contributor Author

#5408 has been merged, but the test still fails.
My guess is that it's because the PR change didn't apply to the speculative decoding path as stated in the PR description.

@wooyeonlee0
Copy link
Contributor Author

wooyeonlee0 commented Jun 27, 2024

After some testing, I found that driver_worker stalls during ModelRunner.execute(), when there are no drafts to score/evaluate.
It's not easy to debug, as it does not emit any logs after entering model.compute_logits().

@wooyeonlee0
Copy link
Contributor Author

I think it would be a simple solution to switch back to the non spec mode for the step where there are no available drafts.
I will try it tomorrow.

@comaniac
Copy link
Collaborator

comaniac commented Jun 27, 2024

btw I got a similar problem at #5799 for non-spec decode case with TP>1, which hangs at sampler in the driver worker.

It seems like the root cause of my case is I changed model runner to let it return a list, and non-driver workers should return an empty list correspondingly instead of None. I fixed in the latest commit of the PR. Hopefully the helps your case too.

@wooyeonlee0
Copy link
Contributor Author

@comaniac Great, thanks for sharing!
I'd better to check your PR :)

@wooyeonlee0
Copy link
Contributor Author

wooyeonlee0 commented Jul 12, 2024

Command to reproduce the problem:
python benchmark_latency.py --model JackFram/llama-160m --enforce-eager --use-v2-block-manager --tensor-parallel-size 4 --speculative-model JackFram/llama-68m --num-speculative-tokens 5 --batch-size 8 --output-len 64 --speculative-max-model-len 32

It does not fail when we add a 'spec-draft-tp 1' option.
python benchmark_latency.py --model JackFram/llama-160m --enforce-eager --use-v2-block-manager --tensor-parallel-size 4 --speculative-model JackFram/llama-68m --num-speculative-tokens 5 --batch-size 8 --output-len 64 --speculative-max-model-len 32 -spec-draft-tp 1

@wooyeonlee0
Copy link
Contributor Author

wooyeonlee0 commented Jul 12, 2024

I opened the PR #6369 as a temporal patch.
I'll handle it later following cade's guide as below, after handling #5856 first.

But when TP==2 the test likely fails because the nonzero draft rank does not know that some sequences are skipped.

Copy link

This issue has been automatically marked as stale because it has not had any activity within 90 days. It will be automatically closed if no further activity occurs within 30 days. Leave a comment if you feel this issue should remain open. Thank you!

@github-actions github-actions bot added the stale label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

3 participants