Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
a-sidorova committed Aug 8, 2022
1 parent dad9764 commit 0f270c4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -582,13 +582,13 @@ void jit_store_emitter::emit_isa(const int in_vec_idx, const Xbyak::Reg64 &reg_d
switch (src_prc_) {
case Precision::FP32:
if ((dst_prc_ != Precision::FP32) && (dst_prc_ != Precision::BF16)) {
h->uni_vcvtps2dq(Vmm(data_idx), Vmm(aux_vec_idxs[aux_vec_idxs.size() - 1]));
h->uni_vcvtps2dq(Vmm(aux_vec_idxs[aux_vec_idxs.size() - 1]), Vmm(data_idx));
data_idx = aux_vec_idxs[aux_vec_idxs.size() - 1];
}
break;
case Precision::I32:
if ((dst_prc_ == Precision::FP32) || (dst_prc_ == Precision::BF16)) {
h->uni_vcvtdq2ps(Vmm(data_idx), Vmm(aux_vec_idxs[aux_vec_idxs.size() - 1]));
h->uni_vcvtdq2ps(Vmm(aux_vec_idxs[aux_vec_idxs.size() - 1]), Vmm(data_idx));
data_idx = aux_vec_idxs[aux_vec_idxs.size() - 1];
}
break;
Expand Down
33 changes: 11 additions & 22 deletions src/plugins/intel_cpu/src/nodes/color_convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,27 +577,15 @@ class SinglePlaneConvert<T, impl_desc_type::jit_uni> : public Converter {
const size_t stride_y = height * width * 3 / 2;
const size_t stride_uv = height * width * 3 / 2;

for (auto batch = 0; batch < batch_size; batch++) {
for (auto h = 0; h < height; h++) {
typename jit_uni_converter::Params args;
args.y = y + batch * stride_y + h * width;
args.u = args.v = uv + batch * stride_uv + (h / 2) * width;
args.dst = dst + (batch * width * height + h * width) * 3;
args.width = width;
args.colorFormat = _colorFormat[0]; // The first byte is enough to determine the RGB or BGR format.
kernel(args);
}
}

// InferenceEngine::parallel_for2d(batch_size, height, [&](int batch, int h) {
// typename jit_uni_converter::Params args;
// args.y = y + batch * stride_y + h * width;
// args.u = args.v = uv + batch * stride_uv + (h / 2) * width;
// args.dst = dst + (batch * width * height + h * width) * 3;
// args.width = width;
// args.colorFormat = _colorFormat[0]; // The first byte is enough to determine the RGB or BGR format.
// kernel(args);
// });
InferenceEngine::parallel_for2d(batch_size, height, [&](int batch, int h) {
typename jit_uni_converter::Params args;
args.y = y + batch * stride_y + h * width;
args.u = args.v = uv + batch * stride_uv + (h / 2) * width;
args.dst = dst + (batch * width * height + h * width) * 3;
args.width = width;
args.colorFormat = _colorFormat[0]; // The first byte is enough to determine the RGB or BGR format.
kernel(args);
});
}
};

Expand Down Expand Up @@ -804,7 +792,6 @@ void JitConverter<T[N]>::generate() {
auto dst = arg<T*>(&Params::dst);
auto width = arg(&Params::width);
auto colorFormat = arg(&Params::colorFormat);
auto uv_width = width >> 1;

static const float data[8] = { 16.f, 128.f, 1.164f, 1.596f, 0.391f, 2.018f, 0.813f, 255.f };
_consts = data;
Expand Down Expand Up @@ -838,6 +825,8 @@ void JitConverter<T[N]>::generate() {
auto u = var<float[N]>();
auto v = var<float[N]>();

auto uv_width = width >> 1;

load(y, src_y, width);
load(u, src_u, uv_width);
load(v, src_v, uv_width);
Expand Down
4 changes: 0 additions & 4 deletions src/plugins/intel_cpu/src/utils/jit_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,20 +295,16 @@ void jit_kernel::free<Zmm>(const Zmm & reg) {

void jit_kernel::postamble() {
jit_generator::postamble();
std::cout << "postamble start" << std::endl;
for (const auto& load_emitter : _load_emitters) {
auto key = load_emitter.first;
std::cout << "load" << std::get<0>(key) << " " << std::get<1>(key) << " " << std::get<2>(key) << std::endl;
if (load_emitter.second)
load_emitter.second->emit_data();
}
for (const auto& store_emitter : _store_emitters) {
auto key = store_emitter.first;
std::cout << "store" << std::get<0>(key) << " " << std::get<1>(key) << " " << std::get<2>(key) << std::endl;
if (store_emitter.second)
store_emitter.second->emit_data();
}
std::cout << "postamble end" << std::endl;
}

const AddressFrame & jit_kernel::address_frame(size_t size) const {
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/intel_cpu/src/utils/jit_kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,6 @@ void jit_kernel::init_load(size_t length) {
typename std::remove_pointer<DstT>::type>::type;
const auto src_prc = internal::type2precision<src_type>();
const auto dst_prc = internal::type2precision<dst_type>();
std::cout << "INIT LOAD: " << length << " " << src_prc << " " << dst_prc << std::endl;
if (_load_emitters.find(params_load_store_emitters(length, src_prc, dst_prc)) == _load_emitters.end()) {
_load_emitters[params_load_store_emitters(length, src_prc, dst_prc)].reset(
new jit_load_emitter(this, internal::get_current_isa(), length, src_prc, dst_prc));
Expand All @@ -760,7 +759,6 @@ void jit_kernel::init_store(size_t length) {
typename std::remove_pointer<DstT>::type>::type;
const auto src_prc = internal::type2precision<src_type>();
const auto dst_prc = internal::type2precision<dst_type>();
std::cout << "INIT STORE: " << length << " " << src_prc << " " << dst_prc << std::endl;
if (_store_emitters.find(params_load_store_emitters(length, src_prc, dst_prc)) == _store_emitters.end()) {
_store_emitters[params_load_store_emitters(length, src_prc, dst_prc)].reset(
new jit_store_emitter(this, internal::get_current_isa(), length, src_prc, dst_prc));
Expand Down

0 comments on commit 0f270c4

Please sign in to comment.