text stringlengths 0 2.2M |
|---|
}
|
if (res->errors) res->state = FAILED;
|
if (res->state == UNTESTED) res->state = PASSED; /* optimism */
|
return res->state == FAILED ? FAIL : OK;
|
}
|
int init_pd(dnnl_engine_t engine, const prb_t *prb, dnnl_primitive_desc_t &bpd,
|
res_t *res, dir_t dir, const_dnnl_primitive_desc_t hint) {
|
dnnl_batch_normalization_desc_t bd;
|
dnnl_memory_desc_t data_d;
|
dnnl_dims_t data_dims_0d = {prb->mb, prb->ic};
|
dnnl_dims_t data_dims_1d = {prb->mb, prb->ic, prb->iw};
|
dnnl_dims_t data_dims_2d = {prb->mb, prb->ic, prb->ih, prb->iw};
|
dnnl_dims_t data_dims_3d = {prb->mb, prb->ic, prb->id, prb->ih, prb->iw};
|
dnnl_dim_t *data_dims = prb->ndims == 5
|
? data_dims_3d
|
: prb->ndims == 4 ? data_dims_2d
|
: prb->ndims == 3 ? data_dims_1d : data_dims_0d;
|
SAFE(init_md(&data_d, prb->ndims, data_dims, prb->dt, prb->tag), CRIT);
|
auto flags = (dnnl_normalization_flags_t)prb->flags;
|
if (dir & FLAG_FWD) {
|
auto prop = prb->dir & FLAG_INF ? dnnl_forward_inference
|
: dnnl_forward_training;
|
DNN_SAFE(dnnl_batch_normalization_forward_desc_init(
|
&bd, prop, &data_d, prb->eps, flags),
|
WARN);
|
} else {
|
dnnl_memory_desc_t diff_data_d;
|
DNN_SAFE(dnnl_memory_desc_init_by_tag(&diff_data_d, prb->ndims,
|
data_dims, prb->dt, dnnl_format_tag_any),
|
WARN);
|
auto prop = prb->dir & FLAG_WEI ? dnnl_backward : dnnl_backward_data;
|
DNN_SAFE(dnnl_batch_normalization_backward_desc_init(
|
&bd, prop, &diff_data_d, &data_d, prb->eps, flags),
|
WARN);
|
}
|
auto dnnl_attr = make_benchdnn_dnnl_wrapper(
|
create_dnnl_attr(prb->attr, attr_args_t()));
|
dnnl_status_t init_status
|
= dnnl_primitive_desc_create(&bpd, &bd, dnnl_attr, engine, hint);
|
if (init_status == dnnl_unimplemented)
|
return res->state = UNIMPLEMENTED, OK;
|
else
|
SAFE(init_status, WARN);
|
// Return if pd is not the one being tested
|
if ((dir & FLAG_FWD) != (prb->dir & FLAG_FWD)) return OK;
|
res->impl_name = query_impl_info(bpd);
|
if (maybe_skip(res->impl_name)) {
|
BENCHDNN_PRINT(2, "SKIPPED: oneDNN implementation: %s\n",
|
res->impl_name.c_str());
|
return res->state = SKIPPED, res->reason = SKIP_IMPL_HIT, OK;
|
} else {
|
BENCHDNN_PRINT(
|
5, "oneDNN implementation: %s\n", res->impl_name.c_str());
|
if (!strstr(res->impl_name.c_str(), "jit")) {
|
BENCHDNN_PRINT(2, "WARNING: %s",
|
"accuracy of the implementation being tested "
|
"depends on the compiler and might give "
|
"false-positives.\n");
|
BENCHDNN_PRINT(2, " %s",
|
"please consider recompiling the sources with"
|
" `-prec-div -fp-model precise` for a reliable testing.\n");
|
}
|
}
|
SAFE(check_pd_w_and_wo_attr(res, prb->attr, bd), WARN);
|
return OK;
|
}
|
void check_post_op_relu_alpha(const prb_t *prb, res_t *res) {
|
const auto &po = prb->attr.post_ops;
|
const auto relu_idx = po.find(attr_t::post_ops_t::kind_t::RELU);
|
if (relu_idx >= 0) {
|
const auto &e = po.entry[relu_idx];
|
float alpha = e.eltwise.alpha;
|
if (alpha != 0.f && (!(prb->dir & FLAG_INF) || !is_cpu())) {
|
res->state = SKIPPED;
|
res->reason = CASE_NOT_SUPPORTED;
|
}
|
}
|
}
|
void check_known_skipped_case(const prb_t *prb, res_t *res) {
|
check_known_skipped_case_common({prb->dt}, prb->dir, res);
|
check_sum_post_ops(prb->attr, res);
|
check_post_op_relu_alpha(prb, res);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.