Skip to content

Commit

Permalink
oneapi sparse (arrayfire#3469)
Browse files Browse the repository at this point in the history
* adds sparse_arith, sparse blas to oneapi backend
  • Loading branch information
syurkevi committed Jul 8, 2023
1 parent e9132c2 commit d74656f
Show file tree
Hide file tree
Showing 7 changed files with 1,308 additions and 259 deletions.
14 changes: 14 additions & 0 deletions src/backend/common/Binary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,27 @@ struct Binary<T, af_add_t> {
__DH__ T operator()(T lhs, T rhs) { return lhs + rhs; }
};

template<typename T>
struct Binary<T, af_sub_t> {
static __DH__ T init() { return scalar<T>(0); }

__DH__ T operator()(T lhs, T rhs) { return lhs - rhs; }
};

template<typename T>
struct Binary<T, af_mul_t> {
static __DH__ T init() { return scalar<T>(1); }

__DH__ T operator()(T lhs, T rhs) { return lhs * rhs; }
};

template<typename T>
struct Binary<T, af_div_t> {
static __DH__ T init() { return scalar<T>(1); }

__DH__ T operator()(T lhs, T rhs) { return lhs / rhs; }
};

template<typename T>
struct Binary<T, af_or_t> {
static __DH__ T init() { return scalar<T>(0); }
Expand Down
2 changes: 2 additions & 0 deletions src/backend/oneapi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ target_sources(afoneapi
kernel/scan_dim.hpp
kernel/sort.hpp
kernel/sort_by_key.hpp
kernel/sparse.hpp
kernel/sparse_arith.hpp
kernel/transpose.hpp
kernel/transpose_inplace.hpp
kernel/triangle.hpp
Expand Down
Loading

0 comments on commit d74656f

Please sign in to comment.