-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathkernel.h
More file actions
42 lines (28 loc) · 850 Bytes
/
kernel.h
File metadata and controls
42 lines (28 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef INFINI_OPS_HYGON_ADD_KERNEL_H_
#define INFINI_OPS_HYGON_ADD_KERNEL_H_
#include <utility>
// clang-format off
#include <cuda_runtime.h>
// clang-format on
#include "cuda/add/kernel.h"
namespace infini::ops {
namespace add {
struct HygonBackend {
using stream_t = cudaStream_t;
static constexpr auto malloc = [](auto&&... args) {
return cudaMalloc(std::forward<decltype(args)>(args)...);
};
static constexpr auto memcpy = cudaMemcpy;
static constexpr auto free = [](auto&&... args) {
return cudaFree(std::forward<decltype(args)>(args)...);
};
static constexpr auto memcpyH2D = cudaMemcpyHostToDevice;
};
} // namespace add
template <>
class Operator<Add, Device::Type::kHygon> : public CudaAdd<add::HygonBackend> {
public:
using CudaAdd<add::HygonBackend>::CudaAdd;
};
} // namespace infini::ops
#endif