#include "gpu/intel/pool/config.hpp"
namespace dnnl {
namespace impl {
namespace gpu {
namespace intel {
namespace pool {
void set_default_conf(conf_t &conf, const desc_t &desc,
const memory_desc_t &src_md, const memory_desc_t &dst_md,
const primitive_attr_t &attr) {
const memory_desc_wrapper src_mdw(src_md);
const memory_desc_wrapper dst_mdw(dst_md);
const auto &src_dims = src_mdw.dims();
const auto &dst_dims = dst_mdw.dims();
int ndims = src_mdw.ndims();
conf.ndims = ndims;
conf.mb = src_dims[0];
conf.c = src_dims[1];
conf.mb_padded = src_mdw.padded_dims()[0];
conf.c_padded = src_mdw.padded_dims()[1];
conf.id = (ndims == 5) ? src_dims[2] : 1;
conf.ih = (ndims == 3) ? 1 : src_dims[ndims - 2];
conf.iw = src_dims[ndims - 1];
conf.od = (ndims == 5) ? dst_dims[2] : 1;
conf.oh = (ndims == 3) ? 1 : dst_dims[ndims - 2];
conf.ow = dst_dims[ndims - 1];
conf.stride_d = (ndims == 5) ? desc.strides[0] : 1;
conf.stride_h = (ndims == 3) ? 1 : desc.strides[ndims - 4];
conf.stride_w = desc.strides[ndims - 3];
conf.kd = (ndims == 5) ? desc.kernel[0] : 1;
conf.kh = (ndims == 3) ? 1 : desc.kernel[ndims - 4];
conf.kw = desc.kernel[ndims - 3];
conf.dd = (ndims == 5) ? desc.dilation[0] : 0;
conf.dh = (ndims == 3) ? 0 : desc.dilation[ndims - 4];
conf.dw = desc.dilation[ndims - 3];
conf.f_pad = (ndims == 5) ? desc.padding[0][0] : 0;
conf.t_pad = (ndims == 3) ? 0 : desc.padding[0][ndims - 4];
conf.l_pad = desc.padding[0][ndims - 3];
conf.alg = desc.alg_kind;
conf.src_dt = src_mdw.data_type();
conf.dst_dt = dst_mdw.data_type();
conf.src_md_info = memory_desc_info_t::create(src_mdw);
conf.dst_md_info = memory_desc_info_t::create(dst_mdw);
conf.is_training = desc.prop_kind == prop_kind::forward_training;
conf.is_backward = desc.prop_kind == prop_kind::backward_data;
conf.attr_info = attr_info_t::create(&attr);
}
} } } } }