InfiniOps
Operator Library for Accelerators
Loading...
Searching...
No Matches
handle.h
Go to the documentation of this file.
1#ifndef INFINI_OPS_HANDLE_H_
2#define INFINI_OPS_HANDLE_H_
3
4#include <cstddef>
5#include <memory>
6
7#include "cloneable.h"
8
9namespace infini::ops {
10
11class Handle {
12 public:
13 virtual ~Handle() = default;
14
15 virtual std::unique_ptr<Handle> Clone() const {
16 return std::make_unique<Handle>(*this);
17 }
18
19 void* stream() const { return stream_; }
20
21 void* workspace() const { return workspace_; }
22
23 std::size_t workspace_size_in_bytes() const {
24 return workspace_size_in_bytes_;
25 }
26
27 void set_stream(void* stream) { stream_ = stream; }
28
29 void set_workspace(void* workspace) { workspace_ = workspace; }
30
32 workspace_size_in_bytes_ = workspace_size_in_bytes;
33 }
34
35 private:
36 void* stream_{nullptr};
37
38 void* workspace_{nullptr};
39
40 std::size_t workspace_size_in_bytes_{0};
41};
42
43} // namespace infini::ops
44
45#endif
Definition handle.h:11
void set_stream(void *stream)
Definition handle.h:27
void set_workspace_size_in_bytes(std::size_t workspace_size_in_bytes)
Definition handle.h:31
virtual ~Handle()=default
void * stream() const
Definition handle.h:19
void * workspace() const
Definition handle.h:21
std::size_t workspace_size_in_bytes() const
Definition handle.h:23
void set_workspace(void *workspace)
Definition handle.h:29
virtual std::unique_ptr< Handle > Clone() const
Definition handle.h:15
Definition generated/include/operator.h:28