Skip to content

Commit 15f1881

Browse files
committed
Added comments to the base class.
1 parent 6c4d859 commit 15f1881

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

kernel_tuner/backends/backend.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,42 +8,52 @@ class Backend(ABC):
88
"""Base class for kernel_tuner backends"""
99
@abstractmethod
1010
def ready_argument_list(self, arguments):
11+
""" This method must implement the allocation of the arguments on device memory. """
1112
pass
1213

1314
@abstractmethod
1415
def compile(self, kernel_instance):
16+
""" This method must implement the compilation of a kernel into a callable function. """
1517
pass
1618

1719
@abstractmethod
1820
def start_event(self):
21+
""" This method must implement the recording of the start of a measurement. """
1922
pass
2023

2124
@abstractmethod
2225
def stop_event(self):
26+
""" This method must implement the recording of the end of a measurement. """
2327
pass
2428

2529
@abstractmethod
2630
def kernel_finished(self):
31+
""" This method must implement a check that returns True if the kernel has finished, False otherwise. """
2732
pass
2833

2934
@abstractmethod
3035
def synchronize(self):
36+
""" This method must implement a barrier that halts execution until device has finished its tasks. """
3137
pass
3238

3339
@abstractmethod
3440
def run_kernel(self, func, gpu_args, threads, grid, stream):
41+
""" This method must implement the execution of the kernel on the device. """
3542
pass
3643

3744
@abstractmethod
3845
def memset(self, allocation, value, size):
46+
""" This method must implement setting the memory to a value on the device. """
3947
pass
4048

4149
@abstractmethod
4250
def memcpy_dtoh(self, dest, src):
51+
""" This method must implement a device to host copy. """
4352
pass
4453

4554
@abstractmethod
4655
def memcpy_htod(self, dest, src):
56+
""" This method must implement a host to device copy. """
4757
pass
4858

4959

@@ -55,14 +65,17 @@ def __init__(self, device, iterations, compiler_options, observers):
5565

5666
@abstractmethod
5767
def copy_constant_memory_args(self, cmem_args):
68+
""" This method must implement the allocation and copy of constant memory to the GPU. """
5869
pass
5970

6071
@abstractmethod
6172
def copy_shared_memory_args(self, smem_args):
73+
""" This method must implement the dynamic allocation of shared memory on the GPU. """
6274
pass
6375

6476
@abstractmethod
6577
def copy_texture_memory_args(self, texmem_args):
78+
""" This method must implement the allocation and copy of texture memory to the GPU. """
6679
pass
6780

6881

0 commit comments

Comments
 (0)