Skip to content

Commit

Permalink
src: cpu: conv: jit_uni_x8s8s32x: dst scale: reuse vmm register
Browse files Browse the repository at this point in the history
  • Loading branch information
igorsafo committed May 25, 2023
1 parent d721767 commit bb3ecc4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
11 changes: 4 additions & 7 deletions src/cpu/x64/jit_uni_x8s8s32x_conv_kernel.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2019-2022 Intel Corporation
* Copyright 2019-2023 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -900,16 +900,14 @@ void _jit_uni_x8s8s32x_fwd_kernel<isa, Vmm>::generate() {

if (jcp.is_depthwise) {
const bool is_zero_point = jcp.src_zero_point || jcp.dst_zero_point;
// dst zero point and dst scale reuse the same register
int idx = ker_max_reg + 1 - jcp.max_regs_ur
- nstl::max(2 * is_zero_point, static_cast<int>(jcp.dst_scale));
int idx = ker_max_reg + 1 - jcp.max_regs_ur - 2 * is_zero_point;
if (!jcp.is_resrc_depthwise) vmm_dw_src = Vmm(--idx);
if (!jcp.has_vnni) vmm_dw_tmp = Vmm(--idx);
if (jcp.signed_input) {
--idx; // due to extra register used for compensations
}
assert(IMPLICATION(!jcp.dst_scale && !is_zero_point,
idx == ker_max_reg - ker_dw_reg_base_idx));
assert(IMPLICATION(
!is_zero_point, idx == ker_max_reg - ker_dw_reg_base_idx));
}

if (!jcp.is_depthwise && (!jcp.has_vnni)) {
Expand Down Expand Up @@ -1359,7 +1357,6 @@ status_t jit_uni_x8s8s32x_fwd_kernel<isa>::init_conf(jit_conv_conf_t &jcp,
jcp.max_regs_ur = jcp.has_vnni ? 15 - jcp.signed_input : 12;
}

if (jcp.dst_scale) jcp.max_regs_ur = 10;
if (jcp.src_zero_point || jcp.dst_zero_point) jcp.max_regs_ur = 9;

auto set_or_check_wei_format = [&]() {
Expand Down
4 changes: 2 additions & 2 deletions src/cpu/x64/jit_uni_x8s8s32x_conv_kernel.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2019-2022 Intel Corporation
* Copyright 2019-2023 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -113,7 +113,7 @@ struct _jit_uni_x8s8s32x_fwd_kernel : public jit_generator {
const Vmm vmm_zp_comp = vmm_zp_one;
const Vmm vmm_zp_dw_tmp = vmm_zp_one;
/* dst scale */
const Vmm vmm_dst_scale = Vmm(5);
const Vmm vmm_dst_scale = Vmm(0);

/* used in compute_ker (but set during prepare_output) */
const Vmm vmm_shift = Vmm(1); // only for signed input
Expand Down

0 comments on commit bb3ecc4

Please sign in to comment.