Skip to content

Commit d88387b

Browse files
Implemented a work-around for issue with forthcoming compiler
1 parent 5982027 commit d88387b

File tree

1 file changed

+32
-2
lines changed
  • dpctl/tensor/libtensor/include/kernels/elementwise_functions

1 file changed

+32
-2
lines changed

dpctl/tensor/libtensor/include/kernels/elementwise_functions/proj.hpp

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,30 @@ sycl::event proj_contig_impl(sycl::queue exec_q,
125125
exec_q, nelems, arg_p, res_p, depends);
126126
}
127127

128+
template <typename argTy>
129+
sycl::event
130+
proj_workaround_contig_impl(sycl::queue exec_q,
131+
size_t nelems,
132+
const char *arg_p,
133+
char *res_p,
134+
const std::vector<sycl::event> &depends = {})
135+
{
136+
using resTy = typename ProjOutputType<argTy>::value_type;
137+
138+
const argTy *arg_tp = reinterpret_cast<const argTy *>(arg_p);
139+
resTy *res_tp = reinterpret_cast<resTy *>(res_p);
140+
141+
sycl::event e = exec_q.submit([&](sycl::handler &cgh) {
142+
cgh.depends_on(depends);
143+
cgh.parallel_for({nelems}, [=](sycl::id<1> id) {
144+
size_t i = id[0];
145+
res_tp[i] = ProjFunctor<argTy, resTy>{}(arg_tp[i]);
146+
});
147+
});
148+
149+
return e;
150+
}
151+
128152
template <typename fnT, typename T> struct ProjContigFactory
129153
{
130154
fnT get()
@@ -135,8 +159,14 @@ template <typename fnT, typename T> struct ProjContigFactory
135159
return fn;
136160
}
137161
else {
138-
fnT fn = proj_contig_impl<T>;
139-
return fn;
162+
if constexpr (std::is_same_v<T, std::complex<double>>) {
163+
fnT fn = proj_workaround_contig_impl<T>;
164+
return fn;
165+
}
166+
else {
167+
fnT fn = proj_contig_impl<T>;
168+
return fn;
169+
}
140170
}
141171
}
142172
};

0 commit comments

Comments
 (0)