fml  0.1-0
Fused Matrix Library
launcher.hh
1 // This file is part of fml which is released under the Boost Software
2 // License, Version 1.0. See accompanying file LICENSE or copy at
3 // https://www.boost.org/LICENSE_1_0.txt
4 
5 #ifndef FML_GPU_INTERNALS_LAUNCHER_H
6 #define FML_GPU_INTERNALS_LAUNCHER_H
7 #pragma once
8 
9 
10 #include "../../_internals/types.hh"
11 
12 
13 namespace fml
14 {
15  namespace kernel_launcher
16  {
17  namespace
18  {
19  static const int BLOCK_SIZE = 16;
20 
21  static inline int grid_len(len_t len)
22  {
23  return (len + BLOCK_SIZE - 1) / BLOCK_SIZE;
24  }
25  }
26 
27 
28 
29  static inline dim3 dim_block1()
30  {
31  dim3 block(BLOCK_SIZE);
32  return block;
33  }
34 
35  static inline dim3 dim_block2()
36  {
37  dim3 block(BLOCK_SIZE, BLOCK_SIZE);
38  return block;
39  }
40 
41 
42 
43  static inline dim3 dim_grid(len_t len)
44  {
45  dim3 grid(grid_len(len));
46  return grid;
47  }
48 
49  static inline dim3 dim_grid(len_t m, len_t n)
50  {
51  dim3 grid(grid_len(m), grid_len(n));
52  return grid;
53  }
54  }
55 }
56 
57 
58 #endif
fml
Core namespace.
Definition: dimops.hh:10