"git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "e660a05fed40229a747ce63104c867ab143a0db4"
kernel_decl.h 2.44 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
/*!
 *  Copyright (c) 2020 by Contributors
 * \file array/kernel_decl.h
 * \brief Sparse matrix format-specific operator declarations.
 */
#ifndef DGL_ARRAY_KERNEL_DECL_H_
#define DGL_ARRAY_KERNEL_DECL_H_

#include <dgl/bcast.h>
#include <dgl/base_heterograph.h>
11
#include <dgl/runtime/ndarray.h>
12
13
14
15
16
17
18
19
20
21

#include <string>
#include <vector>

namespace dgl {
namespace aten {

/*!
 * \brief Generalized Sparse Matrix Dense Matrix Multiplication on Csr format.
 */
22
template <int XPU, typename IdType, int bits>
23
24
25
26
27
28
29
30
31
32
33
void SpMMCsr(const std::string& op, const std::string& reduce,
             const BcastOff& bcast,
             const aten::CSRMatrix& csr,
             NDArray ufeat,
             NDArray efeat,
             NDArray out,
             std::vector<NDArray> out_aux);

/*!
 * \brief Generalized Sparse Matrix Dense Matrix Multiplication on Coo format.
 */
34
template <int XPU, typename IdType, int bits>
35
36
37
38
39
40
41
42
43
44
45
void SpMMCoo(const std::string& op, const std::string& reduce,
             const BcastOff& bcast,
             const aten::COOMatrix& coo,
             NDArray ufeat,
             NDArray efeat,
             NDArray out,
             std::vector<NDArray> out_aux);

/*!
 * \brief Generalized Sampled Dense-Dense Matrix Multiplication on Csr format.
 */
46
template <int XPU, typename IdType, int bits>
47
48
49
void SDDMMCsr(const std::string& op,
              const BcastOff& bcast,
              const aten::CSRMatrix& csr,
50
51
52
53
54
              NDArray lhs,
              NDArray rhs,
              NDArray out,
              int lhs_target,
              int rhs_target);
55
56
57
58

/*!
 * \brief Generalized Sampled Dense-Dense Matrix Multiplication on Coo format.
 */
59
template <int XPU, typename IdType, int bits>
60
61
62
void SDDMMCoo(const std::string& op,
              const BcastOff& bcast,
              const aten::COOMatrix& coo,
63
64
65
66
67
              NDArray lhs,
              NDArray rhs,
              NDArray out,
              int lhs_target,
              int rhs_target);
68

69
70
71
/*!
 * \brief Segment reduce.
 */
72
template <int XPU, typename IdType, int bits>
73
74
75
76
77
78
79
80
81
void SegmentReduce(const std::string& op,
                   NDArray feat,
                   NDArray offsets,
                   NDArray out,
                   NDArray arg);

/*!
 * \brief Backward function of segment cmp.
 */
82
template <int XPU, typename IdType, int bits>
83
84
85
86
void BackwardSegmentCmp(NDArray feat,
                        NDArray arg,
                        NDArray out);

87
88
89
90
}  // namespace aten
}  // namespace dgl

#endif  // DGL_ARRAY_KERNEL_DECL_H_