Commit 19c4169
authored
Feature/occupancy (#648)
* Fix typo: stream._handle -> stream.handle
Stream class does not have _handle data member.
* Move definition of LaunchConfig class to separate file
This is necessary to avoid circular dependency.
Cluster-related occupancy functions need LaunchConfig.
Occupancy functions are defined in _module.py, and _launcher.py
that used to house definition of LaunchConfig imports Kernel
from _module.py
* Introduce _module.KernelOccupancy class
This class defines kernel occupancy query methods.
- max_active_blocks_per_multiprocessor
- max_potential_block_size
- available_dynamic_shared_memory_per_block
- max_potential_cluster_size
- max_active_clusters
Implementation is based on driver API. The following
occupancy-related driver functions are not used
- `cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags`
- `cuOccupancyMaxPotentialBlockSizeWithFlags`
In `cuOccupancyMaxPotentialBlockSize`, only constant dynamic shared-memory size
is supported for now. Supporting variable dynamic shared-memory size that depends
on the block size is deferred until design is resolved.
* Add occupancy tests, except for cluster-related queries
* Fix type in querying handle from Stream argument
* Add tests for cluster-related occupancy descriptors
* Introduce MaxPotentialBlockSizeOccupancyResult named tuple
Use it as return type for the KernelOccupancy.max_potential_block_size
output.
* KernelOccupancy.max_potential_block_size support for CUoccupancyB2DSize
cuda_utils.driver.CUoccupancyB2DSize type is supported. Required
size of dynamic shared memory allocation renamed to
dynamic_shared_memory_needed
* Add test for B2DSize usage in max_potential_block_size
Test requires Numba. If numba is absent, it is skipped, otherwise
`numba.cfunc` is used to compile Python function. ctypes.CFuncPtr
object obtained from cfunc_res.ctypes is converted to
CUoccupancyB2DSize.
* Improved max_potential_block_size.__doc__
Expanded the docstring, added advisory about possibility of deadlocks
should function encoded CUoccupancyB2DSize require GIL.
Added argument type validation for dynamic_shared_memory_needed
argument.
* Add test for dynamic_shared_memory_needed arg of invalid type
* Mention feature/occupancy in 0.3.0 release notes
* Add symbols to api_private.rst
* Reduce test name verbosity
Occupancy tests need not contain saxpy in the test name even though it
uses saxpy kernel for testing.
* Add doc-strings to KernelOccupancy methods.
* fix rendering1 parent 064b9ea commit 19c4169
7 files changed
Lines changed: 407 additions & 70 deletions
File tree
- cuda_core
- cuda/core/experimental
- docs/source
- release
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | 5 | | |
8 | | - | |
9 | 6 | | |
| 7 | + | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
14 | | - | |
15 | | - | |
16 | 12 | | |
17 | 13 | | |
18 | 14 | | |
| |||
37 | 33 | | |
38 | 34 | | |
39 | 35 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | 36 | | |
89 | 37 | | |
90 | 38 | | |
| |||
114 | 62 | | |
115 | 63 | | |
116 | 64 | | |
| 65 | + | |
117 | 66 | | |
118 | 67 | | |
119 | 68 | | |
| |||
127 | 76 | | |
128 | 77 | | |
129 | 78 | | |
130 | | - | |
131 | | - | |
132 | | - | |
| 79 | + | |
133 | 80 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | 81 | | |
145 | 82 | | |
146 | 83 | | |
147 | 84 | | |
148 | 85 | | |
149 | | - | |
| 86 | + | |
150 | 87 | | |
151 | 88 | | |
0 commit comments