Skip to content

Commit 6933675

Browse files
committed
Fixed type dispatching for contiguous copy and cast
- CopyAndCastContigFactory changed to reflect that contiguous copying and casting is now possible for more than strictly different data types
1 parent 7d59843 commit 6933675

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

dpctl/tensor/libtensor/include/kernels/copy_and_cast.hpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ template <typename fnT, typename D, typename S> struct CopyAndCastGenericFactory
197197
}
198198
};
199199

200-
// Specialization of copy_and_cast for contiguous arrays of different data types
200+
// Specialization of copy_and_cast for contiguous arrays
201201

202202
template <typename srcT,
203203
typename dstT,
@@ -339,21 +339,15 @@ sycl::event copy_and_cast_contig_impl(sycl::queue q,
339339

340340
/*!
341341
* @brief Factory to get specialized function pointer for casting and copying
342-
* contiguous arrays of different types.
342+
* contiguous arrays.
343343
* @ingroup CopyAndCastKernels
344344
*/
345345
template <typename fnT, typename D, typename S> struct CopyAndCastContigFactory
346346
{
347347
fnT get()
348348
{
349-
if constexpr (std::is_same_v<D, S>) {
350-
fnT fn = nullptr;
351-
return fn;
352-
}
353-
else {
354-
fnT f = copy_and_cast_contig_impl<D, S>;
355-
return f;
356-
}
349+
fnT f = copy_and_cast_contig_impl<D, S>;
350+
return f;
357351
}
358352
};
359353

0 commit comments

Comments
 (0)