Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/cpu/x64/jit_brdgmm_dw_conv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "common/memory_tracking.hpp"
#include "common/utils.hpp"
#include <xmmintrin.h>

#include "cpu/x64/injectors/jit_uni_postops_injector.hpp"
#include "cpu/x64/jit_brdgmm_dw_conv.hpp"
Expand Down Expand Up @@ -358,6 +359,13 @@ status_t brdgmm_dw_convolution_fwd_t::execute(const exec_ctx_t &ctx) const {
const size_t dst_mb_stride = jcp.ngroups * jcp.ow * jcp.oh * jcp.dst_dsz;

parallel(jcp.nthr, [&](const int ithr, const int nthr) {
// TODO this is a hot fix for denormals, need refactor
unsigned int DENORMALS_ZERO = 0x0040;
unsigned int FLUSH_ZERO = 0x8000;
unsigned int csr = _mm_getcsr();
csr |= DENORMALS_ZERO;
csr |= FLUSH_ZERO;
_mm_setcsr(csr);
int start {0}, end {0};
balance211(work_amount, nthr, ithr, start, end);
int n {0}, chb {0}, oh {0}, owb {0};
Expand Down
13 changes: 13 additions & 0 deletions src/cpu/x64/jit_brgemm_1x1_conv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "common/nstl.hpp"
#include "common/type_helpers.hpp"
#include "common/utils.hpp"
#include <xmmintrin.h>

#include "cpu/cpu_primitive.hpp"

Expand Down Expand Up @@ -487,6 +488,12 @@ status_t brgemm_1x1_convolution_fwd_t<isa>::execute_forward_all(
#define BRGC_WO(...) \
parallel(pd()->jcp_.nthr, [&](const int ithr, const int nthr) { \
if (ithr >= work_amount) return; \
unsigned int DENORMALS_ZERO = 0x0040; \
unsigned int FLUSH_ZERO = 0x8000; \
unsigned int csr = _mm_getcsr(); \
csr |= DENORMALS_ZERO; \
csr |= FLUSH_ZERO; \
_mm_setcsr(csr); \
brgemm_batch_element_t *const brg_batch \
= brg_batch_global + (size_t)ithr * jcp.adjusted_batch_size; \
char *const c_buffer = (jcp.use_buffer) \
Expand Down Expand Up @@ -552,6 +559,12 @@ status_t brgemm_1x1_convolution_fwd_t<isa>::execute_forward_all(
#define BRGC_WO(...) \
parallel(pd()->jcp_.nthr, [&](const int ithr, const int nthr) { \
if (ithr >= work_amount) return; \
unsigned int DENORMALS_ZERO = 0x0040; \
unsigned int FLUSH_ZERO = 0x8000; \
unsigned int csr = _mm_getcsr(); \
csr |= DENORMALS_ZERO; \
csr |= FLUSH_ZERO; \
_mm_setcsr(csr); \
brgemm_batch_element_t *const brg_batch \
= brg_batch_global + (size_t)ithr * jcp.adjusted_batch_size; \
char *const c_buffer = (jcp.use_buffer) \
Expand Down
15 changes: 15 additions & 0 deletions src/cpu/x64/jit_brgemm_conv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "common/utils.hpp"
#include "cpu/cpu_primitive.hpp"
#include "cpu/x64/injectors/jit_uni_binary_injector.hpp"
#include <xmmintrin.h>

#include "cpu/x64/amx_tile_configure.hpp"
#include "cpu/x64/jit_brgemm_conv.hpp"
Expand Down Expand Up @@ -855,6 +856,13 @@ status_t brgemm_convolution_fwd_t<isa>::execute(const exec_ctx_t &ctx) const {

parallel(jcp.nthr, [&](const int ithr, const int nthr) {
if (ithr >= work_amount) return;
// TODO this is a hot fix for denormals, need refactor
unsigned int DENORMALS_ZERO = 0x0040;
unsigned int FLUSH_ZERO = 0x8000;
unsigned int csr = _mm_getcsr();
csr |= DENORMALS_ZERO;
csr |= FLUSH_ZERO;
_mm_setcsr(csr);

brgemm_batch_element_t *const __restrict brg_batch = brg_batch_global
+ static_cast<size_t>(ithr) * jcp.adjusted_batch_size;
Expand Down Expand Up @@ -1014,6 +1022,13 @@ status_t brgemm_convolution_fwd_t<isa>::cal_compensation(
const dim_t kd_b {kd_bs[k]}, kd_e {kd_es[k]}, kh_b {kh_bs[k]},
kh_e {kh_es[k]};
assert(kd_e > kd_b && kh_e > kh_b);
// TODO this is a hot fix for denormals, need refactor
unsigned int DENORMALS_ZERO = 0x0040;
unsigned int FLUSH_ZERO = 0x8000;
unsigned int csr = _mm_getcsr();
csr |= DENORMALS_ZERO;
csr |= FLUSH_ZERO;
_mm_setcsr(csr);

if (jcp.exec_type == exec_vpad && jcp.max_vpad > 0) {
const auto ow = owb * jcp.ow_block;
Expand Down
15 changes: 15 additions & 0 deletions src/cpu/x64/jit_brgemm_inner_product.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "common/dnnl_thread.hpp"
#include "common/type_helpers.hpp"
#include "common/utils.hpp"
#include <xmmintrin.h>

#include "cpu/cpu_primitive.hpp"

Expand Down Expand Up @@ -297,6 +298,13 @@ status_t brgemm_inner_product_fwd_t<isa>::execute_forward(
bool ok = init_thr_groups(
ithr, nthr, nthr_ic, nthr_oc_mb, ithr_ic, ithr_oc_mb);
if (!ok) return;
// TODO this is a hot fix for denormals, need refactor
unsigned int DENORMALS_ZERO = 0x0040;
unsigned int FLUSH_ZERO = 0x8000;
unsigned int csr = _mm_getcsr();
csr |= DENORMALS_ZERO;
csr |= FLUSH_ZERO;
_mm_setcsr(csr);

int start {0}, end {0};
balance211(work_amount, nthr_oc_mb, ithr_oc_mb, start, end);
Expand Down Expand Up @@ -376,6 +384,13 @@ status_t brgemm_inner_product_fwd_t<isa>::execute_forward(
bool ok = init_thr_groups(
ithr, nthr, nthr_ic, nthr_oc_mb, ithr_ic, ithr_oc_mb);
if (!ok) return;
// TODO this is a hot fix for denormals, need refactor
unsigned int DENORMALS_ZERO = 0x0040;
unsigned int FLUSH_ZERO = 0x8000;
unsigned int csr = _mm_getcsr();
csr |= DENORMALS_ZERO;
csr |= FLUSH_ZERO;
_mm_setcsr(csr);

int ocmb_start {0}, ocmb_end {0};
int start {0}, end {0};
Expand Down