intel / xFasterTransformer

Apache License 2.0
355 stars 61 forks source link

[run_benchmark.sh] Few cores are running on HBM when batch-size >16 or 32 #455

Closed hangfu-guo closed 3 months ago

hangfu-guo commented 3 months ago

Tried both xft 1.6.0 and 1.7.1.

For Chatglm3-6B, issue can be seen when batch-size > 32 (Tried 48, 64, 128). For Llama2-13B, issue can be seen when batch-size >16.( Tried 32)

Specifically, only few CPU cores are running, but still lots of HBM memory available.

Duyi-Wang commented 3 months ago

Could you provide more info? CPU info(lscpu), running cmd, and CPU and memory usage in that situation.

hangfu-guo commented 3 months ago

Sure.

lscpu: Xeon Max 9468

root@2952c6e7ae31:~# lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 52 bits physical, 57 bits virtual Byte Order: Little Endian CPU(s): 192 On-line CPU(s) list: 0-191 Vendor ID: GenuineIntel Model name: Intel (R) Xeon (R) CPU Max 9468 CPU family: 6 Model: 143 Thread(s) per core: 2 Core(s) per socket: 48 Socket(s): 2 Stepping: 8 CPU max MHz: 3500.0000 CPU min MHz: 800.0000 BogoMIPS: 4200.00 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstoptsc cpuid aperfmperf tsc known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cat_l2 cdp_l3 i nvpcid_single intel_ppin cdp_l2 ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt av x512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect avx_vnni avx512_bf16 wbnoinvd dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req hfi vnmi avx512vbmi u mip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd fsrm md_clear serialize tsxldtrk pconfig arch_lbr ibt amx_bf16 avx512_fp16 amx_ti le amx_int8 flush_l1d arch_capabilities Virtualization features: Virtualization: VT-x Caches (sum of all): L1d: 4.5 MiB (96 instances) L1i: 3 MiB (96 instances) L2: 192 MiB (96 instances) L3: 210 MiB (2 instances) NUMA: NUMA node(s): 16 NUMA node0 CPU(s): 0-11,96-107 NUMA node1 CPU(s): 12-23,108-119 NUMA node2 CPU(s): 24-35,120-131 NUMA node3 CPU(s): 36-47,132-143 NUMA node4 CPU(s): 48-59,144-155 NUMA node5 CPU(s): 60-71,156-167 NUMA node6 CPU(s): 72-83,168-179 NUMA node7 CPU(s): 84-95,180-191 NUMA node8 CPU(s): NUMA node9 CPU(s): NUMA node10 CPU(s): NUMA node11 CPU(s): NUMA node12 CPU(s): NUMA node13 CPU(s): NUMA node14 CPU(s): NUMA node15 CPU(s):

CMD

bash run_benchmark.sh -m chatglm3-6b -d bf16 -s 1 -bs 48 -in 1024 -out 512 -kvd fp16 -i 1

Screenshots when running the above cmd

image image

There should be all cores of one socket running, but you can see from the picture that only a few are running.

Duyi-Wang commented 3 months ago

This is because the pre-allocated buffer size for SHM is insufficient, causing the program to hang during the communication. This bug may occur randomly, but the patch for the fix has already been merged. https://github.com/intel/xFasterTransformer/pull/457