OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DeviceKernel.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <memory>
20 
21 class CompilationContext;
22 
23 class DeviceClock {
24  public:
25  virtual void start() = 0;
26  virtual int stop() = 0;
27 
28  virtual ~DeviceClock() = default;
29 };
30 
31 class DeviceKernel {
32  public:
33  virtual void launch(unsigned int gridDimX,
34  unsigned int gridDimY,
35  unsigned int gridDimZ,
36  unsigned int blockDimX,
37  unsigned int blockDimY,
38  unsigned int blockDimZ,
39  unsigned int sharedMemBytes,
40  void** kernelParams,
41  bool optimize_block_and_grid_sizes) = 0;
42 
43  virtual void initializeDynamicWatchdog(bool could_interrupt, uint64_t cycle_budget) = 0;
44  virtual void initializeRuntimeInterrupter(const int device_id) = 0;
45  virtual void resetRuntimeInterrupter(const int device_id) = 0;
46 
47  virtual std::unique_ptr<DeviceClock> make_clock() = 0;
48  virtual char const* name() const = 0;
49 
50  virtual ~DeviceKernel() = default;
51 };
52 
53 std::unique_ptr<DeviceKernel> create_device_kernel(const CompilationContext* ctx,
54  int device_id);
virtual int stop()=0
virtual char const * name() const =0
virtual void initializeRuntimeInterrupter(const int device_id)=0
virtual std::unique_ptr< DeviceClock > make_clock()=0
virtual void launch(unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, void **kernelParams, bool optimize_block_and_grid_sizes)=0
virtual ~DeviceKernel()=default
virtual ~DeviceClock()=default
virtual void initializeDynamicWatchdog(bool could_interrupt, uint64_t cycle_budget)=0
virtual void start()=0
std::unique_ptr< DeviceKernel > create_device_kernel(const CompilationContext *ctx, int device_id)
virtual void resetRuntimeInterrupter(const int device_id)=0