1 | #pragma once |
---|---|
2 | #include "taichi/runtime/gfx/runtime.h" |
3 | |
4 | namespace taichi::lang { |
5 | namespace gfx { |
6 | class KernelImpl : public aot::Kernel { |
7 | public: |
8 | explicit KernelImpl(GfxRuntime *runtime, GfxRuntime::RegisterParams &¶ms) |
9 | : runtime_(runtime), params_(std::move(params)) { |
10 | handle_ = runtime_->register_taichi_kernel(params_); |
11 | } |
12 | |
13 | void launch(RuntimeContext *ctx) override { |
14 | runtime_->launch_kernel(handle_, ctx); |
15 | } |
16 | |
17 | const GfxRuntime::RegisterParams ¶ms() { |
18 | return params_; |
19 | } |
20 | |
21 | private: |
22 | GfxRuntime *const runtime_; |
23 | GfxRuntime::KernelHandle handle_; |
24 | const GfxRuntime::RegisterParams params_; |
25 | }; |
26 | } // namespace gfx |
27 | } // namespace taichi::lang |
28 |