Skip to content

Commit ed1decc

Browse files
authored
WOQ: fix illegal instruction error on BDW machines (#2190) (#2198)
1 parent 0cd2502 commit ed1decc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

csrc/cpu/jit/cpu/kernels/OpContext.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ c10::intrusive_ptr<WoqLinearOpContext> IpexWoqLinearOpContext::create_context(
374374
if (qtype == c10::kPerTensorAffine) {
375375
weight_scales_float[0] = weight.q_scale();
376376
} else if (qtype == c10::kPerChannelAffine) {
377-
weight_scales_float.resize(N, 0.0);
377+
weight_scales_float.resize(N);
378378
for (const auto i : c10::irange(N)) {
379379
weight_scales_float[i] = weight.q_per_channel_scales()[i].item<float>();
380380
}
@@ -393,7 +393,7 @@ c10::intrusive_ptr<WoqLinearOpContext> IpexWoqLinearOpContext::create_context(
393393
if (qtype == c10::kPerTensorAffine) {
394394
weight_zero_points_int32[0] = weight.q_zero_point();
395395
} else if (qtype == c10::kPerChannelAffine) {
396-
weight_zero_points_int32.resize(N, 0);
396+
weight_zero_points_int32.resize(N);
397397
for (const auto i : c10::irange(N)) {
398398
weight_zero_points_int32[i] =
399399
weight.q_per_channel_zero_points()[i].item<int32_t>();
@@ -412,7 +412,7 @@ c10::intrusive_ptr<WoqLinearOpContext> IpexWoqLinearOpContext::create_context(
412412
if (qtype == c10::kPerTensorAffine) {
413413
weight_zero_points_float[0] = (float)weight.q_zero_point();
414414
} else if (qtype == c10::kPerChannelAffine) {
415-
weight_zero_points_float.resize(N, 0);
415+
weight_zero_points_float.resize(N);
416416
for (const auto i : c10::irange(N)) {
417417
weight_zero_points_float[i] =
418418
(float)weight.q_per_channel_zero_points()[i].item<int32_t>();
@@ -440,7 +440,7 @@ c10::intrusive_ptr<WoqLinearOpContext> IpexWoqLinearOpContext::create_context(
440440
// extract scales from weight
441441
std::vector<float> weight_scales_float(1, 0.0);
442442
if (qtype == c10::kPerChannelAffineFloatQParams) {
443-
weight_scales_float.resize(N, 0.0);
443+
weight_scales_float.resize(N);
444444
for (const auto i : c10::irange(N)) {
445445
weight_scales_float[i] = weight.q_per_channel_scales()[i].item<float>();
446446
}
@@ -457,7 +457,7 @@ c10::intrusive_ptr<WoqLinearOpContext> IpexWoqLinearOpContext::create_context(
457457
// extract zero_points from weight
458458
std::vector<float> weight_zero_points_float(1, 0);
459459
if (qtype == c10::kPerChannelAffineFloatQParams) {
460-
weight_zero_points_float.resize(N, 0);
460+
weight_zero_points_float.resize(N);
461461
for (const auto i : c10::irange(N)) {
462462
weight_zero_points_float[i] =
463463
weight.q_per_channel_zero_points()[i].item<float>();

0 commit comments

Comments
 (0)