#include "gpu/intel/sum/simple.hpp"
#include "common/c_types_map.hpp"
namespace dnnl {
namespace impl {
namespace gpu {
namespace intel {
namespace sum {
template <data_type_t data_type>
status_t simple_t<data_type>::execute(const exec_ctx_t &ctx) const {
auto &output = CTX_OUT_STORAGE(DNNL_ARG_DST);
const int num_arrs = pd()->n_inputs();
const memory_desc_wrapper o_d(pd()->dst_md());
const size_t nelems = o_d.nelems();
for (int a = 0; a < num_arrs; ++a) {
auto &input = CTX_IN_STORAGE(DNNL_ARG_MULTIPLE_SRC + a);
const float scale = pd()->scales()[a];
compute::kernel_arg_list_t arg_list;
arg_list.set(0, input);
arg_list.set(1, output);
arg_list.set(2, scale);
arg_list.set(3, a);
compute::range_t gws(nelems);
auto nd_range = compute::nd_range_t(gws);
status_t status = parallel_for(ctx, nd_range, kernel_, arg_list);
if (status != status::success) return status;
}
return status::success;
}
template struct simple_t<data_type::f32>;
} } } } }