ZhengyangZhang commited on
Commit
f835406
·
verified ·
1 Parent(s): 5279a7e

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. lib/python3.12/site-packages/certifi/__init__.py +4 -0
  2. lib/python3.12/site-packages/certifi/__main__.py +12 -0
  3. lib/python3.12/site-packages/certifi/__pycache__/__init__.cpython-312.pyc +0 -0
  4. lib/python3.12/site-packages/certifi/__pycache__/__main__.cpython-312.pyc +0 -0
  5. lib/python3.12/site-packages/certifi/__pycache__/core.cpython-312.pyc +0 -0
  6. lib/python3.12/site-packages/certifi/cacert.pem +0 -0
  7. lib/python3.12/site-packages/certifi/core.py +83 -0
  8. lib/python3.12/site-packages/certifi/py.typed +0 -0
  9. lib/python3.12/site-packages/cusparselt/LICENSE.txt +165 -0
  10. lib/python3.12/site-packages/cusparselt/include/cusparseLt.h +371 -0
  11. lib/python3.12/site-packages/distro/__init__.py +54 -0
  12. lib/python3.12/site-packages/distro/__main__.py +4 -0
  13. lib/python3.12/site-packages/distro/__pycache__/__init__.cpython-312.pyc +0 -0
  14. lib/python3.12/site-packages/distro/__pycache__/__main__.cpython-312.pyc +0 -0
  15. lib/python3.12/site-packages/distro/__pycache__/distro.cpython-312.pyc +0 -0
  16. lib/python3.12/site-packages/distro/distro.py +1403 -0
  17. lib/python3.12/site-packages/distro/py.typed +0 -0
  18. lib/python3.12/site-packages/nvidia/__init__.py +0 -0
  19. lib/python3.12/site-packages/nvidia/cuda_nvrtc/__init__.py +0 -0
  20. lib/python3.12/site-packages/nvidia/cuda_nvrtc/__pycache__/__init__.cpython-312.pyc +0 -0
  21. lib/python3.12/site-packages/nvidia/cuda_nvrtc/include/__init__.py +0 -0
  22. lib/python3.12/site-packages/nvidia/cuda_nvrtc/include/__pycache__/__init__.cpython-312.pyc +0 -0
  23. lib/python3.12/site-packages/nvidia/cuda_nvrtc/include/nvrtc.h +869 -0
  24. lib/python3.12/site-packages/nvidia/cuda_nvrtc/lib/__init__.py +0 -0
  25. lib/python3.12/site-packages/nvidia/cuda_nvrtc/lib/__pycache__/__init__.cpython-312.pyc +0 -0
  26. lib/python3.12/site-packages/nvidia/cudnn/__init__.py +0 -0
  27. lib/python3.12/site-packages/nvidia/cudnn/__pycache__/__init__.cpython-312.pyc +0 -0
  28. lib/python3.12/site-packages/nvidia/cudnn/include/__init__.py +0 -0
  29. lib/python3.12/site-packages/nvidia/cudnn/include/__pycache__/__init__.cpython-312.pyc +0 -0
  30. lib/python3.12/site-packages/nvidia/cudnn/include/cudnn.h +68 -0
  31. lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_adv.h +671 -0
  32. lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_adv_v9.h +671 -0
  33. lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_backend.h +60 -0
  34. lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_backend_v9.h +60 -0
  35. lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_cnn.h +693 -0
  36. lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_cnn_v9.h +693 -0
  37. lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_graph.h +909 -0
  38. lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_graph_v9.h +909 -0
  39. lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_ops.h +1316 -0
  40. lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_ops_v9.h +1316 -0
  41. lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_v9.h +68 -0
  42. lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_version.h +70 -0
  43. lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_version_v9.h +70 -0
  44. lib/python3.12/site-packages/nvidia/cudnn/lib/__init__.py +0 -0
  45. lib/python3.12/site-packages/nvidia/cudnn/lib/__pycache__/__init__.cpython-312.pyc +0 -0
  46. lib/python3.12/site-packages/nvidia/cufft/__init__.py +0 -0
  47. lib/python3.12/site-packages/nvidia/cufft/include/__init__.py +0 -0
  48. lib/python3.12/site-packages/nvidia/cufft/include/cudalibxt.h +97 -0
  49. lib/python3.12/site-packages/nvidia/cufft/include/cufft.h +334 -0
  50. lib/python3.12/site-packages/nvidia/cufft/include/cufftw.h +465 -0
lib/python3.12/site-packages/certifi/__init__.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ from .core import contents, where
2
+
3
+ __all__ = ["contents", "where"]
4
+ __version__ = "2026.01.04"
lib/python3.12/site-packages/certifi/__main__.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+
3
+ from certifi import contents, where
4
+
5
+ parser = argparse.ArgumentParser()
6
+ parser.add_argument("-c", "--contents", action="store_true")
7
+ args = parser.parse_args()
8
+
9
+ if args.contents:
10
+ print(contents())
11
+ else:
12
+ print(where())
lib/python3.12/site-packages/certifi/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (313 Bytes). View file
 
lib/python3.12/site-packages/certifi/__pycache__/__main__.cpython-312.pyc ADDED
Binary file (628 Bytes). View file
 
lib/python3.12/site-packages/certifi/__pycache__/core.cpython-312.pyc ADDED
Binary file (2.06 kB). View file
 
lib/python3.12/site-packages/certifi/cacert.pem ADDED
The diff for this file is too large to render. See raw diff
 
lib/python3.12/site-packages/certifi/core.py ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ certifi.py
3
+ ~~~~~~~~~~
4
+
5
+ This module returns the installation location of cacert.pem or its contents.
6
+ """
7
+ import sys
8
+ import atexit
9
+
10
+ def exit_cacert_ctx() -> None:
11
+ _CACERT_CTX.__exit__(None, None, None) # type: ignore[union-attr]
12
+
13
+
14
+ if sys.version_info >= (3, 11):
15
+
16
+ from importlib.resources import as_file, files
17
+
18
+ _CACERT_CTX = None
19
+ _CACERT_PATH = None
20
+
21
+ def where() -> str:
22
+ # This is slightly terrible, but we want to delay extracting the file
23
+ # in cases where we're inside of a zipimport situation until someone
24
+ # actually calls where(), but we don't want to re-extract the file
25
+ # on every call of where(), so we'll do it once then store it in a
26
+ # global variable.
27
+ global _CACERT_CTX
28
+ global _CACERT_PATH
29
+ if _CACERT_PATH is None:
30
+ # This is slightly janky, the importlib.resources API wants you to
31
+ # manage the cleanup of this file, so it doesn't actually return a
32
+ # path, it returns a context manager that will give you the path
33
+ # when you enter it and will do any cleanup when you leave it. In
34
+ # the common case of not needing a temporary file, it will just
35
+ # return the file system location and the __exit__() is a no-op.
36
+ #
37
+ # We also have to hold onto the actual context manager, because
38
+ # it will do the cleanup whenever it gets garbage collected, so
39
+ # we will also store that at the global level as well.
40
+ _CACERT_CTX = as_file(files("certifi").joinpath("cacert.pem"))
41
+ _CACERT_PATH = str(_CACERT_CTX.__enter__())
42
+ atexit.register(exit_cacert_ctx)
43
+
44
+ return _CACERT_PATH
45
+
46
+ def contents() -> str:
47
+ return files("certifi").joinpath("cacert.pem").read_text(encoding="ascii")
48
+
49
+ else:
50
+
51
+ from importlib.resources import path as get_path, read_text
52
+
53
+ _CACERT_CTX = None
54
+ _CACERT_PATH = None
55
+
56
+ def where() -> str:
57
+ # This is slightly terrible, but we want to delay extracting the
58
+ # file in cases where we're inside of a zipimport situation until
59
+ # someone actually calls where(), but we don't want to re-extract
60
+ # the file on every call of where(), so we'll do it once then store
61
+ # it in a global variable.
62
+ global _CACERT_CTX
63
+ global _CACERT_PATH
64
+ if _CACERT_PATH is None:
65
+ # This is slightly janky, the importlib.resources API wants you
66
+ # to manage the cleanup of this file, so it doesn't actually
67
+ # return a path, it returns a context manager that will give
68
+ # you the path when you enter it and will do any cleanup when
69
+ # you leave it. In the common case of not needing a temporary
70
+ # file, it will just return the file system location and the
71
+ # __exit__() is a no-op.
72
+ #
73
+ # We also have to hold onto the actual context manager, because
74
+ # it will do the cleanup whenever it gets garbage collected, so
75
+ # we will also store that at the global level as well.
76
+ _CACERT_CTX = get_path("certifi", "cacert.pem")
77
+ _CACERT_PATH = str(_CACERT_CTX.__enter__())
78
+ atexit.register(exit_cacert_ctx)
79
+
80
+ return _CACERT_PATH
81
+
82
+ def contents() -> str:
83
+ return read_text("certifi", "cacert.pem", encoding="ascii")
lib/python3.12/site-packages/certifi/py.typed ADDED
File without changes
lib/python3.12/site-packages/cusparselt/LICENSE.txt ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ LICENSE AGREEMENT FOR NVIDIA SOFTWARE DEVELOPMENT KITS
2
+
3
+ This license agreement, including exhibits attached ("Agreement”) is a legal agreement between you and NVIDIA Corporation ("NVIDIA") and governs your use of a NVIDIA software development kit (“SDK”).
4
+
5
+ Each SDK has its own set of software and materials, but here is a description of the types of items that may be included in a SDK: source code, header files, APIs, data sets and assets (examples include images, textures, models, scenes, videos, native API input/output files), binary software, sample code, libraries, utility programs, programming code and documentation.
6
+
7
+ This Agreement can be accepted only by an adult of legal age of majority in the country in which the SDK is used.
8
+
9
+ If you are entering into this Agreement on behalf of a company or other legal entity, you represent that you have the legal authority to bind the entity to this Agreement, in which case “you” will mean the entity you represent.
10
+
11
+ If you don’t have the required age or authority to accept this Agreement, or if you don’t accept all the terms and conditions of this Agreement, do not download, install or use the SDK.
12
+
13
+ You agree to use the SDK only for purposes that are permitted by (a) this Agreement, and (b) any applicable law, regulation or generally accepted practices or guidelines in the relevant jurisdictions.
14
+
15
+ 1. License.
16
+
17
+ 1.1 Grant
18
+
19
+ Subject to the terms of this Agreement, NVIDIA hereby grants you a non-exclusive, non-transferable license, without the right to sublicense (except as expressly provided in this Agreement) to:
20
+
21
+ (i) Install and use the SDK,
22
+
23
+ (ii) Modify and create derivative works of sample source code delivered in the SDK, and
24
+
25
+ (iii) Distribute those portions of the SDK that are identified in this Agreement as distributable, as incorporated in object code format into a software application that meets the distribution requirements indicated in this Agreement.
26
+
27
+ 1.2 Distribution Requirements
28
+
29
+ These are the distribution requirements for you to exercise the distribution grant:
30
+
31
+ (i) Your application must have material additional functionality, beyond the included portions of the SDK.
32
+
33
+ (ii) The distributable portions of the SDK shall only be accessed by your application.
34
+
35
+ (iii) The following notice shall be included in modifications and derivative works of sample source code distributed: “This software contains source code provided by NVIDIA Corporation.”
36
+
37
+ (iv) Unless a developer tool is identified in this Agreement as distributable, it is delivered for your internal use only.
38
+
39
+ (v) The terms under which you distribute your application must be consistent with the terms of this Agreement, including (without limitation) terms relating to the license grant and license restrictions and protection of NVIDIA’s intellectual property rights. Additionally, you agree that you will protect the privacy, security and legal rights of your application users.
40
+
41
+ (vi) You agree to notify NVIDIA in writing of any known or suspected distribution or use of the SDK not in compliance with the requirements of this Agreement, and to enforce the terms of your agreements with respect to distributed SDK.
42
+
43
+ 1.3 Authorized Users
44
+
45
+ You may allow employees and contractors of your entity or of your subsidiary(ies) to access and use the SDK from your secure network to perform work on your behalf.
46
+
47
+ If you are an academic institution you may allow users enrolled or employed by the academic institution to access and use the SDK from your secure network.
48
+
49
+ You are responsible for the compliance with the terms of this Agreement by your authorized users. If you become aware that your authorized users didn’t follow the terms of this Agreement, you agree to take reasonable steps to resolve the non-compliance and prevent new occurrences.
50
+
51
+ 1.4 Pre-Release SDK
52
+ The SDK versions identified as alpha, beta, preview or otherwise as pre-release, may not be fully functional, may contain errors or design flaws, and may have reduced or different security, privacy, accessibility, availability, and reliability standards relative to commercial versions of NVIDIA software and materials. Use of a pre-release SDK may result in unexpected results, loss of data, project delays or other unpredictable damage or loss.
53
+ You may use a pre-release SDK at your own risk, understanding that pre-release SDKs are not intended for use in production or business-critical systems.
54
+ NVIDIA may choose not to make available a commercial version of any pre-release SDK. NVIDIA may also choose to abandon development and terminate the availability of a pre-release SDK at any time without liability.
55
+ 1.5 Updates
56
+
57
+ NVIDIA may, at its option, make available patches, workarounds or other updates to this SDK. Unless the updates are provided with their separate governing terms, they are deemed part of the SDK licensed to you as provided in this Agreement.
58
+
59
+ You agree that the form and content of the SDK that NVIDIA provides may change without prior notice to you. While NVIDIA generally maintains compatibility between versions, NVIDIA may in some cases make changes that introduce incompatibilities in future versions of the SDK.
60
+
61
+ 1.6 Third Party Licenses
62
+
63
+ The SDK may come bundled with, or otherwise include or be distributed with, third-party software licensed by a NVIDIA supplier and/or open source software provided under an open source license. Use of third-party software is subject to the third-party license terms, or in the absence of third-party terms, the terms of this Agreement. Copyright to third party software is held by the copyright holders indicated in the third-party software or license.
64
+
65
+ 1.7 Reservation of Rights
66
+
67
+ NVIDIA reserves all rights, title and interest in and to the SDK not expressly granted to you under this Agreement.
68
+
69
+ 2. Limitations.
70
+
71
+ The following license limitations apply to your use of the SDK:
72
+
73
+ 2.1 You may not reverse engineer, decompile or disassemble, or remove copyright or other proprietary notices from any portion of the SDK or copies of the SDK.
74
+
75
+ 2.2 Except as expressly provided in this Agreement, you may not copy, sell, rent, sublicense, transfer, distribute, modify, or create derivative works of any portion of the SDK. For clarity, you may not distribute or sublicense the SDK as a stand-alone product.
76
+
77
+ 2.3 Unless you have an agreement with NVIDIA for this purpose, you may not indicate that an application created with the SDK is sponsored or endorsed by NVIDIA.
78
+
79
+ 2.4 You may not bypass, disable, or circumvent any encryption, security, digital rights management or authentication mechanism in the SDK.
80
+
81
+ 2.5 You may not use the SDK in any manner that would cause it to become subject to an open source software license. As examples, licenses that require as a condition of use, modification, and/or distribution that the SDK be (i) disclosed or distributed in source code form; (ii) licensed for the purpose of making derivative works; or (iii) redistributable at no charge.
82
+
83
+ 2.6 Unless you have an agreement with NVIDIA for this purpose, you may not use the SDK with any system or application where the use or failure of the system or application can reasonably be expected to threaten or result in personal injury, death, or catastrophic loss. Examples include use in avionics, navigation, military, medical, life support or other life critical applications. NVIDIA does not design, test or manufacture the SDK for these critical uses and NVIDIA shall not be liable to you or any third party, in whole or in part, for any claims or damages arising from such uses.
84
+
85
+ 2.7 You agree to defend, indemnify and hold harmless NVIDIA and its affiliates, and their respective employees, contractors, agents, officers and directors, from and against any and all claims, damages, obligations, losses, liabilities, costs or debt, fines, restitutions and expenses (including but not limited to attorney’s fees and costs incident to establishing the right of indemnification) arising out of or related to your use of the SDK outside of the scope of this Agreement, or not in compliance with its terms.
86
+
87
+ 3. Ownership.
88
+
89
+ 3.1 NVIDIA or its licensors hold all rights, title and interest in and to the SDK and its modifications and derivative works, including their respective intellectual property rights, subject to your rights under Section 3.2. This SDK may include software and materials from NVIDIA’s licensors, and these licensors are intended third party beneficiaries that may enforce this Agreement with respect to their intellectual property rights.
90
+
91
+ 3.2 You hold all rights, title and interest in and to your applications and your derivative works of the sample source code delivered in the SDK, including their respective intellectual property rights, subject to NVIDIA’s rights under section 3.1.
92
+
93
+ 3.3 You may, but don’t have to, provide to NVIDIA suggestions, feature requests or other feedback regarding the SDK, including possible enhancements or modifications to the SDK. For any feedback that you voluntarily provide, you hereby grant NVIDIA and its affiliates a perpetual, non-exclusive, worldwide, irrevocable license to use, reproduce, modify, license, sublicense (through multiple tiers of sublicensees), and distribute (through multiple tiers of distributors) it without the payment of any royalties or fees to you. NVIDIA will use feedback at its choice. NVIDIA is constantly looking for ways to improve its products, so you may send feedback to NVIDIA through the developer portal at https://developer.nvidia.com.
94
+
95
+ 4. No Warranties.
96
+
97
+ THE SDK IS PROVIDED BY NVIDIA “AS IS” AND “WITH ALL FAULTS.” TO THE MAXIMUM EXTENT PERMITTED BY LAW, NVIDIA AND ITS AFFILIATES EXPRESSLY DISCLAIM ALL WARRANTIES OF ANY KIND OR NATURE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, NON-INFRINGEMENT, OR THE ABSENCE OF ANY DEFECTS THEREIN, WHETHER LATENT OR PATENT. NO WARRANTY IS MADE ON THE BASIS OF TRADE USAGE, COURSE OF DEALING OR COURSE OF TRADE.
98
+
99
+ 5. Limitations of Liability.
100
+
101
+ TO THE MAXIMUM EXTENT PERMITTED BY LAW, NVIDIA AND ITS AFFILIATES SHALL NOT BE LIABLE FOR ANY SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL DAMAGES, OR ANY LOST PROFITS, LOSS OF USE, LOSS OF DATA OR LOSS OF GOODWILL, OR THE COSTS OF PROCURING SUBSTITUTE PRODUCTS, ARISING OUT OF OR IN CONNECTION WITH THIS AGREEMENT OR THE USE OR PERFORMANCE OF THE SDK, WHETHER SUCH LIABILITY ARISES FROM ANY CLAIM BASED UPON BREACH OF CONTRACT, BREACH OF WARRANTY, TORT (INCLUDING NEGLIGENCE), PRODUCT LIABILITY OR ANY OTHER CAUSE OF ACTION OR THEORY OF LIABILITY. IN NO EVENT WILL NVIDIA’S AND ITS AFFILIATES TOTAL CUMULATIVE LIABILITY UNDER OR ARISING OUT OF THIS AGREEMENT EXCEED US$10.00. THE NATURE OF THE LIABILITY OR THE NUMBER OF CLAIMS OR SUITS SHALL NOT ENLARGE OR EXTEND THIS LIMIT.
102
+
103
+ These exclusions and limitations of liability shall apply regardless if NVIDIA or its affiliates have been advised of the possibility of such damages, and regardless of whether a remedy fails its essential purpose. These exclusions and limitations of liability form an essential basis of the bargain between the parties, and, absent any of these exclusions or limitations of liability, the provisions of this Agreement, including, without limitation, the economic terms, would be substantially different.
104
+
105
+ 6. Termination.
106
+
107
+ 6.1 This Agreement will continue to apply until terminated by either you or NVIDIA as described below.
108
+
109
+ 6.2 If you want to terminate this Agreement, you may do so by stopping to use the SDK.
110
+
111
+ 6.3 NVIDIA may, at any time, terminate this Agreement if: (i) you fail to comply with any term of this Agreement and the non-compliance is not fixed within thirty (30) days following notice from NVIDIA (or immediately if you violate NVIDIA’s intellectual property rights); (ii) you commence or participate in any legal proceeding against NVIDIA with respect to the SDK; or (iii) NVIDIA decides to no longer provide the SDK in a country or, in NVIDIA’s sole discretion, the continued use of it is no longer commercially viable.
112
+
113
+ 6.4 Upon any termination of this Agreement, you agree to promptly discontinue use of the SDK and destroy all copies in your possession or control. Your prior distributions in accordance with this Agreement are not affected by the termination of this Agreement. Upon written request, you will certify in writing that you have complied with your commitments under this section. Upon any termination of this Agreement all provisions survive except for the licenses granted to you.
114
+
115
+ 7. General.
116
+
117
+ If you wish to assign this Agreement or your rights and obligations, including by merger, consolidation, dissolution or operation of law, contact NVIDIA to ask for permission. Any attempted assignment not approved by NVIDIA in writing shall be void and of no effect. NVIDIA may assign, delegate or transfer this Agreement and its rights and obligations, and if to a non-affiliate you will be notified.
118
+
119
+ You agree to cooperate with NVIDIA and provide reasonably requested information to verify your compliance with this Agreement.
120
+
121
+ This Agreement will be governed in all respects by the laws of the United States and of the State of Delaware as those laws are applied to contracts entered into and performed entirely within Delaware by Delaware residents, without regard to the conflicts of laws principles. The United Nations Convention on Contracts for the International Sale of Goods is specifically disclaimed. You agree to all terms of this Agreement in the English language.
122
+
123
+ The state or federal courts residing in Santa Clara County, California shall have exclusive jurisdiction over any dispute or claim arising out of this Agreement. Notwithstanding this, you agree that NVIDIA shall still be allowed to apply for injunctive remedies or an equivalent type of urgent legal relief in any jurisdiction.
124
+
125
+ If any court of competent jurisdiction determines that any provision of this Agreement is illegal, invalid or unenforceable, such provision will be construed as limited to the extent necessary to be consistent with and fully enforceable under the law and the remaining provisions will remain in full force and effect. Unless otherwise specified, remedies are cumulative.
126
+
127
+ Each party acknowledges and agrees that the other is an independent contractor in the performance of this Agreement.
128
+
129
+ The SDK has been developed entirely at private expense and is “commercial items” consisting of “commercial computer software” and “commercial computer software documentation” provided with RESTRICTED RIGHTS. Use, duplication or disclosure by the U.S. Government or a U.S. Government subcontractor is subject to the restrictions in this Agreement pursuant to DFARS 227.7202-3(a) or as set forth in subparagraphs (b)(1) and (2) of the Commercial Computer Software - Restricted Rights clause at FAR 52.227-19, as applicable. Contractor/manufacturer is NVIDIA, 2788 San Tomas Expressway, Santa Clara, CA 95051.
130
+
131
+ The SDK is subject to United States export laws and regulations. You agree that you will not ship, transfer or export the SDK into any country, or use the SDK in any manner, prohibited by the United States Bureau of Industry and Security or economic sanctions regulations administered by the U.S. Department of Treasury’s Office of Foreign Assets Control (OFAC), or any applicable export laws, restrictions or regulations. These laws include restrictions on destinations, end users and end use. By accepting this Agreement, you confirm that you are not a resident or citizen of any country currently embargoed by the U.S. and that you are not otherwise prohibited from receiving the SDK.
132
+
133
+ Any notice delivered by NVIDIA to you under this Agreement will be delivered via mail, email or fax. You agree that any notices that NVIDIA sends you electronically will satisfy any legal communication requirements. Please direct your legal notices or other correspondence to NVIDIA Corporation, 2788 San Tomas Expressway, Santa Clara, California 95051, United States of America, Attention: Legal Department.
134
+
135
+ This Agreement and any exhibits incorporated into this Agreement constitute the entire agreement of the parties with respect to the subject matter of this Agreement and supersede all prior negotiations or documentation exchanged between the parties relating to this subject matter. Any additional and/or conflicting terms on documents issued by you are null, void, and invalid. Any amendment or waiver under this Agreement shall be in writing and signed by representatives of both parties.
136
+
137
+ (v. October 12, 2020)
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+ cuSPARSELt SUPPLEMENT TO SOFTWARE LICENSE AGREEMENT FOR NVIDIA SOFTWARE DEVELOPMENT KITS
154
+
155
+ The terms in this supplement govern your use of the NVIDIA cuSPARSELt SDK under the terms of your license agreement (“Agreement”) as modified by this supplement. Capitalized terms used but not defined below have the meaning assigned to them in the Agreement.
156
+
157
+ This supplement is an exhibit to the Agreement and is incorporated as an integral part of the Agreement. In the event of conflict between the terms in this supplement and the terms in the Agreement, the terms in this supplement govern.
158
+
159
+ 1. License Scope. The SDK is licensed for you to develop applications only for use in systems with NVIDIA GPUs.
160
+
161
+ 2. Distribution. The following portions of the SDK are distributable under the Agreement: the runtimes files ending with .so and .h as part of your application.
162
+
163
+ 3. Licensing. If the distribution terms in this Agreement are not suitable for your organization, or for any questions regarding this Agreement, please contact NVIDIA at nvidia-compute-license-questions@nvidia.com
164
+
165
+ (v. October 12, 2020)
lib/python3.12/site-packages/cusparselt/include/cusparseLt.h ADDED
@@ -0,0 +1,371 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
3
+ *
4
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
5
+ * and proprietary rights in and to this software, related documentation
6
+ * and any modifications thereto. Any use, reproduction, disclosure or
7
+ * distribution of this software and related documentation without an express
8
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
9
+ */
10
+ #if !defined(CUSPARSELT_HEADER_)
11
+ #define CUSPARSELT_HEADER_
12
+
13
+ #include "cusparse.h" // cusparseStatus_t
14
+
15
+ #include <cstddef> // size_t
16
+ #include <driver_types.h> // cudaStream_t
17
+ #include <library_types.h> // cudaDataType
18
+ #include <stdint.h> // uint8_t
19
+
20
+ //##############################################################################
21
+ //# CUSPARSELT VERSION INFORMATION
22
+ //##############################################################################
23
+
24
+ #define CUSPARSELT_VER_MAJOR 0
25
+ #define CUSPARSELT_VER_MINOR 6
26
+ #define CUSPARSELT_VER_PATCH 2
27
+ #define CUSPARSELT_VER_BUILD 3
28
+ #define CUSPARSELT_VERSION (CUSPARSELT_VER_MAJOR * 1000 + \
29
+ CUSPARSELT_VER_MINOR * 100 + \
30
+ CUSPARSELT_VER_PATCH)
31
+
32
+ // #############################################################################
33
+ // # MACRO
34
+ // #############################################################################
35
+
36
+ #if !defined(CUSPARSELT_API)
37
+ # if defined(_WIN32)
38
+ # define CUSPARSELT_API __stdcall
39
+ # else
40
+ # define CUSPARSELT_API
41
+ # endif
42
+ #endif
43
+
44
+ //------------------------------------------------------------------------------
45
+
46
+ #if defined(__cplusplus)
47
+ extern "C" {
48
+ #endif // defined(__cplusplus)
49
+
50
+ //##############################################################################
51
+ //# OPAQUE DATA STRUCTURES
52
+ //##############################################################################
53
+
54
+ typedef struct { uint8_t data[13072]; } cusparseLtHandle_t;
55
+
56
+ typedef struct { uint8_t data[13072]; } cusparseLtMatDescriptor_t;
57
+
58
+ typedef struct { uint8_t data[13072]; } cusparseLtMatmulDescriptor_t;
59
+
60
+ typedef struct { uint8_t data[13072]; } cusparseLtMatmulAlgSelection_t;
61
+
62
+ typedef struct { uint8_t data[13072]; } cusparseLtMatmulPlan_t;
63
+
64
+ //##############################################################################
65
+ //# INITIALIZATION, DESTROY
66
+ //##############################################################################
67
+
68
+ cusparseStatus_t CUSPARSELT_API
69
+ cusparseLtInit(cusparseLtHandle_t* handle);
70
+
71
+ cusparseStatus_t CUSPARSELT_API
72
+ cusparseLtDestroy(const cusparseLtHandle_t* handle);
73
+
74
+ cusparseStatus_t CUSPARSELT_API
75
+ cusparseLtGetVersion(const cusparseLtHandle_t* handle,
76
+ int* version);
77
+
78
+ cusparseStatus_t CUSPARSELT_API
79
+ cusparseLtGetProperty(libraryPropertyType propertyType,
80
+ int* value);
81
+
82
+ //##############################################################################
83
+ //# MATRIX DESCRIPTOR
84
+ //##############################################################################
85
+ // Dense Matrix
86
+
87
+ cusparseStatus_t CUSPARSELT_API
88
+ cusparseLtDenseDescriptorInit(const cusparseLtHandle_t* handle,
89
+ cusparseLtMatDescriptor_t* matDescr,
90
+ int64_t rows,
91
+ int64_t cols,
92
+ int64_t ld,
93
+ uint32_t alignment,
94
+ cudaDataType valueType,
95
+ cusparseOrder_t order);
96
+
97
+ //------------------------------------------------------------------------------
98
+ // Structured Matrix
99
+
100
+ typedef enum {
101
+ CUSPARSELT_SPARSITY_50_PERCENT
102
+ } cusparseLtSparsity_t;
103
+
104
+ cusparseStatus_t CUSPARSELT_API
105
+ cusparseLtStructuredDescriptorInit(const cusparseLtHandle_t* handle,
106
+ cusparseLtMatDescriptor_t* matDescr,
107
+ int64_t rows,
108
+ int64_t cols,
109
+ int64_t ld,
110
+ uint32_t alignment,
111
+ cudaDataType valueType,
112
+ cusparseOrder_t order,
113
+ cusparseLtSparsity_t sparsity);
114
+
115
+ cusparseStatus_t CUSPARSELT_API
116
+ cusparseLtMatDescriptorDestroy(const cusparseLtMatDescriptor_t* matDescr);
117
+
118
+ //------------------------------------------------------------------------------
119
+
120
+ typedef enum {
121
+ CUSPARSELT_MAT_NUM_BATCHES, // READ/WRITE
122
+ CUSPARSELT_MAT_BATCH_STRIDE // READ/WRITE
123
+ } cusparseLtMatDescAttribute_t;
124
+
125
+ cusparseStatus_t CUSPARSELT_API
126
+ cusparseLtMatDescSetAttribute(const cusparseLtHandle_t* handle,
127
+ cusparseLtMatDescriptor_t* matmulDescr,
128
+ cusparseLtMatDescAttribute_t matAttribute,
129
+ const void* data,
130
+ size_t dataSize);
131
+
132
+ cusparseStatus_t CUSPARSELT_API
133
+ cusparseLtMatDescGetAttribute(const cusparseLtHandle_t* handle,
134
+ const cusparseLtMatDescriptor_t* matmulDescr,
135
+ cusparseLtMatDescAttribute_t matAttribute,
136
+ void* data,
137
+ size_t dataSize);
138
+
139
+ //##############################################################################
140
+ //# MATMUL DESCRIPTOR
141
+ //##############################################################################
142
+
143
+ typedef enum {
144
+ CUSPARSE_COMPUTE_32I,
145
+ CUSPARSE_COMPUTE_16F,
146
+ CUSPARSE_COMPUTE_32F
147
+ } cusparseComputeType;
148
+
149
+ cusparseStatus_t CUSPARSELT_API
150
+ cusparseLtMatmulDescriptorInit(const cusparseLtHandle_t* handle,
151
+ cusparseLtMatmulDescriptor_t* matmulDescr,
152
+ cusparseOperation_t opA,
153
+ cusparseOperation_t opB,
154
+ const cusparseLtMatDescriptor_t* matA,
155
+ const cusparseLtMatDescriptor_t* matB,
156
+ const cusparseLtMatDescriptor_t* matC,
157
+ const cusparseLtMatDescriptor_t* matD,
158
+ cusparseComputeType computeType);
159
+
160
+ //------------------------------------------------------------------------------
161
+
162
+ typedef enum {
163
+ CUSPARSELT_MATMUL_ACTIVATION_RELU, // READ/WRITE
164
+ CUSPARSELT_MATMUL_ACTIVATION_RELU_UPPERBOUND, // READ/WRITE
165
+ CUSPARSELT_MATMUL_ACTIVATION_RELU_THRESHOLD, // READ/WRITE
166
+ CUSPARSELT_MATMUL_ACTIVATION_GELU, // READ/WRITE
167
+ CUSPARSELT_MATMUL_ACTIVATION_GELU_SCALING, // READ/WRITE
168
+ CUSPARSELT_MATMUL_ALPHA_VECTOR_SCALING, // READ/WRITE
169
+ CUSPARSELT_MATMUL_BETA_VECTOR_SCALING, // READ/WRITE
170
+ CUSPARSELT_MATMUL_BIAS_STRIDE, // READ/WRITE
171
+ CUSPARSELT_MATMUL_BIAS_POINTER, // READ/WRITE
172
+ CUSPARSELT_MATMUL_SPARSE_MAT_POINTER, // READ/WRITE
173
+ } cusparseLtMatmulDescAttribute_t;
174
+
175
+ cusparseStatus_t CUSPARSELT_API
176
+ cusparseLtMatmulDescSetAttribute(const cusparseLtHandle_t* handle,
177
+ cusparseLtMatmulDescriptor_t* matmulDescr,
178
+ cusparseLtMatmulDescAttribute_t matmulAttribute,
179
+ const void* data,
180
+ size_t dataSize);
181
+
182
+ cusparseStatus_t CUSPARSELT_API
183
+ cusparseLtMatmulDescGetAttribute(
184
+ const cusparseLtHandle_t* handle,
185
+ const cusparseLtMatmulDescriptor_t* matmulDescr,
186
+ cusparseLtMatmulDescAttribute_t matmulAttribute,
187
+ void* data,
188
+ size_t dataSize);
189
+
190
+ //##############################################################################
191
+ //# ALGORITHM SELECTION
192
+ //##############################################################################
193
+
194
+ typedef enum {
195
+ CUSPARSELT_MATMUL_ALG_DEFAULT
196
+ } cusparseLtMatmulAlg_t;
197
+
198
+ cusparseStatus_t CUSPARSELT_API
199
+ cusparseLtMatmulAlgSelectionInit(
200
+ const cusparseLtHandle_t* handle,
201
+ cusparseLtMatmulAlgSelection_t* algSelection,
202
+ const cusparseLtMatmulDescriptor_t* matmulDescr,
203
+ cusparseLtMatmulAlg_t alg);
204
+
205
+ typedef enum {
206
+ CUSPARSELT_MATMUL_ALG_CONFIG_ID, // READ/WRITE
207
+ CUSPARSELT_MATMUL_ALG_CONFIG_MAX_ID, // READ-ONLY
208
+ CUSPARSELT_MATMUL_SEARCH_ITERATIONS, // READ/WRITE
209
+ CUSPARSELT_MATMUL_SPLIT_K, // READ/WRITE
210
+ CUSPARSELT_MATMUL_SPLIT_K_MODE, // READ/WRITE
211
+ CUSPARSELT_MATMUL_SPLIT_K_BUFFERS // READ/WRITE
212
+ } cusparseLtMatmulAlgAttribute_t;
213
+
214
+ typedef enum {
215
+ CUSPARSELT_INVALID_MODE = 0,
216
+ CUSPARSELT_SPLIT_K_MODE_ONE_KERNEL = 1,
217
+ CUSPARSELT_SPLIT_K_MODE_TWO_KERNELS = 2
218
+ } cusparseLtSplitKMode_t;
219
+
220
+ cusparseStatus_t CUSPARSELT_API
221
+ cusparseLtMatmulAlgSetAttribute(const cusparseLtHandle_t* handle,
222
+ cusparseLtMatmulAlgSelection_t* algSelection,
223
+ cusparseLtMatmulAlgAttribute_t attribute,
224
+ const void* data,
225
+ size_t dataSize);
226
+
227
+ cusparseStatus_t CUSPARSELT_API
228
+ cusparseLtMatmulAlgGetAttribute(
229
+ const cusparseLtHandle_t* handle,
230
+ const cusparseLtMatmulAlgSelection_t* algSelection,
231
+ cusparseLtMatmulAlgAttribute_t attribute,
232
+ void* data,
233
+ size_t dataSize);
234
+
235
+ //##############################################################################
236
+ //# MATMUL PLAN
237
+ //##############################################################################
238
+
239
+ cusparseStatus_t CUSPARSELT_API
240
+ cusparseLtMatmulGetWorkspace(
241
+ const cusparseLtHandle_t* handle,
242
+ const cusparseLtMatmulPlan_t* plan,
243
+ size_t* workspaceSize);
244
+
245
+ cusparseStatus_t CUSPARSELT_API
246
+ cusparseLtMatmulPlanInit(const cusparseLtHandle_t* handle,
247
+ cusparseLtMatmulPlan_t* plan,
248
+ const cusparseLtMatmulDescriptor_t* matmulDescr,
249
+ const cusparseLtMatmulAlgSelection_t* algSelection);
250
+
251
+ cusparseStatus_t CUSPARSELT_API
252
+ cusparseLtMatmulPlanDestroy(const cusparseLtMatmulPlan_t* plan);
253
+
254
+ //##############################################################################
255
+ //# MATMUL EXECUTION
256
+ //##############################################################################
257
+
258
+ cusparseStatus_t CUSPARSELT_API
259
+ cusparseLtMatmul(const cusparseLtHandle_t* handle,
260
+ const cusparseLtMatmulPlan_t* plan,
261
+ const void* alpha,
262
+ const void* d_A,
263
+ const void* d_B,
264
+ const void* beta,
265
+ const void* d_C,
266
+ void* d_D,
267
+ void* workspace,
268
+ cudaStream_t* streams,
269
+ int32_t numStreams);
270
+
271
+ cusparseStatus_t CUSPARSELT_API
272
+ cusparseLtMatmulSearch(const cusparseLtHandle_t* handle,
273
+ cusparseLtMatmulPlan_t* plan,
274
+ const void* alpha,
275
+ const void* d_A,
276
+ const void* d_B,
277
+ const void* beta,
278
+ const void* d_C,
279
+ void* d_D,
280
+ void* workspace,
281
+ // void* device_buf,
282
+ cudaStream_t* streams,
283
+ int32_t numStreams);
284
+
285
+ //##############################################################################
286
+ //# HELPER ROUTINES
287
+ //##############################################################################
288
+ // PRUNING
289
+
290
+ typedef enum {
291
+ CUSPARSELT_PRUNE_SPMMA_TILE = 0,
292
+ CUSPARSELT_PRUNE_SPMMA_STRIP = 1
293
+ } cusparseLtPruneAlg_t;
294
+
295
+ cusparseStatus_t CUSPARSELT_API
296
+ cusparseLtSpMMAPrune(const cusparseLtHandle_t* handle,
297
+ const cusparseLtMatmulDescriptor_t* matmulDescr,
298
+ const void* d_in,
299
+ void* d_out,
300
+ cusparseLtPruneAlg_t pruneAlg,
301
+ cudaStream_t stream);
302
+
303
+ cusparseStatus_t CUSPARSELT_API
304
+ cusparseLtSpMMAPruneCheck(const cusparseLtHandle_t* handle,
305
+ const cusparseLtMatmulDescriptor_t* matmulDescr,
306
+ const void* d_in,
307
+ int* valid,
308
+ cudaStream_t stream);
309
+
310
+ cusparseStatus_t CUSPARSELT_API
311
+ cusparseLtSpMMAPrune2(const cusparseLtHandle_t* handle,
312
+ const cusparseLtMatDescriptor_t* sparseMatDescr,
313
+ int isSparseA,
314
+ cusparseOperation_t op,
315
+ const void* d_in,
316
+ void* d_out,
317
+ cusparseLtPruneAlg_t pruneAlg,
318
+ cudaStream_t stream);
319
+
320
+ cusparseStatus_t CUSPARSELT_API
321
+ cusparseLtSpMMAPruneCheck2(const cusparseLtHandle_t* handle,
322
+ const cusparseLtMatDescriptor_t* sparseMatDescr,
323
+ int isSparseA,
324
+ cusparseOperation_t op,
325
+ const void* d_in,
326
+ int* d_valid,
327
+ cudaStream_t stream);
328
+
329
+ //------------------------------------------------------------------------------
330
+ // COMPRESSION
331
+
332
+ cusparseStatus_t CUSPARSELT_API
333
+ cusparseLtSpMMACompressedSize(
334
+ const cusparseLtHandle_t* handle,
335
+ const cusparseLtMatmulPlan_t* plan,
336
+ size_t* compressedSize,
337
+ size_t* compressedBufferSize);
338
+
339
+ cusparseStatus_t CUSPARSELT_API
340
+ cusparseLtSpMMACompress(const cusparseLtHandle_t* handle,
341
+ const cusparseLtMatmulPlan_t* plan,
342
+ const void* d_dense,
343
+ void* d_compressed,
344
+ void* d_compressed_buffer,
345
+ cudaStream_t stream);
346
+
347
+ cusparseStatus_t CUSPARSELT_API
348
+ cusparseLtSpMMACompressedSize2(
349
+ const cusparseLtHandle_t* handle,
350
+ const cusparseLtMatDescriptor_t* sparseMatDescr,
351
+ size_t* compressedSize,
352
+ size_t* compressedBufferSize);
353
+
354
+ cusparseStatus_t CUSPARSELT_API
355
+ cusparseLtSpMMACompress2(const cusparseLtHandle_t* handle,
356
+ const cusparseLtMatDescriptor_t* sparseMatDescr,
357
+ int isSparseA,
358
+ cusparseOperation_t op,
359
+ const void* d_dense,
360
+ void* d_compressed,
361
+ void* d_compressed_buffer,
362
+ cudaStream_t stream);
363
+
364
+ //==============================================================================
365
+ //==============================================================================
366
+
367
+ #if defined(__cplusplus)
368
+ }
369
+ #endif // defined(__cplusplus)
370
+
371
+ #endif // !defined(CUSPARSELT_HEADER_)
lib/python3.12/site-packages/distro/__init__.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from .distro import (
2
+ NORMALIZED_DISTRO_ID,
3
+ NORMALIZED_LSB_ID,
4
+ NORMALIZED_OS_ID,
5
+ LinuxDistribution,
6
+ __version__,
7
+ build_number,
8
+ codename,
9
+ distro_release_attr,
10
+ distro_release_info,
11
+ id,
12
+ info,
13
+ like,
14
+ linux_distribution,
15
+ lsb_release_attr,
16
+ lsb_release_info,
17
+ major_version,
18
+ minor_version,
19
+ name,
20
+ os_release_attr,
21
+ os_release_info,
22
+ uname_attr,
23
+ uname_info,
24
+ version,
25
+ version_parts,
26
+ )
27
+
28
+ __all__ = [
29
+ "NORMALIZED_DISTRO_ID",
30
+ "NORMALIZED_LSB_ID",
31
+ "NORMALIZED_OS_ID",
32
+ "LinuxDistribution",
33
+ "build_number",
34
+ "codename",
35
+ "distro_release_attr",
36
+ "distro_release_info",
37
+ "id",
38
+ "info",
39
+ "like",
40
+ "linux_distribution",
41
+ "lsb_release_attr",
42
+ "lsb_release_info",
43
+ "major_version",
44
+ "minor_version",
45
+ "name",
46
+ "os_release_attr",
47
+ "os_release_info",
48
+ "uname_attr",
49
+ "uname_info",
50
+ "version",
51
+ "version_parts",
52
+ ]
53
+
54
+ __version__ = __version__
lib/python3.12/site-packages/distro/__main__.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ from .distro import main
2
+
3
+ if __name__ == "__main__":
4
+ main()
lib/python3.12/site-packages/distro/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (955 Bytes). View file
 
lib/python3.12/site-packages/distro/__pycache__/__main__.cpython-312.pyc ADDED
Binary file (287 Bytes). View file
 
lib/python3.12/site-packages/distro/__pycache__/distro.cpython-312.pyc ADDED
Binary file (53.8 kB). View file
 
lib/python3.12/site-packages/distro/distro.py ADDED
@@ -0,0 +1,1403 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # Copyright 2015-2021 Nir Cohen
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
+ The ``distro`` package (``distro`` stands for Linux Distribution) provides
18
+ information about the Linux distribution it runs on, such as a reliable
19
+ machine-readable distro ID, or version information.
20
+
21
+ It is the recommended replacement for Python's original
22
+ :py:func:`platform.linux_distribution` function, but it provides much more
23
+ functionality. An alternative implementation became necessary because Python
24
+ 3.5 deprecated this function, and Python 3.8 removed it altogether. Its
25
+ predecessor function :py:func:`platform.dist` was already deprecated since
26
+ Python 2.6 and removed in Python 3.8. Still, there are many cases in which
27
+ access to OS distribution information is needed. See `Python issue 1322
28
+ <https://bugs.python.org/issue1322>`_ for more information.
29
+ """
30
+
31
+ import argparse
32
+ import json
33
+ import logging
34
+ import os
35
+ import re
36
+ import shlex
37
+ import subprocess
38
+ import sys
39
+ import warnings
40
+ from typing import (
41
+ Any,
42
+ Callable,
43
+ Dict,
44
+ Iterable,
45
+ Optional,
46
+ Sequence,
47
+ TextIO,
48
+ Tuple,
49
+ Type,
50
+ )
51
+
52
+ try:
53
+ from typing import TypedDict
54
+ except ImportError:
55
+ # Python 3.7
56
+ TypedDict = dict
57
+
58
+ __version__ = "1.9.0"
59
+
60
+
61
+ class VersionDict(TypedDict):
62
+ major: str
63
+ minor: str
64
+ build_number: str
65
+
66
+
67
+ class InfoDict(TypedDict):
68
+ id: str
69
+ version: str
70
+ version_parts: VersionDict
71
+ like: str
72
+ codename: str
73
+
74
+
75
+ _UNIXCONFDIR = os.environ.get("UNIXCONFDIR", "/etc")
76
+ _UNIXUSRLIBDIR = os.environ.get("UNIXUSRLIBDIR", "/usr/lib")
77
+ _OS_RELEASE_BASENAME = "os-release"
78
+
79
+ #: Translation table for normalizing the "ID" attribute defined in os-release
80
+ #: files, for use by the :func:`distro.id` method.
81
+ #:
82
+ #: * Key: Value as defined in the os-release file, translated to lower case,
83
+ #: with blanks translated to underscores.
84
+ #:
85
+ #: * Value: Normalized value.
86
+ NORMALIZED_OS_ID = {
87
+ "ol": "oracle", # Oracle Linux
88
+ "opensuse-leap": "opensuse", # Newer versions of OpenSuSE report as opensuse-leap
89
+ }
90
+
91
+ #: Translation table for normalizing the "Distributor ID" attribute returned by
92
+ #: the lsb_release command, for use by the :func:`distro.id` method.
93
+ #:
94
+ #: * Key: Value as returned by the lsb_release command, translated to lower
95
+ #: case, with blanks translated to underscores.
96
+ #:
97
+ #: * Value: Normalized value.
98
+ NORMALIZED_LSB_ID = {
99
+ "enterpriseenterpriseas": "oracle", # Oracle Enterprise Linux 4
100
+ "enterpriseenterpriseserver": "oracle", # Oracle Linux 5
101
+ "redhatenterpriseworkstation": "rhel", # RHEL 6, 7 Workstation
102
+ "redhatenterpriseserver": "rhel", # RHEL 6, 7 Server
103
+ "redhatenterprisecomputenode": "rhel", # RHEL 6 ComputeNode
104
+ }
105
+
106
+ #: Translation table for normalizing the distro ID derived from the file name
107
+ #: of distro release files, for use by the :func:`distro.id` method.
108
+ #:
109
+ #: * Key: Value as derived from the file name of a distro release file,
110
+ #: translated to lower case, with blanks translated to underscores.
111
+ #:
112
+ #: * Value: Normalized value.
113
+ NORMALIZED_DISTRO_ID = {
114
+ "redhat": "rhel", # RHEL 6.x, 7.x
115
+ }
116
+
117
+ # Pattern for content of distro release file (reversed)
118
+ _DISTRO_RELEASE_CONTENT_REVERSED_PATTERN = re.compile(
119
+ r"(?:[^)]*\)(.*)\()? *(?:STL )?([\d.+\-a-z]*\d) *(?:esaeler *)?(.+)"
120
+ )
121
+
122
+ # Pattern for base file name of distro release file
123
+ _DISTRO_RELEASE_BASENAME_PATTERN = re.compile(r"(\w+)[-_](release|version)$")
124
+
125
+ # Base file names to be looked up for if _UNIXCONFDIR is not readable.
126
+ _DISTRO_RELEASE_BASENAMES = [
127
+ "SuSE-release",
128
+ "altlinux-release",
129
+ "arch-release",
130
+ "base-release",
131
+ "centos-release",
132
+ "fedora-release",
133
+ "gentoo-release",
134
+ "mageia-release",
135
+ "mandrake-release",
136
+ "mandriva-release",
137
+ "mandrivalinux-release",
138
+ "manjaro-release",
139
+ "oracle-release",
140
+ "redhat-release",
141
+ "rocky-release",
142
+ "sl-release",
143
+ "slackware-version",
144
+ ]
145
+
146
+ # Base file names to be ignored when searching for distro release file
147
+ _DISTRO_RELEASE_IGNORE_BASENAMES = (
148
+ "debian_version",
149
+ "lsb-release",
150
+ "oem-release",
151
+ _OS_RELEASE_BASENAME,
152
+ "system-release",
153
+ "plesk-release",
154
+ "iredmail-release",
155
+ "board-release",
156
+ "ec2_version",
157
+ )
158
+
159
+
160
+ def linux_distribution(full_distribution_name: bool = True) -> Tuple[str, str, str]:
161
+ """
162
+ .. deprecated:: 1.6.0
163
+
164
+ :func:`distro.linux_distribution()` is deprecated. It should only be
165
+ used as a compatibility shim with Python's
166
+ :py:func:`platform.linux_distribution()`. Please use :func:`distro.id`,
167
+ :func:`distro.version` and :func:`distro.name` instead.
168
+
169
+ Return information about the current OS distribution as a tuple
170
+ ``(id_name, version, codename)`` with items as follows:
171
+
172
+ * ``id_name``: If *full_distribution_name* is false, the result of
173
+ :func:`distro.id`. Otherwise, the result of :func:`distro.name`.
174
+
175
+ * ``version``: The result of :func:`distro.version`.
176
+
177
+ * ``codename``: The extra item (usually in parentheses) after the
178
+ os-release version number, or the result of :func:`distro.codename`.
179
+
180
+ The interface of this function is compatible with the original
181
+ :py:func:`platform.linux_distribution` function, supporting a subset of
182
+ its parameters.
183
+
184
+ The data it returns may not exactly be the same, because it uses more data
185
+ sources than the original function, and that may lead to different data if
186
+ the OS distribution is not consistent across multiple data sources it
187
+ provides (there are indeed such distributions ...).
188
+
189
+ Another reason for differences is the fact that the :func:`distro.id`
190
+ method normalizes the distro ID string to a reliable machine-readable value
191
+ for a number of popular OS distributions.
192
+ """
193
+ warnings.warn(
194
+ "distro.linux_distribution() is deprecated. It should only be used as a "
195
+ "compatibility shim with Python's platform.linux_distribution(). Please use "
196
+ "distro.id(), distro.version() and distro.name() instead.",
197
+ DeprecationWarning,
198
+ stacklevel=2,
199
+ )
200
+ return _distro.linux_distribution(full_distribution_name)
201
+
202
+
203
+ def id() -> str:
204
+ """
205
+ Return the distro ID of the current distribution, as a
206
+ machine-readable string.
207
+
208
+ For a number of OS distributions, the returned distro ID value is
209
+ *reliable*, in the sense that it is documented and that it does not change
210
+ across releases of the distribution.
211
+
212
+ This package maintains the following reliable distro ID values:
213
+
214
+ ============== =========================================
215
+ Distro ID Distribution
216
+ ============== =========================================
217
+ "ubuntu" Ubuntu
218
+ "debian" Debian
219
+ "rhel" RedHat Enterprise Linux
220
+ "centos" CentOS
221
+ "fedora" Fedora
222
+ "sles" SUSE Linux Enterprise Server
223
+ "opensuse" openSUSE
224
+ "amzn" Amazon Linux
225
+ "arch" Arch Linux
226
+ "buildroot" Buildroot
227
+ "cloudlinux" CloudLinux OS
228
+ "exherbo" Exherbo Linux
229
+ "gentoo" GenToo Linux
230
+ "ibm_powerkvm" IBM PowerKVM
231
+ "kvmibm" KVM for IBM z Systems
232
+ "linuxmint" Linux Mint
233
+ "mageia" Mageia
234
+ "mandriva" Mandriva Linux
235
+ "parallels" Parallels
236
+ "pidora" Pidora
237
+ "raspbian" Raspbian
238
+ "oracle" Oracle Linux (and Oracle Enterprise Linux)
239
+ "scientific" Scientific Linux
240
+ "slackware" Slackware
241
+ "xenserver" XenServer
242
+ "openbsd" OpenBSD
243
+ "netbsd" NetBSD
244
+ "freebsd" FreeBSD
245
+ "midnightbsd" MidnightBSD
246
+ "rocky" Rocky Linux
247
+ "aix" AIX
248
+ "guix" Guix System
249
+ "altlinux" ALT Linux
250
+ ============== =========================================
251
+
252
+ If you have a need to get distros for reliable IDs added into this set,
253
+ or if you find that the :func:`distro.id` function returns a different
254
+ distro ID for one of the listed distros, please create an issue in the
255
+ `distro issue tracker`_.
256
+
257
+ **Lookup hierarchy and transformations:**
258
+
259
+ First, the ID is obtained from the following sources, in the specified
260
+ order. The first available and non-empty value is used:
261
+
262
+ * the value of the "ID" attribute of the os-release file,
263
+
264
+ * the value of the "Distributor ID" attribute returned by the lsb_release
265
+ command,
266
+
267
+ * the first part of the file name of the distro release file,
268
+
269
+ The so determined ID value then passes the following transformations,
270
+ before it is returned by this method:
271
+
272
+ * it is translated to lower case,
273
+
274
+ * blanks (which should not be there anyway) are translated to underscores,
275
+
276
+ * a normalization of the ID is performed, based upon
277
+ `normalization tables`_. The purpose of this normalization is to ensure
278
+ that the ID is as reliable as possible, even across incompatible changes
279
+ in the OS distributions. A common reason for an incompatible change is
280
+ the addition of an os-release file, or the addition of the lsb_release
281
+ command, with ID values that differ from what was previously determined
282
+ from the distro release file name.
283
+ """
284
+ return _distro.id()
285
+
286
+
287
+ def name(pretty: bool = False) -> str:
288
+ """
289
+ Return the name of the current OS distribution, as a human-readable
290
+ string.
291
+
292
+ If *pretty* is false, the name is returned without version or codename.
293
+ (e.g. "CentOS Linux")
294
+
295
+ If *pretty* is true, the version and codename are appended.
296
+ (e.g. "CentOS Linux 7.1.1503 (Core)")
297
+
298
+ **Lookup hierarchy:**
299
+
300
+ The name is obtained from the following sources, in the specified order.
301
+ The first available and non-empty value is used:
302
+
303
+ * If *pretty* is false:
304
+
305
+ - the value of the "NAME" attribute of the os-release file,
306
+
307
+ - the value of the "Distributor ID" attribute returned by the lsb_release
308
+ command,
309
+
310
+ - the value of the "<name>" field of the distro release file.
311
+
312
+ * If *pretty* is true:
313
+
314
+ - the value of the "PRETTY_NAME" attribute of the os-release file,
315
+
316
+ - the value of the "Description" attribute returned by the lsb_release
317
+ command,
318
+
319
+ - the value of the "<name>" field of the distro release file, appended
320
+ with the value of the pretty version ("<version_id>" and "<codename>"
321
+ fields) of the distro release file, if available.
322
+ """
323
+ return _distro.name(pretty)
324
+
325
+
326
+ def version(pretty: bool = False, best: bool = False) -> str:
327
+ """
328
+ Return the version of the current OS distribution, as a human-readable
329
+ string.
330
+
331
+ If *pretty* is false, the version is returned without codename (e.g.
332
+ "7.0").
333
+
334
+ If *pretty* is true, the codename in parenthesis is appended, if the
335
+ codename is non-empty (e.g. "7.0 (Maipo)").
336
+
337
+ Some distributions provide version numbers with different precisions in
338
+ the different sources of distribution information. Examining the different
339
+ sources in a fixed priority order does not always yield the most precise
340
+ version (e.g. for Debian 8.2, or CentOS 7.1).
341
+
342
+ Some other distributions may not provide this kind of information. In these
343
+ cases, an empty string would be returned. This behavior can be observed
344
+ with rolling releases distributions (e.g. Arch Linux).
345
+
346
+ The *best* parameter can be used to control the approach for the returned
347
+ version:
348
+
349
+ If *best* is false, the first non-empty version number in priority order of
350
+ the examined sources is returned.
351
+
352
+ If *best* is true, the most precise version number out of all examined
353
+ sources is returned.
354
+
355
+ **Lookup hierarchy:**
356
+
357
+ In all cases, the version number is obtained from the following sources.
358
+ If *best* is false, this order represents the priority order:
359
+
360
+ * the value of the "VERSION_ID" attribute of the os-release file,
361
+ * the value of the "Release" attribute returned by the lsb_release
362
+ command,
363
+ * the version number parsed from the "<version_id>" field of the first line
364
+ of the distro release file,
365
+ * the version number parsed from the "PRETTY_NAME" attribute of the
366
+ os-release file, if it follows the format of the distro release files.
367
+ * the version number parsed from the "Description" attribute returned by
368
+ the lsb_release command, if it follows the format of the distro release
369
+ files.
370
+ """
371
+ return _distro.version(pretty, best)
372
+
373
+
374
+ def version_parts(best: bool = False) -> Tuple[str, str, str]:
375
+ """
376
+ Return the version of the current OS distribution as a tuple
377
+ ``(major, minor, build_number)`` with items as follows:
378
+
379
+ * ``major``: The result of :func:`distro.major_version`.
380
+
381
+ * ``minor``: The result of :func:`distro.minor_version`.
382
+
383
+ * ``build_number``: The result of :func:`distro.build_number`.
384
+
385
+ For a description of the *best* parameter, see the :func:`distro.version`
386
+ method.
387
+ """
388
+ return _distro.version_parts(best)
389
+
390
+
391
+ def major_version(best: bool = False) -> str:
392
+ """
393
+ Return the major version of the current OS distribution, as a string,
394
+ if provided.
395
+ Otherwise, the empty string is returned. The major version is the first
396
+ part of the dot-separated version string.
397
+
398
+ For a description of the *best* parameter, see the :func:`distro.version`
399
+ method.
400
+ """
401
+ return _distro.major_version(best)
402
+
403
+
404
+ def minor_version(best: bool = False) -> str:
405
+ """
406
+ Return the minor version of the current OS distribution, as a string,
407
+ if provided.
408
+ Otherwise, the empty string is returned. The minor version is the second
409
+ part of the dot-separated version string.
410
+
411
+ For a description of the *best* parameter, see the :func:`distro.version`
412
+ method.
413
+ """
414
+ return _distro.minor_version(best)
415
+
416
+
417
+ def build_number(best: bool = False) -> str:
418
+ """
419
+ Return the build number of the current OS distribution, as a string,
420
+ if provided.
421
+ Otherwise, the empty string is returned. The build number is the third part
422
+ of the dot-separated version string.
423
+
424
+ For a description of the *best* parameter, see the :func:`distro.version`
425
+ method.
426
+ """
427
+ return _distro.build_number(best)
428
+
429
+
430
+ def like() -> str:
431
+ """
432
+ Return a space-separated list of distro IDs of distributions that are
433
+ closely related to the current OS distribution in regards to packaging
434
+ and programming interfaces, for example distributions the current
435
+ distribution is a derivative from.
436
+
437
+ **Lookup hierarchy:**
438
+
439
+ This information item is only provided by the os-release file.
440
+ For details, see the description of the "ID_LIKE" attribute in the
441
+ `os-release man page
442
+ <http://www.freedesktop.org/software/systemd/man/os-release.html>`_.
443
+ """
444
+ return _distro.like()
445
+
446
+
447
+ def codename() -> str:
448
+ """
449
+ Return the codename for the release of the current OS distribution,
450
+ as a string.
451
+
452
+ If the distribution does not have a codename, an empty string is returned.
453
+
454
+ Note that the returned codename is not always really a codename. For
455
+ example, openSUSE returns "x86_64". This function does not handle such
456
+ cases in any special way and just returns the string it finds, if any.
457
+
458
+ **Lookup hierarchy:**
459
+
460
+ * the codename within the "VERSION" attribute of the os-release file, if
461
+ provided,
462
+
463
+ * the value of the "Codename" attribute returned by the lsb_release
464
+ command,
465
+
466
+ * the value of the "<codename>" field of the distro release file.
467
+ """
468
+ return _distro.codename()
469
+
470
+
471
+ def info(pretty: bool = False, best: bool = False) -> InfoDict:
472
+ """
473
+ Return certain machine-readable information items about the current OS
474
+ distribution in a dictionary, as shown in the following example:
475
+
476
+ .. sourcecode:: python
477
+
478
+ {
479
+ 'id': 'rhel',
480
+ 'version': '7.0',
481
+ 'version_parts': {
482
+ 'major': '7',
483
+ 'minor': '0',
484
+ 'build_number': ''
485
+ },
486
+ 'like': 'fedora',
487
+ 'codename': 'Maipo'
488
+ }
489
+
490
+ The dictionary structure and keys are always the same, regardless of which
491
+ information items are available in the underlying data sources. The values
492
+ for the various keys are as follows:
493
+
494
+ * ``id``: The result of :func:`distro.id`.
495
+
496
+ * ``version``: The result of :func:`distro.version`.
497
+
498
+ * ``version_parts -> major``: The result of :func:`distro.major_version`.
499
+
500
+ * ``version_parts -> minor``: The result of :func:`distro.minor_version`.
501
+
502
+ * ``version_parts -> build_number``: The result of
503
+ :func:`distro.build_number`.
504
+
505
+ * ``like``: The result of :func:`distro.like`.
506
+
507
+ * ``codename``: The result of :func:`distro.codename`.
508
+
509
+ For a description of the *pretty* and *best* parameters, see the
510
+ :func:`distro.version` method.
511
+ """
512
+ return _distro.info(pretty, best)
513
+
514
+
515
+ def os_release_info() -> Dict[str, str]:
516
+ """
517
+ Return a dictionary containing key-value pairs for the information items
518
+ from the os-release file data source of the current OS distribution.
519
+
520
+ See `os-release file`_ for details about these information items.
521
+ """
522
+ return _distro.os_release_info()
523
+
524
+
525
+ def lsb_release_info() -> Dict[str, str]:
526
+ """
527
+ Return a dictionary containing key-value pairs for the information items
528
+ from the lsb_release command data source of the current OS distribution.
529
+
530
+ See `lsb_release command output`_ for details about these information
531
+ items.
532
+ """
533
+ return _distro.lsb_release_info()
534
+
535
+
536
+ def distro_release_info() -> Dict[str, str]:
537
+ """
538
+ Return a dictionary containing key-value pairs for the information items
539
+ from the distro release file data source of the current OS distribution.
540
+
541
+ See `distro release file`_ for details about these information items.
542
+ """
543
+ return _distro.distro_release_info()
544
+
545
+
546
+ def uname_info() -> Dict[str, str]:
547
+ """
548
+ Return a dictionary containing key-value pairs for the information items
549
+ from the distro release file data source of the current OS distribution.
550
+ """
551
+ return _distro.uname_info()
552
+
553
+
554
+ def os_release_attr(attribute: str) -> str:
555
+ """
556
+ Return a single named information item from the os-release file data source
557
+ of the current OS distribution.
558
+
559
+ Parameters:
560
+
561
+ * ``attribute`` (string): Key of the information item.
562
+
563
+ Returns:
564
+
565
+ * (string): Value of the information item, if the item exists.
566
+ The empty string, if the item does not exist.
567
+
568
+ See `os-release file`_ for details about these information items.
569
+ """
570
+ return _distro.os_release_attr(attribute)
571
+
572
+
573
+ def lsb_release_attr(attribute: str) -> str:
574
+ """
575
+ Return a single named information item from the lsb_release command output
576
+ data source of the current OS distribution.
577
+
578
+ Parameters:
579
+
580
+ * ``attribute`` (string): Key of the information item.
581
+
582
+ Returns:
583
+
584
+ * (string): Value of the information item, if the item exists.
585
+ The empty string, if the item does not exist.
586
+
587
+ See `lsb_release command output`_ for details about these information
588
+ items.
589
+ """
590
+ return _distro.lsb_release_attr(attribute)
591
+
592
+
593
+ def distro_release_attr(attribute: str) -> str:
594
+ """
595
+ Return a single named information item from the distro release file
596
+ data source of the current OS distribution.
597
+
598
+ Parameters:
599
+
600
+ * ``attribute`` (string): Key of the information item.
601
+
602
+ Returns:
603
+
604
+ * (string): Value of the information item, if the item exists.
605
+ The empty string, if the item does not exist.
606
+
607
+ See `distro release file`_ for details about these information items.
608
+ """
609
+ return _distro.distro_release_attr(attribute)
610
+
611
+
612
+ def uname_attr(attribute: str) -> str:
613
+ """
614
+ Return a single named information item from the distro release file
615
+ data source of the current OS distribution.
616
+
617
+ Parameters:
618
+
619
+ * ``attribute`` (string): Key of the information item.
620
+
621
+ Returns:
622
+
623
+ * (string): Value of the information item, if the item exists.
624
+ The empty string, if the item does not exist.
625
+ """
626
+ return _distro.uname_attr(attribute)
627
+
628
+
629
+ try:
630
+ from functools import cached_property
631
+ except ImportError:
632
+ # Python < 3.8
633
+ class cached_property: # type: ignore
634
+ """A version of @property which caches the value. On access, it calls the
635
+ underlying function and sets the value in `__dict__` so future accesses
636
+ will not re-call the property.
637
+ """
638
+
639
+ def __init__(self, f: Callable[[Any], Any]) -> None:
640
+ self._fname = f.__name__
641
+ self._f = f
642
+
643
+ def __get__(self, obj: Any, owner: Type[Any]) -> Any:
644
+ assert obj is not None, f"call {self._fname} on an instance"
645
+ ret = obj.__dict__[self._fname] = self._f(obj)
646
+ return ret
647
+
648
+
649
+ class LinuxDistribution:
650
+ """
651
+ Provides information about a OS distribution.
652
+
653
+ This package creates a private module-global instance of this class with
654
+ default initialization arguments, that is used by the
655
+ `consolidated accessor functions`_ and `single source accessor functions`_.
656
+ By using default initialization arguments, that module-global instance
657
+ returns data about the current OS distribution (i.e. the distro this
658
+ package runs on).
659
+
660
+ Normally, it is not necessary to create additional instances of this class.
661
+ However, in situations where control is needed over the exact data sources
662
+ that are used, instances of this class can be created with a specific
663
+ distro release file, or a specific os-release file, or without invoking the
664
+ lsb_release command.
665
+ """
666
+
667
+ def __init__(
668
+ self,
669
+ include_lsb: Optional[bool] = None,
670
+ os_release_file: str = "",
671
+ distro_release_file: str = "",
672
+ include_uname: Optional[bool] = None,
673
+ root_dir: Optional[str] = None,
674
+ include_oslevel: Optional[bool] = None,
675
+ ) -> None:
676
+ """
677
+ The initialization method of this class gathers information from the
678
+ available data sources, and stores that in private instance attributes.
679
+ Subsequent access to the information items uses these private instance
680
+ attributes, so that the data sources are read only once.
681
+
682
+ Parameters:
683
+
684
+ * ``include_lsb`` (bool): Controls whether the
685
+ `lsb_release command output`_ is included as a data source.
686
+
687
+ If the lsb_release command is not available in the program execution
688
+ path, the data source for the lsb_release command will be empty.
689
+
690
+ * ``os_release_file`` (string): The path name of the
691
+ `os-release file`_ that is to be used as a data source.
692
+
693
+ An empty string (the default) will cause the default path name to
694
+ be used (see `os-release file`_ for details).
695
+
696
+ If the specified or defaulted os-release file does not exist, the
697
+ data source for the os-release file will be empty.
698
+
699
+ * ``distro_release_file`` (string): The path name of the
700
+ `distro release file`_ that is to be used as a data source.
701
+
702
+ An empty string (the default) will cause a default search algorithm
703
+ to be used (see `distro release file`_ for details).
704
+
705
+ If the specified distro release file does not exist, or if no default
706
+ distro release file can be found, the data source for the distro
707
+ release file will be empty.
708
+
709
+ * ``include_uname`` (bool): Controls whether uname command output is
710
+ included as a data source. If the uname command is not available in
711
+ the program execution path the data source for the uname command will
712
+ be empty.
713
+
714
+ * ``root_dir`` (string): The absolute path to the root directory to use
715
+ to find distro-related information files. Note that ``include_*``
716
+ parameters must not be enabled in combination with ``root_dir``.
717
+
718
+ * ``include_oslevel`` (bool): Controls whether (AIX) oslevel command
719
+ output is included as a data source. If the oslevel command is not
720
+ available in the program execution path the data source will be
721
+ empty.
722
+
723
+ Public instance attributes:
724
+
725
+ * ``os_release_file`` (string): The path name of the
726
+ `os-release file`_ that is actually used as a data source. The
727
+ empty string if no distro release file is used as a data source.
728
+
729
+ * ``distro_release_file`` (string): The path name of the
730
+ `distro release file`_ that is actually used as a data source. The
731
+ empty string if no distro release file is used as a data source.
732
+
733
+ * ``include_lsb`` (bool): The result of the ``include_lsb`` parameter.
734
+ This controls whether the lsb information will be loaded.
735
+
736
+ * ``include_uname`` (bool): The result of the ``include_uname``
737
+ parameter. This controls whether the uname information will
738
+ be loaded.
739
+
740
+ * ``include_oslevel`` (bool): The result of the ``include_oslevel``
741
+ parameter. This controls whether (AIX) oslevel information will be
742
+ loaded.
743
+
744
+ * ``root_dir`` (string): The result of the ``root_dir`` parameter.
745
+ The absolute path to the root directory to use to find distro-related
746
+ information files.
747
+
748
+ Raises:
749
+
750
+ * :py:exc:`ValueError`: Initialization parameters combination is not
751
+ supported.
752
+
753
+ * :py:exc:`OSError`: Some I/O issue with an os-release file or distro
754
+ release file.
755
+
756
+ * :py:exc:`UnicodeError`: A data source has unexpected characters or
757
+ uses an unexpected encoding.
758
+ """
759
+ self.root_dir = root_dir
760
+ self.etc_dir = os.path.join(root_dir, "etc") if root_dir else _UNIXCONFDIR
761
+ self.usr_lib_dir = (
762
+ os.path.join(root_dir, "usr/lib") if root_dir else _UNIXUSRLIBDIR
763
+ )
764
+
765
+ if os_release_file:
766
+ self.os_release_file = os_release_file
767
+ else:
768
+ etc_dir_os_release_file = os.path.join(self.etc_dir, _OS_RELEASE_BASENAME)
769
+ usr_lib_os_release_file = os.path.join(
770
+ self.usr_lib_dir, _OS_RELEASE_BASENAME
771
+ )
772
+
773
+ # NOTE: The idea is to respect order **and** have it set
774
+ # at all times for API backwards compatibility.
775
+ if os.path.isfile(etc_dir_os_release_file) or not os.path.isfile(
776
+ usr_lib_os_release_file
777
+ ):
778
+ self.os_release_file = etc_dir_os_release_file
779
+ else:
780
+ self.os_release_file = usr_lib_os_release_file
781
+
782
+ self.distro_release_file = distro_release_file or "" # updated later
783
+
784
+ is_root_dir_defined = root_dir is not None
785
+ if is_root_dir_defined and (include_lsb or include_uname or include_oslevel):
786
+ raise ValueError(
787
+ "Including subprocess data sources from specific root_dir is disallowed"
788
+ " to prevent false information"
789
+ )
790
+ self.include_lsb = (
791
+ include_lsb if include_lsb is not None else not is_root_dir_defined
792
+ )
793
+ self.include_uname = (
794
+ include_uname if include_uname is not None else not is_root_dir_defined
795
+ )
796
+ self.include_oslevel = (
797
+ include_oslevel if include_oslevel is not None else not is_root_dir_defined
798
+ )
799
+
800
+ def __repr__(self) -> str:
801
+ """Return repr of all info"""
802
+ return (
803
+ "LinuxDistribution("
804
+ "os_release_file={self.os_release_file!r}, "
805
+ "distro_release_file={self.distro_release_file!r}, "
806
+ "include_lsb={self.include_lsb!r}, "
807
+ "include_uname={self.include_uname!r}, "
808
+ "include_oslevel={self.include_oslevel!r}, "
809
+ "root_dir={self.root_dir!r}, "
810
+ "_os_release_info={self._os_release_info!r}, "
811
+ "_lsb_release_info={self._lsb_release_info!r}, "
812
+ "_distro_release_info={self._distro_release_info!r}, "
813
+ "_uname_info={self._uname_info!r}, "
814
+ "_oslevel_info={self._oslevel_info!r})".format(self=self)
815
+ )
816
+
817
+ def linux_distribution(
818
+ self, full_distribution_name: bool = True
819
+ ) -> Tuple[str, str, str]:
820
+ """
821
+ Return information about the OS distribution that is compatible
822
+ with Python's :func:`platform.linux_distribution`, supporting a subset
823
+ of its parameters.
824
+
825
+ For details, see :func:`distro.linux_distribution`.
826
+ """
827
+ return (
828
+ self.name() if full_distribution_name else self.id(),
829
+ self.version(),
830
+ self._os_release_info.get("release_codename") or self.codename(),
831
+ )
832
+
833
+ def id(self) -> str:
834
+ """Return the distro ID of the OS distribution, as a string.
835
+
836
+ For details, see :func:`distro.id`.
837
+ """
838
+
839
+ def normalize(distro_id: str, table: Dict[str, str]) -> str:
840
+ distro_id = distro_id.lower().replace(" ", "_")
841
+ return table.get(distro_id, distro_id)
842
+
843
+ distro_id = self.os_release_attr("id")
844
+ if distro_id:
845
+ return normalize(distro_id, NORMALIZED_OS_ID)
846
+
847
+ distro_id = self.lsb_release_attr("distributor_id")
848
+ if distro_id:
849
+ return normalize(distro_id, NORMALIZED_LSB_ID)
850
+
851
+ distro_id = self.distro_release_attr("id")
852
+ if distro_id:
853
+ return normalize(distro_id, NORMALIZED_DISTRO_ID)
854
+
855
+ distro_id = self.uname_attr("id")
856
+ if distro_id:
857
+ return normalize(distro_id, NORMALIZED_DISTRO_ID)
858
+
859
+ return ""
860
+
861
+ def name(self, pretty: bool = False) -> str:
862
+ """
863
+ Return the name of the OS distribution, as a string.
864
+
865
+ For details, see :func:`distro.name`.
866
+ """
867
+ name = (
868
+ self.os_release_attr("name")
869
+ or self.lsb_release_attr("distributor_id")
870
+ or self.distro_release_attr("name")
871
+ or self.uname_attr("name")
872
+ )
873
+ if pretty:
874
+ name = self.os_release_attr("pretty_name") or self.lsb_release_attr(
875
+ "description"
876
+ )
877
+ if not name:
878
+ name = self.distro_release_attr("name") or self.uname_attr("name")
879
+ version = self.version(pretty=True)
880
+ if version:
881
+ name = f"{name} {version}"
882
+ return name or ""
883
+
884
+ def version(self, pretty: bool = False, best: bool = False) -> str:
885
+ """
886
+ Return the version of the OS distribution, as a string.
887
+
888
+ For details, see :func:`distro.version`.
889
+ """
890
+ versions = [
891
+ self.os_release_attr("version_id"),
892
+ self.lsb_release_attr("release"),
893
+ self.distro_release_attr("version_id"),
894
+ self._parse_distro_release_content(self.os_release_attr("pretty_name")).get(
895
+ "version_id", ""
896
+ ),
897
+ self._parse_distro_release_content(
898
+ self.lsb_release_attr("description")
899
+ ).get("version_id", ""),
900
+ self.uname_attr("release"),
901
+ ]
902
+ if self.uname_attr("id").startswith("aix"):
903
+ # On AIX platforms, prefer oslevel command output.
904
+ versions.insert(0, self.oslevel_info())
905
+ elif self.id() == "debian" or "debian" in self.like().split():
906
+ # On Debian-like, add debian_version file content to candidates list.
907
+ versions.append(self._debian_version)
908
+ version = ""
909
+ if best:
910
+ # This algorithm uses the last version in priority order that has
911
+ # the best precision. If the versions are not in conflict, that
912
+ # does not matter; otherwise, using the last one instead of the
913
+ # first one might be considered a surprise.
914
+ for v in versions:
915
+ if v.count(".") > version.count(".") or version == "":
916
+ version = v
917
+ else:
918
+ for v in versions:
919
+ if v != "":
920
+ version = v
921
+ break
922
+ if pretty and version and self.codename():
923
+ version = f"{version} ({self.codename()})"
924
+ return version
925
+
926
+ def version_parts(self, best: bool = False) -> Tuple[str, str, str]:
927
+ """
928
+ Return the version of the OS distribution, as a tuple of version
929
+ numbers.
930
+
931
+ For details, see :func:`distro.version_parts`.
932
+ """
933
+ version_str = self.version(best=best)
934
+ if version_str:
935
+ version_regex = re.compile(r"(\d+)\.?(\d+)?\.?(\d+)?")
936
+ matches = version_regex.match(version_str)
937
+ if matches:
938
+ major, minor, build_number = matches.groups()
939
+ return major, minor or "", build_number or ""
940
+ return "", "", ""
941
+
942
+ def major_version(self, best: bool = False) -> str:
943
+ """
944
+ Return the major version number of the current distribution.
945
+
946
+ For details, see :func:`distro.major_version`.
947
+ """
948
+ return self.version_parts(best)[0]
949
+
950
+ def minor_version(self, best: bool = False) -> str:
951
+ """
952
+ Return the minor version number of the current distribution.
953
+
954
+ For details, see :func:`distro.minor_version`.
955
+ """
956
+ return self.version_parts(best)[1]
957
+
958
+ def build_number(self, best: bool = False) -> str:
959
+ """
960
+ Return the build number of the current distribution.
961
+
962
+ For details, see :func:`distro.build_number`.
963
+ """
964
+ return self.version_parts(best)[2]
965
+
966
+ def like(self) -> str:
967
+ """
968
+ Return the IDs of distributions that are like the OS distribution.
969
+
970
+ For details, see :func:`distro.like`.
971
+ """
972
+ return self.os_release_attr("id_like") or ""
973
+
974
+ def codename(self) -> str:
975
+ """
976
+ Return the codename of the OS distribution.
977
+
978
+ For details, see :func:`distro.codename`.
979
+ """
980
+ try:
981
+ # Handle os_release specially since distros might purposefully set
982
+ # this to empty string to have no codename
983
+ return self._os_release_info["codename"]
984
+ except KeyError:
985
+ return (
986
+ self.lsb_release_attr("codename")
987
+ or self.distro_release_attr("codename")
988
+ or ""
989
+ )
990
+
991
+ def info(self, pretty: bool = False, best: bool = False) -> InfoDict:
992
+ """
993
+ Return certain machine-readable information about the OS
994
+ distribution.
995
+
996
+ For details, see :func:`distro.info`.
997
+ """
998
+ return InfoDict(
999
+ id=self.id(),
1000
+ version=self.version(pretty, best),
1001
+ version_parts=VersionDict(
1002
+ major=self.major_version(best),
1003
+ minor=self.minor_version(best),
1004
+ build_number=self.build_number(best),
1005
+ ),
1006
+ like=self.like(),
1007
+ codename=self.codename(),
1008
+ )
1009
+
1010
+ def os_release_info(self) -> Dict[str, str]:
1011
+ """
1012
+ Return a dictionary containing key-value pairs for the information
1013
+ items from the os-release file data source of the OS distribution.
1014
+
1015
+ For details, see :func:`distro.os_release_info`.
1016
+ """
1017
+ return self._os_release_info
1018
+
1019
+ def lsb_release_info(self) -> Dict[str, str]:
1020
+ """
1021
+ Return a dictionary containing key-value pairs for the information
1022
+ items from the lsb_release command data source of the OS
1023
+ distribution.
1024
+
1025
+ For details, see :func:`distro.lsb_release_info`.
1026
+ """
1027
+ return self._lsb_release_info
1028
+
1029
+ def distro_release_info(self) -> Dict[str, str]:
1030
+ """
1031
+ Return a dictionary containing key-value pairs for the information
1032
+ items from the distro release file data source of the OS
1033
+ distribution.
1034
+
1035
+ For details, see :func:`distro.distro_release_info`.
1036
+ """
1037
+ return self._distro_release_info
1038
+
1039
+ def uname_info(self) -> Dict[str, str]:
1040
+ """
1041
+ Return a dictionary containing key-value pairs for the information
1042
+ items from the uname command data source of the OS distribution.
1043
+
1044
+ For details, see :func:`distro.uname_info`.
1045
+ """
1046
+ return self._uname_info
1047
+
1048
+ def oslevel_info(self) -> str:
1049
+ """
1050
+ Return AIX' oslevel command output.
1051
+ """
1052
+ return self._oslevel_info
1053
+
1054
+ def os_release_attr(self, attribute: str) -> str:
1055
+ """
1056
+ Return a single named information item from the os-release file data
1057
+ source of the OS distribution.
1058
+
1059
+ For details, see :func:`distro.os_release_attr`.
1060
+ """
1061
+ return self._os_release_info.get(attribute, "")
1062
+
1063
+ def lsb_release_attr(self, attribute: str) -> str:
1064
+ """
1065
+ Return a single named information item from the lsb_release command
1066
+ output data source of the OS distribution.
1067
+
1068
+ For details, see :func:`distro.lsb_release_attr`.
1069
+ """
1070
+ return self._lsb_release_info.get(attribute, "")
1071
+
1072
+ def distro_release_attr(self, attribute: str) -> str:
1073
+ """
1074
+ Return a single named information item from the distro release file
1075
+ data source of the OS distribution.
1076
+
1077
+ For details, see :func:`distro.distro_release_attr`.
1078
+ """
1079
+ return self._distro_release_info.get(attribute, "")
1080
+
1081
+ def uname_attr(self, attribute: str) -> str:
1082
+ """
1083
+ Return a single named information item from the uname command
1084
+ output data source of the OS distribution.
1085
+
1086
+ For details, see :func:`distro.uname_attr`.
1087
+ """
1088
+ return self._uname_info.get(attribute, "")
1089
+
1090
+ @cached_property
1091
+ def _os_release_info(self) -> Dict[str, str]:
1092
+ """
1093
+ Get the information items from the specified os-release file.
1094
+
1095
+ Returns:
1096
+ A dictionary containing all information items.
1097
+ """
1098
+ if os.path.isfile(self.os_release_file):
1099
+ with open(self.os_release_file, encoding="utf-8") as release_file:
1100
+ return self._parse_os_release_content(release_file)
1101
+ return {}
1102
+
1103
+ @staticmethod
1104
+ def _parse_os_release_content(lines: TextIO) -> Dict[str, str]:
1105
+ """
1106
+ Parse the lines of an os-release file.
1107
+
1108
+ Parameters:
1109
+
1110
+ * lines: Iterable through the lines in the os-release file.
1111
+ Each line must be a unicode string or a UTF-8 encoded byte
1112
+ string.
1113
+
1114
+ Returns:
1115
+ A dictionary containing all information items.
1116
+ """
1117
+ props = {}
1118
+ lexer = shlex.shlex(lines, posix=True)
1119
+ lexer.whitespace_split = True
1120
+
1121
+ tokens = list(lexer)
1122
+ for token in tokens:
1123
+ # At this point, all shell-like parsing has been done (i.e.
1124
+ # comments processed, quotes and backslash escape sequences
1125
+ # processed, multi-line values assembled, trailing newlines
1126
+ # stripped, etc.), so the tokens are now either:
1127
+ # * variable assignments: var=value
1128
+ # * commands or their arguments (not allowed in os-release)
1129
+ # Ignore any tokens that are not variable assignments
1130
+ if "=" in token:
1131
+ k, v = token.split("=", 1)
1132
+ props[k.lower()] = v
1133
+
1134
+ if "version" in props:
1135
+ # extract release codename (if any) from version attribute
1136
+ match = re.search(r"\((\D+)\)|,\s*(\D+)", props["version"])
1137
+ if match:
1138
+ release_codename = match.group(1) or match.group(2)
1139
+ props["codename"] = props["release_codename"] = release_codename
1140
+
1141
+ if "version_codename" in props:
1142
+ # os-release added a version_codename field. Use that in
1143
+ # preference to anything else Note that some distros purposefully
1144
+ # do not have code names. They should be setting
1145
+ # version_codename=""
1146
+ props["codename"] = props["version_codename"]
1147
+ elif "ubuntu_codename" in props:
1148
+ # Same as above but a non-standard field name used on older Ubuntus
1149
+ props["codename"] = props["ubuntu_codename"]
1150
+
1151
+ return props
1152
+
1153
+ @cached_property
1154
+ def _lsb_release_info(self) -> Dict[str, str]:
1155
+ """
1156
+ Get the information items from the lsb_release command output.
1157
+
1158
+ Returns:
1159
+ A dictionary containing all information items.
1160
+ """
1161
+ if not self.include_lsb:
1162
+ return {}
1163
+ try:
1164
+ cmd = ("lsb_release", "-a")
1165
+ stdout = subprocess.check_output(cmd, stderr=subprocess.DEVNULL)
1166
+ # Command not found or lsb_release returned error
1167
+ except (OSError, subprocess.CalledProcessError):
1168
+ return {}
1169
+ content = self._to_str(stdout).splitlines()
1170
+ return self._parse_lsb_release_content(content)
1171
+
1172
+ @staticmethod
1173
+ def _parse_lsb_release_content(lines: Iterable[str]) -> Dict[str, str]:
1174
+ """
1175
+ Parse the output of the lsb_release command.
1176
+
1177
+ Parameters:
1178
+
1179
+ * lines: Iterable through the lines of the lsb_release output.
1180
+ Each line must be a unicode string or a UTF-8 encoded byte
1181
+ string.
1182
+
1183
+ Returns:
1184
+ A dictionary containing all information items.
1185
+ """
1186
+ props = {}
1187
+ for line in lines:
1188
+ kv = line.strip("\n").split(":", 1)
1189
+ if len(kv) != 2:
1190
+ # Ignore lines without colon.
1191
+ continue
1192
+ k, v = kv
1193
+ props.update({k.replace(" ", "_").lower(): v.strip()})
1194
+ return props
1195
+
1196
+ @cached_property
1197
+ def _uname_info(self) -> Dict[str, str]:
1198
+ if not self.include_uname:
1199
+ return {}
1200
+ try:
1201
+ cmd = ("uname", "-rs")
1202
+ stdout = subprocess.check_output(cmd, stderr=subprocess.DEVNULL)
1203
+ except OSError:
1204
+ return {}
1205
+ content = self._to_str(stdout).splitlines()
1206
+ return self._parse_uname_content(content)
1207
+
1208
+ @cached_property
1209
+ def _oslevel_info(self) -> str:
1210
+ if not self.include_oslevel:
1211
+ return ""
1212
+ try:
1213
+ stdout = subprocess.check_output("oslevel", stderr=subprocess.DEVNULL)
1214
+ except (OSError, subprocess.CalledProcessError):
1215
+ return ""
1216
+ return self._to_str(stdout).strip()
1217
+
1218
+ @cached_property
1219
+ def _debian_version(self) -> str:
1220
+ try:
1221
+ with open(
1222
+ os.path.join(self.etc_dir, "debian_version"), encoding="ascii"
1223
+ ) as fp:
1224
+ return fp.readline().rstrip()
1225
+ except FileNotFoundError:
1226
+ return ""
1227
+
1228
+ @staticmethod
1229
+ def _parse_uname_content(lines: Sequence[str]) -> Dict[str, str]:
1230
+ if not lines:
1231
+ return {}
1232
+ props = {}
1233
+ match = re.search(r"^([^\s]+)\s+([\d\.]+)", lines[0].strip())
1234
+ if match:
1235
+ name, version = match.groups()
1236
+
1237
+ # This is to prevent the Linux kernel version from
1238
+ # appearing as the 'best' version on otherwise
1239
+ # identifiable distributions.
1240
+ if name == "Linux":
1241
+ return {}
1242
+ props["id"] = name.lower()
1243
+ props["name"] = name
1244
+ props["release"] = version
1245
+ return props
1246
+
1247
+ @staticmethod
1248
+ def _to_str(bytestring: bytes) -> str:
1249
+ encoding = sys.getfilesystemencoding()
1250
+ return bytestring.decode(encoding)
1251
+
1252
+ @cached_property
1253
+ def _distro_release_info(self) -> Dict[str, str]:
1254
+ """
1255
+ Get the information items from the specified distro release file.
1256
+
1257
+ Returns:
1258
+ A dictionary containing all information items.
1259
+ """
1260
+ if self.distro_release_file:
1261
+ # If it was specified, we use it and parse what we can, even if
1262
+ # its file name or content does not match the expected pattern.
1263
+ distro_info = self._parse_distro_release_file(self.distro_release_file)
1264
+ basename = os.path.basename(self.distro_release_file)
1265
+ # The file name pattern for user-specified distro release files
1266
+ # is somewhat more tolerant (compared to when searching for the
1267
+ # file), because we want to use what was specified as best as
1268
+ # possible.
1269
+ match = _DISTRO_RELEASE_BASENAME_PATTERN.match(basename)
1270
+ else:
1271
+ try:
1272
+ basenames = [
1273
+ basename
1274
+ for basename in os.listdir(self.etc_dir)
1275
+ if basename not in _DISTRO_RELEASE_IGNORE_BASENAMES
1276
+ and os.path.isfile(os.path.join(self.etc_dir, basename))
1277
+ ]
1278
+ # We sort for repeatability in cases where there are multiple
1279
+ # distro specific files; e.g. CentOS, Oracle, Enterprise all
1280
+ # containing `redhat-release` on top of their own.
1281
+ basenames.sort()
1282
+ except OSError:
1283
+ # This may occur when /etc is not readable but we can't be
1284
+ # sure about the *-release files. Check common entries of
1285
+ # /etc for information. If they turn out to not be there the
1286
+ # error is handled in `_parse_distro_release_file()`.
1287
+ basenames = _DISTRO_RELEASE_BASENAMES
1288
+ for basename in basenames:
1289
+ match = _DISTRO_RELEASE_BASENAME_PATTERN.match(basename)
1290
+ if match is None:
1291
+ continue
1292
+ filepath = os.path.join(self.etc_dir, basename)
1293
+ distro_info = self._parse_distro_release_file(filepath)
1294
+ # The name is always present if the pattern matches.
1295
+ if "name" not in distro_info:
1296
+ continue
1297
+ self.distro_release_file = filepath
1298
+ break
1299
+ else: # the loop didn't "break": no candidate.
1300
+ return {}
1301
+
1302
+ if match is not None:
1303
+ distro_info["id"] = match.group(1)
1304
+
1305
+ # CloudLinux < 7: manually enrich info with proper id.
1306
+ if "cloudlinux" in distro_info.get("name", "").lower():
1307
+ distro_info["id"] = "cloudlinux"
1308
+
1309
+ return distro_info
1310
+
1311
+ def _parse_distro_release_file(self, filepath: str) -> Dict[str, str]:
1312
+ """
1313
+ Parse a distro release file.
1314
+
1315
+ Parameters:
1316
+
1317
+ * filepath: Path name of the distro release file.
1318
+
1319
+ Returns:
1320
+ A dictionary containing all information items.
1321
+ """
1322
+ try:
1323
+ with open(filepath, encoding="utf-8") as fp:
1324
+ # Only parse the first line. For instance, on SLES there
1325
+ # are multiple lines. We don't want them...
1326
+ return self._parse_distro_release_content(fp.readline())
1327
+ except OSError:
1328
+ # Ignore not being able to read a specific, seemingly version
1329
+ # related file.
1330
+ # See https://github.com/python-distro/distro/issues/162
1331
+ return {}
1332
+
1333
+ @staticmethod
1334
+ def _parse_distro_release_content(line: str) -> Dict[str, str]:
1335
+ """
1336
+ Parse a line from a distro release file.
1337
+
1338
+ Parameters:
1339
+ * line: Line from the distro release file. Must be a unicode string
1340
+ or a UTF-8 encoded byte string.
1341
+
1342
+ Returns:
1343
+ A dictionary containing all information items.
1344
+ """
1345
+ matches = _DISTRO_RELEASE_CONTENT_REVERSED_PATTERN.match(line.strip()[::-1])
1346
+ distro_info = {}
1347
+ if matches:
1348
+ # regexp ensures non-None
1349
+ distro_info["name"] = matches.group(3)[::-1]
1350
+ if matches.group(2):
1351
+ distro_info["version_id"] = matches.group(2)[::-1]
1352
+ if matches.group(1):
1353
+ distro_info["codename"] = matches.group(1)[::-1]
1354
+ elif line:
1355
+ distro_info["name"] = line.strip()
1356
+ return distro_info
1357
+
1358
+
1359
+ _distro = LinuxDistribution()
1360
+
1361
+
1362
+ def main() -> None:
1363
+ logger = logging.getLogger(__name__)
1364
+ logger.setLevel(logging.DEBUG)
1365
+ logger.addHandler(logging.StreamHandler(sys.stdout))
1366
+
1367
+ parser = argparse.ArgumentParser(description="OS distro info tool")
1368
+ parser.add_argument(
1369
+ "--json", "-j", help="Output in machine readable format", action="store_true"
1370
+ )
1371
+
1372
+ parser.add_argument(
1373
+ "--root-dir",
1374
+ "-r",
1375
+ type=str,
1376
+ dest="root_dir",
1377
+ help="Path to the root filesystem directory (defaults to /)",
1378
+ )
1379
+
1380
+ args = parser.parse_args()
1381
+
1382
+ if args.root_dir:
1383
+ dist = LinuxDistribution(
1384
+ include_lsb=False,
1385
+ include_uname=False,
1386
+ include_oslevel=False,
1387
+ root_dir=args.root_dir,
1388
+ )
1389
+ else:
1390
+ dist = _distro
1391
+
1392
+ if args.json:
1393
+ logger.info(json.dumps(dist.info(), indent=4, sort_keys=True))
1394
+ else:
1395
+ logger.info("Name: %s", dist.name(pretty=True))
1396
+ distribution_version = dist.version(pretty=True)
1397
+ logger.info("Version: %s", distribution_version)
1398
+ distribution_codename = dist.codename()
1399
+ logger.info("Codename: %s", distribution_codename)
1400
+
1401
+
1402
+ if __name__ == "__main__":
1403
+ main()
lib/python3.12/site-packages/distro/py.typed ADDED
File without changes
lib/python3.12/site-packages/nvidia/__init__.py ADDED
File without changes
lib/python3.12/site-packages/nvidia/cuda_nvrtc/__init__.py ADDED
File without changes
lib/python3.12/site-packages/nvidia/cuda_nvrtc/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (196 Bytes). View file
 
lib/python3.12/site-packages/nvidia/cuda_nvrtc/include/__init__.py ADDED
File without changes
lib/python3.12/site-packages/nvidia/cuda_nvrtc/include/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (204 Bytes). View file
 
lib/python3.12/site-packages/nvidia/cuda_nvrtc/include/nvrtc.h ADDED
@@ -0,0 +1,869 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //
2
+ // NVIDIA_COPYRIGHT_BEGIN
3
+ //
4
+ // Copyright (c) 2014-2023, NVIDIA CORPORATION. All rights reserved.
5
+ //
6
+ // NVIDIA CORPORATION and its licensors retain all intellectual property
7
+ // and proprietary rights in and to this software, related documentation
8
+ // and any modifications thereto. Any use, reproduction, disclosure or
9
+ // distribution of this software and related documentation without an express
10
+ // license agreement from NVIDIA CORPORATION is strictly prohibited.
11
+ //
12
+ // NVIDIA_COPYRIGHT_END
13
+ //
14
+
15
+ #ifndef __NVRTC_H__
16
+ #define __NVRTC_H__
17
+
18
+ #ifdef __cplusplus
19
+ extern "C" {
20
+ #endif /* __cplusplus */
21
+
22
+ #include <stdlib.h>
23
+
24
+
25
+ /*************************************************************************//**
26
+ *
27
+ * \defgroup error Error Handling
28
+ *
29
+ * NVRTC defines the following enumeration type and function for API call
30
+ * error handling.
31
+ *
32
+ ****************************************************************************/
33
+
34
+
35
+ /**
36
+ * \ingroup error
37
+ * \brief The enumerated type nvrtcResult defines API call result codes.
38
+ * NVRTC API functions return nvrtcResult to indicate the call
39
+ * result.
40
+ */
41
+ typedef enum {
42
+ NVRTC_SUCCESS = 0,
43
+ NVRTC_ERROR_OUT_OF_MEMORY = 1,
44
+ NVRTC_ERROR_PROGRAM_CREATION_FAILURE = 2,
45
+ NVRTC_ERROR_INVALID_INPUT = 3,
46
+ NVRTC_ERROR_INVALID_PROGRAM = 4,
47
+ NVRTC_ERROR_INVALID_OPTION = 5,
48
+ NVRTC_ERROR_COMPILATION = 6,
49
+ NVRTC_ERROR_BUILTIN_OPERATION_FAILURE = 7,
50
+ NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION = 8,
51
+ NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION = 9,
52
+ NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID = 10,
53
+ NVRTC_ERROR_INTERNAL_ERROR = 11,
54
+ NVRTC_ERROR_TIME_FILE_WRITE_FAILED = 12
55
+ } nvrtcResult;
56
+
57
+
58
+ /**
59
+ * \ingroup error
60
+ * \brief nvrtcGetErrorString is a helper function that returns a string
61
+ * describing the given nvrtcResult code, e.g., NVRTC_SUCCESS to
62
+ * \c "NVRTC_SUCCESS".
63
+ * For unrecognized enumeration values, it returns
64
+ * \c "NVRTC_ERROR unknown".
65
+ *
66
+ * \param [in] result CUDA Runtime Compilation API result code.
67
+ * \return Message string for the given #nvrtcResult code.
68
+ */
69
+ const char *nvrtcGetErrorString(nvrtcResult result);
70
+
71
+
72
+ /*************************************************************************//**
73
+ *
74
+ * \defgroup query General Information Query
75
+ *
76
+ * NVRTC defines the following function for general information query.
77
+ *
78
+ ****************************************************************************/
79
+
80
+
81
+ /**
82
+ * \ingroup query
83
+ * \brief nvrtcVersion sets the output parameters \p major and \p minor
84
+ * with the CUDA Runtime Compilation version number.
85
+ *
86
+ * \param [out] major CUDA Runtime Compilation major version number.
87
+ * \param [out] minor CUDA Runtime Compilation minor version number.
88
+ * \return
89
+ * - \link #nvrtcResult NVRTC_SUCCESS \endlink
90
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_INPUT \endlink
91
+ *
92
+ */
93
+ nvrtcResult nvrtcVersion(int *major, int *minor);
94
+
95
+
96
+ /**
97
+ * \ingroup query
98
+ * \brief nvrtcGetNumSupportedArchs sets the output parameter \p numArchs
99
+ * with the number of architectures supported by NVRTC. This can
100
+ * then be used to pass an array to ::nvrtcGetSupportedArchs to
101
+ * get the supported architectures.
102
+ *
103
+ * \param [out] numArchs number of supported architectures.
104
+ * \return
105
+ * - \link #nvrtcResult NVRTC_SUCCESS \endlink
106
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_INPUT \endlink
107
+ *
108
+ * see ::nvrtcGetSupportedArchs
109
+ */
110
+ nvrtcResult nvrtcGetNumSupportedArchs(int* numArchs);
111
+
112
+
113
+ /**
114
+ * \ingroup query
115
+ * \brief nvrtcGetSupportedArchs populates the array passed via the output parameter
116
+ * \p supportedArchs with the architectures supported by NVRTC. The array is
117
+ * sorted in the ascending order. The size of the array to be passed can be
118
+ * determined using ::nvrtcGetNumSupportedArchs.
119
+ *
120
+ * \param [out] supportedArchs sorted array of supported architectures.
121
+ * \return
122
+ * - \link #nvrtcResult NVRTC_SUCCESS \endlink
123
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_INPUT \endlink
124
+ *
125
+ * see ::nvrtcGetNumSupportedArchs
126
+ */
127
+ nvrtcResult nvrtcGetSupportedArchs(int* supportedArchs);
128
+
129
+
130
+ /*************************************************************************//**
131
+ *
132
+ * \defgroup compilation Compilation
133
+ *
134
+ * NVRTC defines the following type and functions for actual compilation.
135
+ *
136
+ ****************************************************************************/
137
+
138
+
139
+ /**
140
+ * \ingroup compilation
141
+ * \brief nvrtcProgram is the unit of compilation, and an opaque handle for
142
+ * a program.
143
+ *
144
+ * To compile a CUDA program string, an instance of nvrtcProgram must be
145
+ * created first with ::nvrtcCreateProgram, then compiled with
146
+ * ::nvrtcCompileProgram.
147
+ */
148
+ typedef struct _nvrtcProgram *nvrtcProgram;
149
+
150
+
151
+ /**
152
+ * \ingroup compilation
153
+ * \brief nvrtcCreateProgram creates an instance of nvrtcProgram with the
154
+ * given input parameters, and sets the output parameter \p prog with
155
+ * it.
156
+ *
157
+ * \param [out] prog CUDA Runtime Compilation program.
158
+ * \param [in] src CUDA program source.
159
+ * \param [in] name CUDA program name.\n
160
+ * \p name can be \c NULL; \c "default_program" is
161
+ * used when \p name is \c NULL or "".
162
+ * \param [in] numHeaders Number of headers used.\n
163
+ * \p numHeaders must be greater than or equal to 0.
164
+ * \param [in] headers Sources of the headers.\n
165
+ * \p headers can be \c NULL when \p numHeaders is
166
+ * 0.
167
+ * \param [in] includeNames Name of each header by which they can be
168
+ * included in the CUDA program source.\n
169
+ * \p includeNames can be \c NULL when \p numHeaders
170
+ * is 0. These headers must be included with the exact
171
+ * names specified here.
172
+ * \return
173
+ * - \link #nvrtcResult NVRTC_SUCCESS \endlink
174
+ * - \link #nvrtcResult NVRTC_ERROR_OUT_OF_MEMORY \endlink
175
+ * - \link #nvrtcResult NVRTC_ERROR_PROGRAM_CREATION_FAILURE \endlink
176
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_INPUT \endlink
177
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_PROGRAM \endlink
178
+ *
179
+ * \see ::nvrtcDestroyProgram
180
+ */
181
+ nvrtcResult nvrtcCreateProgram(nvrtcProgram *prog,
182
+ const char *src,
183
+ const char *name,
184
+ int numHeaders,
185
+ const char * const *headers,
186
+ const char * const *includeNames);
187
+
188
+
189
+ /**
190
+ * \ingroup compilation
191
+ * \brief nvrtcDestroyProgram destroys the given program.
192
+ *
193
+ * \param [in] prog CUDA Runtime Compilation program.
194
+ * \return
195
+ * - \link #nvrtcResult NVRTC_SUCCESS \endlink
196
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_PROGRAM \endlink
197
+ *
198
+ * \see ::nvrtcCreateProgram
199
+ */
200
+ nvrtcResult nvrtcDestroyProgram(nvrtcProgram *prog);
201
+
202
+
203
+ /**
204
+ * \ingroup compilation
205
+ * \brief nvrtcCompileProgram compiles the given program.
206
+ *
207
+ * \param [in] prog CUDA Runtime Compilation program.
208
+ * \param [in] numOptions Number of compiler options passed.
209
+ * \param [in] options Compiler options in the form of C string array.\n
210
+ * \p options can be \c NULL when \p numOptions is 0.
211
+ *
212
+ * \return
213
+ * - \link #nvrtcResult NVRTC_SUCCESS \endlink
214
+ * - \link #nvrtcResult NVRTC_ERROR_OUT_OF_MEMORY \endlink
215
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_INPUT \endlink
216
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_PROGRAM \endlink
217
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_OPTION \endlink
218
+ * - \link #nvrtcResult NVRTC_ERROR_COMPILATION \endlink
219
+ * - \link #nvrtcResult NVRTC_ERROR_BUILTIN_OPERATION_FAILURE \endlink
220
+ * - \link #nvrtcResult NVRTC_ERROR_TIME_FILE_WRITE_FAILED \endlink
221
+ *
222
+ * It supports compile options listed in \ref options.
223
+ */
224
+ nvrtcResult nvrtcCompileProgram(nvrtcProgram prog,
225
+ int numOptions, const char * const *options);
226
+
227
+
228
+ /**
229
+ * \ingroup compilation
230
+ * \brief nvrtcGetPTXSize sets the value of \p ptxSizeRet with the size of the PTX
231
+ * generated by the previous compilation of \p prog (including the
232
+ * trailing \c NULL).
233
+ *
234
+ * \param [in] prog CUDA Runtime Compilation program.
235
+ * \param [out] ptxSizeRet Size of the generated PTX (including the trailing
236
+ * \c NULL).
237
+ * \return
238
+ * - \link #nvrtcResult NVRTC_SUCCESS \endlink
239
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_INPUT \endlink
240
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_PROGRAM \endlink
241
+ *
242
+ * \see ::nvrtcGetPTX
243
+ */
244
+ nvrtcResult nvrtcGetPTXSize(nvrtcProgram prog, size_t *ptxSizeRet);
245
+
246
+
247
+ /**
248
+ * \ingroup compilation
249
+ * \brief nvrtcGetPTX stores the PTX generated by the previous compilation
250
+ * of \p prog in the memory pointed by \p ptx.
251
+ *
252
+ * \param [in] prog CUDA Runtime Compilation program.
253
+ * \param [out] ptx Compiled result.
254
+ * \return
255
+ * - \link #nvrtcResult NVRTC_SUCCESS \endlink
256
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_INPUT \endlink
257
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_PROGRAM \endlink
258
+ *
259
+ * \see ::nvrtcGetPTXSize
260
+ */
261
+ nvrtcResult nvrtcGetPTX(nvrtcProgram prog, char *ptx);
262
+
263
+
264
+ /**
265
+ * \ingroup compilation
266
+ * \brief nvrtcGetCUBINSize sets the value of \p cubinSizeRet with the size of the cubin
267
+ * generated by the previous compilation of \p prog. The value of
268
+ * cubinSizeRet is set to 0 if the value specified to \c -arch is a
269
+ * virtual architecture instead of an actual architecture.
270
+ *
271
+ * \param [in] prog CUDA Runtime Compilation program.
272
+ * \param [out] cubinSizeRet Size of the generated cubin.
273
+ * \return
274
+ * - \link #nvrtcResult NVRTC_SUCCESS \endlink
275
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_INPUT \endlink
276
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_PROGRAM \endlink
277
+ *
278
+ * \see ::nvrtcGetCUBIN
279
+ */
280
+ nvrtcResult nvrtcGetCUBINSize(nvrtcProgram prog, size_t *cubinSizeRet);
281
+
282
+
283
+ /**
284
+ * \ingroup compilation
285
+ * \brief nvrtcGetCUBIN stores the cubin generated by the previous compilation
286
+ * of \p prog in the memory pointed by \p cubin. No cubin is available
287
+ * if the value specified to \c -arch is a virtual architecture instead
288
+ * of an actual architecture.
289
+ *
290
+ * \param [in] prog CUDA Runtime Compilation program.
291
+ * \param [out] cubin Compiled and assembled result.
292
+ * \return
293
+ * - \link #nvrtcResult NVRTC_SUCCESS \endlink
294
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_INPUT \endlink
295
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_PROGRAM \endlink
296
+ *
297
+ * \see ::nvrtcGetCUBINSize
298
+ */
299
+ nvrtcResult nvrtcGetCUBIN(nvrtcProgram prog, char *cubin);
300
+
301
+
302
+ #if defined(_WIN32)
303
+ # define __DEPRECATED__(msg) __declspec(deprecated(msg))
304
+ #elif (defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5 && !defined(__clang__))))
305
+ # define __DEPRECATED__(msg) __attribute__((deprecated))
306
+ #elif (defined(__GNUC__))
307
+ # define __DEPRECATED__(msg) __attribute__((deprecated(msg)))
308
+ #else
309
+ # define __DEPRECATED__(msg)
310
+ #endif
311
+
312
+ /**
313
+ * \ingroup compilation
314
+ * \brief
315
+ * DEPRECATION NOTICE: This function will be removed in a future release. Please use
316
+ * nvrtcGetLTOIRSize (and nvrtcGetLTOIR) instead.
317
+ */
318
+ __DEPRECATED__("This function will be removed in a future release. Please use nvrtcGetLTOIRSize instead")
319
+ nvrtcResult nvrtcGetNVVMSize(nvrtcProgram prog, size_t *nvvmSizeRet);
320
+
321
+ /**
322
+ * \ingroup compilation
323
+ * \brief
324
+ * DEPRECATION NOTICE: This function will be removed in a future release. Please use
325
+ * nvrtcGetLTOIR (and nvrtcGetLTOIRSize) instead.
326
+ */
327
+ __DEPRECATED__("This function will be removed in a future release. Please use nvrtcGetLTOIR instead")
328
+ nvrtcResult nvrtcGetNVVM(nvrtcProgram prog, char *nvvm);
329
+
330
+ #undef __DEPRECATED__
331
+
332
+ /**
333
+ * \ingroup compilation
334
+ * \brief nvrtcGetLTOIRSize sets the value of \p LTOIRSizeRet with the size of the LTO IR
335
+ * generated by the previous compilation of \p prog. The value of
336
+ * LTOIRSizeRet is set to 0 if the program was not compiled with
337
+ * \c -dlto.
338
+ *
339
+ * \param [in] prog CUDA Runtime Compilation program.
340
+ * \param [out] LTOIRSizeRet Size of the generated LTO IR.
341
+ * \return
342
+ * - \link #nvrtcResult NVRTC_SUCCESS \endlink
343
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_INPUT \endlink
344
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_PROGRAM \endlink
345
+ *
346
+ * \see ::nvrtcGetLTOIR
347
+ */
348
+ nvrtcResult nvrtcGetLTOIRSize(nvrtcProgram prog, size_t *LTOIRSizeRet);
349
+
350
+
351
+ /**
352
+ * \ingroup compilation
353
+ * \brief nvrtcGetLTOIR stores the LTO IR generated by the previous compilation
354
+ * of \p prog in the memory pointed by \p LTOIR. No LTO IR is available
355
+ * if the program was compiled without \c -dlto.
356
+ *
357
+ * \param [in] prog CUDA Runtime Compilation program.
358
+ * \param [out] LTOIR Compiled result.
359
+ * \return
360
+ * - \link #nvrtcResult NVRTC_SUCCESS \endlink
361
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_INPUT \endlink
362
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_PROGRAM \endlink
363
+ *
364
+ * \see ::nvrtcGetLTOIRSize
365
+ */
366
+ nvrtcResult nvrtcGetLTOIR(nvrtcProgram prog, char *LTOIR);
367
+
368
+
369
+ /**
370
+ * \ingroup compilation
371
+ * \brief nvrtcGetOptiXIRSize sets the value of \p optixirSizeRet with the size of the OptiX IR
372
+ * generated by the previous compilation of \p prog. The value of
373
+ * nvrtcGetOptiXIRSize is set to 0 if the program was compiled with
374
+ * options incompatible with OptiX IR generation.
375
+ *
376
+ * \param [in] prog CUDA Runtime Compilation program.
377
+ * \param [out] optixirSizeRet Size of the generated LTO IR.
378
+ * \return
379
+ * - \link #nvrtcResult NVRTC_SUCCESS \endlink
380
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_INPUT \endlink
381
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_PROGRAM \endlink
382
+ *
383
+ * \see ::nvrtcGetOptiXIR
384
+ */
385
+ nvrtcResult nvrtcGetOptiXIRSize(nvrtcProgram prog, size_t *optixirSizeRet);
386
+
387
+
388
+ /**
389
+ * \ingroup compilation
390
+ * \brief nvrtcGetOptiXIR stores the OptiX IR generated by the previous compilation
391
+ * of \p prog in the memory pointed by \p optixir. No OptiX IR is available
392
+ * if the program was compiled with options incompatible with OptiX IR generation.
393
+ *
394
+ * \param [in] prog CUDA Runtime Compilation program.
395
+ * \param [out] Optix IR Compiled result.
396
+ * \return
397
+ * - \link #nvrtcResult NVRTC_SUCCESS \endlink
398
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_INPUT \endlink
399
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_PROGRAM \endlink
400
+ *
401
+ * \see ::nvrtcGetOptiXIRSize
402
+ */
403
+ nvrtcResult nvrtcGetOptiXIR(nvrtcProgram prog, char *optixir);
404
+
405
+ /**
406
+ * \ingroup compilation
407
+ * \brief nvrtcGetProgramLogSize sets \p logSizeRet with the size of the
408
+ * log generated by the previous compilation of \p prog (including the
409
+ * trailing \c NULL).
410
+ *
411
+ * Note that compilation log may be generated with warnings and informative
412
+ * messages, even when the compilation of \p prog succeeds.
413
+ *
414
+ * \param [in] prog CUDA Runtime Compilation program.
415
+ * \param [out] logSizeRet Size of the compilation log
416
+ * (including the trailing \c NULL).
417
+ * \return
418
+ * - \link #nvrtcResult NVRTC_SUCCESS \endlink
419
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_INPUT \endlink
420
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_PROGRAM \endlink
421
+ *
422
+ * \see ::nvrtcGetProgramLog
423
+ */
424
+ nvrtcResult nvrtcGetProgramLogSize(nvrtcProgram prog, size_t *logSizeRet);
425
+
426
+
427
+ /**
428
+ * \ingroup compilation
429
+ * \brief nvrtcGetProgramLog stores the log generated by the previous
430
+ * compilation of \p prog in the memory pointed by \p log.
431
+ *
432
+ * \param [in] prog CUDA Runtime Compilation program.
433
+ * \param [out] log Compilation log.
434
+ * \return
435
+ * - \link #nvrtcResult NVRTC_SUCCESS \endlink
436
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_INPUT \endlink
437
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_PROGRAM \endlink
438
+ *
439
+ * \see ::nvrtcGetProgramLogSize
440
+ */
441
+ nvrtcResult nvrtcGetProgramLog(nvrtcProgram prog, char *log);
442
+
443
+
444
+ /**
445
+ * \ingroup compilation
446
+ * \brief nvrtcAddNameExpression notes the given name expression
447
+ * denoting the address of a __global__ function
448
+ * or __device__/__constant__ variable.
449
+ *
450
+ * The identical name expression string must be provided on a subsequent
451
+ * call to nvrtcGetLoweredName to extract the lowered name.
452
+ * \param [in] prog CUDA Runtime Compilation program.
453
+ * \param [in] name_expression constant expression denoting the address of
454
+ * a __global__ function or __device__/__constant__ variable.
455
+ * \return
456
+ * - \link #nvrtcResult NVRTC_SUCCESS \endlink
457
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_PROGRAM \endlink
458
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_INPUT \endlink
459
+ * - \link #nvrtcResult NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION \endlink
460
+ *
461
+ * \see ::nvrtcGetLoweredName
462
+ */
463
+ nvrtcResult nvrtcAddNameExpression(nvrtcProgram prog,
464
+ const char * const name_expression);
465
+
466
+ /**
467
+ * \ingroup compilation
468
+ * \brief nvrtcGetLoweredName extracts the lowered (mangled) name
469
+ * for a __global__ function or __device__/__constant__ variable,
470
+ * and updates *lowered_name to point to it. The memory containing
471
+ * the name is released when the NVRTC program is destroyed by
472
+ * nvrtcDestroyProgram.
473
+ * The identical name expression must have been previously
474
+ * provided to nvrtcAddNameExpression.
475
+ *
476
+ * \param [in] prog CUDA Runtime Compilation program.
477
+ * \param [in] name_expression constant expression denoting the address of
478
+ * a __global__ function or __device__/__constant__ variable.
479
+ * \param [out] lowered_name initialized by the function to point to a
480
+ * C string containing the lowered (mangled)
481
+ * name corresponding to the provided name expression.
482
+ * \return
483
+ * - \link #nvrtcResult NVRTC_SUCCESS \endlink
484
+ * - \link #nvrtcResult NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION \endlink
485
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_PROGRAM \endlink
486
+ * - \link #nvrtcResult NVRTC_ERROR_INVALID_INPUT \endlink
487
+ * - \link #nvrtcResult NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID \endlink
488
+ *
489
+ * \see ::nvrtcAddNameExpression
490
+ */
491
+ nvrtcResult nvrtcGetLoweredName(nvrtcProgram prog,
492
+ const char *const name_expression,
493
+ const char** lowered_name);
494
+
495
+
496
+ /**
497
+ * \defgroup options Supported Compile Options
498
+ *
499
+ * NVRTC supports the compile options below.
500
+ * Option names with two preceding dashs (\c --) are long option names and
501
+ * option names with one preceding dash (\c -) are short option names.
502
+ * Short option names can be used instead of long option names.
503
+ * When a compile option takes an argument, an assignment operator (\c =)
504
+ * is used to separate the compile option argument from the compile option
505
+ * name, e.g., \c "--gpu-architecture=compute_60".
506
+ * Alternatively, the compile option name and the argument can be specified in
507
+ * separate strings without an assignment operator, .e.g,
508
+ * \c "--gpu-architecture" \c "compute_60".
509
+ * Single-character short option names, such as \c -D, \c -U, and \c -I, do
510
+ * not require an assignment operator, and the compile option name and the
511
+ * argument can be present in the same string with or without spaces between
512
+ * them.
513
+ * For instance, \c "-D=<def>", \c "-D<def>", and \c "-D <def>" are all
514
+ * supported.
515
+ *
516
+ * The valid compiler options are:
517
+ *
518
+ * - Compilation targets
519
+ * - \c --gpu-architecture=\<arch\> (\c -arch)\n
520
+ * Specify the name of the class of GPU architectures for which the
521
+ * input must be compiled.\n
522
+ * - Valid <c>\<arch\></c>s:
523
+ * - \c compute_50
524
+ * - \c compute_52
525
+ * - \c compute_53
526
+ * - \c compute_60
527
+ * - \c compute_61
528
+ * - \c compute_62
529
+ * - \c compute_70
530
+ * - \c compute_72
531
+ * - \c compute_75
532
+ * - \c compute_80
533
+ * - \c compute_87
534
+ * - \c compute_89
535
+ * - \c compute_90
536
+ * - \c compute_90a
537
+ * - \c sm_50
538
+ * - \c sm_52
539
+ * - \c sm_53
540
+ * - \c sm_60
541
+ * - \c sm_61
542
+ * - \c sm_62
543
+ * - \c sm_70
544
+ * - \c sm_72
545
+ * - \c sm_75
546
+ * - \c sm_80
547
+ * - \c sm_87
548
+ * - \c sm_89
549
+ * - \c sm_90
550
+ * - \c sm_90a
551
+ * - Default: \c compute_52
552
+ * - Separate compilation / whole-program compilation
553
+ * - \c --device-c (\c -dc)\n
554
+ * Generate relocatable code that can be linked with other relocatable
555
+ * device code. It is equivalent to --relocatable-device-code=true.
556
+ * - \c --device-w (\c -dw)\n
557
+ * Generate non-relocatable code. It is equivalent to
558
+ * \c --relocatable-device-code=false.
559
+ * - \c --relocatable-device-code={true|false} (\c -rdc)\n
560
+ * Enable (disable) the generation of relocatable device code.
561
+ * - Default: \c false
562
+ * - \c --extensible-whole-program (\c -ewp)\n
563
+ * Do extensible whole program compilation of device code.
564
+ * - Default: \c false
565
+ * - Debugging support
566
+ * - \c --device-debug (\c -G)\n
567
+ * Generate debug information. If --dopt is not specified,
568
+ * then turns off all optimizations.
569
+ * - \c --generate-line-info (\c -lineinfo)\n
570
+ * Generate line-number information.
571
+ * - Code generation
572
+ * - \c --dopt on (\c -dopt)\n
573
+ * - \c --dopt=on \n
574
+ * Enable device code optimization. When specified along with '-G', enables
575
+ * limited debug information generation for optimized device code (currently,
576
+ * only line number information).
577
+ * When '-G' is not specified, '-dopt=on' is implicit.
578
+ * - \c --ptxas-options \<options\> (\c -Xptxas)\n
579
+ * - \c --ptxas-options=\<options\> \n
580
+ * Specify options directly to ptxas, the PTX optimizing assembler.
581
+ * - \c --maxrregcount=\<N\> (\c -maxrregcount)\n
582
+ * Specify the maximum amount of registers that GPU functions can use.
583
+ * Until a function-specific limit, a higher value will generally
584
+ * increase the performance of individual GPU threads that execute this
585
+ * function. However, because thread registers are allocated from a
586
+ * global register pool on each GPU, a higher value of this option will
587
+ * also reduce the maximum thread block size, thereby reducing the amount
588
+ * of thread parallelism. Hence, a good maxrregcount value is the result
589
+ * of a trade-off. If this option is not specified, then no maximum is
590
+ * assumed. Value less than the minimum registers required by ABI will
591
+ * be bumped up by the compiler to ABI minimum limit.
592
+ * - \c --ftz={true|false} (\c -ftz)\n
593
+ * When performing single-precision floating-point operations, flush
594
+ * denormal values to zero or preserve denormal values.
595
+ * \c --use_fast_math implies \c --ftz=true.
596
+ * - Default: \c false
597
+ * - \c --prec-sqrt={true|false} (\c -prec-sqrt)\n
598
+ * For single-precision floating-point square root, use IEEE
599
+ * round-to-nearest mode or use a faster approximation.
600
+ * \c --use_fast_math implies \c --prec-sqrt=false.
601
+ * - Default: \c true
602
+ * - \c --prec-div={true|false} (\c -prec-div)\n
603
+ * For single-precision floating-point division and reciprocals, use IEEE
604
+ * round-to-nearest mode or use a faster approximation.
605
+ * \c --use_fast_math implies \c --prec-div=false.
606
+ * - Default: \c true
607
+ * - \c --fmad={true|false} (\c -fmad)\n
608
+ * Enables (disables) the contraction of floating-point multiplies and
609
+ * adds/subtracts into floating-point multiply-add operations (FMAD,
610
+ * FFMA, or DFMA). \c --use_fast_math implies \c --fmad=true.
611
+ * - Default: \c true
612
+ * - \c --use_fast_math (\c -use_fast_math)\n
613
+ * Make use of fast math operations.
614
+ * \c --use_fast_math implies \c --ftz=true \c --prec-div=false
615
+ * \c --prec-sqrt=false \c --fmad=true.
616
+ * - \c --extra-device-vectorization (\c -extra-device-vectorization)\n
617
+ * Enables more aggressive device code vectorization in the NVVM optimizer.
618
+ * - \c --modify-stack-limit={true|false} (\c -modify-stack-limit)\n
619
+ * On Linux, during compilation, use \c setrlimit() to increase stack size
620
+ * to maximum allowed. The limit is reset to the previous value at the
621
+ * end of compilation.
622
+ * Note: \c setrlimit() changes the value for the entire process.
623
+ * - Default: \c true
624
+ * - \c --dlink-time-opt (\c -dlto)\n
625
+ * Generate intermediate code for later link-time optimization.
626
+ * It implies \c -rdc=true.
627
+ * Note: when this option is used the nvrtcGetLTOIR API should be used,
628
+ * as PTX or Cubin will not be generated.
629
+ * - \c --gen-opt-lto (\c -gen-opt-lto)\n
630
+ * Run the optimizer passes before generating the LTO IR.
631
+ * - \c --optix-ir (\c -optix-ir)\n
632
+ * Generate OptiX IR. The Optix IR is only intended for consumption by OptiX
633
+ * through appropriate APIs. This feature is not supported with
634
+ * link-time-optimization (\c -dlto)\n.
635
+ * Note: when this option is used the nvrtcGetOptiX API should be used,
636
+ * as PTX or Cubin will not be generated.
637
+ * - \c --jump-table-density=[0-101] (\c -jtd)\n
638
+ * Specify the case density percentage in switch statements, and use it as
639
+ * a minimal threshold to determine whether jump table(brx.idx instruction)
640
+ * will be used to implement a switch statement. Default value is 101. The
641
+ * percentage ranges from 0 to 101 inclusively.
642
+ * - Preprocessing
643
+ * - \c --define-macro=\<def\> (\c -D)\n
644
+ * \c \<def\> can be either \c \<name\> or \c \<name=definitions\>.
645
+ * - \c \<name\> \n
646
+ * Predefine \c \<name\> as a macro with definition \c 1.
647
+ * - \c \<name\>=\<definition\> \n
648
+ * The contents of \c \<definition\> are tokenized and preprocessed
649
+ * as if they appeared during translation phase three in a \c \#define
650
+ * directive. In particular, the definition will be truncated by
651
+ * embedded new line characters.
652
+ * - \c --undefine-macro=\<def\> (\c -U)\n
653
+ * Cancel any previous definition of \c \<def\>.
654
+ * - \c --include-path=\<dir\> (\c -I)\n
655
+ * Add the directory \c \<dir\> to the list of directories to be
656
+ * searched for headers. These paths are searched after the list of
657
+ * headers given to ::nvrtcCreateProgram.
658
+ * - \c --pre-include=\<header\> (\c -include)\n
659
+ * Preinclude \c \<header\> during preprocessing.
660
+ * - \c --no-source-include (\c -no-source-include)
661
+ * The preprocessor by default adds the directory of each input sources
662
+ * to the include path. This option disables this feature and only
663
+ * considers the path specified explicitly.
664
+ * - Language Dialect
665
+ * - \c --std={c++03|c++11|c++14|c++17|c++20}
666
+ * (\c -std={c++11|c++14|c++17|c++20})\n
667
+ * Set language dialect to C++03, C++11, C++14, C++17 or C++20
668
+ * - Default: \c c++17
669
+ * - \c --builtin-move-forward={true|false} (\c -builtin-move-forward)\n
670
+ * Provide builtin definitions of \c std::move and \c std::forward,
671
+ * when C++11 or later language dialect is selected.
672
+ * - Default: \c true
673
+ * - \c --builtin-initializer-list={true|false}
674
+ * (\c -builtin-initializer-list)\n
675
+ * Provide builtin definitions of \c std::initializer_list class and
676
+ * member functions when C++11 or later language dialect is selected.
677
+ * - Default: \c true
678
+ * - Misc.
679
+ * - \c --disable-warnings (\c -w)\n
680
+ * Inhibit all warning messages.
681
+ * - \c --restrict (\c -restrict)\n
682
+ * Programmer assertion that all kernel pointer parameters are restrict
683
+ * pointers.
684
+ * - \c --device-as-default-execution-space
685
+ * (\c -default-device)\n
686
+ * Treat entities with no execution space annotation as \c __device__
687
+ * entities.
688
+ * - \c --device-int128 (\c -device-int128)\n
689
+ * Allow the \c __int128 type in device code. Also causes the macro \c __CUDACC_RTC_INT128__
690
+ * to be defined.
691
+ * - \c --optimization-info=\<kind\> (\c -opt-info)\n
692
+ * Provide optimization reports for the specified kind of optimization.
693
+ * The following kind tags are supported:
694
+ * - \c inline : emit a remark when a function is inlined.
695
+ * - \c --display-error-number (\c -err-no)\n
696
+ * Display diagnostic number for warning messages. (Default)
697
+ * - \c --no-display-error-number (\c -no-err-no)\n
698
+ * Disables the display of a diagnostic number for warning messages.
699
+ * - \c --diag-error=<error-number>,... (\c -diag-error)\n
700
+ * Emit error for specified diagnostic message number(s). Message numbers can be separated by comma.
701
+ * - \c --diag-suppress=<error-number>,... (\c -diag-suppress)\n
702
+ * Suppress specified diagnostic message number(s). Message numbers can be separated by comma.
703
+ * - \c --diag-warn=<error-number>,... (\c -diag-warn)\n
704
+ * Emit warning for specified diagnostic message number(s). Message numbers can be separated by comma.
705
+ * - \c --brief-diagnostics={true|false} (\c -brief-diag)\n
706
+ * This option disables or enables showing source line and column info
707
+ * in a diagnostic.
708
+ * The --brief-diagnostics=true will not show the source line and column info.
709
+ * - Default: \c false
710
+ * - \c --time=<file-name> (\c -time)\n
711
+ * Generate a comma separated value table with the time taken by each compilation
712
+ * phase, and append it at the end of the file given as the option argument.
713
+ * If the file does not exist, the column headings are generated in the first row
714
+ * of the table. If the file name is '-', the timing data is written to the compilation log.
715
+ * - \c --split-compile=<number of threads> (\c -split-compile=<number of threads>)\n
716
+ * Perform compiler optimizations in parallel.
717
+ * Split compilation attempts to reduce compile time by enabling the compiler to run certain
718
+ * optimization passes concurrently. This option accepts a numerical value that specifies the
719
+ * maximum number of threads the compiler can use. One can also allow the compiler to use the maximum
720
+ * threads available on the system by setting --split-compile=0.
721
+ * Setting --split-compile=1 will cause this option to be ignored.
722
+ * - \c --fdevice-syntax-only (\c -fdevice-syntax-only)\n
723
+ * Ends device compilation after front-end syntax checking. This option does not generate valid
724
+ * device code.
725
+ * - \c --minimal (\c -minimal)\n
726
+ * Omit certain language features to reduce compile time for small programs.
727
+ * In particular, the following are omitted:
728
+ * - Texture and surface functions and associated types, e.g., \c cudaTextureObject_t.
729
+ * - CUDA Runtime Functions that are provided by the cudadevrt device code library,
730
+ * typically named with prefix "cuda", e.g., \c cudaMalloc.
731
+ * - Kernel launch from device code.
732
+ * - Types and macros associated with CUDA Runtime and Driver APIs,
733
+ * provided by cuda/tools/cudart/driver_types.h, typically named with prefix "cuda", e.g., \c cudaError_t.
734
+ *
735
+ */
736
+
737
+ #ifdef __cplusplus
738
+ }
739
+ #endif /* __cplusplus */
740
+
741
+
742
+ /* The utility function 'nvrtcGetTypeName' is not available by default. Define
743
+ the macro 'NVRTC_GET_TYPE_NAME' to a non-zero value to make it available.
744
+ */
745
+
746
+ #if NVRTC_GET_TYPE_NAME || __DOXYGEN_ONLY__
747
+
748
+ #if NVRTC_USE_CXXABI || __clang__ || __GNUC__ || __DOXYGEN_ONLY__
749
+ #include <cxxabi.h>
750
+ #include <cstdlib>
751
+
752
+ #elif defined(_WIN32)
753
+ #include <Windows.h>
754
+ #include <DbgHelp.h>
755
+ #endif /* NVRTC_USE_CXXABI || __clang__ || __GNUC__ */
756
+
757
+
758
+ #include <string>
759
+ #include <typeinfo>
760
+
761
+ template <typename T> struct __nvrtcGetTypeName_helper_t { };
762
+
763
+ /*************************************************************************//**
764
+ *
765
+ * \defgroup hosthelper Host Helper
766
+ *
767
+ * NVRTC defines the following functions for easier interaction with host code.
768
+ *
769
+ ****************************************************************************/
770
+
771
+ /**
772
+ * \ingroup hosthelper
773
+ * \brief nvrtcGetTypeName stores the source level name of a type in the given
774
+ * std::string location.
775
+ *
776
+ * This function is only provided when the macro NVRTC_GET_TYPE_NAME is
777
+ * defined with a non-zero value. It uses abi::__cxa_demangle or UnDecorateSymbolName
778
+ * function calls to extract the type name, when using gcc/clang or cl.exe compilers,
779
+ * respectively. If the name extraction fails, it will return NVRTC_INTERNAL_ERROR,
780
+ * otherwise *result is initialized with the extracted name.
781
+ *
782
+ * Windows-specific notes:
783
+ * - nvrtcGetTypeName() is not multi-thread safe because it calls UnDecorateSymbolName(),
784
+ * which is not multi-thread safe.
785
+ * - The returned string may contain Microsoft-specific keywords such as __ptr64 and __cdecl.
786
+ *
787
+ * \param [in] tinfo: reference to object of type std::type_info for a given type.
788
+ * \param [in] result: pointer to std::string in which to store the type name.
789
+ * \return
790
+ * - \link #nvrtcResult NVRTC_SUCCESS \endlink
791
+ * - \link #nvrtcResult NVRTC_ERROR_INTERNAL_ERROR \endlink
792
+ *
793
+ */
794
+ inline nvrtcResult nvrtcGetTypeName(const std::type_info &tinfo, std::string *result)
795
+ {
796
+ #if USE_CXXABI || __clang__ || __GNUC__
797
+ const char *name = tinfo.name();
798
+ int status;
799
+ char *undecorated_name = abi::__cxa_demangle(name, 0, 0, &status);
800
+ if (status == 0) {
801
+ *result = undecorated_name;
802
+ free(undecorated_name);
803
+ return NVRTC_SUCCESS;
804
+ }
805
+ #elif defined(_WIN32)
806
+ const char *name = tinfo.raw_name();
807
+ if (!name || *name != '.') {
808
+ return NVRTC_ERROR_INTERNAL_ERROR;
809
+ }
810
+ char undecorated_name[4096];
811
+ //name+1 skips over the '.' prefix
812
+ if(UnDecorateSymbolName(name+1, undecorated_name,
813
+ sizeof(undecorated_name) / sizeof(*undecorated_name),
814
+ //note: doesn't seem to work correctly without UNDNAME_NO_ARGUMENTS.
815
+ UNDNAME_NO_ARGUMENTS | UNDNAME_NAME_ONLY ) ) {
816
+ *result = undecorated_name;
817
+ return NVRTC_SUCCESS;
818
+ }
819
+ #endif /* USE_CXXABI || __clang__ || __GNUC__ */
820
+
821
+ return NVRTC_ERROR_INTERNAL_ERROR;
822
+ }
823
+
824
+ /**
825
+ * \ingroup hosthelper
826
+ * \brief nvrtcGetTypeName stores the source level name of the template type argument
827
+ * T in the given std::string location.
828
+ *
829
+ * This function is only provided when the macro NVRTC_GET_TYPE_NAME is
830
+ * defined with a non-zero value. It uses abi::__cxa_demangle or UnDecorateSymbolName
831
+ * function calls to extract the type name, when using gcc/clang or cl.exe compilers,
832
+ * respectively. If the name extraction fails, it will return NVRTC_INTERNAL_ERROR,
833
+ * otherwise *result is initialized with the extracted name.
834
+ *
835
+ * Windows-specific notes:
836
+ * - nvrtcGetTypeName() is not multi-thread safe because it calls UnDecorateSymbolName(),
837
+ * which is not multi-thread safe.
838
+ * - The returned string may contain Microsoft-specific keywords such as __ptr64 and __cdecl.
839
+ *
840
+ * \param [in] result: pointer to std::string in which to store the type name.
841
+ * \return
842
+ * - \link #nvrtcResult NVRTC_SUCCESS \endlink
843
+ * - \link #nvrtcResult NVRTC_ERROR_INTERNAL_ERROR \endlink
844
+ *
845
+ */
846
+
847
+ template <typename T>
848
+ nvrtcResult nvrtcGetTypeName(std::string *result)
849
+ {
850
+ nvrtcResult res = nvrtcGetTypeName(typeid(__nvrtcGetTypeName_helper_t<T>),
851
+ result);
852
+ if (res != NVRTC_SUCCESS)
853
+ return res;
854
+
855
+ std::string repr = *result;
856
+ std::size_t idx = repr.find("__nvrtcGetTypeName_helper_t");
857
+ idx = (idx != std::string::npos) ? repr.find("<", idx) : idx;
858
+ std::size_t last_idx = repr.find_last_of('>');
859
+ if (idx == std::string::npos || last_idx == std::string::npos) {
860
+ return NVRTC_ERROR_INTERNAL_ERROR;
861
+ }
862
+ ++idx;
863
+ *result = repr.substr(idx, last_idx - idx);
864
+ return NVRTC_SUCCESS;
865
+ }
866
+
867
+ #endif /* NVRTC_GET_TYPE_NAME */
868
+
869
+ #endif /* __NVRTC_H__ */
lib/python3.12/site-packages/nvidia/cuda_nvrtc/lib/__init__.py ADDED
File without changes
lib/python3.12/site-packages/nvidia/cuda_nvrtc/lib/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (200 Bytes). View file
 
lib/python3.12/site-packages/nvidia/cudnn/__init__.py ADDED
File without changes
lib/python3.12/site-packages/nvidia/cudnn/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (191 Bytes). View file
 
lib/python3.12/site-packages/nvidia/cudnn/include/__init__.py ADDED
File without changes
lib/python3.12/site-packages/nvidia/cudnn/include/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (199 Bytes). View file
 
lib/python3.12/site-packages/nvidia/cudnn/include/cudnn.h ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright 2014-2023 NVIDIA Corporation. All rights reserved.
3
+ *
4
+ * NOTICE TO LICENSEE:
5
+ *
6
+ * This source code and/or documentation ("Licensed Deliverables") are
7
+ * subject to NVIDIA intellectual property rights under U.S. and
8
+ * international Copyright laws.
9
+ *
10
+ * These Licensed Deliverables contained herein is PROPRIETARY and
11
+ * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12
+ * conditions of a form of NVIDIA software license agreement by and
13
+ * between NVIDIA and Licensee ("License Agreement") or electronically
14
+ * accepted by Licensee. Notwithstanding any terms or conditions to
15
+ * the contrary in the License Agreement, reproduction or disclosure
16
+ * of the Licensed Deliverables to any third party without the express
17
+ * written consent of NVIDIA is prohibited.
18
+ *
19
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20
+ * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21
+ * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
22
+ * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23
+ * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24
+ * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25
+ * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27
+ * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28
+ * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32
+ * OF THESE LICENSED DELIVERABLES.
33
+ *
34
+ * U.S. Government End Users. These Licensed Deliverables are a
35
+ * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36
+ * 1995), consisting of "commercial computer software" and "commercial
37
+ * computer software documentation" as such terms are used in 48
38
+ * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39
+ * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40
+ * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41
+ * U.S. Government End Users acquire the Licensed Deliverables with
42
+ * only those rights set forth herein.
43
+ *
44
+ * Any use of the Licensed Deliverables in individual and commercial
45
+ * software must include, in the user documentation and internal
46
+ * comments to the code, the above Disclaimer and U.S. Government End
47
+ * Users Notice.
48
+ */
49
+
50
+ /* cudnn : Neural Networks Library */
51
+
52
+ #if !defined(CUDNN_H_)
53
+ #define CUDNN_H_
54
+ #if defined(__cplusplus)
55
+ extern "C" {
56
+ #endif
57
+
58
+ #include <cuda_runtime_api.h>
59
+ #include "cudnn_version.h"
60
+ #include "cudnn_graph.h"
61
+ #include "cudnn_ops.h"
62
+ #include "cudnn_adv.h"
63
+ #include "cudnn_cnn.h"
64
+
65
+ #if defined(__cplusplus)
66
+ }
67
+ #endif
68
+ #endif /* CUDNN_H_ */
lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_adv.h ADDED
@@ -0,0 +1,671 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright 2014-2023 NVIDIA Corporation. All rights reserved.
3
+ *
4
+ * NOTICE TO LICENSEE:
5
+ *
6
+ * This source code and/or documentation ("Licensed Deliverables") are
7
+ * subject to NVIDIA intellectual property rights under U.S. and
8
+ * international Copyright laws.
9
+ *
10
+ * These Licensed Deliverables contained herein is PROPRIETARY and
11
+ * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12
+ * conditions of a form of NVIDIA software license agreement by and
13
+ * between NVIDIA and Licensee ("License Agreement") or electronically
14
+ * accepted by Licensee. Notwithstanding any terms or conditions to
15
+ * the contrary in the License Agreement, reproduction or disclosure
16
+ * of the Licensed Deliverables to any third party without the express
17
+ * written consent of NVIDIA is prohibited.
18
+ *
19
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20
+ * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21
+ * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
22
+ * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23
+ * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24
+ * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25
+ * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27
+ * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28
+ * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32
+ * OF THESE LICENSED DELIVERABLES.
33
+ *
34
+ * U.S. Government End Users. These Licensed Deliverables are a
35
+ * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36
+ * 1995), consisting of "commercial computer software" and "commercial
37
+ * computer software documentation" as such terms are used in 48
38
+ * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39
+ * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40
+ * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41
+ * U.S. Government End Users acquire the Licensed Deliverables with
42
+ * only those rights set forth herein.
43
+ *
44
+ * Any use of the Licensed Deliverables in individual and commercial
45
+ * software must include, in the user documentation and internal
46
+ * comments to the code, the above Disclaimer and U.S. Government End
47
+ * Users Notice.
48
+ */
49
+
50
+ /* cudnn_adv : cuDNN's advanced and experimental features.
51
+
52
+ */
53
+
54
+ #if !defined(CUDNN_ADV_H_)
55
+ #define CUDNN_ADV_H_
56
+
57
+ #include <stdint.h>
58
+
59
+ #include "cudnn_version.h"
60
+ #include "cudnn_ops.h"
61
+
62
+ /* These version numbers are autogenerated, do not edit manually. */
63
+ #define CUDNN_ADV_MAJOR 9
64
+ #define CUDNN_ADV_MINOR 1
65
+ #define CUDNN_ADV_PATCH 0
66
+
67
+ #if (CUDNN_ADV_MAJOR != CUDNN_MAJOR) || (CUDNN_ADV_MINOR != CUDNN_MINOR) || (CUDNN_ADV_PATCH != CUDNN_PATCHLEVEL)
68
+ #error Version mismatch in cuDNN ADV INFER!!!
69
+ #endif
70
+
71
+ #if defined(__cplusplus)
72
+ extern "C" {
73
+ #endif
74
+
75
+ /* BASIC RNN API */
76
+
77
+ typedef enum {
78
+ CUDNN_RNN_ALGO_STANDARD = 0,
79
+ CUDNN_RNN_ALGO_PERSIST_STATIC = 1,
80
+ CUDNN_RNN_ALGO_PERSIST_DYNAMIC = 2,
81
+ CUDNN_RNN_ALGO_PERSIST_STATIC_SMALL_H = 3,
82
+ CUDNN_RNN_ALGO_COUNT = 4,
83
+ } cudnnRNNAlgo_t;
84
+
85
+ typedef enum {
86
+ CUDNN_FWD_MODE_INFERENCE = 0,
87
+ CUDNN_FWD_MODE_TRAINING = 1,
88
+ } cudnnForwardMode_t;
89
+
90
+ typedef enum {
91
+ CUDNN_RNN_RELU = 0, /* basic RNN cell type with ReLu activation */
92
+ CUDNN_RNN_TANH = 1, /* basic RNN cell type with tanh activation */
93
+ CUDNN_LSTM = 2, /* LSTM with optional recurrent projection and clipping */
94
+ CUDNN_GRU = 3, /* Using h' = tanh(r * Uh(t-1) + Wx) and h = (1 - z) * h' + z * h(t-1); */
95
+ } cudnnRNNMode_t;
96
+
97
+ typedef enum {
98
+ CUDNN_RNN_NO_BIAS = 0, /* rnn cell formulas do not use biases */
99
+ CUDNN_RNN_SINGLE_INP_BIAS = 1, /* rnn cell formulas use one input bias in input GEMM */
100
+ CUDNN_RNN_DOUBLE_BIAS = 2, /* default, rnn cell formulas use two bias vectors */
101
+ CUDNN_RNN_SINGLE_REC_BIAS = 3 /* rnn cell formulas use one recurrent bias in recurrent GEMM */
102
+ } cudnnRNNBiasMode_t;
103
+
104
+ typedef enum {
105
+ CUDNN_UNIDIRECTIONAL = 0, /* single direction network */
106
+ CUDNN_BIDIRECTIONAL = 1, /* output concatination at each layer */
107
+ } cudnnDirectionMode_t;
108
+
109
+ typedef enum {
110
+ CUDNN_LINEAR_INPUT = 0, /* adjustable weight matrix in first layer input GEMM */
111
+ CUDNN_SKIP_INPUT = 1, /* fixed identity matrix in the first layer input GEMM */
112
+ } cudnnRNNInputMode_t;
113
+
114
+ typedef enum {
115
+ CUDNN_RNN_CLIP_NONE = 0, /* disables LSTM cell clipping */
116
+ CUDNN_RNN_CLIP_MINMAX = 1, /* enables LSTM cell clipping */
117
+ } cudnnRNNClipMode_t;
118
+
119
+ typedef enum {
120
+ CUDNN_RNN_DATA_LAYOUT_SEQ_MAJOR_UNPACKED = 0, /* padded, outer stride from one time-step to the next */
121
+ CUDNN_RNN_DATA_LAYOUT_SEQ_MAJOR_PACKED = 1, /* sequence length sorted and packed as in basic RNN api */
122
+ CUDNN_RNN_DATA_LAYOUT_BATCH_MAJOR_UNPACKED = 2, /* padded, outer stride from one batch to the next */
123
+ } cudnnRNNDataLayout_t;
124
+
125
+ /* For auxFlags in cudnnSetRNNDescriptor_v8() */
126
+ #define CUDNN_RNN_PADDED_IO_DISABLED 0
127
+ #define CUDNN_RNN_PADDED_IO_ENABLED (1U << 0)
128
+
129
+ struct cudnnRNNStruct;
130
+ typedef struct cudnnRNNStruct *cudnnRNNDescriptor_t;
131
+
132
+ struct cudnnRNNDataStruct;
133
+ typedef struct cudnnRNNDataStruct *cudnnRNNDataDescriptor_t;
134
+
135
+ cudnnStatus_t CUDNNWINAPI
136
+ cudnnCreateRNNDescriptor(cudnnRNNDescriptor_t *rnnDesc);
137
+
138
+ cudnnStatus_t CUDNNWINAPI
139
+ cudnnDestroyRNNDescriptor(cudnnRNNDescriptor_t rnnDesc);
140
+
141
+ /*
142
+ * mathPrec in cudnnSetRNNDescriptor_v8() specifies compute precision.
143
+ * Compute precision is further modified by mathType that sets the
144
+ * preferred option for using NVIDIA Tensor Cores. dataType specify
145
+ * input/output data type and weight/bias type.
146
+ */
147
+
148
+ cudnnStatus_t CUDNNWINAPI
149
+ cudnnSetRNNDescriptor_v8(cudnnRNNDescriptor_t rnnDesc,
150
+ cudnnRNNAlgo_t algo,
151
+ cudnnRNNMode_t cellMode,
152
+ cudnnRNNBiasMode_t biasMode,
153
+ cudnnDirectionMode_t dirMode,
154
+ cudnnRNNInputMode_t inputMode,
155
+ cudnnDataType_t dataType,
156
+ cudnnDataType_t mathPrec,
157
+ cudnnMathType_t mathType,
158
+ int32_t inputSize,
159
+ int32_t hiddenSize,
160
+ int32_t projSize,
161
+ int32_t numLayers,
162
+ cudnnDropoutDescriptor_t dropoutDesc,
163
+ uint32_t auxFlags);
164
+
165
+ cudnnStatus_t CUDNNWINAPI
166
+ cudnnGetRNNDescriptor_v8(cudnnRNNDescriptor_t rnnDesc,
167
+ cudnnRNNAlgo_t *algo,
168
+ cudnnRNNMode_t *cellMode,
169
+ cudnnRNNBiasMode_t *biasMode,
170
+ cudnnDirectionMode_t *dirMode,
171
+ cudnnRNNInputMode_t *inputMode,
172
+ cudnnDataType_t *dataType,
173
+ cudnnDataType_t *mathPrec,
174
+ cudnnMathType_t *mathType,
175
+ int32_t *inputSize,
176
+ int32_t *hiddenSize,
177
+ int32_t *projSize,
178
+ int32_t *numLayers,
179
+ cudnnDropoutDescriptor_t *dropoutDesc,
180
+ uint32_t *auxFlags);
181
+
182
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
183
+ cudnnRNNSetClip_v8(cudnnRNNDescriptor_t rnnDesc,
184
+ cudnnRNNClipMode_t clipMode,
185
+ cudnnNanPropagation_t clipNanOpt,
186
+ double lclip,
187
+ double rclip);
188
+
189
+ cudnnStatus_t CUDNNWINAPI
190
+ cudnnRNNSetClip_v9(cudnnRNNDescriptor_t rnnDesc, cudnnRNNClipMode_t clipMode, double lclip, double rclip);
191
+
192
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
193
+ cudnnRNNGetClip_v8(cudnnRNNDescriptor_t rnnDesc,
194
+ cudnnRNNClipMode_t *clipMode,
195
+ cudnnNanPropagation_t *clipNanOpt,
196
+ double *lclip,
197
+ double *rclip);
198
+
199
+ cudnnStatus_t CUDNNWINAPI
200
+ cudnnRNNGetClip_v9(cudnnRNNDescriptor_t rnnDesc, cudnnRNNClipMode_t *clipMode, double *lclip, double *rclip);
201
+
202
+ cudnnStatus_t CUDNNWINAPI
203
+ cudnnBuildRNNDynamic(cudnnHandle_t handle, cudnnRNNDescriptor_t rnnDesc, int miniBatch);
204
+
205
+ cudnnStatus_t CUDNNWINAPI
206
+ cudnnGetRNNTempSpaceSizes(cudnnHandle_t handle,
207
+ cudnnRNNDescriptor_t rnnDesc,
208
+ cudnnForwardMode_t fwdMode,
209
+ cudnnRNNDataDescriptor_t xDesc,
210
+ size_t *workSpaceSize,
211
+ size_t *reserveSpaceSize);
212
+
213
+ cudnnStatus_t CUDNNWINAPI
214
+ cudnnGetRNNWeightSpaceSize(cudnnHandle_t handle, cudnnRNNDescriptor_t rnnDesc, size_t *weightSpaceSize);
215
+
216
+ cudnnStatus_t CUDNNWINAPI
217
+ cudnnGetRNNWeightParams(cudnnHandle_t handle,
218
+ cudnnRNNDescriptor_t rnnDesc,
219
+ int32_t pseudoLayer,
220
+ size_t weightSpaceSize,
221
+ const void *weightSpace,
222
+ int32_t linLayerID,
223
+ cudnnTensorDescriptor_t mDesc,
224
+ void **mAddr,
225
+ cudnnTensorDescriptor_t bDesc,
226
+ void **bAddr);
227
+
228
+ cudnnStatus_t CUDNNWINAPI
229
+ cudnnCreateRNNDataDescriptor(cudnnRNNDataDescriptor_t *rnnDataDesc);
230
+
231
+ cudnnStatus_t CUDNNWINAPI
232
+ cudnnDestroyRNNDataDescriptor(cudnnRNNDataDescriptor_t rnnDataDesc);
233
+
234
+ cudnnStatus_t CUDNNWINAPI
235
+ cudnnSetRNNDataDescriptor(cudnnRNNDataDescriptor_t rnnDataDesc,
236
+ cudnnDataType_t dataType,
237
+ cudnnRNNDataLayout_t layout,
238
+ int maxSeqLength,
239
+ int batchSize,
240
+ int vectorSize,
241
+ const int seqLengthArray[], /* length of each sequence in the batch */
242
+ void *paddingFill); /* symbol for filling padding position in output */
243
+
244
+ cudnnStatus_t CUDNNWINAPI
245
+ cudnnGetRNNDataDescriptor(cudnnRNNDataDescriptor_t rnnDataDesc,
246
+ cudnnDataType_t *dataType,
247
+ cudnnRNNDataLayout_t *layout,
248
+ int *maxSeqLength,
249
+ int *batchSize,
250
+ int *vectorSize,
251
+ int arrayLengthRequested,
252
+ int seqLengthArray[],
253
+ void *paddingFill);
254
+
255
+ cudnnStatus_t CUDNNWINAPI
256
+ cudnnRNNForward(cudnnHandle_t handle,
257
+ cudnnRNNDescriptor_t rnnDesc,
258
+ cudnnForwardMode_t fwdMode,
259
+ const int32_t devSeqLengths[],
260
+ cudnnRNNDataDescriptor_t xDesc,
261
+ const void *x,
262
+ cudnnRNNDataDescriptor_t yDesc,
263
+ void *y,
264
+ cudnnTensorDescriptor_t hDesc,
265
+ const void *hx,
266
+ void *hy,
267
+ cudnnTensorDescriptor_t cDesc,
268
+ const void *cx,
269
+ void *cy,
270
+ size_t weightSpaceSize,
271
+ const void *weightSpace,
272
+ size_t workSpaceSize,
273
+ void *workSpace,
274
+ size_t reserveSpaceSize,
275
+ void *reserveSpace);
276
+
277
+ /* Sequence data descriptor */
278
+
279
+ typedef enum {
280
+ CUDNN_SEQDATA_TIME_DIM = 0, /* index in time */
281
+ CUDNN_SEQDATA_BATCH_DIM = 1, /* index in batch */
282
+ CUDNN_SEQDATA_BEAM_DIM = 2, /* index in beam */
283
+ CUDNN_SEQDATA_VECT_DIM = 3 /* index in vector */
284
+ } cudnnSeqDataAxis_t;
285
+
286
+ struct cudnnSeqDataStruct;
287
+ typedef struct cudnnSeqDataStruct *cudnnSeqDataDescriptor_t CUDNN_DEPRECATED;
288
+
289
+ #define CUDNN_SEQDATA_DIM_COUNT 4 /* dimension count */
290
+
291
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
292
+ cudnnCreateSeqDataDescriptor(cudnnSeqDataDescriptor_t *seqDataDesc);
293
+
294
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
295
+ cudnnDestroySeqDataDescriptor(cudnnSeqDataDescriptor_t seqDataDesc);
296
+
297
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
298
+ cudnnSetSeqDataDescriptor(cudnnSeqDataDescriptor_t seqDataDesc,
299
+ cudnnDataType_t dataType,
300
+ int nbDims,
301
+ const int dimA[],
302
+ const cudnnSeqDataAxis_t axes[],
303
+ size_t seqLengthArraySize,
304
+ const int seqLengthArray[],
305
+ void *paddingFill);
306
+
307
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
308
+ cudnnGetSeqDataDescriptor(const cudnnSeqDataDescriptor_t seqDataDesc,
309
+ cudnnDataType_t *dataType,
310
+ int *nbDims,
311
+ int nbDimsRequested,
312
+ int dimA[],
313
+ cudnnSeqDataAxis_t axes[],
314
+ size_t *seqLengthArraySize,
315
+ size_t seqLengthSizeRequested,
316
+ int seqLengthArray[],
317
+ void *paddingFill);
318
+
319
+ /* Multihead Attention */
320
+
321
+ /*
322
+ * Multi-head attention options passed via 'attnMode' in cudnnSetAttnDescriptor().
323
+ * Use the bitwise OR operator to combine several settings listed below. Additional
324
+ * minor options can be added here w/o changing or introducing new API functions.
325
+ */
326
+ #define CUDNN_ATTN_QUERYMAP_ALL_TO_ONE 0 /* multiple Q-s map to a single (K,V) set when beam size > 1 */
327
+ #define CUDNN_ATTN_QUERYMAP_ONE_TO_ONE (1U << 0) /* multiple Q-s map to multiple (K,V) sets when beam size > 1 */
328
+ #define CUDNN_ATTN_DISABLE_PROJ_BIASES 0 /* no biases in attention input and output projections */
329
+ #define CUDNN_ATTN_ENABLE_PROJ_BIASES (1U << 1) /* use biases in attention input and output projections */
330
+
331
+ struct cudnnAttnStruct;
332
+ typedef struct cudnnAttnStruct *cudnnAttnDescriptor_t CUDNN_DEPRECATED;
333
+
334
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
335
+ cudnnCreateAttnDescriptor(cudnnAttnDescriptor_t *attnDesc);
336
+
337
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
338
+ cudnnDestroyAttnDescriptor(cudnnAttnDescriptor_t attnDesc);
339
+
340
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
341
+ cudnnSetAttnDescriptor(cudnnAttnDescriptor_t attnDesc,
342
+ unsigned attnMode,
343
+ int nHeads,
344
+ double smScaler,
345
+ cudnnDataType_t dataType,
346
+ cudnnDataType_t computePrec,
347
+ cudnnMathType_t mathType,
348
+ cudnnDropoutDescriptor_t attnDropoutDesc,
349
+ cudnnDropoutDescriptor_t postDropoutDesc,
350
+ int qSize,
351
+ int kSize,
352
+ int vSize,
353
+ int qProjSize,
354
+ int kProjSize,
355
+ int vProjSize,
356
+ int oProjSize,
357
+ int qoMaxSeqLength,
358
+ int kvMaxSeqLength,
359
+ int maxBatchSize,
360
+ int maxBeamSize);
361
+
362
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
363
+ cudnnGetAttnDescriptor(cudnnAttnDescriptor_t attnDesc,
364
+ unsigned *attnMode,
365
+ int *nHeads,
366
+ double *smScaler,
367
+ cudnnDataType_t *dataType,
368
+ cudnnDataType_t *computePrec,
369
+ cudnnMathType_t *mathType,
370
+ cudnnDropoutDescriptor_t *attnDropoutDesc,
371
+ cudnnDropoutDescriptor_t *postDropoutDesc,
372
+ int *qSize,
373
+ int *kSize,
374
+ int *vSize,
375
+ int *qProjSize,
376
+ int *kProjSize,
377
+ int *vProjSize,
378
+ int *oProjSize,
379
+ int *qoMaxSeqLength,
380
+ int *kvMaxSeqLength,
381
+ int *maxBatchSize,
382
+ int *maxBeamSize);
383
+
384
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
385
+ cudnnGetMultiHeadAttnBuffers(cudnnHandle_t handle,
386
+ const cudnnAttnDescriptor_t attnDesc,
387
+ size_t *weightSizeInBytes,
388
+ size_t *workSpaceSizeInBytes,
389
+ size_t *reserveSpaceSizeInBytes);
390
+
391
+ typedef enum {
392
+ CUDNN_MH_ATTN_Q_WEIGHTS = 0, /* input projection weights for 'queries' */
393
+ CUDNN_MH_ATTN_K_WEIGHTS = 1, /* input projection weights for 'keys' */
394
+ CUDNN_MH_ATTN_V_WEIGHTS = 2, /* input projection weights for 'values' */
395
+ CUDNN_MH_ATTN_O_WEIGHTS = 3, /* output projection weights */
396
+ CUDNN_MH_ATTN_Q_BIASES = 4, /* input projection bias tensor for 'queries' */
397
+ CUDNN_MH_ATTN_K_BIASES = 5, /* input projection bias for 'keys' */
398
+ CUDNN_MH_ATTN_V_BIASES = 6, /* input projection bias for 'values' */
399
+ CUDNN_MH_ATTN_O_BIASES = 7, /* output projection biases */
400
+ } cudnnMultiHeadAttnWeightKind_t;
401
+
402
+ #define CUDNN_ATTN_WKIND_COUNT 8 /* Number of attention weight/bias tensors */
403
+
404
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
405
+ cudnnGetMultiHeadAttnWeights(cudnnHandle_t handle,
406
+ const cudnnAttnDescriptor_t attnDesc,
407
+ cudnnMultiHeadAttnWeightKind_t wKind,
408
+ size_t weightSizeInBytes,
409
+ const void *weights,
410
+ cudnnTensorDescriptor_t wDesc,
411
+ void **wAddr);
412
+
413
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
414
+ cudnnMultiHeadAttnForward(cudnnHandle_t handle,
415
+ const cudnnAttnDescriptor_t attnDesc,
416
+ int currIdx,
417
+ const int loWinIdx[],
418
+ const int hiWinIdx[],
419
+ const int devSeqLengthsQO[],
420
+ const int devSeqLengthsKV[],
421
+ const cudnnSeqDataDescriptor_t qDesc,
422
+ const void *queries,
423
+ const void *residuals,
424
+ const cudnnSeqDataDescriptor_t kDesc,
425
+ const void *keys,
426
+ const cudnnSeqDataDescriptor_t vDesc,
427
+ const void *values,
428
+ const cudnnSeqDataDescriptor_t oDesc,
429
+ void *out,
430
+ size_t weightSizeInBytes,
431
+ const void *weights,
432
+ size_t workSpaceSizeInBytes,
433
+ void *workSpace,
434
+ size_t reserveSpaceSizeInBytes,
435
+ void *reserveSpace);
436
+
437
+ /*
438
+ * \brief Cross-library version checker.
439
+ * This function is implemented differently in each sub-library. Each sublib
440
+ * checks whether its own version matches that of its dependencies.
441
+ * \returns CUDNN_STATUS_SUCCESS if the version check passes,
442
+ * CUDNN_STATUS_SUBLIBRARY_VERSION_MISMATCH if the versions are inconsistent.
443
+ */
444
+ cudnnStatus_t CUDNNWINAPI
445
+ cudnnAdvVersionCheck(void);
446
+
447
+ typedef enum {
448
+ CUDNN_WGRAD_MODE_ADD = 0, /* add partial gradients to wgrad output buffers */
449
+ CUDNN_WGRAD_MODE_SET = 1, /* write partial gradients to wgrad output buffers */
450
+ } cudnnWgradMode_t;
451
+
452
+ cudnnStatus_t CUDNNWINAPI
453
+ cudnnRNNBackwardData_v8(cudnnHandle_t handle,
454
+ cudnnRNNDescriptor_t rnnDesc,
455
+ const int32_t devSeqLengths[],
456
+ cudnnRNNDataDescriptor_t yDesc,
457
+ const void *y,
458
+ const void *dy,
459
+ cudnnRNNDataDescriptor_t xDesc,
460
+ void *dx,
461
+ cudnnTensorDescriptor_t hDesc,
462
+ const void *hx,
463
+ const void *dhy,
464
+ void *dhx,
465
+ cudnnTensorDescriptor_t cDesc,
466
+ const void *cx,
467
+ const void *dcy,
468
+ void *dcx,
469
+ size_t weightSpaceSize,
470
+ const void *weightSpace,
471
+ size_t workSpaceSize,
472
+ void *workSpace,
473
+ size_t reserveSpaceSize,
474
+ void *reserveSpace);
475
+
476
+ cudnnStatus_t CUDNNWINAPI
477
+ cudnnRNNBackwardWeights_v8(cudnnHandle_t handle,
478
+ cudnnRNNDescriptor_t rnnDesc,
479
+ cudnnWgradMode_t addGrad,
480
+ const int32_t devSeqLengths[],
481
+ cudnnRNNDataDescriptor_t xDesc,
482
+ const void *x,
483
+ cudnnTensorDescriptor_t hDesc,
484
+ const void *hx,
485
+ cudnnRNNDataDescriptor_t yDesc,
486
+ const void *y,
487
+ size_t weightSpaceSize,
488
+ void *dweightSpace,
489
+ size_t workSpaceSize,
490
+ void *workSpace,
491
+ size_t reserveSpaceSize,
492
+ void *reserveSpace);
493
+
494
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
495
+ cudnnMultiHeadAttnBackwardData(cudnnHandle_t handle,
496
+ const cudnnAttnDescriptor_t attnDesc,
497
+ const int loWinIdx[],
498
+ const int hiWinIdx[],
499
+ const int devSeqLengthsDQDO[],
500
+ const int devSeqLengthsDKDV[],
501
+ const cudnnSeqDataDescriptor_t doDesc,
502
+ const void *dout,
503
+ const cudnnSeqDataDescriptor_t dqDesc,
504
+ void *dqueries,
505
+ const void *queries,
506
+ const cudnnSeqDataDescriptor_t dkDesc,
507
+ void *dkeys,
508
+ const void *keys,
509
+ const cudnnSeqDataDescriptor_t dvDesc,
510
+ void *dvalues,
511
+ const void *values,
512
+ size_t weightSizeInBytes,
513
+ const void *weights,
514
+ size_t workSpaceSizeInBytes,
515
+ void *workSpace,
516
+ size_t reserveSpaceSizeInBytes,
517
+ void *reserveSpace);
518
+
519
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
520
+ cudnnMultiHeadAttnBackwardWeights(cudnnHandle_t handle,
521
+ const cudnnAttnDescriptor_t attnDesc,
522
+ cudnnWgradMode_t addGrad,
523
+ const cudnnSeqDataDescriptor_t qDesc,
524
+ const void *queries,
525
+ const cudnnSeqDataDescriptor_t kDesc,
526
+ const void *keys,
527
+ const cudnnSeqDataDescriptor_t vDesc,
528
+ const void *values,
529
+ const cudnnSeqDataDescriptor_t doDesc,
530
+ const void *dout,
531
+ size_t weightSizeInBytes,
532
+ const void *weights,
533
+ void *dweights,
534
+ size_t workSpaceSizeInBytes,
535
+ void *workSpace,
536
+ size_t reserveSpaceSizeInBytes,
537
+ void *reserveSpace);
538
+
539
+ /*
540
+ * CTC (Connectionist Temporal Classification) loss descriptor create/destory/set/get functions
541
+ */
542
+ /* Input normalization mode for loss function */
543
+ typedef enum {
544
+ CUDNN_LOSS_NORMALIZATION_NONE = 0,
545
+ CUDNN_LOSS_NORMALIZATION_SOFTMAX = 1,
546
+ } cudnnLossNormalizationMode_t;
547
+
548
+ cudnnStatus_t CUDNNWINAPI
549
+ cudnnCreateCTCLossDescriptor(cudnnCTCLossDescriptor_t *ctcLossDesc);
550
+
551
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
552
+ cudnnSetCTCLossDescriptor(cudnnCTCLossDescriptor_t ctcLossDesc, cudnnDataType_t compType);
553
+
554
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
555
+ cudnnSetCTCLossDescriptorEx(cudnnCTCLossDescriptor_t ctcLossDesc,
556
+ cudnnDataType_t compType,
557
+ cudnnLossNormalizationMode_t normMode,
558
+ cudnnNanPropagation_t gradMode);
559
+
560
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
561
+ cudnnSetCTCLossDescriptor_v8(cudnnCTCLossDescriptor_t ctcLossDesc,
562
+ cudnnDataType_t compType,
563
+ cudnnLossNormalizationMode_t normMode,
564
+ cudnnNanPropagation_t gradMode,
565
+ int maxLabelLength);
566
+
567
+ cudnnStatus_t CUDNNWINAPI
568
+ cudnnSetCTCLossDescriptor_v9(cudnnCTCLossDescriptor_t ctcLossDesc,
569
+ cudnnDataType_t compType,
570
+ cudnnLossNormalizationMode_t normMode,
571
+ cudnnCTCGradMode_t ctcGradMode,
572
+ int maxLabelLength);
573
+
574
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
575
+ cudnnGetCTCLossDescriptor(cudnnCTCLossDescriptor_t ctcLossDesc, cudnnDataType_t *compType);
576
+
577
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
578
+ cudnnGetCTCLossDescriptorEx(cudnnCTCLossDescriptor_t ctcLossDesc,
579
+ cudnnDataType_t *compType,
580
+ cudnnLossNormalizationMode_t *normMode,
581
+ cudnnNanPropagation_t *gradMode);
582
+
583
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
584
+ cudnnGetCTCLossDescriptor_v8(cudnnCTCLossDescriptor_t ctcLossDesc,
585
+ cudnnDataType_t *compType,
586
+ cudnnLossNormalizationMode_t *normMode,
587
+ cudnnNanPropagation_t *gradMode,
588
+ int *maxLabelLength);
589
+
590
+ cudnnStatus_t CUDNNWINAPI
591
+ cudnnGetCTCLossDescriptor_v9(cudnnCTCLossDescriptor_t ctcLossDesc,
592
+ cudnnDataType_t *compType,
593
+ cudnnLossNormalizationMode_t *normMode,
594
+ cudnnCTCGradMode_t *ctcGradMode,
595
+ int *maxLabelLength);
596
+
597
+ cudnnStatus_t CUDNNWINAPI
598
+ cudnnDestroyCTCLossDescriptor(cudnnCTCLossDescriptor_t ctcLossDesc);
599
+
600
+ /* return the ctc costs and gradients, given the probabilities and labels */
601
+ cudnnStatus_t CUDNNWINAPI
602
+ cudnnCTCLoss(
603
+ cudnnHandle_t handle,
604
+ const cudnnTensorDescriptor_t
605
+ probsDesc, /* Tensor descriptor for probabilities, the dimensions are T,N,A (T is the timing steps, N is the
606
+ mini batch size, A is the alphabet size) */
607
+ const void *probs, /* probabilities after softmax, in GPU memory */
608
+ const int hostLabels[], /* labels, in CPU memory */
609
+ const int hostLabelLengths[], /* the length of each label, in CPU memory */
610
+ const int hostInputLengths[], /* the lengths of timing steps in each batch, in CPU memory */
611
+ void *costs, /* the returned costs of CTC, in GPU memory */
612
+ const cudnnTensorDescriptor_t gradientsDesc, /* Tensor descriptor for gradients, the dimensions are T,N,A */
613
+ void *gradients, /* the returned CTC gradients, in GPU memory, to compute costs only, set it to NULL */
614
+ cudnnCTCLossAlgo_t algo, /* algorithm selected, supported now 0 and 1 */
615
+ cudnnCTCLossDescriptor_t ctcLossDesc,
616
+ void *workspace, /* pointer to the workspace, in GPU memory */
617
+ size_t workSpaceSizeInBytes); /* size of the workspace */
618
+
619
+ /* return the ctc costs and gradients, given the probabilities and labels */
620
+ cudnnStatus_t CUDNNWINAPI
621
+ cudnnCTCLoss_v8(
622
+ cudnnHandle_t handle,
623
+ cudnnCTCLossAlgo_t algo, /* algorithm selected, supported now 0 and 1 */
624
+ cudnnCTCLossDescriptor_t ctcLossDesc,
625
+ const cudnnTensorDescriptor_t
626
+ probsDesc, /* Tensor descriptor for probabilities, the dimensions are T,N,A (T is the timing steps, N is the
627
+ mini batch size, A is the alphabet size) */
628
+ const void *probs, /* probabilities after softmax, in GPU memory */
629
+ const int labels[], /* labels, in GPU memory */
630
+ const int labelLengths[], /* the length of each label, in GPU memory */
631
+ const int inputLengths[], /* the lengths of timing steps in each batch, in GPU memory */
632
+ void *costs, /* the returned costs of CTC, in GPU memory */
633
+ const cudnnTensorDescriptor_t gradientsDesc, /* Tensor descriptor for gradients, the dimensions are T,N,A */
634
+ void *gradients, /* the returned CTC gradients, in GPU memory, to compute costs only, set it to NULL */
635
+ size_t workSpaceSizeInBytes, /* size of the workspace */
636
+ void *workspace); /* pointer to the workspace, in GPU memory */
637
+
638
+ /* return the workspace size needed for ctc */
639
+ cudnnStatus_t CUDNNWINAPI
640
+ cudnnGetCTCLossWorkspaceSize(
641
+ cudnnHandle_t handle,
642
+ const cudnnTensorDescriptor_t probsDesc, /* Tensor descriptor for probabilities, the dimensions are T,N,A (T is the
643
+ timing steps, N is the mini batch size, A is the alphabet size) */
644
+ const cudnnTensorDescriptor_t gradientsDesc, /* Tensor descriptor for gradients, the
645
+ dimensions are T,N,A. To compute costs
646
+ only, set it to NULL */
647
+ const int *labels, /* labels, in CPU memory */
648
+ const int *labelLengths, /* the length of each label, in CPU memory */
649
+ const int *inputLengths, /* the lengths of timing steps in each batch, in CPU memory */
650
+ cudnnCTCLossAlgo_t algo, /* algorithm selected, supported now 0 and 1 */
651
+ cudnnCTCLossDescriptor_t ctcLossDesc,
652
+ size_t *sizeInBytes); /* pointer to the returned workspace size */
653
+
654
+ /* return the workspace size needed for ctc */
655
+ cudnnStatus_t CUDNNWINAPI
656
+ cudnnGetCTCLossWorkspaceSize_v8(
657
+ cudnnHandle_t handle,
658
+ cudnnCTCLossAlgo_t algo, /* algorithm selected, supported now 0 and 1 */
659
+ cudnnCTCLossDescriptor_t ctcLossDesc,
660
+ const cudnnTensorDescriptor_t probsDesc, /* Tensor descriptor for probabilities, the dimensions are T,N,A (T is the
661
+ timing steps, N is the mini batch size, A is the alphabet size) */
662
+ const cudnnTensorDescriptor_t gradientsDesc, /* Tensor descriptor for gradients, the
663
+ dimensions are T,N,A. To compute costs
664
+ only, set it to NULL */
665
+ size_t *sizeInBytes); /* pointer to the returned workspace size */
666
+
667
+ #if defined(__cplusplus)
668
+ }
669
+ #endif
670
+
671
+ #endif /* CUDNN_ADV_H_ */
lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_adv_v9.h ADDED
@@ -0,0 +1,671 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright 2014-2023 NVIDIA Corporation. All rights reserved.
3
+ *
4
+ * NOTICE TO LICENSEE:
5
+ *
6
+ * This source code and/or documentation ("Licensed Deliverables") are
7
+ * subject to NVIDIA intellectual property rights under U.S. and
8
+ * international Copyright laws.
9
+ *
10
+ * These Licensed Deliverables contained herein is PROPRIETARY and
11
+ * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12
+ * conditions of a form of NVIDIA software license agreement by and
13
+ * between NVIDIA and Licensee ("License Agreement") or electronically
14
+ * accepted by Licensee. Notwithstanding any terms or conditions to
15
+ * the contrary in the License Agreement, reproduction or disclosure
16
+ * of the Licensed Deliverables to any third party without the express
17
+ * written consent of NVIDIA is prohibited.
18
+ *
19
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20
+ * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21
+ * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
22
+ * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23
+ * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24
+ * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25
+ * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27
+ * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28
+ * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32
+ * OF THESE LICENSED DELIVERABLES.
33
+ *
34
+ * U.S. Government End Users. These Licensed Deliverables are a
35
+ * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36
+ * 1995), consisting of "commercial computer software" and "commercial
37
+ * computer software documentation" as such terms are used in 48
38
+ * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39
+ * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40
+ * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41
+ * U.S. Government End Users acquire the Licensed Deliverables with
42
+ * only those rights set forth herein.
43
+ *
44
+ * Any use of the Licensed Deliverables in individual and commercial
45
+ * software must include, in the user documentation and internal
46
+ * comments to the code, the above Disclaimer and U.S. Government End
47
+ * Users Notice.
48
+ */
49
+
50
+ /* cudnn_adv : cuDNN's advanced and experimental features.
51
+
52
+ */
53
+
54
+ #if !defined(CUDNN_ADV_H_)
55
+ #define CUDNN_ADV_H_
56
+
57
+ #include <stdint.h>
58
+
59
+ #include "cudnn_version.h"
60
+ #include "cudnn_ops.h"
61
+
62
+ /* These version numbers are autogenerated, do not edit manually. */
63
+ #define CUDNN_ADV_MAJOR 9
64
+ #define CUDNN_ADV_MINOR 1
65
+ #define CUDNN_ADV_PATCH 0
66
+
67
+ #if (CUDNN_ADV_MAJOR != CUDNN_MAJOR) || (CUDNN_ADV_MINOR != CUDNN_MINOR) || (CUDNN_ADV_PATCH != CUDNN_PATCHLEVEL)
68
+ #error Version mismatch in cuDNN ADV INFER!!!
69
+ #endif
70
+
71
+ #if defined(__cplusplus)
72
+ extern "C" {
73
+ #endif
74
+
75
+ /* BASIC RNN API */
76
+
77
+ typedef enum {
78
+ CUDNN_RNN_ALGO_STANDARD = 0,
79
+ CUDNN_RNN_ALGO_PERSIST_STATIC = 1,
80
+ CUDNN_RNN_ALGO_PERSIST_DYNAMIC = 2,
81
+ CUDNN_RNN_ALGO_PERSIST_STATIC_SMALL_H = 3,
82
+ CUDNN_RNN_ALGO_COUNT = 4,
83
+ } cudnnRNNAlgo_t;
84
+
85
+ typedef enum {
86
+ CUDNN_FWD_MODE_INFERENCE = 0,
87
+ CUDNN_FWD_MODE_TRAINING = 1,
88
+ } cudnnForwardMode_t;
89
+
90
+ typedef enum {
91
+ CUDNN_RNN_RELU = 0, /* basic RNN cell type with ReLu activation */
92
+ CUDNN_RNN_TANH = 1, /* basic RNN cell type with tanh activation */
93
+ CUDNN_LSTM = 2, /* LSTM with optional recurrent projection and clipping */
94
+ CUDNN_GRU = 3, /* Using h' = tanh(r * Uh(t-1) + Wx) and h = (1 - z) * h' + z * h(t-1); */
95
+ } cudnnRNNMode_t;
96
+
97
+ typedef enum {
98
+ CUDNN_RNN_NO_BIAS = 0, /* rnn cell formulas do not use biases */
99
+ CUDNN_RNN_SINGLE_INP_BIAS = 1, /* rnn cell formulas use one input bias in input GEMM */
100
+ CUDNN_RNN_DOUBLE_BIAS = 2, /* default, rnn cell formulas use two bias vectors */
101
+ CUDNN_RNN_SINGLE_REC_BIAS = 3 /* rnn cell formulas use one recurrent bias in recurrent GEMM */
102
+ } cudnnRNNBiasMode_t;
103
+
104
+ typedef enum {
105
+ CUDNN_UNIDIRECTIONAL = 0, /* single direction network */
106
+ CUDNN_BIDIRECTIONAL = 1, /* output concatination at each layer */
107
+ } cudnnDirectionMode_t;
108
+
109
+ typedef enum {
110
+ CUDNN_LINEAR_INPUT = 0, /* adjustable weight matrix in first layer input GEMM */
111
+ CUDNN_SKIP_INPUT = 1, /* fixed identity matrix in the first layer input GEMM */
112
+ } cudnnRNNInputMode_t;
113
+
114
+ typedef enum {
115
+ CUDNN_RNN_CLIP_NONE = 0, /* disables LSTM cell clipping */
116
+ CUDNN_RNN_CLIP_MINMAX = 1, /* enables LSTM cell clipping */
117
+ } cudnnRNNClipMode_t;
118
+
119
+ typedef enum {
120
+ CUDNN_RNN_DATA_LAYOUT_SEQ_MAJOR_UNPACKED = 0, /* padded, outer stride from one time-step to the next */
121
+ CUDNN_RNN_DATA_LAYOUT_SEQ_MAJOR_PACKED = 1, /* sequence length sorted and packed as in basic RNN api */
122
+ CUDNN_RNN_DATA_LAYOUT_BATCH_MAJOR_UNPACKED = 2, /* padded, outer stride from one batch to the next */
123
+ } cudnnRNNDataLayout_t;
124
+
125
+ /* For auxFlags in cudnnSetRNNDescriptor_v8() */
126
+ #define CUDNN_RNN_PADDED_IO_DISABLED 0
127
+ #define CUDNN_RNN_PADDED_IO_ENABLED (1U << 0)
128
+
129
+ struct cudnnRNNStruct;
130
+ typedef struct cudnnRNNStruct *cudnnRNNDescriptor_t;
131
+
132
+ struct cudnnRNNDataStruct;
133
+ typedef struct cudnnRNNDataStruct *cudnnRNNDataDescriptor_t;
134
+
135
+ cudnnStatus_t CUDNNWINAPI
136
+ cudnnCreateRNNDescriptor(cudnnRNNDescriptor_t *rnnDesc);
137
+
138
+ cudnnStatus_t CUDNNWINAPI
139
+ cudnnDestroyRNNDescriptor(cudnnRNNDescriptor_t rnnDesc);
140
+
141
+ /*
142
+ * mathPrec in cudnnSetRNNDescriptor_v8() specifies compute precision.
143
+ * Compute precision is further modified by mathType that sets the
144
+ * preferred option for using NVIDIA Tensor Cores. dataType specify
145
+ * input/output data type and weight/bias type.
146
+ */
147
+
148
+ cudnnStatus_t CUDNNWINAPI
149
+ cudnnSetRNNDescriptor_v8(cudnnRNNDescriptor_t rnnDesc,
150
+ cudnnRNNAlgo_t algo,
151
+ cudnnRNNMode_t cellMode,
152
+ cudnnRNNBiasMode_t biasMode,
153
+ cudnnDirectionMode_t dirMode,
154
+ cudnnRNNInputMode_t inputMode,
155
+ cudnnDataType_t dataType,
156
+ cudnnDataType_t mathPrec,
157
+ cudnnMathType_t mathType,
158
+ int32_t inputSize,
159
+ int32_t hiddenSize,
160
+ int32_t projSize,
161
+ int32_t numLayers,
162
+ cudnnDropoutDescriptor_t dropoutDesc,
163
+ uint32_t auxFlags);
164
+
165
+ cudnnStatus_t CUDNNWINAPI
166
+ cudnnGetRNNDescriptor_v8(cudnnRNNDescriptor_t rnnDesc,
167
+ cudnnRNNAlgo_t *algo,
168
+ cudnnRNNMode_t *cellMode,
169
+ cudnnRNNBiasMode_t *biasMode,
170
+ cudnnDirectionMode_t *dirMode,
171
+ cudnnRNNInputMode_t *inputMode,
172
+ cudnnDataType_t *dataType,
173
+ cudnnDataType_t *mathPrec,
174
+ cudnnMathType_t *mathType,
175
+ int32_t *inputSize,
176
+ int32_t *hiddenSize,
177
+ int32_t *projSize,
178
+ int32_t *numLayers,
179
+ cudnnDropoutDescriptor_t *dropoutDesc,
180
+ uint32_t *auxFlags);
181
+
182
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
183
+ cudnnRNNSetClip_v8(cudnnRNNDescriptor_t rnnDesc,
184
+ cudnnRNNClipMode_t clipMode,
185
+ cudnnNanPropagation_t clipNanOpt,
186
+ double lclip,
187
+ double rclip);
188
+
189
+ cudnnStatus_t CUDNNWINAPI
190
+ cudnnRNNSetClip_v9(cudnnRNNDescriptor_t rnnDesc, cudnnRNNClipMode_t clipMode, double lclip, double rclip);
191
+
192
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
193
+ cudnnRNNGetClip_v8(cudnnRNNDescriptor_t rnnDesc,
194
+ cudnnRNNClipMode_t *clipMode,
195
+ cudnnNanPropagation_t *clipNanOpt,
196
+ double *lclip,
197
+ double *rclip);
198
+
199
+ cudnnStatus_t CUDNNWINAPI
200
+ cudnnRNNGetClip_v9(cudnnRNNDescriptor_t rnnDesc, cudnnRNNClipMode_t *clipMode, double *lclip, double *rclip);
201
+
202
+ cudnnStatus_t CUDNNWINAPI
203
+ cudnnBuildRNNDynamic(cudnnHandle_t handle, cudnnRNNDescriptor_t rnnDesc, int miniBatch);
204
+
205
+ cudnnStatus_t CUDNNWINAPI
206
+ cudnnGetRNNTempSpaceSizes(cudnnHandle_t handle,
207
+ cudnnRNNDescriptor_t rnnDesc,
208
+ cudnnForwardMode_t fwdMode,
209
+ cudnnRNNDataDescriptor_t xDesc,
210
+ size_t *workSpaceSize,
211
+ size_t *reserveSpaceSize);
212
+
213
+ cudnnStatus_t CUDNNWINAPI
214
+ cudnnGetRNNWeightSpaceSize(cudnnHandle_t handle, cudnnRNNDescriptor_t rnnDesc, size_t *weightSpaceSize);
215
+
216
+ cudnnStatus_t CUDNNWINAPI
217
+ cudnnGetRNNWeightParams(cudnnHandle_t handle,
218
+ cudnnRNNDescriptor_t rnnDesc,
219
+ int32_t pseudoLayer,
220
+ size_t weightSpaceSize,
221
+ const void *weightSpace,
222
+ int32_t linLayerID,
223
+ cudnnTensorDescriptor_t mDesc,
224
+ void **mAddr,
225
+ cudnnTensorDescriptor_t bDesc,
226
+ void **bAddr);
227
+
228
+ cudnnStatus_t CUDNNWINAPI
229
+ cudnnCreateRNNDataDescriptor(cudnnRNNDataDescriptor_t *rnnDataDesc);
230
+
231
+ cudnnStatus_t CUDNNWINAPI
232
+ cudnnDestroyRNNDataDescriptor(cudnnRNNDataDescriptor_t rnnDataDesc);
233
+
234
+ cudnnStatus_t CUDNNWINAPI
235
+ cudnnSetRNNDataDescriptor(cudnnRNNDataDescriptor_t rnnDataDesc,
236
+ cudnnDataType_t dataType,
237
+ cudnnRNNDataLayout_t layout,
238
+ int maxSeqLength,
239
+ int batchSize,
240
+ int vectorSize,
241
+ const int seqLengthArray[], /* length of each sequence in the batch */
242
+ void *paddingFill); /* symbol for filling padding position in output */
243
+
244
+ cudnnStatus_t CUDNNWINAPI
245
+ cudnnGetRNNDataDescriptor(cudnnRNNDataDescriptor_t rnnDataDesc,
246
+ cudnnDataType_t *dataType,
247
+ cudnnRNNDataLayout_t *layout,
248
+ int *maxSeqLength,
249
+ int *batchSize,
250
+ int *vectorSize,
251
+ int arrayLengthRequested,
252
+ int seqLengthArray[],
253
+ void *paddingFill);
254
+
255
+ cudnnStatus_t CUDNNWINAPI
256
+ cudnnRNNForward(cudnnHandle_t handle,
257
+ cudnnRNNDescriptor_t rnnDesc,
258
+ cudnnForwardMode_t fwdMode,
259
+ const int32_t devSeqLengths[],
260
+ cudnnRNNDataDescriptor_t xDesc,
261
+ const void *x,
262
+ cudnnRNNDataDescriptor_t yDesc,
263
+ void *y,
264
+ cudnnTensorDescriptor_t hDesc,
265
+ const void *hx,
266
+ void *hy,
267
+ cudnnTensorDescriptor_t cDesc,
268
+ const void *cx,
269
+ void *cy,
270
+ size_t weightSpaceSize,
271
+ const void *weightSpace,
272
+ size_t workSpaceSize,
273
+ void *workSpace,
274
+ size_t reserveSpaceSize,
275
+ void *reserveSpace);
276
+
277
+ /* Sequence data descriptor */
278
+
279
+ typedef enum {
280
+ CUDNN_SEQDATA_TIME_DIM = 0, /* index in time */
281
+ CUDNN_SEQDATA_BATCH_DIM = 1, /* index in batch */
282
+ CUDNN_SEQDATA_BEAM_DIM = 2, /* index in beam */
283
+ CUDNN_SEQDATA_VECT_DIM = 3 /* index in vector */
284
+ } cudnnSeqDataAxis_t;
285
+
286
+ struct cudnnSeqDataStruct;
287
+ typedef struct cudnnSeqDataStruct *cudnnSeqDataDescriptor_t CUDNN_DEPRECATED;
288
+
289
+ #define CUDNN_SEQDATA_DIM_COUNT 4 /* dimension count */
290
+
291
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
292
+ cudnnCreateSeqDataDescriptor(cudnnSeqDataDescriptor_t *seqDataDesc);
293
+
294
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
295
+ cudnnDestroySeqDataDescriptor(cudnnSeqDataDescriptor_t seqDataDesc);
296
+
297
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
298
+ cudnnSetSeqDataDescriptor(cudnnSeqDataDescriptor_t seqDataDesc,
299
+ cudnnDataType_t dataType,
300
+ int nbDims,
301
+ const int dimA[],
302
+ const cudnnSeqDataAxis_t axes[],
303
+ size_t seqLengthArraySize,
304
+ const int seqLengthArray[],
305
+ void *paddingFill);
306
+
307
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
308
+ cudnnGetSeqDataDescriptor(const cudnnSeqDataDescriptor_t seqDataDesc,
309
+ cudnnDataType_t *dataType,
310
+ int *nbDims,
311
+ int nbDimsRequested,
312
+ int dimA[],
313
+ cudnnSeqDataAxis_t axes[],
314
+ size_t *seqLengthArraySize,
315
+ size_t seqLengthSizeRequested,
316
+ int seqLengthArray[],
317
+ void *paddingFill);
318
+
319
+ /* Multihead Attention */
320
+
321
+ /*
322
+ * Multi-head attention options passed via 'attnMode' in cudnnSetAttnDescriptor().
323
+ * Use the bitwise OR operator to combine several settings listed below. Additional
324
+ * minor options can be added here w/o changing or introducing new API functions.
325
+ */
326
+ #define CUDNN_ATTN_QUERYMAP_ALL_TO_ONE 0 /* multiple Q-s map to a single (K,V) set when beam size > 1 */
327
+ #define CUDNN_ATTN_QUERYMAP_ONE_TO_ONE (1U << 0) /* multiple Q-s map to multiple (K,V) sets when beam size > 1 */
328
+ #define CUDNN_ATTN_DISABLE_PROJ_BIASES 0 /* no biases in attention input and output projections */
329
+ #define CUDNN_ATTN_ENABLE_PROJ_BIASES (1U << 1) /* use biases in attention input and output projections */
330
+
331
+ struct cudnnAttnStruct;
332
+ typedef struct cudnnAttnStruct *cudnnAttnDescriptor_t CUDNN_DEPRECATED;
333
+
334
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
335
+ cudnnCreateAttnDescriptor(cudnnAttnDescriptor_t *attnDesc);
336
+
337
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
338
+ cudnnDestroyAttnDescriptor(cudnnAttnDescriptor_t attnDesc);
339
+
340
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
341
+ cudnnSetAttnDescriptor(cudnnAttnDescriptor_t attnDesc,
342
+ unsigned attnMode,
343
+ int nHeads,
344
+ double smScaler,
345
+ cudnnDataType_t dataType,
346
+ cudnnDataType_t computePrec,
347
+ cudnnMathType_t mathType,
348
+ cudnnDropoutDescriptor_t attnDropoutDesc,
349
+ cudnnDropoutDescriptor_t postDropoutDesc,
350
+ int qSize,
351
+ int kSize,
352
+ int vSize,
353
+ int qProjSize,
354
+ int kProjSize,
355
+ int vProjSize,
356
+ int oProjSize,
357
+ int qoMaxSeqLength,
358
+ int kvMaxSeqLength,
359
+ int maxBatchSize,
360
+ int maxBeamSize);
361
+
362
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
363
+ cudnnGetAttnDescriptor(cudnnAttnDescriptor_t attnDesc,
364
+ unsigned *attnMode,
365
+ int *nHeads,
366
+ double *smScaler,
367
+ cudnnDataType_t *dataType,
368
+ cudnnDataType_t *computePrec,
369
+ cudnnMathType_t *mathType,
370
+ cudnnDropoutDescriptor_t *attnDropoutDesc,
371
+ cudnnDropoutDescriptor_t *postDropoutDesc,
372
+ int *qSize,
373
+ int *kSize,
374
+ int *vSize,
375
+ int *qProjSize,
376
+ int *kProjSize,
377
+ int *vProjSize,
378
+ int *oProjSize,
379
+ int *qoMaxSeqLength,
380
+ int *kvMaxSeqLength,
381
+ int *maxBatchSize,
382
+ int *maxBeamSize);
383
+
384
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
385
+ cudnnGetMultiHeadAttnBuffers(cudnnHandle_t handle,
386
+ const cudnnAttnDescriptor_t attnDesc,
387
+ size_t *weightSizeInBytes,
388
+ size_t *workSpaceSizeInBytes,
389
+ size_t *reserveSpaceSizeInBytes);
390
+
391
+ typedef enum {
392
+ CUDNN_MH_ATTN_Q_WEIGHTS = 0, /* input projection weights for 'queries' */
393
+ CUDNN_MH_ATTN_K_WEIGHTS = 1, /* input projection weights for 'keys' */
394
+ CUDNN_MH_ATTN_V_WEIGHTS = 2, /* input projection weights for 'values' */
395
+ CUDNN_MH_ATTN_O_WEIGHTS = 3, /* output projection weights */
396
+ CUDNN_MH_ATTN_Q_BIASES = 4, /* input projection bias tensor for 'queries' */
397
+ CUDNN_MH_ATTN_K_BIASES = 5, /* input projection bias for 'keys' */
398
+ CUDNN_MH_ATTN_V_BIASES = 6, /* input projection bias for 'values' */
399
+ CUDNN_MH_ATTN_O_BIASES = 7, /* output projection biases */
400
+ } cudnnMultiHeadAttnWeightKind_t;
401
+
402
+ #define CUDNN_ATTN_WKIND_COUNT 8 /* Number of attention weight/bias tensors */
403
+
404
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
405
+ cudnnGetMultiHeadAttnWeights(cudnnHandle_t handle,
406
+ const cudnnAttnDescriptor_t attnDesc,
407
+ cudnnMultiHeadAttnWeightKind_t wKind,
408
+ size_t weightSizeInBytes,
409
+ const void *weights,
410
+ cudnnTensorDescriptor_t wDesc,
411
+ void **wAddr);
412
+
413
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
414
+ cudnnMultiHeadAttnForward(cudnnHandle_t handle,
415
+ const cudnnAttnDescriptor_t attnDesc,
416
+ int currIdx,
417
+ const int loWinIdx[],
418
+ const int hiWinIdx[],
419
+ const int devSeqLengthsQO[],
420
+ const int devSeqLengthsKV[],
421
+ const cudnnSeqDataDescriptor_t qDesc,
422
+ const void *queries,
423
+ const void *residuals,
424
+ const cudnnSeqDataDescriptor_t kDesc,
425
+ const void *keys,
426
+ const cudnnSeqDataDescriptor_t vDesc,
427
+ const void *values,
428
+ const cudnnSeqDataDescriptor_t oDesc,
429
+ void *out,
430
+ size_t weightSizeInBytes,
431
+ const void *weights,
432
+ size_t workSpaceSizeInBytes,
433
+ void *workSpace,
434
+ size_t reserveSpaceSizeInBytes,
435
+ void *reserveSpace);
436
+
437
+ /*
438
+ * \brief Cross-library version checker.
439
+ * This function is implemented differently in each sub-library. Each sublib
440
+ * checks whether its own version matches that of its dependencies.
441
+ * \returns CUDNN_STATUS_SUCCESS if the version check passes,
442
+ * CUDNN_STATUS_SUBLIBRARY_VERSION_MISMATCH if the versions are inconsistent.
443
+ */
444
+ cudnnStatus_t CUDNNWINAPI
445
+ cudnnAdvVersionCheck(void);
446
+
447
+ typedef enum {
448
+ CUDNN_WGRAD_MODE_ADD = 0, /* add partial gradients to wgrad output buffers */
449
+ CUDNN_WGRAD_MODE_SET = 1, /* write partial gradients to wgrad output buffers */
450
+ } cudnnWgradMode_t;
451
+
452
+ cudnnStatus_t CUDNNWINAPI
453
+ cudnnRNNBackwardData_v8(cudnnHandle_t handle,
454
+ cudnnRNNDescriptor_t rnnDesc,
455
+ const int32_t devSeqLengths[],
456
+ cudnnRNNDataDescriptor_t yDesc,
457
+ const void *y,
458
+ const void *dy,
459
+ cudnnRNNDataDescriptor_t xDesc,
460
+ void *dx,
461
+ cudnnTensorDescriptor_t hDesc,
462
+ const void *hx,
463
+ const void *dhy,
464
+ void *dhx,
465
+ cudnnTensorDescriptor_t cDesc,
466
+ const void *cx,
467
+ const void *dcy,
468
+ void *dcx,
469
+ size_t weightSpaceSize,
470
+ const void *weightSpace,
471
+ size_t workSpaceSize,
472
+ void *workSpace,
473
+ size_t reserveSpaceSize,
474
+ void *reserveSpace);
475
+
476
+ cudnnStatus_t CUDNNWINAPI
477
+ cudnnRNNBackwardWeights_v8(cudnnHandle_t handle,
478
+ cudnnRNNDescriptor_t rnnDesc,
479
+ cudnnWgradMode_t addGrad,
480
+ const int32_t devSeqLengths[],
481
+ cudnnRNNDataDescriptor_t xDesc,
482
+ const void *x,
483
+ cudnnTensorDescriptor_t hDesc,
484
+ const void *hx,
485
+ cudnnRNNDataDescriptor_t yDesc,
486
+ const void *y,
487
+ size_t weightSpaceSize,
488
+ void *dweightSpace,
489
+ size_t workSpaceSize,
490
+ void *workSpace,
491
+ size_t reserveSpaceSize,
492
+ void *reserveSpace);
493
+
494
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
495
+ cudnnMultiHeadAttnBackwardData(cudnnHandle_t handle,
496
+ const cudnnAttnDescriptor_t attnDesc,
497
+ const int loWinIdx[],
498
+ const int hiWinIdx[],
499
+ const int devSeqLengthsDQDO[],
500
+ const int devSeqLengthsDKDV[],
501
+ const cudnnSeqDataDescriptor_t doDesc,
502
+ const void *dout,
503
+ const cudnnSeqDataDescriptor_t dqDesc,
504
+ void *dqueries,
505
+ const void *queries,
506
+ const cudnnSeqDataDescriptor_t dkDesc,
507
+ void *dkeys,
508
+ const void *keys,
509
+ const cudnnSeqDataDescriptor_t dvDesc,
510
+ void *dvalues,
511
+ const void *values,
512
+ size_t weightSizeInBytes,
513
+ const void *weights,
514
+ size_t workSpaceSizeInBytes,
515
+ void *workSpace,
516
+ size_t reserveSpaceSizeInBytes,
517
+ void *reserveSpace);
518
+
519
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
520
+ cudnnMultiHeadAttnBackwardWeights(cudnnHandle_t handle,
521
+ const cudnnAttnDescriptor_t attnDesc,
522
+ cudnnWgradMode_t addGrad,
523
+ const cudnnSeqDataDescriptor_t qDesc,
524
+ const void *queries,
525
+ const cudnnSeqDataDescriptor_t kDesc,
526
+ const void *keys,
527
+ const cudnnSeqDataDescriptor_t vDesc,
528
+ const void *values,
529
+ const cudnnSeqDataDescriptor_t doDesc,
530
+ const void *dout,
531
+ size_t weightSizeInBytes,
532
+ const void *weights,
533
+ void *dweights,
534
+ size_t workSpaceSizeInBytes,
535
+ void *workSpace,
536
+ size_t reserveSpaceSizeInBytes,
537
+ void *reserveSpace);
538
+
539
+ /*
540
+ * CTC (Connectionist Temporal Classification) loss descriptor create/destory/set/get functions
541
+ */
542
+ /* Input normalization mode for loss function */
543
+ typedef enum {
544
+ CUDNN_LOSS_NORMALIZATION_NONE = 0,
545
+ CUDNN_LOSS_NORMALIZATION_SOFTMAX = 1,
546
+ } cudnnLossNormalizationMode_t;
547
+
548
+ cudnnStatus_t CUDNNWINAPI
549
+ cudnnCreateCTCLossDescriptor(cudnnCTCLossDescriptor_t *ctcLossDesc);
550
+
551
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
552
+ cudnnSetCTCLossDescriptor(cudnnCTCLossDescriptor_t ctcLossDesc, cudnnDataType_t compType);
553
+
554
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
555
+ cudnnSetCTCLossDescriptorEx(cudnnCTCLossDescriptor_t ctcLossDesc,
556
+ cudnnDataType_t compType,
557
+ cudnnLossNormalizationMode_t normMode,
558
+ cudnnNanPropagation_t gradMode);
559
+
560
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
561
+ cudnnSetCTCLossDescriptor_v8(cudnnCTCLossDescriptor_t ctcLossDesc,
562
+ cudnnDataType_t compType,
563
+ cudnnLossNormalizationMode_t normMode,
564
+ cudnnNanPropagation_t gradMode,
565
+ int maxLabelLength);
566
+
567
+ cudnnStatus_t CUDNNWINAPI
568
+ cudnnSetCTCLossDescriptor_v9(cudnnCTCLossDescriptor_t ctcLossDesc,
569
+ cudnnDataType_t compType,
570
+ cudnnLossNormalizationMode_t normMode,
571
+ cudnnCTCGradMode_t ctcGradMode,
572
+ int maxLabelLength);
573
+
574
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
575
+ cudnnGetCTCLossDescriptor(cudnnCTCLossDescriptor_t ctcLossDesc, cudnnDataType_t *compType);
576
+
577
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
578
+ cudnnGetCTCLossDescriptorEx(cudnnCTCLossDescriptor_t ctcLossDesc,
579
+ cudnnDataType_t *compType,
580
+ cudnnLossNormalizationMode_t *normMode,
581
+ cudnnNanPropagation_t *gradMode);
582
+
583
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
584
+ cudnnGetCTCLossDescriptor_v8(cudnnCTCLossDescriptor_t ctcLossDesc,
585
+ cudnnDataType_t *compType,
586
+ cudnnLossNormalizationMode_t *normMode,
587
+ cudnnNanPropagation_t *gradMode,
588
+ int *maxLabelLength);
589
+
590
+ cudnnStatus_t CUDNNWINAPI
591
+ cudnnGetCTCLossDescriptor_v9(cudnnCTCLossDescriptor_t ctcLossDesc,
592
+ cudnnDataType_t *compType,
593
+ cudnnLossNormalizationMode_t *normMode,
594
+ cudnnCTCGradMode_t *ctcGradMode,
595
+ int *maxLabelLength);
596
+
597
+ cudnnStatus_t CUDNNWINAPI
598
+ cudnnDestroyCTCLossDescriptor(cudnnCTCLossDescriptor_t ctcLossDesc);
599
+
600
+ /* return the ctc costs and gradients, given the probabilities and labels */
601
+ cudnnStatus_t CUDNNWINAPI
602
+ cudnnCTCLoss(
603
+ cudnnHandle_t handle,
604
+ const cudnnTensorDescriptor_t
605
+ probsDesc, /* Tensor descriptor for probabilities, the dimensions are T,N,A (T is the timing steps, N is the
606
+ mini batch size, A is the alphabet size) */
607
+ const void *probs, /* probabilities after softmax, in GPU memory */
608
+ const int hostLabels[], /* labels, in CPU memory */
609
+ const int hostLabelLengths[], /* the length of each label, in CPU memory */
610
+ const int hostInputLengths[], /* the lengths of timing steps in each batch, in CPU memory */
611
+ void *costs, /* the returned costs of CTC, in GPU memory */
612
+ const cudnnTensorDescriptor_t gradientsDesc, /* Tensor descriptor for gradients, the dimensions are T,N,A */
613
+ void *gradients, /* the returned CTC gradients, in GPU memory, to compute costs only, set it to NULL */
614
+ cudnnCTCLossAlgo_t algo, /* algorithm selected, supported now 0 and 1 */
615
+ cudnnCTCLossDescriptor_t ctcLossDesc,
616
+ void *workspace, /* pointer to the workspace, in GPU memory */
617
+ size_t workSpaceSizeInBytes); /* size of the workspace */
618
+
619
+ /* return the ctc costs and gradients, given the probabilities and labels */
620
+ cudnnStatus_t CUDNNWINAPI
621
+ cudnnCTCLoss_v8(
622
+ cudnnHandle_t handle,
623
+ cudnnCTCLossAlgo_t algo, /* algorithm selected, supported now 0 and 1 */
624
+ cudnnCTCLossDescriptor_t ctcLossDesc,
625
+ const cudnnTensorDescriptor_t
626
+ probsDesc, /* Tensor descriptor for probabilities, the dimensions are T,N,A (T is the timing steps, N is the
627
+ mini batch size, A is the alphabet size) */
628
+ const void *probs, /* probabilities after softmax, in GPU memory */
629
+ const int labels[], /* labels, in GPU memory */
630
+ const int labelLengths[], /* the length of each label, in GPU memory */
631
+ const int inputLengths[], /* the lengths of timing steps in each batch, in GPU memory */
632
+ void *costs, /* the returned costs of CTC, in GPU memory */
633
+ const cudnnTensorDescriptor_t gradientsDesc, /* Tensor descriptor for gradients, the dimensions are T,N,A */
634
+ void *gradients, /* the returned CTC gradients, in GPU memory, to compute costs only, set it to NULL */
635
+ size_t workSpaceSizeInBytes, /* size of the workspace */
636
+ void *workspace); /* pointer to the workspace, in GPU memory */
637
+
638
+ /* return the workspace size needed for ctc */
639
+ cudnnStatus_t CUDNNWINAPI
640
+ cudnnGetCTCLossWorkspaceSize(
641
+ cudnnHandle_t handle,
642
+ const cudnnTensorDescriptor_t probsDesc, /* Tensor descriptor for probabilities, the dimensions are T,N,A (T is the
643
+ timing steps, N is the mini batch size, A is the alphabet size) */
644
+ const cudnnTensorDescriptor_t gradientsDesc, /* Tensor descriptor for gradients, the
645
+ dimensions are T,N,A. To compute costs
646
+ only, set it to NULL */
647
+ const int *labels, /* labels, in CPU memory */
648
+ const int *labelLengths, /* the length of each label, in CPU memory */
649
+ const int *inputLengths, /* the lengths of timing steps in each batch, in CPU memory */
650
+ cudnnCTCLossAlgo_t algo, /* algorithm selected, supported now 0 and 1 */
651
+ cudnnCTCLossDescriptor_t ctcLossDesc,
652
+ size_t *sizeInBytes); /* pointer to the returned workspace size */
653
+
654
+ /* return the workspace size needed for ctc */
655
+ cudnnStatus_t CUDNNWINAPI
656
+ cudnnGetCTCLossWorkspaceSize_v8(
657
+ cudnnHandle_t handle,
658
+ cudnnCTCLossAlgo_t algo, /* algorithm selected, supported now 0 and 1 */
659
+ cudnnCTCLossDescriptor_t ctcLossDesc,
660
+ const cudnnTensorDescriptor_t probsDesc, /* Tensor descriptor for probabilities, the dimensions are T,N,A (T is the
661
+ timing steps, N is the mini batch size, A is the alphabet size) */
662
+ const cudnnTensorDescriptor_t gradientsDesc, /* Tensor descriptor for gradients, the
663
+ dimensions are T,N,A. To compute costs
664
+ only, set it to NULL */
665
+ size_t *sizeInBytes); /* pointer to the returned workspace size */
666
+
667
+ #if defined(__cplusplus)
668
+ }
669
+ #endif
670
+
671
+ #endif /* CUDNN_ADV_H_ */
lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_backend.h ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright 2014-2023 NVIDIA Corporation. All rights reserved.
3
+ *
4
+ * NOTICE TO LICENSEE:
5
+ *
6
+ * This source code and/or documentation ("Licensed Deliverables") are
7
+ * subject to NVIDIA intellectual property rights under U.S. and
8
+ * international Copyright laws.
9
+ *
10
+ * These Licensed Deliverables contained herein is PROPRIETARY and
11
+ * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12
+ * conditions of a form of NVIDIA software license agreement by and
13
+ * between NVIDIA and Licensee ("License Agreement") or electronically
14
+ * accepted by Licensee. Notwithstanding any terms or conditions to
15
+ * the contrary in the License Agreement, reproduction or disclosure
16
+ * of the Licensed Deliverables to any third party without the express
17
+ * written consent of NVIDIA is prohibited.
18
+ *
19
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20
+ * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21
+ * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
22
+ * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23
+ * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24
+ * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25
+ * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27
+ * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28
+ * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32
+ * OF THESE LICENSED DELIVERABLES.
33
+ *
34
+ * U.S. Government End Users. These Licensed Deliverables are a
35
+ * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36
+ * 1995), consisting of "commercial computer software" and "commercial
37
+ * computer software documentation" as such terms are used in 48
38
+ * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39
+ * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40
+ * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41
+ * U.S. Government End Users acquire the Licensed Deliverables with
42
+ * only those rights set forth herein.
43
+ *
44
+ * Any use of the Licensed Deliverables in individual and commercial
45
+ * software must include, in the user documentation and internal
46
+ * comments to the code, the above Disclaimer and U.S. Government End
47
+ * Users Notice.
48
+ */
49
+
50
+ #ifndef _CUDNN_BACKEND_H_
51
+ #define _CUDNN_BACKEND_H_
52
+
53
+ /*
54
+ * The content of this header has been moved into cudnn_graph.h.
55
+ * This header is kept for the backward compatibility purpose.
56
+ */
57
+
58
+ #include "cudnn_graph.h"
59
+
60
+ #endif /* _CUDNN_BACKEND_H_ */
lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_backend_v9.h ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright 2014-2023 NVIDIA Corporation. All rights reserved.
3
+ *
4
+ * NOTICE TO LICENSEE:
5
+ *
6
+ * This source code and/or documentation ("Licensed Deliverables") are
7
+ * subject to NVIDIA intellectual property rights under U.S. and
8
+ * international Copyright laws.
9
+ *
10
+ * These Licensed Deliverables contained herein is PROPRIETARY and
11
+ * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12
+ * conditions of a form of NVIDIA software license agreement by and
13
+ * between NVIDIA and Licensee ("License Agreement") or electronically
14
+ * accepted by Licensee. Notwithstanding any terms or conditions to
15
+ * the contrary in the License Agreement, reproduction or disclosure
16
+ * of the Licensed Deliverables to any third party without the express
17
+ * written consent of NVIDIA is prohibited.
18
+ *
19
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20
+ * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21
+ * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
22
+ * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23
+ * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24
+ * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25
+ * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27
+ * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28
+ * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32
+ * OF THESE LICENSED DELIVERABLES.
33
+ *
34
+ * U.S. Government End Users. These Licensed Deliverables are a
35
+ * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36
+ * 1995), consisting of "commercial computer software" and "commercial
37
+ * computer software documentation" as such terms are used in 48
38
+ * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39
+ * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40
+ * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41
+ * U.S. Government End Users acquire the Licensed Deliverables with
42
+ * only those rights set forth herein.
43
+ *
44
+ * Any use of the Licensed Deliverables in individual and commercial
45
+ * software must include, in the user documentation and internal
46
+ * comments to the code, the above Disclaimer and U.S. Government End
47
+ * Users Notice.
48
+ */
49
+
50
+ #ifndef _CUDNN_BACKEND_H_
51
+ #define _CUDNN_BACKEND_H_
52
+
53
+ /*
54
+ * The content of this header has been moved into cudnn_graph.h.
55
+ * This header is kept for the backward compatibility purpose.
56
+ */
57
+
58
+ #include "cudnn_graph.h"
59
+
60
+ #endif /* _CUDNN_BACKEND_H_ */
lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_cnn.h ADDED
@@ -0,0 +1,693 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright 2014-2023 NVIDIA Corporation. All rights reserved.
3
+ *
4
+ * NOTICE TO LICENSEE:
5
+ *
6
+ * This source code and/or documentation ("Licensed Deliverables") are
7
+ * subject to NVIDIA intellectual property rights under U.S. and
8
+ * international Copyright laws.
9
+ *
10
+ * These Licensed Deliverables contained herein is PROPRIETARY and
11
+ * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12
+ * conditions of a form of NVIDIA software license agreement by and
13
+ * between NVIDIA and Licensee ("License Agreement") or electronically
14
+ * accepted by Licensee. Notwithstanding any terms or conditions to
15
+ * the contrary in the License Agreement, reproduction or disclosure
16
+ * of the Licensed Deliverables to any third party without the express
17
+ * written consent of NVIDIA is prohibited.
18
+ *
19
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20
+ * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21
+ * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
22
+ * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23
+ * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24
+ * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25
+ * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27
+ * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28
+ * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32
+ * OF THESE LICENSED DELIVERABLES.
33
+ *
34
+ * U.S. Government End Users. These Licensed Deliverables are a
35
+ * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36
+ * 1995), consisting of "commercial computer software" and "commercial
37
+ * computer software documentation" as such terms are used in 48
38
+ * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39
+ * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40
+ * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41
+ * U.S. Government End Users acquire the Licensed Deliverables with
42
+ * only those rights set forth herein.
43
+ *
44
+ * Any use of the Licensed Deliverables in individual and commercial
45
+ * software must include, in the user documentation and internal
46
+ * comments to the code, the above Disclaimer and U.S. Government End
47
+ * Users Notice.
48
+ */
49
+
50
+ /*
51
+ * cudnn_cnn : cuDNN's basic definitions and CNN functions.
52
+ */
53
+
54
+ #if !defined(CUDNN_CNN_H_)
55
+ #define CUDNN_CNN_H_
56
+
57
+ #pragma once
58
+ #include <stdint.h>
59
+
60
+ #include "cudnn_version.h"
61
+ #include "cudnn_ops.h"
62
+
63
+ /* These version numbers are autogenerated, do not edit manually. */
64
+ #define CUDNN_CNN_MAJOR 9
65
+ #define CUDNN_CNN_MINOR 1
66
+ #define CUDNN_CNN_PATCH 0
67
+
68
+ #if (CUDNN_CNN_MAJOR != CUDNN_MAJOR) || (CUDNN_CNN_MINOR != CUDNN_MINOR) || (CUDNN_CNN_PATCH != CUDNN_PATCHLEVEL)
69
+ #error Version mismatch in cuDNN CNN INFER!!!
70
+ #endif
71
+
72
+ #if defined(__cplusplus)
73
+ extern "C" {
74
+ #endif
75
+
76
+ typedef struct cudnnConvolutionStruct *cudnnConvolutionDescriptor_t CUDNN_DEPRECATED;
77
+
78
+ typedef struct cudnnConvolutionFwdAlgoPerfStruct {
79
+ cudnnConvolutionFwdAlgo_t algo;
80
+ cudnnStatus_t status;
81
+ float time;
82
+ size_t memory;
83
+ cudnnDeterminism_t determinism;
84
+ cudnnMathType_t mathType;
85
+ int reserved[3];
86
+ } cudnnConvolutionFwdAlgoPerf_t CUDNN_DEPRECATED;
87
+
88
+ /* Create an instance of convolution descriptor */
89
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
90
+ cudnnCreateConvolutionDescriptor(cudnnConvolutionDescriptor_t *convDesc);
91
+
92
+ /* Destroy an instance of convolution descriptor */
93
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
94
+ cudnnDestroyConvolutionDescriptor(cudnnConvolutionDescriptor_t convDesc);
95
+
96
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
97
+ cudnnSetConvolutionMathType(cudnnConvolutionDescriptor_t convDesc, cudnnMathType_t mathType);
98
+
99
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
100
+ cudnnGetConvolutionMathType(cudnnConvolutionDescriptor_t convDesc, cudnnMathType_t *mathType);
101
+
102
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
103
+ cudnnSetConvolutionGroupCount(cudnnConvolutionDescriptor_t convDesc, int groupCount);
104
+
105
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
106
+ cudnnGetConvolutionGroupCount(cudnnConvolutionDescriptor_t convDesc, int *groupCount);
107
+
108
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
109
+ cudnnSetConvolutionReorderType(cudnnConvolutionDescriptor_t convDesc, cudnnReorderType_t reorderType);
110
+
111
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
112
+ cudnnGetConvolutionReorderType(cudnnConvolutionDescriptor_t convDesc, cudnnReorderType_t *reorderType);
113
+
114
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
115
+ cudnnSetConvolution2dDescriptor(cudnnConvolutionDescriptor_t convDesc,
116
+ int pad_h, /* zero-padding height */
117
+ int pad_w, /* zero-padding width */
118
+ int u, /* vertical filter stride */
119
+ int v, /* horizontal filter stride */
120
+ int dilation_h, /* filter dilation in the vertical dimension */
121
+ int dilation_w, /* filter dilation in the horizontal dimension */
122
+ cudnnConvolutionMode_t mode,
123
+ cudnnDataType_t computeType);
124
+
125
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
126
+ cudnnGetConvolution2dDescriptor(const cudnnConvolutionDescriptor_t convDesc,
127
+ int *pad_h, /* zero-padding height */
128
+ int *pad_w, /* zero-padding width */
129
+ int *u, /* vertical filter stride */
130
+ int *v, /* horizontal filter stride */
131
+ int *dilation_h, /* filter dilation in the vertical dimension */
132
+ int *dilation_w, /* filter dilation in the horizontal dimension */
133
+ cudnnConvolutionMode_t *mode,
134
+ cudnnDataType_t *computeType);
135
+
136
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
137
+ cudnnSetConvolutionNdDescriptor(cudnnConvolutionDescriptor_t convDesc,
138
+ int arrayLength, /* nbDims-2 size */
139
+ const int padA[],
140
+ const int filterStrideA[],
141
+ const int dilationA[],
142
+ cudnnConvolutionMode_t mode,
143
+ cudnnDataType_t computeType); /* convolution data type */
144
+
145
+ /* Helper function to return the dimensions of the output tensor given a convolution descriptor */
146
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
147
+ cudnnGetConvolutionNdDescriptor(const cudnnConvolutionDescriptor_t convDesc,
148
+ int arrayLengthRequested,
149
+ int *arrayLength,
150
+ int padA[],
151
+ int strideA[],
152
+ int dilationA[],
153
+ cudnnConvolutionMode_t *mode,
154
+ cudnnDataType_t *computeType); /* convolution data type */
155
+
156
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
157
+ cudnnGetConvolution2dForwardOutputDim(const cudnnConvolutionDescriptor_t convDesc,
158
+ const cudnnTensorDescriptor_t inputTensorDesc,
159
+ const cudnnFilterDescriptor_t filterDesc,
160
+ int *n,
161
+ int *c,
162
+ int *h,
163
+ int *w);
164
+
165
+ /* Helper function to return the dimensions of the output tensor given a convolution descriptor */
166
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
167
+ cudnnGetConvolutionNdForwardOutputDim(const cudnnConvolutionDescriptor_t convDesc,
168
+ const cudnnTensorDescriptor_t inputTensorDesc,
169
+ const cudnnFilterDescriptor_t filterDesc,
170
+ int nbDims,
171
+ int tensorOuputDimA[]);
172
+
173
+ /* helper function to provide the convolution forward algo that fit best the requirement */
174
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
175
+ cudnnGetConvolutionForwardAlgorithmMaxCount(cudnnHandle_t handle, int *count);
176
+
177
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
178
+ cudnnGetConvolutionForwardAlgorithm_v7(cudnnHandle_t handle,
179
+ const cudnnTensorDescriptor_t srcDesc,
180
+ const cudnnFilterDescriptor_t filterDesc,
181
+ const cudnnConvolutionDescriptor_t convDesc,
182
+ const cudnnTensorDescriptor_t destDesc,
183
+ const int requestedAlgoCount,
184
+ int *returnedAlgoCount,
185
+ cudnnConvolutionFwdAlgoPerf_t *perfResults);
186
+
187
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
188
+ cudnnFindConvolutionForwardAlgorithm(cudnnHandle_t handle,
189
+ const cudnnTensorDescriptor_t xDesc,
190
+ const cudnnFilterDescriptor_t wDesc,
191
+ const cudnnConvolutionDescriptor_t convDesc,
192
+ const cudnnTensorDescriptor_t yDesc,
193
+ const int requestedAlgoCount,
194
+ int *returnedAlgoCount,
195
+ cudnnConvolutionFwdAlgoPerf_t *perfResults);
196
+
197
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
198
+ cudnnFindConvolutionForwardAlgorithmEx(cudnnHandle_t handle,
199
+ const cudnnTensorDescriptor_t xDesc,
200
+ const void *x,
201
+ const cudnnFilterDescriptor_t wDesc,
202
+ const void *w,
203
+ const cudnnConvolutionDescriptor_t convDesc,
204
+ const cudnnTensorDescriptor_t yDesc,
205
+ void *y,
206
+ const int requestedAlgoCount,
207
+ int *returnedAlgoCount,
208
+ cudnnConvolutionFwdAlgoPerf_t *perfResults,
209
+ void *workSpace,
210
+ size_t workSpaceSizeInBytes);
211
+
212
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
213
+ cudnnIm2Col(cudnnHandle_t handle,
214
+ const cudnnTensorDescriptor_t xDesc,
215
+ const void *x,
216
+ const cudnnFilterDescriptor_t wDesc,
217
+ const cudnnConvolutionDescriptor_t convDesc,
218
+ void *colBuffer);
219
+
220
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
221
+ cudnnReorderFilterAndBias(cudnnHandle_t handle,
222
+ const cudnnFilterDescriptor_t filterDesc,
223
+ cudnnReorderType_t reorderType,
224
+ const void *filterData,
225
+ void *reorderedFilterData,
226
+ int reorderBias,
227
+ const void *biasData,
228
+ void *reorderedBiasData);
229
+
230
+ /* Helper function to return the minimum size of the workspace to be passed to the convolution given an algo*/
231
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
232
+ cudnnGetConvolutionForwardWorkspaceSize(cudnnHandle_t handle,
233
+ const cudnnTensorDescriptor_t xDesc,
234
+ const cudnnFilterDescriptor_t wDesc,
235
+ const cudnnConvolutionDescriptor_t convDesc,
236
+ const cudnnTensorDescriptor_t yDesc,
237
+ cudnnConvolutionFwdAlgo_t algo,
238
+ size_t *sizeInBytes);
239
+
240
+ /* Convolution functions: All of the form "output = alpha * Op(inputs) + beta * output" */
241
+
242
+ /* Function to perform the forward pass for batch convolution */
243
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
244
+ cudnnConvolutionForward(cudnnHandle_t handle,
245
+ const void *alpha,
246
+ const cudnnTensorDescriptor_t xDesc,
247
+ const void *x,
248
+ const cudnnFilterDescriptor_t wDesc,
249
+ const void *w,
250
+ const cudnnConvolutionDescriptor_t convDesc,
251
+ cudnnConvolutionFwdAlgo_t algo,
252
+ void *workSpace,
253
+ size_t workSpaceSizeInBytes,
254
+ const void *beta,
255
+ const cudnnTensorDescriptor_t yDesc,
256
+ void *y);
257
+
258
+ /* Fused conv/bias/activation operation : y = Act( alpha1 * conv(x) + alpha2 * z + bias ) */
259
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
260
+ cudnnConvolutionBiasActivationForward(cudnnHandle_t handle,
261
+ const void *alpha1,
262
+ const cudnnTensorDescriptor_t xDesc,
263
+ const void *x,
264
+ const cudnnFilterDescriptor_t wDesc,
265
+ const void *w,
266
+ const cudnnConvolutionDescriptor_t convDesc,
267
+ cudnnConvolutionFwdAlgo_t algo,
268
+ void *workSpace,
269
+ size_t workSpaceSizeInBytes,
270
+ const void *alpha2,
271
+ const cudnnTensorDescriptor_t zDesc,
272
+ const void *z,
273
+ const cudnnTensorDescriptor_t biasDesc,
274
+ const void *bias,
275
+ const cudnnActivationDescriptor_t activationDesc,
276
+ const cudnnTensorDescriptor_t yDesc,
277
+ void *y);
278
+
279
+ /* helper function to provide the convolution backward data algo that fit best the requirement */
280
+
281
+ typedef struct cudnnConvolutionBwdDataAlgoPerfStruct {
282
+ cudnnConvolutionBwdDataAlgo_t algo;
283
+ cudnnStatus_t status;
284
+ float time;
285
+ size_t memory;
286
+ cudnnDeterminism_t determinism;
287
+ cudnnMathType_t mathType;
288
+ int reserved[3];
289
+ } cudnnConvolutionBwdDataAlgoPerf_t CUDNN_DEPRECATED;
290
+
291
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
292
+ cudnnGetConvolutionBackwardDataAlgorithmMaxCount(cudnnHandle_t handle, int *count);
293
+
294
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
295
+ cudnnFindConvolutionBackwardDataAlgorithm(cudnnHandle_t handle,
296
+ const cudnnFilterDescriptor_t wDesc,
297
+ const cudnnTensorDescriptor_t dyDesc,
298
+ const cudnnConvolutionDescriptor_t convDesc,
299
+ const cudnnTensorDescriptor_t dxDesc,
300
+ const int requestedAlgoCount,
301
+ int *returnedAlgoCount,
302
+ cudnnConvolutionBwdDataAlgoPerf_t *perfResults);
303
+
304
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
305
+ cudnnFindConvolutionBackwardDataAlgorithmEx(cudnnHandle_t handle,
306
+ const cudnnFilterDescriptor_t wDesc,
307
+ const void *w,
308
+ const cudnnTensorDescriptor_t dyDesc,
309
+ const void *dy,
310
+ const cudnnConvolutionDescriptor_t convDesc,
311
+ const cudnnTensorDescriptor_t dxDesc,
312
+ void *dx,
313
+ const int requestedAlgoCount,
314
+ int *returnedAlgoCount,
315
+ cudnnConvolutionBwdDataAlgoPerf_t *perfResults,
316
+ void *workSpace,
317
+ size_t workSpaceSizeInBytes);
318
+
319
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
320
+ cudnnGetConvolutionBackwardDataAlgorithm_v7(cudnnHandle_t handle,
321
+ const cudnnFilterDescriptor_t filterDesc,
322
+ const cudnnTensorDescriptor_t diffDesc,
323
+ const cudnnConvolutionDescriptor_t convDesc,
324
+ const cudnnTensorDescriptor_t gradDesc,
325
+ const int requestedAlgoCount,
326
+ int *returnedAlgoCount,
327
+ cudnnConvolutionBwdDataAlgoPerf_t *perfResults);
328
+
329
+ /*
330
+ * convolution algorithm (which requires potentially some workspace)
331
+ */
332
+
333
+ /* Helper function to return the minimum size of the workspace to be passed to the convolution given an algo*/
334
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
335
+ cudnnGetConvolutionBackwardDataWorkspaceSize(cudnnHandle_t handle,
336
+ const cudnnFilterDescriptor_t wDesc,
337
+ const cudnnTensorDescriptor_t dyDesc,
338
+ const cudnnConvolutionDescriptor_t convDesc,
339
+ const cudnnTensorDescriptor_t dxDesc,
340
+ cudnnConvolutionBwdDataAlgo_t algo,
341
+ size_t *sizeInBytes);
342
+
343
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
344
+ cudnnConvolutionBackwardData(cudnnHandle_t handle,
345
+ const void *alpha,
346
+ const cudnnFilterDescriptor_t wDesc,
347
+ const void *w,
348
+ const cudnnTensorDescriptor_t dyDesc,
349
+ const void *dy,
350
+ const cudnnConvolutionDescriptor_t convDesc,
351
+ cudnnConvolutionBwdDataAlgo_t algo,
352
+ void *workSpace,
353
+ size_t workSpaceSizeInBytes,
354
+ const void *beta,
355
+ const cudnnTensorDescriptor_t dxDesc,
356
+ void *dx);
357
+
358
+ /* Helper function to calculate folding descriptors for dgrad */
359
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
360
+ cudnnGetFoldedConvBackwardDataDescriptors(const cudnnHandle_t handle,
361
+ const cudnnFilterDescriptor_t filterDesc,
362
+ const cudnnTensorDescriptor_t diffDesc,
363
+ const cudnnConvolutionDescriptor_t convDesc,
364
+ const cudnnTensorDescriptor_t gradDesc,
365
+ const cudnnTensorFormat_t transformFormat,
366
+ cudnnFilterDescriptor_t foldedFilterDesc,
367
+ cudnnTensorDescriptor_t paddedDiffDesc,
368
+ cudnnConvolutionDescriptor_t foldedConvDesc,
369
+ cudnnTensorDescriptor_t foldedGradDesc,
370
+ cudnnTensorTransformDescriptor_t filterFoldTransDesc,
371
+ cudnnTensorTransformDescriptor_t diffPadTransDesc,
372
+ cudnnTensorTransformDescriptor_t gradFoldTransDesc,
373
+ cudnnTensorTransformDescriptor_t gradUnfoldTransDesc);
374
+
375
+ /* cudnnFusedOps... */
376
+ struct cudnnFusedOpsConstParamStruct;
377
+ typedef struct cudnnFusedOpsConstParamStruct *cudnnFusedOpsConstParamPack_t CUDNN_DEPRECATED;
378
+
379
+ struct cudnnFusedOpsVariantParamStruct;
380
+ typedef struct cudnnFusedOpsVariantParamStruct *cudnnFusedOpsVariantParamPack_t CUDNN_DEPRECATED;
381
+
382
+ struct cudnnFusedOpsPlanStruct;
383
+ typedef struct cudnnFusedOpsPlanStruct *cudnnFusedOpsPlan_t CUDNN_DEPRECATED;
384
+
385
+ typedef enum {
386
+ /* each op in [ ] can be disabled by passing NULL ptr */
387
+ /* [per channel scale], [per channel bias], [activation], convolution, [generate BN stats] */
388
+ CUDNN_FUSED_SCALE_BIAS_ACTIVATION_CONV_BNSTATS = 0,
389
+ /* [per channel scale], [per channel bias], [activation], convolutionBackwardWeights */
390
+ CUDNN_FUSED_SCALE_BIAS_ACTIVATION_WGRAD = 1,
391
+ /* utility for BN training in BN-conv fusion */
392
+ /* computes the equivalent scale and bias from ySum ySqSum and learned scale, bias */
393
+ /* optionally update running stats and generate saved stats */
394
+ CUDNN_FUSED_BN_FINALIZE_STATISTICS_TRAINING = 2,
395
+ /* utility for BN inference in BN-conv fusion */
396
+ /* computes the equivalent scale and bias from learned running stats and learned scale, bias */
397
+ CUDNN_FUSED_BN_FINALIZE_STATISTICS_INFERENCE = 3,
398
+ /* reserved for future use: convolution, [per channel scale], [per channel bias], [residual add], [activation] */
399
+ CUDNN_FUSED_CONV_SCALE_BIAS_ADD_ACTIVATION = 4,
400
+ /* reserved for future use: [per channel scale], [per channel bias], [residual add], activation, bitmask */
401
+ CUDNN_FUSED_SCALE_BIAS_ADD_ACTIVATION_GEN_BITMASK = 5,
402
+ /* reserved for future use */
403
+ CUDNN_FUSED_DACTIVATION_FORK_DBATCHNORM = 6,
404
+ } cudnnFusedOps_t CUDNN_DEPRECATED;
405
+
406
+ typedef enum {
407
+ /* set XDESC: pass previously initialized cudnnTensorDescriptor_t */
408
+ /* get XDESC: pass previously created cudnnTensorDescriptor_t */
409
+ CUDNN_PARAM_XDESC = 0,
410
+ /* set/get XDATA_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
411
+ CUDNN_PARAM_XDATA_PLACEHOLDER = 1,
412
+ /* set/get BN_MODE: pass cudnnBatchNormMode_t* */
413
+ CUDNN_PARAM_BN_MODE = 2,
414
+ /* set CUDNN_PARAM_BN_EQSCALEBIAS_DESC: pass previously initialized cudnnTensorDescriptor_t */
415
+ /* get CUDNN_PARAM_BN_EQSCALEBIAS_DESC: pass previously created cudnnTensorDescriptor_t */
416
+ CUDNN_PARAM_BN_EQSCALEBIAS_DESC = 3,
417
+ /* set/get BN_EQSCALE_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
418
+ CUDNN_PARAM_BN_EQSCALE_PLACEHOLDER = 4,
419
+ /* set/get BN_EQBIAS_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
420
+ CUDNN_PARAM_BN_EQBIAS_PLACEHOLDER = 5,
421
+ /* set ACTIVATION_DESC: pass previously initialized cudnnActivationDescriptor_t */
422
+ /* get ACTIVATION_DESC: pass previously created cudnnActivationDescriptor_t */
423
+ CUDNN_PARAM_ACTIVATION_DESC = 6,
424
+ /* set CONV_DESC: pass previously initialized cudnnConvolutionDescriptor_t */
425
+ /* get CONV_DESC: pass previously created cudnnConvolutionDescriptor_t */
426
+ CUDNN_PARAM_CONV_DESC = 7,
427
+ /* set WDESC: pass previously initialized cudnnFilterDescriptor_t */
428
+ /* get WDESC: pass previously created cudnnFilterDescriptor_t */
429
+ CUDNN_PARAM_WDESC = 8,
430
+ /* set/get WDATA_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
431
+ CUDNN_PARAM_WDATA_PLACEHOLDER = 9,
432
+ /* set DWDESC: pass previously initialized cudnnFilterDescriptor_t */
433
+ /* get DWDESC: pass previously created cudnnFilterDescriptor_t */
434
+ CUDNN_PARAM_DWDESC = 10,
435
+ /* set/get DWDATA_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
436
+ CUDNN_PARAM_DWDATA_PLACEHOLDER = 11,
437
+ /* set YDESC: pass previously initialized cudnnTensorDescriptor_t */
438
+ /* get YDESC: pass previously created cudnnTensorDescriptor_t */
439
+ CUDNN_PARAM_YDESC = 12,
440
+ /* set/get YDATA_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
441
+ CUDNN_PARAM_YDATA_PLACEHOLDER = 13,
442
+ /* set DYDESC: pass previously initialized cudnnTensorDescriptor_t */
443
+ /* get DYDESC: pass previously created cudnnTensorDescriptor_t */
444
+ CUDNN_PARAM_DYDESC = 14,
445
+ /* set/get DYDATA_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
446
+ CUDNN_PARAM_DYDATA_PLACEHOLDER = 15,
447
+ /* set YSTATS_DESC: pass previously initialized cudnnTensorDescriptor_t */
448
+ /* get YSTATS_DESC: pass previously created cudnnTensorDescriptor_t */
449
+ CUDNN_PARAM_YSTATS_DESC = 16,
450
+ /* set/get YSUM_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
451
+ CUDNN_PARAM_YSUM_PLACEHOLDER = 17,
452
+ /* set/get YSQSUM_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
453
+ CUDNN_PARAM_YSQSUM_PLACEHOLDER = 18,
454
+ /* set CUDNN_PARAM_BN_SCALEBIAS_MEANVAR_DESC: pass previously initialized cudnnTensorDescriptor_t */
455
+ /* get CUDNN_PARAM_BN_SCALEBIAS_MEANVAR_DESC: pass previously created cudnnTensorDescriptor_t */
456
+ CUDNN_PARAM_BN_SCALEBIAS_MEANVAR_DESC = 19,
457
+ /* set/get CUDNN_PARAM_BN_SCALE_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
458
+ CUDNN_PARAM_BN_SCALE_PLACEHOLDER = 20,
459
+ /* set/get CUDNN_PARAM_BN_BIAS_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
460
+ CUDNN_PARAM_BN_BIAS_PLACEHOLDER = 21,
461
+ /* set/get CUDNN_PARAM_BN_SAVED_MEAN_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
462
+ CUDNN_PARAM_BN_SAVED_MEAN_PLACEHOLDER = 22,
463
+ /* set/get CUDNN_PARAM_BN_SAVED_INVSTD_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
464
+ CUDNN_PARAM_BN_SAVED_INVSTD_PLACEHOLDER = 23,
465
+ /* set/get CUDNN_PARAM_BN_RUNNING_MEAN_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
466
+ CUDNN_PARAM_BN_RUNNING_MEAN_PLACEHOLDER = 24,
467
+ /* set/get CUDNN_PARAM_BN_RUNNING_VAR_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
468
+ CUDNN_PARAM_BN_RUNNING_VAR_PLACEHOLDER = 25,
469
+
470
+ /* set ZDESC: pass previously initialized cudnnTensorDescriptor_t */
471
+ /* get ZDESC: pass previously created cudnnTensorDescriptor_t */
472
+ CUDNN_PARAM_ZDESC = 26,
473
+ /* set/get ZDATA_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
474
+ CUDNN_PARAM_ZDATA_PLACEHOLDER = 27,
475
+ /* set BN_Z_EQSCALEBIAS_DESC: pass previously initialized cudnnTensorDescriptor_t */
476
+ /* get BN_Z_EQSCALEBIAS_DESC: pass previously created cudnnTensorDescriptor_t */
477
+ CUDNN_PARAM_BN_Z_EQSCALEBIAS_DESC = 28,
478
+ /* set/get BN_Z_EQSCALE_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
479
+ CUDNN_PARAM_BN_Z_EQSCALE_PLACEHOLDER = 29,
480
+ /* set/get BN_Z_EQBIAS_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
481
+ CUDNN_PARAM_BN_Z_EQBIAS_PLACEHOLDER = 30,
482
+
483
+ /* set ACTIVATION_BITMASK_DESC: pass previously initialized cudnnTensorDescriptor_t */
484
+ /* get ACTIVATION_BITMASK_DESC: pass previously created cudnnTensorDescriptor_t */
485
+ CUDNN_PARAM_ACTIVATION_BITMASK_DESC = 31,
486
+ /* set/get ACTIVATION_BITMASK_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
487
+ CUDNN_PARAM_ACTIVATION_BITMASK_PLACEHOLDER = 32,
488
+
489
+ /* set DXDESC: pass previously initialized cudnnTensorDescriptor_t */
490
+ /* get DXDESC: pass previously created cudnnTensorDescriptor_t */
491
+ CUDNN_PARAM_DXDESC = 33,
492
+ /* set/get DXDATA_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
493
+ CUDNN_PARAM_DXDATA_PLACEHOLDER = 34,
494
+ /* set DZDESC: pass previously initialized cudnnTensorDescriptor_t */
495
+ /* get DZDESC: pass previously created cudnnTensorDescriptor_t */
496
+ CUDNN_PARAM_DZDESC = 35,
497
+ /* set/get DZDATA_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
498
+ CUDNN_PARAM_DZDATA_PLACEHOLDER = 36,
499
+ /* set/get CUDNN_PARAM_BN_DSCALE_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
500
+ CUDNN_PARAM_BN_DSCALE_PLACEHOLDER = 37,
501
+ /* set/get CUDNN_PARAM_BN_DBIAS_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
502
+ CUDNN_PARAM_BN_DBIAS_PLACEHOLDER = 38,
503
+ } cudnnFusedOpsConstParamLabel_t CUDNN_DEPRECATED;
504
+
505
+ typedef enum {
506
+ CUDNN_PTR_NULL = 0,
507
+ CUDNN_PTR_ELEM_ALIGNED = 1,
508
+ CUDNN_PTR_16B_ALIGNED = 2,
509
+ } cudnnFusedOpsPointerPlaceHolder_t CUDNN_DEPRECATED;
510
+
511
+ typedef enum {
512
+ /* set: pass void* pointing to dev memory */
513
+ /* get: pass void** pointing to host memory */
514
+ CUDNN_PTR_XDATA = 0,
515
+ CUDNN_PTR_BN_EQSCALE = 1,
516
+ CUDNN_PTR_BN_EQBIAS = 2,
517
+ CUDNN_PTR_WDATA = 3,
518
+ CUDNN_PTR_DWDATA = 4,
519
+ CUDNN_PTR_YDATA = 5,
520
+ CUDNN_PTR_DYDATA = 6,
521
+ CUDNN_PTR_YSUM = 7,
522
+ CUDNN_PTR_YSQSUM = 8,
523
+ CUDNN_PTR_WORKSPACE = 9,
524
+ CUDNN_PTR_BN_SCALE = 10,
525
+ CUDNN_PTR_BN_BIAS = 11,
526
+ CUDNN_PTR_BN_SAVED_MEAN = 12,
527
+ CUDNN_PTR_BN_SAVED_INVSTD = 13,
528
+ CUDNN_PTR_BN_RUNNING_MEAN = 14,
529
+ CUDNN_PTR_BN_RUNNING_VAR = 15,
530
+ CUDNN_PTR_ZDATA = 16,
531
+ CUDNN_PTR_BN_Z_EQSCALE = 17,
532
+ CUDNN_PTR_BN_Z_EQBIAS = 18,
533
+ CUDNN_PTR_ACTIVATION_BITMASK = 19,
534
+ CUDNN_PTR_DXDATA = 20,
535
+ CUDNN_PTR_DZDATA = 21,
536
+ CUDNN_PTR_BN_DSCALE = 22,
537
+ CUDNN_PTR_BN_DBIAS = 23,
538
+
539
+ /* set/get: pass size_t* pointing to host memory */
540
+ CUDNN_SCALAR_SIZE_T_WORKSPACE_SIZE_IN_BYTES = 100,
541
+ /* set/get: pass int64_t* pointing to host memory */
542
+ CUDNN_SCALAR_INT64_T_BN_ACCUMULATION_COUNT = 101,
543
+ /* set/get: pass double* pointing to host memory */
544
+ CUDNN_SCALAR_DOUBLE_BN_EXP_AVG_FACTOR = 102,
545
+ /* set/get: pass double* pointing to host memory */
546
+ CUDNN_SCALAR_DOUBLE_BN_EPSILON = 103,
547
+ } cudnnFusedOpsVariantParamLabel_t CUDNN_DEPRECATED;
548
+
549
+ cudnnStatus_t CUDNNWINAPI
550
+ cudnnCnnVersionCheck(void);
551
+
552
+ /* helper function to provide the convolution backward filter algo that fit best the requirement */
553
+
554
+ typedef struct cudnnConvolutionBwdFilterAlgoPerfStruct {
555
+ cudnnConvolutionBwdFilterAlgo_t algo;
556
+ cudnnStatus_t status;
557
+ float time;
558
+ size_t memory;
559
+ cudnnDeterminism_t determinism;
560
+ cudnnMathType_t mathType;
561
+ int reserved[3];
562
+ } cudnnConvolutionBwdFilterAlgoPerf_t CUDNN_DEPRECATED;
563
+
564
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
565
+ cudnnGetConvolutionBackwardFilterAlgorithmMaxCount(cudnnHandle_t handle, int *count);
566
+
567
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
568
+ cudnnFindConvolutionBackwardFilterAlgorithm(cudnnHandle_t handle,
569
+ const cudnnTensorDescriptor_t xDesc,
570
+ const cudnnTensorDescriptor_t dyDesc,
571
+ const cudnnConvolutionDescriptor_t convDesc,
572
+ const cudnnFilterDescriptor_t dwDesc,
573
+ const int requestedAlgoCount,
574
+ int *returnedAlgoCount,
575
+ cudnnConvolutionBwdFilterAlgoPerf_t *perfResults);
576
+
577
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
578
+ cudnnFindConvolutionBackwardFilterAlgorithmEx(cudnnHandle_t handle,
579
+ const cudnnTensorDescriptor_t xDesc,
580
+ const void *x,
581
+ const cudnnTensorDescriptor_t dyDesc,
582
+ const void *y,
583
+ const cudnnConvolutionDescriptor_t convDesc,
584
+ const cudnnFilterDescriptor_t dwDesc,
585
+ void *dw,
586
+ const int requestedAlgoCount,
587
+ int *returnedAlgoCount,
588
+ cudnnConvolutionBwdFilterAlgoPerf_t *perfResults,
589
+ void *workSpace,
590
+ size_t workSpaceSizeInBytes);
591
+
592
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
593
+ cudnnGetConvolutionBackwardFilterAlgorithm_v7(cudnnHandle_t handle,
594
+ const cudnnTensorDescriptor_t srcDesc,
595
+ const cudnnTensorDescriptor_t diffDesc,
596
+ const cudnnConvolutionDescriptor_t convDesc,
597
+ const cudnnFilterDescriptor_t gradDesc,
598
+ const int requestedAlgoCount,
599
+ int *returnedAlgoCount,
600
+ cudnnConvolutionBwdFilterAlgoPerf_t *perfResults);
601
+
602
+ /*
603
+ * convolution algorithm (which requires potentially some workspace)
604
+ */
605
+
606
+ /* Helper function to return the minimum size of the workspace to be passed to the convolution given an algo*/
607
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
608
+ cudnnGetConvolutionBackwardFilterWorkspaceSize(cudnnHandle_t handle,
609
+ const cudnnTensorDescriptor_t xDesc,
610
+ const cudnnTensorDescriptor_t dyDesc,
611
+ const cudnnConvolutionDescriptor_t convDesc,
612
+ const cudnnFilterDescriptor_t gradDesc,
613
+ cudnnConvolutionBwdFilterAlgo_t algo,
614
+ size_t *sizeInBytes);
615
+
616
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
617
+ cudnnConvolutionBackwardFilter(cudnnHandle_t handle,
618
+ const void *alpha,
619
+ const cudnnTensorDescriptor_t xDesc,
620
+ const void *x,
621
+ const cudnnTensorDescriptor_t dyDesc,
622
+ const void *dy,
623
+ const cudnnConvolutionDescriptor_t convDesc,
624
+ cudnnConvolutionBwdFilterAlgo_t algo,
625
+ void *workSpace,
626
+ size_t workSpaceSizeInBytes,
627
+ const void *beta,
628
+ const cudnnFilterDescriptor_t dwDesc,
629
+ void *dw);
630
+
631
+ /* Function to compute the bias gradient for batch convolution */
632
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
633
+ cudnnConvolutionBackwardBias(cudnnHandle_t handle,
634
+ const void *alpha,
635
+ const cudnnTensorDescriptor_t dyDesc,
636
+ const void *dy,
637
+ const void *beta,
638
+ const cudnnTensorDescriptor_t dbDesc,
639
+ void *db);
640
+
641
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
642
+ cudnnCreateFusedOpsConstParamPack(cudnnFusedOpsConstParamPack_t *constPack, cudnnFusedOps_t ops);
643
+
644
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
645
+ cudnnDestroyFusedOpsConstParamPack(cudnnFusedOpsConstParamPack_t constPack);
646
+
647
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
648
+ cudnnSetFusedOpsConstParamPackAttribute(cudnnFusedOpsConstParamPack_t constPack,
649
+ cudnnFusedOpsConstParamLabel_t paramLabel,
650
+ const void *param);
651
+
652
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
653
+ cudnnGetFusedOpsConstParamPackAttribute(const cudnnFusedOpsConstParamPack_t constPack,
654
+ cudnnFusedOpsConstParamLabel_t paramLabel,
655
+ void *param,
656
+ int *isNULL);
657
+
658
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
659
+ cudnnCreateFusedOpsVariantParamPack(cudnnFusedOpsVariantParamPack_t *varPack, cudnnFusedOps_t ops);
660
+
661
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
662
+ cudnnDestroyFusedOpsVariantParamPack(cudnnFusedOpsVariantParamPack_t varPack);
663
+
664
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
665
+ cudnnSetFusedOpsVariantParamPackAttribute(cudnnFusedOpsVariantParamPack_t varPack,
666
+ cudnnFusedOpsVariantParamLabel_t paramLabel,
667
+ void *ptr);
668
+
669
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
670
+ cudnnGetFusedOpsVariantParamPackAttribute(const cudnnFusedOpsVariantParamPack_t varPack,
671
+ cudnnFusedOpsVariantParamLabel_t paramLabel,
672
+ void *ptr);
673
+
674
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
675
+ cudnnCreateFusedOpsPlan(cudnnFusedOpsPlan_t *plan, cudnnFusedOps_t ops);
676
+
677
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
678
+ cudnnDestroyFusedOpsPlan(cudnnFusedOpsPlan_t plan);
679
+
680
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
681
+ cudnnMakeFusedOpsPlan(cudnnHandle_t handle,
682
+ cudnnFusedOpsPlan_t plan,
683
+ const cudnnFusedOpsConstParamPack_t constPack,
684
+ size_t *workspaceSizeInBytes);
685
+
686
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
687
+ cudnnFusedOpsExecute(cudnnHandle_t handle, const cudnnFusedOpsPlan_t plan, cudnnFusedOpsVariantParamPack_t varPack);
688
+
689
+ #if defined(__cplusplus)
690
+ }
691
+ #endif
692
+
693
+ #endif /* CUDNN_CNN_H_ */
lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_cnn_v9.h ADDED
@@ -0,0 +1,693 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright 2014-2023 NVIDIA Corporation. All rights reserved.
3
+ *
4
+ * NOTICE TO LICENSEE:
5
+ *
6
+ * This source code and/or documentation ("Licensed Deliverables") are
7
+ * subject to NVIDIA intellectual property rights under U.S. and
8
+ * international Copyright laws.
9
+ *
10
+ * These Licensed Deliverables contained herein is PROPRIETARY and
11
+ * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12
+ * conditions of a form of NVIDIA software license agreement by and
13
+ * between NVIDIA and Licensee ("License Agreement") or electronically
14
+ * accepted by Licensee. Notwithstanding any terms or conditions to
15
+ * the contrary in the License Agreement, reproduction or disclosure
16
+ * of the Licensed Deliverables to any third party without the express
17
+ * written consent of NVIDIA is prohibited.
18
+ *
19
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20
+ * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21
+ * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
22
+ * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23
+ * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24
+ * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25
+ * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27
+ * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28
+ * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32
+ * OF THESE LICENSED DELIVERABLES.
33
+ *
34
+ * U.S. Government End Users. These Licensed Deliverables are a
35
+ * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36
+ * 1995), consisting of "commercial computer software" and "commercial
37
+ * computer software documentation" as such terms are used in 48
38
+ * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39
+ * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40
+ * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41
+ * U.S. Government End Users acquire the Licensed Deliverables with
42
+ * only those rights set forth herein.
43
+ *
44
+ * Any use of the Licensed Deliverables in individual and commercial
45
+ * software must include, in the user documentation and internal
46
+ * comments to the code, the above Disclaimer and U.S. Government End
47
+ * Users Notice.
48
+ */
49
+
50
+ /*
51
+ * cudnn_cnn : cuDNN's basic definitions and CNN functions.
52
+ */
53
+
54
+ #if !defined(CUDNN_CNN_H_)
55
+ #define CUDNN_CNN_H_
56
+
57
+ #pragma once
58
+ #include <stdint.h>
59
+
60
+ #include "cudnn_version.h"
61
+ #include "cudnn_ops.h"
62
+
63
+ /* These version numbers are autogenerated, do not edit manually. */
64
+ #define CUDNN_CNN_MAJOR 9
65
+ #define CUDNN_CNN_MINOR 1
66
+ #define CUDNN_CNN_PATCH 0
67
+
68
+ #if (CUDNN_CNN_MAJOR != CUDNN_MAJOR) || (CUDNN_CNN_MINOR != CUDNN_MINOR) || (CUDNN_CNN_PATCH != CUDNN_PATCHLEVEL)
69
+ #error Version mismatch in cuDNN CNN INFER!!!
70
+ #endif
71
+
72
+ #if defined(__cplusplus)
73
+ extern "C" {
74
+ #endif
75
+
76
+ typedef struct cudnnConvolutionStruct *cudnnConvolutionDescriptor_t CUDNN_DEPRECATED;
77
+
78
+ typedef struct cudnnConvolutionFwdAlgoPerfStruct {
79
+ cudnnConvolutionFwdAlgo_t algo;
80
+ cudnnStatus_t status;
81
+ float time;
82
+ size_t memory;
83
+ cudnnDeterminism_t determinism;
84
+ cudnnMathType_t mathType;
85
+ int reserved[3];
86
+ } cudnnConvolutionFwdAlgoPerf_t CUDNN_DEPRECATED;
87
+
88
+ /* Create an instance of convolution descriptor */
89
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
90
+ cudnnCreateConvolutionDescriptor(cudnnConvolutionDescriptor_t *convDesc);
91
+
92
+ /* Destroy an instance of convolution descriptor */
93
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
94
+ cudnnDestroyConvolutionDescriptor(cudnnConvolutionDescriptor_t convDesc);
95
+
96
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
97
+ cudnnSetConvolutionMathType(cudnnConvolutionDescriptor_t convDesc, cudnnMathType_t mathType);
98
+
99
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
100
+ cudnnGetConvolutionMathType(cudnnConvolutionDescriptor_t convDesc, cudnnMathType_t *mathType);
101
+
102
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
103
+ cudnnSetConvolutionGroupCount(cudnnConvolutionDescriptor_t convDesc, int groupCount);
104
+
105
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
106
+ cudnnGetConvolutionGroupCount(cudnnConvolutionDescriptor_t convDesc, int *groupCount);
107
+
108
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
109
+ cudnnSetConvolutionReorderType(cudnnConvolutionDescriptor_t convDesc, cudnnReorderType_t reorderType);
110
+
111
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
112
+ cudnnGetConvolutionReorderType(cudnnConvolutionDescriptor_t convDesc, cudnnReorderType_t *reorderType);
113
+
114
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
115
+ cudnnSetConvolution2dDescriptor(cudnnConvolutionDescriptor_t convDesc,
116
+ int pad_h, /* zero-padding height */
117
+ int pad_w, /* zero-padding width */
118
+ int u, /* vertical filter stride */
119
+ int v, /* horizontal filter stride */
120
+ int dilation_h, /* filter dilation in the vertical dimension */
121
+ int dilation_w, /* filter dilation in the horizontal dimension */
122
+ cudnnConvolutionMode_t mode,
123
+ cudnnDataType_t computeType);
124
+
125
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
126
+ cudnnGetConvolution2dDescriptor(const cudnnConvolutionDescriptor_t convDesc,
127
+ int *pad_h, /* zero-padding height */
128
+ int *pad_w, /* zero-padding width */
129
+ int *u, /* vertical filter stride */
130
+ int *v, /* horizontal filter stride */
131
+ int *dilation_h, /* filter dilation in the vertical dimension */
132
+ int *dilation_w, /* filter dilation in the horizontal dimension */
133
+ cudnnConvolutionMode_t *mode,
134
+ cudnnDataType_t *computeType);
135
+
136
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
137
+ cudnnSetConvolutionNdDescriptor(cudnnConvolutionDescriptor_t convDesc,
138
+ int arrayLength, /* nbDims-2 size */
139
+ const int padA[],
140
+ const int filterStrideA[],
141
+ const int dilationA[],
142
+ cudnnConvolutionMode_t mode,
143
+ cudnnDataType_t computeType); /* convolution data type */
144
+
145
+ /* Helper function to return the dimensions of the output tensor given a convolution descriptor */
146
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
147
+ cudnnGetConvolutionNdDescriptor(const cudnnConvolutionDescriptor_t convDesc,
148
+ int arrayLengthRequested,
149
+ int *arrayLength,
150
+ int padA[],
151
+ int strideA[],
152
+ int dilationA[],
153
+ cudnnConvolutionMode_t *mode,
154
+ cudnnDataType_t *computeType); /* convolution data type */
155
+
156
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
157
+ cudnnGetConvolution2dForwardOutputDim(const cudnnConvolutionDescriptor_t convDesc,
158
+ const cudnnTensorDescriptor_t inputTensorDesc,
159
+ const cudnnFilterDescriptor_t filterDesc,
160
+ int *n,
161
+ int *c,
162
+ int *h,
163
+ int *w);
164
+
165
+ /* Helper function to return the dimensions of the output tensor given a convolution descriptor */
166
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
167
+ cudnnGetConvolutionNdForwardOutputDim(const cudnnConvolutionDescriptor_t convDesc,
168
+ const cudnnTensorDescriptor_t inputTensorDesc,
169
+ const cudnnFilterDescriptor_t filterDesc,
170
+ int nbDims,
171
+ int tensorOuputDimA[]);
172
+
173
+ /* helper function to provide the convolution forward algo that fit best the requirement */
174
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
175
+ cudnnGetConvolutionForwardAlgorithmMaxCount(cudnnHandle_t handle, int *count);
176
+
177
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
178
+ cudnnGetConvolutionForwardAlgorithm_v7(cudnnHandle_t handle,
179
+ const cudnnTensorDescriptor_t srcDesc,
180
+ const cudnnFilterDescriptor_t filterDesc,
181
+ const cudnnConvolutionDescriptor_t convDesc,
182
+ const cudnnTensorDescriptor_t destDesc,
183
+ const int requestedAlgoCount,
184
+ int *returnedAlgoCount,
185
+ cudnnConvolutionFwdAlgoPerf_t *perfResults);
186
+
187
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
188
+ cudnnFindConvolutionForwardAlgorithm(cudnnHandle_t handle,
189
+ const cudnnTensorDescriptor_t xDesc,
190
+ const cudnnFilterDescriptor_t wDesc,
191
+ const cudnnConvolutionDescriptor_t convDesc,
192
+ const cudnnTensorDescriptor_t yDesc,
193
+ const int requestedAlgoCount,
194
+ int *returnedAlgoCount,
195
+ cudnnConvolutionFwdAlgoPerf_t *perfResults);
196
+
197
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
198
+ cudnnFindConvolutionForwardAlgorithmEx(cudnnHandle_t handle,
199
+ const cudnnTensorDescriptor_t xDesc,
200
+ const void *x,
201
+ const cudnnFilterDescriptor_t wDesc,
202
+ const void *w,
203
+ const cudnnConvolutionDescriptor_t convDesc,
204
+ const cudnnTensorDescriptor_t yDesc,
205
+ void *y,
206
+ const int requestedAlgoCount,
207
+ int *returnedAlgoCount,
208
+ cudnnConvolutionFwdAlgoPerf_t *perfResults,
209
+ void *workSpace,
210
+ size_t workSpaceSizeInBytes);
211
+
212
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
213
+ cudnnIm2Col(cudnnHandle_t handle,
214
+ const cudnnTensorDescriptor_t xDesc,
215
+ const void *x,
216
+ const cudnnFilterDescriptor_t wDesc,
217
+ const cudnnConvolutionDescriptor_t convDesc,
218
+ void *colBuffer);
219
+
220
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
221
+ cudnnReorderFilterAndBias(cudnnHandle_t handle,
222
+ const cudnnFilterDescriptor_t filterDesc,
223
+ cudnnReorderType_t reorderType,
224
+ const void *filterData,
225
+ void *reorderedFilterData,
226
+ int reorderBias,
227
+ const void *biasData,
228
+ void *reorderedBiasData);
229
+
230
+ /* Helper function to return the minimum size of the workspace to be passed to the convolution given an algo*/
231
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
232
+ cudnnGetConvolutionForwardWorkspaceSize(cudnnHandle_t handle,
233
+ const cudnnTensorDescriptor_t xDesc,
234
+ const cudnnFilterDescriptor_t wDesc,
235
+ const cudnnConvolutionDescriptor_t convDesc,
236
+ const cudnnTensorDescriptor_t yDesc,
237
+ cudnnConvolutionFwdAlgo_t algo,
238
+ size_t *sizeInBytes);
239
+
240
+ /* Convolution functions: All of the form "output = alpha * Op(inputs) + beta * output" */
241
+
242
+ /* Function to perform the forward pass for batch convolution */
243
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
244
+ cudnnConvolutionForward(cudnnHandle_t handle,
245
+ const void *alpha,
246
+ const cudnnTensorDescriptor_t xDesc,
247
+ const void *x,
248
+ const cudnnFilterDescriptor_t wDesc,
249
+ const void *w,
250
+ const cudnnConvolutionDescriptor_t convDesc,
251
+ cudnnConvolutionFwdAlgo_t algo,
252
+ void *workSpace,
253
+ size_t workSpaceSizeInBytes,
254
+ const void *beta,
255
+ const cudnnTensorDescriptor_t yDesc,
256
+ void *y);
257
+
258
+ /* Fused conv/bias/activation operation : y = Act( alpha1 * conv(x) + alpha2 * z + bias ) */
259
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
260
+ cudnnConvolutionBiasActivationForward(cudnnHandle_t handle,
261
+ const void *alpha1,
262
+ const cudnnTensorDescriptor_t xDesc,
263
+ const void *x,
264
+ const cudnnFilterDescriptor_t wDesc,
265
+ const void *w,
266
+ const cudnnConvolutionDescriptor_t convDesc,
267
+ cudnnConvolutionFwdAlgo_t algo,
268
+ void *workSpace,
269
+ size_t workSpaceSizeInBytes,
270
+ const void *alpha2,
271
+ const cudnnTensorDescriptor_t zDesc,
272
+ const void *z,
273
+ const cudnnTensorDescriptor_t biasDesc,
274
+ const void *bias,
275
+ const cudnnActivationDescriptor_t activationDesc,
276
+ const cudnnTensorDescriptor_t yDesc,
277
+ void *y);
278
+
279
+ /* helper function to provide the convolution backward data algo that fit best the requirement */
280
+
281
+ typedef struct cudnnConvolutionBwdDataAlgoPerfStruct {
282
+ cudnnConvolutionBwdDataAlgo_t algo;
283
+ cudnnStatus_t status;
284
+ float time;
285
+ size_t memory;
286
+ cudnnDeterminism_t determinism;
287
+ cudnnMathType_t mathType;
288
+ int reserved[3];
289
+ } cudnnConvolutionBwdDataAlgoPerf_t CUDNN_DEPRECATED;
290
+
291
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
292
+ cudnnGetConvolutionBackwardDataAlgorithmMaxCount(cudnnHandle_t handle, int *count);
293
+
294
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
295
+ cudnnFindConvolutionBackwardDataAlgorithm(cudnnHandle_t handle,
296
+ const cudnnFilterDescriptor_t wDesc,
297
+ const cudnnTensorDescriptor_t dyDesc,
298
+ const cudnnConvolutionDescriptor_t convDesc,
299
+ const cudnnTensorDescriptor_t dxDesc,
300
+ const int requestedAlgoCount,
301
+ int *returnedAlgoCount,
302
+ cudnnConvolutionBwdDataAlgoPerf_t *perfResults);
303
+
304
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
305
+ cudnnFindConvolutionBackwardDataAlgorithmEx(cudnnHandle_t handle,
306
+ const cudnnFilterDescriptor_t wDesc,
307
+ const void *w,
308
+ const cudnnTensorDescriptor_t dyDesc,
309
+ const void *dy,
310
+ const cudnnConvolutionDescriptor_t convDesc,
311
+ const cudnnTensorDescriptor_t dxDesc,
312
+ void *dx,
313
+ const int requestedAlgoCount,
314
+ int *returnedAlgoCount,
315
+ cudnnConvolutionBwdDataAlgoPerf_t *perfResults,
316
+ void *workSpace,
317
+ size_t workSpaceSizeInBytes);
318
+
319
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
320
+ cudnnGetConvolutionBackwardDataAlgorithm_v7(cudnnHandle_t handle,
321
+ const cudnnFilterDescriptor_t filterDesc,
322
+ const cudnnTensorDescriptor_t diffDesc,
323
+ const cudnnConvolutionDescriptor_t convDesc,
324
+ const cudnnTensorDescriptor_t gradDesc,
325
+ const int requestedAlgoCount,
326
+ int *returnedAlgoCount,
327
+ cudnnConvolutionBwdDataAlgoPerf_t *perfResults);
328
+
329
+ /*
330
+ * convolution algorithm (which requires potentially some workspace)
331
+ */
332
+
333
+ /* Helper function to return the minimum size of the workspace to be passed to the convolution given an algo*/
334
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
335
+ cudnnGetConvolutionBackwardDataWorkspaceSize(cudnnHandle_t handle,
336
+ const cudnnFilterDescriptor_t wDesc,
337
+ const cudnnTensorDescriptor_t dyDesc,
338
+ const cudnnConvolutionDescriptor_t convDesc,
339
+ const cudnnTensorDescriptor_t dxDesc,
340
+ cudnnConvolutionBwdDataAlgo_t algo,
341
+ size_t *sizeInBytes);
342
+
343
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
344
+ cudnnConvolutionBackwardData(cudnnHandle_t handle,
345
+ const void *alpha,
346
+ const cudnnFilterDescriptor_t wDesc,
347
+ const void *w,
348
+ const cudnnTensorDescriptor_t dyDesc,
349
+ const void *dy,
350
+ const cudnnConvolutionDescriptor_t convDesc,
351
+ cudnnConvolutionBwdDataAlgo_t algo,
352
+ void *workSpace,
353
+ size_t workSpaceSizeInBytes,
354
+ const void *beta,
355
+ const cudnnTensorDescriptor_t dxDesc,
356
+ void *dx);
357
+
358
+ /* Helper function to calculate folding descriptors for dgrad */
359
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
360
+ cudnnGetFoldedConvBackwardDataDescriptors(const cudnnHandle_t handle,
361
+ const cudnnFilterDescriptor_t filterDesc,
362
+ const cudnnTensorDescriptor_t diffDesc,
363
+ const cudnnConvolutionDescriptor_t convDesc,
364
+ const cudnnTensorDescriptor_t gradDesc,
365
+ const cudnnTensorFormat_t transformFormat,
366
+ cudnnFilterDescriptor_t foldedFilterDesc,
367
+ cudnnTensorDescriptor_t paddedDiffDesc,
368
+ cudnnConvolutionDescriptor_t foldedConvDesc,
369
+ cudnnTensorDescriptor_t foldedGradDesc,
370
+ cudnnTensorTransformDescriptor_t filterFoldTransDesc,
371
+ cudnnTensorTransformDescriptor_t diffPadTransDesc,
372
+ cudnnTensorTransformDescriptor_t gradFoldTransDesc,
373
+ cudnnTensorTransformDescriptor_t gradUnfoldTransDesc);
374
+
375
+ /* cudnnFusedOps... */
376
+ struct cudnnFusedOpsConstParamStruct;
377
+ typedef struct cudnnFusedOpsConstParamStruct *cudnnFusedOpsConstParamPack_t CUDNN_DEPRECATED;
378
+
379
+ struct cudnnFusedOpsVariantParamStruct;
380
+ typedef struct cudnnFusedOpsVariantParamStruct *cudnnFusedOpsVariantParamPack_t CUDNN_DEPRECATED;
381
+
382
+ struct cudnnFusedOpsPlanStruct;
383
+ typedef struct cudnnFusedOpsPlanStruct *cudnnFusedOpsPlan_t CUDNN_DEPRECATED;
384
+
385
+ typedef enum {
386
+ /* each op in [ ] can be disabled by passing NULL ptr */
387
+ /* [per channel scale], [per channel bias], [activation], convolution, [generate BN stats] */
388
+ CUDNN_FUSED_SCALE_BIAS_ACTIVATION_CONV_BNSTATS = 0,
389
+ /* [per channel scale], [per channel bias], [activation], convolutionBackwardWeights */
390
+ CUDNN_FUSED_SCALE_BIAS_ACTIVATION_WGRAD = 1,
391
+ /* utility for BN training in BN-conv fusion */
392
+ /* computes the equivalent scale and bias from ySum ySqSum and learned scale, bias */
393
+ /* optionally update running stats and generate saved stats */
394
+ CUDNN_FUSED_BN_FINALIZE_STATISTICS_TRAINING = 2,
395
+ /* utility for BN inference in BN-conv fusion */
396
+ /* computes the equivalent scale and bias from learned running stats and learned scale, bias */
397
+ CUDNN_FUSED_BN_FINALIZE_STATISTICS_INFERENCE = 3,
398
+ /* reserved for future use: convolution, [per channel scale], [per channel bias], [residual add], [activation] */
399
+ CUDNN_FUSED_CONV_SCALE_BIAS_ADD_ACTIVATION = 4,
400
+ /* reserved for future use: [per channel scale], [per channel bias], [residual add], activation, bitmask */
401
+ CUDNN_FUSED_SCALE_BIAS_ADD_ACTIVATION_GEN_BITMASK = 5,
402
+ /* reserved for future use */
403
+ CUDNN_FUSED_DACTIVATION_FORK_DBATCHNORM = 6,
404
+ } cudnnFusedOps_t CUDNN_DEPRECATED;
405
+
406
+ typedef enum {
407
+ /* set XDESC: pass previously initialized cudnnTensorDescriptor_t */
408
+ /* get XDESC: pass previously created cudnnTensorDescriptor_t */
409
+ CUDNN_PARAM_XDESC = 0,
410
+ /* set/get XDATA_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
411
+ CUDNN_PARAM_XDATA_PLACEHOLDER = 1,
412
+ /* set/get BN_MODE: pass cudnnBatchNormMode_t* */
413
+ CUDNN_PARAM_BN_MODE = 2,
414
+ /* set CUDNN_PARAM_BN_EQSCALEBIAS_DESC: pass previously initialized cudnnTensorDescriptor_t */
415
+ /* get CUDNN_PARAM_BN_EQSCALEBIAS_DESC: pass previously created cudnnTensorDescriptor_t */
416
+ CUDNN_PARAM_BN_EQSCALEBIAS_DESC = 3,
417
+ /* set/get BN_EQSCALE_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
418
+ CUDNN_PARAM_BN_EQSCALE_PLACEHOLDER = 4,
419
+ /* set/get BN_EQBIAS_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
420
+ CUDNN_PARAM_BN_EQBIAS_PLACEHOLDER = 5,
421
+ /* set ACTIVATION_DESC: pass previously initialized cudnnActivationDescriptor_t */
422
+ /* get ACTIVATION_DESC: pass previously created cudnnActivationDescriptor_t */
423
+ CUDNN_PARAM_ACTIVATION_DESC = 6,
424
+ /* set CONV_DESC: pass previously initialized cudnnConvolutionDescriptor_t */
425
+ /* get CONV_DESC: pass previously created cudnnConvolutionDescriptor_t */
426
+ CUDNN_PARAM_CONV_DESC = 7,
427
+ /* set WDESC: pass previously initialized cudnnFilterDescriptor_t */
428
+ /* get WDESC: pass previously created cudnnFilterDescriptor_t */
429
+ CUDNN_PARAM_WDESC = 8,
430
+ /* set/get WDATA_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
431
+ CUDNN_PARAM_WDATA_PLACEHOLDER = 9,
432
+ /* set DWDESC: pass previously initialized cudnnFilterDescriptor_t */
433
+ /* get DWDESC: pass previously created cudnnFilterDescriptor_t */
434
+ CUDNN_PARAM_DWDESC = 10,
435
+ /* set/get DWDATA_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
436
+ CUDNN_PARAM_DWDATA_PLACEHOLDER = 11,
437
+ /* set YDESC: pass previously initialized cudnnTensorDescriptor_t */
438
+ /* get YDESC: pass previously created cudnnTensorDescriptor_t */
439
+ CUDNN_PARAM_YDESC = 12,
440
+ /* set/get YDATA_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
441
+ CUDNN_PARAM_YDATA_PLACEHOLDER = 13,
442
+ /* set DYDESC: pass previously initialized cudnnTensorDescriptor_t */
443
+ /* get DYDESC: pass previously created cudnnTensorDescriptor_t */
444
+ CUDNN_PARAM_DYDESC = 14,
445
+ /* set/get DYDATA_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
446
+ CUDNN_PARAM_DYDATA_PLACEHOLDER = 15,
447
+ /* set YSTATS_DESC: pass previously initialized cudnnTensorDescriptor_t */
448
+ /* get YSTATS_DESC: pass previously created cudnnTensorDescriptor_t */
449
+ CUDNN_PARAM_YSTATS_DESC = 16,
450
+ /* set/get YSUM_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
451
+ CUDNN_PARAM_YSUM_PLACEHOLDER = 17,
452
+ /* set/get YSQSUM_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
453
+ CUDNN_PARAM_YSQSUM_PLACEHOLDER = 18,
454
+ /* set CUDNN_PARAM_BN_SCALEBIAS_MEANVAR_DESC: pass previously initialized cudnnTensorDescriptor_t */
455
+ /* get CUDNN_PARAM_BN_SCALEBIAS_MEANVAR_DESC: pass previously created cudnnTensorDescriptor_t */
456
+ CUDNN_PARAM_BN_SCALEBIAS_MEANVAR_DESC = 19,
457
+ /* set/get CUDNN_PARAM_BN_SCALE_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
458
+ CUDNN_PARAM_BN_SCALE_PLACEHOLDER = 20,
459
+ /* set/get CUDNN_PARAM_BN_BIAS_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
460
+ CUDNN_PARAM_BN_BIAS_PLACEHOLDER = 21,
461
+ /* set/get CUDNN_PARAM_BN_SAVED_MEAN_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
462
+ CUDNN_PARAM_BN_SAVED_MEAN_PLACEHOLDER = 22,
463
+ /* set/get CUDNN_PARAM_BN_SAVED_INVSTD_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
464
+ CUDNN_PARAM_BN_SAVED_INVSTD_PLACEHOLDER = 23,
465
+ /* set/get CUDNN_PARAM_BN_RUNNING_MEAN_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
466
+ CUDNN_PARAM_BN_RUNNING_MEAN_PLACEHOLDER = 24,
467
+ /* set/get CUDNN_PARAM_BN_RUNNING_VAR_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
468
+ CUDNN_PARAM_BN_RUNNING_VAR_PLACEHOLDER = 25,
469
+
470
+ /* set ZDESC: pass previously initialized cudnnTensorDescriptor_t */
471
+ /* get ZDESC: pass previously created cudnnTensorDescriptor_t */
472
+ CUDNN_PARAM_ZDESC = 26,
473
+ /* set/get ZDATA_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
474
+ CUDNN_PARAM_ZDATA_PLACEHOLDER = 27,
475
+ /* set BN_Z_EQSCALEBIAS_DESC: pass previously initialized cudnnTensorDescriptor_t */
476
+ /* get BN_Z_EQSCALEBIAS_DESC: pass previously created cudnnTensorDescriptor_t */
477
+ CUDNN_PARAM_BN_Z_EQSCALEBIAS_DESC = 28,
478
+ /* set/get BN_Z_EQSCALE_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
479
+ CUDNN_PARAM_BN_Z_EQSCALE_PLACEHOLDER = 29,
480
+ /* set/get BN_Z_EQBIAS_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
481
+ CUDNN_PARAM_BN_Z_EQBIAS_PLACEHOLDER = 30,
482
+
483
+ /* set ACTIVATION_BITMASK_DESC: pass previously initialized cudnnTensorDescriptor_t */
484
+ /* get ACTIVATION_BITMASK_DESC: pass previously created cudnnTensorDescriptor_t */
485
+ CUDNN_PARAM_ACTIVATION_BITMASK_DESC = 31,
486
+ /* set/get ACTIVATION_BITMASK_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
487
+ CUDNN_PARAM_ACTIVATION_BITMASK_PLACEHOLDER = 32,
488
+
489
+ /* set DXDESC: pass previously initialized cudnnTensorDescriptor_t */
490
+ /* get DXDESC: pass previously created cudnnTensorDescriptor_t */
491
+ CUDNN_PARAM_DXDESC = 33,
492
+ /* set/get DXDATA_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
493
+ CUDNN_PARAM_DXDATA_PLACEHOLDER = 34,
494
+ /* set DZDESC: pass previously initialized cudnnTensorDescriptor_t */
495
+ /* get DZDESC: pass previously created cudnnTensorDescriptor_t */
496
+ CUDNN_PARAM_DZDESC = 35,
497
+ /* set/get DZDATA_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
498
+ CUDNN_PARAM_DZDATA_PLACEHOLDER = 36,
499
+ /* set/get CUDNN_PARAM_BN_DSCALE_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
500
+ CUDNN_PARAM_BN_DSCALE_PLACEHOLDER = 37,
501
+ /* set/get CUDNN_PARAM_BN_DBIAS_PLACEHOLDER: pass cudnnFusedOpsPointerPlaceHolder_t* */
502
+ CUDNN_PARAM_BN_DBIAS_PLACEHOLDER = 38,
503
+ } cudnnFusedOpsConstParamLabel_t CUDNN_DEPRECATED;
504
+
505
+ typedef enum {
506
+ CUDNN_PTR_NULL = 0,
507
+ CUDNN_PTR_ELEM_ALIGNED = 1,
508
+ CUDNN_PTR_16B_ALIGNED = 2,
509
+ } cudnnFusedOpsPointerPlaceHolder_t CUDNN_DEPRECATED;
510
+
511
+ typedef enum {
512
+ /* set: pass void* pointing to dev memory */
513
+ /* get: pass void** pointing to host memory */
514
+ CUDNN_PTR_XDATA = 0,
515
+ CUDNN_PTR_BN_EQSCALE = 1,
516
+ CUDNN_PTR_BN_EQBIAS = 2,
517
+ CUDNN_PTR_WDATA = 3,
518
+ CUDNN_PTR_DWDATA = 4,
519
+ CUDNN_PTR_YDATA = 5,
520
+ CUDNN_PTR_DYDATA = 6,
521
+ CUDNN_PTR_YSUM = 7,
522
+ CUDNN_PTR_YSQSUM = 8,
523
+ CUDNN_PTR_WORKSPACE = 9,
524
+ CUDNN_PTR_BN_SCALE = 10,
525
+ CUDNN_PTR_BN_BIAS = 11,
526
+ CUDNN_PTR_BN_SAVED_MEAN = 12,
527
+ CUDNN_PTR_BN_SAVED_INVSTD = 13,
528
+ CUDNN_PTR_BN_RUNNING_MEAN = 14,
529
+ CUDNN_PTR_BN_RUNNING_VAR = 15,
530
+ CUDNN_PTR_ZDATA = 16,
531
+ CUDNN_PTR_BN_Z_EQSCALE = 17,
532
+ CUDNN_PTR_BN_Z_EQBIAS = 18,
533
+ CUDNN_PTR_ACTIVATION_BITMASK = 19,
534
+ CUDNN_PTR_DXDATA = 20,
535
+ CUDNN_PTR_DZDATA = 21,
536
+ CUDNN_PTR_BN_DSCALE = 22,
537
+ CUDNN_PTR_BN_DBIAS = 23,
538
+
539
+ /* set/get: pass size_t* pointing to host memory */
540
+ CUDNN_SCALAR_SIZE_T_WORKSPACE_SIZE_IN_BYTES = 100,
541
+ /* set/get: pass int64_t* pointing to host memory */
542
+ CUDNN_SCALAR_INT64_T_BN_ACCUMULATION_COUNT = 101,
543
+ /* set/get: pass double* pointing to host memory */
544
+ CUDNN_SCALAR_DOUBLE_BN_EXP_AVG_FACTOR = 102,
545
+ /* set/get: pass double* pointing to host memory */
546
+ CUDNN_SCALAR_DOUBLE_BN_EPSILON = 103,
547
+ } cudnnFusedOpsVariantParamLabel_t CUDNN_DEPRECATED;
548
+
549
+ cudnnStatus_t CUDNNWINAPI
550
+ cudnnCnnVersionCheck(void);
551
+
552
+ /* helper function to provide the convolution backward filter algo that fit best the requirement */
553
+
554
+ typedef struct cudnnConvolutionBwdFilterAlgoPerfStruct {
555
+ cudnnConvolutionBwdFilterAlgo_t algo;
556
+ cudnnStatus_t status;
557
+ float time;
558
+ size_t memory;
559
+ cudnnDeterminism_t determinism;
560
+ cudnnMathType_t mathType;
561
+ int reserved[3];
562
+ } cudnnConvolutionBwdFilterAlgoPerf_t CUDNN_DEPRECATED;
563
+
564
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
565
+ cudnnGetConvolutionBackwardFilterAlgorithmMaxCount(cudnnHandle_t handle, int *count);
566
+
567
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
568
+ cudnnFindConvolutionBackwardFilterAlgorithm(cudnnHandle_t handle,
569
+ const cudnnTensorDescriptor_t xDesc,
570
+ const cudnnTensorDescriptor_t dyDesc,
571
+ const cudnnConvolutionDescriptor_t convDesc,
572
+ const cudnnFilterDescriptor_t dwDesc,
573
+ const int requestedAlgoCount,
574
+ int *returnedAlgoCount,
575
+ cudnnConvolutionBwdFilterAlgoPerf_t *perfResults);
576
+
577
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
578
+ cudnnFindConvolutionBackwardFilterAlgorithmEx(cudnnHandle_t handle,
579
+ const cudnnTensorDescriptor_t xDesc,
580
+ const void *x,
581
+ const cudnnTensorDescriptor_t dyDesc,
582
+ const void *y,
583
+ const cudnnConvolutionDescriptor_t convDesc,
584
+ const cudnnFilterDescriptor_t dwDesc,
585
+ void *dw,
586
+ const int requestedAlgoCount,
587
+ int *returnedAlgoCount,
588
+ cudnnConvolutionBwdFilterAlgoPerf_t *perfResults,
589
+ void *workSpace,
590
+ size_t workSpaceSizeInBytes);
591
+
592
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
593
+ cudnnGetConvolutionBackwardFilterAlgorithm_v7(cudnnHandle_t handle,
594
+ const cudnnTensorDescriptor_t srcDesc,
595
+ const cudnnTensorDescriptor_t diffDesc,
596
+ const cudnnConvolutionDescriptor_t convDesc,
597
+ const cudnnFilterDescriptor_t gradDesc,
598
+ const int requestedAlgoCount,
599
+ int *returnedAlgoCount,
600
+ cudnnConvolutionBwdFilterAlgoPerf_t *perfResults);
601
+
602
+ /*
603
+ * convolution algorithm (which requires potentially some workspace)
604
+ */
605
+
606
+ /* Helper function to return the minimum size of the workspace to be passed to the convolution given an algo*/
607
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
608
+ cudnnGetConvolutionBackwardFilterWorkspaceSize(cudnnHandle_t handle,
609
+ const cudnnTensorDescriptor_t xDesc,
610
+ const cudnnTensorDescriptor_t dyDesc,
611
+ const cudnnConvolutionDescriptor_t convDesc,
612
+ const cudnnFilterDescriptor_t gradDesc,
613
+ cudnnConvolutionBwdFilterAlgo_t algo,
614
+ size_t *sizeInBytes);
615
+
616
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
617
+ cudnnConvolutionBackwardFilter(cudnnHandle_t handle,
618
+ const void *alpha,
619
+ const cudnnTensorDescriptor_t xDesc,
620
+ const void *x,
621
+ const cudnnTensorDescriptor_t dyDesc,
622
+ const void *dy,
623
+ const cudnnConvolutionDescriptor_t convDesc,
624
+ cudnnConvolutionBwdFilterAlgo_t algo,
625
+ void *workSpace,
626
+ size_t workSpaceSizeInBytes,
627
+ const void *beta,
628
+ const cudnnFilterDescriptor_t dwDesc,
629
+ void *dw);
630
+
631
+ /* Function to compute the bias gradient for batch convolution */
632
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
633
+ cudnnConvolutionBackwardBias(cudnnHandle_t handle,
634
+ const void *alpha,
635
+ const cudnnTensorDescriptor_t dyDesc,
636
+ const void *dy,
637
+ const void *beta,
638
+ const cudnnTensorDescriptor_t dbDesc,
639
+ void *db);
640
+
641
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
642
+ cudnnCreateFusedOpsConstParamPack(cudnnFusedOpsConstParamPack_t *constPack, cudnnFusedOps_t ops);
643
+
644
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
645
+ cudnnDestroyFusedOpsConstParamPack(cudnnFusedOpsConstParamPack_t constPack);
646
+
647
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
648
+ cudnnSetFusedOpsConstParamPackAttribute(cudnnFusedOpsConstParamPack_t constPack,
649
+ cudnnFusedOpsConstParamLabel_t paramLabel,
650
+ const void *param);
651
+
652
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
653
+ cudnnGetFusedOpsConstParamPackAttribute(const cudnnFusedOpsConstParamPack_t constPack,
654
+ cudnnFusedOpsConstParamLabel_t paramLabel,
655
+ void *param,
656
+ int *isNULL);
657
+
658
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
659
+ cudnnCreateFusedOpsVariantParamPack(cudnnFusedOpsVariantParamPack_t *varPack, cudnnFusedOps_t ops);
660
+
661
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
662
+ cudnnDestroyFusedOpsVariantParamPack(cudnnFusedOpsVariantParamPack_t varPack);
663
+
664
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
665
+ cudnnSetFusedOpsVariantParamPackAttribute(cudnnFusedOpsVariantParamPack_t varPack,
666
+ cudnnFusedOpsVariantParamLabel_t paramLabel,
667
+ void *ptr);
668
+
669
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
670
+ cudnnGetFusedOpsVariantParamPackAttribute(const cudnnFusedOpsVariantParamPack_t varPack,
671
+ cudnnFusedOpsVariantParamLabel_t paramLabel,
672
+ void *ptr);
673
+
674
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
675
+ cudnnCreateFusedOpsPlan(cudnnFusedOpsPlan_t *plan, cudnnFusedOps_t ops);
676
+
677
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
678
+ cudnnDestroyFusedOpsPlan(cudnnFusedOpsPlan_t plan);
679
+
680
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
681
+ cudnnMakeFusedOpsPlan(cudnnHandle_t handle,
682
+ cudnnFusedOpsPlan_t plan,
683
+ const cudnnFusedOpsConstParamPack_t constPack,
684
+ size_t *workspaceSizeInBytes);
685
+
686
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
687
+ cudnnFusedOpsExecute(cudnnHandle_t handle, const cudnnFusedOpsPlan_t plan, cudnnFusedOpsVariantParamPack_t varPack);
688
+
689
+ #if defined(__cplusplus)
690
+ }
691
+ #endif
692
+
693
+ #endif /* CUDNN_CNN_H_ */
lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_graph.h ADDED
@@ -0,0 +1,909 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright 2014-2023 NVIDIA Corporation. All rights reserved.
3
+ *
4
+ * NOTICE TO LICENSEE:
5
+ *
6
+ * This source code and/or documentation ("Licensed Deliverables") are
7
+ * subject to NVIDIA intellectual property rights under U.S. and
8
+ * international Copyright laws.
9
+ *
10
+ * These Licensed Deliverables contained herein is PROPRIETARY and
11
+ * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12
+ * conditions of a form of NVIDIA software license agreement by and
13
+ * between NVIDIA and Licensee ("License Agreement") or electronically
14
+ * accepted by Licensee. Notwithstanding any terms or conditions to
15
+ * the contrary in the License Agreement, reproduction or disclosure
16
+ * of the Licensed Deliverables to any third party without the express
17
+ * written consent of NVIDIA is prohibited.
18
+ *
19
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20
+ * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21
+ * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
22
+ * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23
+ * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24
+ * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25
+ * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27
+ * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28
+ * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32
+ * OF THESE LICENSED DELIVERABLES.
33
+ *
34
+ * U.S. Government End Users. These Licensed Deliverables are a
35
+ * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36
+ * 1995), consisting of "commercial computer software" and "commercial
37
+ * computer software documentation" as such terms are used in 48
38
+ * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39
+ * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40
+ * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41
+ * U.S. Government End Users acquire the Licensed Deliverables with
42
+ * only those rights set forth herein.
43
+ *
44
+ * Any use of the Licensed Deliverables in individual and commercial
45
+ * software must include, in the user documentation and internal
46
+ * comments to the code, the above Disclaimer and U.S. Government End
47
+ * Users Notice.
48
+ */
49
+
50
+ /*
51
+ * cudnn_graph : cuDNN's basic definitions operations.
52
+ */
53
+
54
+ #if !defined(CUDNN_GRAPH_H_)
55
+ #define CUDNN_GRAPH_H_
56
+
57
+ #include <cuda_runtime_api.h>
58
+ #include <library_types.h>
59
+
60
+ #include <stdint.h>
61
+
62
+ #include "cudnn_version.h"
63
+
64
+ /* These version numbers are autogenerated, do not edit manually. */
65
+ #define CUDNN_GRAPH_MAJOR 9
66
+ #define CUDNN_GRAPH_MINOR 1
67
+ #define CUDNN_GRAPH_PATCH 0
68
+
69
+ #if (CUDNN_GRAPH_MAJOR != CUDNN_MAJOR) || (CUDNN_GRAPH_MINOR != CUDNN_MINOR) || (CUDNN_GRAPH_PATCH != CUDNN_PATCHLEVEL)
70
+ #error Version mismatch in cuDNN GRAPH!!!
71
+ #endif
72
+
73
+ #ifndef CUDNNWINAPI
74
+ #ifdef _WIN32
75
+ #define CUDNNWINAPI __stdcall
76
+ #else
77
+ #define CUDNNWINAPI
78
+ #endif
79
+ #endif
80
+
81
+ /* Warnings for deprecated API-s are enabled using the CUDNN_WARN_DEPRECATED macro */
82
+ #if defined(CUDNN_WARN_DEPRECATED) && (defined(__GNUC__) || defined(__clang__))
83
+ /* GCC, Intel C/C++, Cray C/C++, CLANG, IBM XL C/C++ little endian */
84
+ #define CUDNN_DEPRECATED __attribute__((deprecated))
85
+ #define CUDNN_DEPRECATED_ENUM __attribute__((deprecated))
86
+ #elif defined(CUDNN_WARN_DEPRECATED) && defined(_MSC_VER)
87
+ /* Microsoft Visual C++ */
88
+ #define CUDNN_DEPRECATED __declspec(deprecated)
89
+ #define CUDNN_DEPRECATED_ENUM __declspec(deprecated)
90
+ #elif defined(CUDNN_WARN_DEPRECATED) && (__cplusplus >= 201402L)
91
+ /* C++14 compilers */
92
+ #define CUDNN_DEPRECATED [[deprecated]]
93
+ #define CUDNN_DEPRECATED_ENUM [[deprecated]]
94
+ #else
95
+ /* No support for the deprecated attribute */
96
+ #define CUDNN_DEPRECATED
97
+ #define CUDNN_DEPRECATED_ENUM
98
+ #endif
99
+
100
+ #if defined(__cplusplus)
101
+ extern "C" {
102
+ #endif
103
+
104
+ struct cudnnContext;
105
+ typedef struct cudnnContext *cudnnHandle_t;
106
+
107
+ size_t CUDNNWINAPI
108
+ cudnnGetVersion(void);
109
+
110
+ size_t CUDNNWINAPI
111
+ cudnnGetMaxDeviceVersion(void);
112
+
113
+ /* Returns CUDA Runtime version statically linked against cudnn */
114
+ size_t CUDNNWINAPI
115
+ cudnnGetCudartVersion(void);
116
+
117
+ /*
118
+ * CUDNN return codes
119
+ */
120
+ typedef enum {
121
+ CUDNN_STATUS_SUCCESS = 0,
122
+
123
+ /* Uncategorized errors */
124
+ CUDNN_STATUS_NOT_INITIALIZED = 1001,
125
+ CUDNN_STATUS_SUBLIBRARY_VERSION_MISMATCH = 1002,
126
+ CUDNN_STATUS_SERIALIZATION_VERSION_MISMATCH = 1003,
127
+ CUDNN_STATUS_DEPRECATED = 1004,
128
+ CUDNN_STATUS_LICENSE_ERROR = 1005,
129
+ CUDNN_STATUS_RUNTIME_IN_PROGRESS = 1006,
130
+ CUDNN_STATUS_RUNTIME_FP_OVERFLOW = 1007,
131
+
132
+ CUDNN_STATUS_BAD_PARAM = 2000,
133
+ CUDNN_STATUS_BAD_PARAM_NULL_POINTER = 2002,
134
+ CUDNN_STATUS_BAD_PARAM_MISALIGNED_POINTER = 2003,
135
+ CUDNN_STATUS_BAD_PARAM_NOT_FINALIZED = 2004,
136
+ CUDNN_STATUS_BAD_PARAM_OUT_OF_BOUND = 2005,
137
+ CUDNN_STATUS_BAD_PARAM_SIZE_INSUFFICIENT = 2006,
138
+ CUDNN_STATUS_BAD_PARAM_STREAM_MISMATCH = 2007,
139
+ CUDNN_STATUS_BAD_PARAM_SHAPE_MISMATCH = 2008,
140
+ CUDNN_STATUS_BAD_PARAM_DUPLICATED_ENTRIES = 2009,
141
+ CUDNN_STATUS_BAD_PARAM_ATTRIBUTE_TYPE = 2010,
142
+
143
+ CUDNN_STATUS_NOT_SUPPORTED = 3000,
144
+ CUDNN_STATUS_NOT_SUPPORTED_GRAPH_PATTERN = 3001,
145
+ CUDNN_STATUS_NOT_SUPPORTED_SHAPE = 3002,
146
+ CUDNN_STATUS_NOT_SUPPORTED_DATA_TYPE = 3003,
147
+ CUDNN_STATUS_NOT_SUPPORTED_LAYOUT = 3004,
148
+ CUDNN_STATUS_NOT_SUPPORTED_INCOMPATIBLE_CUDA_DRIVER = 3005,
149
+ CUDNN_STATUS_NOT_SUPPORTED_INCOMPATIBLE_CUDART = 3006,
150
+ CUDNN_STATUS_NOT_SUPPORTED_ARCH_MISMATCH = 3007,
151
+ CUDNN_STATUS_NOT_SUPPORTED_RUNTIME_PREREQUISITE_MISSING = 3008,
152
+ CUDNN_STATUS_NOT_SUPPORTED_SUBLIBRARY_UNAVAILABLE = 3009,
153
+ CUDNN_STATUS_NOT_SUPPORTED_SHARED_MEMORY_INSUFFICIENT = 3010,
154
+ CUDNN_STATUS_NOT_SUPPORTED_PADDING = 3011,
155
+ CUDNN_STATUS_NOT_SUPPORTED_BAD_LAUNCH_PARAM = 3012,
156
+
157
+ CUDNN_STATUS_INTERNAL_ERROR = 4000,
158
+ CUDNN_STATUS_INTERNAL_ERROR_COMPILATION_FAILED = 4001,
159
+ CUDNN_STATUS_INTERNAL_ERROR_UNEXPECTED_VALUE = 4002,
160
+ CUDNN_STATUS_INTERNAL_ERROR_HOST_ALLOCATION_FAILED = 4003,
161
+ CUDNN_STATUS_INTERNAL_ERROR_DEVICE_ALLOCATION_FAILED = 4004,
162
+ CUDNN_STATUS_INTERNAL_ERROR_BAD_LAUNCH_PARAM = 4005,
163
+ CUDNN_STATUS_INTERNAL_ERROR_TEXTURE_CREATION_FAILED = 4006,
164
+
165
+ CUDNN_STATUS_EXECUTION_FAILED = 5000,
166
+ CUDNN_STATUS_EXECUTION_FAILED_CUDA_DRIVER = 5001,
167
+ CUDNN_STATUS_EXECUTION_FAILED_CUBLAS = 5002,
168
+ CUDNN_STATUS_EXECUTION_FAILED_CUDART = 5003,
169
+ CUDNN_STATUS_EXECUTION_FAILED_CURAND = 5004,
170
+
171
+ CUDNN_STATUS_ALLOC_FAILED CUDNN_DEPRECATED_ENUM = CUDNN_STATUS_INTERNAL_ERROR_HOST_ALLOCATION_FAILED,
172
+ CUDNN_STATUS_INVALID_VALUE CUDNN_DEPRECATED_ENUM = 2001 /* please transition to CUDNN_STATUS_BAD_PARAM instead */,
173
+ CUDNN_STATUS_ARCH_MISMATCH CUDNN_DEPRECATED_ENUM = CUDNN_STATUS_NOT_SUPPORTED_ARCH_MISMATCH,
174
+ CUDNN_STATUS_MAPPING_ERROR CUDNN_DEPRECATED_ENUM = CUDNN_STATUS_INTERNAL_ERROR_TEXTURE_CREATION_FAILED,
175
+ CUDNN_STATUS_RUNTIME_PREREQUISITE_MISSING CUDNN_DEPRECATED_ENUM =
176
+ CUDNN_STATUS_NOT_SUPPORTED_RUNTIME_PREREQUISITE_MISSING,
177
+ CUDNN_STATUS_VERSION_MISMATCH CUDNN_DEPRECATED_ENUM = CUDNN_STATUS_SUBLIBRARY_VERSION_MISMATCH,
178
+ } cudnnStatus_t;
179
+
180
+ #define CUDNN_STATUS_FULL_ERROR_CODE(category, specific_err) ((cudnnStatus_t)(0 + (category) + (specific_err)))
181
+ #define CUDNN_STATUS_CATEGORY(full_error_code) ((full_error_code) / 1000 * 1000)
182
+ #define CUDNN_STATUS_SPECIFIC_ERROR(full_error_code) ((full_error_code) % 1000)
183
+
184
+ /* human-readable error messages */
185
+ const char *CUDNNWINAPI
186
+ cudnnGetErrorString(cudnnStatus_t status);
187
+
188
+ void CUDNNWINAPI
189
+ cudnnGetLastErrorString(char *message, size_t max_size);
190
+
191
+ /* Forward definition in this version only */
192
+ typedef struct cudnnRuntimeTag_t cudnnRuntimeTag_t CUDNN_DEPRECATED;
193
+
194
+ typedef enum {
195
+ CUDNN_ERRQUERY_RAWCODE = 0,
196
+ CUDNN_ERRQUERY_NONBLOCKING = 1,
197
+ CUDNN_ERRQUERY_BLOCKING = 2,
198
+ } cudnnErrQueryMode_t;
199
+
200
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
201
+ cudnnQueryRuntimeError(cudnnHandle_t handle, cudnnStatus_t *rstatus, cudnnErrQueryMode_t mode, cudnnRuntimeTag_t *tag);
202
+
203
+ cudnnStatus_t CUDNNWINAPI
204
+ cudnnGetProperty(libraryPropertyType type, int *value);
205
+
206
+ cudnnStatus_t CUDNNWINAPI
207
+ cudnnCreate(cudnnHandle_t *handle);
208
+ cudnnStatus_t CUDNNWINAPI
209
+ cudnnDestroy(cudnnHandle_t handle);
210
+ cudnnStatus_t CUDNNWINAPI
211
+ cudnnSetStream(cudnnHandle_t handle, cudaStream_t streamId);
212
+ cudnnStatus_t CUDNNWINAPI
213
+ cudnnGetStream(cudnnHandle_t handle, cudaStream_t *streamId);
214
+ /*
215
+ * CUDNN data type
216
+ */
217
+ typedef enum {
218
+ CUDNN_DATA_FLOAT = 0,
219
+ CUDNN_DATA_DOUBLE = 1,
220
+ CUDNN_DATA_HALF = 2,
221
+ CUDNN_DATA_INT8 = 3,
222
+ CUDNN_DATA_INT32 = 4,
223
+ CUDNN_DATA_INT8x4 CUDNN_DEPRECATED_ENUM = 5,
224
+ CUDNN_DATA_UINT8 = 6,
225
+ CUDNN_DATA_UINT8x4 CUDNN_DEPRECATED_ENUM = 7,
226
+ CUDNN_DATA_INT8x32 CUDNN_DEPRECATED_ENUM = 8,
227
+ CUDNN_DATA_BFLOAT16 = 9,
228
+ CUDNN_DATA_INT64 = 10,
229
+ CUDNN_DATA_BOOLEAN = 11,
230
+ CUDNN_DATA_FP8_E4M3 = 12,
231
+ CUDNN_DATA_FP8_E5M2 = 13,
232
+ CUDNN_DATA_FAST_FLOAT_FOR_FP8 = 14,
233
+ } cudnnDataType_t;
234
+
235
+ /*
236
+ * CUDNN math type
237
+ */
238
+ typedef enum {
239
+ CUDNN_DEFAULT_MATH = 0,
240
+ CUDNN_TENSOR_OP_MATH = 1,
241
+ CUDNN_TENSOR_OP_MATH_ALLOW_CONVERSION = 2,
242
+ CUDNN_FMA_MATH = 3,
243
+ } cudnnMathType_t;
244
+
245
+ /*
246
+ * CUDNN propagate Nan
247
+ */
248
+ typedef enum {
249
+ CUDNN_NOT_PROPAGATE_NAN CUDNN_DEPRECATED_ENUM = 0,
250
+ CUDNN_PROPAGATE_NAN CUDNN_DEPRECATED_ENUM = 1,
251
+ } cudnnNanPropagation_t;
252
+
253
+ /*
254
+ * Behavior for OOB samples. OOB samples are samples where L+R > T is encountered during the gradient calculation. If
255
+ * gradMode is set to CUDNN_CTC_SKIP_OOB_GRADIENTS, then the CTC loss function does not write to the gradient buffer for
256
+ * that sample. Instead, the current values, even not finite, are retained. If gradMode is set to
257
+ * CUDNN_CTC_ZERO_OOB_GRADIENTS, then the gradient for that sample is set to zero. This guarantees a finite gradient.
258
+ */
259
+ typedef enum {
260
+ CUDNN_CTC_ZERO_OOB_GRADIENTS = 0,
261
+ CUDNN_CTC_SKIP_OOB_GRADIENTS = 1,
262
+ } cudnnCTCGradMode_t;
263
+
264
+ typedef enum {
265
+ CUDNN_TENSOR_NCHW = 0, /* row major (wStride = 1, hStride = w) */
266
+ CUDNN_TENSOR_NHWC = 1, /* feature maps interleaved ( cStride = 1 )*/
267
+ CUDNN_TENSOR_NCHW_VECT_C = 2, /* each image point is vector of element of C, vector length in data type */
268
+ } cudnnTensorFormat_t;
269
+
270
+ /*
271
+ * CUDNN ReduceTensor op type
272
+ */
273
+ typedef enum {
274
+ CUDNN_REDUCE_TENSOR_ADD = 0,
275
+ CUDNN_REDUCE_TENSOR_MUL = 1,
276
+ CUDNN_REDUCE_TENSOR_MIN = 2,
277
+ CUDNN_REDUCE_TENSOR_MAX = 3,
278
+ CUDNN_REDUCE_TENSOR_AMAX = 4,
279
+ CUDNN_REDUCE_TENSOR_AVG = 5,
280
+ CUDNN_REDUCE_TENSOR_NORM1 = 6,
281
+ CUDNN_REDUCE_TENSOR_NORM2 = 7,
282
+ CUDNN_REDUCE_TENSOR_MUL_NO_ZEROS = 8,
283
+ } cudnnReduceTensorOp_t;
284
+
285
+ /*
286
+ * activation mode
287
+ */
288
+ typedef enum {
289
+ CUDNN_ACTIVATION_SIGMOID = 0,
290
+ CUDNN_ACTIVATION_RELU = 1,
291
+ CUDNN_ACTIVATION_TANH = 2,
292
+ CUDNN_ACTIVATION_CLIPPED_RELU = 3,
293
+ CUDNN_ACTIVATION_ELU = 4,
294
+ CUDNN_ACTIVATION_IDENTITY = 5,
295
+ CUDNN_ACTIVATION_SWISH = 6
296
+ } cudnnActivationMode_t CUDNN_DEPRECATED;
297
+
298
+ typedef enum {
299
+ CUDNN_SEV_FATAL = 0,
300
+ CUDNN_SEV_ERROR = 1,
301
+ CUDNN_SEV_WARNING = 2,
302
+ CUDNN_SEV_INFO = 3,
303
+ } cudnnSeverity_t;
304
+
305
+ /* Message masks to be used with cudnnSetCallback() */
306
+ #define CUDNN_SEV_ERROR_EN (1U << CUDNN_SEV_ERROR)
307
+ #define CUDNN_SEV_WARNING_EN (1U << CUDNN_SEV_WARNING)
308
+ #define CUDNN_SEV_INFO_EN (1U << CUDNN_SEV_INFO)
309
+
310
+ /* struct containing useful informaiton for each API call */
311
+ typedef struct cudnnDebugStruct {
312
+ unsigned cudnn_version;
313
+ cudnnStatus_t cudnnStatus;
314
+ unsigned time_sec; /* epoch time in seconds */
315
+ unsigned time_usec; /* microseconds part of epoch time */
316
+ unsigned time_delta; /* time since start in seconds */
317
+ cudnnHandle_t handle; /* cudnn handle */
318
+ cudaStream_t stream; /* cuda stream ID */
319
+ unsigned long long pid; /* process ID */
320
+ unsigned long long tid; /* thread ID */
321
+ int cudaDeviceId; /* CUDA device ID */
322
+ int reserved[15]; /* reserved for future use */
323
+ } cudnnDebug_t;
324
+
325
+ typedef void (*cudnnCallback_t)(cudnnSeverity_t sev, void *udata, const cudnnDebug_t *dbg, const char *msg);
326
+
327
+ cudnnStatus_t CUDNNWINAPI
328
+ cudnnSetCallback(unsigned mask, void *udata, cudnnCallback_t fptr);
329
+
330
+ cudnnStatus_t CUDNNWINAPI
331
+ cudnnGetCallback(unsigned *mask, void **udata, cudnnCallback_t *fptr);
332
+
333
+ /*
334
+ * \brief Cross-library version checker.
335
+ * This function is implemented differently in each sub-library. Each sublib
336
+ * checks whether its own version matches that of its dependencies.
337
+ * \returns CUDNN_STATUS_SUCCESS if the version check passes,
338
+ * CUDNN_STATUS_SUBLIBRARY_VERSION_MISMATCH if the versions are inconsistent.
339
+ */
340
+ cudnnStatus_t CUDNNWINAPI
341
+ cudnnGraphVersionCheck(void);
342
+
343
+ /* Maximum supported number of tensor dimensions */
344
+ #define CUDNN_DIM_MAX 8
345
+
346
+ /*
347
+ * convolution mode
348
+ */
349
+ typedef enum { CUDNN_CONVOLUTION = 0, CUDNN_CROSS_CORRELATION = 1 } cudnnConvolutionMode_t;
350
+
351
+ /*
352
+ * CUDNN Reorder
353
+ */
354
+ typedef enum {
355
+ CUDNN_DEFAULT_REORDER = 0,
356
+ CUDNN_NO_REORDER = 1,
357
+ } cudnnReorderType_t CUDNN_DEPRECATED;
358
+
359
+ typedef void *cudnnBackendDescriptor_t;
360
+
361
+ typedef struct cudnnFractionStruct {
362
+ int64_t numerator;
363
+ int64_t denominator;
364
+ } cudnnFraction_t;
365
+
366
+ typedef enum {
367
+ CUDNN_POINTWISE_ADD = 0,
368
+ CUDNN_POINTWISE_ADD_SQUARE = 5,
369
+ CUDNN_POINTWISE_DIV = 6,
370
+ CUDNN_POINTWISE_MAX = 3,
371
+ CUDNN_POINTWISE_MIN = 2,
372
+ CUDNN_POINTWISE_MOD = 7,
373
+ CUDNN_POINTWISE_MUL = 1,
374
+ CUDNN_POINTWISE_POW = 8,
375
+ CUDNN_POINTWISE_SUB = 9,
376
+
377
+ CUDNN_POINTWISE_ABS = 10,
378
+ CUDNN_POINTWISE_CEIL = 11,
379
+ CUDNN_POINTWISE_COS = 12,
380
+ CUDNN_POINTWISE_EXP = 13,
381
+ CUDNN_POINTWISE_FLOOR = 14,
382
+ CUDNN_POINTWISE_LOG = 15,
383
+ CUDNN_POINTWISE_NEG = 16,
384
+ CUDNN_POINTWISE_RSQRT = 17,
385
+ CUDNN_POINTWISE_SIN = 18,
386
+ CUDNN_POINTWISE_SQRT = 4,
387
+ CUDNN_POINTWISE_TAN = 19,
388
+ CUDNN_POINTWISE_ERF = 20,
389
+ CUDNN_POINTWISE_IDENTITY = 21,
390
+ CUDNN_POINTWISE_RECIPROCAL = 22,
391
+ CUDNN_POINTWISE_ATAN2 = 23,
392
+
393
+ CUDNN_POINTWISE_RELU_FWD = 100,
394
+ CUDNN_POINTWISE_TANH_FWD = 101,
395
+ CUDNN_POINTWISE_SIGMOID_FWD = 102,
396
+ CUDNN_POINTWISE_ELU_FWD = 103,
397
+ CUDNN_POINTWISE_GELU_FWD = 104,
398
+ CUDNN_POINTWISE_SOFTPLUS_FWD = 105,
399
+ CUDNN_POINTWISE_SWISH_FWD = 106,
400
+ CUDNN_POINTWISE_GELU_APPROX_TANH_FWD = 107,
401
+
402
+ CUDNN_POINTWISE_RELU_BWD = 200,
403
+ CUDNN_POINTWISE_TANH_BWD = 201,
404
+ CUDNN_POINTWISE_SIGMOID_BWD = 202,
405
+ CUDNN_POINTWISE_ELU_BWD = 203,
406
+ CUDNN_POINTWISE_GELU_BWD = 204,
407
+ CUDNN_POINTWISE_SOFTPLUS_BWD = 205,
408
+ CUDNN_POINTWISE_SWISH_BWD = 206,
409
+ CUDNN_POINTWISE_GELU_APPROX_TANH_BWD = 207,
410
+
411
+ CUDNN_POINTWISE_CMP_EQ = 300,
412
+ CUDNN_POINTWISE_CMP_NEQ = 301,
413
+ CUDNN_POINTWISE_CMP_GT = 302,
414
+ CUDNN_POINTWISE_CMP_GE = 303,
415
+ CUDNN_POINTWISE_CMP_LT = 304,
416
+ CUDNN_POINTWISE_CMP_LE = 305,
417
+
418
+ CUDNN_POINTWISE_LOGICAL_AND = 400,
419
+ CUDNN_POINTWISE_LOGICAL_OR = 401,
420
+ CUDNN_POINTWISE_LOGICAL_NOT = 402,
421
+
422
+ CUDNN_POINTWISE_GEN_INDEX = 501,
423
+
424
+ CUDNN_POINTWISE_BINARY_SELECT = 601,
425
+ } cudnnPointwiseMode_t;
426
+
427
+ typedef enum {
428
+ CUDNN_RESAMPLE_NEAREST = 0,
429
+ CUDNN_RESAMPLE_BILINEAR = 1,
430
+ CUDNN_RESAMPLE_AVGPOOL = 2,
431
+ CUDNN_RESAMPLE_AVGPOOL_INCLUDE_PADDING = 2,
432
+ CUDNN_RESAMPLE_AVGPOOL_EXCLUDE_PADDING = 4,
433
+ CUDNN_RESAMPLE_MAXPOOL = 3,
434
+ } cudnnResampleMode_t;
435
+
436
+ typedef enum {
437
+ CUDNN_SIGNAL_SET = 0,
438
+ CUDNN_SIGNAL_WAIT = 1,
439
+ } cudnnSignalMode_t;
440
+
441
+ typedef enum {
442
+ CUDNN_GENSTATS_SUM_SQSUM = 0,
443
+ } cudnnGenStatsMode_t;
444
+
445
+ typedef enum {
446
+ CUDNN_BN_FINALIZE_STATISTICS_TRAINING = 0,
447
+ CUDNN_BN_FINALIZE_STATISTICS_INFERENCE = 1,
448
+ } cudnnBnFinalizeStatsMode_t;
449
+
450
+ typedef enum {
451
+ CUDNN_RNG_DISTRIBUTION_BERNOULLI,
452
+ CUDNN_RNG_DISTRIBUTION_UNIFORM,
453
+ CUDNN_RNG_DISTRIBUTION_NORMAL,
454
+ } cudnnRngDistribution_t;
455
+
456
+ typedef enum {
457
+ CUDNN_ATTR_POINTWISE_MODE = 0,
458
+ CUDNN_ATTR_POINTWISE_MATH_PREC = 1,
459
+ CUDNN_ATTR_POINTWISE_NAN_PROPAGATION CUDNN_DEPRECATED_ENUM = 2,
460
+ CUDNN_ATTR_POINTWISE_RELU_LOWER_CLIP = 3,
461
+ CUDNN_ATTR_POINTWISE_RELU_UPPER_CLIP = 4,
462
+ CUDNN_ATTR_POINTWISE_RELU_LOWER_CLIP_SLOPE = 5,
463
+ CUDNN_ATTR_POINTWISE_ELU_ALPHA = 6,
464
+ CUDNN_ATTR_POINTWISE_SOFTPLUS_BETA = 7,
465
+ CUDNN_ATTR_POINTWISE_SWISH_BETA = 8,
466
+ CUDNN_ATTR_POINTWISE_AXIS = 9,
467
+
468
+ CUDNN_ATTR_CONVOLUTION_COMP_TYPE = 100,
469
+ CUDNN_ATTR_CONVOLUTION_CONV_MODE = 101,
470
+ CUDNN_ATTR_CONVOLUTION_DILATIONS = 102,
471
+ CUDNN_ATTR_CONVOLUTION_FILTER_STRIDES = 103,
472
+ CUDNN_ATTR_CONVOLUTION_POST_PADDINGS = 104,
473
+ CUDNN_ATTR_CONVOLUTION_PRE_PADDINGS = 105,
474
+ CUDNN_ATTR_CONVOLUTION_SPATIAL_DIMS = 106,
475
+
476
+ CUDNN_ATTR_ENGINEHEUR_MODE = 200,
477
+ CUDNN_ATTR_ENGINEHEUR_OPERATION_GRAPH = 201,
478
+ CUDNN_ATTR_ENGINEHEUR_RESULTS = 202,
479
+ CUDNN_ATTR_ENGINEHEUR_SM_COUNT_TARGET = 203,
480
+
481
+ CUDNN_ATTR_ENGINECFG_ENGINE = 300,
482
+ CUDNN_ATTR_ENGINECFG_INTERMEDIATE_INFO = 301,
483
+ CUDNN_ATTR_ENGINECFG_KNOB_CHOICES = 302,
484
+
485
+ CUDNN_ATTR_EXECUTION_PLAN_HANDLE = 400,
486
+ CUDNN_ATTR_EXECUTION_PLAN_ENGINE_CONFIG = 401,
487
+ CUDNN_ATTR_EXECUTION_PLAN_WORKSPACE_SIZE = 402,
488
+ CUDNN_ATTR_EXECUTION_PLAN_COMPUTED_INTERMEDIATE_UIDS = 403,
489
+ CUDNN_ATTR_EXECUTION_PLAN_RUN_ONLY_INTERMEDIATE_UIDS = 404,
490
+ CUDNN_ATTR_EXECUTION_PLAN_JSON_REPRESENTATION = 405,
491
+
492
+ CUDNN_ATTR_INTERMEDIATE_INFO_UNIQUE_ID = 500,
493
+ CUDNN_ATTR_INTERMEDIATE_INFO_SIZE = 501,
494
+ CUDNN_ATTR_INTERMEDIATE_INFO_DEPENDENT_DATA_UIDS = 502,
495
+ CUDNN_ATTR_INTERMEDIATE_INFO_DEPENDENT_ATTRIBUTES = 503,
496
+
497
+ CUDNN_ATTR_KNOB_CHOICE_KNOB_TYPE = 600,
498
+ CUDNN_ATTR_KNOB_CHOICE_KNOB_VALUE = 601,
499
+
500
+ CUDNN_ATTR_OPERATION_CONVOLUTION_FORWARD_ALPHA = 700,
501
+ CUDNN_ATTR_OPERATION_CONVOLUTION_FORWARD_BETA = 701,
502
+ CUDNN_ATTR_OPERATION_CONVOLUTION_FORWARD_CONV_DESC = 702,
503
+ CUDNN_ATTR_OPERATION_CONVOLUTION_FORWARD_W = 703,
504
+ CUDNN_ATTR_OPERATION_CONVOLUTION_FORWARD_X = 704,
505
+ CUDNN_ATTR_OPERATION_CONVOLUTION_FORWARD_Y = 705,
506
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_DATA_ALPHA = 706,
507
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_DATA_BETA = 707,
508
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_DATA_CONV_DESC = 708,
509
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_DATA_W = 709,
510
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_DATA_DX = 710,
511
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_DATA_DY = 711,
512
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_FILTER_ALPHA = 712,
513
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_FILTER_BETA = 713,
514
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_FILTER_CONV_DESC = 714,
515
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_FILTER_DW = 715,
516
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_FILTER_X = 716,
517
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_FILTER_DY = 717,
518
+
519
+ CUDNN_ATTR_OPERATION_POINTWISE_PW_DESCRIPTOR = 750,
520
+ CUDNN_ATTR_OPERATION_POINTWISE_XDESC = 751,
521
+ CUDNN_ATTR_OPERATION_POINTWISE_BDESC = 752,
522
+ CUDNN_ATTR_OPERATION_POINTWISE_YDESC = 753,
523
+ CUDNN_ATTR_OPERATION_POINTWISE_ALPHA1 = 754,
524
+ CUDNN_ATTR_OPERATION_POINTWISE_ALPHA2 = 755,
525
+ CUDNN_ATTR_OPERATION_POINTWISE_DXDESC = 756,
526
+ CUDNN_ATTR_OPERATION_POINTWISE_DYDESC = 757,
527
+ CUDNN_ATTR_OPERATION_POINTWISE_TDESC = 758,
528
+
529
+ CUDNN_ATTR_OPERATION_GENSTATS_MODE = 770,
530
+ CUDNN_ATTR_OPERATION_GENSTATS_MATH_PREC = 771,
531
+ CUDNN_ATTR_OPERATION_GENSTATS_XDESC = 772,
532
+ CUDNN_ATTR_OPERATION_GENSTATS_SUMDESC = 773,
533
+ CUDNN_ATTR_OPERATION_GENSTATS_SQSUMDESC = 774,
534
+
535
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_STATS_MODE = 780,
536
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_MATH_PREC = 781,
537
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_Y_SUM_DESC = 782,
538
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_Y_SQ_SUM_DESC = 783,
539
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_SCALE_DESC = 784,
540
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_BIAS_DESC = 785,
541
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_PREV_RUNNING_MEAN_DESC = 786,
542
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_PREV_RUNNING_VAR_DESC = 787,
543
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_UPDATED_RUNNING_MEAN_DESC = 788,
544
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_UPDATED_RUNNING_VAR_DESC = 789,
545
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_SAVED_MEAN_DESC = 790,
546
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_SAVED_INV_STD_DESC = 791,
547
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_EQ_SCALE_DESC = 792,
548
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_EQ_BIAS_DESC = 793,
549
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_ACCUM_COUNT_DESC = 794,
550
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_EPSILON_DESC = 795,
551
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_EXP_AVERATE_FACTOR_DESC = 796,
552
+
553
+ CUDNN_ATTR_OPERATIONGRAPH_HANDLE = 800,
554
+ CUDNN_ATTR_OPERATIONGRAPH_OPS = 801,
555
+ CUDNN_ATTR_OPERATIONGRAPH_ENGINE_GLOBAL_COUNT = 802,
556
+
557
+ CUDNN_ATTR_TENSOR_BYTE_ALIGNMENT = 900,
558
+ CUDNN_ATTR_TENSOR_DATA_TYPE = 901,
559
+ CUDNN_ATTR_TENSOR_DIMENSIONS = 902,
560
+ CUDNN_ATTR_TENSOR_STRIDES = 903,
561
+ CUDNN_ATTR_TENSOR_VECTOR_COUNT = 904,
562
+ CUDNN_ATTR_TENSOR_VECTORIZED_DIMENSION = 905,
563
+ CUDNN_ATTR_TENSOR_UNIQUE_ID = 906,
564
+ CUDNN_ATTR_TENSOR_IS_VIRTUAL = 907,
565
+ CUDNN_ATTR_TENSOR_IS_BY_VALUE = 908,
566
+ CUDNN_ATTR_TENSOR_REORDERING_MODE = 909,
567
+ CUDNN_ATTR_TENSOR_RAGGED_OFFSET_DESC = 913,
568
+
569
+ CUDNN_ATTR_VARIANT_PACK_UNIQUE_IDS = 1000,
570
+ CUDNN_ATTR_VARIANT_PACK_DATA_POINTERS = 1001,
571
+ CUDNN_ATTR_VARIANT_PACK_INTERMEDIATES = 1002,
572
+ CUDNN_ATTR_VARIANT_PACK_WORKSPACE = 1003,
573
+
574
+ CUDNN_ATTR_LAYOUT_INFO_TENSOR_UID = 1100,
575
+ CUDNN_ATTR_LAYOUT_INFO_TYPES = 1101,
576
+
577
+ CUDNN_ATTR_KNOB_INFO_TYPE = 1200,
578
+ CUDNN_ATTR_KNOB_INFO_MAXIMUM_VALUE = 1201,
579
+ CUDNN_ATTR_KNOB_INFO_MINIMUM_VALUE = 1202,
580
+ CUDNN_ATTR_KNOB_INFO_STRIDE = 1203,
581
+
582
+ CUDNN_ATTR_ENGINE_OPERATION_GRAPH = 1300,
583
+ CUDNN_ATTR_ENGINE_GLOBAL_INDEX = 1301,
584
+ CUDNN_ATTR_ENGINE_KNOB_INFO = 1302,
585
+ CUDNN_ATTR_ENGINE_NUMERICAL_NOTE = 1303,
586
+ CUDNN_ATTR_ENGINE_LAYOUT_INFO = 1304,
587
+ CUDNN_ATTR_ENGINE_BEHAVIOR_NOTE = 1305,
588
+ CUDNN_ATTR_ENGINE_SM_COUNT_TARGET = 1306,
589
+
590
+ CUDNN_ATTR_MATMUL_COMP_TYPE = 1500,
591
+ CUDNN_ATTR_MATMUL_PADDING_VALUE = 1503,
592
+
593
+ CUDNN_ATTR_OPERATION_MATMUL_ADESC = 1520,
594
+ CUDNN_ATTR_OPERATION_MATMUL_BDESC = 1521,
595
+ CUDNN_ATTR_OPERATION_MATMUL_CDESC = 1522,
596
+ CUDNN_ATTR_OPERATION_MATMUL_DESC = 1523,
597
+ CUDNN_ATTR_OPERATION_MATMUL_IRREGULARLY_STRIDED_BATCH_COUNT CUDNN_DEPRECATED_ENUM = 1524,
598
+ CUDNN_ATTR_OPERATION_MATMUL_GEMM_M_OVERRIDE_DESC = 1525,
599
+ CUDNN_ATTR_OPERATION_MATMUL_GEMM_N_OVERRIDE_DESC = 1526,
600
+ CUDNN_ATTR_OPERATION_MATMUL_GEMM_K_OVERRIDE_DESC = 1527,
601
+
602
+ CUDNN_ATTR_REDUCTION_OPERATOR = 1600,
603
+ CUDNN_ATTR_REDUCTION_COMP_TYPE = 1601,
604
+
605
+ CUDNN_ATTR_OPERATION_REDUCTION_XDESC = 1610,
606
+ CUDNN_ATTR_OPERATION_REDUCTION_YDESC = 1611,
607
+ CUDNN_ATTR_OPERATION_REDUCTION_DESC = 1612,
608
+
609
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_MATH_PREC = 1620,
610
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_MEAN_DESC = 1621,
611
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_INVSTD_DESC = 1622,
612
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_BN_SCALE_DESC = 1623,
613
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_X_DESC = 1624,
614
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_DY_DESC = 1625,
615
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_DBN_SCALE_DESC = 1626,
616
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_DBN_BIAS_DESC = 1627,
617
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_EQ_DY_SCALE_DESC = 1628,
618
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_EQ_X_SCALE_DESC = 1629,
619
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_EQ_BIAS = 1630,
620
+
621
+ CUDNN_ATTR_RESAMPLE_MODE = 1700,
622
+ CUDNN_ATTR_RESAMPLE_COMP_TYPE = 1701,
623
+ CUDNN_ATTR_RESAMPLE_SPATIAL_DIMS = 1702,
624
+ CUDNN_ATTR_RESAMPLE_POST_PADDINGS = 1703,
625
+ CUDNN_ATTR_RESAMPLE_PRE_PADDINGS = 1704,
626
+ CUDNN_ATTR_RESAMPLE_STRIDES = 1705,
627
+ CUDNN_ATTR_RESAMPLE_WINDOW_DIMS = 1706,
628
+ CUDNN_ATTR_RESAMPLE_NAN_PROPAGATION = 1707,
629
+ CUDNN_ATTR_RESAMPLE_PADDING_MODE = 1708,
630
+
631
+ CUDNN_ATTR_OPERATION_RESAMPLE_FWD_XDESC = 1710,
632
+ CUDNN_ATTR_OPERATION_RESAMPLE_FWD_YDESC = 1711,
633
+ CUDNN_ATTR_OPERATION_RESAMPLE_FWD_IDXDESC = 1712,
634
+ CUDNN_ATTR_OPERATION_RESAMPLE_FWD_ALPHA CUDNN_DEPRECATED_ENUM = 1713,
635
+ CUDNN_ATTR_OPERATION_RESAMPLE_FWD_BETA CUDNN_DEPRECATED_ENUM = 1714,
636
+ CUDNN_ATTR_OPERATION_RESAMPLE_FWD_DESC = 1716,
637
+
638
+ CUDNN_ATTR_OPERATION_RESAMPLE_BWD_DXDESC = 1720,
639
+ CUDNN_ATTR_OPERATION_RESAMPLE_BWD_DYDESC = 1721,
640
+ CUDNN_ATTR_OPERATION_RESAMPLE_BWD_IDXDESC = 1722,
641
+ CUDNN_ATTR_OPERATION_RESAMPLE_BWD_ALPHA CUDNN_DEPRECATED_ENUM = 1723,
642
+ CUDNN_ATTR_OPERATION_RESAMPLE_BWD_BETA CUDNN_DEPRECATED_ENUM = 1724,
643
+ CUDNN_ATTR_OPERATION_RESAMPLE_BWD_DESC = 1725,
644
+ CUDNN_ATTR_OPERATION_RESAMPLE_BWD_XDESC = 1726,
645
+ CUDNN_ATTR_OPERATION_RESAMPLE_BWD_YDESC = 1727,
646
+
647
+ CUDNN_ATTR_OPERATION_CONCAT_AXIS = 1800,
648
+ CUDNN_ATTR_OPERATION_CONCAT_INPUT_DESCS = 1801,
649
+ CUDNN_ATTR_OPERATION_CONCAT_INPLACE_INDEX = 1802,
650
+ CUDNN_ATTR_OPERATION_CONCAT_OUTPUT_DESC = 1803,
651
+
652
+ CUDNN_ATTR_OPERATION_SIGNAL_MODE = 1900,
653
+ CUDNN_ATTR_OPERATION_SIGNAL_FLAGDESC = 1901,
654
+ CUDNN_ATTR_OPERATION_SIGNAL_VALUE = 1902,
655
+ CUDNN_ATTR_OPERATION_SIGNAL_XDESC = 1903,
656
+ CUDNN_ATTR_OPERATION_SIGNAL_YDESC = 1904,
657
+
658
+ CUDNN_ATTR_OPERATION_NORM_FWD_MODE = 2000,
659
+ CUDNN_ATTR_OPERATION_NORM_FWD_PHASE = 2001,
660
+ CUDNN_ATTR_OPERATION_NORM_FWD_XDESC = 2002,
661
+ CUDNN_ATTR_OPERATION_NORM_FWD_MEAN_DESC = 2003,
662
+ CUDNN_ATTR_OPERATION_NORM_FWD_INV_VARIANCE_DESC = 2004,
663
+ CUDNN_ATTR_OPERATION_NORM_FWD_SCALE_DESC = 2005,
664
+ CUDNN_ATTR_OPERATION_NORM_FWD_BIAS_DESC = 2006,
665
+ CUDNN_ATTR_OPERATION_NORM_FWD_EPSILON_DESC = 2007,
666
+ CUDNN_ATTR_OPERATION_NORM_FWD_EXP_AVG_FACTOR_DESC = 2008,
667
+ CUDNN_ATTR_OPERATION_NORM_FWD_INPUT_RUNNING_MEAN_DESC = 2009,
668
+ CUDNN_ATTR_OPERATION_NORM_FWD_INPUT_RUNNING_VAR_DESC = 2010,
669
+ CUDNN_ATTR_OPERATION_NORM_FWD_OUTPUT_RUNNING_MEAN_DESC = 2011,
670
+ CUDNN_ATTR_OPERATION_NORM_FWD_OUTPUT_RUNNING_VAR_DESC = 2012,
671
+ CUDNN_ATTR_OPERATION_NORM_FWD_YDESC = 2013,
672
+ CUDNN_ATTR_OPERATION_NORM_FWD_PEER_STAT_DESCS = 2014,
673
+
674
+ CUDNN_ATTR_OPERATION_NORM_BWD_MODE = 2100,
675
+ CUDNN_ATTR_OPERATION_NORM_BWD_XDESC = 2101,
676
+ CUDNN_ATTR_OPERATION_NORM_BWD_MEAN_DESC = 2102,
677
+ CUDNN_ATTR_OPERATION_NORM_BWD_INV_VARIANCE_DESC = 2103,
678
+ CUDNN_ATTR_OPERATION_NORM_BWD_DYDESC = 2104,
679
+ CUDNN_ATTR_OPERATION_NORM_BWD_SCALE_DESC = 2105,
680
+ CUDNN_ATTR_OPERATION_NORM_BWD_EPSILON_DESC = 2106,
681
+ CUDNN_ATTR_OPERATION_NORM_BWD_DSCALE_DESC = 2107,
682
+ CUDNN_ATTR_OPERATION_NORM_BWD_DBIAS_DESC = 2108,
683
+ CUDNN_ATTR_OPERATION_NORM_BWD_DXDESC = 2109,
684
+ CUDNN_ATTR_OPERATION_NORM_BWD_PEER_STAT_DESCS = 2110,
685
+
686
+ CUDNN_ATTR_OPERATION_RESHAPE_XDESC = 2200,
687
+ CUDNN_ATTR_OPERATION_RESHAPE_YDESC = 2201,
688
+
689
+ CUDNN_ATTR_RNG_DISTRIBUTION = 2300,
690
+ CUDNN_ATTR_RNG_NORMAL_DIST_MEAN = 2301,
691
+ CUDNN_ATTR_RNG_NORMAL_DIST_STANDARD_DEVIATION = 2302,
692
+ CUDNN_ATTR_RNG_UNIFORM_DIST_MAXIMUM = 2303,
693
+ CUDNN_ATTR_RNG_UNIFORM_DIST_MINIMUM = 2304,
694
+ CUDNN_ATTR_RNG_BERNOULLI_DIST_PROBABILITY = 2305,
695
+
696
+ CUDNN_ATTR_OPERATION_RNG_YDESC = 2310,
697
+ CUDNN_ATTR_OPERATION_RNG_SEED = 2311,
698
+ CUDNN_ATTR_OPERATION_RNG_DESC = 2312,
699
+ CUDNN_ATTR_OPERATION_RNG_OFFSET_DESC = 2313,
700
+ } cudnnBackendAttributeName_t;
701
+
702
+ typedef enum {
703
+ CUDNN_TYPE_HANDLE = 0,
704
+ CUDNN_TYPE_DATA_TYPE,
705
+ CUDNN_TYPE_BOOLEAN,
706
+ CUDNN_TYPE_INT64,
707
+ CUDNN_TYPE_FLOAT,
708
+ CUDNN_TYPE_DOUBLE,
709
+ CUDNN_TYPE_VOID_PTR,
710
+ CUDNN_TYPE_CONVOLUTION_MODE,
711
+ CUDNN_TYPE_HEUR_MODE,
712
+ CUDNN_TYPE_KNOB_TYPE,
713
+ CUDNN_TYPE_NAN_PROPOGATION CUDNN_DEPRECATED_ENUM,
714
+ CUDNN_TYPE_NUMERICAL_NOTE,
715
+ CUDNN_TYPE_LAYOUT_TYPE,
716
+ CUDNN_TYPE_ATTRIB_NAME,
717
+ CUDNN_TYPE_POINTWISE_MODE,
718
+ CUDNN_TYPE_BACKEND_DESCRIPTOR,
719
+ CUDNN_TYPE_GENSTATS_MODE,
720
+ CUDNN_TYPE_BN_FINALIZE_STATS_MODE,
721
+ CUDNN_TYPE_REDUCTION_OPERATOR_TYPE,
722
+ CUDNN_TYPE_BEHAVIOR_NOTE,
723
+ CUDNN_TYPE_TENSOR_REORDERING_MODE,
724
+ CUDNN_TYPE_RESAMPLE_MODE,
725
+ CUDNN_TYPE_PADDING_MODE,
726
+ CUDNN_TYPE_INT32,
727
+ CUDNN_TYPE_CHAR,
728
+ CUDNN_TYPE_SIGNAL_MODE,
729
+ CUDNN_TYPE_FRACTION,
730
+ CUDNN_TYPE_NORM_MODE,
731
+ CUDNN_TYPE_NORM_FWD_PHASE,
732
+ CUDNN_TYPE_RNG_DISTRIBUTION
733
+ } cudnnBackendAttributeType_t;
734
+
735
+ typedef enum {
736
+ CUDNN_BACKEND_POINTWISE_DESCRIPTOR = 0,
737
+ CUDNN_BACKEND_CONVOLUTION_DESCRIPTOR,
738
+ CUDNN_BACKEND_ENGINE_DESCRIPTOR,
739
+ CUDNN_BACKEND_ENGINECFG_DESCRIPTOR,
740
+ CUDNN_BACKEND_ENGINEHEUR_DESCRIPTOR,
741
+ CUDNN_BACKEND_EXECUTION_PLAN_DESCRIPTOR,
742
+ CUDNN_BACKEND_INTERMEDIATE_INFO_DESCRIPTOR,
743
+ CUDNN_BACKEND_KNOB_CHOICE_DESCRIPTOR,
744
+ CUDNN_BACKEND_KNOB_INFO_DESCRIPTOR,
745
+ CUDNN_BACKEND_LAYOUT_INFO_DESCRIPTOR,
746
+ CUDNN_BACKEND_OPERATION_CONVOLUTION_FORWARD_DESCRIPTOR,
747
+ CUDNN_BACKEND_OPERATION_CONVOLUTION_BACKWARD_FILTER_DESCRIPTOR,
748
+ CUDNN_BACKEND_OPERATION_CONVOLUTION_BACKWARD_DATA_DESCRIPTOR,
749
+ CUDNN_BACKEND_OPERATION_POINTWISE_DESCRIPTOR,
750
+ CUDNN_BACKEND_OPERATION_GEN_STATS_DESCRIPTOR,
751
+ CUDNN_BACKEND_OPERATIONGRAPH_DESCRIPTOR,
752
+ CUDNN_BACKEND_VARIANT_PACK_DESCRIPTOR,
753
+ CUDNN_BACKEND_TENSOR_DESCRIPTOR,
754
+ CUDNN_BACKEND_MATMUL_DESCRIPTOR,
755
+ CUDNN_BACKEND_OPERATION_MATMUL_DESCRIPTOR,
756
+ CUDNN_BACKEND_OPERATION_BN_FINALIZE_STATISTICS_DESCRIPTOR,
757
+ CUDNN_BACKEND_REDUCTION_DESCRIPTOR,
758
+ CUDNN_BACKEND_OPERATION_REDUCTION_DESCRIPTOR,
759
+ CUDNN_BACKEND_OPERATION_BN_BWD_WEIGHTS_DESCRIPTOR,
760
+ CUDNN_BACKEND_RESAMPLE_DESCRIPTOR,
761
+ CUDNN_BACKEND_OPERATION_RESAMPLE_FWD_DESCRIPTOR,
762
+ CUDNN_BACKEND_OPERATION_RESAMPLE_BWD_DESCRIPTOR,
763
+ CUDNN_BACKEND_OPERATION_CONCAT_DESCRIPTOR,
764
+ CUDNN_BACKEND_OPERATION_SIGNAL_DESCRIPTOR,
765
+ CUDNN_BACKEND_OPERATION_NORM_FORWARD_DESCRIPTOR,
766
+ CUDNN_BACKEND_OPERATION_NORM_BACKWARD_DESCRIPTOR,
767
+ CUDNN_BACKEND_OPERATION_RESHAPE_DESCRIPTOR,
768
+ CUDNN_BACKEND_RNG_DESCRIPTOR,
769
+ CUDNN_BACKEND_OPERATION_RNG_DESCRIPTOR,
770
+ } cudnnBackendDescriptorType_t;
771
+
772
+ typedef enum {
773
+ CUDNN_NUMERICAL_NOTE_TENSOR_CORE = 0,
774
+ CUDNN_NUMERICAL_NOTE_DOWN_CONVERT_INPUTS,
775
+ CUDNN_NUMERICAL_NOTE_REDUCED_PRECISION_REDUCTION,
776
+ CUDNN_NUMERICAL_NOTE_FFT,
777
+ CUDNN_NUMERICAL_NOTE_NONDETERMINISTIC,
778
+ CUDNN_NUMERICAL_NOTE_WINOGRAD,
779
+ CUDNN_NUMERICAL_NOTE_WINOGRAD_TILE_4x4,
780
+ CUDNN_NUMERICAL_NOTE_WINOGRAD_TILE_6x6,
781
+ CUDNN_NUMERICAL_NOTE_WINOGRAD_TILE_13x13,
782
+ CUDNN_NUMERICAL_NOTE_STRICT_NAN_PROP,
783
+ CUDNN_NUMERICAL_NOTE_TYPE_COUNT,
784
+ } cudnnBackendNumericalNote_t;
785
+
786
+ typedef enum {
787
+ CUDNN_BEHAVIOR_NOTE_RUNTIME_COMPILATION = 0,
788
+ CUDNN_BEHAVIOR_NOTE_REQUIRES_FILTER_INT8x32_REORDER = 1,
789
+ CUDNN_BEHAVIOR_NOTE_REQUIRES_BIAS_INT8x32_REORDER = 2,
790
+ CUDNN_BEHAVIOR_NOTE_TYPE_COUNT,
791
+ } cudnnBackendBehaviorNote_t;
792
+
793
+ typedef enum {
794
+ CUDNN_KNOB_TYPE_SPLIT_K CUDNN_DEPRECATED_ENUM = 0,
795
+ CUDNN_KNOB_TYPE_SWIZZLE = 1,
796
+ CUDNN_KNOB_TYPE_TILE_SIZE = 2,
797
+ CUDNN_KNOB_TYPE_USE_TEX CUDNN_DEPRECATED_ENUM = 3,
798
+ CUDNN_KNOB_TYPE_EDGE = 4,
799
+ CUDNN_KNOB_TYPE_KBLOCK CUDNN_DEPRECATED_ENUM = 5,
800
+ CUDNN_KNOB_TYPE_LDGA CUDNN_DEPRECATED_ENUM = 6,
801
+ CUDNN_KNOB_TYPE_LDGB CUDNN_DEPRECATED_ENUM = 7,
802
+ CUDNN_KNOB_TYPE_CHUNK_K CUDNN_DEPRECATED_ENUM = 8,
803
+ CUDNN_KNOB_TYPE_SPLIT_H CUDNN_DEPRECATED_ENUM = 9,
804
+ CUDNN_KNOB_TYPE_WINO_TILE CUDNN_DEPRECATED_ENUM = 10,
805
+ CUDNN_KNOB_TYPE_MULTIPLY = 11,
806
+ CUDNN_KNOB_TYPE_SPLIT_K_BUF = 12,
807
+ CUDNN_KNOB_TYPE_TILEK = 13,
808
+ CUDNN_KNOB_TYPE_STAGES = 14,
809
+ CUDNN_KNOB_TYPE_REDUCTION_MODE = 15,
810
+ CUDNN_KNOB_TYPE_CTA_SPLIT_K_MODE CUDNN_DEPRECATED_ENUM = 16,
811
+ CUDNN_KNOB_TYPE_SPLIT_K_SLC = 17,
812
+ CUDNN_KNOB_TYPE_IDX_MODE CUDNN_DEPRECATED_ENUM = 18,
813
+ CUDNN_KNOB_TYPE_SLICED CUDNN_DEPRECATED_ENUM = 19,
814
+ CUDNN_KNOB_TYPE_SPLIT_RS CUDNN_DEPRECATED_ENUM = 20,
815
+ CUDNN_KNOB_TYPE_SINGLEBUFFER CUDNN_DEPRECATED_ENUM = 21,
816
+ CUDNN_KNOB_TYPE_LDGC CUDNN_DEPRECATED_ENUM = 22,
817
+ CUDNN_KNOB_TYPE_SPECFILT = 23,
818
+ CUDNN_KNOB_TYPE_KERNEL_CFG = 24,
819
+ CUDNN_KNOB_TYPE_WORKSPACE = 25,
820
+ CUDNN_KNOB_TYPE_TILE_CGA CUDNN_DEPRECATED_ENUM = 26,
821
+ CUDNN_KNOB_TYPE_TILE_CGA_M = 27,
822
+ CUDNN_KNOB_TYPE_TILE_CGA_N = 28,
823
+ CUDNN_KNOB_TYPE_BLOCK_SIZE = 29,
824
+ CUDNN_KNOB_TYPE_OCCUPANCY = 30,
825
+ CUDNN_KNOB_TYPE_ARRAY_SIZE_PER_THREAD = 31,
826
+ CUDNN_KNOB_TYPE_NUM_C_PER_BLOCK CUDNN_DEPRECATED_ENUM = 32,
827
+ CUDNN_KNOB_TYPE_SPLIT_COLS = 33,
828
+ CUDNN_KNOB_TYPE_TILE_ROWS = 34,
829
+ CUDNN_KNOB_TYPE_TILE_COLS = 35,
830
+ CUDNN_KNOB_TYPE_LOAD_SIZE = 36,
831
+ CUDNN_KNOB_TYPE_COUNTS,
832
+ } cudnnBackendKnobType_t;
833
+
834
+ typedef enum {
835
+ CUDNN_LAYOUT_TYPE_PREFERRED_NCHW = 0,
836
+ CUDNN_LAYOUT_TYPE_PREFERRED_NHWC = 1,
837
+ CUDNN_LAYOUT_TYPE_PREFERRED_PAD4CK = 2,
838
+ CUDNN_LAYOUT_TYPE_PREFERRED_PAD8CK = 3,
839
+ CUDNN_LAYOUT_TYPE_COUNT = 4,
840
+ } cudnnBackendLayoutType_t;
841
+
842
+ typedef enum {
843
+ CUDNN_HEUR_MODE_INSTANT = 0,
844
+ CUDNN_HEUR_MODE_B = 1,
845
+ CUDNN_HEUR_MODE_FALLBACK = 2,
846
+ CUDNN_HEUR_MODE_A = 3,
847
+ CUDNN_HEUR_MODES_COUNT = 4,
848
+ } cudnnBackendHeurMode_t;
849
+
850
+ typedef enum {
851
+ CUDNN_TENSOR_REORDERING_NONE = 0,
852
+ CUDNN_TENSOR_REORDERING_INT8x32 = 1,
853
+ CUDNN_TENSOR_REORDERING_F16x16 = 2,
854
+ } cudnnBackendTensorReordering_t;
855
+
856
+ typedef enum {
857
+ CUDNN_ZERO_PAD = 0,
858
+ CUDNN_NEG_INF_PAD = 1,
859
+ CUDNN_EDGE_VAL_PAD = 2,
860
+ } cudnnPaddingMode_t;
861
+
862
+ typedef enum {
863
+ CUDNN_LAYER_NORM = 0,
864
+ CUDNN_INSTANCE_NORM = 1,
865
+ CUDNN_BATCH_NORM = 2,
866
+ CUDNN_GROUP_NORM = 3,
867
+ CUDNN_RMS_NORM = 4,
868
+ } cudnnBackendNormMode_t;
869
+
870
+ typedef enum {
871
+ CUDNN_NORM_FWD_INFERENCE = 0,
872
+ CUDNN_NORM_FWD_TRAINING = 1,
873
+ } cudnnBackendNormFwdPhase_t;
874
+
875
+ cudnnStatus_t CUDNNWINAPI
876
+ cudnnBackendCreateDescriptor(cudnnBackendDescriptorType_t descriptorType, cudnnBackendDescriptor_t *descriptor);
877
+
878
+ cudnnStatus_t CUDNNWINAPI
879
+ cudnnBackendDestroyDescriptor(cudnnBackendDescriptor_t descriptor);
880
+
881
+ cudnnStatus_t CUDNNWINAPI
882
+ cudnnBackendInitialize(cudnnBackendDescriptor_t descriptor);
883
+
884
+ cudnnStatus_t CUDNNWINAPI
885
+ cudnnBackendFinalize(cudnnBackendDescriptor_t descriptor);
886
+
887
+ cudnnStatus_t CUDNNWINAPI
888
+ cudnnBackendSetAttribute(cudnnBackendDescriptor_t descriptor,
889
+ cudnnBackendAttributeName_t attributeName,
890
+ cudnnBackendAttributeType_t attributeType,
891
+ int64_t elementCount,
892
+ const void *arrayOfElements);
893
+
894
+ cudnnStatus_t CUDNNWINAPI
895
+ cudnnBackendGetAttribute(cudnnBackendDescriptor_t const descriptor,
896
+ cudnnBackendAttributeName_t attributeName,
897
+ cudnnBackendAttributeType_t attributeType,
898
+ int64_t requestedElementCount,
899
+ int64_t *elementCount,
900
+ void *arrayOfElements);
901
+
902
+ cudnnStatus_t CUDNNWINAPI
903
+ cudnnBackendExecute(cudnnHandle_t handle, cudnnBackendDescriptor_t executionPlan, cudnnBackendDescriptor_t variantPack);
904
+
905
+ #if defined(__cplusplus)
906
+ }
907
+ #endif
908
+
909
+ #endif /* CUDNN_GRAPH_H_ */
lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_graph_v9.h ADDED
@@ -0,0 +1,909 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright 2014-2023 NVIDIA Corporation. All rights reserved.
3
+ *
4
+ * NOTICE TO LICENSEE:
5
+ *
6
+ * This source code and/or documentation ("Licensed Deliverables") are
7
+ * subject to NVIDIA intellectual property rights under U.S. and
8
+ * international Copyright laws.
9
+ *
10
+ * These Licensed Deliverables contained herein is PROPRIETARY and
11
+ * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12
+ * conditions of a form of NVIDIA software license agreement by and
13
+ * between NVIDIA and Licensee ("License Agreement") or electronically
14
+ * accepted by Licensee. Notwithstanding any terms or conditions to
15
+ * the contrary in the License Agreement, reproduction or disclosure
16
+ * of the Licensed Deliverables to any third party without the express
17
+ * written consent of NVIDIA is prohibited.
18
+ *
19
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20
+ * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21
+ * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
22
+ * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23
+ * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24
+ * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25
+ * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27
+ * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28
+ * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32
+ * OF THESE LICENSED DELIVERABLES.
33
+ *
34
+ * U.S. Government End Users. These Licensed Deliverables are a
35
+ * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36
+ * 1995), consisting of "commercial computer software" and "commercial
37
+ * computer software documentation" as such terms are used in 48
38
+ * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39
+ * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40
+ * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41
+ * U.S. Government End Users acquire the Licensed Deliverables with
42
+ * only those rights set forth herein.
43
+ *
44
+ * Any use of the Licensed Deliverables in individual and commercial
45
+ * software must include, in the user documentation and internal
46
+ * comments to the code, the above Disclaimer and U.S. Government End
47
+ * Users Notice.
48
+ */
49
+
50
+ /*
51
+ * cudnn_graph : cuDNN's basic definitions operations.
52
+ */
53
+
54
+ #if !defined(CUDNN_GRAPH_H_)
55
+ #define CUDNN_GRAPH_H_
56
+
57
+ #include <cuda_runtime_api.h>
58
+ #include <library_types.h>
59
+
60
+ #include <stdint.h>
61
+
62
+ #include "cudnn_version.h"
63
+
64
+ /* These version numbers are autogenerated, do not edit manually. */
65
+ #define CUDNN_GRAPH_MAJOR 9
66
+ #define CUDNN_GRAPH_MINOR 1
67
+ #define CUDNN_GRAPH_PATCH 0
68
+
69
+ #if (CUDNN_GRAPH_MAJOR != CUDNN_MAJOR) || (CUDNN_GRAPH_MINOR != CUDNN_MINOR) || (CUDNN_GRAPH_PATCH != CUDNN_PATCHLEVEL)
70
+ #error Version mismatch in cuDNN GRAPH!!!
71
+ #endif
72
+
73
+ #ifndef CUDNNWINAPI
74
+ #ifdef _WIN32
75
+ #define CUDNNWINAPI __stdcall
76
+ #else
77
+ #define CUDNNWINAPI
78
+ #endif
79
+ #endif
80
+
81
+ /* Warnings for deprecated API-s are enabled using the CUDNN_WARN_DEPRECATED macro */
82
+ #if defined(CUDNN_WARN_DEPRECATED) && (defined(__GNUC__) || defined(__clang__))
83
+ /* GCC, Intel C/C++, Cray C/C++, CLANG, IBM XL C/C++ little endian */
84
+ #define CUDNN_DEPRECATED __attribute__((deprecated))
85
+ #define CUDNN_DEPRECATED_ENUM __attribute__((deprecated))
86
+ #elif defined(CUDNN_WARN_DEPRECATED) && defined(_MSC_VER)
87
+ /* Microsoft Visual C++ */
88
+ #define CUDNN_DEPRECATED __declspec(deprecated)
89
+ #define CUDNN_DEPRECATED_ENUM __declspec(deprecated)
90
+ #elif defined(CUDNN_WARN_DEPRECATED) && (__cplusplus >= 201402L)
91
+ /* C++14 compilers */
92
+ #define CUDNN_DEPRECATED [[deprecated]]
93
+ #define CUDNN_DEPRECATED_ENUM [[deprecated]]
94
+ #else
95
+ /* No support for the deprecated attribute */
96
+ #define CUDNN_DEPRECATED
97
+ #define CUDNN_DEPRECATED_ENUM
98
+ #endif
99
+
100
+ #if defined(__cplusplus)
101
+ extern "C" {
102
+ #endif
103
+
104
+ struct cudnnContext;
105
+ typedef struct cudnnContext *cudnnHandle_t;
106
+
107
+ size_t CUDNNWINAPI
108
+ cudnnGetVersion(void);
109
+
110
+ size_t CUDNNWINAPI
111
+ cudnnGetMaxDeviceVersion(void);
112
+
113
+ /* Returns CUDA Runtime version statically linked against cudnn */
114
+ size_t CUDNNWINAPI
115
+ cudnnGetCudartVersion(void);
116
+
117
+ /*
118
+ * CUDNN return codes
119
+ */
120
+ typedef enum {
121
+ CUDNN_STATUS_SUCCESS = 0,
122
+
123
+ /* Uncategorized errors */
124
+ CUDNN_STATUS_NOT_INITIALIZED = 1001,
125
+ CUDNN_STATUS_SUBLIBRARY_VERSION_MISMATCH = 1002,
126
+ CUDNN_STATUS_SERIALIZATION_VERSION_MISMATCH = 1003,
127
+ CUDNN_STATUS_DEPRECATED = 1004,
128
+ CUDNN_STATUS_LICENSE_ERROR = 1005,
129
+ CUDNN_STATUS_RUNTIME_IN_PROGRESS = 1006,
130
+ CUDNN_STATUS_RUNTIME_FP_OVERFLOW = 1007,
131
+
132
+ CUDNN_STATUS_BAD_PARAM = 2000,
133
+ CUDNN_STATUS_BAD_PARAM_NULL_POINTER = 2002,
134
+ CUDNN_STATUS_BAD_PARAM_MISALIGNED_POINTER = 2003,
135
+ CUDNN_STATUS_BAD_PARAM_NOT_FINALIZED = 2004,
136
+ CUDNN_STATUS_BAD_PARAM_OUT_OF_BOUND = 2005,
137
+ CUDNN_STATUS_BAD_PARAM_SIZE_INSUFFICIENT = 2006,
138
+ CUDNN_STATUS_BAD_PARAM_STREAM_MISMATCH = 2007,
139
+ CUDNN_STATUS_BAD_PARAM_SHAPE_MISMATCH = 2008,
140
+ CUDNN_STATUS_BAD_PARAM_DUPLICATED_ENTRIES = 2009,
141
+ CUDNN_STATUS_BAD_PARAM_ATTRIBUTE_TYPE = 2010,
142
+
143
+ CUDNN_STATUS_NOT_SUPPORTED = 3000,
144
+ CUDNN_STATUS_NOT_SUPPORTED_GRAPH_PATTERN = 3001,
145
+ CUDNN_STATUS_NOT_SUPPORTED_SHAPE = 3002,
146
+ CUDNN_STATUS_NOT_SUPPORTED_DATA_TYPE = 3003,
147
+ CUDNN_STATUS_NOT_SUPPORTED_LAYOUT = 3004,
148
+ CUDNN_STATUS_NOT_SUPPORTED_INCOMPATIBLE_CUDA_DRIVER = 3005,
149
+ CUDNN_STATUS_NOT_SUPPORTED_INCOMPATIBLE_CUDART = 3006,
150
+ CUDNN_STATUS_NOT_SUPPORTED_ARCH_MISMATCH = 3007,
151
+ CUDNN_STATUS_NOT_SUPPORTED_RUNTIME_PREREQUISITE_MISSING = 3008,
152
+ CUDNN_STATUS_NOT_SUPPORTED_SUBLIBRARY_UNAVAILABLE = 3009,
153
+ CUDNN_STATUS_NOT_SUPPORTED_SHARED_MEMORY_INSUFFICIENT = 3010,
154
+ CUDNN_STATUS_NOT_SUPPORTED_PADDING = 3011,
155
+ CUDNN_STATUS_NOT_SUPPORTED_BAD_LAUNCH_PARAM = 3012,
156
+
157
+ CUDNN_STATUS_INTERNAL_ERROR = 4000,
158
+ CUDNN_STATUS_INTERNAL_ERROR_COMPILATION_FAILED = 4001,
159
+ CUDNN_STATUS_INTERNAL_ERROR_UNEXPECTED_VALUE = 4002,
160
+ CUDNN_STATUS_INTERNAL_ERROR_HOST_ALLOCATION_FAILED = 4003,
161
+ CUDNN_STATUS_INTERNAL_ERROR_DEVICE_ALLOCATION_FAILED = 4004,
162
+ CUDNN_STATUS_INTERNAL_ERROR_BAD_LAUNCH_PARAM = 4005,
163
+ CUDNN_STATUS_INTERNAL_ERROR_TEXTURE_CREATION_FAILED = 4006,
164
+
165
+ CUDNN_STATUS_EXECUTION_FAILED = 5000,
166
+ CUDNN_STATUS_EXECUTION_FAILED_CUDA_DRIVER = 5001,
167
+ CUDNN_STATUS_EXECUTION_FAILED_CUBLAS = 5002,
168
+ CUDNN_STATUS_EXECUTION_FAILED_CUDART = 5003,
169
+ CUDNN_STATUS_EXECUTION_FAILED_CURAND = 5004,
170
+
171
+ CUDNN_STATUS_ALLOC_FAILED CUDNN_DEPRECATED_ENUM = CUDNN_STATUS_INTERNAL_ERROR_HOST_ALLOCATION_FAILED,
172
+ CUDNN_STATUS_INVALID_VALUE CUDNN_DEPRECATED_ENUM = 2001 /* please transition to CUDNN_STATUS_BAD_PARAM instead */,
173
+ CUDNN_STATUS_ARCH_MISMATCH CUDNN_DEPRECATED_ENUM = CUDNN_STATUS_NOT_SUPPORTED_ARCH_MISMATCH,
174
+ CUDNN_STATUS_MAPPING_ERROR CUDNN_DEPRECATED_ENUM = CUDNN_STATUS_INTERNAL_ERROR_TEXTURE_CREATION_FAILED,
175
+ CUDNN_STATUS_RUNTIME_PREREQUISITE_MISSING CUDNN_DEPRECATED_ENUM =
176
+ CUDNN_STATUS_NOT_SUPPORTED_RUNTIME_PREREQUISITE_MISSING,
177
+ CUDNN_STATUS_VERSION_MISMATCH CUDNN_DEPRECATED_ENUM = CUDNN_STATUS_SUBLIBRARY_VERSION_MISMATCH,
178
+ } cudnnStatus_t;
179
+
180
+ #define CUDNN_STATUS_FULL_ERROR_CODE(category, specific_err) ((cudnnStatus_t)(0 + (category) + (specific_err)))
181
+ #define CUDNN_STATUS_CATEGORY(full_error_code) ((full_error_code) / 1000 * 1000)
182
+ #define CUDNN_STATUS_SPECIFIC_ERROR(full_error_code) ((full_error_code) % 1000)
183
+
184
+ /* human-readable error messages */
185
+ const char *CUDNNWINAPI
186
+ cudnnGetErrorString(cudnnStatus_t status);
187
+
188
+ void CUDNNWINAPI
189
+ cudnnGetLastErrorString(char *message, size_t max_size);
190
+
191
+ /* Forward definition in this version only */
192
+ typedef struct cudnnRuntimeTag_t cudnnRuntimeTag_t CUDNN_DEPRECATED;
193
+
194
+ typedef enum {
195
+ CUDNN_ERRQUERY_RAWCODE = 0,
196
+ CUDNN_ERRQUERY_NONBLOCKING = 1,
197
+ CUDNN_ERRQUERY_BLOCKING = 2,
198
+ } cudnnErrQueryMode_t;
199
+
200
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
201
+ cudnnQueryRuntimeError(cudnnHandle_t handle, cudnnStatus_t *rstatus, cudnnErrQueryMode_t mode, cudnnRuntimeTag_t *tag);
202
+
203
+ cudnnStatus_t CUDNNWINAPI
204
+ cudnnGetProperty(libraryPropertyType type, int *value);
205
+
206
+ cudnnStatus_t CUDNNWINAPI
207
+ cudnnCreate(cudnnHandle_t *handle);
208
+ cudnnStatus_t CUDNNWINAPI
209
+ cudnnDestroy(cudnnHandle_t handle);
210
+ cudnnStatus_t CUDNNWINAPI
211
+ cudnnSetStream(cudnnHandle_t handle, cudaStream_t streamId);
212
+ cudnnStatus_t CUDNNWINAPI
213
+ cudnnGetStream(cudnnHandle_t handle, cudaStream_t *streamId);
214
+ /*
215
+ * CUDNN data type
216
+ */
217
+ typedef enum {
218
+ CUDNN_DATA_FLOAT = 0,
219
+ CUDNN_DATA_DOUBLE = 1,
220
+ CUDNN_DATA_HALF = 2,
221
+ CUDNN_DATA_INT8 = 3,
222
+ CUDNN_DATA_INT32 = 4,
223
+ CUDNN_DATA_INT8x4 CUDNN_DEPRECATED_ENUM = 5,
224
+ CUDNN_DATA_UINT8 = 6,
225
+ CUDNN_DATA_UINT8x4 CUDNN_DEPRECATED_ENUM = 7,
226
+ CUDNN_DATA_INT8x32 CUDNN_DEPRECATED_ENUM = 8,
227
+ CUDNN_DATA_BFLOAT16 = 9,
228
+ CUDNN_DATA_INT64 = 10,
229
+ CUDNN_DATA_BOOLEAN = 11,
230
+ CUDNN_DATA_FP8_E4M3 = 12,
231
+ CUDNN_DATA_FP8_E5M2 = 13,
232
+ CUDNN_DATA_FAST_FLOAT_FOR_FP8 = 14,
233
+ } cudnnDataType_t;
234
+
235
+ /*
236
+ * CUDNN math type
237
+ */
238
+ typedef enum {
239
+ CUDNN_DEFAULT_MATH = 0,
240
+ CUDNN_TENSOR_OP_MATH = 1,
241
+ CUDNN_TENSOR_OP_MATH_ALLOW_CONVERSION = 2,
242
+ CUDNN_FMA_MATH = 3,
243
+ } cudnnMathType_t;
244
+
245
+ /*
246
+ * CUDNN propagate Nan
247
+ */
248
+ typedef enum {
249
+ CUDNN_NOT_PROPAGATE_NAN CUDNN_DEPRECATED_ENUM = 0,
250
+ CUDNN_PROPAGATE_NAN CUDNN_DEPRECATED_ENUM = 1,
251
+ } cudnnNanPropagation_t;
252
+
253
+ /*
254
+ * Behavior for OOB samples. OOB samples are samples where L+R > T is encountered during the gradient calculation. If
255
+ * gradMode is set to CUDNN_CTC_SKIP_OOB_GRADIENTS, then the CTC loss function does not write to the gradient buffer for
256
+ * that sample. Instead, the current values, even not finite, are retained. If gradMode is set to
257
+ * CUDNN_CTC_ZERO_OOB_GRADIENTS, then the gradient for that sample is set to zero. This guarantees a finite gradient.
258
+ */
259
+ typedef enum {
260
+ CUDNN_CTC_ZERO_OOB_GRADIENTS = 0,
261
+ CUDNN_CTC_SKIP_OOB_GRADIENTS = 1,
262
+ } cudnnCTCGradMode_t;
263
+
264
+ typedef enum {
265
+ CUDNN_TENSOR_NCHW = 0, /* row major (wStride = 1, hStride = w) */
266
+ CUDNN_TENSOR_NHWC = 1, /* feature maps interleaved ( cStride = 1 )*/
267
+ CUDNN_TENSOR_NCHW_VECT_C = 2, /* each image point is vector of element of C, vector length in data type */
268
+ } cudnnTensorFormat_t;
269
+
270
+ /*
271
+ * CUDNN ReduceTensor op type
272
+ */
273
+ typedef enum {
274
+ CUDNN_REDUCE_TENSOR_ADD = 0,
275
+ CUDNN_REDUCE_TENSOR_MUL = 1,
276
+ CUDNN_REDUCE_TENSOR_MIN = 2,
277
+ CUDNN_REDUCE_TENSOR_MAX = 3,
278
+ CUDNN_REDUCE_TENSOR_AMAX = 4,
279
+ CUDNN_REDUCE_TENSOR_AVG = 5,
280
+ CUDNN_REDUCE_TENSOR_NORM1 = 6,
281
+ CUDNN_REDUCE_TENSOR_NORM2 = 7,
282
+ CUDNN_REDUCE_TENSOR_MUL_NO_ZEROS = 8,
283
+ } cudnnReduceTensorOp_t;
284
+
285
+ /*
286
+ * activation mode
287
+ */
288
+ typedef enum {
289
+ CUDNN_ACTIVATION_SIGMOID = 0,
290
+ CUDNN_ACTIVATION_RELU = 1,
291
+ CUDNN_ACTIVATION_TANH = 2,
292
+ CUDNN_ACTIVATION_CLIPPED_RELU = 3,
293
+ CUDNN_ACTIVATION_ELU = 4,
294
+ CUDNN_ACTIVATION_IDENTITY = 5,
295
+ CUDNN_ACTIVATION_SWISH = 6
296
+ } cudnnActivationMode_t CUDNN_DEPRECATED;
297
+
298
+ typedef enum {
299
+ CUDNN_SEV_FATAL = 0,
300
+ CUDNN_SEV_ERROR = 1,
301
+ CUDNN_SEV_WARNING = 2,
302
+ CUDNN_SEV_INFO = 3,
303
+ } cudnnSeverity_t;
304
+
305
+ /* Message masks to be used with cudnnSetCallback() */
306
+ #define CUDNN_SEV_ERROR_EN (1U << CUDNN_SEV_ERROR)
307
+ #define CUDNN_SEV_WARNING_EN (1U << CUDNN_SEV_WARNING)
308
+ #define CUDNN_SEV_INFO_EN (1U << CUDNN_SEV_INFO)
309
+
310
+ /* struct containing useful informaiton for each API call */
311
+ typedef struct cudnnDebugStruct {
312
+ unsigned cudnn_version;
313
+ cudnnStatus_t cudnnStatus;
314
+ unsigned time_sec; /* epoch time in seconds */
315
+ unsigned time_usec; /* microseconds part of epoch time */
316
+ unsigned time_delta; /* time since start in seconds */
317
+ cudnnHandle_t handle; /* cudnn handle */
318
+ cudaStream_t stream; /* cuda stream ID */
319
+ unsigned long long pid; /* process ID */
320
+ unsigned long long tid; /* thread ID */
321
+ int cudaDeviceId; /* CUDA device ID */
322
+ int reserved[15]; /* reserved for future use */
323
+ } cudnnDebug_t;
324
+
325
+ typedef void (*cudnnCallback_t)(cudnnSeverity_t sev, void *udata, const cudnnDebug_t *dbg, const char *msg);
326
+
327
+ cudnnStatus_t CUDNNWINAPI
328
+ cudnnSetCallback(unsigned mask, void *udata, cudnnCallback_t fptr);
329
+
330
+ cudnnStatus_t CUDNNWINAPI
331
+ cudnnGetCallback(unsigned *mask, void **udata, cudnnCallback_t *fptr);
332
+
333
+ /*
334
+ * \brief Cross-library version checker.
335
+ * This function is implemented differently in each sub-library. Each sublib
336
+ * checks whether its own version matches that of its dependencies.
337
+ * \returns CUDNN_STATUS_SUCCESS if the version check passes,
338
+ * CUDNN_STATUS_SUBLIBRARY_VERSION_MISMATCH if the versions are inconsistent.
339
+ */
340
+ cudnnStatus_t CUDNNWINAPI
341
+ cudnnGraphVersionCheck(void);
342
+
343
+ /* Maximum supported number of tensor dimensions */
344
+ #define CUDNN_DIM_MAX 8
345
+
346
+ /*
347
+ * convolution mode
348
+ */
349
+ typedef enum { CUDNN_CONVOLUTION = 0, CUDNN_CROSS_CORRELATION = 1 } cudnnConvolutionMode_t;
350
+
351
+ /*
352
+ * CUDNN Reorder
353
+ */
354
+ typedef enum {
355
+ CUDNN_DEFAULT_REORDER = 0,
356
+ CUDNN_NO_REORDER = 1,
357
+ } cudnnReorderType_t CUDNN_DEPRECATED;
358
+
359
+ typedef void *cudnnBackendDescriptor_t;
360
+
361
+ typedef struct cudnnFractionStruct {
362
+ int64_t numerator;
363
+ int64_t denominator;
364
+ } cudnnFraction_t;
365
+
366
+ typedef enum {
367
+ CUDNN_POINTWISE_ADD = 0,
368
+ CUDNN_POINTWISE_ADD_SQUARE = 5,
369
+ CUDNN_POINTWISE_DIV = 6,
370
+ CUDNN_POINTWISE_MAX = 3,
371
+ CUDNN_POINTWISE_MIN = 2,
372
+ CUDNN_POINTWISE_MOD = 7,
373
+ CUDNN_POINTWISE_MUL = 1,
374
+ CUDNN_POINTWISE_POW = 8,
375
+ CUDNN_POINTWISE_SUB = 9,
376
+
377
+ CUDNN_POINTWISE_ABS = 10,
378
+ CUDNN_POINTWISE_CEIL = 11,
379
+ CUDNN_POINTWISE_COS = 12,
380
+ CUDNN_POINTWISE_EXP = 13,
381
+ CUDNN_POINTWISE_FLOOR = 14,
382
+ CUDNN_POINTWISE_LOG = 15,
383
+ CUDNN_POINTWISE_NEG = 16,
384
+ CUDNN_POINTWISE_RSQRT = 17,
385
+ CUDNN_POINTWISE_SIN = 18,
386
+ CUDNN_POINTWISE_SQRT = 4,
387
+ CUDNN_POINTWISE_TAN = 19,
388
+ CUDNN_POINTWISE_ERF = 20,
389
+ CUDNN_POINTWISE_IDENTITY = 21,
390
+ CUDNN_POINTWISE_RECIPROCAL = 22,
391
+ CUDNN_POINTWISE_ATAN2 = 23,
392
+
393
+ CUDNN_POINTWISE_RELU_FWD = 100,
394
+ CUDNN_POINTWISE_TANH_FWD = 101,
395
+ CUDNN_POINTWISE_SIGMOID_FWD = 102,
396
+ CUDNN_POINTWISE_ELU_FWD = 103,
397
+ CUDNN_POINTWISE_GELU_FWD = 104,
398
+ CUDNN_POINTWISE_SOFTPLUS_FWD = 105,
399
+ CUDNN_POINTWISE_SWISH_FWD = 106,
400
+ CUDNN_POINTWISE_GELU_APPROX_TANH_FWD = 107,
401
+
402
+ CUDNN_POINTWISE_RELU_BWD = 200,
403
+ CUDNN_POINTWISE_TANH_BWD = 201,
404
+ CUDNN_POINTWISE_SIGMOID_BWD = 202,
405
+ CUDNN_POINTWISE_ELU_BWD = 203,
406
+ CUDNN_POINTWISE_GELU_BWD = 204,
407
+ CUDNN_POINTWISE_SOFTPLUS_BWD = 205,
408
+ CUDNN_POINTWISE_SWISH_BWD = 206,
409
+ CUDNN_POINTWISE_GELU_APPROX_TANH_BWD = 207,
410
+
411
+ CUDNN_POINTWISE_CMP_EQ = 300,
412
+ CUDNN_POINTWISE_CMP_NEQ = 301,
413
+ CUDNN_POINTWISE_CMP_GT = 302,
414
+ CUDNN_POINTWISE_CMP_GE = 303,
415
+ CUDNN_POINTWISE_CMP_LT = 304,
416
+ CUDNN_POINTWISE_CMP_LE = 305,
417
+
418
+ CUDNN_POINTWISE_LOGICAL_AND = 400,
419
+ CUDNN_POINTWISE_LOGICAL_OR = 401,
420
+ CUDNN_POINTWISE_LOGICAL_NOT = 402,
421
+
422
+ CUDNN_POINTWISE_GEN_INDEX = 501,
423
+
424
+ CUDNN_POINTWISE_BINARY_SELECT = 601,
425
+ } cudnnPointwiseMode_t;
426
+
427
+ typedef enum {
428
+ CUDNN_RESAMPLE_NEAREST = 0,
429
+ CUDNN_RESAMPLE_BILINEAR = 1,
430
+ CUDNN_RESAMPLE_AVGPOOL = 2,
431
+ CUDNN_RESAMPLE_AVGPOOL_INCLUDE_PADDING = 2,
432
+ CUDNN_RESAMPLE_AVGPOOL_EXCLUDE_PADDING = 4,
433
+ CUDNN_RESAMPLE_MAXPOOL = 3,
434
+ } cudnnResampleMode_t;
435
+
436
+ typedef enum {
437
+ CUDNN_SIGNAL_SET = 0,
438
+ CUDNN_SIGNAL_WAIT = 1,
439
+ } cudnnSignalMode_t;
440
+
441
+ typedef enum {
442
+ CUDNN_GENSTATS_SUM_SQSUM = 0,
443
+ } cudnnGenStatsMode_t;
444
+
445
+ typedef enum {
446
+ CUDNN_BN_FINALIZE_STATISTICS_TRAINING = 0,
447
+ CUDNN_BN_FINALIZE_STATISTICS_INFERENCE = 1,
448
+ } cudnnBnFinalizeStatsMode_t;
449
+
450
+ typedef enum {
451
+ CUDNN_RNG_DISTRIBUTION_BERNOULLI,
452
+ CUDNN_RNG_DISTRIBUTION_UNIFORM,
453
+ CUDNN_RNG_DISTRIBUTION_NORMAL,
454
+ } cudnnRngDistribution_t;
455
+
456
+ typedef enum {
457
+ CUDNN_ATTR_POINTWISE_MODE = 0,
458
+ CUDNN_ATTR_POINTWISE_MATH_PREC = 1,
459
+ CUDNN_ATTR_POINTWISE_NAN_PROPAGATION CUDNN_DEPRECATED_ENUM = 2,
460
+ CUDNN_ATTR_POINTWISE_RELU_LOWER_CLIP = 3,
461
+ CUDNN_ATTR_POINTWISE_RELU_UPPER_CLIP = 4,
462
+ CUDNN_ATTR_POINTWISE_RELU_LOWER_CLIP_SLOPE = 5,
463
+ CUDNN_ATTR_POINTWISE_ELU_ALPHA = 6,
464
+ CUDNN_ATTR_POINTWISE_SOFTPLUS_BETA = 7,
465
+ CUDNN_ATTR_POINTWISE_SWISH_BETA = 8,
466
+ CUDNN_ATTR_POINTWISE_AXIS = 9,
467
+
468
+ CUDNN_ATTR_CONVOLUTION_COMP_TYPE = 100,
469
+ CUDNN_ATTR_CONVOLUTION_CONV_MODE = 101,
470
+ CUDNN_ATTR_CONVOLUTION_DILATIONS = 102,
471
+ CUDNN_ATTR_CONVOLUTION_FILTER_STRIDES = 103,
472
+ CUDNN_ATTR_CONVOLUTION_POST_PADDINGS = 104,
473
+ CUDNN_ATTR_CONVOLUTION_PRE_PADDINGS = 105,
474
+ CUDNN_ATTR_CONVOLUTION_SPATIAL_DIMS = 106,
475
+
476
+ CUDNN_ATTR_ENGINEHEUR_MODE = 200,
477
+ CUDNN_ATTR_ENGINEHEUR_OPERATION_GRAPH = 201,
478
+ CUDNN_ATTR_ENGINEHEUR_RESULTS = 202,
479
+ CUDNN_ATTR_ENGINEHEUR_SM_COUNT_TARGET = 203,
480
+
481
+ CUDNN_ATTR_ENGINECFG_ENGINE = 300,
482
+ CUDNN_ATTR_ENGINECFG_INTERMEDIATE_INFO = 301,
483
+ CUDNN_ATTR_ENGINECFG_KNOB_CHOICES = 302,
484
+
485
+ CUDNN_ATTR_EXECUTION_PLAN_HANDLE = 400,
486
+ CUDNN_ATTR_EXECUTION_PLAN_ENGINE_CONFIG = 401,
487
+ CUDNN_ATTR_EXECUTION_PLAN_WORKSPACE_SIZE = 402,
488
+ CUDNN_ATTR_EXECUTION_PLAN_COMPUTED_INTERMEDIATE_UIDS = 403,
489
+ CUDNN_ATTR_EXECUTION_PLAN_RUN_ONLY_INTERMEDIATE_UIDS = 404,
490
+ CUDNN_ATTR_EXECUTION_PLAN_JSON_REPRESENTATION = 405,
491
+
492
+ CUDNN_ATTR_INTERMEDIATE_INFO_UNIQUE_ID = 500,
493
+ CUDNN_ATTR_INTERMEDIATE_INFO_SIZE = 501,
494
+ CUDNN_ATTR_INTERMEDIATE_INFO_DEPENDENT_DATA_UIDS = 502,
495
+ CUDNN_ATTR_INTERMEDIATE_INFO_DEPENDENT_ATTRIBUTES = 503,
496
+
497
+ CUDNN_ATTR_KNOB_CHOICE_KNOB_TYPE = 600,
498
+ CUDNN_ATTR_KNOB_CHOICE_KNOB_VALUE = 601,
499
+
500
+ CUDNN_ATTR_OPERATION_CONVOLUTION_FORWARD_ALPHA = 700,
501
+ CUDNN_ATTR_OPERATION_CONVOLUTION_FORWARD_BETA = 701,
502
+ CUDNN_ATTR_OPERATION_CONVOLUTION_FORWARD_CONV_DESC = 702,
503
+ CUDNN_ATTR_OPERATION_CONVOLUTION_FORWARD_W = 703,
504
+ CUDNN_ATTR_OPERATION_CONVOLUTION_FORWARD_X = 704,
505
+ CUDNN_ATTR_OPERATION_CONVOLUTION_FORWARD_Y = 705,
506
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_DATA_ALPHA = 706,
507
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_DATA_BETA = 707,
508
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_DATA_CONV_DESC = 708,
509
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_DATA_W = 709,
510
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_DATA_DX = 710,
511
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_DATA_DY = 711,
512
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_FILTER_ALPHA = 712,
513
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_FILTER_BETA = 713,
514
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_FILTER_CONV_DESC = 714,
515
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_FILTER_DW = 715,
516
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_FILTER_X = 716,
517
+ CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_FILTER_DY = 717,
518
+
519
+ CUDNN_ATTR_OPERATION_POINTWISE_PW_DESCRIPTOR = 750,
520
+ CUDNN_ATTR_OPERATION_POINTWISE_XDESC = 751,
521
+ CUDNN_ATTR_OPERATION_POINTWISE_BDESC = 752,
522
+ CUDNN_ATTR_OPERATION_POINTWISE_YDESC = 753,
523
+ CUDNN_ATTR_OPERATION_POINTWISE_ALPHA1 = 754,
524
+ CUDNN_ATTR_OPERATION_POINTWISE_ALPHA2 = 755,
525
+ CUDNN_ATTR_OPERATION_POINTWISE_DXDESC = 756,
526
+ CUDNN_ATTR_OPERATION_POINTWISE_DYDESC = 757,
527
+ CUDNN_ATTR_OPERATION_POINTWISE_TDESC = 758,
528
+
529
+ CUDNN_ATTR_OPERATION_GENSTATS_MODE = 770,
530
+ CUDNN_ATTR_OPERATION_GENSTATS_MATH_PREC = 771,
531
+ CUDNN_ATTR_OPERATION_GENSTATS_XDESC = 772,
532
+ CUDNN_ATTR_OPERATION_GENSTATS_SUMDESC = 773,
533
+ CUDNN_ATTR_OPERATION_GENSTATS_SQSUMDESC = 774,
534
+
535
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_STATS_MODE = 780,
536
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_MATH_PREC = 781,
537
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_Y_SUM_DESC = 782,
538
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_Y_SQ_SUM_DESC = 783,
539
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_SCALE_DESC = 784,
540
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_BIAS_DESC = 785,
541
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_PREV_RUNNING_MEAN_DESC = 786,
542
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_PREV_RUNNING_VAR_DESC = 787,
543
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_UPDATED_RUNNING_MEAN_DESC = 788,
544
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_UPDATED_RUNNING_VAR_DESC = 789,
545
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_SAVED_MEAN_DESC = 790,
546
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_SAVED_INV_STD_DESC = 791,
547
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_EQ_SCALE_DESC = 792,
548
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_EQ_BIAS_DESC = 793,
549
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_ACCUM_COUNT_DESC = 794,
550
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_EPSILON_DESC = 795,
551
+ CUDNN_ATTR_OPERATION_BN_FINALIZE_EXP_AVERATE_FACTOR_DESC = 796,
552
+
553
+ CUDNN_ATTR_OPERATIONGRAPH_HANDLE = 800,
554
+ CUDNN_ATTR_OPERATIONGRAPH_OPS = 801,
555
+ CUDNN_ATTR_OPERATIONGRAPH_ENGINE_GLOBAL_COUNT = 802,
556
+
557
+ CUDNN_ATTR_TENSOR_BYTE_ALIGNMENT = 900,
558
+ CUDNN_ATTR_TENSOR_DATA_TYPE = 901,
559
+ CUDNN_ATTR_TENSOR_DIMENSIONS = 902,
560
+ CUDNN_ATTR_TENSOR_STRIDES = 903,
561
+ CUDNN_ATTR_TENSOR_VECTOR_COUNT = 904,
562
+ CUDNN_ATTR_TENSOR_VECTORIZED_DIMENSION = 905,
563
+ CUDNN_ATTR_TENSOR_UNIQUE_ID = 906,
564
+ CUDNN_ATTR_TENSOR_IS_VIRTUAL = 907,
565
+ CUDNN_ATTR_TENSOR_IS_BY_VALUE = 908,
566
+ CUDNN_ATTR_TENSOR_REORDERING_MODE = 909,
567
+ CUDNN_ATTR_TENSOR_RAGGED_OFFSET_DESC = 913,
568
+
569
+ CUDNN_ATTR_VARIANT_PACK_UNIQUE_IDS = 1000,
570
+ CUDNN_ATTR_VARIANT_PACK_DATA_POINTERS = 1001,
571
+ CUDNN_ATTR_VARIANT_PACK_INTERMEDIATES = 1002,
572
+ CUDNN_ATTR_VARIANT_PACK_WORKSPACE = 1003,
573
+
574
+ CUDNN_ATTR_LAYOUT_INFO_TENSOR_UID = 1100,
575
+ CUDNN_ATTR_LAYOUT_INFO_TYPES = 1101,
576
+
577
+ CUDNN_ATTR_KNOB_INFO_TYPE = 1200,
578
+ CUDNN_ATTR_KNOB_INFO_MAXIMUM_VALUE = 1201,
579
+ CUDNN_ATTR_KNOB_INFO_MINIMUM_VALUE = 1202,
580
+ CUDNN_ATTR_KNOB_INFO_STRIDE = 1203,
581
+
582
+ CUDNN_ATTR_ENGINE_OPERATION_GRAPH = 1300,
583
+ CUDNN_ATTR_ENGINE_GLOBAL_INDEX = 1301,
584
+ CUDNN_ATTR_ENGINE_KNOB_INFO = 1302,
585
+ CUDNN_ATTR_ENGINE_NUMERICAL_NOTE = 1303,
586
+ CUDNN_ATTR_ENGINE_LAYOUT_INFO = 1304,
587
+ CUDNN_ATTR_ENGINE_BEHAVIOR_NOTE = 1305,
588
+ CUDNN_ATTR_ENGINE_SM_COUNT_TARGET = 1306,
589
+
590
+ CUDNN_ATTR_MATMUL_COMP_TYPE = 1500,
591
+ CUDNN_ATTR_MATMUL_PADDING_VALUE = 1503,
592
+
593
+ CUDNN_ATTR_OPERATION_MATMUL_ADESC = 1520,
594
+ CUDNN_ATTR_OPERATION_MATMUL_BDESC = 1521,
595
+ CUDNN_ATTR_OPERATION_MATMUL_CDESC = 1522,
596
+ CUDNN_ATTR_OPERATION_MATMUL_DESC = 1523,
597
+ CUDNN_ATTR_OPERATION_MATMUL_IRREGULARLY_STRIDED_BATCH_COUNT CUDNN_DEPRECATED_ENUM = 1524,
598
+ CUDNN_ATTR_OPERATION_MATMUL_GEMM_M_OVERRIDE_DESC = 1525,
599
+ CUDNN_ATTR_OPERATION_MATMUL_GEMM_N_OVERRIDE_DESC = 1526,
600
+ CUDNN_ATTR_OPERATION_MATMUL_GEMM_K_OVERRIDE_DESC = 1527,
601
+
602
+ CUDNN_ATTR_REDUCTION_OPERATOR = 1600,
603
+ CUDNN_ATTR_REDUCTION_COMP_TYPE = 1601,
604
+
605
+ CUDNN_ATTR_OPERATION_REDUCTION_XDESC = 1610,
606
+ CUDNN_ATTR_OPERATION_REDUCTION_YDESC = 1611,
607
+ CUDNN_ATTR_OPERATION_REDUCTION_DESC = 1612,
608
+
609
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_MATH_PREC = 1620,
610
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_MEAN_DESC = 1621,
611
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_INVSTD_DESC = 1622,
612
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_BN_SCALE_DESC = 1623,
613
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_X_DESC = 1624,
614
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_DY_DESC = 1625,
615
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_DBN_SCALE_DESC = 1626,
616
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_DBN_BIAS_DESC = 1627,
617
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_EQ_DY_SCALE_DESC = 1628,
618
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_EQ_X_SCALE_DESC = 1629,
619
+ CUDNN_ATTR_OPERATION_BN_BWD_WEIGHTS_EQ_BIAS = 1630,
620
+
621
+ CUDNN_ATTR_RESAMPLE_MODE = 1700,
622
+ CUDNN_ATTR_RESAMPLE_COMP_TYPE = 1701,
623
+ CUDNN_ATTR_RESAMPLE_SPATIAL_DIMS = 1702,
624
+ CUDNN_ATTR_RESAMPLE_POST_PADDINGS = 1703,
625
+ CUDNN_ATTR_RESAMPLE_PRE_PADDINGS = 1704,
626
+ CUDNN_ATTR_RESAMPLE_STRIDES = 1705,
627
+ CUDNN_ATTR_RESAMPLE_WINDOW_DIMS = 1706,
628
+ CUDNN_ATTR_RESAMPLE_NAN_PROPAGATION = 1707,
629
+ CUDNN_ATTR_RESAMPLE_PADDING_MODE = 1708,
630
+
631
+ CUDNN_ATTR_OPERATION_RESAMPLE_FWD_XDESC = 1710,
632
+ CUDNN_ATTR_OPERATION_RESAMPLE_FWD_YDESC = 1711,
633
+ CUDNN_ATTR_OPERATION_RESAMPLE_FWD_IDXDESC = 1712,
634
+ CUDNN_ATTR_OPERATION_RESAMPLE_FWD_ALPHA CUDNN_DEPRECATED_ENUM = 1713,
635
+ CUDNN_ATTR_OPERATION_RESAMPLE_FWD_BETA CUDNN_DEPRECATED_ENUM = 1714,
636
+ CUDNN_ATTR_OPERATION_RESAMPLE_FWD_DESC = 1716,
637
+
638
+ CUDNN_ATTR_OPERATION_RESAMPLE_BWD_DXDESC = 1720,
639
+ CUDNN_ATTR_OPERATION_RESAMPLE_BWD_DYDESC = 1721,
640
+ CUDNN_ATTR_OPERATION_RESAMPLE_BWD_IDXDESC = 1722,
641
+ CUDNN_ATTR_OPERATION_RESAMPLE_BWD_ALPHA CUDNN_DEPRECATED_ENUM = 1723,
642
+ CUDNN_ATTR_OPERATION_RESAMPLE_BWD_BETA CUDNN_DEPRECATED_ENUM = 1724,
643
+ CUDNN_ATTR_OPERATION_RESAMPLE_BWD_DESC = 1725,
644
+ CUDNN_ATTR_OPERATION_RESAMPLE_BWD_XDESC = 1726,
645
+ CUDNN_ATTR_OPERATION_RESAMPLE_BWD_YDESC = 1727,
646
+
647
+ CUDNN_ATTR_OPERATION_CONCAT_AXIS = 1800,
648
+ CUDNN_ATTR_OPERATION_CONCAT_INPUT_DESCS = 1801,
649
+ CUDNN_ATTR_OPERATION_CONCAT_INPLACE_INDEX = 1802,
650
+ CUDNN_ATTR_OPERATION_CONCAT_OUTPUT_DESC = 1803,
651
+
652
+ CUDNN_ATTR_OPERATION_SIGNAL_MODE = 1900,
653
+ CUDNN_ATTR_OPERATION_SIGNAL_FLAGDESC = 1901,
654
+ CUDNN_ATTR_OPERATION_SIGNAL_VALUE = 1902,
655
+ CUDNN_ATTR_OPERATION_SIGNAL_XDESC = 1903,
656
+ CUDNN_ATTR_OPERATION_SIGNAL_YDESC = 1904,
657
+
658
+ CUDNN_ATTR_OPERATION_NORM_FWD_MODE = 2000,
659
+ CUDNN_ATTR_OPERATION_NORM_FWD_PHASE = 2001,
660
+ CUDNN_ATTR_OPERATION_NORM_FWD_XDESC = 2002,
661
+ CUDNN_ATTR_OPERATION_NORM_FWD_MEAN_DESC = 2003,
662
+ CUDNN_ATTR_OPERATION_NORM_FWD_INV_VARIANCE_DESC = 2004,
663
+ CUDNN_ATTR_OPERATION_NORM_FWD_SCALE_DESC = 2005,
664
+ CUDNN_ATTR_OPERATION_NORM_FWD_BIAS_DESC = 2006,
665
+ CUDNN_ATTR_OPERATION_NORM_FWD_EPSILON_DESC = 2007,
666
+ CUDNN_ATTR_OPERATION_NORM_FWD_EXP_AVG_FACTOR_DESC = 2008,
667
+ CUDNN_ATTR_OPERATION_NORM_FWD_INPUT_RUNNING_MEAN_DESC = 2009,
668
+ CUDNN_ATTR_OPERATION_NORM_FWD_INPUT_RUNNING_VAR_DESC = 2010,
669
+ CUDNN_ATTR_OPERATION_NORM_FWD_OUTPUT_RUNNING_MEAN_DESC = 2011,
670
+ CUDNN_ATTR_OPERATION_NORM_FWD_OUTPUT_RUNNING_VAR_DESC = 2012,
671
+ CUDNN_ATTR_OPERATION_NORM_FWD_YDESC = 2013,
672
+ CUDNN_ATTR_OPERATION_NORM_FWD_PEER_STAT_DESCS = 2014,
673
+
674
+ CUDNN_ATTR_OPERATION_NORM_BWD_MODE = 2100,
675
+ CUDNN_ATTR_OPERATION_NORM_BWD_XDESC = 2101,
676
+ CUDNN_ATTR_OPERATION_NORM_BWD_MEAN_DESC = 2102,
677
+ CUDNN_ATTR_OPERATION_NORM_BWD_INV_VARIANCE_DESC = 2103,
678
+ CUDNN_ATTR_OPERATION_NORM_BWD_DYDESC = 2104,
679
+ CUDNN_ATTR_OPERATION_NORM_BWD_SCALE_DESC = 2105,
680
+ CUDNN_ATTR_OPERATION_NORM_BWD_EPSILON_DESC = 2106,
681
+ CUDNN_ATTR_OPERATION_NORM_BWD_DSCALE_DESC = 2107,
682
+ CUDNN_ATTR_OPERATION_NORM_BWD_DBIAS_DESC = 2108,
683
+ CUDNN_ATTR_OPERATION_NORM_BWD_DXDESC = 2109,
684
+ CUDNN_ATTR_OPERATION_NORM_BWD_PEER_STAT_DESCS = 2110,
685
+
686
+ CUDNN_ATTR_OPERATION_RESHAPE_XDESC = 2200,
687
+ CUDNN_ATTR_OPERATION_RESHAPE_YDESC = 2201,
688
+
689
+ CUDNN_ATTR_RNG_DISTRIBUTION = 2300,
690
+ CUDNN_ATTR_RNG_NORMAL_DIST_MEAN = 2301,
691
+ CUDNN_ATTR_RNG_NORMAL_DIST_STANDARD_DEVIATION = 2302,
692
+ CUDNN_ATTR_RNG_UNIFORM_DIST_MAXIMUM = 2303,
693
+ CUDNN_ATTR_RNG_UNIFORM_DIST_MINIMUM = 2304,
694
+ CUDNN_ATTR_RNG_BERNOULLI_DIST_PROBABILITY = 2305,
695
+
696
+ CUDNN_ATTR_OPERATION_RNG_YDESC = 2310,
697
+ CUDNN_ATTR_OPERATION_RNG_SEED = 2311,
698
+ CUDNN_ATTR_OPERATION_RNG_DESC = 2312,
699
+ CUDNN_ATTR_OPERATION_RNG_OFFSET_DESC = 2313,
700
+ } cudnnBackendAttributeName_t;
701
+
702
+ typedef enum {
703
+ CUDNN_TYPE_HANDLE = 0,
704
+ CUDNN_TYPE_DATA_TYPE,
705
+ CUDNN_TYPE_BOOLEAN,
706
+ CUDNN_TYPE_INT64,
707
+ CUDNN_TYPE_FLOAT,
708
+ CUDNN_TYPE_DOUBLE,
709
+ CUDNN_TYPE_VOID_PTR,
710
+ CUDNN_TYPE_CONVOLUTION_MODE,
711
+ CUDNN_TYPE_HEUR_MODE,
712
+ CUDNN_TYPE_KNOB_TYPE,
713
+ CUDNN_TYPE_NAN_PROPOGATION CUDNN_DEPRECATED_ENUM,
714
+ CUDNN_TYPE_NUMERICAL_NOTE,
715
+ CUDNN_TYPE_LAYOUT_TYPE,
716
+ CUDNN_TYPE_ATTRIB_NAME,
717
+ CUDNN_TYPE_POINTWISE_MODE,
718
+ CUDNN_TYPE_BACKEND_DESCRIPTOR,
719
+ CUDNN_TYPE_GENSTATS_MODE,
720
+ CUDNN_TYPE_BN_FINALIZE_STATS_MODE,
721
+ CUDNN_TYPE_REDUCTION_OPERATOR_TYPE,
722
+ CUDNN_TYPE_BEHAVIOR_NOTE,
723
+ CUDNN_TYPE_TENSOR_REORDERING_MODE,
724
+ CUDNN_TYPE_RESAMPLE_MODE,
725
+ CUDNN_TYPE_PADDING_MODE,
726
+ CUDNN_TYPE_INT32,
727
+ CUDNN_TYPE_CHAR,
728
+ CUDNN_TYPE_SIGNAL_MODE,
729
+ CUDNN_TYPE_FRACTION,
730
+ CUDNN_TYPE_NORM_MODE,
731
+ CUDNN_TYPE_NORM_FWD_PHASE,
732
+ CUDNN_TYPE_RNG_DISTRIBUTION
733
+ } cudnnBackendAttributeType_t;
734
+
735
+ typedef enum {
736
+ CUDNN_BACKEND_POINTWISE_DESCRIPTOR = 0,
737
+ CUDNN_BACKEND_CONVOLUTION_DESCRIPTOR,
738
+ CUDNN_BACKEND_ENGINE_DESCRIPTOR,
739
+ CUDNN_BACKEND_ENGINECFG_DESCRIPTOR,
740
+ CUDNN_BACKEND_ENGINEHEUR_DESCRIPTOR,
741
+ CUDNN_BACKEND_EXECUTION_PLAN_DESCRIPTOR,
742
+ CUDNN_BACKEND_INTERMEDIATE_INFO_DESCRIPTOR,
743
+ CUDNN_BACKEND_KNOB_CHOICE_DESCRIPTOR,
744
+ CUDNN_BACKEND_KNOB_INFO_DESCRIPTOR,
745
+ CUDNN_BACKEND_LAYOUT_INFO_DESCRIPTOR,
746
+ CUDNN_BACKEND_OPERATION_CONVOLUTION_FORWARD_DESCRIPTOR,
747
+ CUDNN_BACKEND_OPERATION_CONVOLUTION_BACKWARD_FILTER_DESCRIPTOR,
748
+ CUDNN_BACKEND_OPERATION_CONVOLUTION_BACKWARD_DATA_DESCRIPTOR,
749
+ CUDNN_BACKEND_OPERATION_POINTWISE_DESCRIPTOR,
750
+ CUDNN_BACKEND_OPERATION_GEN_STATS_DESCRIPTOR,
751
+ CUDNN_BACKEND_OPERATIONGRAPH_DESCRIPTOR,
752
+ CUDNN_BACKEND_VARIANT_PACK_DESCRIPTOR,
753
+ CUDNN_BACKEND_TENSOR_DESCRIPTOR,
754
+ CUDNN_BACKEND_MATMUL_DESCRIPTOR,
755
+ CUDNN_BACKEND_OPERATION_MATMUL_DESCRIPTOR,
756
+ CUDNN_BACKEND_OPERATION_BN_FINALIZE_STATISTICS_DESCRIPTOR,
757
+ CUDNN_BACKEND_REDUCTION_DESCRIPTOR,
758
+ CUDNN_BACKEND_OPERATION_REDUCTION_DESCRIPTOR,
759
+ CUDNN_BACKEND_OPERATION_BN_BWD_WEIGHTS_DESCRIPTOR,
760
+ CUDNN_BACKEND_RESAMPLE_DESCRIPTOR,
761
+ CUDNN_BACKEND_OPERATION_RESAMPLE_FWD_DESCRIPTOR,
762
+ CUDNN_BACKEND_OPERATION_RESAMPLE_BWD_DESCRIPTOR,
763
+ CUDNN_BACKEND_OPERATION_CONCAT_DESCRIPTOR,
764
+ CUDNN_BACKEND_OPERATION_SIGNAL_DESCRIPTOR,
765
+ CUDNN_BACKEND_OPERATION_NORM_FORWARD_DESCRIPTOR,
766
+ CUDNN_BACKEND_OPERATION_NORM_BACKWARD_DESCRIPTOR,
767
+ CUDNN_BACKEND_OPERATION_RESHAPE_DESCRIPTOR,
768
+ CUDNN_BACKEND_RNG_DESCRIPTOR,
769
+ CUDNN_BACKEND_OPERATION_RNG_DESCRIPTOR,
770
+ } cudnnBackendDescriptorType_t;
771
+
772
+ typedef enum {
773
+ CUDNN_NUMERICAL_NOTE_TENSOR_CORE = 0,
774
+ CUDNN_NUMERICAL_NOTE_DOWN_CONVERT_INPUTS,
775
+ CUDNN_NUMERICAL_NOTE_REDUCED_PRECISION_REDUCTION,
776
+ CUDNN_NUMERICAL_NOTE_FFT,
777
+ CUDNN_NUMERICAL_NOTE_NONDETERMINISTIC,
778
+ CUDNN_NUMERICAL_NOTE_WINOGRAD,
779
+ CUDNN_NUMERICAL_NOTE_WINOGRAD_TILE_4x4,
780
+ CUDNN_NUMERICAL_NOTE_WINOGRAD_TILE_6x6,
781
+ CUDNN_NUMERICAL_NOTE_WINOGRAD_TILE_13x13,
782
+ CUDNN_NUMERICAL_NOTE_STRICT_NAN_PROP,
783
+ CUDNN_NUMERICAL_NOTE_TYPE_COUNT,
784
+ } cudnnBackendNumericalNote_t;
785
+
786
+ typedef enum {
787
+ CUDNN_BEHAVIOR_NOTE_RUNTIME_COMPILATION = 0,
788
+ CUDNN_BEHAVIOR_NOTE_REQUIRES_FILTER_INT8x32_REORDER = 1,
789
+ CUDNN_BEHAVIOR_NOTE_REQUIRES_BIAS_INT8x32_REORDER = 2,
790
+ CUDNN_BEHAVIOR_NOTE_TYPE_COUNT,
791
+ } cudnnBackendBehaviorNote_t;
792
+
793
+ typedef enum {
794
+ CUDNN_KNOB_TYPE_SPLIT_K CUDNN_DEPRECATED_ENUM = 0,
795
+ CUDNN_KNOB_TYPE_SWIZZLE = 1,
796
+ CUDNN_KNOB_TYPE_TILE_SIZE = 2,
797
+ CUDNN_KNOB_TYPE_USE_TEX CUDNN_DEPRECATED_ENUM = 3,
798
+ CUDNN_KNOB_TYPE_EDGE = 4,
799
+ CUDNN_KNOB_TYPE_KBLOCK CUDNN_DEPRECATED_ENUM = 5,
800
+ CUDNN_KNOB_TYPE_LDGA CUDNN_DEPRECATED_ENUM = 6,
801
+ CUDNN_KNOB_TYPE_LDGB CUDNN_DEPRECATED_ENUM = 7,
802
+ CUDNN_KNOB_TYPE_CHUNK_K CUDNN_DEPRECATED_ENUM = 8,
803
+ CUDNN_KNOB_TYPE_SPLIT_H CUDNN_DEPRECATED_ENUM = 9,
804
+ CUDNN_KNOB_TYPE_WINO_TILE CUDNN_DEPRECATED_ENUM = 10,
805
+ CUDNN_KNOB_TYPE_MULTIPLY = 11,
806
+ CUDNN_KNOB_TYPE_SPLIT_K_BUF = 12,
807
+ CUDNN_KNOB_TYPE_TILEK = 13,
808
+ CUDNN_KNOB_TYPE_STAGES = 14,
809
+ CUDNN_KNOB_TYPE_REDUCTION_MODE = 15,
810
+ CUDNN_KNOB_TYPE_CTA_SPLIT_K_MODE CUDNN_DEPRECATED_ENUM = 16,
811
+ CUDNN_KNOB_TYPE_SPLIT_K_SLC = 17,
812
+ CUDNN_KNOB_TYPE_IDX_MODE CUDNN_DEPRECATED_ENUM = 18,
813
+ CUDNN_KNOB_TYPE_SLICED CUDNN_DEPRECATED_ENUM = 19,
814
+ CUDNN_KNOB_TYPE_SPLIT_RS CUDNN_DEPRECATED_ENUM = 20,
815
+ CUDNN_KNOB_TYPE_SINGLEBUFFER CUDNN_DEPRECATED_ENUM = 21,
816
+ CUDNN_KNOB_TYPE_LDGC CUDNN_DEPRECATED_ENUM = 22,
817
+ CUDNN_KNOB_TYPE_SPECFILT = 23,
818
+ CUDNN_KNOB_TYPE_KERNEL_CFG = 24,
819
+ CUDNN_KNOB_TYPE_WORKSPACE = 25,
820
+ CUDNN_KNOB_TYPE_TILE_CGA CUDNN_DEPRECATED_ENUM = 26,
821
+ CUDNN_KNOB_TYPE_TILE_CGA_M = 27,
822
+ CUDNN_KNOB_TYPE_TILE_CGA_N = 28,
823
+ CUDNN_KNOB_TYPE_BLOCK_SIZE = 29,
824
+ CUDNN_KNOB_TYPE_OCCUPANCY = 30,
825
+ CUDNN_KNOB_TYPE_ARRAY_SIZE_PER_THREAD = 31,
826
+ CUDNN_KNOB_TYPE_NUM_C_PER_BLOCK CUDNN_DEPRECATED_ENUM = 32,
827
+ CUDNN_KNOB_TYPE_SPLIT_COLS = 33,
828
+ CUDNN_KNOB_TYPE_TILE_ROWS = 34,
829
+ CUDNN_KNOB_TYPE_TILE_COLS = 35,
830
+ CUDNN_KNOB_TYPE_LOAD_SIZE = 36,
831
+ CUDNN_KNOB_TYPE_COUNTS,
832
+ } cudnnBackendKnobType_t;
833
+
834
+ typedef enum {
835
+ CUDNN_LAYOUT_TYPE_PREFERRED_NCHW = 0,
836
+ CUDNN_LAYOUT_TYPE_PREFERRED_NHWC = 1,
837
+ CUDNN_LAYOUT_TYPE_PREFERRED_PAD4CK = 2,
838
+ CUDNN_LAYOUT_TYPE_PREFERRED_PAD8CK = 3,
839
+ CUDNN_LAYOUT_TYPE_COUNT = 4,
840
+ } cudnnBackendLayoutType_t;
841
+
842
+ typedef enum {
843
+ CUDNN_HEUR_MODE_INSTANT = 0,
844
+ CUDNN_HEUR_MODE_B = 1,
845
+ CUDNN_HEUR_MODE_FALLBACK = 2,
846
+ CUDNN_HEUR_MODE_A = 3,
847
+ CUDNN_HEUR_MODES_COUNT = 4,
848
+ } cudnnBackendHeurMode_t;
849
+
850
+ typedef enum {
851
+ CUDNN_TENSOR_REORDERING_NONE = 0,
852
+ CUDNN_TENSOR_REORDERING_INT8x32 = 1,
853
+ CUDNN_TENSOR_REORDERING_F16x16 = 2,
854
+ } cudnnBackendTensorReordering_t;
855
+
856
+ typedef enum {
857
+ CUDNN_ZERO_PAD = 0,
858
+ CUDNN_NEG_INF_PAD = 1,
859
+ CUDNN_EDGE_VAL_PAD = 2,
860
+ } cudnnPaddingMode_t;
861
+
862
+ typedef enum {
863
+ CUDNN_LAYER_NORM = 0,
864
+ CUDNN_INSTANCE_NORM = 1,
865
+ CUDNN_BATCH_NORM = 2,
866
+ CUDNN_GROUP_NORM = 3,
867
+ CUDNN_RMS_NORM = 4,
868
+ } cudnnBackendNormMode_t;
869
+
870
+ typedef enum {
871
+ CUDNN_NORM_FWD_INFERENCE = 0,
872
+ CUDNN_NORM_FWD_TRAINING = 1,
873
+ } cudnnBackendNormFwdPhase_t;
874
+
875
+ cudnnStatus_t CUDNNWINAPI
876
+ cudnnBackendCreateDescriptor(cudnnBackendDescriptorType_t descriptorType, cudnnBackendDescriptor_t *descriptor);
877
+
878
+ cudnnStatus_t CUDNNWINAPI
879
+ cudnnBackendDestroyDescriptor(cudnnBackendDescriptor_t descriptor);
880
+
881
+ cudnnStatus_t CUDNNWINAPI
882
+ cudnnBackendInitialize(cudnnBackendDescriptor_t descriptor);
883
+
884
+ cudnnStatus_t CUDNNWINAPI
885
+ cudnnBackendFinalize(cudnnBackendDescriptor_t descriptor);
886
+
887
+ cudnnStatus_t CUDNNWINAPI
888
+ cudnnBackendSetAttribute(cudnnBackendDescriptor_t descriptor,
889
+ cudnnBackendAttributeName_t attributeName,
890
+ cudnnBackendAttributeType_t attributeType,
891
+ int64_t elementCount,
892
+ const void *arrayOfElements);
893
+
894
+ cudnnStatus_t CUDNNWINAPI
895
+ cudnnBackendGetAttribute(cudnnBackendDescriptor_t const descriptor,
896
+ cudnnBackendAttributeName_t attributeName,
897
+ cudnnBackendAttributeType_t attributeType,
898
+ int64_t requestedElementCount,
899
+ int64_t *elementCount,
900
+ void *arrayOfElements);
901
+
902
+ cudnnStatus_t CUDNNWINAPI
903
+ cudnnBackendExecute(cudnnHandle_t handle, cudnnBackendDescriptor_t executionPlan, cudnnBackendDescriptor_t variantPack);
904
+
905
+ #if defined(__cplusplus)
906
+ }
907
+ #endif
908
+
909
+ #endif /* CUDNN_GRAPH_H_ */
lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_ops.h ADDED
@@ -0,0 +1,1316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright 2014-2023 NVIDIA Corporation. All rights reserved.
3
+ *
4
+ * NOTICE TO LICENSEE:
5
+ *
6
+ * This source code and/or documentation ("Licensed Deliverables") are
7
+ * subject to NVIDIA intellectual property rights under U.S. and
8
+ * international Copyright laws.
9
+ *
10
+ * These Licensed Deliverables contained herein is PROPRIETARY and
11
+ * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12
+ * conditions of a form of NVIDIA software license agreement by and
13
+ * between NVIDIA and Licensee ("License Agreement") or electronically
14
+ * accepted by Licensee. Notwithstanding any terms or conditions to
15
+ * the contrary in the License Agreement, reproduction or disclosure
16
+ * of the Licensed Deliverables to any third party without the express
17
+ * written consent of NVIDIA is prohibited.
18
+ *
19
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20
+ * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21
+ * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
22
+ * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23
+ * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24
+ * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25
+ * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27
+ * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28
+ * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32
+ * OF THESE LICENSED DELIVERABLES.
33
+ *
34
+ * U.S. Government End Users. These Licensed Deliverables are a
35
+ * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36
+ * 1995), consisting of "commercial computer software" and "commercial
37
+ * computer software documentation" as such terms are used in 48
38
+ * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39
+ * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40
+ * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41
+ * U.S. Government End Users acquire the Licensed Deliverables with
42
+ * only those rights set forth herein.
43
+ *
44
+ * Any use of the Licensed Deliverables in individual and commercial
45
+ * software must include, in the user documentation and internal
46
+ * comments to the code, the above Disclaimer and U.S. Government End
47
+ * Users Notice.
48
+ */
49
+
50
+ /*
51
+ * cudnn_ops : cuDNN's basic definitions and basic operations.
52
+ */
53
+
54
+ #if !defined(CUDNN_OPS_H_)
55
+ #define CUDNN_OPS_H_
56
+
57
+ #include <stdint.h>
58
+
59
+ #include "cudnn_version.h"
60
+ #include "cudnn_graph.h"
61
+
62
+ /* These version numbers are autogenerated, do not edit manually. */
63
+ #define CUDNN_OPS_MAJOR 9
64
+ #define CUDNN_OPS_MINOR 1
65
+ #define CUDNN_OPS_PATCH 0
66
+
67
+ #if (CUDNN_OPS_MAJOR != CUDNN_MAJOR) || (CUDNN_OPS_MINOR != CUDNN_MINOR) || (CUDNN_OPS_PATCH != CUDNN_PATCHLEVEL)
68
+ #error Version mismatch in cuDNN OPS INFER!!!
69
+ #endif
70
+
71
+ #if defined(__cplusplus)
72
+ extern "C" {
73
+ #endif
74
+
75
+ /* Data structures to represent Image/Filter and the Neural Network Layer */
76
+ typedef struct cudnnTensorStruct *cudnnTensorDescriptor_t;
77
+ typedef struct cudnnPoolingStruct *cudnnPoolingDescriptor_t CUDNN_DEPRECATED;
78
+ typedef struct cudnnFilterStruct *cudnnFilterDescriptor_t CUDNN_DEPRECATED;
79
+ typedef struct cudnnLRNStruct *cudnnLRNDescriptor_t;
80
+ typedef struct cudnnActivationStruct *cudnnActivationDescriptor_t CUDNN_DEPRECATED;
81
+ typedef struct cudnnSpatialTransformerStruct *cudnnSpatialTransformerDescriptor_t;
82
+ typedef struct cudnnOpTensorStruct *cudnnOpTensorDescriptor_t CUDNN_DEPRECATED;
83
+ typedef struct cudnnReduceTensorStruct *cudnnReduceTensorDescriptor_t CUDNN_DEPRECATED;
84
+ typedef struct cudnnCTCLossStruct *cudnnCTCLossDescriptor_t;
85
+ typedef struct cudnnTensorTransformStruct *cudnnTensorTransformDescriptor_t CUDNN_DEPRECATED;
86
+ /*
87
+ * CUDNN Determinism
88
+ */
89
+ typedef enum {
90
+ CUDNN_NON_DETERMINISTIC = 0,
91
+ CUDNN_DETERMINISTIC = 1,
92
+ } cudnnDeterminism_t;
93
+
94
+ /* Create an instance of a generic Tensor descriptor */
95
+ cudnnStatus_t CUDNNWINAPI
96
+ cudnnCreateTensorDescriptor(cudnnTensorDescriptor_t *tensorDesc);
97
+
98
+ cudnnStatus_t CUDNNWINAPI
99
+ cudnnSetTensor4dDescriptor(cudnnTensorDescriptor_t tensorDesc,
100
+ cudnnTensorFormat_t format,
101
+ cudnnDataType_t dataType, /* image data type */
102
+ int n, /* number of inputs (batch size) */
103
+ int c, /* number of input feature maps */
104
+ int h, /* height of input section */
105
+ int w); /* width of input section */
106
+
107
+ cudnnStatus_t CUDNNWINAPI
108
+ cudnnSetTensor4dDescriptorEx(cudnnTensorDescriptor_t tensorDesc,
109
+ cudnnDataType_t dataType, /* image data type */
110
+ int n, /* number of inputs (batch size) */
111
+ int c, /* number of input feature maps */
112
+ int h, /* height of input section */
113
+ int w, /* width of input section */
114
+ int nStride,
115
+ int cStride,
116
+ int hStride,
117
+ int wStride);
118
+
119
+ cudnnStatus_t CUDNNWINAPI
120
+ cudnnGetTensor4dDescriptor(const cudnnTensorDescriptor_t tensorDesc,
121
+ cudnnDataType_t *dataType, /* image data type */
122
+ int *n, /* number of inputs (batch size) */
123
+ int *c, /* number of input feature maps */
124
+ int *h, /* height of input section */
125
+ int *w, /* width of input section */
126
+ int *nStride,
127
+ int *cStride,
128
+ int *hStride,
129
+ int *wStride);
130
+
131
+ cudnnStatus_t CUDNNWINAPI
132
+ cudnnSetTensorNdDescriptor(cudnnTensorDescriptor_t tensorDesc,
133
+ cudnnDataType_t dataType,
134
+ int nbDims,
135
+ const int dimA[],
136
+ const int strideA[]);
137
+
138
+ cudnnStatus_t CUDNNWINAPI
139
+ cudnnSetTensorNdDescriptorEx(cudnnTensorDescriptor_t tensorDesc,
140
+ cudnnTensorFormat_t format,
141
+ cudnnDataType_t dataType,
142
+ int nbDims,
143
+ const int dimA[]);
144
+
145
+ cudnnStatus_t CUDNNWINAPI
146
+ cudnnGetTensorNdDescriptor(const cudnnTensorDescriptor_t tensorDesc,
147
+ int nbDimsRequested,
148
+ cudnnDataType_t *dataType,
149
+ int *nbDims,
150
+ int dimA[],
151
+ int strideA[]);
152
+
153
+ cudnnStatus_t CUDNNWINAPI
154
+ cudnnGetTensorSizeInBytes(const cudnnTensorDescriptor_t tensorDesc, size_t *size);
155
+
156
+ /* PixelOffset( n, c, h, w ) = n *input_stride + c * feature_stride + h * h_stride + w * w_stride
157
+
158
+ 1)Example of all images in row major order one batch of features after the other (with an optional padding on row)
159
+ input_stride : c x h x h_stride
160
+ feature_stride : h x h_stride
161
+ h_stride : >= w ( h_stride = w if no padding)
162
+ w_stride : 1
163
+
164
+
165
+ 2)Example of all images in row major with features maps interleaved
166
+ input_stride : c x h x h_stride
167
+ feature_stride : 1
168
+ h_stride : w x c
169
+ w_stride : c
170
+
171
+ 3)Example of all images in column major order one batch of features after the other (with optional padding on column)
172
+ input_stride : c x w x w_stride
173
+ feature_stride : w x w_stride
174
+ h_stride : 1
175
+ w_stride : >= h
176
+
177
+ */
178
+
179
+ /* Destroy an instance of Tensor4d descriptor */
180
+ cudnnStatus_t CUDNNWINAPI
181
+ cudnnDestroyTensorDescriptor(cudnnTensorDescriptor_t tensorDesc);
182
+
183
+ /* Fold/unfold transforms */
184
+ typedef enum {
185
+ CUDNN_TRANSFORM_FOLD = 0U,
186
+ CUDNN_TRANSFORM_UNFOLD = 1U,
187
+ } cudnnFoldingDirection_t;
188
+
189
+ /** Create a destination descriptor for cudnnTransformTensor */
190
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
191
+ cudnnInitTransformDest(const cudnnTensorTransformDescriptor_t transformDesc,
192
+ const cudnnTensorDescriptor_t srcDesc,
193
+ cudnnTensorDescriptor_t destDesc,
194
+ size_t *destSizeInBytes);
195
+
196
+ /** Create an empty tensor transform descriptor */
197
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
198
+ cudnnCreateTensorTransformDescriptor(cudnnTensorTransformDescriptor_t *transformDesc);
199
+
200
+ /** Initialize a previously created tensor transform descriptor. */
201
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
202
+ cudnnSetTensorTransformDescriptor(cudnnTensorTransformDescriptor_t transformDesc,
203
+ const uint32_t nbDims,
204
+ const cudnnTensorFormat_t destFormat,
205
+ const int32_t padBeforeA[],
206
+ const int32_t padAfterA[],
207
+ const uint32_t foldA[],
208
+ const cudnnFoldingDirection_t direction);
209
+
210
+ /**
211
+ * Retrieves the values stored in a previously initialized tensor transform
212
+ * descriptor.
213
+ */
214
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
215
+ cudnnGetTensorTransformDescriptor(cudnnTensorTransformDescriptor_t transformDesc,
216
+ uint32_t nbDimsRequested,
217
+ cudnnTensorFormat_t *destFormat,
218
+ int32_t padBeforeA[],
219
+ int32_t padAfterA[],
220
+ uint32_t foldA[],
221
+ cudnnFoldingDirection_t *direction);
222
+
223
+ /**
224
+ * Destroys a previously created tensor transform descriptor.
225
+ */
226
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
227
+ cudnnDestroyTensorTransformDescriptor(cudnnTensorTransformDescriptor_t transformDesc);
228
+
229
+ /* Tensor layout conversion helper (y = alpha * x + beta * y) */
230
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
231
+ cudnnTransformTensor(cudnnHandle_t handle,
232
+ const void *alpha,
233
+ const cudnnTensorDescriptor_t xDesc,
234
+ const void *x,
235
+ const void *beta,
236
+ const cudnnTensorDescriptor_t yDesc,
237
+ void *y);
238
+
239
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
240
+ cudnnTransformTensorEx(cudnnHandle_t handle,
241
+ const cudnnTensorTransformDescriptor_t transDesc,
242
+ const void *alpha,
243
+ const cudnnTensorDescriptor_t srcDesc,
244
+ const void *srcData,
245
+ const void *beta,
246
+ const cudnnTensorDescriptor_t destDesc,
247
+ void *destData);
248
+
249
+ /* Tensor Bias addition : C = alpha * A + beta * C */
250
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
251
+ cudnnAddTensor(cudnnHandle_t handle,
252
+ const void *alpha,
253
+ const cudnnTensorDescriptor_t aDesc,
254
+ const void *A,
255
+ const void *beta,
256
+ const cudnnTensorDescriptor_t cDesc,
257
+ void *C);
258
+
259
+ /*
260
+ * CUDNN OpTensor op type
261
+ */
262
+ typedef enum {
263
+ CUDNN_OP_TENSOR_ADD = 0,
264
+ CUDNN_OP_TENSOR_MUL = 1,
265
+ CUDNN_OP_TENSOR_MIN = 2,
266
+ CUDNN_OP_TENSOR_MAX = 3,
267
+ CUDNN_OP_TENSOR_SQRT = 4,
268
+ CUDNN_OP_TENSOR_NOT = 5,
269
+ } cudnnOpTensorOp_t;
270
+
271
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
272
+ cudnnCreateOpTensorDescriptor(cudnnOpTensorDescriptor_t *opTensorDesc);
273
+
274
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
275
+ cudnnSetOpTensorDescriptor(cudnnOpTensorDescriptor_t opTensorDesc,
276
+ cudnnOpTensorOp_t opTensorOp,
277
+ cudnnDataType_t opTensorCompType,
278
+ cudnnNanPropagation_t opTensorNanOpt);
279
+
280
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
281
+ cudnnGetOpTensorDescriptor(const cudnnOpTensorDescriptor_t opTensorDesc,
282
+ cudnnOpTensorOp_t *opTensorOp,
283
+ cudnnDataType_t *opTensorCompType,
284
+ cudnnNanPropagation_t *opTensorNanOpt);
285
+
286
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
287
+ cudnnDestroyOpTensorDescriptor(cudnnOpTensorDescriptor_t opTensorDesc);
288
+
289
+ /* Tensor operation : C = op( alpha1 * A, alpha2 * B ) + beta * C */
290
+ /* B tensor is ignored for CUDNN_OP_TENSOR_SQRT, CUDNN_OP_TENSOR_NOT. */
291
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
292
+ cudnnOpTensor(cudnnHandle_t handle,
293
+ const cudnnOpTensorDescriptor_t opTensorDesc,
294
+ const void *alpha1,
295
+ const cudnnTensorDescriptor_t aDesc,
296
+ const void *A,
297
+ const void *alpha2,
298
+ const cudnnTensorDescriptor_t bDesc,
299
+ const void *B,
300
+ const void *beta,
301
+ const cudnnTensorDescriptor_t cDesc,
302
+ void *C);
303
+
304
+ /*
305
+ * CUDNN ReduceTensor indices type
306
+ */
307
+ typedef enum {
308
+ CUDNN_REDUCE_TENSOR_NO_INDICES = 0,
309
+ CUDNN_REDUCE_TENSOR_FLATTENED_INDICES = 1,
310
+ } cudnnReduceTensorIndices_t CUDNN_DEPRECATED;
311
+
312
+ /*
313
+ * CUDNN tensor indices type size (all unsigned)
314
+ * Currently not supported, default is 32 bit unsigned.
315
+ */
316
+ typedef enum {
317
+ CUDNN_32BIT_INDICES = 0,
318
+ CUDNN_64BIT_INDICES = 1,
319
+ CUDNN_16BIT_INDICES = 2,
320
+ CUDNN_8BIT_INDICES = 3,
321
+ } cudnnIndicesType_t CUDNN_DEPRECATED;
322
+
323
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
324
+ cudnnCreateReduceTensorDescriptor(cudnnReduceTensorDescriptor_t *reduceTensorDesc);
325
+
326
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
327
+ cudnnSetReduceTensorDescriptor(cudnnReduceTensorDescriptor_t reduceTensorDesc,
328
+ cudnnReduceTensorOp_t reduceTensorOp,
329
+ cudnnDataType_t reduceTensorCompType,
330
+ cudnnNanPropagation_t reduceTensorNanOpt,
331
+ cudnnReduceTensorIndices_t reduceTensorIndices,
332
+ cudnnIndicesType_t reduceTensorIndicesType);
333
+
334
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
335
+ cudnnGetReduceTensorDescriptor(const cudnnReduceTensorDescriptor_t reduceTensorDesc,
336
+ cudnnReduceTensorOp_t *reduceTensorOp,
337
+ cudnnDataType_t *reduceTensorCompType,
338
+ cudnnNanPropagation_t *reduceTensorNanOpt,
339
+ cudnnReduceTensorIndices_t *reduceTensorIndices,
340
+ cudnnIndicesType_t *reduceTensorIndicesType);
341
+
342
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
343
+ cudnnDestroyReduceTensorDescriptor(cudnnReduceTensorDescriptor_t reduceTensorDesc);
344
+
345
+ /* Helper function to return the minimum size of the index space to be passed to the reduction given the input and
346
+ * output tensors */
347
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
348
+ cudnnGetReductionIndicesSize(cudnnHandle_t handle,
349
+ const cudnnReduceTensorDescriptor_t reduceTensorDesc,
350
+ const cudnnTensorDescriptor_t aDesc,
351
+ const cudnnTensorDescriptor_t cDesc,
352
+ size_t *sizeInBytes);
353
+
354
+ /* Helper function to return the minimum size of the workspace to be passed to the reduction given the input and output
355
+ * tensors */
356
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
357
+ cudnnGetReductionWorkspaceSize(cudnnHandle_t handle,
358
+ const cudnnReduceTensorDescriptor_t reduceTensorDesc,
359
+ const cudnnTensorDescriptor_t aDesc,
360
+ const cudnnTensorDescriptor_t cDesc,
361
+ size_t *sizeInBytes);
362
+
363
+ /* Tensor operation : C = reduce op( alpha * A ) + beta * C */
364
+ /* The NaN propagation enum applies to only the min and max reduce ops; the other reduce ops propagate NaN as usual. */
365
+ /* The indices space is ignored for reduce ops other than min or max. */
366
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
367
+ cudnnReduceTensor(cudnnHandle_t handle,
368
+ const cudnnReduceTensorDescriptor_t reduceTensorDesc,
369
+ void *indices,
370
+ size_t indicesSizeInBytes,
371
+ void *workspace,
372
+ size_t workspaceSizeInBytes,
373
+ const void *alpha,
374
+ const cudnnTensorDescriptor_t aDesc,
375
+ const void *A,
376
+ const void *beta,
377
+ const cudnnTensorDescriptor_t cDesc,
378
+ void *C);
379
+
380
+ /* Set all values of a tensor to a given value : y[i] = value[0] */
381
+ cudnnStatus_t CUDNNWINAPI
382
+ cudnnSetTensor(cudnnHandle_t handle, const cudnnTensorDescriptor_t yDesc, void *y, const void *valuePtr);
383
+
384
+ /* Scale all values of a tensor by a given factor : y[i] = alpha * y[i] */
385
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
386
+ cudnnScaleTensor(cudnnHandle_t handle, const cudnnTensorDescriptor_t yDesc, void *y, const void *alpha);
387
+
388
+ /* Create an instance of FilterStruct */
389
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
390
+ cudnnCreateFilterDescriptor(cudnnFilterDescriptor_t *filterDesc);
391
+
392
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
393
+ cudnnSetFilter4dDescriptor(cudnnFilterDescriptor_t filterDesc,
394
+ cudnnDataType_t dataType, /* image data type */
395
+ cudnnTensorFormat_t format,
396
+ int k, /* number of output feature maps */
397
+ int c, /* number of input feature maps */
398
+ int h, /* height of each input filter */
399
+ int w); /* width of each input filter */
400
+
401
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
402
+ cudnnGetFilter4dDescriptor(const cudnnFilterDescriptor_t filterDesc,
403
+ cudnnDataType_t *dataType, /* image data type */
404
+ cudnnTensorFormat_t *format,
405
+ int *k, /* number of output feature maps */
406
+ int *c, /* number of input feature maps */
407
+ int *h, /* height of each input filter */
408
+ int *w); /* width of each input filter */
409
+
410
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
411
+ cudnnSetFilterNdDescriptor(cudnnFilterDescriptor_t filterDesc,
412
+ cudnnDataType_t dataType, /* image data type */
413
+ cudnnTensorFormat_t format,
414
+ int nbDims,
415
+ const int filterDimA[]);
416
+
417
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
418
+ cudnnGetFilterNdDescriptor(const cudnnFilterDescriptor_t filterDesc,
419
+ int nbDimsRequested,
420
+ cudnnDataType_t *dataType, /* image data type */
421
+ cudnnTensorFormat_t *format,
422
+ int *nbDims,
423
+ int filterDimA[]);
424
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
425
+ cudnnGetFilterSizeInBytes(const cudnnFilterDescriptor_t filterDesc, size_t *size);
426
+
427
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
428
+ cudnnTransformFilter(cudnnHandle_t handle,
429
+ const cudnnTensorTransformDescriptor_t transDesc,
430
+ const void *alpha,
431
+ const cudnnFilterDescriptor_t srcDesc,
432
+ const void *srcData,
433
+ const void *beta,
434
+ const cudnnFilterDescriptor_t destDesc,
435
+ void *destData);
436
+
437
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
438
+ cudnnDestroyFilterDescriptor(cudnnFilterDescriptor_t filterDesc);
439
+
440
+ /*
441
+ * softmax algorithm
442
+ */
443
+ typedef enum {
444
+ CUDNN_SOFTMAX_FAST = 0, /* straightforward implementation */
445
+ CUDNN_SOFTMAX_ACCURATE = 1, /* subtract max from every point to avoid overflow */
446
+ CUDNN_SOFTMAX_LOG = 2
447
+ } cudnnSoftmaxAlgorithm_t;
448
+
449
+ typedef enum {
450
+ CUDNN_SOFTMAX_MODE_INSTANCE = 0, /* compute the softmax over all C, H, W for each N */
451
+ CUDNN_SOFTMAX_MODE_CHANNEL = 1 /* compute the softmax over all C for each H, W, N */
452
+ } cudnnSoftmaxMode_t;
453
+
454
+ /* Softmax functions: All of the form "output = alpha * Op(inputs) + beta * output" */
455
+
456
+ /* Function to perform forward softmax */
457
+ cudnnStatus_t CUDNNWINAPI
458
+ cudnnSoftmaxForward(cudnnHandle_t handle,
459
+ cudnnSoftmaxAlgorithm_t algo,
460
+ cudnnSoftmaxMode_t mode,
461
+ const void *alpha,
462
+ const cudnnTensorDescriptor_t xDesc,
463
+ const void *x,
464
+ const void *beta,
465
+ const cudnnTensorDescriptor_t yDesc,
466
+ void *y);
467
+
468
+ /*
469
+ * pooling mode
470
+ */
471
+ typedef enum {
472
+ CUDNN_POOLING_MAX = 0,
473
+ CUDNN_POOLING_AVERAGE_COUNT_INCLUDE_PADDING = 1, /* count for average includes padded values */
474
+ CUDNN_POOLING_AVERAGE_COUNT_EXCLUDE_PADDING = 2, /* count for average does not include padded values */
475
+ CUDNN_POOLING_MAX_DETERMINISTIC = 3
476
+ } cudnnPoolingMode_t CUDNN_DEPRECATED;
477
+
478
+ /* Create an instance of pooling descriptor */
479
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
480
+ cudnnCreatePoolingDescriptor(cudnnPoolingDescriptor_t *poolingDesc);
481
+
482
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
483
+ cudnnSetPooling2dDescriptor(cudnnPoolingDescriptor_t poolingDesc,
484
+ cudnnPoolingMode_t mode,
485
+ cudnnNanPropagation_t maxpoolingNanOpt,
486
+ int windowHeight,
487
+ int windowWidth,
488
+ int verticalPadding,
489
+ int horizontalPadding,
490
+ int verticalStride,
491
+ int horizontalStride);
492
+
493
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
494
+ cudnnGetPooling2dDescriptor(const cudnnPoolingDescriptor_t poolingDesc,
495
+ cudnnPoolingMode_t *mode,
496
+ cudnnNanPropagation_t *maxpoolingNanOpt,
497
+ int *windowHeight,
498
+ int *windowWidth,
499
+ int *verticalPadding,
500
+ int *horizontalPadding,
501
+ int *verticalStride,
502
+ int *horizontalStride);
503
+
504
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
505
+ cudnnSetPoolingNdDescriptor(cudnnPoolingDescriptor_t poolingDesc,
506
+ const cudnnPoolingMode_t mode,
507
+ const cudnnNanPropagation_t maxpoolingNanOpt,
508
+ int nbDims,
509
+ const int windowDimA[],
510
+ const int paddingA[],
511
+ const int strideA[]);
512
+
513
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
514
+ cudnnGetPoolingNdDescriptor(const cudnnPoolingDescriptor_t poolingDesc,
515
+ int nbDimsRequested,
516
+ cudnnPoolingMode_t *mode,
517
+ cudnnNanPropagation_t *maxpoolingNanOpt,
518
+ int *nbDims,
519
+ int windowDimA[],
520
+ int paddingA[],
521
+ int strideA[]);
522
+
523
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
524
+ cudnnGetPoolingNdForwardOutputDim(const cudnnPoolingDescriptor_t poolingDesc,
525
+ const cudnnTensorDescriptor_t inputTensorDesc,
526
+ int nbDims,
527
+ int outputTensorDimA[]);
528
+
529
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
530
+ cudnnGetPooling2dForwardOutputDim(const cudnnPoolingDescriptor_t poolingDesc,
531
+ const cudnnTensorDescriptor_t inputTensorDesc,
532
+ int *n,
533
+ int *c,
534
+ int *h,
535
+ int *w);
536
+
537
+ /* Destroy an instance of pooling descriptor */
538
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
539
+ cudnnDestroyPoolingDescriptor(cudnnPoolingDescriptor_t poolingDesc);
540
+
541
+ /* Pooling functions: All of the form "output = alpha * Op(inputs) + beta * output" */
542
+
543
+ /* Function to perform forward pooling */
544
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
545
+ cudnnPoolingForward(cudnnHandle_t handle,
546
+ const cudnnPoolingDescriptor_t poolingDesc,
547
+ const void *alpha,
548
+ const cudnnTensorDescriptor_t xDesc,
549
+ const void *x,
550
+ const void *beta,
551
+ const cudnnTensorDescriptor_t yDesc,
552
+ void *y);
553
+
554
+ /* Activation functions: All of the form "output = alpha * Op(inputs) + beta * output" */
555
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
556
+ cudnnCreateActivationDescriptor(cudnnActivationDescriptor_t *activationDesc);
557
+
558
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
559
+ cudnnSetActivationDescriptor(cudnnActivationDescriptor_t activationDesc,
560
+ cudnnActivationMode_t mode,
561
+ cudnnNanPropagation_t reluNanOpt,
562
+ double coef); /* ceiling for clipped RELU, alpha for ELU */
563
+
564
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
565
+ cudnnGetActivationDescriptor(const cudnnActivationDescriptor_t activationDesc,
566
+ cudnnActivationMode_t *mode,
567
+ cudnnNanPropagation_t *reluNanOpt,
568
+ double *coef); /* ceiling for clipped RELU, alpha for ELU */
569
+
570
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
571
+ cudnnSetActivationDescriptorSwishBeta(cudnnActivationDescriptor_t activationDesc, double swish_beta);
572
+
573
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
574
+ cudnnGetActivationDescriptorSwishBeta(cudnnActivationDescriptor_t activationDesc, double *swish_beta);
575
+
576
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
577
+ cudnnDestroyActivationDescriptor(cudnnActivationDescriptor_t activationDesc);
578
+
579
+ /* Function to perform forward activation */
580
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
581
+ cudnnActivationForward(cudnnHandle_t handle,
582
+ cudnnActivationDescriptor_t activationDesc,
583
+ const void *alpha,
584
+ const cudnnTensorDescriptor_t xDesc,
585
+ const void *x,
586
+ const void *beta,
587
+ const cudnnTensorDescriptor_t yDesc,
588
+ void *y);
589
+
590
+ /*
591
+ * Create an instance of LRN (Local Response Normalization) descriptor
592
+ * Uses lrnN=5, lrnAlpha=1e-4, lrnBeta=0.75, lrnK=2.0 as defaults from Krizhevsky'12 ImageNet paper
593
+ */
594
+ cudnnStatus_t CUDNNWINAPI
595
+ cudnnCreateLRNDescriptor(cudnnLRNDescriptor_t *normDesc);
596
+
597
+ #define CUDNN_LRN_MIN_N 1 /* minimum allowed lrnN */
598
+ #define CUDNN_LRN_MAX_N 16 /* maximum allowed lrnN */
599
+ #define CUDNN_LRN_MIN_K 1e-5 /* minimum allowed lrnK */
600
+ #define CUDNN_LRN_MIN_BETA 0.01 /* minimum allowed lrnBeta */
601
+
602
+ /* LRN layer mode */
603
+ typedef enum {
604
+ CUDNN_LRN_CROSS_CHANNEL_DIM1 = 0, /* Normalize across tensor's dimA[1] dimension */
605
+ } cudnnLRNMode_t;
606
+
607
+ /*
608
+ * Uses a window [center-lookBehind, center+lookAhead], where
609
+ * lookBehind = floor( (lrnN-1)/2 ), lookAhead = lrnN-lookBehind-1.
610
+ * Values of double parameters cast to tensor data type.
611
+ */
612
+ cudnnStatus_t CUDNNWINAPI
613
+ cudnnSetLRNDescriptor(cudnnLRNDescriptor_t normDesc, unsigned lrnN, double lrnAlpha, double lrnBeta, double lrnK);
614
+ /*
615
+ * Retrieve the settings currently stored in an LRN layer descriptor
616
+ * Any of the provided pointers can be NULL (no corresponding value will be returned)
617
+ */
618
+ cudnnStatus_t CUDNNWINAPI
619
+ cudnnGetLRNDescriptor(cudnnLRNDescriptor_t normDesc, unsigned *lrnN, double *lrnAlpha, double *lrnBeta, double *lrnK);
620
+
621
+ /* Destroy an instance of LRN descriptor */
622
+ cudnnStatus_t CUDNNWINAPI
623
+ cudnnDestroyLRNDescriptor(cudnnLRNDescriptor_t lrnDesc);
624
+
625
+ /* LRN functions: output = alpha * normalize(x) + beta * old_y */
626
+
627
+ /* LRN cross-channel forward computation. Double parameters cast to tensor data type */
628
+ cudnnStatus_t CUDNNWINAPI
629
+ cudnnLRNCrossChannelForward(cudnnHandle_t handle,
630
+ cudnnLRNDescriptor_t normDesc,
631
+ cudnnLRNMode_t lrnMode,
632
+ const void *alpha,
633
+ const cudnnTensorDescriptor_t xDesc,
634
+ const void *x,
635
+ const void *beta,
636
+ const cudnnTensorDescriptor_t yDesc,
637
+ void *y);
638
+
639
+ typedef enum {
640
+ CUDNN_DIVNORM_PRECOMPUTED_MEANS = 0,
641
+ } cudnnDivNormMode_t;
642
+
643
+ /* LCN/divisive normalization functions: y = alpha * normalize(x) + beta * y */
644
+ cudnnStatus_t CUDNNWINAPI
645
+ cudnnDivisiveNormalizationForward(cudnnHandle_t handle,
646
+ cudnnLRNDescriptor_t normDesc,
647
+ cudnnDivNormMode_t mode,
648
+ const void *alpha,
649
+ const cudnnTensorDescriptor_t xDesc, /* same desc for means, temp, temp2 */
650
+ const void *x,
651
+ const void *means, /* if NULL, means are assumed to be zero */
652
+ void *temp,
653
+ void *temp2,
654
+ const void *beta,
655
+ const cudnnTensorDescriptor_t yDesc,
656
+ void *y);
657
+
658
+ typedef enum {
659
+ /* bnScale, bnBias tensor dims are 1xCxHxWx.. (one value per CHW...-slice, normalized over N slice) */
660
+ CUDNN_BATCHNORM_PER_ACTIVATION = 0,
661
+
662
+ /* bnScale, bnBias tensor dims are 1xCx1x1 (one value per C-dim normalized over Nx1xHxW subtensors) */
663
+ CUDNN_BATCHNORM_SPATIAL = 1,
664
+
665
+ /*
666
+ * bnScale, bnBias tensor dims are 1xCx1x1 (one value per C-dim normalized over Nx1xHxW subtensors).
667
+ * May be faster than CUDNN_BATCHNORM_SPATIAL but imposes some limits on the range of values
668
+ */
669
+ CUDNN_BATCHNORM_SPATIAL_PERSISTENT = 2,
670
+ } cudnnBatchNormMode_t CUDNN_DEPRECATED;
671
+
672
+ #define CUDNN_BN_MIN_EPSILON 0.0 /* Minimum epsilon allowed to be used in the Batch Normalization formula */
673
+
674
+ /*
675
+ * Derives a tensor descriptor from layer data descriptor for BatchNormalization
676
+ * scale, invVariance, bnBias, bnScale tensors. Use this tensor desc for
677
+ * bnScaleBiasMeanVarDesc and bnScaleBiasDiffDesc in Batch Normalization forward and backward functions.
678
+ */
679
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
680
+ cudnnDeriveBNTensorDescriptor(cudnnTensorDescriptor_t derivedBnDesc,
681
+ const cudnnTensorDescriptor_t xDesc,
682
+ cudnnBatchNormMode_t mode);
683
+
684
+ typedef enum {
685
+ CUDNN_BATCHNORM_OPS_BN = 0, /* do batch normalization only */
686
+ CUDNN_BATCHNORM_OPS_BN_ACTIVATION = 1, /* do batchNorm, then activation */
687
+ CUDNN_BATCHNORM_OPS_BN_ADD_ACTIVATION = 2, /* do batchNorm, then elemWiseAdd, then activation */
688
+ } cudnnBatchNormOps_t CUDNN_DEPRECATED;
689
+
690
+ /*
691
+ * Performs Batch Normalization during Inference:
692
+ * y[i] = bnScale[k]*(x[i]-estimatedMean[k])/sqrt(epsilon+estimatedVariance[k]) + bnBias[k]
693
+ * with bnScale, bnBias, runningMean, runningInvVariance tensors indexed
694
+ * according to spatial or per-activation mode. Refer to cudnnBatchNormalizationForwardTraining
695
+ * above for notes on function arguments.
696
+ */
697
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
698
+ cudnnBatchNormalizationForwardInference(cudnnHandle_t handle,
699
+ cudnnBatchNormMode_t mode,
700
+ const void *alpha, /* alpha[0] = result blend factor */
701
+ const void *beta, /* beta[0] = dest layer blend factor */
702
+ const cudnnTensorDescriptor_t xDesc,
703
+ const void *x, /* NxCxHxW */
704
+ const cudnnTensorDescriptor_t yDesc,
705
+ void *y, /* NxCxHxW */
706
+ const cudnnTensorDescriptor_t bnScaleBiasMeanVarDesc,
707
+ const void *bnScale,
708
+ const void *bnBias,
709
+ const void *estimatedMean,
710
+ const void *estimatedVariance,
711
+ double epsilon);
712
+
713
+ typedef enum {
714
+ /* bnScale, bnBias tensor dims are 1xCxHxWx.. (one value per CHW...-slice, normalized over N slice) */
715
+ CUDNN_NORM_PER_ACTIVATION = 0,
716
+
717
+ /* bnScale, bnBias tensor dims are 1xCx1x1 (one value per C-dim normalized over Nx1xHxW subtensors) */
718
+ CUDNN_NORM_PER_CHANNEL = 1,
719
+ } cudnnNormMode_t CUDNN_DEPRECATED;
720
+
721
+ typedef enum { CUDNN_NORM_ALGO_STANDARD = 0, CUDNN_NORM_ALGO_PERSIST = 1 } cudnnNormAlgo_t CUDNN_DEPRECATED;
722
+
723
+ /*
724
+ * Derives a tensor descriptor from layer data descriptor for Normalization
725
+ * scale, invVariance, bnBias, bnScale tensors. Use this tensor desc for
726
+ * normScaleBiasMeanVarDesc and normScaleBiasDiffDesc in Normalization forward and backward functions.
727
+ */
728
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
729
+ cudnnDeriveNormTensorDescriptor(cudnnTensorDescriptor_t derivedNormScaleBiasDesc,
730
+ cudnnTensorDescriptor_t derivedNormMeanVarDesc,
731
+ const cudnnTensorDescriptor_t xDesc,
732
+ cudnnNormMode_t mode,
733
+ int groupCnt); /* Place hold for future work, should be set to 1 now*/
734
+
735
+ typedef enum {
736
+ CUDNN_NORM_OPS_NORM = 0, /* do normalization only */
737
+ CUDNN_NORM_OPS_NORM_ACTIVATION = 1, /* do Norm, then activation */
738
+ CUDNN_NORM_OPS_NORM_ADD_ACTIVATION = 2, /* do Norm, then elemWiseAdd, then activation */
739
+ } cudnnNormOps_t CUDNN_DEPRECATED;
740
+
741
+ /*
742
+ * Performs Normalization during Inference:
743
+ * y[i] = normScale[k]*(x[i]-estimatedMean[k])/sqrt(epsilon+estimatedVariance[k]) + normBias[k]
744
+ * with normScale, normBias, runningMean, runningInvVariance tensors indexed
745
+ * according to per-channel or per-activation mode. Refer to cudnnNormalizationForwardTraining
746
+ * above for notes on function arguments.
747
+ */
748
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
749
+ cudnnNormalizationForwardInference(cudnnHandle_t handle,
750
+ cudnnNormMode_t mode,
751
+ cudnnNormOps_t normOps,
752
+ cudnnNormAlgo_t algo,
753
+ const void *alpha, /* alpha[0] = result blend factor */
754
+ const void *beta, /* beta[0] = dest layer blend factor */
755
+ const cudnnTensorDescriptor_t xDesc,
756
+ const void *x, /* NxCxHxW */
757
+ const cudnnTensorDescriptor_t normScaleBiasDesc,
758
+ const void *normScale,
759
+ const void *normBias,
760
+ const cudnnTensorDescriptor_t normMeanVarDesc,
761
+ const void *estimatedMean,
762
+ const void *estimatedVariance,
763
+ const cudnnTensorDescriptor_t zDesc,
764
+ const void *z,
765
+ cudnnActivationDescriptor_t activationDesc,
766
+ const cudnnTensorDescriptor_t yDesc,
767
+ void *y, /* NxCxHxW */
768
+ double epsilon,
769
+ int groupCnt); /* Place hold for future work*/
770
+
771
+ /* APIs for spatial transformer network*/
772
+ typedef enum {
773
+ CUDNN_SAMPLER_BILINEAR = 0,
774
+ } cudnnSamplerType_t;
775
+
776
+ cudnnStatus_t CUDNNWINAPI
777
+ cudnnCreateSpatialTransformerDescriptor(cudnnSpatialTransformerDescriptor_t *stDesc);
778
+
779
+ cudnnStatus_t CUDNNWINAPI
780
+ cudnnSetSpatialTransformerNdDescriptor(cudnnSpatialTransformerDescriptor_t stDesc,
781
+ cudnnSamplerType_t samplerType,
782
+ cudnnDataType_t dataType,
783
+ const int nbDims,
784
+ const int dimA[]);
785
+
786
+ cudnnStatus_t CUDNNWINAPI
787
+ cudnnDestroySpatialTransformerDescriptor(cudnnSpatialTransformerDescriptor_t stDesc);
788
+
789
+ cudnnStatus_t CUDNNWINAPI
790
+ cudnnSpatialTfGridGeneratorForward(cudnnHandle_t handle,
791
+ const cudnnSpatialTransformerDescriptor_t stDesc,
792
+ const void *theta,
793
+ void *grid);
794
+
795
+ cudnnStatus_t CUDNNWINAPI
796
+ cudnnSpatialTfSamplerForward(cudnnHandle_t handle,
797
+ cudnnSpatialTransformerDescriptor_t stDesc,
798
+ const void *alpha,
799
+ const cudnnTensorDescriptor_t xDesc,
800
+ const void *x,
801
+ const void *grid,
802
+ const void *beta,
803
+ cudnnTensorDescriptor_t yDesc,
804
+ void *y);
805
+
806
+ typedef struct cudnnDropoutStruct *cudnnDropoutDescriptor_t;
807
+
808
+ cudnnStatus_t CUDNNWINAPI
809
+ cudnnCreateDropoutDescriptor(cudnnDropoutDescriptor_t *dropoutDesc);
810
+
811
+ cudnnStatus_t CUDNNWINAPI
812
+ cudnnDestroyDropoutDescriptor(cudnnDropoutDescriptor_t dropoutDesc);
813
+
814
+ /*helper function to determine size of the states to be passed to cudnnSetDropoutDescriptor */
815
+ cudnnStatus_t CUDNNWINAPI
816
+ cudnnDropoutGetStatesSize(cudnnHandle_t handle, size_t *sizeInBytes);
817
+
818
+ /*helper function to determine size of the reserve space to be passed to dropout forward/backward calls */
819
+ cudnnStatus_t CUDNNWINAPI
820
+ cudnnDropoutGetReserveSpaceSize(cudnnTensorDescriptor_t xdesc, size_t *sizeInBytes);
821
+
822
+ cudnnStatus_t CUDNNWINAPI
823
+ cudnnSetDropoutDescriptor(cudnnDropoutDescriptor_t dropoutDesc,
824
+ cudnnHandle_t handle,
825
+ float dropout,
826
+ void *states,
827
+ size_t stateSizeInBytes,
828
+ unsigned long long seed);
829
+
830
+ /* Restores the dropout descriptor to a previously saved-off state */
831
+ cudnnStatus_t CUDNNWINAPI
832
+ cudnnRestoreDropoutDescriptor(cudnnDropoutDescriptor_t dropoutDesc,
833
+ cudnnHandle_t handle,
834
+ float dropout,
835
+ void *states,
836
+ size_t stateSizeInBytes,
837
+ unsigned long long seed);
838
+
839
+ cudnnStatus_t CUDNNWINAPI
840
+ cudnnGetDropoutDescriptor(cudnnDropoutDescriptor_t dropoutDesc,
841
+ cudnnHandle_t handle,
842
+ float *dropout,
843
+ void **states,
844
+ unsigned long long *seed);
845
+
846
+ cudnnStatus_t CUDNNWINAPI
847
+ cudnnDropoutForward(cudnnHandle_t handle,
848
+ const cudnnDropoutDescriptor_t dropoutDesc,
849
+ const cudnnTensorDescriptor_t xdesc,
850
+ const void *x,
851
+ const cudnnTensorDescriptor_t ydesc,
852
+ void *y,
853
+ void *reserveSpace,
854
+ size_t reserveSpaceSizeInBytes);
855
+
856
+ /* TODO: move these enums out to the appropriate submodule */
857
+ typedef enum {
858
+ CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM = 0,
859
+ CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM = 1,
860
+ CUDNN_CONVOLUTION_FWD_ALGO_GEMM = 2,
861
+ CUDNN_CONVOLUTION_FWD_ALGO_DIRECT = 3,
862
+ CUDNN_CONVOLUTION_FWD_ALGO_FFT = 4,
863
+ CUDNN_CONVOLUTION_FWD_ALGO_FFT_TILING = 5,
864
+ CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD = 6,
865
+ CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD_NONFUSED = 7,
866
+ CUDNN_CONVOLUTION_FWD_ALGO_COUNT = 8
867
+ } cudnnConvolutionFwdAlgo_t;
868
+
869
+ typedef enum {
870
+ CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0 = 0, /* non-deterministic */
871
+ CUDNN_CONVOLUTION_BWD_FILTER_ALGO_1 = 1,
872
+ CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT = 2,
873
+ CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3 = 3, /* non-deterministic */
874
+ CUDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD = 4, /* not implemented */
875
+ CUDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD_NONFUSED = 5,
876
+ CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT_TILING = 6,
877
+ CUDNN_CONVOLUTION_BWD_FILTER_ALGO_COUNT = 7
878
+ } cudnnConvolutionBwdFilterAlgo_t;
879
+
880
+ typedef enum {
881
+ CUDNN_CONVOLUTION_BWD_DATA_ALGO_0 = 0, /* non-deterministic */
882
+ CUDNN_CONVOLUTION_BWD_DATA_ALGO_1 = 1,
883
+ CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT = 2,
884
+ CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT_TILING = 3,
885
+ CUDNN_CONVOLUTION_BWD_DATA_ALGO_WINOGRAD = 4,
886
+ CUDNN_CONVOLUTION_BWD_DATA_ALGO_WINOGRAD_NONFUSED = 5,
887
+ CUDNN_CONVOLUTION_BWD_DATA_ALGO_COUNT = 6
888
+ } cudnnConvolutionBwdDataAlgo_t;
889
+
890
+ typedef enum { CUDNN_CTC_LOSS_ALGO_DETERMINISTIC = 0, CUDNN_CTC_LOSS_ALGO_NON_DETERMINISTIC = 1 } cudnnCTCLossAlgo_t;
891
+
892
+ /*
893
+ * \brief Cross-library version checker.
894
+ * This function is implemented differently in each sub-library. Each sublib
895
+ * checks whether its own version matches that of its dependencies.
896
+ * \returns CUDNN_STATUS_SUCCESS if the version check passes,
897
+ * CUDNN_STATUS_SUBLIBRARY_VERSION_MISMATCH if the versions are inconsistent.
898
+ */
899
+ cudnnStatus_t CUDNNWINAPI
900
+ cudnnOpsVersionCheck(void);
901
+
902
+ /* Function to perform backward softmax */
903
+ cudnnStatus_t CUDNNWINAPI
904
+ cudnnSoftmaxBackward(cudnnHandle_t handle,
905
+ cudnnSoftmaxAlgorithm_t algo,
906
+ cudnnSoftmaxMode_t mode,
907
+ const void *alpha,
908
+ const cudnnTensorDescriptor_t yDesc,
909
+ const void *y,
910
+ const cudnnTensorDescriptor_t dyDesc,
911
+ const void *dy,
912
+ const void *beta,
913
+ const cudnnTensorDescriptor_t dxDesc,
914
+ void *dx);
915
+
916
+ /* Function to perform backward pooling */
917
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
918
+ cudnnPoolingBackward(cudnnHandle_t handle,
919
+ const cudnnPoolingDescriptor_t poolingDesc,
920
+ const void *alpha,
921
+ const cudnnTensorDescriptor_t yDesc,
922
+ const void *y,
923
+ const cudnnTensorDescriptor_t dyDesc,
924
+ const void *dy,
925
+ const cudnnTensorDescriptor_t xDesc,
926
+ const void *x,
927
+ const void *beta,
928
+ const cudnnTensorDescriptor_t dxDesc,
929
+ void *dx);
930
+
931
+ /* Function to perform backward activation */
932
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
933
+ cudnnActivationBackward(cudnnHandle_t handle,
934
+ cudnnActivationDescriptor_t activationDesc,
935
+ const void *alpha,
936
+ const cudnnTensorDescriptor_t yDesc,
937
+ const void *y,
938
+ const cudnnTensorDescriptor_t dyDesc,
939
+ const void *dy,
940
+ const cudnnTensorDescriptor_t xDesc,
941
+ const void *x,
942
+ const void *beta,
943
+ const cudnnTensorDescriptor_t dxDesc,
944
+ void *dx);
945
+
946
+ /* LRN cross-channel backward computation. Double parameters cast to tensor data type */
947
+ cudnnStatus_t CUDNNWINAPI
948
+ cudnnLRNCrossChannelBackward(cudnnHandle_t handle,
949
+ cudnnLRNDescriptor_t normDesc,
950
+ cudnnLRNMode_t lrnMode,
951
+ const void *alpha,
952
+ const cudnnTensorDescriptor_t yDesc,
953
+ const void *y,
954
+ const cudnnTensorDescriptor_t dyDesc,
955
+ const void *dy,
956
+ const cudnnTensorDescriptor_t xDesc,
957
+ const void *x,
958
+ const void *beta,
959
+ const cudnnTensorDescriptor_t dxDesc,
960
+ void *dx);
961
+
962
+ cudnnStatus_t CUDNNWINAPI
963
+ cudnnDivisiveNormalizationBackward(cudnnHandle_t handle,
964
+ cudnnLRNDescriptor_t normDesc,
965
+ cudnnDivNormMode_t mode,
966
+ const void *alpha,
967
+ const cudnnTensorDescriptor_t xDesc, /* same desc for x, means, dy, temp, temp2 */
968
+ const void *x,
969
+ const void *means, /* if NULL, means are assumed to be zero */
970
+ const void *dy,
971
+ void *temp,
972
+ void *temp2,
973
+ const void *beta,
974
+ const cudnnTensorDescriptor_t dXdMeansDesc, /* same desc for dx, dMeans */
975
+ void *dx, /* output x differential */
976
+ void *dMeans); /* output means differential, can be NULL */
977
+
978
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
979
+ cudnnGetBatchNormalizationForwardTrainingExWorkspaceSize(cudnnHandle_t handle,
980
+ cudnnBatchNormMode_t mode,
981
+ cudnnBatchNormOps_t bnOps,
982
+ const cudnnTensorDescriptor_t xDesc,
983
+ const cudnnTensorDescriptor_t zDesc,
984
+ const cudnnTensorDescriptor_t yDesc,
985
+ const cudnnTensorDescriptor_t bnScaleBiasMeanVarDesc,
986
+ const cudnnActivationDescriptor_t activationDesc,
987
+ size_t *sizeInBytes);
988
+
989
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
990
+ cudnnGetBatchNormalizationBackwardExWorkspaceSize(cudnnHandle_t handle,
991
+ cudnnBatchNormMode_t mode,
992
+ cudnnBatchNormOps_t bnOps,
993
+ const cudnnTensorDescriptor_t xDesc,
994
+ const cudnnTensorDescriptor_t yDesc,
995
+ const cudnnTensorDescriptor_t dyDesc,
996
+ const cudnnTensorDescriptor_t dzDesc,
997
+ const cudnnTensorDescriptor_t dxDesc,
998
+ const cudnnTensorDescriptor_t dBnScaleBiasDesc,
999
+ const cudnnActivationDescriptor_t activationDesc,
1000
+ size_t *sizeInBytes);
1001
+
1002
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
1003
+ cudnnGetBatchNormalizationTrainingExReserveSpaceSize(cudnnHandle_t handle,
1004
+ cudnnBatchNormMode_t mode,
1005
+ cudnnBatchNormOps_t bnOps,
1006
+ const cudnnActivationDescriptor_t activationDesc,
1007
+ const cudnnTensorDescriptor_t xDesc,
1008
+ size_t *sizeInBytes);
1009
+
1010
+ /* Computes y = BN(x). Also accumulates moving averages of mean and inverse variances */
1011
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
1012
+ cudnnBatchNormalizationForwardTraining(
1013
+ cudnnHandle_t handle,
1014
+ cudnnBatchNormMode_t mode,
1015
+
1016
+ const void *alpha, /* alpha[0] = result blend factor */
1017
+ const void *beta, /* beta[0] = dest layer blend factor */
1018
+
1019
+ const cudnnTensorDescriptor_t xDesc,
1020
+ const void *x, /* NxCxHxW */
1021
+ const cudnnTensorDescriptor_t yDesc,
1022
+ void *y, /* NxCxHxW */
1023
+
1024
+ /* Shared desc for the next 6 tensors in the argument list.
1025
+ Data type to be set as follows:
1026
+ type = (typeOf(x) == double) ? double : float
1027
+ Dimensions for this descriptor depend on normalization mode
1028
+ - Spatial Normalization : tensors are expected to have dims 1xCx1x1
1029
+ (normalization is performed across NxHxW)
1030
+ - Per-Activation Normalization : tensors are expected to have dims of 1xCxHxW
1031
+ (normalization is performed across N) */
1032
+ const cudnnTensorDescriptor_t bnScaleBiasMeanVarDesc,
1033
+
1034
+ /* 'Gamma' and 'Beta' respectively in Ioffe and Szegedy's paper's notation */
1035
+ const void *bnScale,
1036
+ const void *bnBias,
1037
+
1038
+ /* MUST use factor=1 in the very first call of a complete training cycle.
1039
+ Use a factor=1/(1+n) at N-th call to the function to get
1040
+ Cumulative Moving Average (CMA) behavior
1041
+ CMA[n] = (x[1]+...+x[n])/n
1042
+ Since CMA[n+1] = (n*CMA[n]+x[n+1])/(n+1) =
1043
+ ((n+1)*CMA[n]-CMA[n])/(n+1) + x[n+1]/(n+1) =
1044
+ CMA[n]*(1-1/(n+1)) + x[n+1]*1/(n+1) */
1045
+ double exponentialAverageFactor,
1046
+
1047
+ /* Used in Training phase only.
1048
+ runningMean = newMean*factor + runningMean*(1-factor) */
1049
+ void *resultRunningMean,
1050
+ /* Output in training mode, input in inference. Is the moving average
1051
+ of variance[x] (factor is applied in the same way as for runningMean) */
1052
+ void *resultRunningVariance,
1053
+
1054
+ /* Has to be >= CUDNN_BN_MIN_EPSILON. Should be the same in forward and backward functions. */
1055
+ double epsilon,
1056
+
1057
+ /* Optionally save intermediate results from the forward pass here
1058
+ - can be reused to speed up backward pass. NULL if unused */
1059
+ void *resultSaveMean,
1060
+ void *resultSaveInvVariance);
1061
+
1062
+ /* Computes y = relu(BN(x) + z). Also accumulates moving averages of mean and inverse variances */
1063
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
1064
+ cudnnBatchNormalizationForwardTrainingEx(
1065
+ cudnnHandle_t handle,
1066
+ cudnnBatchNormMode_t mode,
1067
+ cudnnBatchNormOps_t bnOps,
1068
+
1069
+ const void *alpha, /* alpha[0] = result blend factor */
1070
+ const void *beta, /* beta[0] = dest layer blend factor */
1071
+
1072
+ const cudnnTensorDescriptor_t xDesc,
1073
+ const void *xData,
1074
+ const cudnnTensorDescriptor_t zDesc,
1075
+ const void *zData,
1076
+ const cudnnTensorDescriptor_t yDesc,
1077
+ void *yData,
1078
+
1079
+ const cudnnTensorDescriptor_t bnScaleBiasMeanVarDesc,
1080
+ const void *bnScale,
1081
+ const void *bnBias,
1082
+
1083
+ double exponentialAverageFactor,
1084
+ void *resultRunningMean,
1085
+ void *resultRunningVariance,
1086
+
1087
+ /* Has to be >= CUDNN_BN_MIN_EPSILON. Should be the same in forward and backward functions. */
1088
+ double epsilon,
1089
+
1090
+ /* Optionally save intermediate results from the forward pass here
1091
+ - can be reused to speed up backward pass. NULL if unused */
1092
+ void *resultSaveMean,
1093
+ void *resultSaveInvVariance,
1094
+
1095
+ cudnnActivationDescriptor_t activationDesc,
1096
+ void *workspace,
1097
+ size_t workSpaceSizeInBytes,
1098
+ void *reserveSpace,
1099
+ size_t reserveSpaceSizeInBytes);
1100
+
1101
+ /* Performs backward pass of Batch Normalization layer. Returns x gradient,
1102
+ * bnScale gradient and bnBias gradient */
1103
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
1104
+ cudnnBatchNormalizationBackward(cudnnHandle_t handle,
1105
+ cudnnBatchNormMode_t mode,
1106
+ const void *alphaDataDiff,
1107
+ const void *betaDataDiff,
1108
+ const void *alphaParamDiff,
1109
+ const void *betaParamDiff,
1110
+ const cudnnTensorDescriptor_t xDesc, /* same desc for x, dx, dy */
1111
+ const void *x,
1112
+ const cudnnTensorDescriptor_t dyDesc,
1113
+ const void *dy,
1114
+ const cudnnTensorDescriptor_t dxDesc,
1115
+ void *dx,
1116
+ /* Shared tensor desc for the 4 tensors below */
1117
+ const cudnnTensorDescriptor_t dBnScaleBiasDesc,
1118
+ const void *bnScale, /* bnBias doesn't affect backpropagation */
1119
+ /* scale and bias diff are not backpropagated below this layer */
1120
+ void *dBnScaleResult,
1121
+ void *dBnBiasResult,
1122
+ /* Same epsilon as forward pass */
1123
+ double epsilon,
1124
+
1125
+ /* Optionally cached intermediate results from
1126
+ forward pass */
1127
+ const void *savedMean,
1128
+ const void *savedInvVariance);
1129
+
1130
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
1131
+ cudnnBatchNormalizationBackwardEx(cudnnHandle_t handle,
1132
+ cudnnBatchNormMode_t mode,
1133
+ cudnnBatchNormOps_t bnOps,
1134
+
1135
+ const void *alphaDataDiff,
1136
+ const void *betaDataDiff,
1137
+ const void *alphaParamDiff,
1138
+ const void *betaParamDiff,
1139
+ const cudnnTensorDescriptor_t xDesc,
1140
+ const void *xData,
1141
+ const cudnnTensorDescriptor_t yDesc,
1142
+ const void *yData,
1143
+ const cudnnTensorDescriptor_t dyDesc,
1144
+ const void *dyData,
1145
+ const cudnnTensorDescriptor_t dzDesc,
1146
+ void *dzData,
1147
+ const cudnnTensorDescriptor_t dxDesc,
1148
+ void *dxData,
1149
+
1150
+ /* Shared tensor desc for the 4 tensors below */
1151
+ const cudnnTensorDescriptor_t dBnScaleBiasDesc,
1152
+ const void *bnScaleData,
1153
+ const void *bnBiasData, /* needed if there is activation */
1154
+ void *dBnScaleData,
1155
+ void *dBnBiasData,
1156
+ double epsilon, /* Same epsilon as forward pass */
1157
+
1158
+ /* Optionally cached intermediate results from
1159
+ forward pass */
1160
+ const void *savedMean,
1161
+ const void *savedInvVariance,
1162
+ cudnnActivationDescriptor_t activationDesc,
1163
+ void *workSpace,
1164
+ size_t workSpaceSizeInBytes,
1165
+ void *reserveSpace,
1166
+ size_t reserveSpaceSizeInBytes);
1167
+
1168
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
1169
+ cudnnGetNormalizationForwardTrainingWorkspaceSize(cudnnHandle_t handle,
1170
+ cudnnNormMode_t mode,
1171
+ cudnnNormOps_t normOps,
1172
+ cudnnNormAlgo_t algo,
1173
+ const cudnnTensorDescriptor_t xDesc,
1174
+ const cudnnTensorDescriptor_t zDesc,
1175
+ const cudnnTensorDescriptor_t yDesc,
1176
+ const cudnnTensorDescriptor_t normScaleBiasDesc,
1177
+ const cudnnActivationDescriptor_t activationDesc,
1178
+ const cudnnTensorDescriptor_t normMeanVarDesc,
1179
+ size_t *sizeInBytes,
1180
+ int groupCnt); /* Place hold for future work, should be set to 1 now*/
1181
+
1182
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
1183
+ cudnnGetNormalizationBackwardWorkspaceSize(cudnnHandle_t handle,
1184
+ cudnnNormMode_t mode,
1185
+ cudnnNormOps_t normOps,
1186
+ cudnnNormAlgo_t algo,
1187
+ const cudnnTensorDescriptor_t xDesc,
1188
+ const cudnnTensorDescriptor_t yDesc,
1189
+ const cudnnTensorDescriptor_t dyDesc,
1190
+ const cudnnTensorDescriptor_t dzDesc,
1191
+ const cudnnTensorDescriptor_t dxDesc,
1192
+ const cudnnTensorDescriptor_t dNormScaleBiasDesc,
1193
+ const cudnnActivationDescriptor_t activationDesc,
1194
+ const cudnnTensorDescriptor_t normMeanVarDesc,
1195
+ size_t *sizeInBytes,
1196
+ int groupCnt); /* Place hold for future work, should be set to 1 now*/
1197
+
1198
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
1199
+ cudnnGetNormalizationTrainingReserveSpaceSize(cudnnHandle_t handle,
1200
+ cudnnNormMode_t mode,
1201
+ cudnnNormOps_t normOps,
1202
+ cudnnNormAlgo_t algo,
1203
+ const cudnnActivationDescriptor_t activationDesc,
1204
+ const cudnnTensorDescriptor_t xDesc,
1205
+ size_t *sizeInBytes,
1206
+ int groupCnt); /* Place hold for future work, should be set to 1 now*/
1207
+
1208
+ /* Computes y = relu(Norm(x) + z). Also accumulates moving averages of mean and inverse variances */
1209
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
1210
+ cudnnNormalizationForwardTraining(cudnnHandle_t handle,
1211
+ cudnnNormMode_t mode,
1212
+ cudnnNormOps_t normOps,
1213
+ cudnnNormAlgo_t algo,
1214
+ const void *alpha, /* alpha[0] = result blend factor */
1215
+ const void *beta, /* beta[0] = dest layer blend factor */
1216
+ const cudnnTensorDescriptor_t xDesc,
1217
+ const void *xData,
1218
+ const cudnnTensorDescriptor_t normScaleBiasDesc,
1219
+ const void *normScale,
1220
+ const void *normBias,
1221
+ double exponentialAverageFactor,
1222
+ const cudnnTensorDescriptor_t normMeanVarDesc,
1223
+ void *resultRunningMean,
1224
+ void *resultRunningVariance,
1225
+ /* Has to be >= 0. Should be the same in forward and backward functions. */
1226
+ double epsilon,
1227
+ /* Optionally save intermediate results from the forward pass here
1228
+ - can be reused to speed up backward pass. NULL if unused */
1229
+ void *resultSaveMean,
1230
+ void *resultSaveInvVariance,
1231
+ cudnnActivationDescriptor_t activationDesc,
1232
+ const cudnnTensorDescriptor_t zDesc,
1233
+ const void *zData,
1234
+ const cudnnTensorDescriptor_t yDesc,
1235
+ void *yData,
1236
+ void *workspace,
1237
+ size_t workSpaceSizeInBytes,
1238
+ void *reserveSpace,
1239
+ size_t reserveSpaceSizeInBytes,
1240
+ int groupCnt); /* Place hold for future work, should be set to 1 now*/
1241
+
1242
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
1243
+ cudnnNormalizationBackward(cudnnHandle_t handle,
1244
+ cudnnNormMode_t mode,
1245
+ cudnnNormOps_t normOps,
1246
+ cudnnNormAlgo_t algo,
1247
+ const void *alphaDataDiff,
1248
+ const void *betaDataDiff,
1249
+ const void *alphaParamDiff,
1250
+ const void *betaParamDiff,
1251
+ const cudnnTensorDescriptor_t xDesc,
1252
+ const void *xData,
1253
+ const cudnnTensorDescriptor_t yDesc,
1254
+ const void *yData,
1255
+ const cudnnTensorDescriptor_t dyDesc,
1256
+ const void *dyData,
1257
+ const cudnnTensorDescriptor_t dzDesc,
1258
+ void *dzData,
1259
+ const cudnnTensorDescriptor_t dxDesc,
1260
+ void *dxData,
1261
+ /* Shared tensor desc for the 4 tensors below */
1262
+ const cudnnTensorDescriptor_t dNormScaleBiasDesc,
1263
+ const void *normScaleData,
1264
+ const void *normBiasData, /* needed if there is activation */
1265
+ void *dNormScaleData,
1266
+ void *dNormBiasData,
1267
+ double epsilon, /* Same epsilon as forward pass */
1268
+ const cudnnTensorDescriptor_t normMeanVarDesc,
1269
+ /* Optionally cached intermediate results from
1270
+ forward pass */
1271
+ const void *savedMean,
1272
+ const void *savedInvVariance,
1273
+ cudnnActivationDescriptor_t activationDesc,
1274
+ void *workSpace,
1275
+ size_t workSpaceSizeInBytes,
1276
+ void *reserveSpace,
1277
+ size_t reserveSpaceSizeInBytes,
1278
+ int groupCnt); /* Place hold for future work, should be set to 1 now*/
1279
+
1280
+ cudnnStatus_t CUDNNWINAPI
1281
+ cudnnSpatialTfGridGeneratorBackward(cudnnHandle_t handle,
1282
+ const cudnnSpatialTransformerDescriptor_t stDesc,
1283
+ const void *dgrid,
1284
+ void *dtheta);
1285
+
1286
+ cudnnStatus_t CUDNNWINAPI
1287
+ cudnnSpatialTfSamplerBackward(cudnnHandle_t handle,
1288
+ cudnnSpatialTransformerDescriptor_t stDesc,
1289
+ const void *alpha,
1290
+ const cudnnTensorDescriptor_t xDesc,
1291
+ const void *x,
1292
+ const void *beta,
1293
+ const cudnnTensorDescriptor_t dxDesc,
1294
+ void *dx,
1295
+ const void *alphaDgrid,
1296
+ const cudnnTensorDescriptor_t dyDesc,
1297
+ const void *dy,
1298
+ const void *grid,
1299
+ const void *betaDgrid,
1300
+ void *dgrid);
1301
+
1302
+ cudnnStatus_t CUDNNWINAPI
1303
+ cudnnDropoutBackward(cudnnHandle_t handle,
1304
+ const cudnnDropoutDescriptor_t dropoutDesc,
1305
+ const cudnnTensorDescriptor_t dydesc,
1306
+ const void *dy,
1307
+ const cudnnTensorDescriptor_t dxdesc,
1308
+ void *dx,
1309
+ void *reserveSpace,
1310
+ size_t reserveSpaceSizeInBytes);
1311
+
1312
+ #if defined(__cplusplus)
1313
+ }
1314
+ #endif
1315
+
1316
+ #endif /* CUDNN_OPS_H_ */
lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_ops_v9.h ADDED
@@ -0,0 +1,1316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright 2014-2023 NVIDIA Corporation. All rights reserved.
3
+ *
4
+ * NOTICE TO LICENSEE:
5
+ *
6
+ * This source code and/or documentation ("Licensed Deliverables") are
7
+ * subject to NVIDIA intellectual property rights under U.S. and
8
+ * international Copyright laws.
9
+ *
10
+ * These Licensed Deliverables contained herein is PROPRIETARY and
11
+ * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12
+ * conditions of a form of NVIDIA software license agreement by and
13
+ * between NVIDIA and Licensee ("License Agreement") or electronically
14
+ * accepted by Licensee. Notwithstanding any terms or conditions to
15
+ * the contrary in the License Agreement, reproduction or disclosure
16
+ * of the Licensed Deliverables to any third party without the express
17
+ * written consent of NVIDIA is prohibited.
18
+ *
19
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20
+ * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21
+ * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
22
+ * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23
+ * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24
+ * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25
+ * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27
+ * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28
+ * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32
+ * OF THESE LICENSED DELIVERABLES.
33
+ *
34
+ * U.S. Government End Users. These Licensed Deliverables are a
35
+ * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36
+ * 1995), consisting of "commercial computer software" and "commercial
37
+ * computer software documentation" as such terms are used in 48
38
+ * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39
+ * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40
+ * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41
+ * U.S. Government End Users acquire the Licensed Deliverables with
42
+ * only those rights set forth herein.
43
+ *
44
+ * Any use of the Licensed Deliverables in individual and commercial
45
+ * software must include, in the user documentation and internal
46
+ * comments to the code, the above Disclaimer and U.S. Government End
47
+ * Users Notice.
48
+ */
49
+
50
+ /*
51
+ * cudnn_ops : cuDNN's basic definitions and basic operations.
52
+ */
53
+
54
+ #if !defined(CUDNN_OPS_H_)
55
+ #define CUDNN_OPS_H_
56
+
57
+ #include <stdint.h>
58
+
59
+ #include "cudnn_version.h"
60
+ #include "cudnn_graph.h"
61
+
62
+ /* These version numbers are autogenerated, do not edit manually. */
63
+ #define CUDNN_OPS_MAJOR 9
64
+ #define CUDNN_OPS_MINOR 1
65
+ #define CUDNN_OPS_PATCH 0
66
+
67
+ #if (CUDNN_OPS_MAJOR != CUDNN_MAJOR) || (CUDNN_OPS_MINOR != CUDNN_MINOR) || (CUDNN_OPS_PATCH != CUDNN_PATCHLEVEL)
68
+ #error Version mismatch in cuDNN OPS INFER!!!
69
+ #endif
70
+
71
+ #if defined(__cplusplus)
72
+ extern "C" {
73
+ #endif
74
+
75
+ /* Data structures to represent Image/Filter and the Neural Network Layer */
76
+ typedef struct cudnnTensorStruct *cudnnTensorDescriptor_t;
77
+ typedef struct cudnnPoolingStruct *cudnnPoolingDescriptor_t CUDNN_DEPRECATED;
78
+ typedef struct cudnnFilterStruct *cudnnFilterDescriptor_t CUDNN_DEPRECATED;
79
+ typedef struct cudnnLRNStruct *cudnnLRNDescriptor_t;
80
+ typedef struct cudnnActivationStruct *cudnnActivationDescriptor_t CUDNN_DEPRECATED;
81
+ typedef struct cudnnSpatialTransformerStruct *cudnnSpatialTransformerDescriptor_t;
82
+ typedef struct cudnnOpTensorStruct *cudnnOpTensorDescriptor_t CUDNN_DEPRECATED;
83
+ typedef struct cudnnReduceTensorStruct *cudnnReduceTensorDescriptor_t CUDNN_DEPRECATED;
84
+ typedef struct cudnnCTCLossStruct *cudnnCTCLossDescriptor_t;
85
+ typedef struct cudnnTensorTransformStruct *cudnnTensorTransformDescriptor_t CUDNN_DEPRECATED;
86
+ /*
87
+ * CUDNN Determinism
88
+ */
89
+ typedef enum {
90
+ CUDNN_NON_DETERMINISTIC = 0,
91
+ CUDNN_DETERMINISTIC = 1,
92
+ } cudnnDeterminism_t;
93
+
94
+ /* Create an instance of a generic Tensor descriptor */
95
+ cudnnStatus_t CUDNNWINAPI
96
+ cudnnCreateTensorDescriptor(cudnnTensorDescriptor_t *tensorDesc);
97
+
98
+ cudnnStatus_t CUDNNWINAPI
99
+ cudnnSetTensor4dDescriptor(cudnnTensorDescriptor_t tensorDesc,
100
+ cudnnTensorFormat_t format,
101
+ cudnnDataType_t dataType, /* image data type */
102
+ int n, /* number of inputs (batch size) */
103
+ int c, /* number of input feature maps */
104
+ int h, /* height of input section */
105
+ int w); /* width of input section */
106
+
107
+ cudnnStatus_t CUDNNWINAPI
108
+ cudnnSetTensor4dDescriptorEx(cudnnTensorDescriptor_t tensorDesc,
109
+ cudnnDataType_t dataType, /* image data type */
110
+ int n, /* number of inputs (batch size) */
111
+ int c, /* number of input feature maps */
112
+ int h, /* height of input section */
113
+ int w, /* width of input section */
114
+ int nStride,
115
+ int cStride,
116
+ int hStride,
117
+ int wStride);
118
+
119
+ cudnnStatus_t CUDNNWINAPI
120
+ cudnnGetTensor4dDescriptor(const cudnnTensorDescriptor_t tensorDesc,
121
+ cudnnDataType_t *dataType, /* image data type */
122
+ int *n, /* number of inputs (batch size) */
123
+ int *c, /* number of input feature maps */
124
+ int *h, /* height of input section */
125
+ int *w, /* width of input section */
126
+ int *nStride,
127
+ int *cStride,
128
+ int *hStride,
129
+ int *wStride);
130
+
131
+ cudnnStatus_t CUDNNWINAPI
132
+ cudnnSetTensorNdDescriptor(cudnnTensorDescriptor_t tensorDesc,
133
+ cudnnDataType_t dataType,
134
+ int nbDims,
135
+ const int dimA[],
136
+ const int strideA[]);
137
+
138
+ cudnnStatus_t CUDNNWINAPI
139
+ cudnnSetTensorNdDescriptorEx(cudnnTensorDescriptor_t tensorDesc,
140
+ cudnnTensorFormat_t format,
141
+ cudnnDataType_t dataType,
142
+ int nbDims,
143
+ const int dimA[]);
144
+
145
+ cudnnStatus_t CUDNNWINAPI
146
+ cudnnGetTensorNdDescriptor(const cudnnTensorDescriptor_t tensorDesc,
147
+ int nbDimsRequested,
148
+ cudnnDataType_t *dataType,
149
+ int *nbDims,
150
+ int dimA[],
151
+ int strideA[]);
152
+
153
+ cudnnStatus_t CUDNNWINAPI
154
+ cudnnGetTensorSizeInBytes(const cudnnTensorDescriptor_t tensorDesc, size_t *size);
155
+
156
+ /* PixelOffset( n, c, h, w ) = n *input_stride + c * feature_stride + h * h_stride + w * w_stride
157
+
158
+ 1)Example of all images in row major order one batch of features after the other (with an optional padding on row)
159
+ input_stride : c x h x h_stride
160
+ feature_stride : h x h_stride
161
+ h_stride : >= w ( h_stride = w if no padding)
162
+ w_stride : 1
163
+
164
+
165
+ 2)Example of all images in row major with features maps interleaved
166
+ input_stride : c x h x h_stride
167
+ feature_stride : 1
168
+ h_stride : w x c
169
+ w_stride : c
170
+
171
+ 3)Example of all images in column major order one batch of features after the other (with optional padding on column)
172
+ input_stride : c x w x w_stride
173
+ feature_stride : w x w_stride
174
+ h_stride : 1
175
+ w_stride : >= h
176
+
177
+ */
178
+
179
+ /* Destroy an instance of Tensor4d descriptor */
180
+ cudnnStatus_t CUDNNWINAPI
181
+ cudnnDestroyTensorDescriptor(cudnnTensorDescriptor_t tensorDesc);
182
+
183
+ /* Fold/unfold transforms */
184
+ typedef enum {
185
+ CUDNN_TRANSFORM_FOLD = 0U,
186
+ CUDNN_TRANSFORM_UNFOLD = 1U,
187
+ } cudnnFoldingDirection_t;
188
+
189
+ /** Create a destination descriptor for cudnnTransformTensor */
190
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
191
+ cudnnInitTransformDest(const cudnnTensorTransformDescriptor_t transformDesc,
192
+ const cudnnTensorDescriptor_t srcDesc,
193
+ cudnnTensorDescriptor_t destDesc,
194
+ size_t *destSizeInBytes);
195
+
196
+ /** Create an empty tensor transform descriptor */
197
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
198
+ cudnnCreateTensorTransformDescriptor(cudnnTensorTransformDescriptor_t *transformDesc);
199
+
200
+ /** Initialize a previously created tensor transform descriptor. */
201
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
202
+ cudnnSetTensorTransformDescriptor(cudnnTensorTransformDescriptor_t transformDesc,
203
+ const uint32_t nbDims,
204
+ const cudnnTensorFormat_t destFormat,
205
+ const int32_t padBeforeA[],
206
+ const int32_t padAfterA[],
207
+ const uint32_t foldA[],
208
+ const cudnnFoldingDirection_t direction);
209
+
210
+ /**
211
+ * Retrieves the values stored in a previously initialized tensor transform
212
+ * descriptor.
213
+ */
214
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
215
+ cudnnGetTensorTransformDescriptor(cudnnTensorTransformDescriptor_t transformDesc,
216
+ uint32_t nbDimsRequested,
217
+ cudnnTensorFormat_t *destFormat,
218
+ int32_t padBeforeA[],
219
+ int32_t padAfterA[],
220
+ uint32_t foldA[],
221
+ cudnnFoldingDirection_t *direction);
222
+
223
+ /**
224
+ * Destroys a previously created tensor transform descriptor.
225
+ */
226
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
227
+ cudnnDestroyTensorTransformDescriptor(cudnnTensorTransformDescriptor_t transformDesc);
228
+
229
+ /* Tensor layout conversion helper (y = alpha * x + beta * y) */
230
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
231
+ cudnnTransformTensor(cudnnHandle_t handle,
232
+ const void *alpha,
233
+ const cudnnTensorDescriptor_t xDesc,
234
+ const void *x,
235
+ const void *beta,
236
+ const cudnnTensorDescriptor_t yDesc,
237
+ void *y);
238
+
239
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
240
+ cudnnTransformTensorEx(cudnnHandle_t handle,
241
+ const cudnnTensorTransformDescriptor_t transDesc,
242
+ const void *alpha,
243
+ const cudnnTensorDescriptor_t srcDesc,
244
+ const void *srcData,
245
+ const void *beta,
246
+ const cudnnTensorDescriptor_t destDesc,
247
+ void *destData);
248
+
249
+ /* Tensor Bias addition : C = alpha * A + beta * C */
250
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
251
+ cudnnAddTensor(cudnnHandle_t handle,
252
+ const void *alpha,
253
+ const cudnnTensorDescriptor_t aDesc,
254
+ const void *A,
255
+ const void *beta,
256
+ const cudnnTensorDescriptor_t cDesc,
257
+ void *C);
258
+
259
+ /*
260
+ * CUDNN OpTensor op type
261
+ */
262
+ typedef enum {
263
+ CUDNN_OP_TENSOR_ADD = 0,
264
+ CUDNN_OP_TENSOR_MUL = 1,
265
+ CUDNN_OP_TENSOR_MIN = 2,
266
+ CUDNN_OP_TENSOR_MAX = 3,
267
+ CUDNN_OP_TENSOR_SQRT = 4,
268
+ CUDNN_OP_TENSOR_NOT = 5,
269
+ } cudnnOpTensorOp_t;
270
+
271
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
272
+ cudnnCreateOpTensorDescriptor(cudnnOpTensorDescriptor_t *opTensorDesc);
273
+
274
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
275
+ cudnnSetOpTensorDescriptor(cudnnOpTensorDescriptor_t opTensorDesc,
276
+ cudnnOpTensorOp_t opTensorOp,
277
+ cudnnDataType_t opTensorCompType,
278
+ cudnnNanPropagation_t opTensorNanOpt);
279
+
280
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
281
+ cudnnGetOpTensorDescriptor(const cudnnOpTensorDescriptor_t opTensorDesc,
282
+ cudnnOpTensorOp_t *opTensorOp,
283
+ cudnnDataType_t *opTensorCompType,
284
+ cudnnNanPropagation_t *opTensorNanOpt);
285
+
286
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
287
+ cudnnDestroyOpTensorDescriptor(cudnnOpTensorDescriptor_t opTensorDesc);
288
+
289
+ /* Tensor operation : C = op( alpha1 * A, alpha2 * B ) + beta * C */
290
+ /* B tensor is ignored for CUDNN_OP_TENSOR_SQRT, CUDNN_OP_TENSOR_NOT. */
291
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
292
+ cudnnOpTensor(cudnnHandle_t handle,
293
+ const cudnnOpTensorDescriptor_t opTensorDesc,
294
+ const void *alpha1,
295
+ const cudnnTensorDescriptor_t aDesc,
296
+ const void *A,
297
+ const void *alpha2,
298
+ const cudnnTensorDescriptor_t bDesc,
299
+ const void *B,
300
+ const void *beta,
301
+ const cudnnTensorDescriptor_t cDesc,
302
+ void *C);
303
+
304
+ /*
305
+ * CUDNN ReduceTensor indices type
306
+ */
307
+ typedef enum {
308
+ CUDNN_REDUCE_TENSOR_NO_INDICES = 0,
309
+ CUDNN_REDUCE_TENSOR_FLATTENED_INDICES = 1,
310
+ } cudnnReduceTensorIndices_t CUDNN_DEPRECATED;
311
+
312
+ /*
313
+ * CUDNN tensor indices type size (all unsigned)
314
+ * Currently not supported, default is 32 bit unsigned.
315
+ */
316
+ typedef enum {
317
+ CUDNN_32BIT_INDICES = 0,
318
+ CUDNN_64BIT_INDICES = 1,
319
+ CUDNN_16BIT_INDICES = 2,
320
+ CUDNN_8BIT_INDICES = 3,
321
+ } cudnnIndicesType_t CUDNN_DEPRECATED;
322
+
323
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
324
+ cudnnCreateReduceTensorDescriptor(cudnnReduceTensorDescriptor_t *reduceTensorDesc);
325
+
326
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
327
+ cudnnSetReduceTensorDescriptor(cudnnReduceTensorDescriptor_t reduceTensorDesc,
328
+ cudnnReduceTensorOp_t reduceTensorOp,
329
+ cudnnDataType_t reduceTensorCompType,
330
+ cudnnNanPropagation_t reduceTensorNanOpt,
331
+ cudnnReduceTensorIndices_t reduceTensorIndices,
332
+ cudnnIndicesType_t reduceTensorIndicesType);
333
+
334
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
335
+ cudnnGetReduceTensorDescriptor(const cudnnReduceTensorDescriptor_t reduceTensorDesc,
336
+ cudnnReduceTensorOp_t *reduceTensorOp,
337
+ cudnnDataType_t *reduceTensorCompType,
338
+ cudnnNanPropagation_t *reduceTensorNanOpt,
339
+ cudnnReduceTensorIndices_t *reduceTensorIndices,
340
+ cudnnIndicesType_t *reduceTensorIndicesType);
341
+
342
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
343
+ cudnnDestroyReduceTensorDescriptor(cudnnReduceTensorDescriptor_t reduceTensorDesc);
344
+
345
+ /* Helper function to return the minimum size of the index space to be passed to the reduction given the input and
346
+ * output tensors */
347
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
348
+ cudnnGetReductionIndicesSize(cudnnHandle_t handle,
349
+ const cudnnReduceTensorDescriptor_t reduceTensorDesc,
350
+ const cudnnTensorDescriptor_t aDesc,
351
+ const cudnnTensorDescriptor_t cDesc,
352
+ size_t *sizeInBytes);
353
+
354
+ /* Helper function to return the minimum size of the workspace to be passed to the reduction given the input and output
355
+ * tensors */
356
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
357
+ cudnnGetReductionWorkspaceSize(cudnnHandle_t handle,
358
+ const cudnnReduceTensorDescriptor_t reduceTensorDesc,
359
+ const cudnnTensorDescriptor_t aDesc,
360
+ const cudnnTensorDescriptor_t cDesc,
361
+ size_t *sizeInBytes);
362
+
363
+ /* Tensor operation : C = reduce op( alpha * A ) + beta * C */
364
+ /* The NaN propagation enum applies to only the min and max reduce ops; the other reduce ops propagate NaN as usual. */
365
+ /* The indices space is ignored for reduce ops other than min or max. */
366
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
367
+ cudnnReduceTensor(cudnnHandle_t handle,
368
+ const cudnnReduceTensorDescriptor_t reduceTensorDesc,
369
+ void *indices,
370
+ size_t indicesSizeInBytes,
371
+ void *workspace,
372
+ size_t workspaceSizeInBytes,
373
+ const void *alpha,
374
+ const cudnnTensorDescriptor_t aDesc,
375
+ const void *A,
376
+ const void *beta,
377
+ const cudnnTensorDescriptor_t cDesc,
378
+ void *C);
379
+
380
+ /* Set all values of a tensor to a given value : y[i] = value[0] */
381
+ cudnnStatus_t CUDNNWINAPI
382
+ cudnnSetTensor(cudnnHandle_t handle, const cudnnTensorDescriptor_t yDesc, void *y, const void *valuePtr);
383
+
384
+ /* Scale all values of a tensor by a given factor : y[i] = alpha * y[i] */
385
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
386
+ cudnnScaleTensor(cudnnHandle_t handle, const cudnnTensorDescriptor_t yDesc, void *y, const void *alpha);
387
+
388
+ /* Create an instance of FilterStruct */
389
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
390
+ cudnnCreateFilterDescriptor(cudnnFilterDescriptor_t *filterDesc);
391
+
392
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
393
+ cudnnSetFilter4dDescriptor(cudnnFilterDescriptor_t filterDesc,
394
+ cudnnDataType_t dataType, /* image data type */
395
+ cudnnTensorFormat_t format,
396
+ int k, /* number of output feature maps */
397
+ int c, /* number of input feature maps */
398
+ int h, /* height of each input filter */
399
+ int w); /* width of each input filter */
400
+
401
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
402
+ cudnnGetFilter4dDescriptor(const cudnnFilterDescriptor_t filterDesc,
403
+ cudnnDataType_t *dataType, /* image data type */
404
+ cudnnTensorFormat_t *format,
405
+ int *k, /* number of output feature maps */
406
+ int *c, /* number of input feature maps */
407
+ int *h, /* height of each input filter */
408
+ int *w); /* width of each input filter */
409
+
410
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
411
+ cudnnSetFilterNdDescriptor(cudnnFilterDescriptor_t filterDesc,
412
+ cudnnDataType_t dataType, /* image data type */
413
+ cudnnTensorFormat_t format,
414
+ int nbDims,
415
+ const int filterDimA[]);
416
+
417
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
418
+ cudnnGetFilterNdDescriptor(const cudnnFilterDescriptor_t filterDesc,
419
+ int nbDimsRequested,
420
+ cudnnDataType_t *dataType, /* image data type */
421
+ cudnnTensorFormat_t *format,
422
+ int *nbDims,
423
+ int filterDimA[]);
424
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
425
+ cudnnGetFilterSizeInBytes(const cudnnFilterDescriptor_t filterDesc, size_t *size);
426
+
427
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
428
+ cudnnTransformFilter(cudnnHandle_t handle,
429
+ const cudnnTensorTransformDescriptor_t transDesc,
430
+ const void *alpha,
431
+ const cudnnFilterDescriptor_t srcDesc,
432
+ const void *srcData,
433
+ const void *beta,
434
+ const cudnnFilterDescriptor_t destDesc,
435
+ void *destData);
436
+
437
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
438
+ cudnnDestroyFilterDescriptor(cudnnFilterDescriptor_t filterDesc);
439
+
440
+ /*
441
+ * softmax algorithm
442
+ */
443
+ typedef enum {
444
+ CUDNN_SOFTMAX_FAST = 0, /* straightforward implementation */
445
+ CUDNN_SOFTMAX_ACCURATE = 1, /* subtract max from every point to avoid overflow */
446
+ CUDNN_SOFTMAX_LOG = 2
447
+ } cudnnSoftmaxAlgorithm_t;
448
+
449
+ typedef enum {
450
+ CUDNN_SOFTMAX_MODE_INSTANCE = 0, /* compute the softmax over all C, H, W for each N */
451
+ CUDNN_SOFTMAX_MODE_CHANNEL = 1 /* compute the softmax over all C for each H, W, N */
452
+ } cudnnSoftmaxMode_t;
453
+
454
+ /* Softmax functions: All of the form "output = alpha * Op(inputs) + beta * output" */
455
+
456
+ /* Function to perform forward softmax */
457
+ cudnnStatus_t CUDNNWINAPI
458
+ cudnnSoftmaxForward(cudnnHandle_t handle,
459
+ cudnnSoftmaxAlgorithm_t algo,
460
+ cudnnSoftmaxMode_t mode,
461
+ const void *alpha,
462
+ const cudnnTensorDescriptor_t xDesc,
463
+ const void *x,
464
+ const void *beta,
465
+ const cudnnTensorDescriptor_t yDesc,
466
+ void *y);
467
+
468
+ /*
469
+ * pooling mode
470
+ */
471
+ typedef enum {
472
+ CUDNN_POOLING_MAX = 0,
473
+ CUDNN_POOLING_AVERAGE_COUNT_INCLUDE_PADDING = 1, /* count for average includes padded values */
474
+ CUDNN_POOLING_AVERAGE_COUNT_EXCLUDE_PADDING = 2, /* count for average does not include padded values */
475
+ CUDNN_POOLING_MAX_DETERMINISTIC = 3
476
+ } cudnnPoolingMode_t CUDNN_DEPRECATED;
477
+
478
+ /* Create an instance of pooling descriptor */
479
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
480
+ cudnnCreatePoolingDescriptor(cudnnPoolingDescriptor_t *poolingDesc);
481
+
482
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
483
+ cudnnSetPooling2dDescriptor(cudnnPoolingDescriptor_t poolingDesc,
484
+ cudnnPoolingMode_t mode,
485
+ cudnnNanPropagation_t maxpoolingNanOpt,
486
+ int windowHeight,
487
+ int windowWidth,
488
+ int verticalPadding,
489
+ int horizontalPadding,
490
+ int verticalStride,
491
+ int horizontalStride);
492
+
493
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
494
+ cudnnGetPooling2dDescriptor(const cudnnPoolingDescriptor_t poolingDesc,
495
+ cudnnPoolingMode_t *mode,
496
+ cudnnNanPropagation_t *maxpoolingNanOpt,
497
+ int *windowHeight,
498
+ int *windowWidth,
499
+ int *verticalPadding,
500
+ int *horizontalPadding,
501
+ int *verticalStride,
502
+ int *horizontalStride);
503
+
504
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
505
+ cudnnSetPoolingNdDescriptor(cudnnPoolingDescriptor_t poolingDesc,
506
+ const cudnnPoolingMode_t mode,
507
+ const cudnnNanPropagation_t maxpoolingNanOpt,
508
+ int nbDims,
509
+ const int windowDimA[],
510
+ const int paddingA[],
511
+ const int strideA[]);
512
+
513
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
514
+ cudnnGetPoolingNdDescriptor(const cudnnPoolingDescriptor_t poolingDesc,
515
+ int nbDimsRequested,
516
+ cudnnPoolingMode_t *mode,
517
+ cudnnNanPropagation_t *maxpoolingNanOpt,
518
+ int *nbDims,
519
+ int windowDimA[],
520
+ int paddingA[],
521
+ int strideA[]);
522
+
523
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
524
+ cudnnGetPoolingNdForwardOutputDim(const cudnnPoolingDescriptor_t poolingDesc,
525
+ const cudnnTensorDescriptor_t inputTensorDesc,
526
+ int nbDims,
527
+ int outputTensorDimA[]);
528
+
529
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
530
+ cudnnGetPooling2dForwardOutputDim(const cudnnPoolingDescriptor_t poolingDesc,
531
+ const cudnnTensorDescriptor_t inputTensorDesc,
532
+ int *n,
533
+ int *c,
534
+ int *h,
535
+ int *w);
536
+
537
+ /* Destroy an instance of pooling descriptor */
538
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
539
+ cudnnDestroyPoolingDescriptor(cudnnPoolingDescriptor_t poolingDesc);
540
+
541
+ /* Pooling functions: All of the form "output = alpha * Op(inputs) + beta * output" */
542
+
543
+ /* Function to perform forward pooling */
544
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
545
+ cudnnPoolingForward(cudnnHandle_t handle,
546
+ const cudnnPoolingDescriptor_t poolingDesc,
547
+ const void *alpha,
548
+ const cudnnTensorDescriptor_t xDesc,
549
+ const void *x,
550
+ const void *beta,
551
+ const cudnnTensorDescriptor_t yDesc,
552
+ void *y);
553
+
554
+ /* Activation functions: All of the form "output = alpha * Op(inputs) + beta * output" */
555
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
556
+ cudnnCreateActivationDescriptor(cudnnActivationDescriptor_t *activationDesc);
557
+
558
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
559
+ cudnnSetActivationDescriptor(cudnnActivationDescriptor_t activationDesc,
560
+ cudnnActivationMode_t mode,
561
+ cudnnNanPropagation_t reluNanOpt,
562
+ double coef); /* ceiling for clipped RELU, alpha for ELU */
563
+
564
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
565
+ cudnnGetActivationDescriptor(const cudnnActivationDescriptor_t activationDesc,
566
+ cudnnActivationMode_t *mode,
567
+ cudnnNanPropagation_t *reluNanOpt,
568
+ double *coef); /* ceiling for clipped RELU, alpha for ELU */
569
+
570
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
571
+ cudnnSetActivationDescriptorSwishBeta(cudnnActivationDescriptor_t activationDesc, double swish_beta);
572
+
573
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
574
+ cudnnGetActivationDescriptorSwishBeta(cudnnActivationDescriptor_t activationDesc, double *swish_beta);
575
+
576
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
577
+ cudnnDestroyActivationDescriptor(cudnnActivationDescriptor_t activationDesc);
578
+
579
+ /* Function to perform forward activation */
580
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
581
+ cudnnActivationForward(cudnnHandle_t handle,
582
+ cudnnActivationDescriptor_t activationDesc,
583
+ const void *alpha,
584
+ const cudnnTensorDescriptor_t xDesc,
585
+ const void *x,
586
+ const void *beta,
587
+ const cudnnTensorDescriptor_t yDesc,
588
+ void *y);
589
+
590
+ /*
591
+ * Create an instance of LRN (Local Response Normalization) descriptor
592
+ * Uses lrnN=5, lrnAlpha=1e-4, lrnBeta=0.75, lrnK=2.0 as defaults from Krizhevsky'12 ImageNet paper
593
+ */
594
+ cudnnStatus_t CUDNNWINAPI
595
+ cudnnCreateLRNDescriptor(cudnnLRNDescriptor_t *normDesc);
596
+
597
+ #define CUDNN_LRN_MIN_N 1 /* minimum allowed lrnN */
598
+ #define CUDNN_LRN_MAX_N 16 /* maximum allowed lrnN */
599
+ #define CUDNN_LRN_MIN_K 1e-5 /* minimum allowed lrnK */
600
+ #define CUDNN_LRN_MIN_BETA 0.01 /* minimum allowed lrnBeta */
601
+
602
+ /* LRN layer mode */
603
+ typedef enum {
604
+ CUDNN_LRN_CROSS_CHANNEL_DIM1 = 0, /* Normalize across tensor's dimA[1] dimension */
605
+ } cudnnLRNMode_t;
606
+
607
+ /*
608
+ * Uses a window [center-lookBehind, center+lookAhead], where
609
+ * lookBehind = floor( (lrnN-1)/2 ), lookAhead = lrnN-lookBehind-1.
610
+ * Values of double parameters cast to tensor data type.
611
+ */
612
+ cudnnStatus_t CUDNNWINAPI
613
+ cudnnSetLRNDescriptor(cudnnLRNDescriptor_t normDesc, unsigned lrnN, double lrnAlpha, double lrnBeta, double lrnK);
614
+ /*
615
+ * Retrieve the settings currently stored in an LRN layer descriptor
616
+ * Any of the provided pointers can be NULL (no corresponding value will be returned)
617
+ */
618
+ cudnnStatus_t CUDNNWINAPI
619
+ cudnnGetLRNDescriptor(cudnnLRNDescriptor_t normDesc, unsigned *lrnN, double *lrnAlpha, double *lrnBeta, double *lrnK);
620
+
621
+ /* Destroy an instance of LRN descriptor */
622
+ cudnnStatus_t CUDNNWINAPI
623
+ cudnnDestroyLRNDescriptor(cudnnLRNDescriptor_t lrnDesc);
624
+
625
+ /* LRN functions: output = alpha * normalize(x) + beta * old_y */
626
+
627
+ /* LRN cross-channel forward computation. Double parameters cast to tensor data type */
628
+ cudnnStatus_t CUDNNWINAPI
629
+ cudnnLRNCrossChannelForward(cudnnHandle_t handle,
630
+ cudnnLRNDescriptor_t normDesc,
631
+ cudnnLRNMode_t lrnMode,
632
+ const void *alpha,
633
+ const cudnnTensorDescriptor_t xDesc,
634
+ const void *x,
635
+ const void *beta,
636
+ const cudnnTensorDescriptor_t yDesc,
637
+ void *y);
638
+
639
+ typedef enum {
640
+ CUDNN_DIVNORM_PRECOMPUTED_MEANS = 0,
641
+ } cudnnDivNormMode_t;
642
+
643
+ /* LCN/divisive normalization functions: y = alpha * normalize(x) + beta * y */
644
+ cudnnStatus_t CUDNNWINAPI
645
+ cudnnDivisiveNormalizationForward(cudnnHandle_t handle,
646
+ cudnnLRNDescriptor_t normDesc,
647
+ cudnnDivNormMode_t mode,
648
+ const void *alpha,
649
+ const cudnnTensorDescriptor_t xDesc, /* same desc for means, temp, temp2 */
650
+ const void *x,
651
+ const void *means, /* if NULL, means are assumed to be zero */
652
+ void *temp,
653
+ void *temp2,
654
+ const void *beta,
655
+ const cudnnTensorDescriptor_t yDesc,
656
+ void *y);
657
+
658
+ typedef enum {
659
+ /* bnScale, bnBias tensor dims are 1xCxHxWx.. (one value per CHW...-slice, normalized over N slice) */
660
+ CUDNN_BATCHNORM_PER_ACTIVATION = 0,
661
+
662
+ /* bnScale, bnBias tensor dims are 1xCx1x1 (one value per C-dim normalized over Nx1xHxW subtensors) */
663
+ CUDNN_BATCHNORM_SPATIAL = 1,
664
+
665
+ /*
666
+ * bnScale, bnBias tensor dims are 1xCx1x1 (one value per C-dim normalized over Nx1xHxW subtensors).
667
+ * May be faster than CUDNN_BATCHNORM_SPATIAL but imposes some limits on the range of values
668
+ */
669
+ CUDNN_BATCHNORM_SPATIAL_PERSISTENT = 2,
670
+ } cudnnBatchNormMode_t CUDNN_DEPRECATED;
671
+
672
+ #define CUDNN_BN_MIN_EPSILON 0.0 /* Minimum epsilon allowed to be used in the Batch Normalization formula */
673
+
674
+ /*
675
+ * Derives a tensor descriptor from layer data descriptor for BatchNormalization
676
+ * scale, invVariance, bnBias, bnScale tensors. Use this tensor desc for
677
+ * bnScaleBiasMeanVarDesc and bnScaleBiasDiffDesc in Batch Normalization forward and backward functions.
678
+ */
679
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
680
+ cudnnDeriveBNTensorDescriptor(cudnnTensorDescriptor_t derivedBnDesc,
681
+ const cudnnTensorDescriptor_t xDesc,
682
+ cudnnBatchNormMode_t mode);
683
+
684
+ typedef enum {
685
+ CUDNN_BATCHNORM_OPS_BN = 0, /* do batch normalization only */
686
+ CUDNN_BATCHNORM_OPS_BN_ACTIVATION = 1, /* do batchNorm, then activation */
687
+ CUDNN_BATCHNORM_OPS_BN_ADD_ACTIVATION = 2, /* do batchNorm, then elemWiseAdd, then activation */
688
+ } cudnnBatchNormOps_t CUDNN_DEPRECATED;
689
+
690
+ /*
691
+ * Performs Batch Normalization during Inference:
692
+ * y[i] = bnScale[k]*(x[i]-estimatedMean[k])/sqrt(epsilon+estimatedVariance[k]) + bnBias[k]
693
+ * with bnScale, bnBias, runningMean, runningInvVariance tensors indexed
694
+ * according to spatial or per-activation mode. Refer to cudnnBatchNormalizationForwardTraining
695
+ * above for notes on function arguments.
696
+ */
697
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
698
+ cudnnBatchNormalizationForwardInference(cudnnHandle_t handle,
699
+ cudnnBatchNormMode_t mode,
700
+ const void *alpha, /* alpha[0] = result blend factor */
701
+ const void *beta, /* beta[0] = dest layer blend factor */
702
+ const cudnnTensorDescriptor_t xDesc,
703
+ const void *x, /* NxCxHxW */
704
+ const cudnnTensorDescriptor_t yDesc,
705
+ void *y, /* NxCxHxW */
706
+ const cudnnTensorDescriptor_t bnScaleBiasMeanVarDesc,
707
+ const void *bnScale,
708
+ const void *bnBias,
709
+ const void *estimatedMean,
710
+ const void *estimatedVariance,
711
+ double epsilon);
712
+
713
+ typedef enum {
714
+ /* bnScale, bnBias tensor dims are 1xCxHxWx.. (one value per CHW...-slice, normalized over N slice) */
715
+ CUDNN_NORM_PER_ACTIVATION = 0,
716
+
717
+ /* bnScale, bnBias tensor dims are 1xCx1x1 (one value per C-dim normalized over Nx1xHxW subtensors) */
718
+ CUDNN_NORM_PER_CHANNEL = 1,
719
+ } cudnnNormMode_t CUDNN_DEPRECATED;
720
+
721
+ typedef enum { CUDNN_NORM_ALGO_STANDARD = 0, CUDNN_NORM_ALGO_PERSIST = 1 } cudnnNormAlgo_t CUDNN_DEPRECATED;
722
+
723
+ /*
724
+ * Derives a tensor descriptor from layer data descriptor for Normalization
725
+ * scale, invVariance, bnBias, bnScale tensors. Use this tensor desc for
726
+ * normScaleBiasMeanVarDesc and normScaleBiasDiffDesc in Normalization forward and backward functions.
727
+ */
728
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
729
+ cudnnDeriveNormTensorDescriptor(cudnnTensorDescriptor_t derivedNormScaleBiasDesc,
730
+ cudnnTensorDescriptor_t derivedNormMeanVarDesc,
731
+ const cudnnTensorDescriptor_t xDesc,
732
+ cudnnNormMode_t mode,
733
+ int groupCnt); /* Place hold for future work, should be set to 1 now*/
734
+
735
+ typedef enum {
736
+ CUDNN_NORM_OPS_NORM = 0, /* do normalization only */
737
+ CUDNN_NORM_OPS_NORM_ACTIVATION = 1, /* do Norm, then activation */
738
+ CUDNN_NORM_OPS_NORM_ADD_ACTIVATION = 2, /* do Norm, then elemWiseAdd, then activation */
739
+ } cudnnNormOps_t CUDNN_DEPRECATED;
740
+
741
+ /*
742
+ * Performs Normalization during Inference:
743
+ * y[i] = normScale[k]*(x[i]-estimatedMean[k])/sqrt(epsilon+estimatedVariance[k]) + normBias[k]
744
+ * with normScale, normBias, runningMean, runningInvVariance tensors indexed
745
+ * according to per-channel or per-activation mode. Refer to cudnnNormalizationForwardTraining
746
+ * above for notes on function arguments.
747
+ */
748
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
749
+ cudnnNormalizationForwardInference(cudnnHandle_t handle,
750
+ cudnnNormMode_t mode,
751
+ cudnnNormOps_t normOps,
752
+ cudnnNormAlgo_t algo,
753
+ const void *alpha, /* alpha[0] = result blend factor */
754
+ const void *beta, /* beta[0] = dest layer blend factor */
755
+ const cudnnTensorDescriptor_t xDesc,
756
+ const void *x, /* NxCxHxW */
757
+ const cudnnTensorDescriptor_t normScaleBiasDesc,
758
+ const void *normScale,
759
+ const void *normBias,
760
+ const cudnnTensorDescriptor_t normMeanVarDesc,
761
+ const void *estimatedMean,
762
+ const void *estimatedVariance,
763
+ const cudnnTensorDescriptor_t zDesc,
764
+ const void *z,
765
+ cudnnActivationDescriptor_t activationDesc,
766
+ const cudnnTensorDescriptor_t yDesc,
767
+ void *y, /* NxCxHxW */
768
+ double epsilon,
769
+ int groupCnt); /* Place hold for future work*/
770
+
771
+ /* APIs for spatial transformer network*/
772
+ typedef enum {
773
+ CUDNN_SAMPLER_BILINEAR = 0,
774
+ } cudnnSamplerType_t;
775
+
776
+ cudnnStatus_t CUDNNWINAPI
777
+ cudnnCreateSpatialTransformerDescriptor(cudnnSpatialTransformerDescriptor_t *stDesc);
778
+
779
+ cudnnStatus_t CUDNNWINAPI
780
+ cudnnSetSpatialTransformerNdDescriptor(cudnnSpatialTransformerDescriptor_t stDesc,
781
+ cudnnSamplerType_t samplerType,
782
+ cudnnDataType_t dataType,
783
+ const int nbDims,
784
+ const int dimA[]);
785
+
786
+ cudnnStatus_t CUDNNWINAPI
787
+ cudnnDestroySpatialTransformerDescriptor(cudnnSpatialTransformerDescriptor_t stDesc);
788
+
789
+ cudnnStatus_t CUDNNWINAPI
790
+ cudnnSpatialTfGridGeneratorForward(cudnnHandle_t handle,
791
+ const cudnnSpatialTransformerDescriptor_t stDesc,
792
+ const void *theta,
793
+ void *grid);
794
+
795
+ cudnnStatus_t CUDNNWINAPI
796
+ cudnnSpatialTfSamplerForward(cudnnHandle_t handle,
797
+ cudnnSpatialTransformerDescriptor_t stDesc,
798
+ const void *alpha,
799
+ const cudnnTensorDescriptor_t xDesc,
800
+ const void *x,
801
+ const void *grid,
802
+ const void *beta,
803
+ cudnnTensorDescriptor_t yDesc,
804
+ void *y);
805
+
806
+ typedef struct cudnnDropoutStruct *cudnnDropoutDescriptor_t;
807
+
808
+ cudnnStatus_t CUDNNWINAPI
809
+ cudnnCreateDropoutDescriptor(cudnnDropoutDescriptor_t *dropoutDesc);
810
+
811
+ cudnnStatus_t CUDNNWINAPI
812
+ cudnnDestroyDropoutDescriptor(cudnnDropoutDescriptor_t dropoutDesc);
813
+
814
+ /*helper function to determine size of the states to be passed to cudnnSetDropoutDescriptor */
815
+ cudnnStatus_t CUDNNWINAPI
816
+ cudnnDropoutGetStatesSize(cudnnHandle_t handle, size_t *sizeInBytes);
817
+
818
+ /*helper function to determine size of the reserve space to be passed to dropout forward/backward calls */
819
+ cudnnStatus_t CUDNNWINAPI
820
+ cudnnDropoutGetReserveSpaceSize(cudnnTensorDescriptor_t xdesc, size_t *sizeInBytes);
821
+
822
+ cudnnStatus_t CUDNNWINAPI
823
+ cudnnSetDropoutDescriptor(cudnnDropoutDescriptor_t dropoutDesc,
824
+ cudnnHandle_t handle,
825
+ float dropout,
826
+ void *states,
827
+ size_t stateSizeInBytes,
828
+ unsigned long long seed);
829
+
830
+ /* Restores the dropout descriptor to a previously saved-off state */
831
+ cudnnStatus_t CUDNNWINAPI
832
+ cudnnRestoreDropoutDescriptor(cudnnDropoutDescriptor_t dropoutDesc,
833
+ cudnnHandle_t handle,
834
+ float dropout,
835
+ void *states,
836
+ size_t stateSizeInBytes,
837
+ unsigned long long seed);
838
+
839
+ cudnnStatus_t CUDNNWINAPI
840
+ cudnnGetDropoutDescriptor(cudnnDropoutDescriptor_t dropoutDesc,
841
+ cudnnHandle_t handle,
842
+ float *dropout,
843
+ void **states,
844
+ unsigned long long *seed);
845
+
846
+ cudnnStatus_t CUDNNWINAPI
847
+ cudnnDropoutForward(cudnnHandle_t handle,
848
+ const cudnnDropoutDescriptor_t dropoutDesc,
849
+ const cudnnTensorDescriptor_t xdesc,
850
+ const void *x,
851
+ const cudnnTensorDescriptor_t ydesc,
852
+ void *y,
853
+ void *reserveSpace,
854
+ size_t reserveSpaceSizeInBytes);
855
+
856
+ /* TODO: move these enums out to the appropriate submodule */
857
+ typedef enum {
858
+ CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM = 0,
859
+ CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM = 1,
860
+ CUDNN_CONVOLUTION_FWD_ALGO_GEMM = 2,
861
+ CUDNN_CONVOLUTION_FWD_ALGO_DIRECT = 3,
862
+ CUDNN_CONVOLUTION_FWD_ALGO_FFT = 4,
863
+ CUDNN_CONVOLUTION_FWD_ALGO_FFT_TILING = 5,
864
+ CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD = 6,
865
+ CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD_NONFUSED = 7,
866
+ CUDNN_CONVOLUTION_FWD_ALGO_COUNT = 8
867
+ } cudnnConvolutionFwdAlgo_t;
868
+
869
+ typedef enum {
870
+ CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0 = 0, /* non-deterministic */
871
+ CUDNN_CONVOLUTION_BWD_FILTER_ALGO_1 = 1,
872
+ CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT = 2,
873
+ CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3 = 3, /* non-deterministic */
874
+ CUDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD = 4, /* not implemented */
875
+ CUDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD_NONFUSED = 5,
876
+ CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT_TILING = 6,
877
+ CUDNN_CONVOLUTION_BWD_FILTER_ALGO_COUNT = 7
878
+ } cudnnConvolutionBwdFilterAlgo_t;
879
+
880
+ typedef enum {
881
+ CUDNN_CONVOLUTION_BWD_DATA_ALGO_0 = 0, /* non-deterministic */
882
+ CUDNN_CONVOLUTION_BWD_DATA_ALGO_1 = 1,
883
+ CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT = 2,
884
+ CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT_TILING = 3,
885
+ CUDNN_CONVOLUTION_BWD_DATA_ALGO_WINOGRAD = 4,
886
+ CUDNN_CONVOLUTION_BWD_DATA_ALGO_WINOGRAD_NONFUSED = 5,
887
+ CUDNN_CONVOLUTION_BWD_DATA_ALGO_COUNT = 6
888
+ } cudnnConvolutionBwdDataAlgo_t;
889
+
890
+ typedef enum { CUDNN_CTC_LOSS_ALGO_DETERMINISTIC = 0, CUDNN_CTC_LOSS_ALGO_NON_DETERMINISTIC = 1 } cudnnCTCLossAlgo_t;
891
+
892
+ /*
893
+ * \brief Cross-library version checker.
894
+ * This function is implemented differently in each sub-library. Each sublib
895
+ * checks whether its own version matches that of its dependencies.
896
+ * \returns CUDNN_STATUS_SUCCESS if the version check passes,
897
+ * CUDNN_STATUS_SUBLIBRARY_VERSION_MISMATCH if the versions are inconsistent.
898
+ */
899
+ cudnnStatus_t CUDNNWINAPI
900
+ cudnnOpsVersionCheck(void);
901
+
902
+ /* Function to perform backward softmax */
903
+ cudnnStatus_t CUDNNWINAPI
904
+ cudnnSoftmaxBackward(cudnnHandle_t handle,
905
+ cudnnSoftmaxAlgorithm_t algo,
906
+ cudnnSoftmaxMode_t mode,
907
+ const void *alpha,
908
+ const cudnnTensorDescriptor_t yDesc,
909
+ const void *y,
910
+ const cudnnTensorDescriptor_t dyDesc,
911
+ const void *dy,
912
+ const void *beta,
913
+ const cudnnTensorDescriptor_t dxDesc,
914
+ void *dx);
915
+
916
+ /* Function to perform backward pooling */
917
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
918
+ cudnnPoolingBackward(cudnnHandle_t handle,
919
+ const cudnnPoolingDescriptor_t poolingDesc,
920
+ const void *alpha,
921
+ const cudnnTensorDescriptor_t yDesc,
922
+ const void *y,
923
+ const cudnnTensorDescriptor_t dyDesc,
924
+ const void *dy,
925
+ const cudnnTensorDescriptor_t xDesc,
926
+ const void *x,
927
+ const void *beta,
928
+ const cudnnTensorDescriptor_t dxDesc,
929
+ void *dx);
930
+
931
+ /* Function to perform backward activation */
932
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
933
+ cudnnActivationBackward(cudnnHandle_t handle,
934
+ cudnnActivationDescriptor_t activationDesc,
935
+ const void *alpha,
936
+ const cudnnTensorDescriptor_t yDesc,
937
+ const void *y,
938
+ const cudnnTensorDescriptor_t dyDesc,
939
+ const void *dy,
940
+ const cudnnTensorDescriptor_t xDesc,
941
+ const void *x,
942
+ const void *beta,
943
+ const cudnnTensorDescriptor_t dxDesc,
944
+ void *dx);
945
+
946
+ /* LRN cross-channel backward computation. Double parameters cast to tensor data type */
947
+ cudnnStatus_t CUDNNWINAPI
948
+ cudnnLRNCrossChannelBackward(cudnnHandle_t handle,
949
+ cudnnLRNDescriptor_t normDesc,
950
+ cudnnLRNMode_t lrnMode,
951
+ const void *alpha,
952
+ const cudnnTensorDescriptor_t yDesc,
953
+ const void *y,
954
+ const cudnnTensorDescriptor_t dyDesc,
955
+ const void *dy,
956
+ const cudnnTensorDescriptor_t xDesc,
957
+ const void *x,
958
+ const void *beta,
959
+ const cudnnTensorDescriptor_t dxDesc,
960
+ void *dx);
961
+
962
+ cudnnStatus_t CUDNNWINAPI
963
+ cudnnDivisiveNormalizationBackward(cudnnHandle_t handle,
964
+ cudnnLRNDescriptor_t normDesc,
965
+ cudnnDivNormMode_t mode,
966
+ const void *alpha,
967
+ const cudnnTensorDescriptor_t xDesc, /* same desc for x, means, dy, temp, temp2 */
968
+ const void *x,
969
+ const void *means, /* if NULL, means are assumed to be zero */
970
+ const void *dy,
971
+ void *temp,
972
+ void *temp2,
973
+ const void *beta,
974
+ const cudnnTensorDescriptor_t dXdMeansDesc, /* same desc for dx, dMeans */
975
+ void *dx, /* output x differential */
976
+ void *dMeans); /* output means differential, can be NULL */
977
+
978
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
979
+ cudnnGetBatchNormalizationForwardTrainingExWorkspaceSize(cudnnHandle_t handle,
980
+ cudnnBatchNormMode_t mode,
981
+ cudnnBatchNormOps_t bnOps,
982
+ const cudnnTensorDescriptor_t xDesc,
983
+ const cudnnTensorDescriptor_t zDesc,
984
+ const cudnnTensorDescriptor_t yDesc,
985
+ const cudnnTensorDescriptor_t bnScaleBiasMeanVarDesc,
986
+ const cudnnActivationDescriptor_t activationDesc,
987
+ size_t *sizeInBytes);
988
+
989
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
990
+ cudnnGetBatchNormalizationBackwardExWorkspaceSize(cudnnHandle_t handle,
991
+ cudnnBatchNormMode_t mode,
992
+ cudnnBatchNormOps_t bnOps,
993
+ const cudnnTensorDescriptor_t xDesc,
994
+ const cudnnTensorDescriptor_t yDesc,
995
+ const cudnnTensorDescriptor_t dyDesc,
996
+ const cudnnTensorDescriptor_t dzDesc,
997
+ const cudnnTensorDescriptor_t dxDesc,
998
+ const cudnnTensorDescriptor_t dBnScaleBiasDesc,
999
+ const cudnnActivationDescriptor_t activationDesc,
1000
+ size_t *sizeInBytes);
1001
+
1002
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
1003
+ cudnnGetBatchNormalizationTrainingExReserveSpaceSize(cudnnHandle_t handle,
1004
+ cudnnBatchNormMode_t mode,
1005
+ cudnnBatchNormOps_t bnOps,
1006
+ const cudnnActivationDescriptor_t activationDesc,
1007
+ const cudnnTensorDescriptor_t xDesc,
1008
+ size_t *sizeInBytes);
1009
+
1010
+ /* Computes y = BN(x). Also accumulates moving averages of mean and inverse variances */
1011
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
1012
+ cudnnBatchNormalizationForwardTraining(
1013
+ cudnnHandle_t handle,
1014
+ cudnnBatchNormMode_t mode,
1015
+
1016
+ const void *alpha, /* alpha[0] = result blend factor */
1017
+ const void *beta, /* beta[0] = dest layer blend factor */
1018
+
1019
+ const cudnnTensorDescriptor_t xDesc,
1020
+ const void *x, /* NxCxHxW */
1021
+ const cudnnTensorDescriptor_t yDesc,
1022
+ void *y, /* NxCxHxW */
1023
+
1024
+ /* Shared desc for the next 6 tensors in the argument list.
1025
+ Data type to be set as follows:
1026
+ type = (typeOf(x) == double) ? double : float
1027
+ Dimensions for this descriptor depend on normalization mode
1028
+ - Spatial Normalization : tensors are expected to have dims 1xCx1x1
1029
+ (normalization is performed across NxHxW)
1030
+ - Per-Activation Normalization : tensors are expected to have dims of 1xCxHxW
1031
+ (normalization is performed across N) */
1032
+ const cudnnTensorDescriptor_t bnScaleBiasMeanVarDesc,
1033
+
1034
+ /* 'Gamma' and 'Beta' respectively in Ioffe and Szegedy's paper's notation */
1035
+ const void *bnScale,
1036
+ const void *bnBias,
1037
+
1038
+ /* MUST use factor=1 in the very first call of a complete training cycle.
1039
+ Use a factor=1/(1+n) at N-th call to the function to get
1040
+ Cumulative Moving Average (CMA) behavior
1041
+ CMA[n] = (x[1]+...+x[n])/n
1042
+ Since CMA[n+1] = (n*CMA[n]+x[n+1])/(n+1) =
1043
+ ((n+1)*CMA[n]-CMA[n])/(n+1) + x[n+1]/(n+1) =
1044
+ CMA[n]*(1-1/(n+1)) + x[n+1]*1/(n+1) */
1045
+ double exponentialAverageFactor,
1046
+
1047
+ /* Used in Training phase only.
1048
+ runningMean = newMean*factor + runningMean*(1-factor) */
1049
+ void *resultRunningMean,
1050
+ /* Output in training mode, input in inference. Is the moving average
1051
+ of variance[x] (factor is applied in the same way as for runningMean) */
1052
+ void *resultRunningVariance,
1053
+
1054
+ /* Has to be >= CUDNN_BN_MIN_EPSILON. Should be the same in forward and backward functions. */
1055
+ double epsilon,
1056
+
1057
+ /* Optionally save intermediate results from the forward pass here
1058
+ - can be reused to speed up backward pass. NULL if unused */
1059
+ void *resultSaveMean,
1060
+ void *resultSaveInvVariance);
1061
+
1062
+ /* Computes y = relu(BN(x) + z). Also accumulates moving averages of mean and inverse variances */
1063
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
1064
+ cudnnBatchNormalizationForwardTrainingEx(
1065
+ cudnnHandle_t handle,
1066
+ cudnnBatchNormMode_t mode,
1067
+ cudnnBatchNormOps_t bnOps,
1068
+
1069
+ const void *alpha, /* alpha[0] = result blend factor */
1070
+ const void *beta, /* beta[0] = dest layer blend factor */
1071
+
1072
+ const cudnnTensorDescriptor_t xDesc,
1073
+ const void *xData,
1074
+ const cudnnTensorDescriptor_t zDesc,
1075
+ const void *zData,
1076
+ const cudnnTensorDescriptor_t yDesc,
1077
+ void *yData,
1078
+
1079
+ const cudnnTensorDescriptor_t bnScaleBiasMeanVarDesc,
1080
+ const void *bnScale,
1081
+ const void *bnBias,
1082
+
1083
+ double exponentialAverageFactor,
1084
+ void *resultRunningMean,
1085
+ void *resultRunningVariance,
1086
+
1087
+ /* Has to be >= CUDNN_BN_MIN_EPSILON. Should be the same in forward and backward functions. */
1088
+ double epsilon,
1089
+
1090
+ /* Optionally save intermediate results from the forward pass here
1091
+ - can be reused to speed up backward pass. NULL if unused */
1092
+ void *resultSaveMean,
1093
+ void *resultSaveInvVariance,
1094
+
1095
+ cudnnActivationDescriptor_t activationDesc,
1096
+ void *workspace,
1097
+ size_t workSpaceSizeInBytes,
1098
+ void *reserveSpace,
1099
+ size_t reserveSpaceSizeInBytes);
1100
+
1101
+ /* Performs backward pass of Batch Normalization layer. Returns x gradient,
1102
+ * bnScale gradient and bnBias gradient */
1103
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
1104
+ cudnnBatchNormalizationBackward(cudnnHandle_t handle,
1105
+ cudnnBatchNormMode_t mode,
1106
+ const void *alphaDataDiff,
1107
+ const void *betaDataDiff,
1108
+ const void *alphaParamDiff,
1109
+ const void *betaParamDiff,
1110
+ const cudnnTensorDescriptor_t xDesc, /* same desc for x, dx, dy */
1111
+ const void *x,
1112
+ const cudnnTensorDescriptor_t dyDesc,
1113
+ const void *dy,
1114
+ const cudnnTensorDescriptor_t dxDesc,
1115
+ void *dx,
1116
+ /* Shared tensor desc for the 4 tensors below */
1117
+ const cudnnTensorDescriptor_t dBnScaleBiasDesc,
1118
+ const void *bnScale, /* bnBias doesn't affect backpropagation */
1119
+ /* scale and bias diff are not backpropagated below this layer */
1120
+ void *dBnScaleResult,
1121
+ void *dBnBiasResult,
1122
+ /* Same epsilon as forward pass */
1123
+ double epsilon,
1124
+
1125
+ /* Optionally cached intermediate results from
1126
+ forward pass */
1127
+ const void *savedMean,
1128
+ const void *savedInvVariance);
1129
+
1130
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
1131
+ cudnnBatchNormalizationBackwardEx(cudnnHandle_t handle,
1132
+ cudnnBatchNormMode_t mode,
1133
+ cudnnBatchNormOps_t bnOps,
1134
+
1135
+ const void *alphaDataDiff,
1136
+ const void *betaDataDiff,
1137
+ const void *alphaParamDiff,
1138
+ const void *betaParamDiff,
1139
+ const cudnnTensorDescriptor_t xDesc,
1140
+ const void *xData,
1141
+ const cudnnTensorDescriptor_t yDesc,
1142
+ const void *yData,
1143
+ const cudnnTensorDescriptor_t dyDesc,
1144
+ const void *dyData,
1145
+ const cudnnTensorDescriptor_t dzDesc,
1146
+ void *dzData,
1147
+ const cudnnTensorDescriptor_t dxDesc,
1148
+ void *dxData,
1149
+
1150
+ /* Shared tensor desc for the 4 tensors below */
1151
+ const cudnnTensorDescriptor_t dBnScaleBiasDesc,
1152
+ const void *bnScaleData,
1153
+ const void *bnBiasData, /* needed if there is activation */
1154
+ void *dBnScaleData,
1155
+ void *dBnBiasData,
1156
+ double epsilon, /* Same epsilon as forward pass */
1157
+
1158
+ /* Optionally cached intermediate results from
1159
+ forward pass */
1160
+ const void *savedMean,
1161
+ const void *savedInvVariance,
1162
+ cudnnActivationDescriptor_t activationDesc,
1163
+ void *workSpace,
1164
+ size_t workSpaceSizeInBytes,
1165
+ void *reserveSpace,
1166
+ size_t reserveSpaceSizeInBytes);
1167
+
1168
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
1169
+ cudnnGetNormalizationForwardTrainingWorkspaceSize(cudnnHandle_t handle,
1170
+ cudnnNormMode_t mode,
1171
+ cudnnNormOps_t normOps,
1172
+ cudnnNormAlgo_t algo,
1173
+ const cudnnTensorDescriptor_t xDesc,
1174
+ const cudnnTensorDescriptor_t zDesc,
1175
+ const cudnnTensorDescriptor_t yDesc,
1176
+ const cudnnTensorDescriptor_t normScaleBiasDesc,
1177
+ const cudnnActivationDescriptor_t activationDesc,
1178
+ const cudnnTensorDescriptor_t normMeanVarDesc,
1179
+ size_t *sizeInBytes,
1180
+ int groupCnt); /* Place hold for future work, should be set to 1 now*/
1181
+
1182
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
1183
+ cudnnGetNormalizationBackwardWorkspaceSize(cudnnHandle_t handle,
1184
+ cudnnNormMode_t mode,
1185
+ cudnnNormOps_t normOps,
1186
+ cudnnNormAlgo_t algo,
1187
+ const cudnnTensorDescriptor_t xDesc,
1188
+ const cudnnTensorDescriptor_t yDesc,
1189
+ const cudnnTensorDescriptor_t dyDesc,
1190
+ const cudnnTensorDescriptor_t dzDesc,
1191
+ const cudnnTensorDescriptor_t dxDesc,
1192
+ const cudnnTensorDescriptor_t dNormScaleBiasDesc,
1193
+ const cudnnActivationDescriptor_t activationDesc,
1194
+ const cudnnTensorDescriptor_t normMeanVarDesc,
1195
+ size_t *sizeInBytes,
1196
+ int groupCnt); /* Place hold for future work, should be set to 1 now*/
1197
+
1198
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
1199
+ cudnnGetNormalizationTrainingReserveSpaceSize(cudnnHandle_t handle,
1200
+ cudnnNormMode_t mode,
1201
+ cudnnNormOps_t normOps,
1202
+ cudnnNormAlgo_t algo,
1203
+ const cudnnActivationDescriptor_t activationDesc,
1204
+ const cudnnTensorDescriptor_t xDesc,
1205
+ size_t *sizeInBytes,
1206
+ int groupCnt); /* Place hold for future work, should be set to 1 now*/
1207
+
1208
+ /* Computes y = relu(Norm(x) + z). Also accumulates moving averages of mean and inverse variances */
1209
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
1210
+ cudnnNormalizationForwardTraining(cudnnHandle_t handle,
1211
+ cudnnNormMode_t mode,
1212
+ cudnnNormOps_t normOps,
1213
+ cudnnNormAlgo_t algo,
1214
+ const void *alpha, /* alpha[0] = result blend factor */
1215
+ const void *beta, /* beta[0] = dest layer blend factor */
1216
+ const cudnnTensorDescriptor_t xDesc,
1217
+ const void *xData,
1218
+ const cudnnTensorDescriptor_t normScaleBiasDesc,
1219
+ const void *normScale,
1220
+ const void *normBias,
1221
+ double exponentialAverageFactor,
1222
+ const cudnnTensorDescriptor_t normMeanVarDesc,
1223
+ void *resultRunningMean,
1224
+ void *resultRunningVariance,
1225
+ /* Has to be >= 0. Should be the same in forward and backward functions. */
1226
+ double epsilon,
1227
+ /* Optionally save intermediate results from the forward pass here
1228
+ - can be reused to speed up backward pass. NULL if unused */
1229
+ void *resultSaveMean,
1230
+ void *resultSaveInvVariance,
1231
+ cudnnActivationDescriptor_t activationDesc,
1232
+ const cudnnTensorDescriptor_t zDesc,
1233
+ const void *zData,
1234
+ const cudnnTensorDescriptor_t yDesc,
1235
+ void *yData,
1236
+ void *workspace,
1237
+ size_t workSpaceSizeInBytes,
1238
+ void *reserveSpace,
1239
+ size_t reserveSpaceSizeInBytes,
1240
+ int groupCnt); /* Place hold for future work, should be set to 1 now*/
1241
+
1242
+ CUDNN_DEPRECATED cudnnStatus_t CUDNNWINAPI
1243
+ cudnnNormalizationBackward(cudnnHandle_t handle,
1244
+ cudnnNormMode_t mode,
1245
+ cudnnNormOps_t normOps,
1246
+ cudnnNormAlgo_t algo,
1247
+ const void *alphaDataDiff,
1248
+ const void *betaDataDiff,
1249
+ const void *alphaParamDiff,
1250
+ const void *betaParamDiff,
1251
+ const cudnnTensorDescriptor_t xDesc,
1252
+ const void *xData,
1253
+ const cudnnTensorDescriptor_t yDesc,
1254
+ const void *yData,
1255
+ const cudnnTensorDescriptor_t dyDesc,
1256
+ const void *dyData,
1257
+ const cudnnTensorDescriptor_t dzDesc,
1258
+ void *dzData,
1259
+ const cudnnTensorDescriptor_t dxDesc,
1260
+ void *dxData,
1261
+ /* Shared tensor desc for the 4 tensors below */
1262
+ const cudnnTensorDescriptor_t dNormScaleBiasDesc,
1263
+ const void *normScaleData,
1264
+ const void *normBiasData, /* needed if there is activation */
1265
+ void *dNormScaleData,
1266
+ void *dNormBiasData,
1267
+ double epsilon, /* Same epsilon as forward pass */
1268
+ const cudnnTensorDescriptor_t normMeanVarDesc,
1269
+ /* Optionally cached intermediate results from
1270
+ forward pass */
1271
+ const void *savedMean,
1272
+ const void *savedInvVariance,
1273
+ cudnnActivationDescriptor_t activationDesc,
1274
+ void *workSpace,
1275
+ size_t workSpaceSizeInBytes,
1276
+ void *reserveSpace,
1277
+ size_t reserveSpaceSizeInBytes,
1278
+ int groupCnt); /* Place hold for future work, should be set to 1 now*/
1279
+
1280
+ cudnnStatus_t CUDNNWINAPI
1281
+ cudnnSpatialTfGridGeneratorBackward(cudnnHandle_t handle,
1282
+ const cudnnSpatialTransformerDescriptor_t stDesc,
1283
+ const void *dgrid,
1284
+ void *dtheta);
1285
+
1286
+ cudnnStatus_t CUDNNWINAPI
1287
+ cudnnSpatialTfSamplerBackward(cudnnHandle_t handle,
1288
+ cudnnSpatialTransformerDescriptor_t stDesc,
1289
+ const void *alpha,
1290
+ const cudnnTensorDescriptor_t xDesc,
1291
+ const void *x,
1292
+ const void *beta,
1293
+ const cudnnTensorDescriptor_t dxDesc,
1294
+ void *dx,
1295
+ const void *alphaDgrid,
1296
+ const cudnnTensorDescriptor_t dyDesc,
1297
+ const void *dy,
1298
+ const void *grid,
1299
+ const void *betaDgrid,
1300
+ void *dgrid);
1301
+
1302
+ cudnnStatus_t CUDNNWINAPI
1303
+ cudnnDropoutBackward(cudnnHandle_t handle,
1304
+ const cudnnDropoutDescriptor_t dropoutDesc,
1305
+ const cudnnTensorDescriptor_t dydesc,
1306
+ const void *dy,
1307
+ const cudnnTensorDescriptor_t dxdesc,
1308
+ void *dx,
1309
+ void *reserveSpace,
1310
+ size_t reserveSpaceSizeInBytes);
1311
+
1312
+ #if defined(__cplusplus)
1313
+ }
1314
+ #endif
1315
+
1316
+ #endif /* CUDNN_OPS_H_ */
lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_v9.h ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright 2014-2023 NVIDIA Corporation. All rights reserved.
3
+ *
4
+ * NOTICE TO LICENSEE:
5
+ *
6
+ * This source code and/or documentation ("Licensed Deliverables") are
7
+ * subject to NVIDIA intellectual property rights under U.S. and
8
+ * international Copyright laws.
9
+ *
10
+ * These Licensed Deliverables contained herein is PROPRIETARY and
11
+ * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12
+ * conditions of a form of NVIDIA software license agreement by and
13
+ * between NVIDIA and Licensee ("License Agreement") or electronically
14
+ * accepted by Licensee. Notwithstanding any terms or conditions to
15
+ * the contrary in the License Agreement, reproduction or disclosure
16
+ * of the Licensed Deliverables to any third party without the express
17
+ * written consent of NVIDIA is prohibited.
18
+ *
19
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20
+ * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21
+ * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
22
+ * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23
+ * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24
+ * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25
+ * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27
+ * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28
+ * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32
+ * OF THESE LICENSED DELIVERABLES.
33
+ *
34
+ * U.S. Government End Users. These Licensed Deliverables are a
35
+ * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36
+ * 1995), consisting of "commercial computer software" and "commercial
37
+ * computer software documentation" as such terms are used in 48
38
+ * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39
+ * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40
+ * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41
+ * U.S. Government End Users acquire the Licensed Deliverables with
42
+ * only those rights set forth herein.
43
+ *
44
+ * Any use of the Licensed Deliverables in individual and commercial
45
+ * software must include, in the user documentation and internal
46
+ * comments to the code, the above Disclaimer and U.S. Government End
47
+ * Users Notice.
48
+ */
49
+
50
+ /* cudnn : Neural Networks Library */
51
+
52
+ #if !defined(CUDNN_H_)
53
+ #define CUDNN_H_
54
+ #if defined(__cplusplus)
55
+ extern "C" {
56
+ #endif
57
+
58
+ #include <cuda_runtime_api.h>
59
+ #include "cudnn_version.h"
60
+ #include "cudnn_graph.h"
61
+ #include "cudnn_ops.h"
62
+ #include "cudnn_adv.h"
63
+ #include "cudnn_cnn.h"
64
+
65
+ #if defined(__cplusplus)
66
+ }
67
+ #endif
68
+ #endif /* CUDNN_H_ */
lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_version.h ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright 2014-2023 NVIDIA Corporation. All rights reserved.
3
+ *
4
+ * NOTICE TO LICENSEE:
5
+ *
6
+ * This source code and/or documentation ("Licensed Deliverables") are
7
+ * subject to NVIDIA intellectual property rights under U.S. and
8
+ * international Copyright laws.
9
+ *
10
+ * These Licensed Deliverables contained herein is PROPRIETARY and
11
+ * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12
+ * conditions of a form of NVIDIA software license agreement by and
13
+ * between NVIDIA and Licensee ("License Agreement") or electronically
14
+ * accepted by Licensee. Notwithstanding any terms or conditions to
15
+ * the contrary in the License Agreement, reproduction or disclosure
16
+ * of the Licensed Deliverables to any third party without the express
17
+ * written consent of NVIDIA is prohibited.
18
+ *
19
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20
+ * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21
+ * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
22
+ * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23
+ * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24
+ * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25
+ * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27
+ * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28
+ * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32
+ * OF THESE LICENSED DELIVERABLES.
33
+ *
34
+ * U.S. Government End Users. These Licensed Deliverables are a
35
+ * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36
+ * 1995), consisting of "commercial computer software" and "commercial
37
+ * computer software documentation" as such terms are used in 48
38
+ * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39
+ * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40
+ * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41
+ * U.S. Government End Users acquire the Licensed Deliverables with
42
+ * only those rights set forth herein.
43
+ *
44
+ * Any use of the Licensed Deliverables in individual and commercial
45
+ * software must include, in the user documentation and internal
46
+ * comments to the code, the above Disclaimer and U.S. Government End
47
+ * Users Notice.
48
+ */
49
+
50
+ /**
51
+ * \file: The master cuDNN version file.
52
+ */
53
+
54
+ #ifndef CUDNN_VERSION_H_
55
+ #define CUDNN_VERSION_H_
56
+
57
+ #define CUDNN_MAJOR 9
58
+ #define CUDNN_MINOR 1
59
+ #define CUDNN_PATCHLEVEL 0
60
+
61
+ #define CUDNN_VERSION (CUDNN_MAJOR * 10000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)
62
+
63
+ /* cannot use constexpr here since this is a C-only file */
64
+ /* Below is the max SM version this cuDNN library is aware of and supports natively */
65
+
66
+ #define CUDNN_MAX_SM_MAJOR_NUMBER 9
67
+ #define CUDNN_MAX_SM_MINOR_NUMBER 0
68
+ #define CUDNN_MAX_DEVICE_VERSION (CUDNN_MAX_SM_MAJOR_NUMBER * 100 + CUDNN_MAX_SM_MINOR_NUMBER * 10)
69
+
70
+ #endif /* CUDNN_VERSION_H */
lib/python3.12/site-packages/nvidia/cudnn/include/cudnn_version_v9.h ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright 2014-2023 NVIDIA Corporation. All rights reserved.
3
+ *
4
+ * NOTICE TO LICENSEE:
5
+ *
6
+ * This source code and/or documentation ("Licensed Deliverables") are
7
+ * subject to NVIDIA intellectual property rights under U.S. and
8
+ * international Copyright laws.
9
+ *
10
+ * These Licensed Deliverables contained herein is PROPRIETARY and
11
+ * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12
+ * conditions of a form of NVIDIA software license agreement by and
13
+ * between NVIDIA and Licensee ("License Agreement") or electronically
14
+ * accepted by Licensee. Notwithstanding any terms or conditions to
15
+ * the contrary in the License Agreement, reproduction or disclosure
16
+ * of the Licensed Deliverables to any third party without the express
17
+ * written consent of NVIDIA is prohibited.
18
+ *
19
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20
+ * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21
+ * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
22
+ * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23
+ * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24
+ * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25
+ * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27
+ * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28
+ * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32
+ * OF THESE LICENSED DELIVERABLES.
33
+ *
34
+ * U.S. Government End Users. These Licensed Deliverables are a
35
+ * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36
+ * 1995), consisting of "commercial computer software" and "commercial
37
+ * computer software documentation" as such terms are used in 48
38
+ * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39
+ * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40
+ * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41
+ * U.S. Government End Users acquire the Licensed Deliverables with
42
+ * only those rights set forth herein.
43
+ *
44
+ * Any use of the Licensed Deliverables in individual and commercial
45
+ * software must include, in the user documentation and internal
46
+ * comments to the code, the above Disclaimer and U.S. Government End
47
+ * Users Notice.
48
+ */
49
+
50
+ /**
51
+ * \file: The master cuDNN version file.
52
+ */
53
+
54
+ #ifndef CUDNN_VERSION_H_
55
+ #define CUDNN_VERSION_H_
56
+
57
+ #define CUDNN_MAJOR 9
58
+ #define CUDNN_MINOR 1
59
+ #define CUDNN_PATCHLEVEL 0
60
+
61
+ #define CUDNN_VERSION (CUDNN_MAJOR * 10000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)
62
+
63
+ /* cannot use constexpr here since this is a C-only file */
64
+ /* Below is the max SM version this cuDNN library is aware of and supports natively */
65
+
66
+ #define CUDNN_MAX_SM_MAJOR_NUMBER 9
67
+ #define CUDNN_MAX_SM_MINOR_NUMBER 0
68
+ #define CUDNN_MAX_DEVICE_VERSION (CUDNN_MAX_SM_MAJOR_NUMBER * 100 + CUDNN_MAX_SM_MINOR_NUMBER * 10)
69
+
70
+ #endif /* CUDNN_VERSION_H */
lib/python3.12/site-packages/nvidia/cudnn/lib/__init__.py ADDED
File without changes
lib/python3.12/site-packages/nvidia/cudnn/lib/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (195 Bytes). View file
 
lib/python3.12/site-packages/nvidia/cufft/__init__.py ADDED
File without changes
lib/python3.12/site-packages/nvidia/cufft/include/__init__.py ADDED
File without changes
lib/python3.12/site-packages/nvidia/cufft/include/cudalibxt.h ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2013,2014 NVIDIA Corporation. All rights reserved.
2
+ *
3
+ * NOTICE TO LICENSEE:
4
+ *
5
+ * The source code and/or documentation ("Licensed Deliverables") are
6
+ * subject to NVIDIA intellectual property rights under U.S. and
7
+ * international Copyright laws.
8
+ *
9
+ * The Licensed Deliverables contained herein are PROPRIETARY and
10
+ * CONFIDENTIAL to NVIDIA and are being provided under the terms and
11
+ * conditions of a form of NVIDIA software license agreement by and
12
+ * between NVIDIA and Licensee ("License Agreement") or electronically
13
+ * accepted by Licensee. Notwithstanding any terms or conditions to
14
+ * the contrary in the License Agreement, reproduction or disclosure
15
+ * of the Licensed Deliverables to any third party without the express
16
+ * written consent of NVIDIA is prohibited.
17
+ *
18
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
19
+ * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
20
+ * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE
21
+ * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
22
+ * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
23
+ * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
24
+ * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
25
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
26
+ * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
27
+ * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
28
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
29
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
30
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
31
+ * OF THESE LICENSED DELIVERABLES.
32
+ *
33
+ * U.S. Government End Users. These Licensed Deliverables are a
34
+ * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
35
+ * 1995), consisting of "commercial computer software" and "commercial
36
+ * computer software documentation" as such terms are used in 48
37
+ * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government
38
+ * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
39
+ * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
40
+ * U.S. Government End Users acquire the Licensed Deliverables with
41
+ * only those rights set forth herein.
42
+ *
43
+ * Any use of the Licensed Deliverables in individual and commercial
44
+ * software must include, in the user documentation and internal
45
+ * comments to the code, the above Disclaimer and U.S. Government End
46
+ * Users Notice.
47
+ */
48
+
49
+ /*!
50
+ * \file cudalibxt.h
51
+ * \brief Public header file for the NVIDIA library multi-GPU support structures
52
+ */
53
+
54
+ #ifndef _CUDA_LIB_XT_H_
55
+ #define _CUDA_LIB_XT_H_
56
+ #include <cuda_runtime.h>
57
+
58
+ #define CUDA_XT_DESCRIPTOR_VERSION 0x01000000 // This is added to CUDART_VERSION
59
+
60
+ enum cudaXtCopyType_t {
61
+ LIB_XT_COPY_HOST_TO_DEVICE,
62
+ LIB_XT_COPY_DEVICE_TO_HOST,
63
+ LIB_XT_COPY_DEVICE_TO_DEVICE
64
+ } ;
65
+ typedef enum cudaXtCopyType_t cudaLibXtCopyType;
66
+
67
+ enum libFormat_t {
68
+ LIB_FORMAT_CUFFT = 0x0,
69
+ LIB_FORMAT_UNDEFINED = 0x1
70
+ };
71
+
72
+ typedef enum libFormat_t libFormat;
73
+
74
+ #define MAX_CUDA_DESCRIPTOR_GPUS 64
75
+
76
+ struct cudaXtDesc_t{
77
+ int version; //descriptor version
78
+ int nGPUs; //number of GPUs
79
+ int GPUs[MAX_CUDA_DESCRIPTOR_GPUS]; //array of device IDs
80
+ void *data[MAX_CUDA_DESCRIPTOR_GPUS]; //array of pointers to data, one per GPU
81
+ size_t size[MAX_CUDA_DESCRIPTOR_GPUS]; //array of data sizes, one per GPU
82
+ void *cudaXtState; //opaque CUDA utility structure
83
+ };
84
+ typedef struct cudaXtDesc_t cudaXtDesc;
85
+
86
+ struct cudaLibXtDesc_t{
87
+ int version; //descriptor version
88
+ cudaXtDesc *descriptor; //multi-GPU memory descriptor
89
+ libFormat library; //which library recognizes the format
90
+ int subFormat; //library specific enumerator of sub formats
91
+ void *libDescriptor; //library specific descriptor e.g. FFT transform plan object
92
+ };
93
+ typedef struct cudaLibXtDesc_t cudaLibXtDesc;
94
+
95
+
96
+ #endif
97
+
lib/python3.12/site-packages/nvidia/cufft/include/cufft.h ADDED
@@ -0,0 +1,334 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Copyright 2005-2021 NVIDIA Corporation. All rights reserved.
2
+ *
3
+ * NOTICE TO LICENSEE:
4
+ *
5
+ * The source code and/or documentation ("Licensed Deliverables") are
6
+ * subject to NVIDIA intellectual property rights under U.S. and
7
+ * international Copyright laws.
8
+ *
9
+ * The Licensed Deliverables contained herein are PROPRIETARY and
10
+ * CONFIDENTIAL to NVIDIA and are being provided under the terms and
11
+ * conditions of a form of NVIDIA software license agreement by and
12
+ * between NVIDIA and Licensee ("License Agreement") or electronically
13
+ * accepted by Licensee. Notwithstanding any terms or conditions to
14
+ * the contrary in the License Agreement, reproduction or disclosure
15
+ * of the Licensed Deliverables to any third party without the express
16
+ * written consent of NVIDIA is prohibited.
17
+ *
18
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
19
+ * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
20
+ * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE
21
+ * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
22
+ * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
23
+ * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
24
+ * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
25
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
26
+ * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
27
+ * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
28
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
29
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
30
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
31
+ * OF THESE LICENSED DELIVERABLES.
32
+ *
33
+ * U.S. Government End Users. These Licensed Deliverables are a
34
+ * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
35
+ * 1995), consisting of "commercial computer software" and "commercial
36
+ * computer software documentation" as such terms are used in 48
37
+ * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government
38
+ * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
39
+ * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
40
+ * U.S. Government End Users acquire the Licensed Deliverables with
41
+ * only those rights set forth herein.
42
+ *
43
+ * Any use of the Licensed Deliverables in individual and commercial
44
+ * software must include, in the user documentation and internal
45
+ * comments to the code, the above Disclaimer and U.S. Government End
46
+ * Users Notice.
47
+ */
48
+
49
+ /*!
50
+ * \file cufft.h
51
+ * \brief Public header file for the NVIDIA CUDA FFT library (CUFFT)
52
+ */
53
+
54
+ #ifndef _CUFFT_H_
55
+ #define _CUFFT_H_
56
+
57
+
58
+ #include "cuComplex.h"
59
+ #include "driver_types.h"
60
+ #include "library_types.h"
61
+
62
+ #ifndef CUFFTAPI
63
+ #ifdef _WIN32
64
+ #define CUFFTAPI __stdcall
65
+ #elif __GNUC__ >= 4
66
+ #define CUFFTAPI __attribute__ ((visibility ("default")))
67
+ #else
68
+ #define CUFFTAPI
69
+ #endif
70
+ #endif
71
+
72
+ #ifdef __cplusplus
73
+ extern "C" {
74
+ #endif
75
+
76
+ #define CUFFT_VER_MAJOR 11
77
+ #define CUFFT_VER_MINOR 2
78
+ #define CUFFT_VER_PATCH 1
79
+ #define CUFFT_VER_BUILD 3
80
+
81
+ #define CUFFT_VERSION 11201
82
+
83
+ // CUFFT API function return values
84
+ typedef enum cufftResult_t {
85
+ CUFFT_SUCCESS = 0x0,
86
+ CUFFT_INVALID_PLAN = 0x1,
87
+ CUFFT_ALLOC_FAILED = 0x2,
88
+ CUFFT_INVALID_TYPE = 0x3,
89
+ CUFFT_INVALID_VALUE = 0x4,
90
+ CUFFT_INTERNAL_ERROR = 0x5,
91
+ CUFFT_EXEC_FAILED = 0x6,
92
+ CUFFT_SETUP_FAILED = 0x7,
93
+ CUFFT_INVALID_SIZE = 0x8,
94
+ CUFFT_UNALIGNED_DATA = 0x9,
95
+ CUFFT_INCOMPLETE_PARAMETER_LIST = 0xA,
96
+ CUFFT_INVALID_DEVICE = 0xB,
97
+ CUFFT_PARSE_ERROR = 0xC,
98
+ CUFFT_NO_WORKSPACE = 0xD,
99
+ CUFFT_NOT_IMPLEMENTED = 0xE,
100
+ CUFFT_LICENSE_ERROR = 0x0F,
101
+ CUFFT_NOT_SUPPORTED = 0x10
102
+
103
+ } cufftResult;
104
+
105
+ #define MAX_CUFFT_ERROR 0x11
106
+
107
+
108
+ // CUFFT defines and supports the following data types
109
+
110
+
111
+ // cufftReal is a single-precision, floating-point real data type.
112
+ // cufftDoubleReal is a double-precision, real data type.
113
+ typedef float cufftReal;
114
+ typedef double cufftDoubleReal;
115
+
116
+ // cufftComplex is a single-precision, floating-point complex data type that
117
+ // consists of interleaved real and imaginary components.
118
+ // cufftDoubleComplex is the double-precision equivalent.
119
+ typedef cuComplex cufftComplex;
120
+ typedef cuDoubleComplex cufftDoubleComplex;
121
+
122
+ // CUFFT transform directions
123
+ #define CUFFT_FORWARD -1 // Forward FFT
124
+ #define CUFFT_INVERSE 1 // Inverse FFT
125
+
126
+ // CUFFT supports the following transform types
127
+ typedef enum cufftType_t {
128
+ CUFFT_R2C = 0x2a, // Real to Complex (interleaved)
129
+ CUFFT_C2R = 0x2c, // Complex (interleaved) to Real
130
+ CUFFT_C2C = 0x29, // Complex to Complex, interleaved
131
+ CUFFT_D2Z = 0x6a, // Double to Double-Complex
132
+ CUFFT_Z2D = 0x6c, // Double-Complex to Double
133
+ CUFFT_Z2Z = 0x69 // Double-Complex to Double-Complex
134
+ } cufftType;
135
+
136
+ // CUFFT supports the following data layouts
137
+ typedef enum cufftCompatibility_t {
138
+ CUFFT_COMPATIBILITY_FFTW_PADDING = 0x01 // The default value
139
+ } cufftCompatibility;
140
+
141
+ #define CUFFT_COMPATIBILITY_DEFAULT CUFFT_COMPATIBILITY_FFTW_PADDING
142
+
143
+ //
144
+ // structure definition used by the shim between old and new APIs
145
+ //
146
+ #define MAX_SHIM_RANK 3
147
+
148
+ // cufftHandle is a handle type used to store and access CUFFT plans.
149
+ typedef int cufftHandle;
150
+
151
+
152
+ cufftResult CUFFTAPI cufftPlan1d(cufftHandle *plan,
153
+ int nx,
154
+ cufftType type,
155
+ int batch);
156
+
157
+ cufftResult CUFFTAPI cufftPlan2d(cufftHandle *plan,
158
+ int nx, int ny,
159
+ cufftType type);
160
+
161
+ cufftResult CUFFTAPI cufftPlan3d(cufftHandle *plan,
162
+ int nx, int ny, int nz,
163
+ cufftType type);
164
+
165
+ cufftResult CUFFTAPI cufftPlanMany(cufftHandle *plan,
166
+ int rank,
167
+ int *n,
168
+ int *inembed, int istride, int idist,
169
+ int *onembed, int ostride, int odist,
170
+ cufftType type,
171
+ int batch);
172
+
173
+ cufftResult CUFFTAPI cufftMakePlan1d(cufftHandle plan,
174
+ int nx,
175
+ cufftType type,
176
+ int batch,
177
+ size_t *workSize);
178
+
179
+ cufftResult CUFFTAPI cufftMakePlan2d(cufftHandle plan,
180
+ int nx, int ny,
181
+ cufftType type,
182
+ size_t *workSize);
183
+
184
+ cufftResult CUFFTAPI cufftMakePlan3d(cufftHandle plan,
185
+ int nx, int ny, int nz,
186
+ cufftType type,
187
+ size_t *workSize);
188
+
189
+ cufftResult CUFFTAPI cufftMakePlanMany(cufftHandle plan,
190
+ int rank,
191
+ int *n,
192
+ int *inembed, int istride, int idist,
193
+ int *onembed, int ostride, int odist,
194
+ cufftType type,
195
+ int batch,
196
+ size_t *workSize);
197
+
198
+ cufftResult CUFFTAPI cufftMakePlanMany64(cufftHandle plan,
199
+ int rank,
200
+ long long int *n,
201
+ long long int *inembed,
202
+ long long int istride,
203
+ long long int idist,
204
+ long long int *onembed,
205
+ long long int ostride, long long int odist,
206
+ cufftType type,
207
+ long long int batch,
208
+ size_t * workSize);
209
+
210
+ cufftResult CUFFTAPI cufftGetSizeMany64(cufftHandle plan,
211
+ int rank,
212
+ long long int *n,
213
+ long long int *inembed,
214
+ long long int istride, long long int idist,
215
+ long long int *onembed,
216
+ long long int ostride, long long int odist,
217
+ cufftType type,
218
+ long long int batch,
219
+ size_t *workSize);
220
+
221
+
222
+
223
+
224
+ cufftResult CUFFTAPI cufftEstimate1d(int nx,
225
+ cufftType type,
226
+ int batch,
227
+ size_t *workSize);
228
+
229
+ cufftResult CUFFTAPI cufftEstimate2d(int nx, int ny,
230
+ cufftType type,
231
+ size_t *workSize);
232
+
233
+ cufftResult CUFFTAPI cufftEstimate3d(int nx, int ny, int nz,
234
+ cufftType type,
235
+ size_t *workSize);
236
+
237
+ cufftResult CUFFTAPI cufftEstimateMany(int rank,
238
+ int *n,
239
+ int *inembed, int istride, int idist,
240
+ int *onembed, int ostride, int odist,
241
+ cufftType type,
242
+ int batch,
243
+ size_t *workSize);
244
+
245
+ cufftResult CUFFTAPI cufftCreate(cufftHandle * handle);
246
+
247
+ cufftResult CUFFTAPI cufftGetSize1d(cufftHandle handle,
248
+ int nx,
249
+ cufftType type,
250
+ int batch,
251
+ size_t *workSize );
252
+
253
+ cufftResult CUFFTAPI cufftGetSize2d(cufftHandle handle,
254
+ int nx, int ny,
255
+ cufftType type,
256
+ size_t *workSize);
257
+
258
+ cufftResult CUFFTAPI cufftGetSize3d(cufftHandle handle,
259
+ int nx, int ny, int nz,
260
+ cufftType type,
261
+ size_t *workSize);
262
+
263
+ cufftResult CUFFTAPI cufftGetSizeMany(cufftHandle handle,
264
+ int rank, int *n,
265
+ int *inembed, int istride, int idist,
266
+ int *onembed, int ostride, int odist,
267
+ cufftType type, int batch, size_t *workArea);
268
+
269
+ cufftResult CUFFTAPI cufftGetSize(cufftHandle handle, size_t *workSize);
270
+
271
+ cufftResult CUFFTAPI cufftSetWorkArea(cufftHandle plan, void *workArea);
272
+
273
+ cufftResult CUFFTAPI cufftSetAutoAllocation(cufftHandle plan, int autoAllocate);
274
+
275
+ cufftResult CUFFTAPI cufftExecC2C(cufftHandle plan,
276
+ cufftComplex *idata,
277
+ cufftComplex *odata,
278
+ int direction);
279
+
280
+ cufftResult CUFFTAPI cufftExecR2C(cufftHandle plan,
281
+ cufftReal *idata,
282
+ cufftComplex *odata);
283
+
284
+ cufftResult CUFFTAPI cufftExecC2R(cufftHandle plan,
285
+ cufftComplex *idata,
286
+ cufftReal *odata);
287
+
288
+ cufftResult CUFFTAPI cufftExecZ2Z(cufftHandle plan,
289
+ cufftDoubleComplex *idata,
290
+ cufftDoubleComplex *odata,
291
+ int direction);
292
+
293
+ cufftResult CUFFTAPI cufftExecD2Z(cufftHandle plan,
294
+ cufftDoubleReal *idata,
295
+ cufftDoubleComplex *odata);
296
+
297
+ cufftResult CUFFTAPI cufftExecZ2D(cufftHandle plan,
298
+ cufftDoubleComplex *idata,
299
+ cufftDoubleReal *odata);
300
+
301
+
302
+ // utility functions
303
+ cufftResult CUFFTAPI cufftSetStream(cufftHandle plan,
304
+ cudaStream_t stream);
305
+
306
+ cufftResult CUFFTAPI cufftDestroy(cufftHandle plan);
307
+
308
+ cufftResult CUFFTAPI cufftGetVersion(int *version);
309
+
310
+ cufftResult CUFFTAPI cufftGetProperty(libraryPropertyType type,
311
+ int *value);
312
+
313
+ //
314
+ // Set/Get PlanProperty APIs configures per-plan behavior
315
+ //
316
+ typedef enum cufftProperty_t {
317
+ NVFFT_PLAN_PROPERTY_INT64_PATIENT_JIT = 0x1
318
+ } cufftProperty;
319
+
320
+ cufftResult CUFFTAPI cufftSetPlanPropertyInt64(cufftHandle plan,
321
+ cufftProperty property,
322
+ const long long int inputValueInt);
323
+
324
+ cufftResult CUFFTAPI cufftGetPlanPropertyInt64(cufftHandle plan,
325
+ cufftProperty property,
326
+ long long int* returnPtrValue);
327
+
328
+ cufftResult CUFFTAPI cufftResetPlanProperty(cufftHandle plan, cufftProperty property);
329
+
330
+ #ifdef __cplusplus
331
+ }
332
+ #endif
333
+
334
+ #endif /* _CUFFT_H_ */
lib/python3.12/site-packages/nvidia/cufft/include/cufftw.h ADDED
@@ -0,0 +1,465 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /* Copyright 2005-2014 NVIDIA Corporation. All rights reserved.
3
+ *
4
+ * NOTICE TO LICENSEE:
5
+ *
6
+ * The source code and/or documentation ("Licensed Deliverables") are
7
+ * subject to NVIDIA intellectual property rights under U.S. and
8
+ * international Copyright laws.
9
+ *
10
+ * The Licensed Deliverables contained herein are PROPRIETARY and
11
+ * CONFIDENTIAL to NVIDIA and are being provided under the terms and
12
+ * conditions of a form of NVIDIA software license agreement by and
13
+ * between NVIDIA and Licensee ("License Agreement") or electronically
14
+ * accepted by Licensee. Notwithstanding any terms or conditions to
15
+ * the contrary in the License Agreement, reproduction or disclosure
16
+ * of the Licensed Deliverables to any third party without the express
17
+ * written consent of NVIDIA is prohibited.
18
+ *
19
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20
+ * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21
+ * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE
22
+ * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23
+ * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24
+ * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25
+ * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26
+ * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27
+ * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28
+ * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32
+ * OF THESE LICENSED DELIVERABLES.
33
+ *
34
+ * U.S. Government End Users. These Licensed Deliverables are a
35
+ * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36
+ * 1995), consisting of "commercial computer software" and "commercial
37
+ * computer software documentation" as such terms are used in 48
38
+ * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government
39
+ * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40
+ * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41
+ * U.S. Government End Users acquire the Licensed Deliverables with
42
+ * only those rights set forth herein.
43
+ *
44
+ * Any use of the Licensed Deliverables in individual and commercial
45
+ * software must include, in the user documentation and internal
46
+ * comments to the code, the above Disclaimer and U.S. Government End
47
+ * Users Notice.
48
+ */
49
+
50
+ /*!
51
+ * \file cufftw.h
52
+ * \brief Public header file for the NVIDIA CUDA FFTW library (CUFFTW)
53
+ */
54
+
55
+ #ifndef _CUFFTW_H_
56
+ #define _CUFFTW_H_
57
+
58
+
59
+ #include <stdio.h>
60
+ #include "cufft.h"
61
+
62
+ #ifdef __cplusplus
63
+ extern "C" {
64
+ #endif
65
+
66
+ // Transform direction
67
+ #define FFTW_FORWARD -1
68
+ #define FFTW_INVERSE 1
69
+ #define FFTW_BACKWARD 1
70
+
71
+ // Planner flags
72
+ #define FFTW_ESTIMATE 0x01
73
+ #define FFTW_MEASURE 0x02
74
+ #define FFTW_PATIENT 0x03
75
+ #define FFTW_EXHAUSTIVE 0x04
76
+ #define FFTW_WISDOM_ONLY 0x05
77
+
78
+ // Algorithm restriction flags
79
+ #define FFTW_DESTROY_INPUT 0x08
80
+ #define FFTW_PRESERVE_INPUT 0x0C
81
+ #define FFTW_UNALIGNED 0x10
82
+
83
+ // CUFFTW defines and supports the following data types
84
+
85
+ // note if complex.h has been included we use the C99 complex types
86
+ #if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined (complex)
87
+ typedef double _Complex fftw_complex;
88
+ typedef float _Complex fftwf_complex;
89
+ #else
90
+ typedef double fftw_complex[2];
91
+ typedef float fftwf_complex[2];
92
+ #endif
93
+
94
+ typedef void *fftw_plan;
95
+
96
+ typedef void *fftwf_plan;
97
+
98
+ typedef struct {
99
+ int n;
100
+ int is;
101
+ int os;
102
+ } fftw_iodim;
103
+
104
+ typedef fftw_iodim fftwf_iodim;
105
+
106
+ typedef struct {
107
+ ptrdiff_t n;
108
+ ptrdiff_t is;
109
+ ptrdiff_t os;
110
+ } fftw_iodim64;
111
+
112
+ typedef fftw_iodim64 fftwf_iodim64;
113
+
114
+ // CUFFTW defines and supports the following double precision APIs
115
+
116
+ fftw_plan CUFFTAPI fftw_plan_dft_1d(int n,
117
+ fftw_complex *in,
118
+ fftw_complex *out,
119
+ int sign,
120
+ unsigned flags);
121
+
122
+ fftw_plan CUFFTAPI fftw_plan_dft_2d(int n0,
123
+ int n1,
124
+ fftw_complex *in,
125
+ fftw_complex *out,
126
+ int sign,
127
+ unsigned flags);
128
+
129
+ fftw_plan CUFFTAPI fftw_plan_dft_3d(int n0,
130
+ int n1,
131
+ int n2,
132
+ fftw_complex *in,
133
+ fftw_complex *out,
134
+ int sign,
135
+ unsigned flags);
136
+
137
+ fftw_plan CUFFTAPI fftw_plan_dft(int rank,
138
+ const int *n,
139
+ fftw_complex *in,
140
+ fftw_complex *out,
141
+ int sign,
142
+ unsigned flags);
143
+
144
+ fftw_plan CUFFTAPI fftw_plan_dft_r2c_1d(int n,
145
+ double *in,
146
+ fftw_complex *out,
147
+ unsigned flags);
148
+
149
+ fftw_plan CUFFTAPI fftw_plan_dft_r2c_2d(int n0,
150
+ int n1,
151
+ double *in,
152
+ fftw_complex *out,
153
+ unsigned flags);
154
+
155
+ fftw_plan CUFFTAPI fftw_plan_dft_r2c_3d(int n0,
156
+ int n1,
157
+ int n2,
158
+ double *in,
159
+ fftw_complex *out,
160
+ unsigned flags);
161
+
162
+ fftw_plan CUFFTAPI fftw_plan_dft_r2c(int rank,
163
+ const int *n,
164
+ double *in,
165
+ fftw_complex *out,
166
+ unsigned flags);
167
+
168
+ fftw_plan CUFFTAPI fftw_plan_dft_c2r_1d(int n,
169
+ fftw_complex *in,
170
+ double *out,
171
+ unsigned flags);
172
+
173
+ fftw_plan CUFFTAPI fftw_plan_dft_c2r_2d(int n0,
174
+ int n1,
175
+ fftw_complex *in,
176
+ double *out,
177
+ unsigned flags);
178
+
179
+ fftw_plan CUFFTAPI fftw_plan_dft_c2r_3d(int n0,
180
+ int n1,
181
+ int n2,
182
+ fftw_complex *in,
183
+ double *out,
184
+ unsigned flags);
185
+
186
+ fftw_plan CUFFTAPI fftw_plan_dft_c2r(int rank,
187
+ const int *n,
188
+ fftw_complex *in,
189
+ double *out,
190
+ unsigned flags);
191
+
192
+
193
+ fftw_plan CUFFTAPI fftw_plan_many_dft(int rank,
194
+ const int *n,
195
+ int batch,
196
+ fftw_complex *in,
197
+ const int *inembed, int istride, int idist,
198
+ fftw_complex *out,
199
+ const int *onembed, int ostride, int odist,
200
+ int sign, unsigned flags);
201
+
202
+ fftw_plan CUFFTAPI fftw_plan_many_dft_r2c(int rank,
203
+ const int *n,
204
+ int batch,
205
+ double *in,
206
+ const int *inembed, int istride, int idist,
207
+ fftw_complex *out,
208
+ const int *onembed, int ostride, int odist,
209
+ unsigned flags);
210
+
211
+ fftw_plan CUFFTAPI fftw_plan_many_dft_c2r(int rank,
212
+ const int *n,
213
+ int batch,
214
+ fftw_complex *in,
215
+ const int *inembed, int istride, int idist,
216
+ double *out,
217
+ const int *onembed, int ostride, int odist,
218
+ unsigned flags);
219
+
220
+ fftw_plan CUFFTAPI fftw_plan_guru_dft(int rank, const fftw_iodim *dims,
221
+ int batch_rank, const fftw_iodim *batch_dims,
222
+ fftw_complex *in, fftw_complex *out,
223
+ int sign, unsigned flags);
224
+
225
+ fftw_plan CUFFTAPI fftw_plan_guru_dft_r2c(int rank, const fftw_iodim *dims,
226
+ int batch_rank, const fftw_iodim *batch_dims,
227
+ double *in, fftw_complex *out,
228
+ unsigned flags);
229
+
230
+ fftw_plan CUFFTAPI fftw_plan_guru_dft_c2r(int rank, const fftw_iodim *dims,
231
+ int batch_rank, const fftw_iodim *batch_dims,
232
+ fftw_complex *in, double *out,
233
+ unsigned flags);
234
+
235
+ fftw_plan CUFFTAPI fftw_plan_guru64_dft(int rank, const fftw_iodim64* dims,
236
+ int batch_rank, const fftw_iodim64* batch_dims,
237
+ fftw_complex* in, fftw_complex* out,
238
+ int sign, unsigned flags);
239
+
240
+ fftw_plan CUFFTAPI fftw_plan_guru64_dft_r2c(int rank, const fftw_iodim64* dims,
241
+ int batch_rank, const fftw_iodim64* batch_dims,
242
+ double* in, fftw_complex* out,
243
+ unsigned flags);
244
+
245
+ fftw_plan CUFFTAPI fftw_plan_guru64_dft_c2r(int rank, const fftw_iodim64* dims,
246
+ int batch_rank, const fftw_iodim64* batch_dims,
247
+ fftw_complex* in, double* out,
248
+ unsigned flags);
249
+
250
+ void CUFFTAPI fftw_execute(const fftw_plan plan);
251
+
252
+ void CUFFTAPI fftw_execute_dft(const fftw_plan plan,
253
+ fftw_complex *idata,
254
+ fftw_complex *odata);
255
+
256
+ void CUFFTAPI fftw_execute_dft_r2c(const fftw_plan plan,
257
+ double *idata,
258
+ fftw_complex *odata);
259
+
260
+ void CUFFTAPI fftw_execute_dft_c2r(const fftw_plan plan,
261
+ fftw_complex *idata,
262
+ double *odata);
263
+
264
+ // CUFFTW defines and supports the following single precision APIs
265
+
266
+ fftwf_plan CUFFTAPI fftwf_plan_dft_1d(int n,
267
+ fftwf_complex *in,
268
+ fftwf_complex *out,
269
+ int sign,
270
+ unsigned flags);
271
+
272
+ fftwf_plan CUFFTAPI fftwf_plan_dft_2d(int n0,
273
+ int n1,
274
+ fftwf_complex *in,
275
+ fftwf_complex *out,
276
+ int sign,
277
+ unsigned flags);
278
+
279
+ fftwf_plan CUFFTAPI fftwf_plan_dft_3d(int n0,
280
+ int n1,
281
+ int n2,
282
+ fftwf_complex *in,
283
+ fftwf_complex *out,
284
+ int sign,
285
+ unsigned flags);
286
+
287
+ fftwf_plan CUFFTAPI fftwf_plan_dft(int rank,
288
+ const int *n,
289
+ fftwf_complex *in,
290
+ fftwf_complex *out,
291
+ int sign,
292
+ unsigned flags);
293
+
294
+ fftwf_plan CUFFTAPI fftwf_plan_dft_r2c_1d(int n,
295
+ float *in,
296
+ fftwf_complex *out,
297
+ unsigned flags);
298
+
299
+ fftwf_plan CUFFTAPI fftwf_plan_dft_r2c_2d(int n0,
300
+ int n1,
301
+ float *in,
302
+ fftwf_complex *out,
303
+ unsigned flags);
304
+
305
+ fftwf_plan CUFFTAPI fftwf_plan_dft_r2c_3d(int n0,
306
+ int n1,
307
+ int n2,
308
+ float *in,
309
+ fftwf_complex *out,
310
+ unsigned flags);
311
+
312
+ fftwf_plan CUFFTAPI fftwf_plan_dft_r2c(int rank,
313
+ const int *n,
314
+ float *in,
315
+ fftwf_complex *out,
316
+ unsigned flags);
317
+
318
+ fftwf_plan CUFFTAPI fftwf_plan_dft_c2r_1d(int n,
319
+ fftwf_complex *in,
320
+ float *out,
321
+ unsigned flags);
322
+
323
+ fftwf_plan CUFFTAPI fftwf_plan_dft_c2r_2d(int n0,
324
+ int n1,
325
+ fftwf_complex *in,
326
+ float *out,
327
+ unsigned flags);
328
+
329
+ fftwf_plan CUFFTAPI fftwf_plan_dft_c2r_3d(int n0,
330
+ int n1,
331
+ int n2,
332
+ fftwf_complex *in,
333
+ float *out,
334
+ unsigned flags);
335
+
336
+ fftwf_plan CUFFTAPI fftwf_plan_dft_c2r(int rank,
337
+ const int *n,
338
+ fftwf_complex *in,
339
+ float *out,
340
+ unsigned flags);
341
+
342
+ fftwf_plan CUFFTAPI fftwf_plan_many_dft(int rank,
343
+ const int *n,
344
+ int batch,
345
+ fftwf_complex *in,
346
+ const int *inembed, int istride, int idist,
347
+ fftwf_complex *out,
348
+ const int *onembed, int ostride, int odist,
349
+ int sign, unsigned flags);
350
+
351
+ fftwf_plan CUFFTAPI fftwf_plan_many_dft_r2c(int rank,
352
+ const int *n,
353
+ int batch,
354
+ float *in,
355
+ const int *inembed, int istride, int idist,
356
+ fftwf_complex *out,
357
+ const int *onembed, int ostride, int odist,
358
+ unsigned flags);
359
+
360
+ fftwf_plan CUFFTAPI fftwf_plan_many_dft_c2r(int rank,
361
+ const int *n,
362
+ int batch,
363
+ fftwf_complex *in,
364
+ const int *inembed, int istride, int idist,
365
+ float *out,
366
+ const int *onembed, int ostride, int odist,
367
+ unsigned flags);
368
+
369
+ fftwf_plan CUFFTAPI fftwf_plan_guru_dft(int rank, const fftwf_iodim *dims,
370
+ int batch_rank, const fftwf_iodim *batch_dims,
371
+ fftwf_complex *in, fftwf_complex *out,
372
+ int sign, unsigned flags);
373
+
374
+ fftwf_plan CUFFTAPI fftwf_plan_guru_dft_r2c(int rank, const fftwf_iodim *dims,
375
+ int batch_rank, const fftwf_iodim *batch_dims,
376
+ float *in, fftwf_complex *out,
377
+ unsigned flags);
378
+
379
+ fftwf_plan CUFFTAPI fftwf_plan_guru_dft_c2r(int rank, const fftwf_iodim *dims,
380
+ int batch_rank, const fftwf_iodim *batch_dims,
381
+ fftwf_complex *in, float *out,
382
+ unsigned flags);
383
+
384
+ fftwf_plan CUFFTAPI fftwf_plan_guru64_dft(int rank, const fftwf_iodim64* dims,
385
+ int batch_rank, const fftwf_iodim64* batch_dims,
386
+ fftwf_complex* in, fftwf_complex* out,
387
+ int sign, unsigned flags);
388
+
389
+ fftwf_plan CUFFTAPI fftwf_plan_guru64_dft_r2c(int rank, const fftwf_iodim64* dims,
390
+ int batch_rank, const fftwf_iodim64* batch_dims,
391
+ float* in, fftwf_complex* out,
392
+ unsigned flags);
393
+
394
+ fftwf_plan CUFFTAPI fftwf_plan_guru64_dft_c2r(int rank, const fftwf_iodim64* dims,
395
+ int batch_rank, const fftwf_iodim64* batch_dims,
396
+ fftwf_complex* in, float* out,
397
+ unsigned flags);
398
+
399
+ void CUFFTAPI fftwf_execute(const fftw_plan plan);
400
+
401
+ void CUFFTAPI fftwf_execute_dft(const fftwf_plan plan,
402
+ fftwf_complex *idata,
403
+ fftwf_complex *odata);
404
+
405
+ void CUFFTAPI fftwf_execute_dft_r2c(const fftwf_plan plan,
406
+ float *idata,
407
+ fftwf_complex *odata);
408
+
409
+ void CUFFTAPI fftwf_execute_dft_c2r(const fftwf_plan plan,
410
+ fftwf_complex *idata,
411
+ float *odata);
412
+
413
+ #ifdef _WIN32
414
+ #define _CUFFTAPI(T) T CUFFTAPI
415
+ #else
416
+ #define _CUFFTAPI(T) CUFFTAPI T
417
+ #endif
418
+
419
+ // CUFFTW defines and supports the following support APIs
420
+
421
+ _CUFFTAPI(void *) fftw_malloc(size_t n);
422
+
423
+ _CUFFTAPI(void *) fftwf_malloc(size_t n);
424
+
425
+ void CUFFTAPI fftw_free(void *pointer);
426
+
427
+ void CUFFTAPI fftwf_free(void *pointer);
428
+
429
+ void CUFFTAPI fftw_export_wisdom_to_file(FILE * output_file);
430
+
431
+ void CUFFTAPI fftwf_export_wisdom_to_file(FILE * output_file);
432
+
433
+ int CUFFTAPI fftw_import_wisdom_from_file(FILE * input_file);
434
+
435
+ int CUFFTAPI fftwf_import_wisdom_from_file(FILE * input_file);
436
+
437
+ void CUFFTAPI fftw_print_plan(const fftw_plan plan);
438
+
439
+ void CUFFTAPI fftwf_print_plan(const fftwf_plan plan);
440
+
441
+ void CUFFTAPI fftw_set_timelimit(double seconds);
442
+
443
+ void CUFFTAPI fftwf_set_timelimit(double seconds);
444
+
445
+ double CUFFTAPI fftw_cost(const fftw_plan plan);
446
+
447
+ double CUFFTAPI fftwf_cost(const fftw_plan plan);
448
+
449
+ void CUFFTAPI fftw_flops(const fftw_plan plan, double *add, double *mul, double *fma);
450
+
451
+ void CUFFTAPI fftwf_flops(const fftw_plan plan, double *add, double *mul, double *fma);
452
+
453
+ void CUFFTAPI fftw_destroy_plan(fftw_plan plan);
454
+
455
+ void CUFFTAPI fftwf_destroy_plan(fftwf_plan plan);
456
+
457
+ void CUFFTAPI fftw_cleanup(void);
458
+
459
+ void CUFFTAPI fftwf_cleanup(void);
460
+
461
+ #ifdef __cplusplus
462
+ }
463
+ #endif
464
+
465
+ #endif /* _CUFFTW_H_ */