Skip to content

Commit

Permalink
WOQ: fix illegal instruction error on BDW machines (#2190) (#2198)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xia-Weiwen authored Oct 26, 2023
1 parent 0cd2502 commit ed1decc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions csrc/cpu/jit/cpu/kernels/OpContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ c10::intrusive_ptr<WoqLinearOpContext> IpexWoqLinearOpContext::create_context(
if (qtype == c10::kPerTensorAffine) {
weight_scales_float[0] = weight.q_scale();
} else if (qtype == c10::kPerChannelAffine) {
weight_scales_float.resize(N, 0.0);
weight_scales_float.resize(N);
for (const auto i : c10::irange(N)) {
weight_scales_float[i] = weight.q_per_channel_scales()[i].item<float>();
}
Expand All @@ -393,7 +393,7 @@ c10::intrusive_ptr<WoqLinearOpContext> IpexWoqLinearOpContext::create_context(
if (qtype == c10::kPerTensorAffine) {
weight_zero_points_int32[0] = weight.q_zero_point();
} else if (qtype == c10::kPerChannelAffine) {
weight_zero_points_int32.resize(N, 0);
weight_zero_points_int32.resize(N);
for (const auto i : c10::irange(N)) {
weight_zero_points_int32[i] =
weight.q_per_channel_zero_points()[i].item<int32_t>();
Expand All @@ -412,7 +412,7 @@ c10::intrusive_ptr<WoqLinearOpContext> IpexWoqLinearOpContext::create_context(
if (qtype == c10::kPerTensorAffine) {
weight_zero_points_float[0] = (float)weight.q_zero_point();
} else if (qtype == c10::kPerChannelAffine) {
weight_zero_points_float.resize(N, 0);
weight_zero_points_float.resize(N);
for (const auto i : c10::irange(N)) {
weight_zero_points_float[i] =
(float)weight.q_per_channel_zero_points()[i].item<int32_t>();
Expand Down Expand Up @@ -440,7 +440,7 @@ c10::intrusive_ptr<WoqLinearOpContext> IpexWoqLinearOpContext::create_context(
// extract scales from weight
std::vector<float> weight_scales_float(1, 0.0);
if (qtype == c10::kPerChannelAffineFloatQParams) {
weight_scales_float.resize(N, 0.0);
weight_scales_float.resize(N);
for (const auto i : c10::irange(N)) {
weight_scales_float[i] = weight.q_per_channel_scales()[i].item<float>();
}
Expand All @@ -457,7 +457,7 @@ c10::intrusive_ptr<WoqLinearOpContext> IpexWoqLinearOpContext::create_context(
// extract zero_points from weight
std::vector<float> weight_zero_points_float(1, 0);
if (qtype == c10::kPerChannelAffineFloatQParams) {
weight_zero_points_float.resize(N, 0);
weight_zero_points_float.resize(N);
for (const auto i : c10::irange(N)) {
weight_zero_points_float[i] =
weight.q_per_channel_zero_points()[i].item<float>();
Expand Down

0 comments on commit ed1decc

Please sign in to comment.