Skip to content

Commit e47c98e

Browse files
[Fix] Add missing stubs from cpu fp8 attention changes (vllm-project#41387)
Signed-off-by: Li, Tianmu <tianmu.li@intel.com> Co-authored-by: Li, Jiang <jiang1.li@intel.com>
1 parent aee190a commit e47c98e

4 files changed

Lines changed: 25 additions & 0 deletions

File tree

csrc/cpu/cpu_types_arm.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,10 @@ struct FP32Vec16 : public VectorizedRegWrapper<FP32Vec16, 4, float> {
486486

487487
explicit FP32Vec16(const BF16Vec8& v) : FP32Vec16(FP32Vec8(v)) {};
488488

489+
// FP8 stub: dead code on ARM (fp8 KV cache is x86-only), needed for
490+
// load_b_pair_vec template to compile on all platforms.
491+
explicit FP32Vec16(const BF16Vec32&, int) : Base() {}
492+
489493
explicit FP32Vec16(const FP16Vec16& v) {
490494
reg.val[0] = Vectorized<float>(vcvt_f32_f16(vget_low_f16(v.reg.val[0])));
491495
reg.val[1] = Vectorized<float>(vcvt_f32_f16(vget_high_f16(v.reg.val[0])));

csrc/cpu/cpu_types_scalar.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
namespace vec_op {
88

9+
struct fp8_e4m3_tag {};
10+
struct fp8_e5m2_tag {};
11+
912
#define VLLM_DISPATCH_CASE_FLOATING_TYPES(...) \
1013
AT_DISPATCH_CASE(at::ScalarType::Float, __VA_ARGS__) \
1114
AT_DISPATCH_CASE(at::ScalarType::BFloat16, __VA_ARGS__) \
@@ -145,6 +148,9 @@ struct BF16Vec32 : public Vec<BF16Vec32> {
145148
}
146149

147150
void save(void* ptr) const { *reinterpret_cast<f16x32_t*>(ptr) = reg; }
151+
152+
explicit BF16Vec32(const uint8_t*, fp8_e4m3_tag) : reg{} {}
153+
explicit BF16Vec32(const uint8_t*, fp8_e5m2_tag) : reg{} {}
148154
};
149155

150156
struct FP32Vec4 : public Vec<FP32Vec4> {
@@ -302,6 +308,10 @@ struct FP32Vec16 : public Vec<FP32Vec16> {
302308

303309
FP32Vec16(const BF16Vec8& v) : FP32Vec16(FP32Vec8(v)) {};
304310

311+
// FP8 stub: dead code on scalar path (fp8 KV cache is x86-only), needed for
312+
// load_b_pair_vec template to compile on all platforms.
313+
explicit FP32Vec16(const BF16Vec32&, int) : reg{} {}
314+
305315
FP32Vec16 operator*(const FP32Vec16& b) const {
306316
f32x16_t ret;
307317
unroll_loop<int, VEC_ELEM_NUM>(

csrc/cpu/cpu_types_vsx.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ struct BF16Vec32 : public Vec<BF16Vec32> {
146146
: reg({vec8_data.reg, vec8_data.reg, vec8_data.reg, vec8_data.reg}) {}
147147

148148
void save(void* ptr) const { *reinterpret_cast<ss16x8x4_t*>(ptr) = reg; }
149+
150+
explicit BF16Vec32(const uint8_t*, fp8_e4m3_tag) : reg{} {}
151+
explicit BF16Vec32(const uint8_t*, fp8_e5m2_tag) : reg{} {}
149152
};
150153

151154
struct FP32Vec4 : public Vec<FP32Vec4> {
@@ -408,6 +411,10 @@ struct FP32Vec16 : public Vec<FP32Vec16> {
408411

409412
explicit FP32Vec16(const BF16Vec8& v) : FP32Vec16(FP32Vec8(v)) {}
410413

414+
// FP8 stub: dead code on PowerPC (fp8 KV cache is x86-only), needed for
415+
// load_b_pair_vec template to compile on all platforms.
416+
explicit FP32Vec16(const BF16Vec32&, int) : reg{} {}
417+
411418
explicit FP32Vec16(const INT32Vec16& v) {
412419
reg.val[0] = vec_ctf(v.reg.val[0], 0);
413420
reg.val[1] = vec_ctf(v.reg.val[1], 0);

csrc/cpu/cpu_types_vxe.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,10 @@ struct FP32Vec16 : public Vec<FP32Vec16> {
688688

689689
explicit FP32Vec16(const BF16Vec8& v) : FP32Vec16(FP32Vec8(v)) {}
690690

691+
// FP8 stub: dead code on s390x (fp8 KV cache is x86-only), needed for
692+
// load_b_pair_vec template to compile on all platforms.
693+
explicit FP32Vec16(const BF16Vec32&, int) : reg{} {}
694+
691695
FP32Vec16 operator*(const FP32Vec16& b) const {
692696
return FP32Vec16(f32x4x4_t({vec_mul(reg.val[0], b.reg.val[0]),
693697
vec_mul(reg.val[1], b.reg.val[1]),

0 commit comments

Comments
 (0)