Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cpp/oneapi/dal/backend/interop/table_conversion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,14 @@ inline daal::data_management::CSRNumericTablePtr wrap_by_host_csr_adapter(const
template <typename Float>
inline daal::data_management::CSRNumericTablePtr convert_to_daal_table(const csr_table& table,
bool need_copy = false) {
if (need_copy)
// Always copy the table, and do not try to wrap it, if need_copy is specified by the caller.
// Because the table's data can be allocated on device and it will lead to crash in wrap_by_host_csr_adapter
return copy_to_daal_csr_table<Float>(table);

auto wrapper = wrap_by_host_csr_adapter(table);
return need_copy || !wrapper ? copy_to_daal_csr_table<Float>(table) : wrapper;
// copy the table if wrap failed
return !wrapper ? copy_to_daal_csr_table<Float>(table) : wrapper;
}

template <typename Data>
Expand Down