codekingpro commited on
Commit
2f705f7
·
verified ·
1 Parent(s): c7554bc

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. cuda_toolkit/bin/FrameViewKMD.sys +0 -0
  2. cuda_toolkit/bin/FvSDK_x64.dll +0 -0
  3. cuda_toolkit/bin/FvSDK_x86.dll +0 -0
  4. cuda_toolkit/bin/__nvcc_device_query.exe +0 -0
  5. cuda_toolkit/bin/ant +336 -0
  6. cuda_toolkit/bin/ant.bat +218 -0
  7. cuda_toolkit/bin/ant.cmd +93 -0
  8. cuda_toolkit/bin/antRun +24 -0
  9. cuda_toolkit/bin/antRun.bat +50 -0
  10. cuda_toolkit/bin/antRun.pl +66 -0
  11. cuda_toolkit/bin/antenv.cmd +98 -0
  12. cuda_toolkit/bin/complete-ant-cmd.pl +114 -0
  13. cuda_toolkit/bin/compute-sanitizer.bat +2 -0
  14. cuda_toolkit/bin/envset.cmd +131 -0
  15. cuda_toolkit/bin/lcp.bat +31 -0
  16. cuda_toolkit/bin/mouseLut.json +1732 -0
  17. cuda_toolkit/bin/nvcc.profile +13 -0
  18. cuda_toolkit/bin/nvvp.bat +5 -0
  19. cuda_toolkit/bin/runant.pl +153 -0
  20. cuda_toolkit/bin/runant.py +102 -0
  21. cuda_toolkit/bin/runrc.cmd +60 -0
  22. cuda_toolkit/compute-sanitizer/LICENSE +1632 -0
  23. cuda_toolkit/include/__assert +70 -0
  24. cuda_toolkit/include/__availability +306 -0
  25. cuda_toolkit/include/__bit_reference +1293 -0
  26. cuda_toolkit/include/__bsd_locale_defaults.h +40 -0
  27. cuda_toolkit/include/__bsd_locale_fallbacks.h +143 -0
  28. cuda_toolkit/include/__cccl_config +194 -0
  29. cuda_toolkit/include/__config +2250 -0
  30. cuda_toolkit/include/__config_site.in +36 -0
  31. cuda_toolkit/include/__debug +279 -0
  32. cuda_toolkit/include/__errc +221 -0
  33. cuda_toolkit/include/__functional_base +138 -0
  34. cuda_toolkit/include/__hash_table +0 -0
  35. cuda_toolkit/include/__libcpp_version +1 -0
  36. cuda_toolkit/include/__locale +1557 -0
  37. cuda_toolkit/include/__mutex_base +542 -0
  38. cuda_toolkit/include/__node_handle +213 -0
  39. cuda_toolkit/include/__nullptr +65 -0
  40. cuda_toolkit/include/__pragma_pop +16 -0
  41. cuda_toolkit/include/__pragma_push +25 -0
  42. cuda_toolkit/include/__split_buffer +632 -0
  43. cuda_toolkit/include/__sso_allocator +80 -0
  44. cuda_toolkit/include/__std_stream +365 -0
  45. cuda_toolkit/include/__string +990 -0
  46. cuda_toolkit/include/__threading_support +795 -0
  47. cuda_toolkit/include/__tree +0 -0
  48. cuda_toolkit/include/__undef_macros +33 -0
  49. cuda_toolkit/include/__verbose_abort +59 -0
  50. cuda_toolkit/include/algorithm +0 -0
cuda_toolkit/bin/FrameViewKMD.sys ADDED
Binary file (22.1 kB). View file
 
cuda_toolkit/bin/FvSDK_x64.dll ADDED
Binary file (86.6 kB). View file
 
cuda_toolkit/bin/FvSDK_x86.dll ADDED
Binary file (75.3 kB). View file
 
cuda_toolkit/bin/__nvcc_device_query.exe ADDED
Binary file (84.5 kB). View file
 
cuda_toolkit/bin/ant ADDED
@@ -0,0 +1,336 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #! /bin/sh
2
+
3
+ # Licensed to the Apache Software Foundation (ASF) under one or more
4
+ # contributor license agreements. See the NOTICE file distributed with
5
+ # this work for additional information regarding copyright ownership.
6
+ # The ASF licenses this file to You under the Apache License, Version 2.0
7
+ # (the "License"); you may not use this file except in compliance with
8
+ # the License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ # Extract launch and ant arguments, (see details below).
19
+ ant_exec_args=
20
+ no_config=false
21
+ use_jikes_default=false
22
+ ant_exec_debug=false
23
+ show_help=false
24
+ for arg in "$@" ; do
25
+ if [ "$arg" = "--noconfig" ] ; then
26
+ no_config=true
27
+ elif [ "$arg" = "--usejikes" ] ; then
28
+ use_jikes_default=true
29
+ elif [ "$arg" = "--execdebug" ] ; then
30
+ ant_exec_debug=true
31
+ elif [ my"$arg" = my"--h" -o my"$arg" = my"--help" ] ; then
32
+ show_help=true
33
+ ant_exec_args="$ant_exec_args -h"
34
+ else
35
+ if [ my"$arg" = my"-h" -o my"$arg" = my"-help" ] ; then
36
+ show_help=true
37
+ fi
38
+ ant_exec_args="$ant_exec_args \"$arg\""
39
+ fi
40
+ done
41
+
42
+ # Source/default ant configuration
43
+ if $no_config ; then
44
+ rpm_mode=false
45
+ usejikes=$use_jikes_default
46
+ else
47
+ # load system-wide ant configuration (ONLY if ANT_HOME has NOT been set)
48
+ if [ -z "$ANT_HOME" -o "$ANT_HOME" = "/usr/share/ant" ]; then
49
+ if [ -f "/etc/ant.conf" ] ; then
50
+ . /etc/ant.conf
51
+ fi
52
+ fi
53
+
54
+ # load user ant configuration
55
+ if [ -f "$HOME/.ant/ant.conf" ] ; then
56
+ . $HOME/.ant/ant.conf
57
+ fi
58
+ if [ -f "$HOME/.antrc" ] ; then
59
+ . "$HOME/.antrc"
60
+ fi
61
+
62
+ # provide default configuration values
63
+ if [ -z "$rpm_mode" ] ; then
64
+ rpm_mode=false
65
+ fi
66
+ if [ -z "$usejikes" ] ; then
67
+ usejikes=$use_jikes_default
68
+ fi
69
+ fi
70
+
71
+ # Setup Java environment in rpm mode
72
+ if $rpm_mode ; then
73
+ if [ -f /usr/share/java-utils/java-functions ] ; then
74
+ . /usr/share/java-utils/java-functions
75
+ set_jvm
76
+ set_javacmd
77
+ fi
78
+ fi
79
+
80
+ # OS specific support. $var _must_ be set to either true or false.
81
+ cygwin=false;
82
+ darwin=false;
83
+ mingw=false;
84
+ case "`uname`" in
85
+ CYGWIN*) cygwin=true ;;
86
+ Darwin*) darwin=true
87
+ if [ -z "$JAVA_HOME" ] ; then
88
+ if [ -x '/usr/libexec/java_home' ] ; then
89
+ JAVA_HOME=`/usr/libexec/java_home`
90
+ elif [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" ]; then
91
+ JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
92
+ fi
93
+ fi
94
+ ;;
95
+ MINGW*) mingw=true ;;
96
+ esac
97
+
98
+ if [ -z "$ANT_HOME" -o ! -d "$ANT_HOME" ] ; then
99
+ ## resolve links - $0 may be a link to ant's home
100
+ PRG="$0"
101
+ progname=`basename "$0"`
102
+
103
+ # need this for relative symlinks
104
+ while [ -h "$PRG" ] ; do
105
+ ls=`ls -ld "$PRG"`
106
+ link=`expr "$ls" : '.*-> \(.*\)$'`
107
+ if expr "$link" : '/.*' > /dev/null; then
108
+ PRG="$link"
109
+ else
110
+ PRG=`dirname "$PRG"`"/$link"
111
+ fi
112
+ done
113
+
114
+ ANT_HOME=`dirname "$PRG"`/..
115
+
116
+ # make it fully qualified
117
+ ANT_HOME=`cd "$ANT_HOME" > /dev/null && pwd`
118
+ fi
119
+
120
+ # For Cygwin and Mingw, ensure paths are in UNIX format before
121
+ # anything is touched
122
+ if $cygwin ; then
123
+ [ -n "$ANT_HOME" ] &&
124
+ ANT_HOME=`cygpath --unix "$ANT_HOME"`
125
+ [ -n "$JAVA_HOME" ] &&
126
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
127
+ fi
128
+ if $mingw ; then
129
+ [ -n "$ANT_HOME" ] &&
130
+ ANT_HOME="`(cd "$ANT_HOME"; pwd)`"
131
+ [ -n "$JAVA_HOME" ] &&
132
+ JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
133
+ fi
134
+
135
+ # set ANT_LIB location
136
+ ANT_LIB="${ANT_HOME}/lib"
137
+
138
+ if [ -z "$JAVACMD" ] ; then
139
+ if [ -n "$JAVA_HOME" ] ; then
140
+ # IBM's JDK on AIX uses strange locations for the executables
141
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
142
+ JAVACMD="$JAVA_HOME/jre/sh/java"
143
+ elif [ -x "$JAVA_HOME/jre/bin/java" ] ; then
144
+ JAVACMD="$JAVA_HOME/jre/bin/java"
145
+ else
146
+ JAVACMD="$JAVA_HOME/bin/java"
147
+ fi
148
+ else
149
+ JAVACMD=`which java 2> /dev/null `
150
+ if [ -z "$JAVACMD" ] ; then
151
+ JAVACMD=java
152
+ fi
153
+ fi
154
+ fi
155
+
156
+ if [ ! -x "$JAVACMD" ] ; then
157
+ echo "Error: JAVA_HOME is not defined correctly."
158
+ echo " We cannot execute $JAVACMD"
159
+ exit 1
160
+ fi
161
+
162
+ # Build local classpath using just the launcher in non-rpm mode or
163
+ # use the Jpackage helper in rpm mode with basic and default jars
164
+ # specified in the ant.conf configuration. Because the launcher is
165
+ # used, libraries linked in ANT_HOME/lib will also be included, but this
166
+ # is discouraged as it is not java-version safe. A user should
167
+ # request optional jars and their dependencies via the OPT_JAR_LIST
168
+ # variable
169
+ if $rpm_mode && [ -x /usr/bin/build-classpath ] ; then
170
+ LOCALCLASSPATH="$(/usr/bin/build-classpath ant ant-launcher jaxp_parser_impl xml-commons-apis)"
171
+
172
+ # If no optional jars have been specified then build the default list
173
+ if [ -z "$OPT_JAR_LIST" ] ; then
174
+ for file in /etc/ant.d/*; do
175
+ if [ -f "$file" ]; then
176
+ case "$file" in
177
+ *~) ;;
178
+ *#*) ;;
179
+ *.rpmsave) ;;
180
+ *.rpmnew) ;;
181
+ *)
182
+ for dep in `cat "$file"`; do
183
+ OPT_JAR_LIST="$OPT_JAR_LIST${OPT_JAR_LIST:+ }$dep"
184
+ done
185
+ esac
186
+ fi
187
+ done
188
+ fi
189
+
190
+ # If the user requested to try to add some other jars to the classpath
191
+ if [ -n "$OPT_JAR_LIST" ] ; then
192
+ _OPTCLASSPATH="$(/usr/bin/build-classpath $OPT_JAR_LIST 2> /dev/null)"
193
+ if [ -n "$_OPTCLASSPATH" ] ; then
194
+ LOCALCLASSPATH="$LOCALCLASSPATH:$_OPTCLASSPATH"
195
+ fi
196
+ fi
197
+
198
+ # Explicitly add javac path to classpath, assume JAVA_HOME set
199
+ # properly in rpm mode
200
+ if [ -f "$JAVA_HOME/lib/tools.jar" ] ; then
201
+ LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/tools.jar"
202
+ fi
203
+ if [ -f "$JAVA_HOME/lib/classes.zip" ] ; then
204
+ LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/classes.zip"
205
+ fi
206
+
207
+ # if CLASSPATH_OVERRIDE env var is set, LOCALCLASSPATH will be
208
+ # user CLASSPATH first and ant-found jars after.
209
+ # In that case, the user CLASSPATH will override ant-found jars
210
+ #
211
+ # if CLASSPATH_OVERRIDE is not set, we'll have the normal behaviour
212
+ # with ant-found jars first and user CLASSPATH after
213
+ if [ -n "$CLASSPATH" ] ; then
214
+ # merge local and specified classpath
215
+ if [ -z "$LOCALCLASSPATH" ] ; then
216
+ LOCALCLASSPATH="$CLASSPATH"
217
+ elif [ -n "$CLASSPATH_OVERRIDE" ] ; then
218
+ LOCALCLASSPATH="$CLASSPATH:$LOCALCLASSPATH"
219
+ else
220
+ LOCALCLASSPATH="$LOCALCLASSPATH:$CLASSPATH"
221
+ fi
222
+
223
+ # remove class path from launcher -cp option
224
+ CLASSPATH=""
225
+ fi
226
+ else
227
+ # not using rpm_mode; use launcher to determine classpaths
228
+ if [ -z "$LOCALCLASSPATH" ] ; then
229
+ LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar
230
+ else
231
+ LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar:$LOCALCLASSPATH
232
+ fi
233
+ fi
234
+
235
+ if [ -n "$JAVA_HOME" ] ; then
236
+ # OSX hack to make Ant work with jikes
237
+ if $darwin ; then
238
+ OSXHACK="${JAVA_HOME}/../Classes"
239
+ if [ -d "${OSXHACK}" ] ; then
240
+ for i in "${OSXHACK}"/*.jar
241
+ do
242
+ JIKESPATH="$JIKESPATH:$i"
243
+ done
244
+ fi
245
+ fi
246
+ fi
247
+
248
+ # Allow Jikes support (off by default)
249
+ if $usejikes; then
250
+ ANT_OPTS="$ANT_OPTS -Dbuild.compiler=jikes"
251
+ fi
252
+
253
+ # For Cygwin, switch paths to appropriate format before running java
254
+ # For PATHs convert to unix format first, then to windows format to ensure
255
+ # both formats are supported. Probably this will fail on directories with ;
256
+ # in the name in the path. Let's assume that paths containing ; are more
257
+ # rare than windows style paths on cygwin.
258
+ if $cygwin; then
259
+ if [ "$OS" = "Windows_NT" ] && cygpath -m .>/dev/null 2>/dev/null ; then
260
+ format=mixed
261
+ else
262
+ format=windows
263
+ fi
264
+ [ -n "$ANT_HOME" ] && ANT_HOME=`cygpath --$format "$ANT_HOME"`
265
+ ANT_LIB=`cygpath --$format "$ANT_LIB"`
266
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --$format "$JAVA_HOME"`
267
+ LCP_TEMP=`cygpath --path --unix "$LOCALCLASSPATH"`
268
+ LOCALCLASSPATH=`cygpath --path --$format "$LCP_TEMP"`
269
+ if [ -n "$CLASSPATH" ] ; then
270
+ CP_TEMP=`cygpath --path --unix "$CLASSPATH"`
271
+ CLASSPATH=`cygpath --path --$format "$CP_TEMP"`
272
+ fi
273
+ CYGHOME=`cygpath --$format "$HOME"`
274
+ fi
275
+
276
+ # Show script help if requested
277
+ if $show_help ; then
278
+ echo $0 '[script options] [options] [target [target2 [target3] ..]]'
279
+ echo 'Script Options:'
280
+ echo ' --help, --h print this message and ant help'
281
+ echo ' --noconfig suppress sourcing of /etc/ant.conf,'
282
+ echo ' $HOME/.ant/ant.conf, and $HOME/.antrc'
283
+ echo ' configuration files'
284
+ echo ' --usejikes enable use of jikes by default, unless'
285
+ echo ' set explicitly in configuration files'
286
+ echo ' --execdebug print ant exec line generated by this'
287
+ echo ' launch script'
288
+ echo ' '
289
+ fi
290
+ # add a second backslash to variables terminated by a backslash under cygwin
291
+ if $cygwin; then
292
+ case "$ANT_HOME" in
293
+ *\\ )
294
+ ANT_HOME="$ANT_HOME\\"
295
+ ;;
296
+ esac
297
+ case "$CYGHOME" in
298
+ *\\ )
299
+ CYGHOME="$CYGHOME\\"
300
+ ;;
301
+ esac
302
+ case "$JIKESPATH" in
303
+ *\\ )
304
+ JIKESPATH="$JIKESPATH\\"
305
+ ;;
306
+ esac
307
+ case "$LOCALCLASSPATH" in
308
+ *\\ )
309
+ LOCALCLASSPATH="$LOCALCLASSPATH\\"
310
+ ;;
311
+ esac
312
+ case "$CLASSPATH" in
313
+ *\\ )
314
+ CLASSPATH="$CLASSPATH\\"
315
+ ;;
316
+ esac
317
+ fi
318
+ # Execute ant using eval/exec to preserve spaces in paths,
319
+ # java options, and ant args
320
+ ant_sys_opts=
321
+ if [ -n "$CYGHOME" ]; then
322
+ if [ -n "$JIKESPATH" ]; then
323
+ ant_sys_opts="-Djikes.class.path=\"$JIKESPATH\" -Dcygwin.user.home=\"$CYGHOME\""
324
+ else
325
+ ant_sys_opts="-Dcygwin.user.home=\"$CYGHOME\""
326
+ fi
327
+ else
328
+ if [ -n "$JIKESPATH" ]; then
329
+ ant_sys_opts="-Djikes.class.path=\"$JIKESPATH\""
330
+ fi
331
+ fi
332
+ ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS -classpath \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=\"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher $ANT_ARGS -cp \"$CLASSPATH\""
333
+ if $ant_exec_debug ; then
334
+ echo $ant_exec_command $ant_exec_args
335
+ fi
336
+ eval $ant_exec_command "$ant_exec_args"
cuda_toolkit/bin/ant.bat ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+
3
+ REM Licensed to the Apache Software Foundation (ASF) under one or more
4
+ REM contributor license agreements. See the NOTICE file distributed with
5
+ REM this work for additional information regarding copyright ownership.
6
+ REM The ASF licenses this file to You under the Apache License, Version 2.0
7
+ REM (the "License"); you may not use this file except in compliance with
8
+ REM the License. You may obtain a copy of the License at
9
+ REM
10
+ REM http://www.apache.org/licenses/LICENSE-2.0
11
+ REM
12
+ REM Unless required by applicable law or agreed to in writing, software
13
+ REM distributed under the License is distributed on an "AS IS" BASIS,
14
+ REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ REM See the License for the specific language governing permissions and
16
+ REM limitations under the License.
17
+
18
+ REM This is an inordinately troublesome piece of code, particularly because it
19
+ REM tries to work on both Win9x and WinNT-based systems. If we could abandon '9x
20
+ REM support, things would be much easier, but sadly, it is not yet time.
21
+ REM Be cautious about editing this, and only add WinNT specific stuff in code that
22
+ REM only runs on WinNT.
23
+
24
+ if "%HOME%"=="" goto homeDrivePathPre
25
+ if exist "%HOME%\antrc_pre.bat" call "%HOME%\antrc_pre.bat"
26
+
27
+ :homeDrivePathPre
28
+ if "%HOMEDRIVE%%HOMEPATH%"=="" goto userProfilePre
29
+ if "%HOMEDRIVE%%HOMEPATH%"=="%HOME%" goto userProfilePre
30
+ if exist "%HOMEDRIVE%%HOMEPATH%\antrc_pre.bat" call "%HOMEDRIVE%%HOMEPATH%\antrc_pre.bat"
31
+
32
+ :userProfilePre
33
+ if "%USERPROFILE%"=="" goto alpha
34
+ if "%USERPROFILE%"=="%HOME%" goto alpha
35
+ if "%USERPROFILE%"=="%HOMEDRIVE%%HOMEPATH%" goto alpha
36
+ if exist "%USERPROFILE%\antrc_pre.bat" call "%USERPROFILE%\antrc_pre.bat"
37
+
38
+ :alpha
39
+
40
+ if "%OS%"=="Windows_NT" @setlocal
41
+ if "%OS%"=="WINNT" @setlocal
42
+
43
+ if "%ANT_HOME%"=="" goto setDefaultAntHome
44
+
45
+ :stripAntHome
46
+ if not _%ANT_HOME:~-1%==_\ goto checkClasspath
47
+ set ANT_HOME=%ANT_HOME:~0,-1%
48
+ goto stripAntHome
49
+
50
+ :setDefaultAntHome
51
+ rem %~dp0 is expanded pathname of the current script under NT
52
+ set ANT_HOME=%~dp0..
53
+
54
+ :checkClasspath
55
+ set _USE_CLASSPATH=yes
56
+ rem CLASSPATH must not be used if it is equal to ""
57
+ if "%CLASSPATH%"=="""" set _USE_CLASSPATH=no
58
+ if "%CLASSPATH%"=="" set _USE_CLASSPATH=no
59
+
60
+ rem Slurp the command line arguments. This loop allows for an unlimited number
61
+ rem of arguments (up to the command line limit, anyway).
62
+ set ANT_CMD_LINE_ARGS=
63
+ :setupArgs
64
+ if ""%1""=="""" goto doneStart
65
+ if ""%1""==""-noclasspath"" goto clearclasspath
66
+ set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
67
+ shift
68
+ goto setupArgs
69
+
70
+ rem here is there is a -noclasspath in the options
71
+ :clearclasspath
72
+ set _USE_CLASSPATH=no
73
+ shift
74
+ goto setupArgs
75
+
76
+ rem This label provides a place for the argument list loop to break out
77
+ rem and for NT handling to skip to.
78
+
79
+ :doneStart
80
+
81
+ if "%_USE_CLASSPATH%"=="no" goto findAntHome
82
+
83
+ :stripClasspath
84
+ if not _%CLASSPATH:~-1%==_\ goto findAntHome
85
+ set CLASSPATH=%CLASSPATH:~0,-1%
86
+ goto stripClasspath
87
+
88
+ :findAntHome
89
+ rem find ANT_HOME if it does not exist due to either an invalid value passed
90
+ rem by the user or the %0 problem on Windows 9x
91
+ if exist "%ANT_HOME%\lib\ant.jar" goto checkJava
92
+
93
+ rem check for ant in Program Files
94
+ if not exist "%ProgramFiles%\ant" goto checkSystemDrive
95
+ set ANT_HOME=%ProgramFiles%\ant
96
+ goto checkJava
97
+
98
+ :checkSystemDrive
99
+ rem check for ant in root directory of system drive
100
+ if not exist %SystemDrive%\ant\lib\ant.jar goto checkCDrive
101
+ set ANT_HOME=%SystemDrive%\ant
102
+ goto checkJava
103
+
104
+ :checkCDrive
105
+ rem check for ant in C:\ant for Win9X users
106
+ if not exist C:\ant\lib\ant.jar goto noAntHome
107
+ set ANT_HOME=C:\ant
108
+ goto checkJava
109
+
110
+ :noAntHome
111
+ echo ANT_HOME is set incorrectly or ant could not be located. Please set ANT_HOME.
112
+ goto end
113
+
114
+ :checkJava
115
+ set _JAVACMD=%JAVACMD%
116
+
117
+ if "%JAVA_HOME%" == "" goto noJavaHome
118
+ if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
119
+ if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java.exe
120
+ goto checkJikes
121
+
122
+ :noJavaHome
123
+ if "%_JAVACMD%" == "" set _JAVACMD=java.exe
124
+
125
+ :checkJikes
126
+ if not "%JIKESPATH%"=="" goto runAntWithJikes
127
+
128
+ :runAnt
129
+ if "%_USE_CLASSPATH%"=="no" goto runAntNoClasspath
130
+ :runAntWithClasspath
131
+ "%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp "%CLASSPATH%" %ANT_CMD_LINE_ARGS%
132
+ rem Check the error code of the Ant build
133
+ if not "%OS%"=="Windows_NT" goto onError
134
+ set ANT_ERROR=%ERRORLEVEL%
135
+ goto end
136
+
137
+ :runAntNoClasspath
138
+ "%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS%
139
+ rem Check the error code of the Ant build
140
+ if not "%OS%"=="Windows_NT" goto onError
141
+ set ANT_ERROR=%ERRORLEVEL%
142
+ goto end
143
+
144
+ :runAntWithJikes
145
+
146
+ if not _%JIKESPATH:~-1%==_\ goto checkJikesAndClasspath
147
+ set JIKESPATH=%JIKESPATH:~0,-1%
148
+ goto runAntWithJikes
149
+
150
+ :checkJikesAndClasspath
151
+
152
+ if "%_USE_CLASSPATH%"=="no" goto runAntWithJikesNoClasspath
153
+
154
+ :runAntWithJikesAndClasspath
155
+ "%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" "-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp "%CLASSPATH%" %ANT_CMD_LINE_ARGS%
156
+ rem Check the error code of the Ant build
157
+ if not "%OS%"=="Windows_NT" goto onError
158
+ set ANT_ERROR=%ERRORLEVEL%
159
+ goto end
160
+
161
+ :runAntWithJikesNoClasspath
162
+ "%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" "-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS%
163
+ rem Check the error code of the Ant build
164
+ if not "%OS%"=="Windows_NT" goto onError
165
+ set ANT_ERROR=%ERRORLEVEL%
166
+ goto end
167
+
168
+ :onError
169
+ rem Windows 9x way of checking the error code. It matches via brute force.
170
+ for %%i in (1 10 100) do set err%%i=
171
+ for %%i in (0 1 2) do if errorlevel %%i00 set err100=%%i
172
+ if %err100%==2 goto onError200
173
+ if %err100%==0 set err100=
174
+ for %%i in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %err100%%%i0 set err10=%%i
175
+ if "%err100%"=="" if %err10%==0 set err10=
176
+ :onError1
177
+ for %%i in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %err100%%err10%%%i set err1=%%i
178
+ goto onErrorEnd
179
+ :onError200
180
+ for %%i in (0 1 2 3 4 5) do if errorlevel 2%%i0 set err10=%%i
181
+ if err10==5 for %%i in (0 1 2 3 4 5) do if errorlevel 25%%i set err1=%%i
182
+ if not err10==5 goto onError1
183
+ :onErrorEnd
184
+ set ANT_ERROR=%err100%%err10%%err1%
185
+ for %%i in (1 10 100) do set err%%i=
186
+
187
+ :end
188
+ rem bug ID 32069: resetting an undefined env variable changes the errorlevel.
189
+ if not "%_JAVACMD%"=="" set _JAVACMD=
190
+ if not "%_ANT_CMD_LINE_ARGS%"=="" set ANT_CMD_LINE_ARGS=
191
+
192
+ if "%ANT_ERROR%"=="0" goto mainEnd
193
+
194
+ goto omega
195
+
196
+ :mainEnd
197
+
198
+ rem If there were no errors, we run the post script.
199
+ if "%OS%"=="Windows_NT" @endlocal
200
+ if "%OS%"=="WINNT" @endlocal
201
+
202
+ if "%HOME%"=="" goto homeDrivePathPost
203
+ if exist "%HOME%\antrc_post.bat" call "%HOME%\antrc_post.bat"
204
+
205
+ :homeDrivePathPost
206
+ if "%HOMEDRIVE%%HOMEPATH%"=="" goto userProfilePost
207
+ if "%HOMEDRIVE%%HOMEPATH%"=="%HOME%" goto userProfilePost
208
+ if exist "%HOMEDRIVE%%HOMEPATH%\antrc_post.bat" call "%HOMEDRIVE%%HOMEPATH%\antrc_post.bat"
209
+
210
+ :userProfilePost
211
+ if "%USERPROFILE%"=="" goto omega
212
+ if "%USERPROFILE%"=="%HOME%" goto omega
213
+ if "%USERPROFILE%"=="%HOMEDRIVE%%HOMEPATH%" goto omega
214
+ if exist "%USERPROFILE%\antrc_post.bat" call "%USERPROFILE%\antrc_post.bat"
215
+
216
+ :omega
217
+
218
+ exit /b %ANT_ERROR%
cuda_toolkit/bin/ant.cmd ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Licensed to the Apache Software Foundation (ASF) under one or more
3
+ contributor license agreements. See the NOTICE file distributed with
4
+ this work for additional information regarding copyright ownership.
5
+ The ASF licenses this file to You under the Apache License, Version 2.0
6
+ (the "License"); you may not use this file except in compliance with
7
+ the License. You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+
17
+ Run ant
18
+ */
19
+
20
+ '@echo off'
21
+ parse arg mode envarg '::' antarg
22
+
23
+ if mode\='.' & mode\='..' & mode\='/' then do
24
+ envarg = mode envarg
25
+ mode = ''
26
+ end
27
+
28
+ if antarg = '' then do
29
+ antarg = envarg
30
+ envarg = ''
31
+ end
32
+
33
+ x = setlocal()
34
+
35
+ env="OS2ENVIRONMENT"
36
+ antenv = _getenv_('antenv')
37
+ if _testenv_() = 0 then interpret 'call "' || antenv || '"' '"' || envarg || '"'
38
+
39
+ if mode = '' then mode = _getenv_('ANT_MODE' '..')
40
+ if mode \= '/' then do
41
+ runrc = _getenv_('runrc')
42
+ antrc = _getenv_('antrc' 'antrc.cmd')
43
+ if mode = '..' then mode = '-r'
44
+ else mode = ''
45
+ interpret 'call "' || runrc || '"' antrc '"' || mode || '"'
46
+ end
47
+
48
+ if _testenv_() = 0 then do
49
+ say 'Ant environment is not set properly'
50
+ x = endlocal()
51
+ exit 16
52
+ end
53
+
54
+ settings = '-Dant.home=' || ANT_HOME '-Djava.home=' || JAVA_HOME
55
+
56
+ java = _getenv_('javacmd' 'java')
57
+ opts = value('ANT_OPTS',,env)
58
+ args = value('ANT_ARGS',,env)
59
+ lcp = value('LOCALCLASSPATH',,env)
60
+ cp = value('CLASSPATH',,env)
61
+ if value('ANT_USE_CP',,env) \= '' then do
62
+ if lcp \= '' & right(lcp, 1) \= ';' then lcp = lcp || ';'
63
+ lcp = lcp || cp
64
+ 'SET CLASSPATH='
65
+ end
66
+ if lcp\='' then lcp = '-classpath' lcp
67
+
68
+ cmd = java opts lcp '-jar' ANT_HOME ||'\lib\ant-launcher.jar' settings args antarg
69
+ launcher = stream(ANT_HOME ||'\lib\ant-launcher.jar', 'C', 'query exists')
70
+ if launcher = '' then entry = 'org.apache.tools.ant.Main'
71
+ else entry = 'org.apache.tools.ant.launch.Launcher'
72
+ java opts lcp entry settings args antarg
73
+
74
+ x = endlocal()
75
+
76
+ return rc
77
+
78
+ _testenv_: procedure expose env ANT_HOME JAVA_HOME
79
+ ANT_HOME = value('ANT_HOME',,env)
80
+ if ANT_HOME = '' then return 0
81
+ JAVA_HOME = value('JAVA_HOME',,env)
82
+ if JAVA_HOME = '' then return 0
83
+ cp = translate(value('CLASSPATH',,env))
84
+ if pos(translate(ANT_HOME), cp) = 0 then return 0
85
+ if pos(translate(JAVA_HOME), cp) = 0 then return 0
86
+ return 1
87
+
88
+ _getenv_: procedure expose env
89
+ parse arg envar default
90
+ if default = '' then default = envar
91
+ var = value(translate(envar),,env)
92
+ if var = '' then var = default
93
+ return var
cuda_toolkit/bin/antRun ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #! /bin/sh
2
+
3
+ # Licensed to the Apache Software Foundation (ASF) under one or more
4
+ # contributor license agreements. See the NOTICE file distributed with
5
+ # this work for additional information regarding copyright ownership.
6
+ # The ASF licenses this file to You under the Apache License, Version 2.0
7
+ # (the "License"); you may not use this file except in compliance with
8
+ # the License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ # Args: DIR command
19
+ cd "$1"
20
+ CMD="$2"
21
+ shift
22
+ shift
23
+
24
+ exec "$CMD" "$@"
cuda_toolkit/bin/antRun.bat ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+
3
+ REM Licensed to the Apache Software Foundation (ASF) under one or more
4
+ REM contributor license agreements. See the NOTICE file distributed with
5
+ REM this work for additional information regarding copyright ownership.
6
+ REM The ASF licenses this file to You under the Apache License, Version 2.0
7
+ REM (the "License"); you may not use this file except in compliance with
8
+ REM the License. You may obtain a copy of the License at
9
+ REM
10
+ REM http://www.apache.org/licenses/LICENSE-2.0
11
+ REM
12
+ REM Unless required by applicable law or agreed to in writing, software
13
+ REM distributed under the License is distributed on an "AS IS" BASIS,
14
+ REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ REM See the License for the specific language governing permissions and
16
+ REM limitations under the License.
17
+
18
+ if "%OS%"=="Windows_NT" @setlocal
19
+ if "%OS%"=="WINNT" @setlocal
20
+
21
+ if ""%1""=="""" goto runCommand
22
+
23
+ rem Change drive and directory to %1
24
+ if "%OS%"=="Windows_NT" goto nt_cd
25
+ if "%OS%"=="WINNT" goto nt_cd
26
+ cd ""%1""
27
+ goto end_cd
28
+ :nt_cd
29
+ cd /d ""%1""
30
+ :end_cd
31
+ shift
32
+
33
+ rem Slurp the command line arguments. This loop allows for an unlimited number
34
+ rem of arguments (up to the command line limit, anyway).
35
+ set ANT_RUN_CMD=%1
36
+ if ""%1""=="""" goto runCommand
37
+ shift
38
+ :loop
39
+ if ""%1""=="""" goto runCommand
40
+ set ANT_RUN_CMD=%ANT_RUN_CMD% %1
41
+ shift
42
+ goto loop
43
+
44
+ :runCommand
45
+ rem echo %ANT_RUN_CMD%
46
+ %ANT_RUN_CMD%
47
+
48
+ if "%OS%"=="Windows_NT" @endlocal
49
+ if "%OS%"=="WINNT" @endlocal
50
+
cuda_toolkit/bin/antRun.pl ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/perl
2
+ #
3
+ # Licensed to the Apache Software Foundation (ASF) under one or more
4
+ # contributor license agreements. See the NOTICE file distributed with
5
+ # this work for additional information regarding copyright ownership.
6
+ # The ASF licenses this file to You under the Apache License, Version 2.0
7
+ # (the "License"); you may not use this file except in compliance with
8
+ # the License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ #######################################################################
19
+ #
20
+ # antRun.pl
21
+ #
22
+ # wrapper script for invoking commands on a platform with Perl installed
23
+ # this is akin to antRun.bat, and antRun the SH script
24
+ #
25
+ # created: 2001-10-18
26
+ # author: Jeff Tulley jtulley@novell.com
27
+ #######################################################################
28
+ #be fussy about variables
29
+ use strict;
30
+
31
+ #turn warnings on during dev; generates a few spurious uninitialised var access warnings
32
+ #use warnings;
33
+
34
+ #and set $debug to 1 to turn on trace info (currently unused)
35
+ my $debug=1;
36
+
37
+ #######################################################################
38
+ # change drive and directory to "%1"
39
+ my $ANT_RUN_CMD = @ARGV[0];
40
+
41
+ # assign current run command to "%2"
42
+ chdir (@ARGV[0]) || die "Can't cd to $ARGV[0]: $!\n";
43
+ if ($^O eq "NetWare") {
44
+ # There is a bug in Perl 5 on NetWare, where chdir does not
45
+ # do anything. On NetWare, the following path-prefixed form should
46
+ # always work. (afaict)
47
+ $ANT_RUN_CMD .= "/".@ARGV[1];
48
+ }
49
+ else {
50
+ $ANT_RUN_CMD = @ARGV[1];
51
+ }
52
+
53
+ # dispose of the first two arguments, leaving only the command's args.
54
+ shift;
55
+ shift;
56
+
57
+ # run the command
58
+ my $returnValue = system $ANT_RUN_CMD, @ARGV;
59
+ if ($returnValue eq 0) {
60
+ exit 0;
61
+ }
62
+ else {
63
+ # only 0 and 1 are widely recognized as exit values
64
+ # so change the exit value to 1
65
+ exit 1;
66
+ }
cuda_toolkit/bin/antenv.cmd ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Licensed to the Apache Software Foundation (ASF) under one or more
3
+ contributor license agreements. See the NOTICE file distributed with
4
+ this work for additional information regarding copyright ownership.
5
+ The ASF licenses this file to You under the Apache License, Version 2.0
6
+ (the "License"); you may not use this file except in compliance with
7
+ the License. You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ */
17
+
18
+ '@echo off'
19
+ call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
20
+ call SysLoadFuncs
21
+
22
+ /* Prepare the parameters for later use */
23
+ parse arg argv
24
+ mode = ''
25
+ args = ''
26
+ opts = ''
27
+ cp = ''
28
+ lcp = ''
29
+
30
+ do i = 1 to words(argv)
31
+ param = word(argv, i)
32
+ select
33
+ when param='-lcp' then mode = 'l'
34
+ when param='-cp' | param='-classpath' then mode = 'c'
35
+ when abbrev('-opts', param, 4) then mode = 'o'
36
+ when abbrev('-args', param, 4) then mode = 'a'
37
+ otherwise
38
+ select
39
+ when mode = 'a' then args = space(args param, 1)
40
+ when mode = 'c' then cp = space(cp param, 1)
41
+ when mode = 'l' then lcp = space(lcp param, 1)
42
+ when mode = 'o' then opts = space(opts param, 1)
43
+ otherwise
44
+ say 'Option' param 'ignored'
45
+ end
46
+ end
47
+ end
48
+
49
+ env="OS2ENVIRONMENT"
50
+ antconf = _getenv_('antconf' 'antconf.cmd')
51
+ runrc = _getenv_('runrc')
52
+ interpret 'call "' || runrc || '"' '"' || antconf || '"' 'ETC'
53
+ ANT_HOME = value('ANT_HOME',,env)
54
+ JAVA_HOME = value('JAVA_HOME',,env)
55
+ classpath = value('CLASSPATH',,env)
56
+ classes = stream(JAVA_HOME || "\lib\classes.zip", "C", "QUERY EXISTS")
57
+ if classes \= '' then classpath = prepend(classpath classes)
58
+ classes = stream(JAVA_HOME || "\lib\tools.jar", "C", "QUERY EXISTS")
59
+ if classes \= '' then classpath = prepend(classpath classes)
60
+
61
+ classpath = prepend(classpath ANT_HOME || '\lib\ant-launcher.jar')
62
+ 'SET CLASSPATH=' || classpath
63
+
64
+ /* Setting classpathes, options and arguments */
65
+ envset = _getenv_('envset')
66
+ if cp\='' then interpret 'call "' || envset || '"' '"; CLASSPATH"' '"' || cp || '"'
67
+ if lcp\='' then interpret 'call "' || envset || '"' '"; LOCALCLASSPATH"' '"' || lcp || '"'
68
+ if opts\='' then interpret 'call "' || envset || '"' '"-D ANT_OPTS"' '"' || opts || '"'
69
+ if args\='' then interpret 'call "' || envset || '"' '"ANT_ARGS"' '"' || args || '"'
70
+
71
+ exit 0
72
+
73
+ addpath: procedure
74
+ parse arg path elem
75
+ if elem = '' then do
76
+ if path\='' & right(path, 1)\=';' then path = path || ';'
77
+ return path
78
+ end
79
+ if substr(path, length(path)) = ';' then glue = ''
80
+ else glue = ';'
81
+ if pos(translate(elem), translate(path)) = 0 then path = path || glue || elem || ';'
82
+ return path
83
+
84
+ prepend: procedure
85
+ parse arg path elem
86
+ if elem = '' then do
87
+ if path\='' & right(path, 1)\=';' then path = path || ';'
88
+ return path
89
+ end
90
+ if pos(translate(elem), translate(path)) = 0 then path = elem || ';' || path
91
+ return path
92
+
93
+ _getenv_: procedure expose env
94
+ parse arg envar default
95
+ if default = '' then default = envar
96
+ var = value(translate(envar),,env)
97
+ if var = '' then var = default
98
+ return var
cuda_toolkit/bin/complete-ant-cmd.pl ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/perl
2
+ #
3
+ # Licensed to the Apache Software Foundation (ASF) under one or more
4
+ # contributor license agreements. See the NOTICE file distributed with
5
+ # this work for additional information regarding copyright ownership.
6
+ # The ASF licenses this file to You under the Apache License, Version 2.0
7
+ # (the "License"); you may not use this file except in compliance with
8
+ # the License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ # A script to allow Bash or Z-Shell to complete an Ant command-line.
19
+ #
20
+ # To install for Bash 2.0 or better, add the following to ~/.bashrc:
21
+ #
22
+ # complete -C complete-ant-cmd.pl ant build.sh
23
+ #
24
+ # To install for Z-Shell 2.5 or better, add the following to ~/.zshrc:
25
+ #
26
+ # function ant_complete () {
27
+ # local args_line args
28
+ # read -l args_line
29
+ # set -A args $args_line
30
+ # set -A reply $(COMP_LINE=$args_line complete-ant-cmd.pl ${args[1]} $1)
31
+ # }
32
+ # compctl -K ant_complete ant build.sh
33
+ #
34
+ # @author Mike Williams <mikew@cortexebusiness.com.au>
35
+
36
+ my $cmdLine = $ENV{'COMP_LINE'};
37
+ my $antCmd = $ARGV[0];
38
+ my $word = $ARGV[1];
39
+
40
+ my @completions;
41
+ if ($word =~ /^-/) {
42
+ list( restrict( $word, getArguments() ));
43
+ } elsif ($cmdLine =~ /-(f|buildfile)\s+\S*$/) {
44
+ list( getBuildFiles($word) );
45
+ } else {
46
+ list( restrict( $word, getTargets() ));
47
+ }
48
+
49
+ exit(0);
50
+
51
+ sub list {
52
+ for (@_) {
53
+ print "$_\n";
54
+ }
55
+ }
56
+
57
+ sub restrict {
58
+ my ($word, @completions) = @_;
59
+ grep( /^\Q$word\E/, @completions );
60
+ }
61
+
62
+ sub getArguments {
63
+ qw(-buildfile -debug -emacs -f -find -help -listener -logfile
64
+ -logger -projecthelp -quiet -verbose -version);
65
+ }
66
+
67
+
68
+ sub getBuildFiles {
69
+ my ($word) = @_;
70
+ grep( /\.xml$/, glob( "$word*" ));
71
+ }
72
+
73
+ sub getTargets {
74
+
75
+ # Look for build-file
76
+ my $buildFile = 'build.xml';
77
+ if ($cmdLine =~ /-(f|buildfile)\s+(\S+)/) {
78
+ $buildFile = $2;
79
+ }
80
+ return () unless (-f $buildFile);
81
+
82
+ # Run "ant -projecthelp" to list targets. Keep a cache of results in a
83
+ # cache-file.
84
+ my $cacheFile = $buildFile;
85
+ $cacheFile =~ s|(.*/)?(.*)|${1}.ant-targets-${2}|;
86
+ if ((!-e $cacheFile) || (-z $cacheFile) || (-M $buildFile) < (-M $cacheFile)) {
87
+ open( CACHE, '>'.$cacheFile ) || die "can\'t write $cacheFile: $!\n";
88
+ open( HELP, "$antCmd -projecthelp -f '$buildFile'|" ) || return();
89
+ my %targets;
90
+ while( <HELP> ) {
91
+ if (/^\s+(\S+)/) {
92
+ $targets{$1}++;
93
+ }
94
+ }
95
+ my @targets = sort keys %targets;
96
+ for (@targets) { print CACHE "$_\n"; }
97
+ return @targets;
98
+ }
99
+
100
+ # Read the target-cache
101
+ open( CACHE, $cacheFile ) || die "can\'t read $cacheFile: $!\n";
102
+ my @targets;
103
+ while (<CACHE>) {
104
+ chop;
105
+ s/\r$//; # for Cygwin
106
+ push( @targets, $_ );
107
+ }
108
+ close( CACHE );
109
+ @targets;
110
+
111
+ }
112
+
113
+
114
+
cuda_toolkit/bin/compute-sanitizer.bat ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ @echo off
2
+ "%~dp0\..\compute-sanitizer\compute-sanitizer.exe" %*
cuda_toolkit/bin/envset.cmd ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+
3
+ Licensed to the Apache Software Foundation (ASF) under one or more
4
+ contributor license agreements. See the NOTICE file distributed with
5
+ this work for additional information regarding copyright ownership.
6
+ The ASF licenses this file to You under the Apache License, Version 2.0
7
+ (the "License"); you may not use this file except in compliance with
8
+ the License. You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+
18
+ SET environment variables
19
+ First optional parameter:
20
+ ; parameters are considered parts of a path variable, semicolons are
21
+ appended to each element if not already present
22
+ -D parameters are properties for Java or Makefile etc., -D will be
23
+ prepended and the parameters will be separated by a space
24
+ =D the same as above but equal sign is not required
25
+ , parameters should be comma separated in the environment variable
26
+ - parameters should be separated by the next parameter
27
+ Other values mean that the first parameter is missing and the environment
28
+ variable will be set to the space separated parameters
29
+
30
+ Second parameter: name of the environment variable
31
+
32
+ Next parameters: values
33
+ ; implies that the equal sign is considered a part of the parameter and is
34
+ not interpreted
35
+
36
+ -D requires parameters in the form name=value. If the equal sign is not found,
37
+ the parameters are changed to name=expanded_name
38
+
39
+ Other options have optional equal sign. If it is found, only the part after
40
+ the equal sign will be oprionally expanded.
41
+
42
+ If the parameter is the minus sign, the next parameter will not be expanded.
43
+ If the parameter is a single dot, it will be replaced with the value of the
44
+ environment variable as it existed before envset was invoked.
45
+
46
+ For other parameters the batch looks for the environment variable with the
47
+ same name (in uppercase). If it is found, it forms the expanded_name. If
48
+ the environment variable with such a name does not exist, the expanded_name
49
+ will hold the parameter name without case conversion.
50
+ */
51
+
52
+ parse arg mode envar args
53
+
54
+ equal = 0
55
+ sep = ' '
56
+
57
+ /* Parse command line parameters */
58
+ select
59
+ when mode='-' then do
60
+ sep = envar
61
+ parse var args envar args
62
+ end
63
+ when mode=';' then do
64
+ sep = ''
65
+ equal = -1
66
+ end
67
+ when mode='-D' then equal = 1
68
+ when mode='=D' then mode = '-D'
69
+ when mode=',' then sep = ','
70
+ otherwise
71
+ args = envar args
72
+ envar = mode
73
+ mode = ''
74
+ end
75
+
76
+ env = 'OS2ENVIRONMENT'
77
+ envar = translate(envar)
78
+ orig = value(envar,,env)
79
+ newval = ''
80
+ expand = 1
81
+
82
+ /* for each parameter... */
83
+ do i = 1 to words(args)
84
+ if expand > 0 & word(args, i) = '-' then expand = 0
85
+ else call addval word(args, i)
86
+ end
87
+
88
+ /* Optionally enclose path variable by quotes */
89
+ if mode = ';' & pos(' ', newval) > 0 then newval = '"' || newval || '"'
90
+
91
+ /* Set the new value, 'SET' cannot be used since it does not allow '=' */
92
+ x = value(envar, newval, env)
93
+ exit 0
94
+
95
+ addval: procedure expose sep equal orig expand newval mode env
96
+ parse arg var
97
+
98
+ if var = '.' then expvar = orig
99
+ else do
100
+ if equal >= 0 then do
101
+ parse var var name '=' val
102
+ if val = '' then var = name
103
+ else var = val
104
+ end
105
+ if expand = 0 then expvar = var
106
+ else expvar = value(translate(var),,env)
107
+ if expvar = '' then expvar = var
108
+ if equal >= 0 then do
109
+ if val = '' then do
110
+ parse var expvar key '=' val
111
+ if val <> '' then name = key
112
+ else do
113
+ if equal > 0 then val = key
114
+ else name = key
115
+ end
116
+ end
117
+ else val = expvar
118
+ if pos(' ', val) > 0 | pos('=', val) > 0 then val = '"' || val || '"'
119
+ if val = '' then expvar = name
120
+ else expvar = name || '=' || val
121
+ end
122
+ if mode = '-D' then expvar = '-D' || expvar
123
+ if mode = ';' then do
124
+ if right(expvar, 1) <> ';' then expvar = expvar || ';'
125
+ end
126
+ end
127
+
128
+ if newval = '' then newval = expvar
129
+ else newval = newval || sep || expvar
130
+ expand = 1
131
+ return
cuda_toolkit/bin/lcp.bat ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ REM
2
+ REM Licensed to the Apache Software Foundation (ASF) under one or more
3
+ REM contributor license agreements. See the NOTICE file distributed with
4
+ REM this work for additional information regarding copyright ownership.
5
+ REM The ASF licenses this file to You under the Apache License, Version 2.0
6
+ REM (the "License"); you may not use this file except in compliance with
7
+ REM the License. You may obtain a copy of the License at
8
+ REM
9
+ REM http://www.apache.org/licenses/LICENSE-2.0
10
+ REM
11
+ REM Unless required by applicable law or agreed to in writing, software
12
+ REM distributed under the License is distributed on an "AS IS" BASIS,
13
+ REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ REM See the License for the specific language governing permissions and
15
+ REM limitations under the License.
16
+ REM
17
+ REM
18
+
19
+ set _CLASSPATHCOMPONENT=%1
20
+ if ""%1""=="""" goto gotAllArgs
21
+ shift
22
+
23
+ :argCheck
24
+ if ""%1""=="""" goto gotAllArgs
25
+ set _CLASSPATHCOMPONENT=%_CLASSPATHCOMPONENT% %1
26
+ shift
27
+ goto argCheck
28
+
29
+ :gotAllArgs
30
+ set LOCALCLASSPATH=%LOCALCLASSPATH%;%_CLASSPATHCOMPONENT%
31
+
cuda_toolkit/bin/mouseLut.json ADDED
@@ -0,0 +1,1732 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "db": [
3
+ {
4
+ "actuationDetectionDurationUs": 0,
5
+ "adjustedAvgLmbLatencyUs": 16889,
6
+ "avgLmbLatencyUs": 16889,
7
+ "make": "Microsoft",
8
+ "mode": "none",
9
+ "model": "Basic Optical Mouse 2.0",
10
+ "perClickLatency": false,
11
+ "pid": "00cb",
12
+ "polledActuation": false,
13
+ "reportExtension": false,
14
+ "revision": "0100",
15
+ "vid": "045e"
16
+ },
17
+ {
18
+ "actuationDetectionDurationUs": 0,
19
+ "adjustedAvgLmbLatencyUs": 39752,
20
+ "avgLmbLatencyUs": 39752,
21
+ "make": "Microsoft",
22
+ "mode": "none",
23
+ "model": "Optical Mouse 200",
24
+ "perClickLatency": false,
25
+ "pid": "0797",
26
+ "polledActuation": false,
27
+ "reportExtension": false,
28
+ "revision": "0200",
29
+ "vid": "045e"
30
+ },
31
+ {
32
+ "actuationDetectionDurationUs": 0,
33
+ "adjustedAvgLmbLatencyUs": 4125,
34
+ "avgLmbLatencyUs": 4125,
35
+ "make": "Alienware",
36
+ "mode": "none",
37
+ "model": "AW610M (wired)",
38
+ "perClickLatency": true,
39
+ "pid": "4e9d",
40
+ "polledActuation": false,
41
+ "reportExtension": false,
42
+ "revision": "0308",
43
+ "vid": "0461"
44
+ },
45
+ {
46
+ "actuationDetectionDurationUs": 0,
47
+ "adjustedAvgLmbLatencyUs": 4543,
48
+ "avgLmbLatencyUs": 4543,
49
+ "make": "Alienware",
50
+ "mode": "none",
51
+ "model": "AW610M (wireless)",
52
+ "perClickLatency": true,
53
+ "pid": "4ec0",
54
+ "polledActuation": false,
55
+ "reportExtension": false,
56
+ "revision": "0303",
57
+ "vid": "0461"
58
+ },
59
+ {
60
+ "actuationDetectionDurationUs": 0,
61
+ "adjustedAvgLmbLatencyUs": 1843,
62
+ "avgLmbLatencyUs": 1843,
63
+ "make": "Logitech G",
64
+ "mode": "wireless",
65
+ "model": "PRO X SUPERLIGHT (wireless)",
66
+ "perClickLatency": false,
67
+ "pid": "4093",
68
+ "polledActuation": false,
69
+ "reportExtension": true,
70
+ "revision": "0000",
71
+ "vid": "046d"
72
+ },
73
+ {
74
+ "actuationDetectionDurationUs": 0,
75
+ "adjustedAvgLmbLatencyUs": 2919,
76
+ "avgLmbLatencyUs": 2919,
77
+ "make": "Logitech G",
78
+ "mode": "none",
79
+ "model": "G403",
80
+ "perClickLatency": false,
81
+ "pid": "c083",
82
+ "polledActuation": false,
83
+ "reportExtension": false,
84
+ "revision": "0801",
85
+ "vid": "046d"
86
+ },
87
+ {
88
+ "actuationDetectionDurationUs": 0,
89
+ "adjustedAvgLmbLatencyUs": 3179,
90
+ "avgLmbLatencyUs": 3179,
91
+ "make": "Logitech G",
92
+ "mode": "none",
93
+ "model": "G203",
94
+ "perClickLatency": false,
95
+ "pid": "c084",
96
+ "polledActuation": false,
97
+ "reportExtension": false,
98
+ "revision": "0703",
99
+ "vid": "046d"
100
+ },
101
+ {
102
+ "actuationDetectionDurationUs": 0,
103
+ "adjustedAvgLmbLatencyUs": 3025,
104
+ "avgLmbLatencyUs": 3025,
105
+ "make": "Logitech G",
106
+ "mode": "none",
107
+ "model": "PRO",
108
+ "perClickLatency": false,
109
+ "pid": "c085",
110
+ "polledActuation": false,
111
+ "reportExtension": false,
112
+ "revision": "1002",
113
+ "vid": "046d"
114
+ },
115
+ {
116
+ "actuationDetectionDurationUs": 0,
117
+ "adjustedAvgLmbLatencyUs": 2562,
118
+ "avgLmbLatencyUs": 2562,
119
+ "make": "Logitech G",
120
+ "mode": "none",
121
+ "model": "PRO Wireless Ghost White (wired), PRO Wireless Easter Pink (wired), PRO Wireless Black (wired)",
122
+ "perClickLatency": false,
123
+ "pid": "c088",
124
+ "polledActuation": false,
125
+ "reportExtension": false,
126
+ "revision": "1502",
127
+ "vid": "046d"
128
+ },
129
+ {
130
+ "actuationDetectionDurationUs": 0,
131
+ "adjustedAvgLmbLatencyUs": 2523,
132
+ "avgLmbLatencyUs": 2537,
133
+ "make": "Logitech G",
134
+ "mode": "none",
135
+ "model": "PRO Wireless Ghost White (wired), PRO Wireless Easter Pink (wired), PRO Wireless Black (wired)",
136
+ "perClickLatency": true,
137
+ "pid": "c088",
138
+ "polledActuation": false,
139
+ "reportExtension": false,
140
+ "revision": "1510",
141
+ "vid": "046d"
142
+ },
143
+ {
144
+ "actuationDetectionDurationUs": 0,
145
+ "adjustedAvgLmbLatencyUs": 2497,
146
+ "avgLmbLatencyUs": 2497,
147
+ "make": "Logitech G",
148
+ "mode": "none",
149
+ "model": "G502",
150
+ "perClickLatency": false,
151
+ "pid": "c08b",
152
+ "polledActuation": false,
153
+ "reportExtension": false,
154
+ "revision": "2702",
155
+ "vid": "046d"
156
+ },
157
+ {
158
+ "actuationDetectionDurationUs": 0,
159
+ "adjustedAvgLmbLatencyUs": 2554,
160
+ "avgLmbLatencyUs": 2554,
161
+ "make": "Logitech G",
162
+ "mode": "none",
163
+ "model": "PRO",
164
+ "perClickLatency": false,
165
+ "pid": "c08c",
166
+ "polledActuation": false,
167
+ "reportExtension": false,
168
+ "revision": "2801",
169
+ "vid": "046d"
170
+ },
171
+ {
172
+ "actuationDetectionDurationUs": 0,
173
+ "adjustedAvgLmbLatencyUs": 2527,
174
+ "avgLmbLatencyUs": 2527,
175
+ "make": "Logitech G",
176
+ "mode": "none",
177
+ "model": "502 Lightspeed (wired)",
178
+ "perClickLatency": false,
179
+ "pid": "c08d",
180
+ "polledActuation": false,
181
+ "reportExtension": false,
182
+ "revision": "1700",
183
+ "vid": "046d"
184
+ },
185
+ {
186
+ "actuationDetectionDurationUs": 0,
187
+ "adjustedAvgLmbLatencyUs": 2809,
188
+ "avgLmbLatencyUs": 2809,
189
+ "make": "Logitech G",
190
+ "mode": "none",
191
+ "model": "MX518",
192
+ "perClickLatency": false,
193
+ "pid": "c08e",
194
+ "polledActuation": false,
195
+ "reportExtension": false,
196
+ "revision": "4000",
197
+ "vid": "046d"
198
+ },
199
+ {
200
+ "actuationDetectionDurationUs": 0,
201
+ "adjustedAvgLmbLatencyUs": 2562,
202
+ "avgLmbLatencyUs": 2562,
203
+ "make": "Logitech G",
204
+ "mode": "none",
205
+ "model": "403 Hero",
206
+ "perClickLatency": false,
207
+ "pid": "c08f",
208
+ "polledActuation": false,
209
+ "reportExtension": false,
210
+ "revision": "4501",
211
+ "vid": "046d"
212
+ },
213
+ {
214
+ "actuationDetectionDurationUs": 0,
215
+ "adjustedAvgLmbLatencyUs": 2537,
216
+ "avgLmbLatencyUs": 2537,
217
+ "make": "Logitech G",
218
+ "mode": "none",
219
+ "model": "703 Lightspeed (wired)",
220
+ "perClickLatency": false,
221
+ "pid": "c090",
222
+ "polledActuation": false,
223
+ "reportExtension": false,
224
+ "revision": "2202",
225
+ "vid": "046d"
226
+ },
227
+ {
228
+ "actuationDetectionDurationUs": 0,
229
+ "adjustedAvgLmbLatencyUs": 2516,
230
+ "avgLmbLatencyUs": 2516,
231
+ "make": "Logitech G",
232
+ "mode": "none",
233
+ "model": "903 Lightspeed (wired)",
234
+ "perClickLatency": false,
235
+ "pid": "c091",
236
+ "polledActuation": false,
237
+ "reportExtension": false,
238
+ "revision": "2301",
239
+ "vid": "046d"
240
+ },
241
+ {
242
+ "actuationDetectionDurationUs": 0,
243
+ "adjustedAvgLmbLatencyUs": 808,
244
+ "avgLmbLatencyUs": 808,
245
+ "make": "Logitech G",
246
+ "mode": "none",
247
+ "model": "PRO X SUPERLIGHT (wired)",
248
+ "perClickLatency": true,
249
+ "pid": "c094",
250
+ "polledActuation": false,
251
+ "reportExtension": false,
252
+ "revision": "2500",
253
+ "vid": "046d"
254
+ },
255
+ {
256
+ "actuationDetectionDurationUs": 0,
257
+ "adjustedAvgLmbLatencyUs": 831,
258
+ "avgLmbLatencyUs": 831,
259
+ "make": "Logitech",
260
+ "mode": "none",
261
+ "model": "G PRO X SUPERLIGHT",
262
+ "perClickLatency": true,
263
+ "pid": "c094",
264
+ "polledActuation": false,
265
+ "reportExtension": false,
266
+ "revision": "2501",
267
+ "vid": "046d"
268
+ },
269
+ {
270
+ "actuationDetectionDurationUs": 0,
271
+ "adjustedAvgLmbLatencyUs": 834,
272
+ "avgLmbLatencyUs": 834,
273
+ "make": "Logitech",
274
+ "mode": "none",
275
+ "model": "G303 SHROUD EDITION",
276
+ "perClickLatency": true,
277
+ "pid": "c097",
278
+ "polledActuation": false,
279
+ "reportExtension": false,
280
+ "revision": "2900",
281
+ "vid": "046d"
282
+ },
283
+ {
284
+ "actuationDetectionDurationUs": 0,
285
+ "adjustedAvgLmbLatencyUs": 1169,
286
+ "avgLmbLatencyUs": 1169,
287
+ "make": "Logitech",
288
+ "mode": "none",
289
+ "model": "G303 SHROUD EDITION",
290
+ "perClickLatency": false,
291
+ "pid": "c547",
292
+ "polledActuation": false,
293
+ "reportExtension": false,
294
+ "revision": "0402",
295
+ "vid": "046d"
296
+ },
297
+ {
298
+ "actuationDetectionDurationUs": 0,
299
+ "adjustedAvgLmbLatencyUs": 7237,
300
+ "avgLmbLatencyUs": 7658,
301
+ "make": "Zowie",
302
+ "mode": "none",
303
+ "model": "EC2-B Divina Edition, EC2-B, S2 Divina, EC2 Tyloo Edition, S1 Divina",
304
+ "perClickLatency": false,
305
+ "pid": "8001",
306
+ "polledActuation": false,
307
+ "reportExtension": false,
308
+ "revision": "0020",
309
+ "vid": "04a5"
310
+ },
311
+ {
312
+ "actuationDetectionDurationUs": 0,
313
+ "adjustedAvgLmbLatencyUs": 6132,
314
+ "avgLmbLatencyUs": 6595,
315
+ "make": "Finalmouse",
316
+ "mode": "none",
317
+ "model": "Ultralight Phantom, Air58 Ninja CBB, Ultralight 2 Cape Town, Ninja Air58 CBR",
318
+ "perClickLatency": false,
319
+ "pid": "ad50",
320
+ "polledActuation": false,
321
+ "reportExtension": false,
322
+ "revision": "0100",
323
+ "vid": "04d9"
324
+ },
325
+ {
326
+ "actuationDetectionDurationUs": 0,
327
+ "adjustedAvgLmbLatencyUs": 8380,
328
+ "avgLmbLatencyUs": 8380,
329
+ "make": "HyperX",
330
+ "mode": "none",
331
+ "model": "Pulsefire FPS",
332
+ "perClickLatency": false,
333
+ "pid": "16bc",
334
+ "polledActuation": false,
335
+ "reportExtension": false,
336
+ "revision": "0007",
337
+ "vid": "0951"
338
+ },
339
+ {
340
+ "actuationDetectionDurationUs": 0,
341
+ "adjustedAvgLmbLatencyUs": 5748,
342
+ "avgLmbLatencyUs": 5748,
343
+ "make": "HyperX",
344
+ "mode": "none",
345
+ "model": "PulseFire Haste",
346
+ "perClickLatency": true,
347
+ "pid": "1727",
348
+ "polledActuation": false,
349
+ "reportExtension": false,
350
+ "revision": "0110",
351
+ "vid": "0951"
352
+ },
353
+ {
354
+ "actuationDetectionDurationUs": 0,
355
+ "adjustedAvgLmbLatencyUs": 1309,
356
+ "avgLmbLatencyUs": 1309,
357
+ "make": "ASUS",
358
+ "mode": "none",
359
+ "model": "ROG Chakram (wired)",
360
+ "perClickLatency": true,
361
+ "pid": "18e3",
362
+ "polledActuation": false,
363
+ "reportExtension": false,
364
+ "revision": "0131",
365
+ "vid": "0b05"
366
+ },
367
+ {
368
+ "actuationDetectionDurationUs": 0,
369
+ "adjustedAvgLmbLatencyUs": 2115,
370
+ "avgLmbLatencyUs": 2115,
371
+ "make": "ASUS",
372
+ "mode": "none",
373
+ "model": "ROG Chakram (wired)",
374
+ "perClickLatency": false,
375
+ "pid": "18e3",
376
+ "polledActuation": false,
377
+ "reportExtension": false,
378
+ "revision": "0928",
379
+ "vid": "0b05"
380
+ },
381
+ {
382
+ "actuationDetectionDurationUs": 0,
383
+ "adjustedAvgLmbLatencyUs": 2440,
384
+ "avgLmbLatencyUs": 2440,
385
+ "make": "ASUS",
386
+ "mode": "none",
387
+ "model": "ROG Chakram (wireless)",
388
+ "perClickLatency": false,
389
+ "pid": "18e5",
390
+ "polledActuation": false,
391
+ "reportExtension": true,
392
+ "revision": "0131",
393
+ "vid": "0b05"
394
+ },
395
+ {
396
+ "actuationDetectionDurationUs": 0,
397
+ "adjustedAvgLmbLatencyUs": 2993,
398
+ "avgLmbLatencyUs": 2993,
399
+ "make": "ASUS",
400
+ "mode": "none",
401
+ "model": "ROG Chakram (wireless)",
402
+ "perClickLatency": false,
403
+ "pid": "18e5",
404
+ "polledActuation": false,
405
+ "reportExtension": true,
406
+ "revision": "0930",
407
+ "vid": "0b05"
408
+ },
409
+ {
410
+ "actuationDetectionDurationUs": 0,
411
+ "adjustedAvgLmbLatencyUs": 616,
412
+ "avgLmbLatencyUs": 616,
413
+ "make": "ASUS",
414
+ "mode": "none",
415
+ "model": "ROG Chakram Core",
416
+ "perClickLatency": true,
417
+ "pid": "1958",
418
+ "polledActuation": false,
419
+ "reportExtension": false,
420
+ "revision": "0108",
421
+ "vid": "0b05"
422
+ },
423
+ {
424
+ "actuationDetectionDurationUs": 0,
425
+ "adjustedAvgLmbLatencyUs": 659,
426
+ "avgLmbLatencyUs": 659,
427
+ "make": "ASUS",
428
+ "mode": "none",
429
+ "model": "ROG Keris",
430
+ "perClickLatency": true,
431
+ "pid": "195c",
432
+ "polledActuation": false,
433
+ "reportExtension": false,
434
+ "revision": "0108",
435
+ "vid": "0b05"
436
+ },
437
+ {
438
+ "actuationDetectionDurationUs": 0,
439
+ "adjustedAvgLmbLatencyUs": 1250,
440
+ "avgLmbLatencyUs": 1250,
441
+ "make": "ASUS",
442
+ "mode": "none",
443
+ "model": "ROG Keris Wireless (wired)",
444
+ "perClickLatency": true,
445
+ "pid": "195e",
446
+ "polledActuation": false,
447
+ "reportExtension": false,
448
+ "revision": "0113",
449
+ "vid": "0b05"
450
+ },
451
+ {
452
+ "actuationDetectionDurationUs": 0,
453
+ "adjustedAvgLmbLatencyUs": 2252,
454
+ "avgLmbLatencyUs": 2252,
455
+ "make": "ASUS",
456
+ "mode": "none",
457
+ "model": "ROG Keris Wireless",
458
+ "perClickLatency": false,
459
+ "pid": "1960",
460
+ "polledActuation": false,
461
+ "reportExtension": true,
462
+ "revision": "0203",
463
+ "vid": "0b05"
464
+ },
465
+ {
466
+ "actuationDetectionDurationUs": 0,
467
+ "adjustedAvgLmbLatencyUs": 1409,
468
+ "avgLmbLatencyUs": 1409,
469
+ "make": "ASUS",
470
+ "mode": "none",
471
+ "model": "ROG Spatha X (Wired)",
472
+ "perClickLatency": true,
473
+ "pid": "1977",
474
+ "polledActuation": false,
475
+ "reportExtension": false,
476
+ "revision": "0117",
477
+ "vid": "0b05"
478
+ },
479
+ {
480
+ "actuationDetectionDurationUs": 0,
481
+ "adjustedAvgLmbLatencyUs": 9213,
482
+ "avgLmbLatencyUs": 9213,
483
+ "make": "ASUS",
484
+ "mode": "none",
485
+ "model": "ROG Spatha X (Wireless)",
486
+ "perClickLatency": false,
487
+ "pid": "1979",
488
+ "polledActuation": false,
489
+ "reportExtension": false,
490
+ "revision": "0119",
491
+ "vid": "0b05"
492
+ },
493
+ {
494
+ "actuationDetectionDurationUs": 0,
495
+ "adjustedAvgLmbLatencyUs": 626,
496
+ "avgLmbLatencyUs": 626,
497
+ "make": "ASUS",
498
+ "mode": "none",
499
+ "model": "ROG Gladius III ",
500
+ "perClickLatency": true,
501
+ "pid": "197b",
502
+ "polledActuation": false,
503
+ "reportExtension": false,
504
+ "revision": "0116",
505
+ "vid": "0b05"
506
+ },
507
+ {
508
+ "actuationDetectionDurationUs": 0,
509
+ "adjustedAvgLmbLatencyUs": 1394,
510
+ "avgLmbLatencyUs": 1394,
511
+ "make": "ASUS",
512
+ "mode": "none",
513
+ "model": "ROG Gladius III Wireless (Wired)",
514
+ "perClickLatency": true,
515
+ "pid": "197d",
516
+ "polledActuation": false,
517
+ "reportExtension": false,
518
+ "revision": "0120",
519
+ "vid": "0b05"
520
+ },
521
+ {
522
+ "actuationDetectionDurationUs": 0,
523
+ "adjustedAvgLmbLatencyUs": 3194,
524
+ "avgLmbLatencyUs": 3194,
525
+ "make": "ASUS",
526
+ "mode": "none",
527
+ "model": "ROG Gladius III Wireless (Wireless)",
528
+ "perClickLatency": false,
529
+ "pid": "197f",
530
+ "polledActuation": false,
531
+ "reportExtension": false,
532
+ "revision": "0121",
533
+ "vid": "0b05"
534
+ },
535
+ {
536
+ "actuationDetectionDurationUs": 0,
537
+ "adjustedAvgLmbLatencyUs": 181,
538
+ "avgLmbLatencyUs": 181,
539
+ "make": "Asus",
540
+ "mode": "none",
541
+ "model": "ROG Chakram X",
542
+ "perClickLatency": true,
543
+ "pid": "1a18",
544
+ "polledActuation": false,
545
+ "reportExtension": false,
546
+ "revision": "0211",
547
+ "vid": "0b05"
548
+ },
549
+ {
550
+ "actuationDetectionDurationUs": 0,
551
+ "adjustedAvgLmbLatencyUs": 8482,
552
+ "avgLmbLatencyUs": 8482,
553
+ "make": "Asus",
554
+ "mode": "none",
555
+ "model": "ROG Chakram X",
556
+ "perClickLatency": false,
557
+ "pid": "1a1a",
558
+ "polledActuation": false,
559
+ "reportExtension": false,
560
+ "revision": "0110",
561
+ "vid": "0b05"
562
+ },
563
+ {
564
+ "actuationDetectionDurationUs": 0,
565
+ "adjustedAvgLmbLatencyUs": 18801,
566
+ "avgLmbLatencyUs": 18801,
567
+ "make": "MSI",
568
+ "mode": "none",
569
+ "model": "Clutch GM08",
570
+ "perClickLatency": false,
571
+ "pid": "0d08",
572
+ "polledActuation": false,
573
+ "reportExtension": false,
574
+ "revision": "0100",
575
+ "vid": "0db0"
576
+ },
577
+ {
578
+ "actuationDetectionDurationUs": 0,
579
+ "adjustedAvgLmbLatencyUs": 1710,
580
+ "avgLmbLatencyUs": 1710,
581
+ "make": "MSI",
582
+ "mode": "none",
583
+ "model": "GM11",
584
+ "perClickLatency": false,
585
+ "pid": "0d11",
586
+ "polledActuation": false,
587
+ "reportExtension": false,
588
+ "revision": "0309",
589
+ "vid": "0db0"
590
+ },
591
+ {
592
+ "actuationDetectionDurationUs": 0,
593
+ "adjustedAvgLmbLatencyUs": 10781,
594
+ "avgLmbLatencyUs": 10781,
595
+ "make": "MSI",
596
+ "mode": "none",
597
+ "model": "Clutch GM20 Elite",
598
+ "perClickLatency": false,
599
+ "pid": "0d2e",
600
+ "polledActuation": false,
601
+ "reportExtension": false,
602
+ "revision": "0108",
603
+ "vid": "0db0"
604
+ },
605
+ {
606
+ "actuationDetectionDurationUs": 0,
607
+ "adjustedAvgLmbLatencyUs": 8416,
608
+ "avgLmbLatencyUs": 8416,
609
+ "make": "MSI",
610
+ "mode": "none",
611
+ "model": "Clutch GM30",
612
+ "perClickLatency": false,
613
+ "pid": "0d30",
614
+ "polledActuation": false,
615
+ "reportExtension": false,
616
+ "revision": "0210",
617
+ "vid": "0db0"
618
+ },
619
+ {
620
+ "actuationDetectionDurationUs": 0,
621
+ "adjustedAvgLmbLatencyUs": 4348,
622
+ "avgLmbLatencyUs": 4348,
623
+ "make": "MSI",
624
+ "mode": "none",
625
+ "model": "GM41",
626
+ "perClickLatency": true,
627
+ "pid": "0d41",
628
+ "polledActuation": false,
629
+ "reportExtension": false,
630
+ "revision": "0210",
631
+ "vid": "0db0"
632
+ },
633
+ {
634
+ "actuationDetectionDurationUs": 0,
635
+ "adjustedAvgLmbLatencyUs": 4191,
636
+ "avgLmbLatencyUs": 4191,
637
+ "make": "MSI",
638
+ "mode": "none",
639
+ "model": "Clutch GM41 Lightweight Wireless (wired)",
640
+ "perClickLatency": true,
641
+ "pid": "0d4b",
642
+ "polledActuation": false,
643
+ "reportExtension": false,
644
+ "revision": "0091",
645
+ "vid": "0db0"
646
+ },
647
+ {
648
+ "actuationDetectionDurationUs": 0,
649
+ "adjustedAvgLmbLatencyUs": 4080,
650
+ "avgLmbLatencyUs": 4080,
651
+ "make": "MSI",
652
+ "mode": "none",
653
+ "model": "Clutch GM41 Lightweight Wireless (wired)",
654
+ "perClickLatency": true,
655
+ "pid": "0d4b",
656
+ "polledActuation": false,
657
+ "reportExtension": false,
658
+ "revision": "0092",
659
+ "vid": "0db0"
660
+ },
661
+ {
662
+ "actuationDetectionDurationUs": 0,
663
+ "adjustedAvgLmbLatencyUs": 4354,
664
+ "avgLmbLatencyUs": 4354,
665
+ "make": "MSI",
666
+ "mode": "none",
667
+ "model": "Clutch GM41 Lightweight Wireless (wireless)",
668
+ "perClickLatency": true,
669
+ "pid": "0d4c",
670
+ "polledActuation": false,
671
+ "reportExtension": false,
672
+ "revision": "0091",
673
+ "vid": "0db0"
674
+ },
675
+ {
676
+ "actuationDetectionDurationUs": 0,
677
+ "adjustedAvgLmbLatencyUs": 4533,
678
+ "avgLmbLatencyUs": 4533,
679
+ "make": "MSI",
680
+ "mode": "none",
681
+ "model": "Clutch GM41 Lightweight Wireless (wireless)",
682
+ "perClickLatency": true,
683
+ "pid": "0d4c",
684
+ "polledActuation": false,
685
+ "reportExtension": false,
686
+ "revision": "0092",
687
+ "vid": "0db0"
688
+ },
689
+ {
690
+ "actuationDetectionDurationUs": 0,
691
+ "adjustedAvgLmbLatencyUs": 13592,
692
+ "avgLmbLatencyUs": 13592,
693
+ "make": "MSI",
694
+ "mode": "none",
695
+ "model": "Clutch GM50",
696
+ "perClickLatency": false,
697
+ "pid": "0d50",
698
+ "polledActuation": false,
699
+ "reportExtension": false,
700
+ "revision": "0132",
701
+ "vid": "0db0"
702
+ },
703
+ {
704
+ "actuationDetectionDurationUs": 0,
705
+ "adjustedAvgLmbLatencyUs": 8790,
706
+ "avgLmbLatencyUs": 8790,
707
+ "make": "SteelSeries",
708
+ "mode": "none",
709
+ "model": "Rival 300",
710
+ "perClickLatency": false,
711
+ "pid": "1710",
712
+ "polledActuation": false,
713
+ "reportExtension": false,
714
+ "revision": "0024",
715
+ "vid": "1038"
716
+ },
717
+ {
718
+ "actuationDetectionDurationUs": 0,
719
+ "adjustedAvgLmbLatencyUs": 8542,
720
+ "avgLmbLatencyUs": 8542,
721
+ "make": "Steelseries",
722
+ "mode": "none",
723
+ "model": "Rival 600",
724
+ "perClickLatency": false,
725
+ "pid": "1724",
726
+ "polledActuation": false,
727
+ "reportExtension": false,
728
+ "revision": "0233",
729
+ "vid": "1038"
730
+ },
731
+ {
732
+ "actuationDetectionDurationUs": 0,
733
+ "adjustedAvgLmbLatencyUs": 5123,
734
+ "avgLmbLatencyUs": 5123,
735
+ "make": "SteelSeries",
736
+ "mode": "none",
737
+ "model": "Rival 3",
738
+ "perClickLatency": true,
739
+ "pid": "184c",
740
+ "polledActuation": false,
741
+ "reportExtension": false,
742
+ "revision": "0025",
743
+ "vid": "1038"
744
+ },
745
+ {
746
+ "actuationDetectionDurationUs": 0,
747
+ "adjustedAvgLmbLatencyUs": 3108,
748
+ "avgLmbLatencyUs": 3108,
749
+ "make": "SteelSeries",
750
+ "mode": "none",
751
+ "model": "Rival 3",
752
+ "perClickLatency": true,
753
+ "pid": "eeee",
754
+ "polledActuation": false,
755
+ "reportExtension": false,
756
+ "revision": "00ee",
757
+ "vid": "1038"
758
+ },
759
+ {
760
+ "actuationDetectionDurationUs": 0,
761
+ "adjustedAvgLmbLatencyUs": 0,
762
+ "avgLmbLatencyUs": 0,
763
+ "make": "NVIDIA LUT Version",
764
+ "mode": "none",
765
+ "model": "v1.0.6 4-26-2022",
766
+ "perClickLatency": true,
767
+ "pid": "0000",
768
+ "polledActuation": true,
769
+ "reportExtension": true,
770
+ "revision": "0000",
771
+ "vid": "10de"
772
+ },
773
+ {
774
+ "actuationDetectionDurationUs": 0,
775
+ "adjustedAvgLmbLatencyUs": 10150,
776
+ "avgLmbLatencyUs": 10150,
777
+ "make": "Razer",
778
+ "mode": "none",
779
+ "model": "Deathadder Elite",
780
+ "perClickLatency": false,
781
+ "pid": "005c",
782
+ "polledActuation": false,
783
+ "reportExtension": false,
784
+ "revision": "0200",
785
+ "vid": "1532"
786
+ },
787
+ {
788
+ "actuationDetectionDurationUs": 0,
789
+ "adjustedAvgLmbLatencyUs": 841,
790
+ "avgLmbLatencyUs": 841,
791
+ "make": "Razer",
792
+ "mode": "none",
793
+ "model": "Viper Ultimate (Wired)",
794
+ "perClickLatency": true,
795
+ "pid": "007a",
796
+ "polledActuation": false,
797
+ "reportExtension": false,
798
+ "revision": "0100",
799
+ "vid": "1532"
800
+ },
801
+ {
802
+ "actuationDetectionDurationUs": 0,
803
+ "adjustedAvgLmbLatencyUs": 1400,
804
+ "avgLmbLatencyUs": 1400,
805
+ "make": "Razer",
806
+ "mode": "none",
807
+ "model": "Deathadder V2 Pro (wired)",
808
+ "perClickLatency": true,
809
+ "pid": "007c",
810
+ "polledActuation": false,
811
+ "reportExtension": false,
812
+ "revision": "0100",
813
+ "vid": "1532"
814
+ },
815
+ {
816
+ "actuationDetectionDurationUs": 0,
817
+ "adjustedAvgLmbLatencyUs": 1587,
818
+ "avgLmbLatencyUs": 1587,
819
+ "make": "Razer",
820
+ "mode": "none",
821
+ "model": "Deathadder V2 Pro (wireless)",
822
+ "perClickLatency": false,
823
+ "pid": "007d",
824
+ "polledActuation": false,
825
+ "reportExtension": false,
826
+ "revision": "0100",
827
+ "vid": "1532"
828
+ },
829
+ {
830
+ "actuationDetectionDurationUs": 0,
831
+ "adjustedAvgLmbLatencyUs": 2905,
832
+ "avgLmbLatencyUs": 2905,
833
+ "make": "Razer",
834
+ "mode": "none",
835
+ "model": "Viper Ultimate (Wireless)",
836
+ "perClickLatency": false,
837
+ "pid": "007e",
838
+ "polledActuation": false,
839
+ "reportExtension": false,
840
+ "revision": "0200",
841
+ "vid": "1532"
842
+ },
843
+ {
844
+ "actuationDetectionDurationUs": 0,
845
+ "adjustedAvgLmbLatencyUs": 710,
846
+ "avgLmbLatencyUs": 710,
847
+ "make": "Razer",
848
+ "mode": "none",
849
+ "model": "DeathAdder V2",
850
+ "perClickLatency": true,
851
+ "pid": "0084",
852
+ "polledActuation": false,
853
+ "reportExtension": false,
854
+ "revision": "0200",
855
+ "vid": "1532"
856
+ },
857
+ {
858
+ "actuationDetectionDurationUs": 0,
859
+ "adjustedAvgLmbLatencyUs": 926,
860
+ "avgLmbLatencyUs": 926,
861
+ "make": "Razer",
862
+ "mode": "none",
863
+ "model": "Basilisk Ultimate (Wired)",
864
+ "perClickLatency": true,
865
+ "pid": "0086",
866
+ "polledActuation": false,
867
+ "reportExtension": false,
868
+ "revision": "0100",
869
+ "vid": "1532"
870
+ },
871
+ {
872
+ "actuationDetectionDurationUs": 0,
873
+ "adjustedAvgLmbLatencyUs": 2530,
874
+ "avgLmbLatencyUs": 2530,
875
+ "make": "Razer",
876
+ "mode": "none",
877
+ "model": "Basilisk Ultimate (Wireless)",
878
+ "perClickLatency": false,
879
+ "pid": "0088",
880
+ "polledActuation": false,
881
+ "reportExtension": false,
882
+ "revision": "0200",
883
+ "vid": "1532"
884
+ },
885
+ {
886
+ "actuationDetectionDurationUs": 0,
887
+ "adjustedAvgLmbLatencyUs": 844,
888
+ "avgLmbLatencyUs": 844,
889
+ "make": "Razer",
890
+ "mode": "none",
891
+ "model": "VIPER MINI",
892
+ "perClickLatency": false,
893
+ "pid": "008a",
894
+ "polledActuation": false,
895
+ "reportExtension": false,
896
+ "revision": "0200",
897
+ "vid": "1532"
898
+ },
899
+ {
900
+ "actuationDetectionDurationUs": 0,
901
+ "adjustedAvgLmbLatencyUs": 724,
902
+ "avgLmbLatencyUs": 724,
903
+ "make": "Razer",
904
+ "mode": "none",
905
+ "model": "NAGA X",
906
+ "perClickLatency": false,
907
+ "pid": "0096",
908
+ "polledActuation": false,
909
+ "reportExtension": false,
910
+ "revision": "0200",
911
+ "vid": "1532"
912
+ },
913
+ {
914
+ "actuationDetectionDurationUs": 0,
915
+ "adjustedAvgLmbLatencyUs": 10067,
916
+ "avgLmbLatencyUs": 10364,
917
+ "make": "Zowie",
918
+ "mode": "none",
919
+ "model": "EC1-A White, EC1-A, EC2-A, FK1, FK2 White, FK2, ZA12, EC1-B",
920
+ "perClickLatency": false,
921
+ "pid": "0001",
922
+ "polledActuation": false,
923
+ "reportExtension": false,
924
+ "revision": "0001",
925
+ "vid": "1af3"
926
+ },
927
+ {
928
+ "actuationDetectionDurationUs": 0,
929
+ "adjustedAvgLmbLatencyUs": 1367,
930
+ "avgLmbLatencyUs": 1367,
931
+ "make": "CORSAIR",
932
+ "mode": "none",
933
+ "model": "M65 RGB ELITE",
934
+ "perClickLatency": true,
935
+ "pid": "1b5a",
936
+ "polledActuation": false,
937
+ "reportExtension": false,
938
+ "revision": "0341",
939
+ "vid": "1b1c"
940
+ },
941
+ {
942
+ "actuationDetectionDurationUs": 0,
943
+ "adjustedAvgLmbLatencyUs": 1368,
944
+ "avgLmbLatencyUs": 1368,
945
+ "make": "CORSAIR",
946
+ "mode": "none",
947
+ "model": "NIGHTSWORD RGB",
948
+ "perClickLatency": true,
949
+ "pid": "1b5c",
950
+ "polledActuation": false,
951
+ "reportExtension": false,
952
+ "revision": "0341",
953
+ "vid": "1b1c"
954
+ },
955
+ {
956
+ "actuationDetectionDurationUs": 0,
957
+ "adjustedAvgLmbLatencyUs": 573,
958
+ "avgLmbLatencyUs": 573,
959
+ "make": "Corsair",
960
+ "mode": "none",
961
+ "model": "CHAMPION SERIES SABRE RGB PRO",
962
+ "perClickLatency": true,
963
+ "pid": "1b79",
964
+ "polledActuation": false,
965
+ "reportExtension": false,
966
+ "revision": "0109",
967
+ "vid": "1b1c"
968
+ },
969
+ {
970
+ "actuationDetectionDurationUs": 0,
971
+ "adjustedAvgLmbLatencyUs": 609,
972
+ "avgLmbLatencyUs": 609,
973
+ "make": "Corsair",
974
+ "mode": "none",
975
+ "model": "CHAMPION SERIES SABRE PRO",
976
+ "perClickLatency": true,
977
+ "pid": "1b7a",
978
+ "polledActuation": false,
979
+ "reportExtension": false,
980
+ "revision": "0109",
981
+ "vid": "1b1c"
982
+ },
983
+ {
984
+ "actuationDetectionDurationUs": 0,
985
+ "adjustedAvgLmbLatencyUs": 648,
986
+ "avgLmbLatencyUs": 648,
987
+ "make": "Corsair",
988
+ "mode": "none",
989
+ "model": "Dark Core RGB PRO SE (wired)",
990
+ "perClickLatency": true,
991
+ "pid": "1b7e",
992
+ "polledActuation": false,
993
+ "reportExtension": false,
994
+ "revision": "0207",
995
+ "vid": "1b1c"
996
+ },
997
+ {
998
+ "actuationDetectionDurationUs": 0,
999
+ "adjustedAvgLmbLatencyUs": 715,
1000
+ "avgLmbLatencyUs": 715,
1001
+ "make": "Corsair",
1002
+ "mode": "none",
1003
+ "model": "Dark Core RGB PRO SE (wired)",
1004
+ "perClickLatency": true,
1005
+ "pid": "1b7e",
1006
+ "polledActuation": false,
1007
+ "reportExtension": false,
1008
+ "revision": "0500",
1009
+ "vid": "1b1c"
1010
+ },
1011
+ {
1012
+ "actuationDetectionDurationUs": 0,
1013
+ "adjustedAvgLmbLatencyUs": 1220,
1014
+ "avgLmbLatencyUs": 1220,
1015
+ "make": "Corsair",
1016
+ "mode": "none",
1017
+ "model": "Dark Core RGB PRO SE (wireless)",
1018
+ "perClickLatency": true,
1019
+ "pid": "1b7f",
1020
+ "polledActuation": false,
1021
+ "reportExtension": false,
1022
+ "revision": "0204",
1023
+ "vid": "1b1c"
1024
+ },
1025
+ {
1026
+ "actuationDetectionDurationUs": 0,
1027
+ "adjustedAvgLmbLatencyUs": 1186,
1028
+ "avgLmbLatencyUs": 1186,
1029
+ "make": "Corsair",
1030
+ "mode": "none",
1031
+ "model": "Dark Core RGB PRO SE (wireless)",
1032
+ "perClickLatency": true,
1033
+ "pid": "1b7f",
1034
+ "polledActuation": false,
1035
+ "reportExtension": false,
1036
+ "revision": "0500",
1037
+ "vid": "1b1c"
1038
+ },
1039
+ {
1040
+ "actuationDetectionDurationUs": 0,
1041
+ "adjustedAvgLmbLatencyUs": 648,
1042
+ "avgLmbLatencyUs": 648,
1043
+ "make": "Corsair",
1044
+ "mode": "none",
1045
+ "model": "Dark Core RGB Pro (wired)",
1046
+ "perClickLatency": true,
1047
+ "pid": "1b80",
1048
+ "polledActuation": false,
1049
+ "reportExtension": false,
1050
+ "revision": "0207",
1051
+ "vid": "1b1c"
1052
+ },
1053
+ {
1054
+ "actuationDetectionDurationUs": 0,
1055
+ "adjustedAvgLmbLatencyUs": 713,
1056
+ "avgLmbLatencyUs": 713,
1057
+ "make": "Corsair",
1058
+ "mode": "none",
1059
+ "model": "Dark Core RGB Pro (wired)",
1060
+ "perClickLatency": true,
1061
+ "pid": "1b80",
1062
+ "polledActuation": false,
1063
+ "reportExtension": false,
1064
+ "revision": "0500",
1065
+ "vid": "1b1c"
1066
+ },
1067
+ {
1068
+ "actuationDetectionDurationUs": 0,
1069
+ "adjustedAvgLmbLatencyUs": 1202,
1070
+ "avgLmbLatencyUs": 1202,
1071
+ "make": "Corsair",
1072
+ "mode": "none",
1073
+ "model": "Dark Core RGB Pro (wireless)",
1074
+ "perClickLatency": true,
1075
+ "pid": "1b81",
1076
+ "polledActuation": false,
1077
+ "reportExtension": false,
1078
+ "revision": "0204",
1079
+ "vid": "1b1c"
1080
+ },
1081
+ {
1082
+ "actuationDetectionDurationUs": 0,
1083
+ "adjustedAvgLmbLatencyUs": 1169,
1084
+ "avgLmbLatencyUs": 1169,
1085
+ "make": "Corsair",
1086
+ "mode": "none",
1087
+ "model": "Dark Core RGB Pro (wireless)",
1088
+ "perClickLatency": true,
1089
+ "pid": "1b81",
1090
+ "polledActuation": false,
1091
+ "reportExtension": false,
1092
+ "revision": "0500",
1093
+ "vid": "1b1c"
1094
+ },
1095
+ {
1096
+ "actuationDetectionDurationUs": 0,
1097
+ "adjustedAvgLmbLatencyUs": 1394,
1098
+ "avgLmbLatencyUs": 1394,
1099
+ "make": "Corsair",
1100
+ "mode": "none",
1101
+ "model": "KATAR PRO Wireless",
1102
+ "perClickLatency": true,
1103
+ "pid": "1b94",
1104
+ "polledActuation": false,
1105
+ "reportExtension": false,
1106
+ "revision": "0201",
1107
+ "vid": "1b1c"
1108
+ },
1109
+ {
1110
+ "actuationDetectionDurationUs": 0,
1111
+ "adjustedAvgLmbLatencyUs": 887,
1112
+ "avgLmbLatencyUs": 887,
1113
+ "make": "Corsair",
1114
+ "mode": "none",
1115
+ "model": "KATAR PRO XT",
1116
+ "perClickLatency": true,
1117
+ "pid": "1bac",
1118
+ "polledActuation": false,
1119
+ "reportExtension": false,
1120
+ "revision": "0105",
1121
+ "vid": "1b1c"
1122
+ },
1123
+ {
1124
+ "actuationDetectionDurationUs": 0,
1125
+ "adjustedAvgLmbLatencyUs": 1273,
1126
+ "avgLmbLatencyUs": 1273,
1127
+ "make": "ROCCAT",
1128
+ "mode": "none",
1129
+ "model": "Kone Pro",
1130
+ "perClickLatency": true,
1131
+ "pid": "2c88",
1132
+ "polledActuation": false,
1133
+ "reportExtension": false,
1134
+ "revision": "0117",
1135
+ "vid": "1e7d"
1136
+ },
1137
+ {
1138
+ "actuationDetectionDurationUs": 0,
1139
+ "adjustedAvgLmbLatencyUs": 1398,
1140
+ "avgLmbLatencyUs": 1398,
1141
+ "make": "ROCCAT",
1142
+ "mode": "none",
1143
+ "model": "Kone XP",
1144
+ "perClickLatency": true,
1145
+ "pid": "2c8b",
1146
+ "polledActuation": false,
1147
+ "reportExtension": false,
1148
+ "revision": "0108",
1149
+ "vid": "1e7d"
1150
+ },
1151
+ {
1152
+ "actuationDetectionDurationUs": 0,
1153
+ "adjustedAvgLmbLatencyUs": 2895,
1154
+ "avgLmbLatencyUs": 2895,
1155
+ "make": "ROCCAT",
1156
+ "mode": "none",
1157
+ "model": "Kone Pro Air (Wireless)",
1158
+ "perClickLatency": false,
1159
+ "pid": "2c8e",
1160
+ "polledActuation": false,
1161
+ "reportExtension": false,
1162
+ "revision": "0417",
1163
+ "vid": "1e7d"
1164
+ },
1165
+ {
1166
+ "actuationDetectionDurationUs": 0,
1167
+ "adjustedAvgLmbLatencyUs": 1231,
1168
+ "avgLmbLatencyUs": 1231,
1169
+ "make": "ROCCAT",
1170
+ "mode": "none",
1171
+ "model": "Kone Pro Air (Wired)",
1172
+ "perClickLatency": true,
1173
+ "pid": "2c92",
1174
+ "polledActuation": false,
1175
+ "reportExtension": false,
1176
+ "revision": "0430",
1177
+ "vid": "1e7d"
1178
+ },
1179
+ {
1180
+ "actuationDetectionDurationUs": 0,
1181
+ "adjustedAvgLmbLatencyUs": 5821,
1182
+ "avgLmbLatencyUs": 5821,
1183
+ "make": "Roccat",
1184
+ "mode": "none",
1185
+ "model": "Burst Pro Air",
1186
+ "perClickLatency": true,
1187
+ "pid": "2cab",
1188
+ "polledActuation": false,
1189
+ "reportExtension": false,
1190
+ "revision": "0043",
1191
+ "vid": "1e7d"
1192
+ },
1193
+ {
1194
+ "actuationDetectionDurationUs": 0,
1195
+ "adjustedAvgLmbLatencyUs": 1446,
1196
+ "avgLmbLatencyUs": 1446,
1197
+ "make": "ROCCAT",
1198
+ "mode": "none",
1199
+ "model": "Burst Pro",
1200
+ "perClickLatency": true,
1201
+ "pid": "2de1",
1202
+ "polledActuation": false,
1203
+ "reportExtension": false,
1204
+ "revision": "0111",
1205
+ "vid": "1e7d"
1206
+ },
1207
+ {
1208
+ "actuationDetectionDurationUs": 0,
1209
+ "adjustedAvgLmbLatencyUs": 1295,
1210
+ "avgLmbLatencyUs": 1295,
1211
+ "make": "Roccat",
1212
+ "mode": "none",
1213
+ "model": "Kone XP",
1214
+ "perClickLatency": true,
1215
+ "pid": "2de6",
1216
+ "polledActuation": false,
1217
+ "reportExtension": false,
1218
+ "revision": "0101",
1219
+ "vid": "1e7d"
1220
+ },
1221
+ {
1222
+ "actuationDetectionDurationUs": 0,
1223
+ "adjustedAvgLmbLatencyUs": 13461,
1224
+ "avgLmbLatencyUs": 13461,
1225
+ "make": "Glorious",
1226
+ "mode": "none",
1227
+ "model": "Model O",
1228
+ "perClickLatency": false,
1229
+ "pid": "0036",
1230
+ "polledActuation": false,
1231
+ "reportExtension": false,
1232
+ "revision": "0100",
1233
+ "vid": "258a"
1234
+ },
1235
+ {
1236
+ "actuationDetectionDurationUs": 0,
1237
+ "adjustedAvgLmbLatencyUs": 4802,
1238
+ "avgLmbLatencyUs": 4802,
1239
+ "make": "AOC",
1240
+ "mode": "none",
1241
+ "model": "GM510",
1242
+ "perClickLatency": true,
1243
+ "pid": "006d",
1244
+ "polledActuation": false,
1245
+ "reportExtension": false,
1246
+ "revision": "0114",
1247
+ "vid": "258a"
1248
+ },
1249
+ {
1250
+ "actuationDetectionDurationUs": 0,
1251
+ "adjustedAvgLmbLatencyUs": 5267,
1252
+ "avgLmbLatencyUs": 5267,
1253
+ "make": "AOC",
1254
+ "mode": "none",
1255
+ "model": "GM510",
1256
+ "perClickLatency": true,
1257
+ "pid": "006d",
1258
+ "polledActuation": false,
1259
+ "reportExtension": false,
1260
+ "revision": "0115",
1261
+ "vid": "258a"
1262
+ },
1263
+ {
1264
+ "actuationDetectionDurationUs": 0,
1265
+ "adjustedAvgLmbLatencyUs": 4606,
1266
+ "avgLmbLatencyUs": 4606,
1267
+ "make": "AOC",
1268
+ "mode": "none",
1269
+ "model": "AGM 600",
1270
+ "perClickLatency": true,
1271
+ "pid": "0081",
1272
+ "polledActuation": false,
1273
+ "reportExtension": false,
1274
+ "revision": "0000",
1275
+ "vid": "258a"
1276
+ },
1277
+ {
1278
+ "actuationDetectionDurationUs": 0,
1279
+ "adjustedAvgLmbLatencyUs": 7623,
1280
+ "avgLmbLatencyUs": 7623,
1281
+ "make": "Zowie",
1282
+ "mode": "none",
1283
+ "model": "ZA13",
1284
+ "perClickLatency": false,
1285
+ "pid": "0001",
1286
+ "polledActuation": false,
1287
+ "reportExtension": false,
1288
+ "revision": "0002",
1289
+ "vid": "3057"
1290
+ },
1291
+ {
1292
+ "actuationDetectionDurationUs": 0,
1293
+ "adjustedAvgLmbLatencyUs": 655,
1294
+ "avgLmbLatencyUs": 655,
1295
+ "make": "EVGA",
1296
+ "mode": "none",
1297
+ "model": "X17",
1298
+ "perClickLatency": true,
1299
+ "pid": "240d",
1300
+ "polledActuation": false,
1301
+ "reportExtension": false,
1302
+ "revision": "a168",
1303
+ "vid": "3842"
1304
+ },
1305
+ {
1306
+ "actuationDetectionDurationUs": 0,
1307
+ "adjustedAvgLmbLatencyUs": 685,
1308
+ "avgLmbLatencyUs": 685,
1309
+ "make": "EVGA",
1310
+ "mode": "none",
1311
+ "model": "X15",
1312
+ "perClickLatency": true,
1313
+ "pid": "2415",
1314
+ "polledActuation": false,
1315
+ "reportExtension": false,
1316
+ "revision": "a124",
1317
+ "vid": "3842"
1318
+ },
1319
+ {
1320
+ "actuationDetectionDurationUs": 0,
1321
+ "adjustedAvgLmbLatencyUs": 2305,
1322
+ "avgLmbLatencyUs": 2305,
1323
+ "make": "EVGA",
1324
+ "mode": "none",
1325
+ "model": "X12",
1326
+ "perClickLatency": true,
1327
+ "pid": "2422",
1328
+ "polledActuation": false,
1329
+ "reportExtension": false,
1330
+ "revision": "a177",
1331
+ "vid": "3842"
1332
+ },
1333
+ {
1334
+ "actuationDetectionDurationUs": 0,
1335
+ "adjustedAvgLmbLatencyUs": 16580,
1336
+ "avgLmbLatencyUs": 16580,
1337
+ "make": "Acer",
1338
+ "mode": "none",
1339
+ "model": "Predator Cestus 350 (wired)",
1340
+ "perClickLatency": true,
1341
+ "pid": "1172",
1342
+ "polledActuation": false,
1343
+ "reportExtension": false,
1344
+ "revision": "0121",
1345
+ "vid": "3938"
1346
+ },
1347
+ {
1348
+ "actuationDetectionDurationUs": 0,
1349
+ "adjustedAvgLmbLatencyUs": 1576,
1350
+ "avgLmbLatencyUs": 1576,
1351
+ "make": "Acer",
1352
+ "mode": "none",
1353
+ "model": "Predator Cestus 350 (wired)",
1354
+ "perClickLatency": true,
1355
+ "pid": "1172",
1356
+ "polledActuation": false,
1357
+ "reportExtension": false,
1358
+ "revision": "0122",
1359
+ "vid": "3938"
1360
+ },
1361
+ {
1362
+ "actuationDetectionDurationUs": 0,
1363
+ "adjustedAvgLmbLatencyUs": 16560,
1364
+ "avgLmbLatencyUs": 16560,
1365
+ "make": "Acer",
1366
+ "mode": "none",
1367
+ "model": "AOPEN Fire Legend GM310",
1368
+ "perClickLatency": true,
1369
+ "pid": "1176",
1370
+ "polledActuation": false,
1371
+ "reportExtension": false,
1372
+ "revision": "0104",
1373
+ "vid": "3938"
1374
+ },
1375
+ {
1376
+ "actuationDetectionDurationUs": 0,
1377
+ "adjustedAvgLmbLatencyUs": 5241,
1378
+ "avgLmbLatencyUs": 5241,
1379
+ "make": "AOC",
1380
+ "mode": "none",
1381
+ "model": "GM500",
1382
+ "perClickLatency": true,
1383
+ "pid": "1179",
1384
+ "polledActuation": false,
1385
+ "reportExtension": false,
1386
+ "revision": "0202",
1387
+ "vid": "3938"
1388
+ },
1389
+ {
1390
+ "actuationDetectionDurationUs": 0,
1391
+ "adjustedAvgLmbLatencyUs": 16916,
1392
+ "avgLmbLatencyUs": 16916,
1393
+ "make": "Acer",
1394
+ "mode": "none",
1395
+ "model": "Predator Cestus 330",
1396
+ "perClickLatency": true,
1397
+ "pid": "1184",
1398
+ "polledActuation": false,
1399
+ "reportExtension": false,
1400
+ "revision": "0101",
1401
+ "vid": "3938"
1402
+ },
1403
+ {
1404
+ "actuationDetectionDurationUs": 0,
1405
+ "adjustedAvgLmbLatencyUs": 1576,
1406
+ "avgLmbLatencyUs": 1576,
1407
+ "make": "Acer",
1408
+ "mode": "none",
1409
+ "model": "Predator Cestus 330",
1410
+ "perClickLatency": true,
1411
+ "pid": "1184",
1412
+ "polledActuation": false,
1413
+ "reportExtension": false,
1414
+ "revision": "0109",
1415
+ "vid": "3938"
1416
+ },
1417
+ {
1418
+ "actuationDetectionDurationUs": 0,
1419
+ "adjustedAvgLmbLatencyUs": 17589,
1420
+ "avgLmbLatencyUs": 17589,
1421
+ "make": "Acer",
1422
+ "mode": "none",
1423
+ "model": "Predator Cestus 350",
1424
+ "perClickLatency": false,
1425
+ "pid": "1218",
1426
+ "polledActuation": false,
1427
+ "reportExtension": false,
1428
+ "revision": "0107",
1429
+ "vid": "3938"
1430
+ },
1431
+ {
1432
+ "actuationDetectionDurationUs": 0,
1433
+ "adjustedAvgLmbLatencyUs": 2001,
1434
+ "avgLmbLatencyUs": 2001,
1435
+ "make": "Alienware",
1436
+ "mode": "none",
1437
+ "model": "720M",
1438
+ "perClickLatency": true,
1439
+ "pid": "3028",
1440
+ "polledActuation": false,
1441
+ "reportExtension": false,
1442
+ "revision": "0219",
1443
+ "vid": "413c"
1444
+ },
1445
+ {
1446
+ "actuationDetectionDurationUs": 0,
1447
+ "adjustedAvgLmbLatencyUs": 4265,
1448
+ "avgLmbLatencyUs": 4265,
1449
+ "make": "Alienware",
1450
+ "mode": "none",
1451
+ "model": "720M",
1452
+ "perClickLatency": true,
1453
+ "pid": "3029",
1454
+ "polledActuation": false,
1455
+ "reportExtension": false,
1456
+ "revision": "0209",
1457
+ "vid": "413c"
1458
+ },
1459
+ {
1460
+ "actuationDetectionDurationUs": 0,
1461
+ "adjustedAvgLmbLatencyUs": 4881,
1462
+ "avgLmbLatencyUs": 4881,
1463
+ "make": "Alienware",
1464
+ "mode": "none",
1465
+ "model": "AW320M",
1466
+ "perClickLatency": true,
1467
+ "pid": "302a",
1468
+ "polledActuation": false,
1469
+ "reportExtension": false,
1470
+ "revision": "0031",
1471
+ "vid": "413c"
1472
+ }
1473
+ ],
1474
+ "signature": [
1475
+ 116,
1476
+ 199,
1477
+ 223,
1478
+ 205,
1479
+ 23,
1480
+ 140,
1481
+ 185,
1482
+ 27,
1483
+ 56,
1484
+ 15,
1485
+ 215,
1486
+ 3,
1487
+ 29,
1488
+ 227,
1489
+ 183,
1490
+ 128,
1491
+ 143,
1492
+ 112,
1493
+ 246,
1494
+ 113,
1495
+ 38,
1496
+ 201,
1497
+ 172,
1498
+ 110,
1499
+ 13,
1500
+ 55,
1501
+ 98,
1502
+ 241,
1503
+ 233,
1504
+ 116,
1505
+ 133,
1506
+ 74,
1507
+ 189,
1508
+ 189,
1509
+ 207,
1510
+ 250,
1511
+ 108,
1512
+ 34,
1513
+ 56,
1514
+ 116,
1515
+ 254,
1516
+ 0,
1517
+ 156,
1518
+ 51,
1519
+ 51,
1520
+ 221,
1521
+ 48,
1522
+ 173,
1523
+ 5,
1524
+ 98,
1525
+ 132,
1526
+ 97,
1527
+ 255,
1528
+ 220,
1529
+ 91,
1530
+ 40,
1531
+ 57,
1532
+ 36,
1533
+ 199,
1534
+ 177,
1535
+ 90,
1536
+ 125,
1537
+ 82,
1538
+ 221,
1539
+ 2,
1540
+ 174,
1541
+ 19,
1542
+ 237,
1543
+ 214,
1544
+ 133,
1545
+ 102,
1546
+ 217,
1547
+ 216,
1548
+ 152,
1549
+ 114,
1550
+ 185,
1551
+ 170,
1552
+ 79,
1553
+ 222,
1554
+ 15,
1555
+ 219,
1556
+ 72,
1557
+ 144,
1558
+ 166,
1559
+ 227,
1560
+ 23,
1561
+ 187,
1562
+ 200,
1563
+ 191,
1564
+ 240,
1565
+ 195,
1566
+ 197,
1567
+ 110,
1568
+ 115,
1569
+ 151,
1570
+ 105,
1571
+ 185,
1572
+ 87,
1573
+ 52,
1574
+ 146,
1575
+ 130,
1576
+ 241,
1577
+ 100,
1578
+ 74,
1579
+ 232,
1580
+ 105,
1581
+ 200,
1582
+ 221,
1583
+ 247,
1584
+ 190,
1585
+ 178,
1586
+ 192,
1587
+ 189,
1588
+ 238,
1589
+ 192,
1590
+ 179,
1591
+ 93,
1592
+ 140,
1593
+ 78,
1594
+ 231,
1595
+ 154,
1596
+ 128,
1597
+ 221,
1598
+ 64,
1599
+ 166,
1600
+ 242,
1601
+ 134,
1602
+ 173,
1603
+ 33,
1604
+ 39,
1605
+ 49,
1606
+ 131,
1607
+ 70,
1608
+ 211,
1609
+ 141,
1610
+ 164,
1611
+ 57,
1612
+ 249,
1613
+ 64,
1614
+ 182,
1615
+ 252,
1616
+ 46,
1617
+ 239,
1618
+ 191,
1619
+ 148,
1620
+ 139,
1621
+ 44,
1622
+ 49,
1623
+ 7,
1624
+ 31,
1625
+ 189,
1626
+ 78,
1627
+ 44,
1628
+ 236,
1629
+ 107,
1630
+ 168,
1631
+ 163,
1632
+ 115,
1633
+ 17,
1634
+ 54,
1635
+ 165,
1636
+ 158,
1637
+ 132,
1638
+ 146,
1639
+ 127,
1640
+ 0,
1641
+ 197,
1642
+ 111,
1643
+ 75,
1644
+ 114,
1645
+ 165,
1646
+ 237,
1647
+ 121,
1648
+ 222,
1649
+ 178,
1650
+ 81,
1651
+ 114,
1652
+ 136,
1653
+ 200,
1654
+ 204,
1655
+ 51,
1656
+ 36,
1657
+ 169,
1658
+ 181,
1659
+ 13,
1660
+ 238,
1661
+ 234,
1662
+ 142,
1663
+ 226,
1664
+ 146,
1665
+ 26,
1666
+ 163,
1667
+ 103,
1668
+ 174,
1669
+ 36,
1670
+ 214,
1671
+ 135,
1672
+ 41,
1673
+ 68,
1674
+ 122,
1675
+ 196,
1676
+ 241,
1677
+ 86,
1678
+ 223,
1679
+ 212,
1680
+ 104,
1681
+ 164,
1682
+ 133,
1683
+ 167,
1684
+ 236,
1685
+ 197,
1686
+ 0,
1687
+ 236,
1688
+ 103,
1689
+ 0,
1690
+ 11,
1691
+ 128,
1692
+ 127,
1693
+ 190,
1694
+ 215,
1695
+ 189,
1696
+ 254,
1697
+ 248,
1698
+ 240,
1699
+ 93,
1700
+ 140,
1701
+ 196,
1702
+ 2,
1703
+ 34,
1704
+ 34,
1705
+ 104,
1706
+ 12,
1707
+ 232,
1708
+ 181,
1709
+ 163,
1710
+ 47,
1711
+ 178,
1712
+ 60,
1713
+ 231,
1714
+ 232,
1715
+ 66,
1716
+ 50,
1717
+ 239,
1718
+ 24,
1719
+ 16,
1720
+ 32,
1721
+ 242,
1722
+ 247,
1723
+ 33,
1724
+ 16,
1725
+ 198,
1726
+ 12,
1727
+ 169,
1728
+ 199,
1729
+ 52,
1730
+ 29
1731
+ ]
1732
+ }
cuda_toolkit/bin/nvcc.profile ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ TOP = $(_HERE_)/..
3
+
4
+ NVVMIR_LIBRARY_DIR = $(TOP)/$(_NVVM_BRANCH_)/libdevice
5
+
6
+ PATH += $(TOP)/$(_NVVM_BRANCH_)/bin;$(_HERE_);$(TOP)/lib;
7
+
8
+ INCLUDES += "-I$(TOP)/include" $(_SPACE_)
9
+
10
+ LIBRARIES =+ $(_SPACE_) "/LIBPATH:$(TOP)/lib/$(_WIN_PLATFORM_)"
11
+
12
+ CUDAFE_FLAGS +=
13
+ PTXAS_FLAGS +=
cuda_toolkit/bin/nvvp.bat ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ @echo off
2
+ setlocal
3
+ setx PATH "%~dp0\..\extras\CUPTI\lib64;%PATH%"
4
+ start "" "%~dp0\..\libnvvp\nvvp.exe" %*
5
+ endlocal
cuda_toolkit/bin/runant.pl ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/perl
2
+ #
3
+ # Licensed to the Apache Software Foundation (ASF) under one or more
4
+ # contributor license agreements. See the NOTICE file distributed with
5
+ # this work for additional information regarding copyright ownership.
6
+ # The ASF licenses this file to You under the Apache License, Version 2.0
7
+ # (the "License"); you may not use this file except in compliance with
8
+ # the License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ #######################################################################
19
+ #
20
+ # runant.pl
21
+ #
22
+ # wrapper script for invoking ant in a platform with Perl installed
23
+ # this may include cgi-bin invocation, which is considered somewhat daft.
24
+ # (slo: that should be a separate file which can be derived from this
25
+ # and returns the XML formatted output)
26
+ #
27
+ # the code is not totally portable due to classpath and directory splitting
28
+ # issues. oops. (NB, use File::Spec::Functions will help and the code is
29
+ # structured for the catfile() call, but because of perl version funnies
30
+ # the code is not included.
31
+ #
32
+ # created: 2000-8-24
33
+ # author: Steve Loughran steve_l@sourceforge.net
34
+ #######################################################################
35
+ #
36
+ # Assumptions:
37
+ #
38
+ # - the "java" executable/script is on the command path
39
+ # - ANT_HOME has been set
40
+ # - target platform uses ":" as classpath separator or perl indicates it is dos/win32
41
+ # - target platform uses "/" as directory separator.
42
+
43
+ #be fussy about variables
44
+ use strict;
45
+
46
+ #platform specifics (disabled)
47
+ #use File::Spec::Functions;
48
+
49
+ #turn warnings on during dev; generates a few spurious uninitialised var access warnings
50
+ #use warnings;
51
+
52
+ #and set $debug to 1 to turn on trace info
53
+ my $debug=1;
54
+
55
+ #######################################################################
56
+ #
57
+ # check to make sure environment is setup
58
+ #
59
+
60
+ my $HOME = $ENV{ANT_HOME};
61
+ if ($HOME eq "")
62
+ {
63
+ die "\n\nANT_HOME *MUST* be set!\n\n";
64
+ }
65
+
66
+ my $JAVACMD = $ENV{JAVACMD};
67
+ $JAVACMD = "java" if $JAVACMD eq "";
68
+
69
+ my $onnetware = 0;
70
+ if ($^O eq "NetWare")
71
+ {
72
+ $onnetware = 1;
73
+ }
74
+
75
+ my $oncygwin = ($^O eq "cygwin");
76
+
77
+ #ISSUE: what java wants to split up classpath varies from platform to platform
78
+ #and perl is not too hot at hinting which box it is on.
79
+ #here I assume ":" 'cept on win32, dos, and netware. Add extra tests here as needed.
80
+ my $s=":";
81
+ if(($^O eq "MSWin32") || ($^O eq "dos") || ($^O eq "cygwin") ||
82
+ ($onnetware == 1))
83
+ {
84
+ $s=";";
85
+ }
86
+
87
+ #build up standard classpath
88
+ my $localpath = "$HOME/lib/ant-launcher.jar";
89
+ #set JVM options and Ant arguments, if any
90
+ my @ANT_OPTS=split(" ", $ENV{ANT_OPTS});
91
+ my @ANT_ARGS=split(" ", $ENV{ANT_ARGS});
92
+
93
+ #jikes
94
+ if($ENV{JIKESPATH} ne "")
95
+ {
96
+ push @ANT_OPTS, "-Djikes.class.path=$ENV{JIKESPATH}";
97
+ }
98
+
99
+ #construct arguments to java
100
+ my @ARGS;
101
+ push @ARGS, @ANT_OPTS;
102
+
103
+ my $CYGHOME = "";
104
+
105
+ my $classpath=$ENV{CLASSPATH};
106
+ if ($oncygwin == 1) {
107
+ $localpath = `cygpath --path --windows $localpath`;
108
+ chomp ($localpath);
109
+ if (! $classpath eq "")
110
+ {
111
+ $classpath = `cygpath --path --windows "$classpath"`;
112
+ chomp ($classpath);
113
+ }
114
+ $HOME = `cygpath --path --windows $HOME`;
115
+ chomp ($HOME);
116
+ $CYGHOME = `cygpath --path --windows $ENV{HOME}`;
117
+ chomp ($CYGHOME);
118
+ }
119
+ push @ARGS, "-classpath", "$localpath";
120
+ push @ARGS, "-Dant.home=$HOME";
121
+ if ( ! $CYGHOME eq "" )
122
+ {
123
+ push @ARGS, "-Dcygwin.user.home=\"$CYGHOME\""
124
+ }
125
+ push @ARGS, "org.apache.tools.ant.launch.Launcher", @ANT_ARGS;
126
+ push @ARGS, @ARGV;
127
+ if (! $classpath eq "")
128
+ {
129
+ if ($onnetware == 1)
130
+ {
131
+ # make classpath literally $CLASSPATH
132
+ # this is to avoid pushing us over the 512 character limit
133
+ # even skip the ; - that is already in $localpath
134
+ push @ARGS, "-lib", "\$CLASSPATH";
135
+ }
136
+ else
137
+ {
138
+ push @ARGS, "-lib", "$classpath";
139
+ }
140
+ }
141
+ print "\n $JAVACMD @ARGS\n\n" if ($debug);
142
+
143
+ my $returnValue = system $JAVACMD, @ARGS;
144
+ if ($returnValue eq 0)
145
+ {
146
+ exit 0;
147
+ }
148
+ else
149
+ {
150
+ # only 0 and 1 are widely recognized as exit values
151
+ # so change the exit value to 1
152
+ exit 1;
153
+ }
cuda_toolkit/bin/runant.py ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/python
2
+ # Licensed to the Apache Software Foundation (ASF) under one or more
3
+ # contributor license agreements. See the NOTICE file distributed with
4
+ # this work for additional information regarding copyright ownership.
5
+ # The ASF licenses this file to You under the Apache License, Version 2.0
6
+ # (the "License"); you may not use this file except in compliance with
7
+ # the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ """
19
+
20
+ runant.py
21
+
22
+ This script is a translation of the runant.pl written by Steve Loughran.
23
+ It runs ant with/out arguments, it should be quite portable (thanks to
24
+ the python os library)
25
+ This script has been tested with Python2.0/Win2K
26
+
27
+ created: 2001-04-11
28
+ author: Pierre Dittgen pierre.dittgen@criltelecom.com
29
+
30
+ Assumptions:
31
+
32
+ - the "java" executable/script is on the command path
33
+ """
34
+ import os, os.path, string, sys
35
+
36
+ # Change it to 1 to get extra debug information
37
+ debug = 0
38
+
39
+ #######################################################################
40
+
41
+ # If ANT_HOME is not set default to script's parent directory
42
+ if os.environ.has_key('ANT_HOME'):
43
+ ANT_HOME = os.environ['ANT_HOME']
44
+ else:
45
+ ANT_HOME = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
46
+
47
+ # set ANT_LIB location
48
+ ANT_LIB = os.path.join(ANT_HOME, 'lib')
49
+
50
+ # set JAVACMD (check variables JAVACMD and JAVA_HOME)
51
+ JAVACMD = None
52
+ if not os.environ.has_key('JAVACMD'):
53
+ if os.environ.has_key('JAVA_HOME'):
54
+ if not os.path.exists(os.environ['JAVA_HOME']):
55
+ print "Warning: JAVA_HOME is not defined correctly."
56
+ else:
57
+ JAVACMD = os.path.join(os.environ['JAVA_HOME'], 'bin', 'java')
58
+ else:
59
+ print "Warning: JAVA_HOME not set."
60
+ else:
61
+ JAVACMD = os.environ['JAVACMD']
62
+ if not JAVACMD:
63
+ JAVACMD = 'java'
64
+
65
+ launcher_jar = os.path.join(ANT_LIB, 'ant-launcher.jar')
66
+ if not os.path.exists(launcher_jar):
67
+ print 'Warning: Unable to locate ant-launcher.jar. Expected to find it in %s' % \
68
+ ANT_LIB
69
+
70
+ # Build up standard classpath (LOCALCLASSPATH)
71
+ LOCALCLASSPATH = launcher_jar
72
+ if os.environ.has_key('LOCALCLASSPATH'):
73
+ LOCALCLASSPATH += os.pathsep + os.environ['LOCALCLASSPATH']
74
+
75
+ ANT_OPTS = ""
76
+ if os.environ.has_key('ANT_OPTS'):
77
+ ANT_OPTS = os.environ['ANT_OPTS']
78
+
79
+ OPTS = ""
80
+ if os.environ.has_key('JIKESPATH'):
81
+ OPTS = '-Djikes.class.path=\"%s\"' % os.environ['JIKESPATH']
82
+
83
+ ANT_ARGS = ""
84
+ if os.environ.has_key('ANT_ARGS'):
85
+ ANT_ARGS = os.environ['ANT_ARGS']
86
+
87
+ CLASSPATH = ""
88
+ if os.environ.has_key('CLASSPATH'):
89
+ CLASSPATH = "-lib " + os.environ['CLASSPATH']
90
+
91
+ # Builds the commandline
92
+ cmdline = ('%s %s -classpath %s -Dant.home=%s %s ' + \
93
+ 'org.apache.tools.ant.launch.Launcher %s %s %s') \
94
+ % (JAVACMD, ANT_OPTS, LOCALCLASSPATH, ANT_HOME, OPTS, ANT_ARGS, \
95
+ CLASSPATH, string.join(sys.argv[1:], ' '))
96
+
97
+ if debug:
98
+ print '\n%s\n\n' % (cmdline)
99
+ sys.stdout.flush()
100
+
101
+ # Run the biniou!
102
+ os.system(cmdline)
cuda_toolkit/bin/runrc.cmd ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Licensed to the Apache Software Foundation (ASF) under one or more
3
+ contributor license agreements. See the NOTICE file distributed with
4
+ this work for additional information regarding copyright ownership.
5
+ The ASF licenses this file to You under the Apache License, Version 2.0
6
+ (the "License"); you may not use this file except in compliance with
7
+ the License. You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+
17
+ Run RC file, name is in the first arg, second arg is either PATH
18
+ ENV or -r or nothing
19
+ */
20
+
21
+ parse arg name path rest
22
+
23
+ if name = '' then do
24
+ say 'RC file name is missing'
25
+ exit 1
26
+ end
27
+
28
+ if rest \= '' then do
29
+ say 'Too many parameters'
30
+ exit 1
31
+ end
32
+
33
+ call runit name path
34
+ exit 0
35
+
36
+ runit: procedure
37
+ parse arg name path dir
38
+
39
+ if path \= '' & path \= '-r' then do
40
+ dir = value(translate(path),,'OS2ENVIRONMENT')
41
+ if dir = '' then return
42
+ dir = translate(dir, '\', '/') /* change UNIX-like path to OS/2 */
43
+ end
44
+
45
+ if dir = '' then dir = directory()
46
+
47
+ if path = '-r' then do /* recursive call */
48
+ subdir = filespec('path', dir)
49
+ if subdir \= '\' then do
50
+ subdir = left(subdir, length(subdir)-1)
51
+ call runit name path filespec('drive', dir) || subdir
52
+ end
53
+ end
54
+
55
+ /* Look for the file and run it */
56
+ if right(dir, 1) \= '\' then dir = dir || '\'
57
+ rcfile = stream(dir || name, 'c', 'query exists')
58
+ if rcfile \= '' then interpret 'call "' || rcfile || '"'
59
+
60
+ return
cuda_toolkit/compute-sanitizer/LICENSE ADDED
@@ -0,0 +1,1632 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ End User License Agreement
2
+ --------------------------
3
+
4
+ NVIDIA Software License Agreement and CUDA Supplement to
5
+ Software License Agreement.
6
+
7
+ The CUDA Toolkit End User License Agreement applies to the
8
+ NVIDIA CUDA Toolkit, the NVIDIA CUDA Samples, the NVIDIA
9
+ Display Driver, NVIDIA Nsight tools (Visual Studio Edition),
10
+ and the associated documentation on CUDA APIs, programming
11
+ model and development tools. If you do not agree with the
12
+ terms and conditions of the license agreement, then do not
13
+ download or use the software.
14
+
15
+ Last updated: January 12, 2024.
16
+
17
+
18
+ Preface
19
+ -------
20
+
21
+ The Software License Agreement in Chapter 1 and the Supplement
22
+ in Chapter 2 contain license terms and conditions that govern
23
+ the use of NVIDIA toolkit. By accepting this agreement, you
24
+ agree to comply with all the terms and conditions applicable
25
+ to the product(s) included herein.
26
+
27
+
28
+ NVIDIA Driver
29
+
30
+
31
+ Description
32
+
33
+ This package contains the operating system driver and
34
+ fundamental system software components for NVIDIA GPUs.
35
+
36
+
37
+ NVIDIA CUDA Toolkit
38
+
39
+
40
+ Description
41
+
42
+ The NVIDIA CUDA Toolkit provides command-line and graphical
43
+ tools for building, debugging and optimizing the performance
44
+ of applications accelerated by NVIDIA GPUs, runtime and math
45
+ libraries, and documentation including programming guides,
46
+ user manuals, and API references.
47
+
48
+
49
+ Default Install Location of CUDA Toolkit
50
+
51
+ Windows platform:
52
+
53
+ %ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v#.#
54
+
55
+ Linux platform:
56
+
57
+ /usr/local/cuda-#.#
58
+
59
+ Mac platform:
60
+
61
+ /Developer/NVIDIA/CUDA-#.#
62
+
63
+
64
+ NVIDIA CUDA Samples
65
+
66
+
67
+ Description
68
+
69
+ CUDA Samples are now located in
70
+ https://github.com/nvidia/cuda-samples, which includes
71
+ instructions for obtaining, building, and running the samples.
72
+ They are no longer included in the CUDA toolkit.
73
+
74
+
75
+ NVIDIA Nsight Visual Studio Edition (Windows only)
76
+
77
+
78
+ Description
79
+
80
+ NVIDIA Nsight Development Platform, Visual Studio Edition is a
81
+ development environment integrated into Microsoft Visual
82
+ Studio that provides tools for debugging, profiling, analyzing
83
+ and optimizing your GPU computing and graphics applications.
84
+
85
+
86
+ Default Install Location of Nsight Visual Studio Edition
87
+
88
+ Windows platform:
89
+
90
+ %ProgramFiles(x86)%\NVIDIA Corporation\Nsight Visual Studio Edition #.#
91
+
92
+
93
+ 1. License Agreement for NVIDIA Software Development Kits
94
+ ---------------------------------------------------------
95
+
96
+
97
+ Important Notice—Read before downloading, installing,
98
+ copying or using the licensed software:
99
+ -------------------------------------------------------
100
+
101
+ This license agreement, including exhibits attached
102
+ ("Agreement”) is a legal agreement between you and NVIDIA
103
+ Corporation ("NVIDIA") and governs your use of a NVIDIA
104
+ software development kit (“SDK”).
105
+
106
+ Each SDK has its own set of software and materials, but here
107
+ is a description of the types of items that may be included in
108
+ a SDK: source code, header files, APIs, data sets and assets
109
+ (examples include images, textures, models, scenes, videos,
110
+ native API input/output files), binary software, sample code,
111
+ libraries, utility programs, programming code and
112
+ documentation.
113
+
114
+ This Agreement can be accepted only by an adult of legal age
115
+ of majority in the country in which the SDK is used.
116
+
117
+ If you are entering into this Agreement on behalf of a company
118
+ or other legal entity, you represent that you have the legal
119
+ authority to bind the entity to this Agreement, in which case
120
+ “you” will mean the entity you represent.
121
+
122
+ If you don’t have the required age or authority to accept
123
+ this Agreement, or if you don’t accept all the terms and
124
+ conditions of this Agreement, do not download, install or use
125
+ the SDK.
126
+
127
+ You agree to use the SDK only for purposes that are permitted
128
+ by (a) this Agreement, and (b) any applicable law, regulation
129
+ or generally accepted practices or guidelines in the relevant
130
+ jurisdictions.
131
+
132
+
133
+ 1.1. License
134
+
135
+
136
+ 1.1.1. License Grant
137
+
138
+ Subject to the terms of this Agreement, NVIDIA hereby grants
139
+ you a non-exclusive, non-transferable license, without the
140
+ right to sublicense (except as expressly provided in this
141
+ Agreement) to:
142
+
143
+ 1. Install and use the SDK,
144
+
145
+ 2. Modify and create derivative works of sample source code
146
+ delivered in the SDK, and
147
+
148
+ 3. Distribute those portions of the SDK that are identified
149
+ in this Agreement as distributable, as incorporated in
150
+ object code format into a software application that meets
151
+ the distribution requirements indicated in this Agreement.
152
+
153
+
154
+ 1.1.2. Distribution Requirements
155
+
156
+ These are the distribution requirements for you to exercise
157
+ the distribution grant:
158
+
159
+ 1. Your application must have material additional
160
+ functionality, beyond the included portions of the SDK.
161
+
162
+ 2. The distributable portions of the SDK shall only be
163
+ accessed by your application.
164
+
165
+ 3. The following notice shall be included in modifications
166
+ and derivative works of sample source code distributed:
167
+ “This software contains source code provided by NVIDIA
168
+ Corporation.”
169
+
170
+ 4. Unless a developer tool is identified in this Agreement
171
+ as distributable, it is delivered for your internal use
172
+ only.
173
+
174
+ 5. The terms under which you distribute your application
175
+ must be consistent with the terms of this Agreement,
176
+ including (without limitation) terms relating to the
177
+ license grant and license restrictions and protection of
178
+ NVIDIA’s intellectual property rights. Additionally, you
179
+ agree that you will protect the privacy, security and
180
+ legal rights of your application users.
181
+
182
+ 6. You agree to notify NVIDIA in writing of any known or
183
+ suspected distribution or use of the SDK not in compliance
184
+ with the requirements of this Agreement, and to enforce
185
+ the terms of your agreements with respect to distributed
186
+ SDK.
187
+
188
+
189
+ 1.1.3. Authorized Users
190
+
191
+ You may allow employees and contractors of your entity or of
192
+ your subsidiary(ies) to access and use the SDK from your
193
+ secure network to perform work on your behalf.
194
+
195
+ If you are an academic institution you may allow users
196
+ enrolled or employed by the academic institution to access and
197
+ use the SDK from your secure network.
198
+
199
+ You are responsible for the compliance with the terms of this
200
+ Agreement by your authorized users. If you become aware that
201
+ your authorized users didn’t follow the terms of this
202
+ Agreement, you agree to take reasonable steps to resolve the
203
+ non-compliance and prevent new occurrences.
204
+
205
+
206
+ 1.1.4. Pre-Release SDK
207
+
208
+ The SDK versions identified as alpha, beta, preview or
209
+ otherwise as pre-release, may not be fully functional, may
210
+ contain errors or design flaws, and may have reduced or
211
+ different security, privacy, accessibility, availability, and
212
+ reliability standards relative to commercial versions of
213
+ NVIDIA software and materials. Use of a pre-release SDK may
214
+ result in unexpected results, loss of data, project delays or
215
+ other unpredictable damage or loss.
216
+
217
+ You may use a pre-release SDK at your own risk, understanding
218
+ that pre-release SDKs are not intended for use in production
219
+ or business-critical systems.
220
+
221
+ NVIDIA may choose not to make available a commercial version
222
+ of any pre-release SDK. NVIDIA may also choose to abandon
223
+ development and terminate the availability of a pre-release
224
+ SDK at any time without liability.
225
+
226
+
227
+ 1.1.5. Updates
228
+
229
+ NVIDIA may, at its option, make available patches, workarounds
230
+ or other updates to this SDK. Unless the updates are provided
231
+ with their separate governing terms, they are deemed part of
232
+ the SDK licensed to you as provided in this Agreement. You
233
+ agree that the form and content of the SDK that NVIDIA
234
+ provides may change without prior notice to you. While NVIDIA
235
+ generally maintains compatibility between versions, NVIDIA may
236
+ in some cases make changes that introduce incompatibilities in
237
+ future versions of the SDK.
238
+
239
+
240
+ 1.1.6. Components Under Other Licenses
241
+
242
+ The SDK may come bundled with, or otherwise include or be
243
+ distributed with, NVIDIA or third-party components with
244
+ separate legal notices or terms as may be described in
245
+ proprietary notices accompanying the SDK. If and to the extent
246
+ there is a conflict between the terms in this Agreement and
247
+ the license terms associated with the component, the license
248
+ terms associated with the components control only to the
249
+ extent necessary to resolve the conflict.
250
+
251
+ Subject to the other terms of this Agreement, you may use the
252
+ SDK to develop and test applications released under Open
253
+ Source Initiative (OSI) approved open source software
254
+ licenses.
255
+
256
+
257
+ 1.1.7. Reservation of Rights
258
+
259
+ NVIDIA reserves all rights, title, and interest in and to the
260
+ SDK, not expressly granted to you under this Agreement.
261
+
262
+
263
+ 1.2. Limitations
264
+
265
+ The following license limitations apply to your use of the
266
+ SDK:
267
+
268
+ 1. You may not reverse engineer, decompile or disassemble,
269
+ or remove copyright or other proprietary notices from any
270
+ portion of the SDK or copies of the SDK.
271
+
272
+ 2. Except as expressly provided in this Agreement, you may
273
+ not copy, sell, rent, sublicense, transfer, distribute,
274
+ modify, or create derivative works of any portion of the
275
+ SDK. For clarity, you may not distribute or sublicense the
276
+ SDK as a stand-alone product.
277
+
278
+ 3. Unless you have an agreement with NVIDIA for this
279
+ purpose, you may not indicate that an application created
280
+ with the SDK is sponsored or endorsed by NVIDIA.
281
+
282
+ 4. You may not bypass, disable, or circumvent any
283
+ encryption, security, digital rights management or
284
+ authentication mechanism in the SDK.
285
+
286
+ 5. You may not use the SDK in any manner that would cause it
287
+ to become subject to an open source software license. As
288
+ examples, licenses that require as a condition of use,
289
+ modification, and/or distribution that the SDK be:
290
+
291
+ a. Disclosed or distributed in source code form;
292
+
293
+ b. Licensed for the purpose of making derivative works;
294
+ or
295
+
296
+ c. Redistributable at no charge.
297
+
298
+ 6. You acknowledge that the SDK as delivered is not tested
299
+ or certified by NVIDIA for use in connection with the
300
+ design, construction, maintenance, and/or operation of any
301
+ system where the use or failure of such system could
302
+ result in a situation that threatens the safety of human
303
+ life or results in catastrophic damages (each, a "Critical
304
+ Application"). Examples of Critical Applications include
305
+ use in avionics, navigation, autonomous vehicle
306
+ applications, ai solutions for automotive products,
307
+ military, medical, life support or other life critical
308
+ applications. NVIDIA shall not be liable to you or any
309
+ third party, in whole or in part, for any claims or
310
+ damages arising from such uses. You are solely responsible
311
+ for ensuring that any product or service developed with
312
+ the SDK as a whole includes sufficient features to comply
313
+ with all applicable legal and regulatory standards and
314
+ requirements.
315
+
316
+ 7. You agree to defend, indemnify and hold harmless NVIDIA
317
+ and its affiliates, and their respective employees,
318
+ contractors, agents, officers and directors, from and
319
+ against any and all claims, damages, obligations, losses,
320
+ liabilities, costs or debt, fines, restitutions and
321
+ expenses (including but not limited to attorney’s fees
322
+ and costs incident to establishing the right of
323
+ indemnification) arising out of or related to products or
324
+ services that use the SDK in or for Critical Applications,
325
+ and for use of the SDK outside of the scope of this
326
+ Agreement or not in compliance with its terms.
327
+
328
+ 8. You may not reverse engineer, decompile or disassemble
329
+ any portion of the output generated using SDK elements for
330
+ the purpose of translating such output artifacts to target
331
+ a non-NVIDIA platform.
332
+
333
+
334
+ 1.3. Ownership
335
+
336
+ 1. NVIDIA or its licensors hold all rights, title and
337
+ interest in and to the SDK and its modifications and
338
+ derivative works, including their respective intellectual
339
+ property rights, subject to your rights under Section
340
+ 1.3.2. This SDK may include software and materials from
341
+ NVIDIA’s licensors, and these licensors are intended
342
+ third party beneficiaries that may enforce this Agreement
343
+ with respect to their intellectual property rights.
344
+
345
+ 2. You hold all rights, title and interest in and to your
346
+ applications and your derivative works of the sample
347
+ source code delivered in the SDK, including their
348
+ respective intellectual property rights, subject to
349
+ NVIDIA’s rights under Section 1.3.1.
350
+
351
+ 3. You may, but don’t have to, provide to NVIDIA
352
+ suggestions, feature requests or other feedback regarding
353
+ the SDK, including possible enhancements or modifications
354
+ to the SDK. For any feedback that you voluntarily provide,
355
+ you hereby grant NVIDIA and its affiliates a perpetual,
356
+ non-exclusive, worldwide, irrevocable license to use,
357
+ reproduce, modify, license, sublicense (through multiple
358
+ tiers of sublicensees), and distribute (through multiple
359
+ tiers of distributors) it without the payment of any
360
+ royalties or fees to you. NVIDIA will use feedback at its
361
+ choice. NVIDIA is constantly looking for ways to improve
362
+ its products, so you may send feedback to NVIDIA through
363
+ the developer portal at https://developer.nvidia.com.
364
+
365
+
366
+ 1.4. No Warranties
367
+
368
+ THE SDK IS PROVIDED BY NVIDIA “AS IS” AND “WITH ALL
369
+ FAULTS.” TO THE MAXIMUM EXTENT PERMITTED BY LAW, NVIDIA AND
370
+ ITS AFFILIATES EXPRESSLY DISCLAIM ALL WARRANTIES OF ANY KIND
371
+ OR NATURE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING,
372
+ BUT NOT LIMITED TO, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
373
+ FOR A PARTICULAR PURPOSE, TITLE, NON-INFRINGEMENT, OR THE
374
+ ABSENCE OF ANY DEFECTS THEREIN, WHETHER LATENT OR PATENT. NO
375
+ WARRANTY IS MADE ON THE BASIS OF TRADE USAGE, COURSE OF
376
+ DEALING OR COURSE OF TRADE.
377
+
378
+
379
+ 1.5. Limitation of Liability
380
+
381
+ TO THE MAXIMUM EXTENT PERMITTED BY LAW, NVIDIA AND ITS
382
+ AFFILIATES SHALL NOT BE LIABLE FOR ANY (I) SPECIAL, INCIDENTAL,
383
+ PUNITIVE OR CONSEQUENTIAL DAMAGES, OR (II) DAMAGES FOR (A) ANY
384
+ LOST PROFITS, LOSS OF USE, LOSS OF DATA OR LOSS OF GOODWILL,
385
+ OR THE COSTS OF PROCURING SUBSTITUTE PRODUCTS, ARISING OUT OF
386
+ OR IN CONNECTION WITH THIS AGREEMENT OR THE USE OR PERFORMANCE
387
+ OF THE SDK, WHETHER SUCH LIABILITY ARISES FROM ANY CLAIM BASED
388
+ UPON BREACH OF CONTRACT, BREACH OF WARRANTY, TORT (INCLUDING
389
+ NEGLIGENCE), PRODUCT LIABILITY OR ANY OTHER CAUSE OF ACTION OR
390
+ THEORY OF LIABILITY. IN NO EVENT WILL NVIDIA’S AND ITS AFFILIATES
391
+ TOTAL CUMULATIVE LIABILITY UNDER OR ARISING OUT OF THIS
392
+ AGREEMENT EXCEED US$10.00. THE NATURE OF THE LIABILITY OR THE
393
+ NUMBER OF CLAIMS OR SUITS SHALL NOT ENLARGE OR EXTEND THIS
394
+ LIMIT.
395
+
396
+ These exclusions and limitations of liability shall apply
397
+ regardless if NVIDIA or its affiliates have been advised of
398
+ the possibility of such damages, and regardless of whether a
399
+ remedy fails its essential purpose. These exclusions and
400
+ limitations of liability form an essential basis of the
401
+ bargain between the parties, and, absent any of these
402
+ exclusions or limitations of liability, the provisions of this
403
+ Agreement, including, without limitation, the economic terms,
404
+ would be substantially different.
405
+
406
+
407
+ 1.6. Termination
408
+
409
+ 1. This Agreement will continue to apply until terminated by
410
+ either you or NVIDIA as described below.
411
+
412
+ 2. If you want to terminate this Agreement, you may do so by
413
+ stopping to use the SDK.
414
+
415
+ 3. NVIDIA may, at any time, terminate this Agreement if:
416
+
417
+ a. (i) you fail to comply with any term of this
418
+ Agreement and the non-compliance is not fixed within
419
+ thirty (30) days following notice from NVIDIA (or
420
+ immediately if you violate NVIDIA’s intellectual
421
+ property rights);
422
+
423
+ b. (ii) you commence or participate in any legal
424
+ proceeding against NVIDIA with respect to the SDK; or
425
+
426
+ c. (iii) NVIDIA decides to no longer provide the SDK in
427
+ a country or, in NVIDIA’s sole discretion, the
428
+ continued use of it is no longer commercially viable.
429
+
430
+ 4. Upon any termination of this Agreement, you agree to
431
+ promptly discontinue use of the SDK and destroy all copies
432
+ in your possession or control. Your prior distributions in
433
+ accordance with this Agreement are not affected by the
434
+ termination of this Agreement. Upon written request, you
435
+ will certify in writing that you have complied with your
436
+ commitments under this section. Upon any termination of
437
+ this Agreement all provisions survive except for the
438
+ license grant provisions.
439
+
440
+
441
+ 1.7. General
442
+
443
+ If you wish to assign this Agreement or your rights and
444
+ obligations, including by merger, consolidation, dissolution
445
+ or operation of law, contact NVIDIA to ask for permission. Any
446
+ attempted assignment not approved by NVIDIA in writing shall
447
+ be void and of no effect. NVIDIA may assign, delegate or
448
+ transfer this Agreement and its rights and obligations, and if
449
+ to a non-affiliate you will be notified.
450
+
451
+ You agree to cooperate with NVIDIA and provide reasonably
452
+ requested information to verify your compliance with this
453
+ Agreement.
454
+
455
+ This Agreement will be governed in all respects by the laws of
456
+ the United States and of the State of Delaware, without regard to the
457
+ conflicts of laws principles. The United Nations Convention on
458
+ Contracts for the International Sale of Goods is specifically
459
+ disclaimed. You agree to all terms of this Agreement in the
460
+ English language.
461
+
462
+ The state or federal courts residing in Santa Clara County,
463
+ California shall have exclusive jurisdiction over any dispute
464
+ or claim arising out of this Agreement. Notwithstanding this,
465
+ you agree that NVIDIA shall still be allowed to apply for
466
+ injunctive remedies or an equivalent type of urgent legal
467
+ relief in any jurisdiction.
468
+
469
+ If any court of competent jurisdiction determines that any
470
+ provision of this Agreement is illegal, invalid or
471
+ unenforceable, such provision will be construed as limited to
472
+ the extent necessary to be consistent with and fully
473
+ enforceable under the law and the remaining provisions will
474
+ remain in full force and effect. Unless otherwise specified,
475
+ remedies are cumulative.
476
+
477
+ Each party acknowledges and agrees that the other is an
478
+ independent contractor in the performance of this Agreement.
479
+
480
+ The SDK has been developed entirely at private expense and is
481
+ “commercial items” consisting of “commercial computer
482
+ software” and “commercial computer software
483
+ documentation” provided with RESTRICTED RIGHTS. Use,
484
+ duplication or disclosure by the U.S. Government or a U.S.
485
+ Government subcontractor is subject to the restrictions in
486
+ this Agreement pursuant to DFARS 227.7202-3(a) or as set forth
487
+ in subparagraphs (c)(1) and (2) of the Commercial Computer
488
+ Software - Restricted Rights clause at FAR 52.227-19, as
489
+ applicable. Contractor/manufacturer is NVIDIA, 2788 San Tomas
490
+ Expressway, Santa Clara, CA 95051.
491
+
492
+ The SDK is subject to United States export laws and
493
+ regulations. You agree that you will not ship, transfer or
494
+ export the SDK into any country, or use the SDK in any manner,
495
+ prohibited by the United States Bureau of Industry and
496
+ Security or economic sanctions regulations administered by the
497
+ U.S. Department of Treasury’s Office of Foreign Assets
498
+ Control (OFAC), or any applicable export laws, restrictions or
499
+ regulations. These laws include restrictions on destinations,
500
+ end users and end use. By accepting this Agreement, you
501
+ confirm that you are not located in a country currently
502
+ embargoed by the U.S. or otherwise prohibited from receiving
503
+ the SDK under U.S. law.
504
+
505
+ Any notice delivered by NVIDIA to you under this Agreement
506
+ will be delivered via mail, email or fax. You agree that any
507
+ notices that NVIDIA sends you electronically will satisfy any
508
+ legal communication requirements. Please direct your legal
509
+ notices or other correspondence to NVIDIA Corporation, 2788
510
+ San Tomas Expressway, Santa Clara, California 95051, United
511
+ States of America, Attention: Legal Department.
512
+
513
+ This Agreement and any exhibits incorporated into this
514
+ Agreement constitute the entire agreement of the parties with
515
+ respect to the subject matter of this Agreement and supersede
516
+ all prior negotiations or documentation exchanged between the
517
+ parties relating to this SDK license. Any additional and/or
518
+ conflicting terms on documents issued by you are null, void,
519
+ and invalid. Any amendment or waiver under this Agreement
520
+ shall be in writing and signed by representatives of both
521
+ parties.
522
+
523
+
524
+ 2. CUDA Toolkit Supplement to Software License Agreement for
525
+ NVIDIA Software Development Kits
526
+ ------------------------------------------------------------
527
+
528
+ The terms in this supplement govern your use of the NVIDIA
529
+ CUDA Toolkit SDK under the terms of your license agreement
530
+ (“Agreement”) as modified by this supplement. Capitalized
531
+ terms used but not defined below have the meaning assigned to
532
+ them in the Agreement.
533
+
534
+ This supplement is an exhibit to the Agreement and is
535
+ incorporated as an integral part of the Agreement. In the
536
+ event of conflict between the terms in this supplement and the
537
+ terms in the Agreement, the terms in this supplement govern.
538
+
539
+
540
+ 2.1. License Scope
541
+
542
+ The SDK is licensed for you to develop applications only for
543
+ use in systems with NVIDIA GPUs.
544
+
545
+
546
+ 2.2. Distribution
547
+
548
+ The portions of the SDK that are distributable under the
549
+ Agreement are listed in Attachment A.
550
+
551
+
552
+ 2.3. Operating Systems
553
+
554
+ Those portions of the SDK designed exclusively for use on the
555
+ Linux or FreeBSD operating systems, or other operating systems
556
+ derived from the source code to these operating systems, may
557
+ be copied and redistributed for use in accordance with this
558
+ Agreement, provided that the object code files are not
559
+ modified in any way (except for unzipping of compressed
560
+ files).
561
+
562
+
563
+ 2.4. Audio and Video Encoders and Decoders
564
+
565
+ You acknowledge and agree that it is your sole responsibility
566
+ to obtain any additional third-party licenses required to
567
+ make, have made, use, have used, sell, import, and offer for
568
+ sale your products or services that include or incorporate any
569
+ third-party software and content relating to audio and/or
570
+ video encoders and decoders from, including but not limited
571
+ to, Microsoft, Thomson, Fraunhofer IIS, Sisvel S.p.A.,
572
+ MPEG-LA, and Coding Technologies. NVIDIA does not grant to you
573
+ under this Agreement any necessary patent or other rights with
574
+ respect to any audio and/or video encoders and decoders.
575
+
576
+
577
+ 2.5. Licensing
578
+
579
+ If the distribution terms in this Agreement are not suitable
580
+ for your organization, or for any questions regarding this
581
+ Agreement, please contact NVIDIA at
582
+ nvidia-compute-license-questions@nvidia.com.
583
+
584
+
585
+ 2.6. Attachment A
586
+
587
+ The following CUDA Toolkit files may be distributed with
588
+ applications developed by you, including certain
589
+ variations of these files that have version number or
590
+ architecture specific information embedded in the file name -
591
+ as an example only, for release version 9.0 of the 64-bit
592
+ Windows software, the file cudart64_90.dll is redistributable.
593
+
594
+ Component
595
+
596
+ CUDA Runtime
597
+
598
+ Windows
599
+
600
+ cudart.dll, cudart_static.lib, cudadevrt.lib
601
+
602
+ Mac OSX
603
+
604
+ libcudart.dylib, libcudart_static.a, libcudadevrt.a
605
+
606
+ Linux
607
+
608
+ libcudart.so, libcudart_static.a, libcudadevrt.a
609
+
610
+ Android
611
+
612
+ libcudart.so, libcudart_static.a, libcudadevrt.a
613
+
614
+ Component
615
+
616
+ CUDA FFT Library
617
+
618
+ Windows
619
+
620
+ cufft.dll, cufftw.dll, cufft.lib, cufftw.lib
621
+
622
+ Mac OSX
623
+
624
+ libcufft.dylib, libcufft_static.a, libcufftw.dylib,
625
+ libcufftw_static.a
626
+
627
+ Linux
628
+
629
+ libcufft.so, libcufft_static.a, libcufftw.so,
630
+ libcufftw_static.a
631
+
632
+ Android
633
+
634
+ libcufft.so, libcufft_static.a, libcufftw.so,
635
+ libcufftw_static.a
636
+
637
+ Component
638
+
639
+ CUDA BLAS Library
640
+
641
+ Windows
642
+
643
+ cublas.dll, cublasLt.dll
644
+
645
+ Mac OSX
646
+
647
+ libcublas.dylib, libcublasLt.dylib, libcublas_static.a,
648
+ libcublasLt_static.a
649
+
650
+ Linux
651
+
652
+ libcublas.so, libcublasLt.so, libcublas_static.a,
653
+ libcublasLt_static.a
654
+
655
+ Android
656
+
657
+ libcublas.so, libcublasLt.so, libcublas_static.a,
658
+ libcublasLt_static.a
659
+
660
+ Component
661
+
662
+ NVIDIA "Drop-in" BLAS Library
663
+
664
+ Windows
665
+
666
+ nvblas.dll
667
+
668
+ Mac OSX
669
+
670
+ libnvblas.dylib
671
+
672
+ Linux
673
+
674
+ libnvblas.so
675
+
676
+ Component
677
+
678
+ CUDA Sparse Matrix Library
679
+
680
+ Windows
681
+
682
+ cusparse.dll, cusparse.lib
683
+
684
+ Mac OSX
685
+
686
+ libcusparse.dylib, libcusparse_static.a
687
+
688
+ Linux
689
+
690
+ libcusparse.so, libcusparse_static.a
691
+
692
+ Android
693
+
694
+ libcusparse.so, libcusparse_static.a
695
+
696
+ Component
697
+
698
+ CUDA Linear Solver Library
699
+
700
+ Windows
701
+
702
+ cusolver.dll, cusolver.lib
703
+
704
+ Mac OSX
705
+
706
+ libcusolver.dylib, libcusolver_static.a
707
+
708
+ Linux
709
+
710
+ libcusolver.so, libcusolver_static.a
711
+
712
+ Android
713
+
714
+ libcusolver.so, libcusolver_static.a
715
+
716
+ Component
717
+
718
+ CUDA Random Number Generation Library
719
+
720
+ Windows
721
+
722
+ curand.dll, curand.lib
723
+
724
+ Mac OSX
725
+
726
+ libcurand.dylib, libcurand_static.a
727
+
728
+ Linux
729
+
730
+ libcurand.so, libcurand_static.a
731
+
732
+ Android
733
+
734
+ libcurand.so, libcurand_static.a
735
+
736
+ Component
737
+
738
+ NVIDIA Performance Primitives Library
739
+
740
+ Windows
741
+
742
+ nppc.dll, nppc.lib, nppial.dll, nppial.lib, nppicc.dll,
743
+ nppicc.lib, nppicom.dll, nppicom.lib, nppidei.dll,
744
+ nppidei.lib, nppif.dll, nppif.lib, nppig.dll, nppig.lib,
745
+ nppim.dll, nppim.lib, nppist.dll, nppist.lib, nppisu.dll,
746
+ nppisu.lib, nppitc.dll, nppitc.lib, npps.dll, npps.lib
747
+
748
+ Mac OSX
749
+
750
+ libnppc.dylib, libnppc_static.a, libnppial.dylib,
751
+ libnppial_static.a, libnppicc.dylib, libnppicc_static.a,
752
+ libnppicom.dylib, libnppicom_static.a, libnppidei.dylib,
753
+ libnppidei_static.a, libnppif.dylib, libnppif_static.a,
754
+ libnppig.dylib, libnppig_static.a, libnppim.dylib,
755
+ libnppisu_static.a, libnppitc.dylib, libnppitc_static.a,
756
+ libnpps.dylib, libnpps_static.a
757
+
758
+ Linux
759
+
760
+ libnppc.so, libnppc_static.a, libnppial.so,
761
+ libnppial_static.a, libnppicc.so, libnppicc_static.a,
762
+ libnppicom.so, libnppicom_static.a, libnppidei.so,
763
+ libnppidei_static.a, libnppif.so, libnppif_static.a
764
+ libnppig.so, libnppig_static.a, libnppim.so,
765
+ libnppim_static.a, libnppist.so, libnppist_static.a,
766
+ libnppisu.so, libnppisu_static.a, libnppitc.so
767
+ libnppitc_static.a, libnpps.so, libnpps_static.a
768
+
769
+ Android
770
+
771
+ libnppc.so, libnppc_static.a, libnppial.so,
772
+ libnppial_static.a, libnppicc.so, libnppicc_static.a,
773
+ libnppicom.so, libnppicom_static.a, libnppidei.so,
774
+ libnppidei_static.a, libnppif.so, libnppif_static.a
775
+ libnppig.so, libnppig_static.a, libnppim.so,
776
+ libnppim_static.a, libnppist.so, libnppist_static.a,
777
+ libnppisu.so, libnppisu_static.a, libnppitc.so
778
+ libnppitc_static.a, libnpps.so, libnpps_static.a
779
+
780
+ Component
781
+
782
+ NVIDIA JPEG Library
783
+
784
+ Windows
785
+
786
+ nvjpeg.lib, nvjpeg.dll
787
+
788
+ Linux
789
+
790
+ libnvjpeg.so, libnvjpeg_static.a
791
+
792
+ Component
793
+
794
+ Internal common library required for statically linking to
795
+ cuBLAS, cuSPARSE, cuFFT, cuRAND, nvJPEG and NPP
796
+
797
+ Mac OSX
798
+
799
+ libculibos.a
800
+
801
+ Linux
802
+
803
+ libculibos.a
804
+
805
+ Component
806
+
807
+ NVIDIA Runtime Compilation Library and Header
808
+
809
+ All
810
+
811
+ nvrtc.h
812
+
813
+ Windows
814
+
815
+ nvrtc.dll, nvrtc-builtins.dll
816
+
817
+ Mac OSX
818
+
819
+ libnvrtc.dylib, libnvrtc-builtins.dylib
820
+
821
+ Linux
822
+
823
+ libnvrtc.so, libnvrtc-builtins.so, libnvrtc_static.a, libnvrtx-builtins_static.a
824
+
825
+ Component
826
+
827
+ NVIDIA Optimizing Compiler Library
828
+
829
+ Windows
830
+
831
+ nvvm.dll
832
+
833
+ Mac OSX
834
+
835
+ libnvvm.dylib
836
+
837
+ Linux
838
+
839
+ libnvvm.so
840
+
841
+ Component
842
+
843
+ NVIDIA JIT Linking Library
844
+
845
+ Windows
846
+
847
+ libnvJitLink.dll, libnvJitLink.lib
848
+
849
+ Linux
850
+
851
+ libnvJitLink.so, libnvJitLink_static.a
852
+
853
+ Component
854
+
855
+ NVIDIA Common Device Math Functions Library
856
+
857
+ Windows
858
+
859
+ libdevice.10.bc
860
+
861
+ Mac OSX
862
+
863
+ libdevice.10.bc
864
+
865
+ Linux
866
+
867
+ libdevice.10.bc
868
+
869
+ Component
870
+
871
+ CUDA Occupancy Calculation Header Library
872
+
873
+ All
874
+
875
+ cuda_occupancy.h
876
+
877
+ Component
878
+
879
+ CUDA Half Precision Headers
880
+
881
+ All
882
+
883
+ cuda_fp16.h, cuda_fp16.hpp
884
+
885
+ Component
886
+
887
+ CUDA Profiling Tools Interface (CUPTI) Library
888
+
889
+ Windows
890
+
891
+ cupti.dll
892
+
893
+ Mac OSX
894
+
895
+ libcupti.dylib
896
+
897
+ Linux
898
+
899
+ libcupti.so
900
+
901
+ Component
902
+
903
+ NVIDIA Tools Extension Library
904
+
905
+ Windows
906
+
907
+ nvToolsExt.dll, nvToolsExt.lib
908
+
909
+ Mac OSX
910
+
911
+ libnvToolsExt.dylib
912
+
913
+ Linux
914
+
915
+ libnvToolsExt.so
916
+
917
+ Component
918
+
919
+ NVIDIA CUDA Driver Libraries
920
+
921
+ Linux
922
+
923
+ libcuda.so, libnvidia-ptxjitcompiler.so, libnvptxcompiler_static.a
924
+
925
+ Component
926
+
927
+ NVIDIA CUDA File IO Libraries and Header
928
+
929
+ All
930
+
931
+ cufile.h
932
+
933
+ Linux
934
+
935
+ libcufile.so, libcufile_rdma.so, libcufile_static.a,
936
+ libcufile_rdma_static.a
937
+
938
+ In addition to the rights above, for parties that are
939
+ developing software intended solely for use on Jetson
940
+ development kits or Jetson modules, and running Linux for
941
+ Tegra software, the following shall apply:
942
+
943
+ * The SDK may be distributed in its entirety, as provided by
944
+ NVIDIA, and without separation of its components, for you
945
+ and/or your licensees to create software development kits
946
+ for use only on the Jetson platform and running Linux for
947
+ Tegra software.
948
+
949
+
950
+ 2.7. Attachment B
951
+
952
+
953
+ Additional Licensing Obligations
954
+
955
+ The following third party components included in the SOFTWARE
956
+ are licensed to Licensee pursuant to the following terms and
957
+ conditions:
958
+
959
+ 1. Licensee's use of the GDB third party component is
960
+ subject to the terms and conditions of GNU GPL v3:
961
+
962
+ This product includes copyrighted third-party software licensed
963
+ under the terms of the GNU General Public License v3 ("GPL v3").
964
+ All third-party software packages are copyright by their respective
965
+ authors. GPL v3 terms and conditions are hereby incorporated into
966
+ the Agreement by this reference: http://www.gnu.org/licenses/gpl.txt
967
+
968
+ Consistent with these licensing requirements, the software
969
+ listed below is provided under the terms of the specified
970
+ open source software licenses. To obtain source code for
971
+ software provided under licenses that require
972
+ redistribution of source code, including the GNU General
973
+ Public License (GPL) and GNU Lesser General Public License
974
+ (LGPL), contact oss-requests@nvidia.com. This offer is
975
+ valid for a period of three (3) years from the date of the
976
+ distribution of this product by NVIDIA CORPORATION.
977
+
978
+ Component License
979
+ CUDA-GDB GPL v3
980
+
981
+ 2. Licensee represents and warrants that any and all third
982
+ party licensing and/or royalty payment obligations in
983
+ connection with Licensee's use of the H.264 video codecs
984
+ are solely the responsibility of Licensee.
985
+
986
+ 3. Licensee's use of the Thrust library is subject to the
987
+ terms and conditions of the Apache License Version 2.0.
988
+ All third-party software packages are copyright by their
989
+ respective authors. Apache License Version 2.0 terms and
990
+ conditions are hereby incorporated into the Agreement by
991
+ this reference.
992
+ http://www.apache.org/licenses/LICENSE-2.0.html
993
+
994
+ In addition, Licensee acknowledges the following notice:
995
+ Thrust includes source code from the Boost Iterator,
996
+ Tuple, System, and Random Number libraries.
997
+
998
+ Boost Software License - Version 1.0 - August 17th, 2003
999
+ . . . .
1000
+
1001
+ Permission is hereby granted, free of charge, to any person or
1002
+ organization obtaining a copy of the software and accompanying
1003
+ documentation covered by this license (the "Software") to use,
1004
+ reproduce, display, distribute, execute, and transmit the Software,
1005
+ and to prepare derivative works of the Software, and to permit
1006
+ third-parties to whom the Software is furnished to do so, all
1007
+ subject to the following:
1008
+
1009
+ The copyright notices in the Software and this entire statement,
1010
+ including the above license grant, this restriction and the following
1011
+ disclaimer, must be included in all copies of the Software, in whole
1012
+ or in part, and all derivative works of the Software, unless such
1013
+ copies or derivative works are solely in the form of machine-executable
1014
+ object code generated by a source language processor.
1015
+
1016
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1017
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1018
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
1019
+ NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
1020
+ ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR
1021
+ OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING
1022
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1023
+ OTHER DEALINGS IN THE SOFTWARE.
1024
+
1025
+ 4. Licensee's use of the LLVM third party component is
1026
+ subject to the following terms and conditions:
1027
+
1028
+ ======================================================
1029
+ LLVM Release License
1030
+ ======================================================
1031
+ University of Illinois/NCSA
1032
+ Open Source License
1033
+
1034
+ Copyright (c) 2003-2010 University of Illinois at Urbana-Champaign.
1035
+ All rights reserved.
1036
+
1037
+ Developed by:
1038
+
1039
+ LLVM Team
1040
+
1041
+ University of Illinois at Urbana-Champaign
1042
+
1043
+ http://llvm.org
1044
+
1045
+ Permission is hereby granted, free of charge, to any person obtaining a copy
1046
+ of this software and associated documentation files (the "Software"), to
1047
+ deal with the Software without restriction, including without limitation the
1048
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
1049
+ sell copies of the Software, and to permit persons to whom the Software is
1050
+ furnished to do so, subject to the following conditions:
1051
+
1052
+ * Redistributions of source code must retain the above copyright notice,
1053
+ this list of conditions and the following disclaimers.
1054
+
1055
+ * Redistributions in binary form must reproduce the above copyright
1056
+ notice, this list of conditions and the following disclaimers in the
1057
+ documentation and/or other materials provided with the distribution.
1058
+
1059
+ * Neither the names of the LLVM Team, University of Illinois at Urbana-
1060
+ Champaign, nor the names of its contributors may be used to endorse or
1061
+ promote products derived from this Software without specific prior
1062
+ written permission.
1063
+
1064
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1065
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1066
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
1067
+ THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
1068
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1069
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1070
+ DEALINGS WITH THE SOFTWARE.
1071
+
1072
+ 5. Licensee's use of the PCRE third party component is
1073
+ subject to the following terms and conditions:
1074
+
1075
+ ------------
1076
+ PCRE LICENCE
1077
+ ------------
1078
+ PCRE is a library of functions to support regular expressions whose syntax
1079
+ and semantics are as close as possible to those of the Perl 5 language.
1080
+ Release 8 of PCRE is distributed under the terms of the "BSD" licence, as
1081
+ specified below. The documentation for PCRE, supplied in the "doc"
1082
+ directory, is distributed under the same terms as the software itself. The
1083
+ basic library functions are written in C and are freestanding. Also
1084
+ included in the distribution is a set of C++ wrapper functions, and a just-
1085
+ in-time compiler that can be used to optimize pattern matching. These are
1086
+ both optional features that can be omitted when the library is built.
1087
+
1088
+ THE BASIC LIBRARY FUNCTIONS
1089
+ ---------------------------
1090
+ Written by: Philip Hazel
1091
+ Email local part: ph10
1092
+ Email domain: cam.ac.uk
1093
+ University of Cambridge Computing Service,
1094
+ Cambridge, England.
1095
+ Copyright (c) 1997-2012 University of Cambridge
1096
+ All rights reserved.
1097
+
1098
+ PCRE JUST-IN-TIME COMPILATION SUPPORT
1099
+ -------------------------------------
1100
+ Written by: Zoltan Herczeg
1101
+ Email local part: hzmester
1102
+ Emain domain: freemail.hu
1103
+ Copyright(c) 2010-2012 Zoltan Herczeg
1104
+ All rights reserved.
1105
+
1106
+ STACK-LESS JUST-IN-TIME COMPILER
1107
+ --------------------------------
1108
+ Written by: Zoltan Herczeg
1109
+ Email local part: hzmester
1110
+ Emain domain: freemail.hu
1111
+ Copyright(c) 2009-2012 Zoltan Herczeg
1112
+ All rights reserved.
1113
+
1114
+ THE C++ WRAPPER FUNCTIONS
1115
+ -------------------------
1116
+ Contributed by: Google Inc.
1117
+ Copyright (c) 2007-2012, Google Inc.
1118
+ All rights reserved.
1119
+
1120
+ THE "BSD" LICENCE
1121
+ -----------------
1122
+ Redistribution and use in source and binary forms, with or without
1123
+ modification, are permitted provided that the following conditions are met:
1124
+
1125
+ * Redistributions of source code must retain the above copyright notice,
1126
+ this list of conditions and the following disclaimer.
1127
+
1128
+ * Redistributions in binary form must reproduce the above copyright
1129
+ notice, this list of conditions and the following disclaimer in the
1130
+ documentation and/or other materials provided with the distribution.
1131
+
1132
+ * Neither the name of the University of Cambridge nor the name of Google
1133
+ Inc. nor the names of their contributors may be used to endorse or
1134
+ promote products derived from this software without specific prior
1135
+ written permission.
1136
+
1137
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1138
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1139
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1140
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
1141
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1142
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1143
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1144
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1145
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1146
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1147
+ POSSIBILITY OF SUCH DAMAGE.
1148
+
1149
+ 6. Some of the cuBLAS library routines were written by or
1150
+ derived from code written by Vasily Volkov and are subject
1151
+ to the Modified Berkeley Software Distribution License as
1152
+ follows:
1153
+
1154
+ Copyright (c) 2007-2009, Regents of the University of California
1155
+
1156
+ All rights reserved.
1157
+
1158
+ Redistribution and use in source and binary forms, with or without
1159
+ modification, are permitted provided that the following conditions are
1160
+ met:
1161
+ * Redistributions of source code must retain the above copyright
1162
+ notice, this list of conditions and the following disclaimer.
1163
+ * Redistributions in binary form must reproduce the above
1164
+ copyright notice, this list of conditions and the following
1165
+ disclaimer in the documentation and/or other materials provided
1166
+ with the distribution.
1167
+ * Neither the name of the University of California, Berkeley nor
1168
+ the names of its contributors may be used to endorse or promote
1169
+ products derived from this software without specific prior
1170
+ written permission.
1171
+
1172
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
1173
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1174
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1175
+ DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
1176
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
1177
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1178
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1179
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
1180
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
1181
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1182
+ POSSIBILITY OF SUCH DAMAGE.
1183
+
1184
+ 7. Some of the cuBLAS library routines were written by or
1185
+ derived from code written by Davide Barbieri and are
1186
+ subject to the Modified Berkeley Software Distribution
1187
+ License as follows:
1188
+
1189
+ Copyright (c) 2008-2009 Davide Barbieri @ University of Rome Tor Vergata.
1190
+
1191
+ All rights reserved.
1192
+
1193
+ Redistribution and use in source and binary forms, with or without
1194
+ modification, are permitted provided that the following conditions are
1195
+ met:
1196
+ * Redistributions of source code must retain the above copyright
1197
+ notice, this list of conditions and the following disclaimer.
1198
+ * Redistributions in binary form must reproduce the above
1199
+ copyright notice, this list of conditions and the following
1200
+ disclaimer in the documentation and/or other materials provided
1201
+ with the distribution.
1202
+ * The name of the author may not be used to endorse or promote
1203
+ products derived from this software without specific prior
1204
+ written permission.
1205
+
1206
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
1207
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1208
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1209
+ DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
1210
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
1211
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1212
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1213
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
1214
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
1215
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1216
+ POSSIBILITY OF SUCH DAMAGE.
1217
+
1218
+ 8. Some of the cuBLAS library routines were derived from
1219
+ code developed by the University of Tennessee and are
1220
+ subject to the Modified Berkeley Software Distribution
1221
+ License as follows:
1222
+
1223
+ Copyright (c) 2010 The University of Tennessee.
1224
+
1225
+ All rights reserved.
1226
+
1227
+ Redistribution and use in source and binary forms, with or without
1228
+ modification, are permitted provided that the following conditions are
1229
+ met:
1230
+ * Redistributions of source code must retain the above copyright
1231
+ notice, this list of conditions and the following disclaimer.
1232
+ * Redistributions in binary form must reproduce the above
1233
+ copyright notice, this list of conditions and the following
1234
+ disclaimer listed in this license in the documentation and/or
1235
+ other materials provided with the distribution.
1236
+ * Neither the name of the copyright holders nor the names of its
1237
+ contributors may be used to endorse or promote products derived
1238
+ from this software without specific prior written permission.
1239
+
1240
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1241
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1242
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1243
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1244
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1245
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1246
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1247
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1248
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1249
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1250
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1251
+
1252
+ 9. Some of the cuBLAS library routines were written by or
1253
+ derived from code written by Jonathan Hogg and are subject
1254
+ to the Modified Berkeley Software Distribution License as
1255
+ follows:
1256
+
1257
+ Copyright (c) 2012, The Science and Technology Facilities Council (STFC).
1258
+
1259
+ All rights reserved.
1260
+
1261
+ Redistribution and use in source and binary forms, with or without
1262
+ modification, are permitted provided that the following conditions are
1263
+ met:
1264
+ * Redistributions of source code must retain the above copyright
1265
+ notice, this list of conditions and the following disclaimer.
1266
+ * Redistributions in binary form must reproduce the above
1267
+ copyright notice, this list of conditions and the following
1268
+ disclaimer in the documentation and/or other materials provided
1269
+ with the distribution.
1270
+ * Neither the name of the STFC nor the names of its contributors
1271
+ may be used to endorse or promote products derived from this
1272
+ software without specific prior written permission.
1273
+
1274
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1275
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1276
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1277
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE STFC BE
1278
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1279
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1280
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
1281
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
1282
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
1283
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
1284
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1285
+
1286
+ 10. Some of the cuBLAS library routines were written by or
1287
+ derived from code written by Ahmad M. Abdelfattah, David
1288
+ Keyes, and Hatem Ltaief, and are subject to the Apache
1289
+ License, Version 2.0, as follows:
1290
+
1291
+ -- (C) Copyright 2013 King Abdullah University of Science and Technology
1292
+ Authors:
1293
+ Ahmad Abdelfattah (ahmad.ahmad@kaust.edu.sa)
1294
+ David Keyes (david.keyes@kaust.edu.sa)
1295
+ Hatem Ltaief (hatem.ltaief@kaust.edu.sa)
1296
+
1297
+ Redistribution and use in source and binary forms, with or without
1298
+ modification, are permitted provided that the following conditions
1299
+ are met:
1300
+
1301
+ * Redistributions of source code must retain the above copyright
1302
+ notice, this list of conditions and the following disclaimer.
1303
+ * Redistributions in binary form must reproduce the above copyright
1304
+ notice, this list of conditions and the following disclaimer in the
1305
+ documentation and/or other materials provided with the distribution.
1306
+ * Neither the name of the King Abdullah University of Science and
1307
+ Technology nor the names of its contributors may be used to endorse
1308
+ or promote products derived from this software without specific prior
1309
+ written permission.
1310
+
1311
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1312
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1313
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1314
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1315
+ HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1316
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1317
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1318
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1319
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1320
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1321
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
1322
+
1323
+ 11. Some of the cuSPARSE library routines were written by or
1324
+ derived from code written by Li-Wen Chang and are subject
1325
+ to the NCSA Open Source License as follows:
1326
+
1327
+ Copyright (c) 2012, University of Illinois.
1328
+
1329
+ All rights reserved.
1330
+
1331
+ Developed by: IMPACT Group, University of Illinois, http://impact.crhc.illinois.edu
1332
+
1333
+ Permission is hereby granted, free of charge, to any person obtaining
1334
+ a copy of this software and associated documentation files (the
1335
+ "Software"), to deal with the Software without restriction, including
1336
+ without limitation the rights to use, copy, modify, merge, publish,
1337
+ distribute, sublicense, and/or sell copies of the Software, and to
1338
+ permit persons to whom the Software is furnished to do so, subject to
1339
+ the following conditions:
1340
+ * Redistributions of source code must retain the above copyright
1341
+ notice, this list of conditions and the following disclaimer.
1342
+ * Redistributions in binary form must reproduce the above
1343
+ copyright notice, this list of conditions and the following
1344
+ disclaimers in the documentation and/or other materials provided
1345
+ with the distribution.
1346
+ * Neither the names of IMPACT Group, University of Illinois, nor
1347
+ the names of its contributors may be used to endorse or promote
1348
+ products derived from this Software without specific prior
1349
+ written permission.
1350
+
1351
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1352
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1353
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1354
+ NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT
1355
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1356
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
1357
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
1358
+ SOFTWARE.
1359
+
1360
+ 12. Some of the cuRAND library routines were written by or
1361
+ derived from code written by Mutsuo Saito and Makoto
1362
+ Matsumoto and are subject to the following license:
1363
+
1364
+ Copyright (c) 2009, 2010 Mutsuo Saito, Makoto Matsumoto and Hiroshima
1365
+ University. All rights reserved.
1366
+
1367
+ Copyright (c) 2011 Mutsuo Saito, Makoto Matsumoto, Hiroshima
1368
+ University and University of Tokyo. All rights reserved.
1369
+
1370
+ Redistribution and use in source and binary forms, with or without
1371
+ modification, are permitted provided that the following conditions are
1372
+ met:
1373
+ * Redistributions of source code must retain the above copyright
1374
+ notice, this list of conditions and the following disclaimer.
1375
+ * Redistributions in binary form must reproduce the above
1376
+ copyright notice, this list of conditions and the following
1377
+ disclaimer in the documentation and/or other materials provided
1378
+ with the distribution.
1379
+ * Neither the name of the Hiroshima University nor the names of
1380
+ its contributors may be used to endorse or promote products
1381
+ derived from this software without specific prior written
1382
+ permission.
1383
+
1384
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1385
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1386
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1387
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1388
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1389
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1390
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1391
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1392
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1393
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1394
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1395
+
1396
+ 13. Some of the cuRAND library routines were derived from
1397
+ code developed by D. E. Shaw Research and are subject to
1398
+ the following license:
1399
+
1400
+ Copyright 2010-2011, D. E. Shaw Research.
1401
+
1402
+ All rights reserved.
1403
+
1404
+ Redistribution and use in source and binary forms, with or without
1405
+ modification, are permitted provided that the following conditions are
1406
+ met:
1407
+ * Redistributions of source code must retain the above copyright
1408
+ notice, this list of conditions, and the following disclaimer.
1409
+ * Redistributions in binary form must reproduce the above
1410
+ copyright notice, this list of conditions, and the following
1411
+ disclaimer in the documentation and/or other materials provided
1412
+ with the distribution.
1413
+ * Neither the name of D. E. Shaw Research nor the names of its
1414
+ contributors may be used to endorse or promote products derived
1415
+ from this software without specific prior written permission.
1416
+
1417
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1418
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1419
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1420
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1421
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1422
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1423
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1424
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1425
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1426
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1427
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1428
+
1429
+ 14. Some of the Math library routines were written by or
1430
+ derived from code developed by Norbert Juffa and are
1431
+ subject to the following license:
1432
+
1433
+ Copyright (c) 2015-2017, Norbert Juffa
1434
+ All rights reserved.
1435
+
1436
+ Redistribution and use in source and binary forms, with or without
1437
+ modification, are permitted provided that the following conditions
1438
+ are met:
1439
+
1440
+ 1. Redistributions of source code must retain the above copyright
1441
+ notice, this list of conditions and the following disclaimer.
1442
+
1443
+ 2. Redistributions in binary form must reproduce the above copyright
1444
+ notice, this list of conditions and the following disclaimer in the
1445
+ documentation and/or other materials provided with the distribution.
1446
+
1447
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1448
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1449
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1450
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1451
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1452
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1453
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1454
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1455
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1456
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1457
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1458
+
1459
+ 15. Licensee's use of the lz4 third party component is
1460
+ subject to the following terms and conditions:
1461
+
1462
+ Copyright (C) 2011-2013, Yann Collet.
1463
+ BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
1464
+
1465
+ Redistribution and use in source and binary forms, with or without
1466
+ modification, are permitted provided that the following conditions are
1467
+ met:
1468
+
1469
+ * Redistributions of source code must retain the above copyright
1470
+ notice, this list of conditions and the following disclaimer.
1471
+ * Redistributions in binary form must reproduce the above
1472
+ copyright notice, this list of conditions and the following disclaimer
1473
+ in the documentation and/or other materials provided with the
1474
+ distribution.
1475
+
1476
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1477
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1478
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1479
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1480
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1481
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1482
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1483
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1484
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1485
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1486
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1487
+
1488
+ 16. The NPP library uses code from the Boost Math Toolkit,
1489
+ and is subject to the following license:
1490
+
1491
+ Boost Software License - Version 1.0 - August 17th, 2003
1492
+ . . . .
1493
+
1494
+ Permission is hereby granted, free of charge, to any person or
1495
+ organization obtaining a copy of the software and accompanying
1496
+ documentation covered by this license (the "Software") to use,
1497
+ reproduce, display, distribute, execute, and transmit the Software,
1498
+ and to prepare derivative works of the Software, and to permit
1499
+ third-parties to whom the Software is furnished to do so, all
1500
+ subject to the following:
1501
+
1502
+ The copyright notices in the Software and this entire statement,
1503
+ including the above license grant, this restriction and the following
1504
+ disclaimer, must be included in all copies of the Software, in whole
1505
+ or in part, and all derivative works of the Software, unless such
1506
+ copies or derivative works are solely in the form of machine-executable
1507
+ object code generated by a source language processor.
1508
+
1509
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1510
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1511
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
1512
+ NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
1513
+ ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR
1514
+ OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING
1515
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1516
+ OTHER DEALINGS IN THE SOFTWARE.
1517
+
1518
+ 17. Portions of the Nsight Eclipse Edition is subject to the
1519
+ following license:
1520
+
1521
+ The Eclipse Foundation makes available all content in this plug-in
1522
+ ("Content"). Unless otherwise indicated below, the Content is provided
1523
+ to you under the terms and conditions of the Eclipse Public License
1524
+ Version 1.0 ("EPL"). A copy of the EPL is available at http://
1525
+ www.eclipse.org/legal/epl-v10.html. For purposes of the EPL, "Program"
1526
+ will mean the Content.
1527
+
1528
+ If you did not receive this Content directly from the Eclipse
1529
+ Foundation, the Content is being redistributed by another party
1530
+ ("Redistributor") and different terms and conditions may apply to your
1531
+ use of any object code in the Content. Check the Redistributor's
1532
+ license that was provided with the Content. If no such license exists,
1533
+ contact the Redistributor. Unless otherwise indicated below, the terms
1534
+ and conditions of the EPL still apply to any source code in the
1535
+ Content and such source code may be obtained at http://www.eclipse.org.
1536
+
1537
+ 18. Some of the cuBLAS library routines uses code from
1538
+ OpenAI, which is subject to the following license:
1539
+
1540
+ License URL
1541
+ https://github.com/openai/openai-gemm/blob/master/LICENSE
1542
+
1543
+ License Text
1544
+ The MIT License
1545
+
1546
+ Copyright (c) 2016 OpenAI (http://openai.com), 2016 Google Inc.
1547
+
1548
+ Permission is hereby granted, free of charge, to any person obtaining a copy
1549
+ of this software and associated documentation files (the "Software"), to deal
1550
+ in the Software without restriction, including without limitation the rights
1551
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1552
+ copies of the Software, and to permit persons to whom the Software is
1553
+ furnished to do so, subject to the following conditions:
1554
+
1555
+ The above copyright notice and this permission notice shall be included in
1556
+ all copies or substantial portions of the Software.
1557
+
1558
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1559
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1560
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1561
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1562
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1563
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1564
+ THE SOFTWARE.
1565
+
1566
+ 19. Licensee's use of the Visual Studio Setup Configuration
1567
+ Samples is subject to the following license:
1568
+
1569
+ The MIT License (MIT)
1570
+ Copyright (C) Microsoft Corporation. All rights reserved.
1571
+
1572
+ Permission is hereby granted, free of charge, to any person
1573
+ obtaining a copy of this software and associated documentation
1574
+ files (the "Software"), to deal in the Software without restriction,
1575
+ including without limitation the rights to use, copy, modify, merge,
1576
+ publish, distribute, sublicense, and/or sell copies of the Software,
1577
+ and to permit persons to whom the Software is furnished to do so,
1578
+ subject to the following conditions:
1579
+
1580
+ The above copyright notice and this permission notice shall be included
1581
+ in all copies or substantial portions of the Software.
1582
+
1583
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1584
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1585
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1586
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1587
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1588
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1589
+
1590
+ 20. Licensee's use of linmath.h header for CPU functions for
1591
+ GL vector/matrix operations from lunarG is subject to the
1592
+ Apache License Version 2.0.
1593
+
1594
+ 21. The DX12-CUDA sample uses the d3dx12.h header, which is
1595
+ subject to the MIT license.
1596
+
1597
+ 22. Components of the driver and compiler used for binary management, including
1598
+ nvFatBin, nvcc, and cuobjdump, use the Zstandard library which is subject to
1599
+ the following license:
1600
+
1601
+ BSD License
1602
+
1603
+ For Zstandard software
1604
+
1605
+ Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
1606
+
1607
+ Redistribution and use in source and binary forms, with or without modification,
1608
+ are permitted provided that the following conditions are met:
1609
+
1610
+ * Redistributions of source code must retain the above copyright notice, this
1611
+ list of conditions and the following disclaimer.
1612
+
1613
+ * Redistributions in binary form must reproduce the above copyright notice,
1614
+ this list of conditions and the following disclaimer in the documentation
1615
+ and/or other materials provided with the distribution.
1616
+
1617
+ * Neither the name Facebook, nor Meta, nor the names of its contributors may
1618
+ be used to endorse or promote products derived from this software without
1619
+ specific prior written permission.
1620
+
1621
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1622
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1623
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1624
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
1625
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
1626
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
1627
+ OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
1628
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1629
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
1630
+ OF SUCH DAMAGE.
1631
+
1632
+ -----------------
cuda_toolkit/include/__assert ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
8
+ //
9
+ //===----------------------------------------------------------------------===//
10
+
11
+ #ifndef _LIBCUDACXX___ASSERT
12
+ #define _LIBCUDACXX___ASSERT
13
+
14
+ #ifndef __cuda_std__
15
+ #include <__config>
16
+ #endif // __cuda_std__
17
+
18
+ #include "__verbose_abort"
19
+
20
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
21
+ # pragma GCC system_header
22
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
23
+ # pragma clang system_header
24
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
25
+ # pragma system_header
26
+ #endif // no system header
27
+
28
+ // This is for backwards compatibility with code that might have been enabling
29
+ // assertions through the Debug mode previously.
30
+ // TODO: In LLVM 16, make it an error to define _LIBCUDACXX_DEBUG
31
+ #if defined(_LIBCUDACXX_DEBUG)
32
+ # ifndef _LIBCUDACXX_ENABLE_ASSERTIONS
33
+ # define _LIBCUDACXX_ENABLE_ASSERTIONS 1
34
+ # endif
35
+ #endif
36
+
37
+ // Automatically enable assertions when the debug mode is enabled.
38
+ #if defined(_LIBCUDACXX_ENABLE_DEBUG_MODE)
39
+ # ifndef _LIBCUDACXX_ENABLE_ASSERTIONS
40
+ # define _LIBCUDACXX_ENABLE_ASSERTIONS 1
41
+ # endif
42
+ #endif
43
+
44
+ #ifndef _LIBCUDACXX_ENABLE_ASSERTIONS
45
+ # define _LIBCUDACXX_ENABLE_ASSERTIONS _LIBCUDACXX_ENABLE_ASSERTIONS_DEFAULT
46
+ #endif
47
+
48
+ #if _LIBCUDACXX_ENABLE_ASSERTIONS != 0 && _LIBCUDACXX_ENABLE_ASSERTIONS != 1
49
+ # error "_LIBCUDACXX_ENABLE_ASSERTIONS must be set to 0 or 1"
50
+ #endif
51
+
52
+ #if _LIBCUDACXX_ENABLE_ASSERTIONS
53
+ # define _LIBCUDACXX_ASSERT(expression, message) \
54
+ (_CCCL_DIAG_PUSH \
55
+ _CCCL_DIAG_SUPPRESS_CLANG("-Wassume") \
56
+ __builtin_expect(static_cast<bool>(expression), 1) ? \
57
+ (void)0 : \
58
+ ::_CUDA_VSTD::__libcpp_verbose_abort("%s:%d: assertion %s failed: %s", __FILE__, __LINE__, #expression, message)
59
+ _CCCL_DIAG_POP)
60
+ #elif 0 // !defined(_LIBCUDACXX_ASSERTIONS_DISABLE_ASSUME) && __has_builtin(__builtin_assume)
61
+ # define _LIBCUDACXX_ASSERT(expression, message) \
62
+ (_CCCL_DIAG_PUSH \
63
+ _CCCL_DIAG_SUPPRESS_CLANG("-Wassume") \
64
+ __builtin_assume(static_cast<bool>(expression)) \
65
+ _CCCL_DIAG_POP)
66
+ #else
67
+ # define _LIBCUDACXX_ASSERT(expression, message) ((void)0)
68
+ #endif
69
+
70
+ #endif // _LIBCUDACXX___ASSERT
cuda_toolkit/include/__availability ADDED
@@ -0,0 +1,306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
8
+ //
9
+ //===----------------------------------------------------------------------===//
10
+
11
+ #ifndef _LIBCUDACXX___AVAILABILITY
12
+ #define _LIBCUDACXX___AVAILABILITY
13
+
14
+ #ifndef __cuda_std__
15
+ #include <__config>
16
+ #endif // __cuda_std__
17
+
18
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
19
+ # pragma GCC system_header
20
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
21
+ # pragma clang system_header
22
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
23
+ # pragma system_header
24
+ #endif // no system header
25
+
26
+ // Libc++ is shipped by various vendors. In particular, it is used as a system
27
+ // library on macOS, iOS and other Apple platforms. In order for users to be
28
+ // able to compile a binary that is intended to be deployed to an older version
29
+ // of a platform, Clang provides availability attributes [1]. These attributes
30
+ // can be placed on declarations and are used to describe the life cycle of a
31
+ // symbol in the library.
32
+ //
33
+ // The main goal is to ensure a compile-time error if a symbol that hasn't been
34
+ // introduced in a previously released library is used in a program that targets
35
+ // that previously released library. Normally, this would be a load-time error
36
+ // when one tries to launch the program against the older library.
37
+ //
38
+ // For example, the filesystem library was introduced in the dylib in macOS 10.15.
39
+ // If a user compiles on a macOS 10.15 host but targets macOS 10.13 with their
40
+ // program, the compiler would normally not complain (because the required
41
+ // declarations are in the headers), but the dynamic loader would fail to find
42
+ // the symbols when actually trying to launch the program on macOS 10.13. To
43
+ // turn this into a compile-time issue instead, declarations are annotated with
44
+ // when they were introduced, and the compiler can produce a diagnostic if the
45
+ // program references something that isn't available on the deployment target.
46
+ //
47
+ // This mechanism is general in nature, and any vendor can add their markup to
48
+ // the library (see below). Whenever a new feature is added that requires support
49
+ // in the shared library, a macro should be added below to mark this feature
50
+ // as unavailable. When vendors decide to ship the feature as part of their
51
+ // shared library, they can update the markup appropriately.
52
+ //
53
+ // Furthermore, many features in the standard library have corresponding
54
+ // feature-test macros. When a feature is made unavailable on some deployment
55
+ // target, a macro should be defined to signal that it is unavailable. That
56
+ // macro can then be picked up when feature-test macros are generated (see
57
+ // generate_feature_test_macro_components.py) to make sure that feature-test
58
+ // macros don't announce a feature as being implemented if it has been marked
59
+ // as unavailable.
60
+ //
61
+ // Note that this mechanism is disabled by default in the "upstream" libc++.
62
+ // Availability annotations are only meaningful when shipping libc++ inside
63
+ // a platform (i.e. as a system library), and so vendors that want them should
64
+ // turn those annotations on at CMake configuration time.
65
+ //
66
+ // [1]: https://clang.llvm.org/docs/AttributeReference.html#availability
67
+
68
+
69
+ // For backwards compatibility, allow users to define _LIBCUDACXX_DISABLE_AVAILABILITY
70
+ // for a while.
71
+ #if defined(_LIBCUDACXX_DISABLE_AVAILABILITY)
72
+ # if !defined(_LIBCUDACXX_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
73
+ # define _LIBCUDACXX_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
74
+ # endif
75
+ #endif
76
+
77
+ // Availability markup is disabled when building the library, or when the compiler
78
+ // doesn't support the proper attributes.
79
+ #if defined(_LIBCUDACXX_BUILDING_LIBRARY) || \
80
+ defined(_LIBCXXABI_BUILDING_LIBRARY) || \
81
+ !__has_feature(attribute_availability_with_strict) || \
82
+ !__has_feature(attribute_availability_in_templates) || \
83
+ !__has_extension(pragma_clang_attribute_external_declaration)
84
+ # if !defined(_LIBCUDACXX_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
85
+ # define _LIBCUDACXX_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
86
+ # endif
87
+ #endif
88
+
89
+ #if defined(_LIBCUDACXX_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
90
+
91
+ // This controls the availability of std::shared_mutex and std::shared_timed_mutex,
92
+ // which were added to the dylib later.
93
+ # define _LIBCUDACXX_AVAILABILITY_SHARED_MUTEX
94
+ // # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex
95
+ // # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex
96
+
97
+ // These macros control the availability of std::bad_optional_access and
98
+ // other exception types. These were put in the shared library to prevent
99
+ // code bloat from every user program defining the vtable for these exception
100
+ // types.
101
+ //
102
+ // Note that when exceptions are disabled, the methods that normally throw
103
+ // these exceptions can be used even on older deployment targets, but those
104
+ // methods will abort instead of throwing.
105
+ # define _LIBCUDACXX_AVAILABILITY_BAD_OPTIONAL_ACCESS
106
+ # define _LIBCUDACXX_AVAILABILITY_BAD_VARIANT_ACCESS
107
+ # define _LIBCUDACXX_AVAILABILITY_BAD_ANY_CAST
108
+
109
+ // This controls the availability of std::uncaught_exceptions().
110
+ # define _LIBCUDACXX_AVAILABILITY_UNCAUGHT_EXCEPTIONS
111
+
112
+ // This controls the availability of the sized version of ::operator delete,
113
+ // ::operator delete[], and their align_val_t variants, which were all added
114
+ // in C++17, and hence not present in early dylibs.
115
+ # define _LIBCUDACXX_AVAILABILITY_SIZED_NEW_DELETE
116
+
117
+ // This controls the availability of the std::future_error exception.
118
+ //
119
+ // Note that when exceptions are disabled, the methods that normally throw
120
+ // std::future_error can be used even on older deployment targets, but those
121
+ // methods will abort instead of throwing.
122
+ # define _LIBCUDACXX_AVAILABILITY_FUTURE_ERROR
123
+
124
+ // This controls the availability of std::type_info's vtable.
125
+ // I can't imagine how using std::type_info can work at all if
126
+ // this isn't supported.
127
+ # define _LIBCUDACXX_AVAILABILITY_TYPEINFO_VTABLE
128
+
129
+ // This controls the availability of std::locale::category members
130
+ // (e.g. std::locale::collate), which are defined in the dylib.
131
+ # define _LIBCUDACXX_AVAILABILITY_LOCALE_CATEGORY
132
+
133
+ // This controls the availability of atomic operations on std::shared_ptr
134
+ // (e.g. `std::atomic_store(std::shared_ptr)`), which require a shared
135
+ // lock table located in the dylib.
136
+ # define _LIBCUDACXX_AVAILABILITY_ATOMIC_SHARED_PTR
137
+
138
+ // These macros control the availability of all parts of <filesystem> that
139
+ // depend on something in the dylib.
140
+ # define _LIBCUDACXX_AVAILABILITY_FILESYSTEM
141
+ # define _LIBCUDACXX_AVAILABILITY_FILESYSTEM_PUSH
142
+ # define _LIBCUDACXX_AVAILABILITY_FILESYSTEM_POP
143
+ // # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem
144
+
145
+ // This controls the availability of floating-point std::to_chars functions.
146
+ // These overloads were added later than the integer overloads.
147
+ # define _LIBCUDACXX_AVAILABILITY_TO_CHARS_FLOATING_POINT
148
+
149
+ // This controls the availability of the C++20 synchronization library,
150
+ // which requires shared library support for various operations
151
+ // (see libcxx/src/atomic.cpp). This includes <barier>, <latch>,
152
+ // <semaphore>, and notification functions on std::atomic.
153
+ # define _LIBCUDACXX_AVAILABILITY_SYNC
154
+ // # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait
155
+ // # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier
156
+ // # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_latch
157
+ // # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore
158
+
159
+ // This controls the availability of the C++20 format library.
160
+ // The library is in development and not ABI stable yet. P2216 is
161
+ // retroactively accepted in C++20. This paper contains ABI breaking
162
+ // changes.
163
+ # define _LIBCUDACXX_AVAILABILITY_FORMAT
164
+ // # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_format
165
+
166
+ // This controls whether the default verbose termination function is
167
+ // provided by the library.
168
+ //
169
+ // Note that when users provide their own custom function, it doesn't
170
+ // matter whether the dylib provides a default function, and the
171
+ // availability markup can actually give a false positive diagnostic
172
+ // (it will think that no function is provided, when in reality the
173
+ // user has provided their own).
174
+ //
175
+ // Users can pass -D_LIBCUDACXX_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED
176
+ // to the compiler to tell the library not to define its own verbose abort.
177
+ // Note that defining this macro but failing to define a custom function
178
+ // will lead to a load-time error on back-deployment targets, so it should
179
+ // be avoided.
180
+ // # define _LIBCUDACXX_HAS_NO_VERBOSE_ABORT_IN_LIBRARY
181
+
182
+ #elif defined(__APPLE__)
183
+
184
+ # define _LIBCUDACXX_AVAILABILITY_SHARED_MUTEX \
185
+ __attribute__((availability(macos,strict,introduced=10.12))) \
186
+ __attribute__((availability(ios,strict,introduced=10.0))) \
187
+ __attribute__((availability(tvos,strict,introduced=10.0))) \
188
+ __attribute__((availability(watchos,strict,introduced=3.0)))
189
+ # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200) || \
190
+ (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 100000) || \
191
+ (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 100000) || \
192
+ (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 30000)
193
+ # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex
194
+ # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex
195
+ # endif
196
+
197
+ // Note: bad_optional_access & friends were not introduced in the matching
198
+ // macOS and iOS versions, so the version mismatch between macOS and others
199
+ // is intended.
200
+ # define _LIBCUDACXX_AVAILABILITY_BAD_OPTIONAL_ACCESS \
201
+ __attribute__((availability(macos,strict,introduced=10.13))) \
202
+ __attribute__((availability(ios,strict,introduced=12.0))) \
203
+ __attribute__((availability(tvos,strict,introduced=12.0))) \
204
+ __attribute__((availability(watchos,strict,introduced=5.0)))
205
+ # define _LIBCUDACXX_AVAILABILITY_BAD_VARIANT_ACCESS \
206
+ _LIBCUDACXX_AVAILABILITY_BAD_OPTIONAL_ACCESS
207
+ # define _LIBCUDACXX_AVAILABILITY_BAD_ANY_CAST \
208
+ _LIBCUDACXX_AVAILABILITY_BAD_OPTIONAL_ACCESS
209
+
210
+ # define _LIBCUDACXX_AVAILABILITY_UNCAUGHT_EXCEPTIONS \
211
+ __attribute__((availability(macos,strict,introduced=10.12))) \
212
+ __attribute__((availability(ios,strict,introduced=10.0))) \
213
+ __attribute__((availability(tvos,strict,introduced=10.0))) \
214
+ __attribute__((availability(watchos,strict,introduced=3.0)))
215
+
216
+ # define _LIBCUDACXX_AVAILABILITY_SIZED_NEW_DELETE \
217
+ __attribute__((availability(macos,strict,introduced=10.12))) \
218
+ __attribute__((availability(ios,strict,introduced=10.0))) \
219
+ __attribute__((availability(tvos,strict,introduced=10.0))) \
220
+ __attribute__((availability(watchos,strict,introduced=3.0)))
221
+
222
+ # define _LIBCUDACXX_AVAILABILITY_FUTURE_ERROR \
223
+ __attribute__((availability(ios,strict,introduced=6.0)))
224
+
225
+ # define _LIBCUDACXX_AVAILABILITY_TYPEINFO_VTABLE \
226
+ __attribute__((availability(macos,strict,introduced=10.9))) \
227
+ __attribute__((availability(ios,strict,introduced=7.0)))
228
+
229
+ # define _LIBCUDACXX_AVAILABILITY_LOCALE_CATEGORY \
230
+ __attribute__((availability(macos,strict,introduced=10.9))) \
231
+ __attribute__((availability(ios,strict,introduced=7.0)))
232
+
233
+ # define _LIBCUDACXX_AVAILABILITY_ATOMIC_SHARED_PTR \
234
+ __attribute__((availability(macos,strict,introduced=10.9))) \
235
+ __attribute__((availability(ios,strict,introduced=7.0)))
236
+
237
+ # define _LIBCUDACXX_AVAILABILITY_FILESYSTEM \
238
+ __attribute__((availability(macos,strict,introduced=10.15))) \
239
+ __attribute__((availability(ios,strict,introduced=13.0))) \
240
+ __attribute__((availability(tvos,strict,introduced=13.0))) \
241
+ __attribute__((availability(watchos,strict,introduced=6.0)))
242
+ # define _LIBCUDACXX_AVAILABILITY_FILESYSTEM_PUSH \
243
+ _Pragma("clang attribute push(__attribute__((availability(macos,strict,introduced=10.15))), apply_to=any(function,record))") \
244
+ _Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))") \
245
+ _Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))") \
246
+ _Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))")
247
+ # define _LIBCUDACXX_AVAILABILITY_FILESYSTEM_POP \
248
+ _Pragma("clang attribute pop") \
249
+ _Pragma("clang attribute pop") \
250
+ _Pragma("clang attribute pop") \
251
+ _Pragma("clang attribute pop")
252
+ # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) || \
253
+ (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 130000) || \
254
+ (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 130000) || \
255
+ (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 60000)
256
+ # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem
257
+ # endif
258
+
259
+ # define _LIBCUDACXX_AVAILABILITY_TO_CHARS_FLOATING_POINT \
260
+ __attribute__((unavailable))
261
+
262
+ # define _LIBCUDACXX_AVAILABILITY_SYNC \
263
+ __attribute__((availability(macos,strict,introduced=11.0))) \
264
+ __attribute__((availability(ios,strict,introduced=14.0))) \
265
+ __attribute__((availability(tvos,strict,introduced=14.0))) \
266
+ __attribute__((availability(watchos,strict,introduced=7.0)))
267
+ # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 110000) || \
268
+ (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000) || \
269
+ (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 140000) || \
270
+ (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 70000)
271
+ # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait
272
+ # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier
273
+ # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_latch
274
+ # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore
275
+ # endif
276
+
277
+ # define _LIBCUDACXX_AVAILABILITY_FORMAT \
278
+ __attribute__((unavailable))
279
+ # define _LIBCUDACXX_AVAILABILITY_DISABLE_FTM___cpp_lib_format
280
+
281
+ # define _LIBCUDACXX_HAS_NO_VERBOSE_ABORT_IN_LIBRARY
282
+
283
+ #else
284
+
285
+ // ...New vendors can add availability markup here...
286
+
287
+ # error "It looks like you're trying to enable vendor availability markup, but you haven't defined the corresponding macros yet!"
288
+
289
+ #endif
290
+
291
+ // Define availability attributes that depend on _LIBCUDACXX_NO_EXCEPTIONS.
292
+ // Those are defined in terms of the availability attributes above, and
293
+ // should not be vendor-specific.
294
+ #if defined(_LIBCUDACXX_NO_EXCEPTIONS)
295
+ # define _LIBCUDACXX_AVAILABILITY_FUTURE
296
+ # define _LIBCUDACXX_AVAILABILITY_THROW_BAD_ANY_CAST
297
+ # define _LIBCUDACXX_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
298
+ # define _LIBCUDACXX_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
299
+ #else
300
+ # define _LIBCUDACXX_AVAILABILITY_FUTURE _LIBCUDACXX_AVAILABILITY_FUTURE_ERROR
301
+ # define _LIBCUDACXX_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCUDACXX_AVAILABILITY_BAD_ANY_CAST
302
+ # define _LIBCUDACXX_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCUDACXX_AVAILABILITY_BAD_OPTIONAL_ACCESS
303
+ # define _LIBCUDACXX_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCUDACXX_AVAILABILITY_BAD_VARIANT_ACCESS
304
+ #endif
305
+
306
+ #endif // _LIBCUDACXX___AVAILABILITY
cuda_toolkit/include/__bit_reference ADDED
@@ -0,0 +1,1293 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___BIT_REFERENCE
11
+ #define _LIBCUDACXX___BIT_REFERENCE
12
+
13
+ #include <__config>
14
+ #include <bit>
15
+ #include <algorithm>
16
+
17
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
18
+ # pragma GCC system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
20
+ # pragma clang system_header
21
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
22
+ # pragma system_header
23
+ #endif // no system header
24
+
25
+ _LIBCUDACXX_PUSH_MACROS
26
+ #include <__undef_macros>
27
+
28
+
29
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
30
+
31
+ template <class _Cp, bool _IsConst, typename _Cp::__storage_type = 0> class __bit_iterator;
32
+ template <class _Cp> class __bit_const_reference;
33
+
34
+ template <class _Tp>
35
+ struct __has_storage_type
36
+ {
37
+ static const bool value = false;
38
+ };
39
+
40
+ template <class _Cp, bool = __has_storage_type<_Cp>::value>
41
+ class __bit_reference
42
+ {
43
+ typedef typename _Cp::__storage_type __storage_type;
44
+ typedef typename _Cp::__storage_pointer __storage_pointer;
45
+
46
+ __storage_pointer __seg_;
47
+ __storage_type __mask_;
48
+
49
+ friend typename _Cp::__self;
50
+
51
+ friend class __bit_const_reference<_Cp>;
52
+ friend class __bit_iterator<_Cp, false>;
53
+ public:
54
+ _LIBCUDACXX_INLINE_VISIBILITY
55
+ __bit_reference(const __bit_reference&) = default;
56
+
57
+ _LIBCUDACXX_INLINE_VISIBILITY operator bool() const noexcept
58
+ {return static_cast<bool>(*__seg_ & __mask_);}
59
+ _LIBCUDACXX_INLINE_VISIBILITY bool operator ~() const noexcept
60
+ {return !static_cast<bool>(*this);}
61
+
62
+ _LIBCUDACXX_INLINE_VISIBILITY
63
+ __bit_reference& operator=(bool __x) noexcept
64
+ {
65
+ if (__x)
66
+ *__seg_ |= __mask_;
67
+ else
68
+ *__seg_ &= ~__mask_;
69
+ return *this;
70
+ }
71
+
72
+ _LIBCUDACXX_INLINE_VISIBILITY
73
+ __bit_reference& operator=(const __bit_reference& __x) noexcept
74
+ {return operator=(static_cast<bool>(__x));}
75
+
76
+ _LIBCUDACXX_INLINE_VISIBILITY void flip() noexcept {*__seg_ ^= __mask_;}
77
+ _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator<_Cp, false> operator&() const noexcept
78
+ {return __bit_iterator<_Cp, false>(__seg_, static_cast<unsigned>(__libcpp_ctz(__mask_)));}
79
+ private:
80
+ _LIBCUDACXX_INLINE_VISIBILITY
81
+ __bit_reference(__storage_pointer __s, __storage_type __m) noexcept
82
+ : __seg_(__s), __mask_(__m) {}
83
+ };
84
+
85
+ template <class _Cp>
86
+ class __bit_reference<_Cp, false>
87
+ {
88
+ };
89
+
90
+ template <class _Cp>
91
+ inline _LIBCUDACXX_INLINE_VISIBILITY
92
+ void
93
+ swap(__bit_reference<_Cp> __x, __bit_reference<_Cp> __y) noexcept
94
+ {
95
+ bool __t = __x;
96
+ __x = __y;
97
+ __y = __t;
98
+ }
99
+
100
+ template <class _Cp, class _Dp>
101
+ inline _LIBCUDACXX_INLINE_VISIBILITY
102
+ void
103
+ swap(__bit_reference<_Cp> __x, __bit_reference<_Dp> __y) noexcept
104
+ {
105
+ bool __t = __x;
106
+ __x = __y;
107
+ __y = __t;
108
+ }
109
+
110
+ template <class _Cp>
111
+ inline _LIBCUDACXX_INLINE_VISIBILITY
112
+ void
113
+ swap(__bit_reference<_Cp> __x, bool& __y) noexcept
114
+ {
115
+ bool __t = __x;
116
+ __x = __y;
117
+ __y = __t;
118
+ }
119
+
120
+ template <class _Cp>
121
+ inline _LIBCUDACXX_INLINE_VISIBILITY
122
+ void
123
+ swap(bool& __x, __bit_reference<_Cp> __y) noexcept
124
+ {
125
+ bool __t = __x;
126
+ __x = __y;
127
+ __y = __t;
128
+ }
129
+
130
+ template <class _Cp>
131
+ class __bit_const_reference
132
+ {
133
+ typedef typename _Cp::__storage_type __storage_type;
134
+ typedef typename _Cp::__const_storage_pointer __storage_pointer;
135
+
136
+ __storage_pointer __seg_;
137
+ __storage_type __mask_;
138
+
139
+ friend typename _Cp::__self;
140
+ friend class __bit_iterator<_Cp, true>;
141
+ public:
142
+ _LIBCUDACXX_INLINE_VISIBILITY
143
+ __bit_const_reference(const __bit_const_reference&) = default;
144
+
145
+ _LIBCUDACXX_INLINE_VISIBILITY
146
+ __bit_const_reference(const __bit_reference<_Cp>& __x) noexcept
147
+ : __seg_(__x.__seg_), __mask_(__x.__mask_) {}
148
+
149
+ _LIBCUDACXX_INLINE_VISIBILITY constexpr operator bool() const noexcept
150
+ {return static_cast<bool>(*__seg_ & __mask_);}
151
+
152
+ _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator<_Cp, true> operator&() const noexcept
153
+ {return __bit_iterator<_Cp, true>(__seg_, static_cast<unsigned>(__libcpp_ctz(__mask_)));}
154
+ private:
155
+ _LIBCUDACXX_INLINE_VISIBILITY
156
+ constexpr
157
+ __bit_const_reference(__storage_pointer __s, __storage_type __m) noexcept
158
+ : __seg_(__s), __mask_(__m) {}
159
+
160
+ __bit_const_reference& operator=(const __bit_const_reference&) = delete;
161
+ };
162
+
163
+ // find
164
+
165
+ template <class _Cp, bool _IsConst>
166
+ __bit_iterator<_Cp, _IsConst>
167
+ __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
168
+ {
169
+ typedef __bit_iterator<_Cp, _IsConst> _It;
170
+ typedef typename _It::__storage_type __storage_type;
171
+ static const int __bits_per_word = _It::__bits_per_word;
172
+ // do first partial word
173
+ if (__first.__ctz_ != 0)
174
+ {
175
+ __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
176
+ __storage_type __dn = _CUDA_VSTD::min(__clz_f, __n);
177
+ __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
178
+ __storage_type __b = *__first.__seg_ & __m;
179
+ if (__b)
180
+ return _It(__first.__seg_, static_cast<unsigned>(_CUDA_VSTD::__libcpp_ctz(__b)));
181
+ if (__n == __dn)
182
+ return __first + __n;
183
+ __n -= __dn;
184
+ ++__first.__seg_;
185
+ }
186
+ // do middle whole words
187
+ for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
188
+ if (*__first.__seg_)
189
+ return _It(__first.__seg_, static_cast<unsigned>(_CUDA_VSTD::__libcpp_ctz(*__first.__seg_)));
190
+ // do last partial word
191
+ if (__n > 0)
192
+ {
193
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
194
+ __storage_type __b = *__first.__seg_ & __m;
195
+ if (__b)
196
+ return _It(__first.__seg_, static_cast<unsigned>(_CUDA_VSTD::__libcpp_ctz(__b)));
197
+ }
198
+ return _It(__first.__seg_, static_cast<unsigned>(__n));
199
+ }
200
+
201
+ template <class _Cp, bool _IsConst>
202
+ __bit_iterator<_Cp, _IsConst>
203
+ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
204
+ {
205
+ typedef __bit_iterator<_Cp, _IsConst> _It;
206
+ typedef typename _It::__storage_type __storage_type;
207
+ const int __bits_per_word = _It::__bits_per_word;
208
+ // do first partial word
209
+ if (__first.__ctz_ != 0)
210
+ {
211
+ __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
212
+ __storage_type __dn = _CUDA_VSTD::min(__clz_f, __n);
213
+ __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
214
+ __storage_type __b = ~*__first.__seg_ & __m;
215
+ if (__b)
216
+ return _It(__first.__seg_, static_cast<unsigned>(_CUDA_VSTD::__libcpp_ctz(__b)));
217
+ if (__n == __dn)
218
+ return __first + __n;
219
+ __n -= __dn;
220
+ ++__first.__seg_;
221
+ }
222
+ // do middle whole words
223
+ for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
224
+ {
225
+ __storage_type __b = ~*__first.__seg_;
226
+ if (__b)
227
+ return _It(__first.__seg_, static_cast<unsigned>(_CUDA_VSTD::__libcpp_ctz(__b)));
228
+ }
229
+ // do last partial word
230
+ if (__n > 0)
231
+ {
232
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
233
+ __storage_type __b = ~*__first.__seg_ & __m;
234
+ if (__b)
235
+ return _It(__first.__seg_, static_cast<unsigned>(_CUDA_VSTD::__libcpp_ctz(__b)));
236
+ }
237
+ return _It(__first.__seg_, static_cast<unsigned>(__n));
238
+ }
239
+
240
+ template <class _Cp, bool _IsConst, class _Tp>
241
+ inline _LIBCUDACXX_INLINE_VISIBILITY
242
+ __bit_iterator<_Cp, _IsConst>
243
+ find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_)
244
+ {
245
+ if (static_cast<bool>(__value_))
246
+ return __find_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
247
+ return __find_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
248
+ }
249
+
250
+ // count
251
+
252
+ template <class _Cp, bool _IsConst>
253
+ typename __bit_iterator<_Cp, _IsConst>::difference_type
254
+ __count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
255
+ {
256
+ typedef __bit_iterator<_Cp, _IsConst> _It;
257
+ typedef typename _It::__storage_type __storage_type;
258
+ typedef typename _It::difference_type difference_type;
259
+ const int __bits_per_word = _It::__bits_per_word;
260
+ difference_type __r = 0;
261
+ // do first partial word
262
+ if (__first.__ctz_ != 0)
263
+ {
264
+ __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
265
+ __storage_type __dn = _CUDA_VSTD::min(__clz_f, __n);
266
+ __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
267
+ __r = _CUDA_VSTD::__libcpp_popcount(*__first.__seg_ & __m);
268
+ __n -= __dn;
269
+ ++__first.__seg_;
270
+ }
271
+ // do middle whole words
272
+ for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
273
+ __r += _CUDA_VSTD::__libcpp_popcount(*__first.__seg_);
274
+ // do last partial word
275
+ if (__n > 0)
276
+ {
277
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
278
+ __r += _CUDA_VSTD::__libcpp_popcount(*__first.__seg_ & __m);
279
+ }
280
+ return __r;
281
+ }
282
+
283
+ template <class _Cp, bool _IsConst>
284
+ typename __bit_iterator<_Cp, _IsConst>::difference_type
285
+ __count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
286
+ {
287
+ typedef __bit_iterator<_Cp, _IsConst> _It;
288
+ typedef typename _It::__storage_type __storage_type;
289
+ typedef typename _It::difference_type difference_type;
290
+ const int __bits_per_word = _It::__bits_per_word;
291
+ difference_type __r = 0;
292
+ // do first partial word
293
+ if (__first.__ctz_ != 0)
294
+ {
295
+ __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
296
+ __storage_type __dn = _CUDA_VSTD::min(__clz_f, __n);
297
+ __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
298
+ __r = _CUDA_VSTD::__libcpp_popcount(~*__first.__seg_ & __m);
299
+ __n -= __dn;
300
+ ++__first.__seg_;
301
+ }
302
+ // do middle whole words
303
+ for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
304
+ __r += _CUDA_VSTD::__libcpp_popcount(~*__first.__seg_);
305
+ // do last partial word
306
+ if (__n > 0)
307
+ {
308
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
309
+ __r += _CUDA_VSTD::__libcpp_popcount(~*__first.__seg_ & __m);
310
+ }
311
+ return __r;
312
+ }
313
+
314
+ template <class _Cp, bool _IsConst, class _Tp>
315
+ inline _LIBCUDACXX_INLINE_VISIBILITY
316
+ typename __bit_iterator<_Cp, _IsConst>::difference_type
317
+ count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_)
318
+ {
319
+ if (static_cast<bool>(__value_))
320
+ return __count_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
321
+ return __count_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
322
+ }
323
+
324
+ // fill_n
325
+
326
+ template <class _Cp>
327
+ void
328
+ __fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
329
+ {
330
+ typedef __bit_iterator<_Cp, false> _It;
331
+ typedef typename _It::__storage_type __storage_type;
332
+ const int __bits_per_word = _It::__bits_per_word;
333
+ // do first partial word
334
+ if (__first.__ctz_ != 0)
335
+ {
336
+ __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
337
+ __storage_type __dn = _CUDA_VSTD::min(__clz_f, __n);
338
+ __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
339
+ *__first.__seg_ &= ~__m;
340
+ __n -= __dn;
341
+ ++__first.__seg_;
342
+ }
343
+ // do middle whole words
344
+ __storage_type __nw = __n / __bits_per_word;
345
+ _CUDA_VSTD::memset(_CUDA_VSTD::__to_raw_pointer(__first.__seg_), 0, __nw * sizeof(__storage_type));
346
+ __n -= __nw * __bits_per_word;
347
+ // do last partial word
348
+ if (__n > 0)
349
+ {
350
+ __first.__seg_ += __nw;
351
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
352
+ *__first.__seg_ &= ~__m;
353
+ }
354
+ }
355
+
356
+ template <class _Cp>
357
+ void
358
+ __fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
359
+ {
360
+ typedef __bit_iterator<_Cp, false> _It;
361
+ typedef typename _It::__storage_type __storage_type;
362
+ const int __bits_per_word = _It::__bits_per_word;
363
+ // do first partial word
364
+ if (__first.__ctz_ != 0)
365
+ {
366
+ __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
367
+ __storage_type __dn = _CUDA_VSTD::min(__clz_f, __n);
368
+ __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
369
+ *__first.__seg_ |= __m;
370
+ __n -= __dn;
371
+ ++__first.__seg_;
372
+ }
373
+ // do middle whole words
374
+ __storage_type __nw = __n / __bits_per_word;
375
+ _CUDA_VSTD::memset(_CUDA_VSTD::__to_raw_pointer(__first.__seg_), -1, __nw * sizeof(__storage_type));
376
+ __n -= __nw * __bits_per_word;
377
+ // do last partial word
378
+ if (__n > 0)
379
+ {
380
+ __first.__seg_ += __nw;
381
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
382
+ *__first.__seg_ |= __m;
383
+ }
384
+ }
385
+
386
+ template <class _Cp>
387
+ inline _LIBCUDACXX_INLINE_VISIBILITY
388
+ void
389
+ fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n, bool __value_)
390
+ {
391
+ if (__n > 0)
392
+ {
393
+ if (__value_)
394
+ __fill_n_true(__first, __n);
395
+ else
396
+ __fill_n_false(__first, __n);
397
+ }
398
+ }
399
+
400
+ // fill
401
+
402
+ template <class _Cp>
403
+ inline _LIBCUDACXX_INLINE_VISIBILITY
404
+ void
405
+ fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value_)
406
+ {
407
+ _CUDA_VSTD::fill_n(__first, static_cast<typename _Cp::size_type>(__last - __first), __value_);
408
+ }
409
+
410
+ // copy
411
+
412
+ template <class _Cp, bool _IsConst>
413
+ __bit_iterator<_Cp, false>
414
+ __copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
415
+ __bit_iterator<_Cp, false> __result)
416
+ {
417
+ typedef __bit_iterator<_Cp, _IsConst> _In;
418
+ typedef typename _In::difference_type difference_type;
419
+ typedef typename _In::__storage_type __storage_type;
420
+ const int __bits_per_word = _In::__bits_per_word;
421
+ difference_type __n = __last - __first;
422
+ if (__n > 0)
423
+ {
424
+ // do first word
425
+ if (__first.__ctz_ != 0)
426
+ {
427
+ unsigned __clz = __bits_per_word - __first.__ctz_;
428
+ difference_type __dn = _CUDA_VSTD::min(static_cast<difference_type>(__clz), __n);
429
+ __n -= __dn;
430
+ __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz - __dn));
431
+ __storage_type __b = *__first.__seg_ & __m;
432
+ *__result.__seg_ &= ~__m;
433
+ *__result.__seg_ |= __b;
434
+ __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word;
435
+ __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_) % __bits_per_word);
436
+ ++__first.__seg_;
437
+ // __first.__ctz_ = 0;
438
+ }
439
+ // __first.__ctz_ == 0;
440
+ // do middle words
441
+ __storage_type __nw = __n / __bits_per_word;
442
+ _CUDA_VSTD::memmove(_CUDA_VSTD::__to_raw_pointer(__result.__seg_),
443
+ _CUDA_VSTD::__to_raw_pointer(__first.__seg_),
444
+ __nw * sizeof(__storage_type));
445
+ __n -= __nw * __bits_per_word;
446
+ __result.__seg_ += __nw;
447
+ // do last word
448
+ if (__n > 0)
449
+ {
450
+ __first.__seg_ += __nw;
451
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
452
+ __storage_type __b = *__first.__seg_ & __m;
453
+ *__result.__seg_ &= ~__m;
454
+ *__result.__seg_ |= __b;
455
+ __result.__ctz_ = static_cast<unsigned>(__n);
456
+ }
457
+ }
458
+ return __result;
459
+ }
460
+
461
+ template <class _Cp, bool _IsConst>
462
+ __bit_iterator<_Cp, false>
463
+ __copy_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
464
+ __bit_iterator<_Cp, false> __result)
465
+ {
466
+ typedef __bit_iterator<_Cp, _IsConst> _In;
467
+ typedef typename _In::difference_type difference_type;
468
+ typedef typename _In::__storage_type __storage_type;
469
+ static const int __bits_per_word = _In::__bits_per_word;
470
+ difference_type __n = __last - __first;
471
+ if (__n > 0)
472
+ {
473
+ // do first word
474
+ if (__first.__ctz_ != 0)
475
+ {
476
+ unsigned __clz_f = __bits_per_word - __first.__ctz_;
477
+ difference_type __dn = _CUDA_VSTD::min(static_cast<difference_type>(__clz_f), __n);
478
+ __n -= __dn;
479
+ __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
480
+ __storage_type __b = *__first.__seg_ & __m;
481
+ unsigned __clz_r = __bits_per_word - __result.__ctz_;
482
+ __storage_type __ddn = _CUDA_VSTD::min<__storage_type>(__dn, __clz_r);
483
+ __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
484
+ *__result.__seg_ &= ~__m;
485
+ if (__result.__ctz_ > __first.__ctz_)
486
+ *__result.__seg_ |= __b << (__result.__ctz_ - __first.__ctz_);
487
+ else
488
+ *__result.__seg_ |= __b >> (__first.__ctz_ - __result.__ctz_);
489
+ __result.__seg_ += (__ddn + __result.__ctz_) / __bits_per_word;
490
+ __result.__ctz_ = static_cast<unsigned>((__ddn + __result.__ctz_) % __bits_per_word);
491
+ __dn -= __ddn;
492
+ if (__dn > 0)
493
+ {
494
+ __m = ~__storage_type(0) >> (__bits_per_word - __dn);
495
+ *__result.__seg_ &= ~__m;
496
+ *__result.__seg_ |= __b >> (__first.__ctz_ + __ddn);
497
+ __result.__ctz_ = static_cast<unsigned>(__dn);
498
+ }
499
+ ++__first.__seg_;
500
+ // __first.__ctz_ = 0;
501
+ }
502
+ // __first.__ctz_ == 0;
503
+ // do middle words
504
+ unsigned __clz_r = __bits_per_word - __result.__ctz_;
505
+ __storage_type __m = ~__storage_type(0) << __result.__ctz_;
506
+ for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_)
507
+ {
508
+ __storage_type __b = *__first.__seg_;
509
+ *__result.__seg_ &= ~__m;
510
+ *__result.__seg_ |= __b << __result.__ctz_;
511
+ ++__result.__seg_;
512
+ *__result.__seg_ &= __m;
513
+ *__result.__seg_ |= __b >> __clz_r;
514
+ }
515
+ // do last word
516
+ if (__n > 0)
517
+ {
518
+ __m = ~__storage_type(0) >> (__bits_per_word - __n);
519
+ __storage_type __b = *__first.__seg_ & __m;
520
+ __storage_type __dn = _CUDA_VSTD::min(__n, static_cast<difference_type>(__clz_r));
521
+ __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn));
522
+ *__result.__seg_ &= ~__m;
523
+ *__result.__seg_ |= __b << __result.__ctz_;
524
+ __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word;
525
+ __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_) % __bits_per_word);
526
+ __n -= __dn;
527
+ if (__n > 0)
528
+ {
529
+ __m = ~__storage_type(0) >> (__bits_per_word - __n);
530
+ *__result.__seg_ &= ~__m;
531
+ *__result.__seg_ |= __b >> __dn;
532
+ __result.__ctz_ = static_cast<unsigned>(__n);
533
+ }
534
+ }
535
+ }
536
+ return __result;
537
+ }
538
+
539
+ template <class _Cp, bool _IsConst>
540
+ inline _LIBCUDACXX_INLINE_VISIBILITY
541
+ __bit_iterator<_Cp, false>
542
+ copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
543
+ {
544
+ if (__first.__ctz_ == __result.__ctz_)
545
+ return __copy_aligned(__first, __last, __result);
546
+ return __copy_unaligned(__first, __last, __result);
547
+ }
548
+
549
+ // copy_backward
550
+
551
+ template <class _Cp, bool _IsConst>
552
+ __bit_iterator<_Cp, false>
553
+ __copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
554
+ __bit_iterator<_Cp, false> __result)
555
+ {
556
+ typedef __bit_iterator<_Cp, _IsConst> _In;
557
+ typedef typename _In::difference_type difference_type;
558
+ typedef typename _In::__storage_type __storage_type;
559
+ const int __bits_per_word = _In::__bits_per_word;
560
+ difference_type __n = __last - __first;
561
+ if (__n > 0)
562
+ {
563
+ // do first word
564
+ if (__last.__ctz_ != 0)
565
+ {
566
+ difference_type __dn = _CUDA_VSTD::min(static_cast<difference_type>(__last.__ctz_), __n);
567
+ __n -= __dn;
568
+ unsigned __clz = __bits_per_word - __last.__ctz_;
569
+ __storage_type __m = (~__storage_type(0) << (__last.__ctz_ - __dn)) & (~__storage_type(0) >> __clz);
570
+ __storage_type __b = *__last.__seg_ & __m;
571
+ *__result.__seg_ &= ~__m;
572
+ *__result.__seg_ |= __b;
573
+ __result.__ctz_ = static_cast<unsigned>(((-__dn & (__bits_per_word - 1)) +
574
+ __result.__ctz_) % __bits_per_word);
575
+ // __last.__ctz_ = 0
576
+ }
577
+ // __last.__ctz_ == 0 || __n == 0
578
+ // __result.__ctz_ == 0 || __n == 0
579
+ // do middle words
580
+ __storage_type __nw = __n / __bits_per_word;
581
+ __result.__seg_ -= __nw;
582
+ __last.__seg_ -= __nw;
583
+ _CUDA_VSTD::memmove(_CUDA_VSTD::__to_raw_pointer(__result.__seg_),
584
+ _CUDA_VSTD::__to_raw_pointer(__last.__seg_),
585
+ __nw * sizeof(__storage_type));
586
+ __n -= __nw * __bits_per_word;
587
+ // do last word
588
+ if (__n > 0)
589
+ {
590
+ __storage_type __m = ~__storage_type(0) << (__bits_per_word - __n);
591
+ __storage_type __b = *--__last.__seg_ & __m;
592
+ *--__result.__seg_ &= ~__m;
593
+ *__result.__seg_ |= __b;
594
+ __result.__ctz_ = static_cast<unsigned>(-__n & (__bits_per_word - 1));
595
+ }
596
+ }
597
+ return __result;
598
+ }
599
+
600
+ template <class _Cp, bool _IsConst>
601
+ __bit_iterator<_Cp, false>
602
+ __copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
603
+ __bit_iterator<_Cp, false> __result)
604
+ {
605
+ typedef __bit_iterator<_Cp, _IsConst> _In;
606
+ typedef typename _In::difference_type difference_type;
607
+ typedef typename _In::__storage_type __storage_type;
608
+ const int __bits_per_word = _In::__bits_per_word;
609
+ difference_type __n = __last - __first;
610
+ if (__n > 0)
611
+ {
612
+ // do first word
613
+ if (__last.__ctz_ != 0)
614
+ {
615
+ difference_type __dn = _CUDA_VSTD::min(static_cast<difference_type>(__last.__ctz_), __n);
616
+ __n -= __dn;
617
+ unsigned __clz_l = __bits_per_word - __last.__ctz_;
618
+ __storage_type __m = (~__storage_type(0) << (__last.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_l);
619
+ __storage_type __b = *__last.__seg_ & __m;
620
+ unsigned __clz_r = __bits_per_word - __result.__ctz_;
621
+ __storage_type __ddn = _CUDA_VSTD::min(__dn, static_cast<difference_type>(__result.__ctz_));
622
+ if (__ddn > 0)
623
+ {
624
+ __m = (~__storage_type(0) << (__result.__ctz_ - __ddn)) & (~__storage_type(0) >> __clz_r);
625
+ *__result.__seg_ &= ~__m;
626
+ if (__result.__ctz_ > __last.__ctz_)
627
+ *__result.__seg_ |= __b << (__result.__ctz_ - __last.__ctz_);
628
+ else
629
+ *__result.__seg_ |= __b >> (__last.__ctz_ - __result.__ctz_);
630
+ __result.__ctz_ = static_cast<unsigned>(((-__ddn & (__bits_per_word - 1)) +
631
+ __result.__ctz_) % __bits_per_word);
632
+ __dn -= __ddn;
633
+ }
634
+ if (__dn > 0)
635
+ {
636
+ // __result.__ctz_ == 0
637
+ --__result.__seg_;
638
+ __result.__ctz_ = static_cast<unsigned>(-__dn & (__bits_per_word - 1));
639
+ __m = ~__storage_type(0) << __result.__ctz_;
640
+ *__result.__seg_ &= ~__m;
641
+ __last.__ctz_ -= __dn + __ddn;
642
+ *__result.__seg_ |= __b << (__result.__ctz_ - __last.__ctz_);
643
+ }
644
+ // __last.__ctz_ = 0
645
+ }
646
+ // __last.__ctz_ == 0 || __n == 0
647
+ // __result.__ctz_ != 0 || __n == 0
648
+ // do middle words
649
+ unsigned __clz_r = __bits_per_word - __result.__ctz_;
650
+ __storage_type __m = ~__storage_type(0) >> __clz_r;
651
+ for (; __n >= __bits_per_word; __n -= __bits_per_word)
652
+ {
653
+ __storage_type __b = *--__last.__seg_;
654
+ *__result.__seg_ &= ~__m;
655
+ *__result.__seg_ |= __b >> __clz_r;
656
+ *--__result.__seg_ &= __m;
657
+ *__result.__seg_ |= __b << __result.__ctz_;
658
+ }
659
+ // do last word
660
+ if (__n > 0)
661
+ {
662
+ __m = ~__storage_type(0) << (__bits_per_word - __n);
663
+ __storage_type __b = *--__last.__seg_ & __m;
664
+ __clz_r = __bits_per_word - __result.__ctz_;
665
+ __storage_type __dn = _CUDA_VSTD::min(__n, static_cast<difference_type>(__result.__ctz_));
666
+ __m = (~__storage_type(0) << (__result.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_r);
667
+ *__result.__seg_ &= ~__m;
668
+ *__result.__seg_ |= __b >> (__bits_per_word - __result.__ctz_);
669
+ __result.__ctz_ = static_cast<unsigned>(((-__dn & (__bits_per_word - 1)) +
670
+ __result.__ctz_) % __bits_per_word);
671
+ __n -= __dn;
672
+ if (__n > 0)
673
+ {
674
+ // __result.__ctz_ == 0
675
+ --__result.__seg_;
676
+ __result.__ctz_ = static_cast<unsigned>(-__n & (__bits_per_word - 1));
677
+ __m = ~__storage_type(0) << __result.__ctz_;
678
+ *__result.__seg_ &= ~__m;
679
+ *__result.__seg_ |= __b << (__result.__ctz_ - (__bits_per_word - __n - __dn));
680
+ }
681
+ }
682
+ }
683
+ return __result;
684
+ }
685
+
686
+ template <class _Cp, bool _IsConst>
687
+ inline _LIBCUDACXX_INLINE_VISIBILITY
688
+ __bit_iterator<_Cp, false>
689
+ copy_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
690
+ {
691
+ if (__last.__ctz_ == __result.__ctz_)
692
+ return __copy_backward_aligned(__first, __last, __result);
693
+ return __copy_backward_unaligned(__first, __last, __result);
694
+ }
695
+
696
+ // move
697
+
698
+ template <class _Cp, bool _IsConst>
699
+ inline _LIBCUDACXX_INLINE_VISIBILITY
700
+ __bit_iterator<_Cp, false>
701
+ move(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
702
+ {
703
+ return _CUDA_VSTD::copy(__first, __last, __result);
704
+ }
705
+
706
+ // move_backward
707
+
708
+ template <class _Cp, bool _IsConst>
709
+ inline _LIBCUDACXX_INLINE_VISIBILITY
710
+ __bit_iterator<_Cp, false>
711
+ move_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
712
+ {
713
+ return _CUDA_VSTD::copy_backward(__first, __last, __result);
714
+ }
715
+
716
+ // swap_ranges
717
+
718
+ template <class __C1, class __C2>
719
+ __bit_iterator<__C2, false>
720
+ __swap_ranges_aligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last,
721
+ __bit_iterator<__C2, false> __result)
722
+ {
723
+ typedef __bit_iterator<__C1, false> _I1;
724
+ typedef typename _I1::difference_type difference_type;
725
+ typedef typename _I1::__storage_type __storage_type;
726
+ const int __bits_per_word = _I1::__bits_per_word;
727
+ difference_type __n = __last - __first;
728
+ if (__n > 0)
729
+ {
730
+ // do first word
731
+ if (__first.__ctz_ != 0)
732
+ {
733
+ unsigned __clz = __bits_per_word - __first.__ctz_;
734
+ difference_type __dn = _CUDA_VSTD::min(static_cast<difference_type>(__clz), __n);
735
+ __n -= __dn;
736
+ __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz - __dn));
737
+ __storage_type __b1 = *__first.__seg_ & __m;
738
+ *__first.__seg_ &= ~__m;
739
+ __storage_type __b2 = *__result.__seg_ & __m;
740
+ *__result.__seg_ &= ~__m;
741
+ *__result.__seg_ |= __b1;
742
+ *__first.__seg_ |= __b2;
743
+ __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word;
744
+ __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_) % __bits_per_word);
745
+ ++__first.__seg_;
746
+ // __first.__ctz_ = 0;
747
+ }
748
+ // __first.__ctz_ == 0;
749
+ // do middle words
750
+ for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_, ++__result.__seg_)
751
+ swap(*__first.__seg_, *__result.__seg_);
752
+ // do last word
753
+ if (__n > 0)
754
+ {
755
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
756
+ __storage_type __b1 = *__first.__seg_ & __m;
757
+ *__first.__seg_ &= ~__m;
758
+ __storage_type __b2 = *__result.__seg_ & __m;
759
+ *__result.__seg_ &= ~__m;
760
+ *__result.__seg_ |= __b1;
761
+ *__first.__seg_ |= __b2;
762
+ __result.__ctz_ = static_cast<unsigned>(__n);
763
+ }
764
+ }
765
+ return __result;
766
+ }
767
+
768
+ template <class __C1, class __C2>
769
+ __bit_iterator<__C2, false>
770
+ __swap_ranges_unaligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last,
771
+ __bit_iterator<__C2, false> __result)
772
+ {
773
+ typedef __bit_iterator<__C1, false> _I1;
774
+ typedef typename _I1::difference_type difference_type;
775
+ typedef typename _I1::__storage_type __storage_type;
776
+ const int __bits_per_word = _I1::__bits_per_word;
777
+ difference_type __n = __last - __first;
778
+ if (__n > 0)
779
+ {
780
+ // do first word
781
+ if (__first.__ctz_ != 0)
782
+ {
783
+ unsigned __clz_f = __bits_per_word - __first.__ctz_;
784
+ difference_type __dn = _CUDA_VSTD::min(static_cast<difference_type>(__clz_f), __n);
785
+ __n -= __dn;
786
+ __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
787
+ __storage_type __b1 = *__first.__seg_ & __m;
788
+ *__first.__seg_ &= ~__m;
789
+ unsigned __clz_r = __bits_per_word - __result.__ctz_;
790
+ __storage_type __ddn = _CUDA_VSTD::min<__storage_type>(__dn, __clz_r);
791
+ __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
792
+ __storage_type __b2 = *__result.__seg_ & __m;
793
+ *__result.__seg_ &= ~__m;
794
+ if (__result.__ctz_ > __first.__ctz_)
795
+ {
796
+ unsigned __s = __result.__ctz_ - __first.__ctz_;
797
+ *__result.__seg_ |= __b1 << __s;
798
+ *__first.__seg_ |= __b2 >> __s;
799
+ }
800
+ else
801
+ {
802
+ unsigned __s = __first.__ctz_ - __result.__ctz_;
803
+ *__result.__seg_ |= __b1 >> __s;
804
+ *__first.__seg_ |= __b2 << __s;
805
+ }
806
+ __result.__seg_ += (__ddn + __result.__ctz_) / __bits_per_word;
807
+ __result.__ctz_ = static_cast<unsigned>((__ddn + __result.__ctz_) % __bits_per_word);
808
+ __dn -= __ddn;
809
+ if (__dn > 0)
810
+ {
811
+ __m = ~__storage_type(0) >> (__bits_per_word - __dn);
812
+ __b2 = *__result.__seg_ & __m;
813
+ *__result.__seg_ &= ~__m;
814
+ unsigned __s = __first.__ctz_ + __ddn;
815
+ *__result.__seg_ |= __b1 >> __s;
816
+ *__first.__seg_ |= __b2 << __s;
817
+ __result.__ctz_ = static_cast<unsigned>(__dn);
818
+ }
819
+ ++__first.__seg_;
820
+ // __first.__ctz_ = 0;
821
+ }
822
+ // __first.__ctz_ == 0;
823
+ // do middle words
824
+ __storage_type __m = ~__storage_type(0) << __result.__ctz_;
825
+ unsigned __clz_r = __bits_per_word - __result.__ctz_;
826
+ for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_)
827
+ {
828
+ __storage_type __b1 = *__first.__seg_;
829
+ __storage_type __b2 = *__result.__seg_ & __m;
830
+ *__result.__seg_ &= ~__m;
831
+ *__result.__seg_ |= __b1 << __result.__ctz_;
832
+ *__first.__seg_ = __b2 >> __result.__ctz_;
833
+ ++__result.__seg_;
834
+ __b2 = *__result.__seg_ & ~__m;
835
+ *__result.__seg_ &= __m;
836
+ *__result.__seg_ |= __b1 >> __clz_r;
837
+ *__first.__seg_ |= __b2 << __clz_r;
838
+ }
839
+ // do last word
840
+ if (__n > 0)
841
+ {
842
+ __m = ~__storage_type(0) >> (__bits_per_word - __n);
843
+ __storage_type __b1 = *__first.__seg_ & __m;
844
+ *__first.__seg_ &= ~__m;
845
+ __storage_type __dn = _CUDA_VSTD::min<__storage_type>(__n, __clz_r);
846
+ __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn));
847
+ __storage_type __b2 = *__result.__seg_ & __m;
848
+ *__result.__seg_ &= ~__m;
849
+ *__result.__seg_ |= __b1 << __result.__ctz_;
850
+ *__first.__seg_ |= __b2 >> __result.__ctz_;
851
+ __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word;
852
+ __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_) % __bits_per_word);
853
+ __n -= __dn;
854
+ if (__n > 0)
855
+ {
856
+ __m = ~__storage_type(0) >> (__bits_per_word - __n);
857
+ __b2 = *__result.__seg_ & __m;
858
+ *__result.__seg_ &= ~__m;
859
+ *__result.__seg_ |= __b1 >> __dn;
860
+ *__first.__seg_ |= __b2 << __dn;
861
+ __result.__ctz_ = static_cast<unsigned>(__n);
862
+ }
863
+ }
864
+ }
865
+ return __result;
866
+ }
867
+
868
+ template <class __C1, class __C2>
869
+ inline _LIBCUDACXX_INLINE_VISIBILITY
870
+ __bit_iterator<__C2, false>
871
+ swap_ranges(__bit_iterator<__C1, false> __first1, __bit_iterator<__C1, false> __last1,
872
+ __bit_iterator<__C2, false> __first2)
873
+ {
874
+ if (__first1.__ctz_ == __first2.__ctz_)
875
+ return __swap_ranges_aligned(__first1, __last1, __first2);
876
+ return __swap_ranges_unaligned(__first1, __last1, __first2);
877
+ }
878
+
879
+ // rotate
880
+
881
+ template <class _Cp>
882
+ struct __bit_array
883
+ {
884
+ typedef typename _Cp::difference_type difference_type;
885
+ typedef typename _Cp::__storage_type __storage_type;
886
+ typedef typename _Cp::__storage_pointer __storage_pointer;
887
+ typedef typename _Cp::iterator iterator;
888
+ static const unsigned __bits_per_word = _Cp::__bits_per_word;
889
+ static const unsigned _Np = 4;
890
+
891
+ difference_type __size_;
892
+ __storage_type __word_[_Np];
893
+
894
+ _LIBCUDACXX_INLINE_VISIBILITY static difference_type capacity()
895
+ {return static_cast<difference_type>(_Np * __bits_per_word);}
896
+ _LIBCUDACXX_INLINE_VISIBILITY explicit __bit_array(difference_type __s) : __size_(__s) {}
897
+ _LIBCUDACXX_INLINE_VISIBILITY iterator begin()
898
+ {
899
+ return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]), 0);
900
+ }
901
+ _LIBCUDACXX_INLINE_VISIBILITY iterator end()
902
+ {
903
+ return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]) + __size_ / __bits_per_word,
904
+ static_cast<unsigned>(__size_ % __bits_per_word));
905
+ }
906
+ };
907
+
908
+ template <class _Cp>
909
+ __bit_iterator<_Cp, false>
910
+ rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle, __bit_iterator<_Cp, false> __last)
911
+ {
912
+ typedef __bit_iterator<_Cp, false> _I1;
913
+ typedef typename _I1::difference_type difference_type;
914
+ difference_type __d1 = __middle - __first;
915
+ difference_type __d2 = __last - __middle;
916
+ _I1 __r = __first + __d2;
917
+ while (__d1 != 0 && __d2 != 0)
918
+ {
919
+ if (__d1 <= __d2)
920
+ {
921
+ if (__d1 <= __bit_array<_Cp>::capacity())
922
+ {
923
+ __bit_array<_Cp> __b(__d1);
924
+ _CUDA_VSTD::copy(__first, __middle, __b.begin());
925
+ _CUDA_VSTD::copy(__b.begin(), __b.end(), _CUDA_VSTD::copy(__middle, __last, __first));
926
+ break;
927
+ }
928
+ else
929
+ {
930
+ __bit_iterator<_Cp, false> __mp = _CUDA_VSTD::swap_ranges(__first, __middle, __middle);
931
+ __first = __middle;
932
+ __middle = __mp;
933
+ __d2 -= __d1;
934
+ }
935
+ }
936
+ else
937
+ {
938
+ if (__d2 <= __bit_array<_Cp>::capacity())
939
+ {
940
+ __bit_array<_Cp> __b(__d2);
941
+ _CUDA_VSTD::copy(__middle, __last, __b.begin());
942
+ _CUDA_VSTD::copy_backward(__b.begin(), __b.end(), _CUDA_VSTD::copy_backward(__first, __middle, __last));
943
+ break;
944
+ }
945
+ else
946
+ {
947
+ __bit_iterator<_Cp, false> __mp = __first + __d2;
948
+ _CUDA_VSTD::swap_ranges(__first, __mp, __middle);
949
+ __first = __mp;
950
+ __d1 -= __d2;
951
+ }
952
+ }
953
+ }
954
+ return __r;
955
+ }
956
+
957
+ // equal
958
+
959
+ template <class _Cp, bool _IC1, bool _IC2>
960
+ bool
961
+ __equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1,
962
+ __bit_iterator<_Cp, _IC2> __first2)
963
+ {
964
+ typedef __bit_iterator<_Cp, _IC1> _It;
965
+ typedef typename _It::difference_type difference_type;
966
+ typedef typename _It::__storage_type __storage_type;
967
+ static const int __bits_per_word = _It::__bits_per_word;
968
+ difference_type __n = __last1 - __first1;
969
+ if (__n > 0)
970
+ {
971
+ // do first word
972
+ if (__first1.__ctz_ != 0)
973
+ {
974
+ unsigned __clz_f = __bits_per_word - __first1.__ctz_;
975
+ difference_type __dn = _CUDA_VSTD::min(static_cast<difference_type>(__clz_f), __n);
976
+ __n -= __dn;
977
+ __storage_type __m = (~__storage_type(0) << __first1.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
978
+ __storage_type __b = *__first1.__seg_ & __m;
979
+ unsigned __clz_r = __bits_per_word - __first2.__ctz_;
980
+ __storage_type __ddn = _CUDA_VSTD::min<__storage_type>(__dn, __clz_r);
981
+ __m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
982
+ if (__first2.__ctz_ > __first1.__ctz_)
983
+ {
984
+ if ((*__first2.__seg_ & __m) != (__b << (__first2.__ctz_ - __first1.__ctz_)))
985
+ return false;
986
+ }
987
+ else
988
+ {
989
+ if ((*__first2.__seg_ & __m) != (__b >> (__first1.__ctz_ - __first2.__ctz_)))
990
+ return false;
991
+ }
992
+ __first2.__seg_ += (__ddn + __first2.__ctz_) / __bits_per_word;
993
+ __first2.__ctz_ = static_cast<unsigned>((__ddn + __first2.__ctz_) % __bits_per_word);
994
+ __dn -= __ddn;
995
+ if (__dn > 0)
996
+ {
997
+ __m = ~__storage_type(0) >> (__bits_per_word - __dn);
998
+ if ((*__first2.__seg_ & __m) != (__b >> (__first1.__ctz_ + __ddn)))
999
+ return false;
1000
+ __first2.__ctz_ = static_cast<unsigned>(__dn);
1001
+ }
1002
+ ++__first1.__seg_;
1003
+ // __first1.__ctz_ = 0;
1004
+ }
1005
+ // __first1.__ctz_ == 0;
1006
+ // do middle words
1007
+ unsigned __clz_r = __bits_per_word - __first2.__ctz_;
1008
+ __storage_type __m = ~__storage_type(0) << __first2.__ctz_;
1009
+ for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first1.__seg_)
1010
+ {
1011
+ __storage_type __b = *__first1.__seg_;
1012
+ if ((*__first2.__seg_ & __m) != (__b << __first2.__ctz_))
1013
+ return false;
1014
+ ++__first2.__seg_;
1015
+ if ((*__first2.__seg_ & ~__m) != (__b >> __clz_r))
1016
+ return false;
1017
+ }
1018
+ // do last word
1019
+ if (__n > 0)
1020
+ {
1021
+ __m = ~__storage_type(0) >> (__bits_per_word - __n);
1022
+ __storage_type __b = *__first1.__seg_ & __m;
1023
+ __storage_type __dn = _CUDA_VSTD::min(__n, static_cast<difference_type>(__clz_r));
1024
+ __m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn));
1025
+ if ((*__first2.__seg_ & __m) != (__b << __first2.__ctz_))
1026
+ return false;
1027
+ __first2.__seg_ += (__dn + __first2.__ctz_) / __bits_per_word;
1028
+ __first2.__ctz_ = static_cast<unsigned>((__dn + __first2.__ctz_) % __bits_per_word);
1029
+ __n -= __dn;
1030
+ if (__n > 0)
1031
+ {
1032
+ __m = ~__storage_type(0) >> (__bits_per_word - __n);
1033
+ if ((*__first2.__seg_ & __m) != (__b >> __dn))
1034
+ return false;
1035
+ }
1036
+ }
1037
+ }
1038
+ return true;
1039
+ }
1040
+
1041
+ template <class _Cp, bool _IC1, bool _IC2>
1042
+ bool
1043
+ __equal_aligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1,
1044
+ __bit_iterator<_Cp, _IC2> __first2)
1045
+ {
1046
+ typedef __bit_iterator<_Cp, _IC1> _It;
1047
+ typedef typename _It::difference_type difference_type;
1048
+ typedef typename _It::__storage_type __storage_type;
1049
+ static const int __bits_per_word = _It::__bits_per_word;
1050
+ difference_type __n = __last1 - __first1;
1051
+ if (__n > 0)
1052
+ {
1053
+ // do first word
1054
+ if (__first1.__ctz_ != 0)
1055
+ {
1056
+ unsigned __clz = __bits_per_word - __first1.__ctz_;
1057
+ difference_type __dn = _CUDA_VSTD::min(static_cast<difference_type>(__clz), __n);
1058
+ __n -= __dn;
1059
+ __storage_type __m = (~__storage_type(0) << __first1.__ctz_) & (~__storage_type(0) >> (__clz - __dn));
1060
+ if ((*__first2.__seg_ & __m) != (*__first1.__seg_ & __m))
1061
+ return false;
1062
+ ++__first2.__seg_;
1063
+ ++__first1.__seg_;
1064
+ // __first1.__ctz_ = 0;
1065
+ // __first2.__ctz_ = 0;
1066
+ }
1067
+ // __first1.__ctz_ == 0;
1068
+ // __first2.__ctz_ == 0;
1069
+ // do middle words
1070
+ for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first1.__seg_, ++__first2.__seg_)
1071
+ if (*__first2.__seg_ != *__first1.__seg_)
1072
+ return false;
1073
+ // do last word
1074
+ if (__n > 0)
1075
+ {
1076
+ __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
1077
+ if ((*__first2.__seg_ & __m) != (*__first1.__seg_ & __m))
1078
+ return false;
1079
+ }
1080
+ }
1081
+ return true;
1082
+ }
1083
+
1084
+ template <class _Cp, bool _IC1, bool _IC2>
1085
+ inline _LIBCUDACXX_INLINE_VISIBILITY
1086
+ bool
1087
+ equal(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __bit_iterator<_Cp, _IC2> __first2)
1088
+ {
1089
+ if (__first1.__ctz_ == __first2.__ctz_)
1090
+ return __equal_aligned(__first1, __last1, __first2);
1091
+ return __equal_unaligned(__first1, __last1, __first2);
1092
+ }
1093
+
1094
+ template <class _Cp, bool _IsConst,
1095
+ typename _Cp::__storage_type>
1096
+ class __bit_iterator
1097
+ {
1098
+ public:
1099
+ typedef typename _Cp::difference_type difference_type;
1100
+ typedef bool value_type;
1101
+ typedef __bit_iterator pointer;
1102
+ typedef typename conditional<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> >::type reference;
1103
+ typedef random_access_iterator_tag iterator_category;
1104
+
1105
+ private:
1106
+ typedef typename _Cp::__storage_type __storage_type;
1107
+ typedef typename conditional<_IsConst, typename _Cp::__const_storage_pointer,
1108
+ typename _Cp::__storage_pointer>::type __storage_pointer;
1109
+ static const unsigned __bits_per_word = _Cp::__bits_per_word;
1110
+
1111
+ __storage_pointer __seg_;
1112
+ unsigned __ctz_;
1113
+
1114
+ public:
1115
+ _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator() noexcept
1116
+ #if _LIBCUDACXX_STD_VER > 11
1117
+ : __seg_(nullptr), __ctz_(0)
1118
+ #endif
1119
+ {}
1120
+ // avoid re-declaring a copy constructor for the non-const version.
1121
+ using __type_for_copy_to_const =
1122
+ _If<_IsConst, __bit_iterator<_Cp, false>, struct __private_nat>;
1123
+
1124
+ _LIBCUDACXX_INLINE_VISIBILITY
1125
+ __bit_iterator(const __type_for_copy_to_const& __it) noexcept
1126
+ : __seg_(__it.__seg_), __ctz_(__it.__ctz_) {}
1127
+
1128
+ _LIBCUDACXX_INLINE_VISIBILITY reference operator*() const noexcept
1129
+ {return reference(__seg_, __storage_type(1) << __ctz_);}
1130
+
1131
+ _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator& operator++()
1132
+ {
1133
+ if (__ctz_ != __bits_per_word-1)
1134
+ ++__ctz_;
1135
+ else
1136
+ {
1137
+ __ctz_ = 0;
1138
+ ++__seg_;
1139
+ }
1140
+ return *this;
1141
+ }
1142
+
1143
+ _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator operator++(int)
1144
+ {
1145
+ __bit_iterator __tmp = *this;
1146
+ ++(*this);
1147
+ return __tmp;
1148
+ }
1149
+
1150
+ _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator& operator--()
1151
+ {
1152
+ if (__ctz_ != 0)
1153
+ --__ctz_;
1154
+ else
1155
+ {
1156
+ __ctz_ = __bits_per_word - 1;
1157
+ --__seg_;
1158
+ }
1159
+ return *this;
1160
+ }
1161
+
1162
+ _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator operator--(int)
1163
+ {
1164
+ __bit_iterator __tmp = *this;
1165
+ --(*this);
1166
+ return __tmp;
1167
+ }
1168
+
1169
+ _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator& operator+=(difference_type __n)
1170
+ {
1171
+ if (__n >= 0)
1172
+ __seg_ += (__n + __ctz_) / __bits_per_word;
1173
+ else
1174
+ __seg_ += static_cast<difference_type>(__n - __bits_per_word + __ctz_ + 1)
1175
+ / static_cast<difference_type>(__bits_per_word);
1176
+ __n &= (__bits_per_word - 1);
1177
+ __ctz_ = static_cast<unsigned>((__n + __ctz_) % __bits_per_word);
1178
+ return *this;
1179
+ }
1180
+
1181
+ _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator& operator-=(difference_type __n)
1182
+ {
1183
+ return *this += -__n;
1184
+ }
1185
+
1186
+ _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator operator+(difference_type __n) const
1187
+ {
1188
+ __bit_iterator __t(*this);
1189
+ __t += __n;
1190
+ return __t;
1191
+ }
1192
+
1193
+ _LIBCUDACXX_INLINE_VISIBILITY __bit_iterator operator-(difference_type __n) const
1194
+ {
1195
+ __bit_iterator __t(*this);
1196
+ __t -= __n;
1197
+ return __t;
1198
+ }
1199
+
1200
+ _LIBCUDACXX_INLINE_VISIBILITY
1201
+ friend __bit_iterator operator+(difference_type __n, const __bit_iterator& __it) {return __it + __n;}
1202
+
1203
+ _LIBCUDACXX_INLINE_VISIBILITY
1204
+ friend difference_type operator-(const __bit_iterator& __x, const __bit_iterator& __y)
1205
+ {return (__x.__seg_ - __y.__seg_) * __bits_per_word + __x.__ctz_ - __y.__ctz_;}
1206
+
1207
+ _LIBCUDACXX_INLINE_VISIBILITY reference operator[](difference_type __n) const {return *(*this + __n);}
1208
+
1209
+ _LIBCUDACXX_INLINE_VISIBILITY friend bool operator==(const __bit_iterator& __x, const __bit_iterator& __y)
1210
+ {return __x.__seg_ == __y.__seg_ && __x.__ctz_ == __y.__ctz_;}
1211
+
1212
+ _LIBCUDACXX_INLINE_VISIBILITY friend bool operator!=(const __bit_iterator& __x, const __bit_iterator& __y)
1213
+ {return !(__x == __y);}
1214
+
1215
+ _LIBCUDACXX_INLINE_VISIBILITY friend bool operator<(const __bit_iterator& __x, const __bit_iterator& __y)
1216
+ {return __x.__seg_ < __y.__seg_ || (__x.__seg_ == __y.__seg_ && __x.__ctz_ < __y.__ctz_);}
1217
+
1218
+ _LIBCUDACXX_INLINE_VISIBILITY friend bool operator>(const __bit_iterator& __x, const __bit_iterator& __y)
1219
+ {return __y < __x;}
1220
+
1221
+ _LIBCUDACXX_INLINE_VISIBILITY friend bool operator<=(const __bit_iterator& __x, const __bit_iterator& __y)
1222
+ {return !(__y < __x);}
1223
+
1224
+ _LIBCUDACXX_INLINE_VISIBILITY friend bool operator>=(const __bit_iterator& __x, const __bit_iterator& __y)
1225
+ {return !(__x < __y);}
1226
+
1227
+ private:
1228
+ _LIBCUDACXX_INLINE_VISIBILITY
1229
+ __bit_iterator(__storage_pointer __s, unsigned __ctz) noexcept
1230
+ : __seg_(__s), __ctz_(__ctz) {}
1231
+
1232
+ friend typename _Cp::__self;
1233
+
1234
+ friend class __bit_reference<_Cp>;
1235
+ friend class __bit_const_reference<_Cp>;
1236
+ friend class __bit_iterator<_Cp, true>;
1237
+ template <class _Dp> friend struct __bit_array;
1238
+ template <class _Dp> friend void __fill_n_false(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n);
1239
+ template <class _Dp> friend void __fill_n_true(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n);
1240
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_aligned(__bit_iterator<_Dp, _IC> __first,
1241
+ __bit_iterator<_Dp, _IC> __last,
1242
+ __bit_iterator<_Dp, false> __result);
1243
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_unaligned(__bit_iterator<_Dp, _IC> __first,
1244
+ __bit_iterator<_Dp, _IC> __last,
1245
+ __bit_iterator<_Dp, false> __result);
1246
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> copy(__bit_iterator<_Dp, _IC> __first,
1247
+ __bit_iterator<_Dp, _IC> __last,
1248
+ __bit_iterator<_Dp, false> __result);
1249
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_backward_aligned(__bit_iterator<_Dp, _IC> __first,
1250
+ __bit_iterator<_Dp, _IC> __last,
1251
+ __bit_iterator<_Dp, false> __result);
1252
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_backward_unaligned(__bit_iterator<_Dp, _IC> __first,
1253
+ __bit_iterator<_Dp, _IC> __last,
1254
+ __bit_iterator<_Dp, false> __result);
1255
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> copy_backward(__bit_iterator<_Dp, _IC> __first,
1256
+ __bit_iterator<_Dp, _IC> __last,
1257
+ __bit_iterator<_Dp, false> __result);
1258
+ template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_aligned(__bit_iterator<__C1, false>,
1259
+ __bit_iterator<__C1, false>,
1260
+ __bit_iterator<__C2, false>);
1261
+ template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_unaligned(__bit_iterator<__C1, false>,
1262
+ __bit_iterator<__C1, false>,
1263
+ __bit_iterator<__C2, false>);
1264
+ template <class __C1, class __C2>friend __bit_iterator<__C2, false> swap_ranges(__bit_iterator<__C1, false>,
1265
+ __bit_iterator<__C1, false>,
1266
+ __bit_iterator<__C2, false>);
1267
+ template <class _Dp> friend __bit_iterator<_Dp, false> rotate(__bit_iterator<_Dp, false>,
1268
+ __bit_iterator<_Dp, false>,
1269
+ __bit_iterator<_Dp, false>);
1270
+ template <class _Dp, bool _IC1, bool _IC2> friend bool __equal_aligned(__bit_iterator<_Dp, _IC1>,
1271
+ __bit_iterator<_Dp, _IC1>,
1272
+ __bit_iterator<_Dp, _IC2>);
1273
+ template <class _Dp, bool _IC1, bool _IC2> friend bool __equal_unaligned(__bit_iterator<_Dp, _IC1>,
1274
+ __bit_iterator<_Dp, _IC1>,
1275
+ __bit_iterator<_Dp, _IC2>);
1276
+ template <class _Dp, bool _IC1, bool _IC2> friend bool equal(__bit_iterator<_Dp, _IC1>,
1277
+ __bit_iterator<_Dp, _IC1>,
1278
+ __bit_iterator<_Dp, _IC2>);
1279
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, _IC> __find_bool_true(__bit_iterator<_Dp, _IC>,
1280
+ typename _Dp::size_type);
1281
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, _IC> __find_bool_false(__bit_iterator<_Dp, _IC>,
1282
+ typename _Dp::size_type);
1283
+ template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type
1284
+ __count_bool_true(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
1285
+ template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type
1286
+ __count_bool_false(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
1287
+ };
1288
+
1289
+ _LIBCUDACXX_END_NAMESPACE_STD
1290
+
1291
+ _LIBCUDACXX_POP_MACROS
1292
+
1293
+ #endif // _LIBCUDACXX___BIT_REFERENCE
cuda_toolkit/include/__bsd_locale_defaults.h ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===---------------------- __bsd_locale_defaults.h -----------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+ // The BSDs have lots of *_l functions. We don't want to define those symbols
10
+ // on other platforms though, for fear of conflicts with user code. So here,
11
+ // we will define the mapping from an internal macro to the real BSD symbol.
12
+ //===----------------------------------------------------------------------===//
13
+
14
+ #ifndef _LIBCUDACXX_BSD_LOCALE_DEFAULTS_H
15
+ #define _LIBCUDACXX_BSD_LOCALE_DEFAULTS_H
16
+
17
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
18
+ # pragma GCC system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
20
+ # pragma clang system_header
21
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
22
+ # pragma system_header
23
+ #endif // no system header
24
+
25
+ #define __libcpp_mb_cur_max_l(loc) MB_CUR_MAX_L(loc)
26
+ #define __libcpp_btowc_l(ch, loc) btowc_l(ch, loc)
27
+ #define __libcpp_wctob_l(wch, loc) wctob_l(wch, loc)
28
+ #define __libcpp_wcsnrtombs_l(dst, src, nwc, len, ps, loc) wcsnrtombs_l(dst, src, nwc, len, ps, loc)
29
+ #define __libcpp_wcrtomb_l(src, wc, ps, loc) wcrtomb_l(src, wc, ps, loc)
30
+ #define __libcpp_mbsnrtowcs_l(dst, src, nms, len, ps, loc) mbsnrtowcs_l(dst, src, nms, len, ps, loc)
31
+ #define __libcpp_mbrtowc_l(pwc, s, n, ps, l) mbrtowc_l(pwc, s, n, ps, l)
32
+ #define __libcpp_mbtowc_l(pwc, pmb, max, l) mbtowc_l(pwc, pmb, max, l)
33
+ #define __libcpp_mbrlen_l(s, n, ps, l) mbrlen_l(s, n, ps, l)
34
+ #define __libcpp_localeconv_l(l) localeconv_l(l)
35
+ #define __libcpp_mbsrtowcs_l(dest, src, len, ps, l) mbsrtowcs_l(dest, src, len, ps, l)
36
+ #define __libcpp_snprintf_l(...) snprintf_l(__VA_ARGS__)
37
+ #define __libcpp_asprintf_l(...) asprintf_l(__VA_ARGS__)
38
+ #define __libcpp_sscanf_l(...) sscanf_l(__VA_ARGS__)
39
+
40
+ #endif // _LIBCUDACXX_BSD_LOCALE_DEFAULTS_H
cuda_toolkit/include/__bsd_locale_fallbacks.h ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===---------------------- __bsd_locale_fallbacks.h ----------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+ // The BSDs have lots of *_l functions. This file provides reimplementations
10
+ // of those functions for non-BSD platforms.
11
+ //===----------------------------------------------------------------------===//
12
+
13
+ #ifndef _LIBCUDACXX_BSD_LOCALE_FALLBACKS_DEFAULTS_H
14
+ #define _LIBCUDACXX_BSD_LOCALE_FALLBACKS_DEFAULTS_H
15
+
16
+ #include <stdlib.h>
17
+ #include <stdarg.h>
18
+ #include <memory>
19
+
20
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
21
+ # pragma GCC system_header
22
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
23
+ # pragma clang system_header
24
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
25
+ # pragma system_header
26
+ #endif // no system header
27
+
28
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
29
+
30
+ inline _LIBCUDACXX_INLINE_VISIBILITY
31
+ decltype(MB_CUR_MAX) __libcpp_mb_cur_max_l(locale_t __l)
32
+ {
33
+ __libcpp_locale_guard __current(__l);
34
+ return MB_CUR_MAX;
35
+ }
36
+
37
+ inline _LIBCUDACXX_INLINE_VISIBILITY
38
+ wint_t __libcpp_btowc_l(int __c, locale_t __l)
39
+ {
40
+ __libcpp_locale_guard __current(__l);
41
+ return btowc(__c);
42
+ }
43
+
44
+ inline _LIBCUDACXX_INLINE_VISIBILITY
45
+ int __libcpp_wctob_l(wint_t __c, locale_t __l)
46
+ {
47
+ __libcpp_locale_guard __current(__l);
48
+ return wctob(__c);
49
+ }
50
+
51
+ inline _LIBCUDACXX_INLINE_VISIBILITY
52
+ size_t __libcpp_wcsnrtombs_l(char *__dest, const wchar_t **__src, size_t __nwc,
53
+ size_t __len, mbstate_t *__ps, locale_t __l)
54
+ {
55
+ __libcpp_locale_guard __current(__l);
56
+ return wcsnrtombs(__dest, __src, __nwc, __len, __ps);
57
+ }
58
+
59
+ inline _LIBCUDACXX_INLINE_VISIBILITY
60
+ size_t __libcpp_wcrtomb_l(char *__s, wchar_t __wc, mbstate_t *__ps, locale_t __l)
61
+ {
62
+ __libcpp_locale_guard __current(__l);
63
+ return wcrtomb(__s, __wc, __ps);
64
+ }
65
+
66
+ inline _LIBCUDACXX_INLINE_VISIBILITY
67
+ size_t __libcpp_mbsnrtowcs_l(wchar_t * __dest, const char **__src, size_t __nms,
68
+ size_t __len, mbstate_t *__ps, locale_t __l)
69
+ {
70
+ __libcpp_locale_guard __current(__l);
71
+ return mbsnrtowcs(__dest, __src, __nms, __len, __ps);
72
+ }
73
+
74
+ inline _LIBCUDACXX_INLINE_VISIBILITY
75
+ size_t __libcpp_mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n,
76
+ mbstate_t *__ps, locale_t __l)
77
+ {
78
+ __libcpp_locale_guard __current(__l);
79
+ return mbrtowc(__pwc, __s, __n, __ps);
80
+ }
81
+
82
+ inline _LIBCUDACXX_INLINE_VISIBILITY
83
+ int __libcpp_mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l)
84
+ {
85
+ __libcpp_locale_guard __current(__l);
86
+ return mbtowc(__pwc, __pmb, __max);
87
+ }
88
+
89
+ inline _LIBCUDACXX_INLINE_VISIBILITY
90
+ size_t __libcpp_mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t __l)
91
+ {
92
+ __libcpp_locale_guard __current(__l);
93
+ return mbrlen(__s, __n, __ps);
94
+ }
95
+
96
+ inline _LIBCUDACXX_INLINE_VISIBILITY
97
+ lconv *__libcpp_localeconv_l(locale_t __l)
98
+ {
99
+ __libcpp_locale_guard __current(__l);
100
+ return localeconv();
101
+ }
102
+
103
+ inline _LIBCUDACXX_INLINE_VISIBILITY
104
+ size_t __libcpp_mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len,
105
+ mbstate_t *__ps, locale_t __l)
106
+ {
107
+ __libcpp_locale_guard __current(__l);
108
+ return mbsrtowcs(__dest, __src, __len, __ps);
109
+ }
110
+
111
+ inline
112
+ int __libcpp_snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) {
113
+ va_list __va;
114
+ va_start(__va, __format);
115
+ __libcpp_locale_guard __current(__l);
116
+ int __res = vsnprintf(__s, __n, __format, __va);
117
+ va_end(__va);
118
+ return __res;
119
+ }
120
+
121
+ inline
122
+ int __libcpp_asprintf_l(char **__s, locale_t __l, const char *__format, ...) {
123
+ va_list __va;
124
+ va_start(__va, __format);
125
+ __libcpp_locale_guard __current(__l);
126
+ int __res = vasprintf(__s, __format, __va);
127
+ va_end(__va);
128
+ return __res;
129
+ }
130
+
131
+ inline
132
+ int __libcpp_sscanf_l(const char *__s, locale_t __l, const char *__format, ...) {
133
+ va_list __va;
134
+ va_start(__va, __format);
135
+ __libcpp_locale_guard __current(__l);
136
+ int __res = vsscanf(__s, __format, __va);
137
+ va_end(__va);
138
+ return __res;
139
+ }
140
+
141
+ _LIBCUDACXX_END_NAMESPACE_STD
142
+
143
+ #endif // _LIBCUDACXX_BSD_LOCALE_FALLBACKS_DEFAULTS_H
cuda_toolkit/include/__cccl_config ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of libcu++, the C++ Standard Library for your entire system,
4
+ // under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
8
+ //
9
+ //===----------------------------------------------------------------------===//
10
+
11
+ #ifndef __CCCL_CONFIG
12
+ #define __CCCL_CONFIG
13
+
14
+ // Determine the host compiler
15
+ #if defined(__INTEL_LLVM_COMPILER)
16
+ # define _CCCL_COMPILER_ICC_LLVM
17
+ #elif defined(__INTEL_COMPILER)
18
+ # define _CCCL_COMPILER_ICC
19
+ #elif defined(__NVCOMPILER)
20
+ # define _CCCL_COMPILER_NVHPC
21
+ #elif defined(__clang__)
22
+ # define _CCCL_COMPILER_CLANG
23
+ #elif defined(__GNUC__)
24
+ # define _CCCL_COMPILER_GCC
25
+ #elif defined(_MSC_VER)
26
+ # define _CCCL_COMPILER_MSVC
27
+ #elif defined(__IBMCPP__)
28
+ # define _CCCL_COMPILER_IBM
29
+ #elif defined(__CUDACC_RTC__)
30
+ # define _CCCL_COMPILER_NVRTC
31
+ #endif
32
+
33
+ // Convenient shortcut to determine which version of MSVC we are dealing with
34
+ #if defined(_CCCL_COMPILER_MSVC)
35
+ # if _MSC_VER < 1917
36
+ # define _CCCL_COMPILER_MSVC_2017
37
+ # elif _MSC_VER < 1930
38
+ # define _CCCL_COMPILER_MSVC_2019
39
+ # else // _MSC_VER < 1940
40
+ # define _CCCL_COMPILER_MSVC_2022
41
+ # endif // _MSC_VER < 1940
42
+ #endif // _CCCL_COMPILER_MSVC
43
+
44
+ // Determine the cuda compiler
45
+ #if defined(__NVCC__)
46
+ # define _CCCL_CUDA_COMPILER_NVCC
47
+ #elif defined(_NVHPC_CUDA)
48
+ # define _CCCL_CUDA_COMPILER_NVHPC
49
+ #elif defined(__CUDA__) && defined(_CCCL_COMPILER_CLANG)
50
+ # define _CCCL_CUDA_COMPILER_CLANG
51
+ #endif
52
+
53
+ // Shorthand to check whether there is a cuda compiler available
54
+ #if defined(_CCCL_CUDA_COMPILER_NVCC) || defined(_CCCL_CUDA_COMPILER_NVHPC) || defined(_CCCL_CUDA_COMPILER_CLANG) \
55
+ || defined(_CCCL_COMPILER_NVRTC)
56
+ # define _CCCL_CUDA_COMPILER
57
+ #endif // cuda compiler available
58
+
59
+ // Enforce that cccl headers are treated as system headers
60
+ #if defined(_CCCL_COMPILER_GCC) || defined(_CCCL_COMPILER_NVHPC) || defined(_CCCL_COMPILER_ICC) \
61
+ || defined(_CCCL_COMPILER_ICC_LLVM)
62
+ # define _CCCL_FORCE_SYSTEM_HEADER_GCC
63
+ #elif defined(_CCCL_COMPILER_CLANG)
64
+ # define _CCCL_FORCE_SYSTEM_HEADER_CLANG
65
+ #elif defined(_CCCL_COMPILER_MSVC)
66
+ # define _CCCL_FORCE_SYSTEM_HEADER_MSVC
67
+ #endif // other compilers
68
+
69
+ // Potentially enable that cccl headers are treated as system headers
70
+ #if !defined(_CCCL_NO_SYSTEM_HEADER) \
71
+ && !(defined(_CCCL_COMPILER_MSVC) && defined(_LIBCUDACXX_DISABLE_PRAGMA_MSVC_WARNING)) \
72
+ && !defined(_CCCL_COMPILER_NVRTC) && !defined(_LIBCUDACXX_DISABLE_PRAGMA_GCC_SYSTEM_HEADER)
73
+ # if defined(_CCCL_COMPILER_GCC) || defined(_CCCL_COMPILER_NVHPC) || defined(_CCCL_COMPILER_ICC) \
74
+ || defined(_CCCL_COMPILER_ICC_LLVM)
75
+ # define _CCCL_IMPLICIT_SYSTEM_HEADER_GCC
76
+ # elif defined(_CCCL_COMPILER_CLANG)
77
+ # define _CCCL_IMPLICIT_SYSTEM_HEADER_CLANG
78
+ # elif defined(_CCCL_COMPILER_MSVC)
79
+ # define _CCCL_IMPLICIT_SYSTEM_HEADER_MSVC
80
+ # endif // other compilers
81
+ #endif // Use system header
82
+
83
+ // Potentially silence all warnings from this header
84
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
85
+ # pragma GCC system_header
86
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
87
+ # pragma clang system_header
88
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
89
+ # pragma system_header
90
+ #endif // no system header
91
+
92
+ // Enable us to selectively silence host compiler warnings
93
+ #define _CCCL_TOSTRING2(_STR) #_STR
94
+ #define _CCCL_TOSTRING(_STR) _CCCL_TOSTRING2(_STR)
95
+ #ifdef _CCCL_COMPILER_CLANG
96
+ # define _CCCL_DIAG_PUSH _Pragma("clang diagnostic push")
97
+ # define _CCCL_DIAG_POP _Pragma("clang diagnostic pop")
98
+ # define _CCCL_DIAG_SUPPRESS_CLANG(str) _Pragma(_CCCL_TOSTRING(clang diagnostic ignored str))
99
+ # define _CCCL_DIAG_SUPPRESS_GCC(str)
100
+ # define _CCCL_DIAG_SUPPRESS_NVHPC(str)
101
+ # define _CCCL_DIAG_SUPPRESS_MSVC(str)
102
+ #elif defined(_CCCL_COMPILER_GCC)
103
+ # define _CCCL_DIAG_PUSH _Pragma("GCC diagnostic push")
104
+ # define _CCCL_DIAG_POP _Pragma("GCC diagnostic pop")
105
+ # define _CCCL_DIAG_SUPPRESS_CLANG(str)
106
+ # define _CCCL_DIAG_SUPPRESS_GCC(str) _Pragma(_CCCL_TOSTRING(GCC diagnostic ignored str))
107
+ # define _CCCL_DIAG_SUPPRESS_NVHPC(str)
108
+ # define _CCCL_DIAG_SUPPRESS_MSVC(str)
109
+ #elif defined(_CCCL_COMPILER_NVHPC)
110
+ # define _CCCL_DIAG_PUSH _Pragma("diagnostic push")
111
+ # define _CCCL_DIAG_POP _Pragma("diagnostic pop")
112
+ # define _CCCL_DIAG_SUPPRESS_CLANG(str)
113
+ # define _CCCL_DIAG_SUPPRESS_GCC(str)
114
+ # define _CCCL_DIAG_SUPPRESS_NVHPC(str) _Pragma(_CCCL_TOSTRING(diag_suppress str))
115
+ # define _CCCL_DIAG_SUPPRESS_MSVC(str)
116
+ #elif defined(_CCCL_COMPILER_MSVC)
117
+ # define _CCCL_DIAG_PUSH __pragma(warning(push))
118
+ # define _CCCL_DIAG_POP __pragma(warning(pop))
119
+ # define _CCCL_DIAG_SUPPRESS_CLANG(str)
120
+ # define _CCCL_DIAG_SUPPRESS_GCC(str)
121
+ # define _CCCL_DIAG_SUPPRESS_NVHPC(str)
122
+ # define _CCCL_DIAG_SUPPRESS_MSVC(str) __pragma(warning(disable : str))
123
+ #else
124
+ # define _CCCL_DIAG_PUSH
125
+ # define _CCCL_DIAG_POP
126
+ # define _CCCL_DIAG_SUPPRESS_CLANG(str)
127
+ # define _CCCL_DIAG_SUPPRESS_GCC(str)
128
+ # define _CCCL_DIAG_SUPPRESS_NVHPC(str)
129
+ # define _CCCL_DIAG_SUPPRESS_MSVC(str)
130
+ #endif
131
+
132
+ // Convenient shortcuts to silence common warnings
133
+ #if defined(_CCCL_COMPILER_CLANG)
134
+ # define _CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH \
135
+ _CCCL_DIAG_PUSH \
136
+ _CCCL_DIAG_SUPPRESS_CLANG("-Wdeprecated") \
137
+ _CCCL_DIAG_SUPPRESS_CLANG("-Wdeprecated-declarations")
138
+ # define _CCCL_DIAG_SUPPRESS_DEPRECATED_POP _CCCL_DIAG_POP
139
+ #elif defined(_CCCL_COMPILER_GCC)
140
+ # define _CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH \
141
+ _CCCL_DIAG_PUSH \
142
+ _CCCL_DIAG_SUPPRESS_GCC("-Wdeprecated") \
143
+ _CCCL_DIAG_SUPPRESS_GCC("-Wdeprecated-declarations")
144
+ # define _CCCL_DIAG_SUPPRESS_DEPRECATED_POP _CCCL_DIAG_POP
145
+ #elif defined(_CCCL_COMPILER_MSVC)
146
+ # define _CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH \
147
+ _CCCL_DIAG_PUSH \
148
+ _CCCL_DIAG_SUPPRESS_MSVC(4996)
149
+ # define _CCCL_DIAG_SUPPRESS_DEPRECATED_POP _CCCL_DIAG_POP
150
+ #else // !_CCCL_COMPILER_CLANG && !_CCCL_COMPILER_GCC
151
+ # define _CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH
152
+ # define _CCCL_DIAG_SUPPRESS_DEPRECATED_POP
153
+ #endif // !_CCCL_COMPILER_CLANG && !_CCCL_COMPILER_GCC
154
+
155
+ // Enable us to selectively silence cuda compiler warnings
156
+ #if defined(__CUDACC__)
157
+ # if !defined(_CCCL_CUDA_COMPILER_CLANG)
158
+ # define _CCCL_NV_DIAG_SUPPRESS(_WARNING)
159
+ # define _CCCL_NV_DIAG_DEFAULT(_WARNING)
160
+ # elif defined(__NVCC_DIAG_PRAGMA_SUPPORT__)
161
+ # if defined(_CCCL_COMPILER_MSVC)
162
+ # define _CCCL_NV_DIAG_SUPPRESS(_WARNING) __pragma(_CCCL_TOSTRING(nv_diag_suppress _WARNING))
163
+ # define _CCCL_NV_DIAG_DEFAULT(_WARNING) __pragma(_CCCL_TOSTRING(nv_diag_default _WARNING))
164
+ # else // ^^^ _CCCL_COMPILER_MSVC ^^^ / vvv !_CCCL_COMPILER_MSVC vvv
165
+ # define _CCCL_NV_DIAG_SUPPRESS(_WARNING) \
166
+ _Pragma(_CCCL_TOSTRING(nv_diagnostic push)) _Pragma(_CCCL_TOSTRING(nv_diag_suppress _WARNING))
167
+ # define _CCCL_NV_DIAG_DEFAULT(_WARNING) _Pragma(_CCCL_TOSTRING(nv_diagnostic pop))
168
+ # endif // !_CCCL_COMPILER_MSVC
169
+ # elif defined(_CCCL_COMPILER_NVHPC)
170
+ # define _CCCL_NV_DIAG_SUPPRESS(_WARNING) \
171
+ _Pragma(_CCCL_TOSTRING(diagnostic push)) _Pragma(_CCCL_TOSTRING(diag_suppress _WARNING))
172
+ # define _CCCL_NV_DIAG_DEFAULT(_WARNING) _Pragma(_CCCL_TOSTRING(diagnostic pop))
173
+ # else // ^^^ __NVCC_DIAG_PRAGMA_SUPPORT__ ^^^ / vvv !__NVCC_DIAG_PRAGMA_SUPPORT__ vvv
174
+ # if defined(_CCCL_COMPILER_MSVC_2017) // MSVC 2017 has issues with restoring the warning
175
+ # define _CCCL_NV_DIAG_SUPPRESS(_WARNING) __pragma(_CCCL_TOSTRING(diag_suppress _WARNING))
176
+ # define _CCCL_NV_DIAG_DEFAULT(_WARNING)
177
+ # elif defined(_CCCL_COMPILER_MSVC)
178
+ # define _CCCL_NV_DIAG_SUPPRESS(_WARNING) __pragma(_CCCL_TOSTRING(diag_suppress _WARNING))
179
+ # define _CCCL_NV_DIAG_DEFAULT(_WARNING) __pragma(_CCCL_TOSTRING(diag_default _WARNING))
180
+ # else // ^^^ _CCCL_COMPILER_MSVC ^^^ / vvv !_CCCL_COMPILER_MSVC vvv
181
+ # define _CCCL_NV_DIAG_SUPPRESS(_WARNING) _Pragma(_CCCL_TOSTRING(diag_suppress _WARNING))
182
+ # define _CCCL_NV_DIAG_DEFAULT(_WARNING) _Pragma(_CCCL_TOSTRING(diag_default _WARNING))
183
+ # endif // !_CCCL_COMPILER_MSVC
184
+ # endif // !__NVCC_DIAG_PRAGMA_SUPPORT__
185
+ #else // ^^^ __CUDACC__ ^^^ / vvv !__CUDACC__ vvv
186
+ # define _CCCL_NV_DIAG_SUPPRESS(_WARNING)
187
+ # define _CCCL_NV_DIAG_DEFAULT(_WARNING)
188
+ #endif // other compilers
189
+
190
+ #include "__cccl/ptx_isa.h"
191
+ #include "__cccl/version.h"
192
+ #include "__cccl/visibility.h"
193
+
194
+ #endif // __CCCL_CONFIG
cuda_toolkit/include/__config ADDED
@@ -0,0 +1,2250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===--------------------------- __config ---------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX_CONFIG
11
+ #define _LIBCUDACXX_CONFIG
12
+
13
+ #include "__cccl_config"
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #if defined(__INTEL_LLVM_COMPILER)
24
+ # define _LIBCUDACXX_COMPILER_ICC_LLVM
25
+ #elif defined(__INTEL_COMPILER)
26
+ # define _LIBCUDACXX_COMPILER_ICC
27
+ #elif defined(__NVCOMPILER)
28
+ # define _LIBCUDACXX_COMPILER_NVHPC
29
+ #elif defined(__clang__)
30
+ # define _LIBCUDACXX_COMPILER_CLANG
31
+ # ifndef __apple_build_version__
32
+ # define _LIBCUDACXX_CLANG_VER (__clang_major__ * 100 + __clang_minor__)
33
+ # endif
34
+ #elif defined(__GNUC__)
35
+ # define _LIBCUDACXX_COMPILER_GCC
36
+ #elif defined(_MSC_VER)
37
+ # define _LIBCUDACXX_COMPILER_MSVC
38
+ #elif defined(__IBMCPP__)
39
+ # define _LIBCUDACXX_COMPILER_IBM
40
+ #elif defined(__CUDACC_RTC__)
41
+ # define _LIBCUDACXX_COMPILER_NVRTC
42
+ #endif
43
+
44
+ #if defined(_LIBCUDACXX_COMPILER_MSVC)
45
+ #if _MSC_VER < 1917
46
+ #define _LIBCUDACXX_COMPILER_MSVC_2017
47
+ #elif _MSC_VER < 1930
48
+ #define _LIBCUDACXX_COMPILER_MSVC_2019
49
+ #else
50
+ #define _LIBCUDACXX_COMPILER_MSVC_2022
51
+ #endif
52
+ #endif // defined(_LIBCUDACXX_COMPILER_MSVC)
53
+
54
+ #if defined(__NVCC__)
55
+ // This is not mutually exclusive with other compilers, as NVCC uses a host
56
+ // compiler.
57
+ # define _LIBCUDACXX_COMPILER_NVCC
58
+ #elif defined(_NVHPC_CUDA)
59
+ # define _LIBCUDACXX_COMPILER_NVHPC_CUDA
60
+ #elif defined(__CUDA__) && defined(_LIBCUDACXX_COMPILER_CLANG)
61
+ # define _LIBCUDACXX_COMPILER_CLANG_CUDA
62
+ #endif
63
+
64
+ #ifdef __CUDACC__
65
+ # define _LIBCUDACXX_CUDACC
66
+ # define _LIBCUDACXX_CUDACC_VER_MAJOR __CUDACC_VER_MAJOR__
67
+ # define _LIBCUDACXX_CUDACC_VER_MINOR __CUDACC_VER_MINOR__
68
+ # define _LIBCUDACXX_CUDACC_VER_BUILD __CUDACC_VER_BUILD__
69
+ # define _LIBCUDACXX_CUDACC_VER \
70
+ _LIBCUDACXX_CUDACC_VER_MAJOR * 100000 + _LIBCUDACXX_CUDACC_VER_MINOR * 1000 + \
71
+ _LIBCUDACXX_CUDACC_VER_BUILD
72
+
73
+ // TODO: Determine if this is necessary, I don't know why we automatically include this in <config>
74
+ # if defined(__clang__) || defined(__FLT16_MANT_DIG__)
75
+ # include <cuda_fp16.h>
76
+ # endif
77
+ #endif
78
+
79
+ // Some convenience macros to filter CUDACC versions
80
+ #if defined(_LIBCUDACXX_CUDACC) && _LIBCUDACXX_CUDACC_VER < 1102000
81
+ #define _LIBCUDACXX_CUDACC_BELOW_11_2
82
+ #endif // defined(_LIBCUDACXX_CUDACC) && _LIBCUDACXX_CUDACC_VER < 1102000
83
+ #if defined(_LIBCUDACXX_CUDACC) && _LIBCUDACXX_CUDACC_VER < 1103000
84
+ #define _LIBCUDACXX_CUDACC_BELOW_11_3
85
+ #endif // defined(_LIBCUDACXX_CUDACC) && _LIBCUDACXX_CUDACC_VER < 1103000
86
+ #if defined(_LIBCUDACXX_CUDACC) && _LIBCUDACXX_CUDACC_VER < 1108000
87
+ #define _LIBCUDACXX_CUDACC_BELOW_11_8
88
+ #endif // defined(_LIBCUDACXX_CUDACC) && _LIBCUDACXX_CUDACC_VER < 1108000
89
+ #if defined(_LIBCUDACXX_CUDACC) && _LIBCUDACXX_CUDACC_VER < 1203000
90
+ #define _LIBCUDACXX_CUDACC_BELOW_12_3
91
+ #endif // defined(_LIBCUDACXX_CUDACC) && _LIBCUDACXX_CUDACC_VER < 1203000
92
+
93
+ #if defined(_LIBCUDACXX_COMPILER_MSVC)
94
+ # define _LIBCUDACXX_HAS_PRAGMA_MSVC_WARNING
95
+ # if !defined(_LIBCUDACXX_DISABLE_PRAGMA_MSVC_WARNING)
96
+ # define _LIBCUDACXX_USE_PRAGMA_MSVC_WARNING
97
+ # endif // !_LIBCUDACXX_DISABLE_PRAGMA_MSVC_WARNING
98
+ #endif // _LIBCUDACXX_COMPILER_MSVC
99
+
100
+ #ifdef __cplusplus
101
+
102
+ // __config may be included in `extern "C"` contexts, switch back to include <nv/target>
103
+ extern "C++" {
104
+ #include <nv/target>
105
+ }
106
+
107
+ #ifdef __GNUC__
108
+ # define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
109
+ #else
110
+ # define _GNUC_VER 0
111
+ #endif
112
+
113
+ #define _LIBCUDACXX_VERSION 10000
114
+
115
+ #ifndef _LIBCUDACXX_ABI_VERSION
116
+ # define _LIBCUDACXX_ABI_VERSION 1
117
+ #endif
118
+
119
+ #ifndef _LIBCUDACXX_STD_VER
120
+ # if defined(_MSC_VER)
121
+ # if _MSVC_LANG <= 201103L
122
+ # define _LIBCUDACXX_STD_VER 11
123
+ # elif _MSVC_LANG <= 201402L
124
+ # define _LIBCUDACXX_STD_VER 14
125
+ # elif _MSVC_LANG <= 201703L
126
+ # define _LIBCUDACXX_STD_VER 17
127
+ # elif _MSVC_LANG <= 202002L
128
+ # define _LIBCUDACXX_STD_VER 20
129
+ # else
130
+ # define _LIBCUDACXX_STD_VER 23 // current year, or date of c++2b ratification
131
+ # endif
132
+ # else
133
+ # if __cplusplus <= 201103L
134
+ # define _LIBCUDACXX_STD_VER 11
135
+ # elif __cplusplus <= 201402L
136
+ # define _LIBCUDACXX_STD_VER 14
137
+ # elif __cplusplus <= 201703L
138
+ # define _LIBCUDACXX_STD_VER 17
139
+ # elif __cplusplus <= 202002L
140
+ # define _LIBCUDACXX_STD_VER 20
141
+ # else
142
+ # define _LIBCUDACXX_STD_VER 23 // current year, or date of c++2b ratification
143
+ # endif
144
+ # endif
145
+ #endif // _LIBCUDACXX_STD_VER
146
+
147
+ #if _LIBCUDACXX_STD_VER < 11
148
+ # error libcu++ requires C++11 or later
149
+ #endif
150
+
151
+ #if (defined(_LIBCUDACXX_COMPILER_NVHPC) && defined(__linux__)) \
152
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
153
+ #define __ELF__
154
+ #endif
155
+
156
+ #if defined(__ELF__)
157
+ # define _LIBCUDACXX_OBJECT_FORMAT_ELF 1
158
+ #elif defined(__MACH__)
159
+ # define _LIBCUDACXX_OBJECT_FORMAT_MACHO 1
160
+ #elif defined(_WIN32)
161
+ # define _LIBCUDACXX_OBJECT_FORMAT_COFF 1
162
+ #elif defined(__wasm__)
163
+ # define _LIBCUDACXX_OBJECT_FORMAT_WASM 1
164
+ #else
165
+ # error Unknown object file format
166
+ #endif
167
+
168
+ #if defined(_LIBCUDACXX_ABI_UNSTABLE) || _LIBCUDACXX_ABI_VERSION >= 2 || defined(__cuda_std__)
169
+ // Change short string representation so that string data starts at offset 0,
170
+ // improving its alignment in some cases.
171
+ # define _LIBCUDACXX_ABI_ALTERNATE_STRING_LAYOUT
172
+ // Fix deque iterator type in order to support incomplete types.
173
+ # define _LIBCUDACXX_ABI_INCOMPLETE_TYPES_IN_DEQUE
174
+ // Fix undefined behavior in how std::list stores its linked nodes.
175
+ # define _LIBCUDACXX_ABI_LIST_REMOVE_NODE_POINTER_UB
176
+ // Fix undefined behavior in how __tree stores its end and parent nodes.
177
+ # define _LIBCUDACXX_ABI_TREE_REMOVE_NODE_POINTER_UB
178
+ // Fix undefined behavior in how __hash_table stores its pointer types.
179
+ # define _LIBCUDACXX_ABI_FIX_UNORDERED_NODE_POINTER_UB
180
+ # define _LIBCUDACXX_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
181
+ # define _LIBCUDACXX_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
182
+ // Don't use a nullptr_t simulation type in C++03 instead using C++11 nullptr
183
+ // provided under the alternate keyword __nullptr, which changes the mangling
184
+ // of nullptr_t. This option is ABI incompatible with GCC in C++03 mode.
185
+ # define _LIBCUDACXX_ABI_ALWAYS_USE_CXX11_NULLPTR
186
+ // Define the `pointer_safety` enum as a C++11 strongly typed enumeration
187
+ // instead of as a class simulating an enum. If this option is enabled
188
+ // `pointer_safety` and `get_pointer_safety()` will no longer be available
189
+ // in C++03.
190
+ # define _LIBCUDACXX_ABI_POINTER_SAFETY_ENUM_TYPE
191
+ // Define a key function for `bad_function_call` in the library, to centralize
192
+ // its vtable and typeinfo to libc++ rather than having all other libraries
193
+ // using that class define their own copies.
194
+ # define _LIBCUDACXX_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
195
+ // Enable optimized version of __do_get_(un)signed which avoids redundant copies.
196
+ # define _LIBCUDACXX_ABI_OPTIMIZED_LOCALE_NUM_GET
197
+ // Use the smallest possible integer type to represent the index of the variant.
198
+ // Previously libc++ used "unsigned int" exclusively.
199
+ # define _LIBCUDACXX_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION
200
+ // Unstable attempt to provide a more optimized std::function
201
+ # define _LIBCUDACXX_ABI_OPTIMIZED_FUNCTION
202
+ // All the regex constants must be distinct and nonzero.
203
+ # define _LIBCUDACXX_ABI_REGEX_CONSTANTS_NONZERO
204
+ #elif _LIBCUDACXX_ABI_VERSION == 1
205
+ # if !defined(_LIBCUDACXX_OBJECT_FORMAT_COFF)
206
+ // Enable compiling copies of now inline methods into the dylib to support
207
+ // applications compiled against older libraries. This is unnecessary with
208
+ // COFF dllexport semantics, since dllexport forces a non-inline definition
209
+ // of inline functions to be emitted anyway. Our own non-inline copy would
210
+ // conflict with the dllexport-emitted copy, so we disable it.
211
+ # define _LIBCUDACXX_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
212
+ # endif
213
+ #endif
214
+
215
+ #ifndef __has_attribute
216
+ #define __has_attribute(__x) 0
217
+ #endif
218
+
219
+ #ifndef __has_builtin
220
+ #define __has_builtin(__x) 0
221
+ #endif
222
+
223
+ #ifndef __has_extension
224
+ #define __has_extension(__x) 0
225
+ #endif
226
+
227
+ #ifndef __has_feature
228
+ #define __has_feature(__x) 0
229
+ #endif
230
+
231
+ #ifndef __has_cpp_attribute
232
+ #define __has_cpp_attribute(__x) 0
233
+ #endif
234
+
235
+ // '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
236
+ // the compiler and '1' otherwise.
237
+ #ifndef __is_identifier
238
+ #define __is_identifier(__x) 1
239
+ #endif
240
+
241
+ #ifndef __has_declspec_attribute
242
+ #define __has_declspec_attribute(__x) 0
243
+ #endif
244
+
245
+ #define __has_keyword(__x) !(__is_identifier(__x))
246
+
247
+ #ifndef __has_include
248
+ #define __has_include(...) 0
249
+ #endif
250
+
251
+ #if !defined(_LIBCUDACXX_COMPILER_NVCC) && !defined(_LIBCUDACXX_COMPILER_NVRTC)
252
+ // If NVCC is not being used <complex> can safely use `long double` without warnings
253
+ # define _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE
254
+ // NVCC does not have a way of silencing non '_' prefixed UDLs
255
+ # define _LIBCUDACXX_HAS_STL_LITERALS
256
+ #endif
257
+
258
+ #if defined(_LIBCUDACXX_COMPILER_GCC) && __cplusplus < 201103L
259
+ #error "libc++ does not support using GCC with C++03. Please enable C++11"
260
+ #endif
261
+
262
+ // FIXME: ABI detection should be done via compiler builtin macros. This
263
+ // is just a placeholder until Clang implements such macros. For now assume
264
+ // that Windows compilers pretending to be MSVC++ target the Microsoft ABI,
265
+ // and allow the user to explicitly specify the ABI to handle cases where this
266
+ // heuristic falls short.
267
+ #if defined(_LIBCUDACXX_ABI_FORCE_ITANIUM) && defined(_LIBCUDACXX_ABI_FORCE_MICROSOFT)
268
+ # error "Only one of _LIBCUDACXX_ABI_FORCE_ITANIUM and _LIBCUDACXX_ABI_FORCE_MICROSOFT can be defined"
269
+ #elif defined(_LIBCUDACXX_ABI_FORCE_ITANIUM)
270
+ # define _LIBCUDACXX_ABI_ITANIUM
271
+ #elif defined(_LIBCUDACXX_ABI_FORCE_MICROSOFT)
272
+ # define _LIBCUDACXX_ABI_MICROSOFT
273
+ #else
274
+ # if defined(_WIN32) && defined(_LIBCUDACXX_COMPILER_MSVC)
275
+ # define _LIBCUDACXX_ABI_MICROSOFT
276
+ # else
277
+ # define _LIBCUDACXX_ABI_ITANIUM
278
+ # endif
279
+ #endif
280
+
281
+ #if defined(_LIBCUDACXX_ABI_MICROSOFT) && !defined(_LIBCUDACXX_NO_VCRUNTIME)
282
+ # define _LIBCUDACXX_ABI_VCRUNTIME
283
+ #endif
284
+
285
+ // Need to detect which libc we're using if we're on Linux.
286
+ #if defined(__linux__)
287
+ # include <features.h>
288
+ # if defined(__GLIBC_PREREQ)
289
+ # define _LIBCUDACXX_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b)
290
+ # else
291
+ # define _LIBCUDACXX_GLIBC_PREREQ(a, b) 0
292
+ # endif // defined(__GLIBC_PREREQ)
293
+ #endif // defined(__linux__)
294
+
295
+ #ifdef __LITTLE_ENDIAN__
296
+ # if __LITTLE_ENDIAN__
297
+ # define _LIBCUDACXX_LITTLE_ENDIAN
298
+ # endif // __LITTLE_ENDIAN__
299
+ #endif // __LITTLE_ENDIAN__
300
+
301
+ #ifdef __BIG_ENDIAN__
302
+ # if __BIG_ENDIAN__
303
+ # define _LIBCUDACXX_BIG_ENDIAN
304
+ # endif // __BIG_ENDIAN__
305
+ #endif // __BIG_ENDIAN__
306
+
307
+ #ifdef __BYTE_ORDER__
308
+ # if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
309
+ # define _LIBCUDACXX_LITTLE_ENDIAN
310
+ # elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
311
+ # define _LIBCUDACXX_BIG_ENDIAN
312
+ # endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
313
+ #endif // __BYTE_ORDER__
314
+
315
+ #ifdef __FreeBSD__
316
+ # include <sys/endian.h>
317
+ # if _BYTE_ORDER == _LITTLE_ENDIAN
318
+ # define _LIBCUDACXX_LITTLE_ENDIAN
319
+ # else // _BYTE_ORDER == _LITTLE_ENDIAN
320
+ # define _LIBCUDACXX_BIG_ENDIAN
321
+ # endif // _BYTE_ORDER == _LITTLE_ENDIAN
322
+ # ifndef __LONG_LONG_SUPPORTED
323
+ # define _LIBCUDACXX_HAS_NO_LONG_LONG
324
+ # endif // __LONG_LONG_SUPPORTED
325
+ #endif // __FreeBSD__
326
+
327
+ #ifdef __NetBSD__
328
+ # include <sys/endian.h>
329
+ # if _BYTE_ORDER == _LITTLE_ENDIAN
330
+ # define _LIBCUDACXX_LITTLE_ENDIAN
331
+ # else // _BYTE_ORDER == _LITTLE_ENDIAN
332
+ # define _LIBCUDACXX_BIG_ENDIAN
333
+ # endif // _BYTE_ORDER == _LITTLE_ENDIAN
334
+ # define _LIBCUDACXX_HAS_QUICK_EXIT
335
+ #endif // __NetBSD__
336
+
337
+ #if defined(_WIN32)
338
+ # define _LIBCUDACXX_WIN32API
339
+ # define _LIBCUDACXX_LITTLE_ENDIAN
340
+ # define _LIBCUDACXX_SHORT_WCHAR 1
341
+ // Both MinGW and native MSVC provide a "MSVC"-like environment
342
+ # define _LIBCUDACXX_MSVCRT_LIKE
343
+ // If mingw not explicitly detected, assume using MS C runtime only if
344
+ // a MS compatibility version is specified.
345
+ # if defined(_LIBCUDACXX_COMPILER_MSVC) && !defined(__MINGW32__)
346
+ # define _LIBCUDACXX_MSVCRT // Using Microsoft's C Runtime library
347
+ # endif
348
+ # if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__))
349
+ # define _LIBCUDACXX_HAS_BITSCAN64
350
+ # endif
351
+ # define _LIBCUDACXX_HAS_OPEN_WITH_WCHAR
352
+ # if defined(_LIBCUDACXX_MSVCRT)
353
+ # define _LIBCUDACXX_HAS_QUICK_EXIT
354
+ # endif
355
+
356
+ // Some CRT APIs are unavailable to store apps
357
+ # if defined(WINAPI_FAMILY)
358
+ # include <winapifamily.h>
359
+ # if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && \
360
+ (!defined(WINAPI_PARTITION_SYSTEM) || \
361
+ !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_SYSTEM))
362
+ # define _LIBCUDACXX_WINDOWS_STORE_APP
363
+ # endif
364
+ # endif
365
+ #endif // defined(_WIN32)
366
+
367
+ #ifdef __sun__
368
+ # include <sys/isa_defs.h>
369
+ # ifdef _LITTLE_ENDIAN
370
+ # define _LIBCUDACXX_LITTLE_ENDIAN
371
+ # else
372
+ # define _LIBCUDACXX_BIG_ENDIAN
373
+ # endif
374
+ #endif // __sun__
375
+
376
+ #if defined(__CloudABI__)
377
+ // Certain architectures provide arc4random(). Prefer using
378
+ // arc4random() over /dev/{u,}random to make it possible to obtain
379
+ // random data even when using sandboxing mechanisms such as chroots,
380
+ // Capsicum, etc.
381
+ # define _LIBCUDACXX_USING_ARC4_RANDOM
382
+ #elif defined(__Fuchsia__) || defined(__wasi__)
383
+ # define _LIBCUDACXX_USING_GETENTROPY
384
+ #elif defined(__native_client__)
385
+ // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
386
+ // including accesses to the special files under /dev. C++11's
387
+ // std::random_device is instead exposed through a NaCl syscall.
388
+ # define _LIBCUDACXX_USING_NACL_RANDOM
389
+ #elif defined(_LIBCUDACXX_WIN32API)
390
+ # define _LIBCUDACXX_USING_WIN32_RANDOM
391
+ #else
392
+ # define _LIBCUDACXX_USING_DEV_RANDOM
393
+ #endif
394
+
395
+ #ifndef _LIBCUDACXX_LITTLE_ENDIAN
396
+ #if defined(_LIBCUDACXX_COMPILER_NVRTC)
397
+ # define _LIBCUDACXX_LITTLE_ENDIAN
398
+ #endif
399
+ #endif // _LIBCUDACXX_LITTLE_ENDIAN
400
+
401
+ #if !defined(_LIBCUDACXX_LITTLE_ENDIAN) && !defined(_LIBCUDACXX_BIG_ENDIAN)
402
+ # include <endian.h>
403
+ # if __BYTE_ORDER == __LITTLE_ENDIAN
404
+ # define _LIBCUDACXX_LITTLE_ENDIAN
405
+ # elif __BYTE_ORDER == __BIG_ENDIAN
406
+ # define _LIBCUDACXX_BIG_ENDIAN
407
+ # else // __BYTE_ORDER == __BIG_ENDIAN
408
+ # error unable to determine endian
409
+ # endif
410
+ #endif // !defined(_LIBCUDACXX_LITTLE_ENDIAN) && !defined(_LIBCUDACXX_BIG_ENDIAN)
411
+
412
+ #if __has_attribute(__no_sanitize__) && !defined(_LIBCUDACXX_COMPILER_GCC)
413
+ # define _LIBCUDACXX_NO_CFI __attribute__((__no_sanitize__("cfi")))
414
+ #else
415
+ # define _LIBCUDACXX_NO_CFI
416
+ #endif
417
+
418
+ #if (defined(__ISO_C_VISIBLE) && __ISO_C_VISIBLE >= 2011) || __cplusplus >= 201103L
419
+ # if defined(__FreeBSD__)
420
+ # define _LIBCUDACXX_HAS_QUICK_EXIT
421
+ # define _LIBCUDACXX_HAS_C11_FEATURES
422
+ # elif defined(__Fuchsia__) || defined(__wasi__)
423
+ # define _LIBCUDACXX_HAS_QUICK_EXIT
424
+ # define _LIBCUDACXX_HAS_TIMESPEC_GET
425
+ # define _LIBCUDACXX_HAS_C11_FEATURES
426
+ # elif defined(__linux__)
427
+ # if !defined(_LIBCUDACXX_HAS_MUSL_LIBC)
428
+ # if _LIBCUDACXX_GLIBC_PREREQ(2, 15) || defined(__BIONIC__)
429
+ # define _LIBCUDACXX_HAS_QUICK_EXIT
430
+ # endif
431
+ # if _LIBCUDACXX_GLIBC_PREREQ(2, 17)
432
+ # define _LIBCUDACXX_HAS_C11_FEATURES
433
+ # define _LIBCUDACXX_HAS_TIMESPEC_GET
434
+ # endif
435
+ # else // defined(_LIBCUDACXX_HAS_MUSL_LIBC)
436
+ # define _LIBCUDACXX_HAS_QUICK_EXIT
437
+ # define _LIBCUDACXX_HAS_TIMESPEC_GET
438
+ # define _LIBCUDACXX_HAS_C11_FEATURES
439
+ # endif
440
+ # endif // __linux__
441
+ #endif
442
+
443
+ #if defined(_LIBCUDACXX_COMPILER_NVRTC)
444
+ # define __alignof(x) alignof(x)
445
+ #endif // _LIBCUDACXX_COMPILER_NVRTC
446
+
447
+ #if defined(_LIBCUDACXX_COMPILER_MSVC)
448
+ # define __alignof__ __alignof
449
+ #endif
450
+
451
+ #define _LIBCUDACXX_ALIGNOF(_Tp) alignof(_Tp)
452
+ #define _LIBCUDACXX_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp)
453
+
454
+ #if defined(_LIBCUDACXX_COMPILER_MSVC)
455
+ # define _ALIGNAS_TYPE(x) alignas(x)
456
+ # define _ALIGNAS(x) __declspec(align(x))
457
+ #elif __has_feature(cxx_alignas)
458
+ # define _ALIGNAS_TYPE(x) alignas(x)
459
+ # define _ALIGNAS(x) alignas(x)
460
+ #else
461
+ # define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCUDACXX_ALIGNOF(x))))
462
+ # define _ALIGNAS(x) __attribute__((__aligned__(x)))
463
+ #endif // !_LIBCUDACXX_COMPILER_MSVC && !__has_feature(cxx_alignas)
464
+
465
+ // This is wrapped in __CUDA_ARCH__ to prevent error: "ignoring '#pragma unroll'
466
+ // [-Werror=unknown-pragmas]"
467
+ #if defined(__CUDA_ARCH__)
468
+ #if defined(_LIBCUDACXX_COMPILER_MSVC)
469
+ # define _LIBCUDACXX_PRAGMA_UNROLL(_N) __pragma(_LIBCUDACXX_TOSTRING(unroll _N))
470
+ #else // ^^^ _LIBCUDACXX_COMPILER_MSVC ^^^ / vvv !_LIBCUDACXX_COMPILER_MSVC vvv
471
+ # define _LIBCUDACXX_PRAGMA_UNROLL(_N) _Pragma(_LIBCUDACXX_TOSTRING(unroll _N))
472
+ #endif // !_LIBCUDACXX_COMPILER_MSVC
473
+ #else // ^^^ _LIBCUDACXX_CUDACC ^^^ / vvv !_LIBCUDACXX_CUDACCvvv
474
+ # define _LIBCUDACXX_PRAGMA_UNROLL(_N)
475
+ #endif // !__CUDA_ARCH__
476
+
477
+ #if defined(_LIBCUDACXX_COMPILER_MSVC)
478
+ #define _LIBCUDACXX_ALWAYS_INLINE __forceinline
479
+ #else
480
+ #define _LIBCUDACXX_ALWAYS_INLINE __attribute__ ((__always_inline__))
481
+ #endif // !_LIBCUDACXX_COMPILER_MSVC
482
+
483
+ #if defined(__cuda_std__)
484
+ #define _LIBCUDACXX_ATOMIC_ALWAYS_LOCK_FREE(size, ptr) (size <= 8)
485
+ #elif defined(_LIBCUDACXX_COMPILER_CLANG) || defined(_LIBCUDACXX_COMPILER_GCC)
486
+ #define _LIBCUDACXX_ATOMIC_ALWAYS_LOCK_FREE(...) __atomic_always_lock_free(__VA_ARGS__)
487
+ #endif // __cuda_std__
488
+
489
+ // https://bugs.llvm.org/show_bug.cgi?id=44517
490
+ #define __check_builtin(__x) (__has_builtin(__##__x) || \
491
+ __has_keyword(__##__x) || \
492
+ __has_feature(__x))
493
+
494
+ // We work around old clang versions (before clang-10) not supporting __has_builtin via __check_builtin
495
+ // We work around old intel versions (before 2021.3) not supporting __has_builtin via __check_builtin
496
+ // We work around old nvhpc versions (before 2022.11) not supporting __has_builtin via __check_builtin
497
+ // MSVC needs manual handling, has no real way of checking builtins so all is manual
498
+ // GCC needs manual handling, before gcc-10 as that finally supports __has_builtin
499
+
500
+ #if __check_builtin(array_rank)
501
+ #define _LIBCUDACXX_ARRAY_RANK(...) __array_rank(__VA_ARGS__)
502
+ #endif // __check_builtin(array_rank)
503
+
504
+ // nvhpc has a bug where it supports __builtin_addressof but does not mark it via __check_builtin
505
+ #if __check_builtin(builtin_addressof) \
506
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 700) \
507
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
508
+ || defined(_LIBCUDACXX_COMPILER_NVHPC)
509
+ #define _LIBCUDACXX_ADDRESSOF(...) __builtin_addressof(__VA_ARGS__)
510
+ #endif // __check_builtin(builtin_addressof)
511
+
512
+ #if __check_builtin(builtin_bit_cast) \
513
+ || (defined(_LIBCUDACXX_COMPILER_MSVC) && _MSC_VER > 1925)
514
+ #define _LIBCUDACXX_BIT_CAST(...) __builtin_bit_cast(__VA_ARGS__)
515
+ #endif // __check_builtin(builtin_bit_cast)
516
+
517
+ #if __check_builtin(builtin_is_constant_evaluated) \
518
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 900) \
519
+ || (defined(_LIBCUDACXX_COMPILER_MSVC) && _MSC_VER > 1924 && !defined(_LIBCUDACXX_CUDACC_BELOW_11_3))
520
+ #define _LIBCUDACXX_IS_CONSTANT_EVALUATED(...) __builtin_is_constant_evaluated(__VA_ARGS__)
521
+ #endif // __check_builtin(builtin_is_constant_evaluated)
522
+
523
+ // NVCC and NVRTC in C++11 mode freaks out about `__builtin_is_constant_evaluated`.
524
+ #if _LIBCUDACXX_STD_VER < 14 \
525
+ && (defined(_LIBCUDACXX_COMPILER_NVCC) \
526
+ || defined(_LIBCUDACXX_COMPILER_NVRTC) \
527
+ || defined(_LIBCUDACXX_COMPILER_NVHPC))
528
+ #undef _LIBCUDACXX_IS_CONSTANT_EVALUATED
529
+ #endif // _LIBCUDACXX_STD_VER < 14 && defined(_LIBCUDACXX_COMPILER_NVCC)
530
+
531
+ #if __check_builtin(builtin_launder) \
532
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 700)
533
+ #define _LIBCUDACXX_LAUNDER(...) __builtin_launder(__VA_ARGS__)
534
+ #endif // __check_builtin(builtin_launder)
535
+
536
+ // Disabled due to libstdc++ conflict
537
+ #if 0 // __check_builtin(decay)
538
+ #define _LIBCUDACXX_DECAY(...) __decay(__VA_ARGS__)
539
+ #endif // __check_builtin(decay)
540
+
541
+ #if __check_builtin(has_nothrow_assign) \
542
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \
543
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
544
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
545
+ #define _LIBCUDACXX_HAS_NOTHROW_ASSIGN(...) __has_nothrow_assign(__VA_ARGS__)
546
+ #endif // __check_builtin(has_nothrow_assign)
547
+
548
+ #if __check_builtin(has_nothrow_constructor) \
549
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \
550
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
551
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
552
+ #define _LIBCUDACXX_HAS_NOTHROW_CONSTRUCTOR(...) __has_nothrow_constructor(__VA_ARGS__)
553
+ #endif // __check_builtin(has_nothrow_constructor)
554
+
555
+ #if __check_builtin(has_nothrow_copy) \
556
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \
557
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
558
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
559
+ #define _LIBCUDACXX_HAS_NOTHROW_COPY(...) __has_nothrow_copy(__VA_ARGS__)
560
+ #endif // __check_builtin(has_nothrow_copy)
561
+
562
+ #if __check_builtin(has_trivial_constructor) \
563
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \
564
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
565
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
566
+ #define _LIBCUDACXX_HAS_TRIVIAL_CONSTRUCTOR(...) __has_trivial_constructor(__VA_ARGS__)
567
+ #endif // __check_builtin(has_trivial_constructor)
568
+
569
+ #if __check_builtin(has_trivial_destructor) \
570
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \
571
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
572
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
573
+ #define _LIBCUDACXX_HAS_TRIVIAL_DESTRUCTOR(...) __has_trivial_destructor(__VA_ARGS__)
574
+ #endif // __check_builtin(has_trivial_destructor)
575
+
576
+ #if __check_builtin(has_unique_object_representations) \
577
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 700)
578
+ #define _LIBCUDACXX_HAS_UNIQUE_OBJECT_REPRESENTATIONS(...) __has_unique_object_representations(__VA_ARGS__)
579
+ #endif // __check_builtin(has_unique_object_representations)
580
+
581
+ #if __check_builtin(has_virtual_destructor) \
582
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \
583
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
584
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
585
+ #define _LIBCUDACXX_HAS_VIRTUAL_DESTRUCTOR(...) __has_virtual_destructor(__VA_ARGS__)
586
+ #endif // __check_builtin(has_virtual_destructor)
587
+
588
+ #if __check_builtin(is_aggregate) \
589
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 700) \
590
+ || (defined(_LIBCUDACXX_COMPILER_MSVC) && _MSC_VER > 1914) \
591
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
592
+ #define _LIBCUDACXX_IS_AGGREGATE(...) __is_aggregate(__VA_ARGS__)
593
+ #endif // __check_builtin(is_aggregate)
594
+
595
+ #if __check_builtin(is_array)
596
+ #define _LIBCUDACXX_IS_ARRAY(...) __is_array(__VA_ARGS__)
597
+ #endif // __check_builtin(is_array)
598
+
599
+ // TODO: Clang incorrectly reports that __is_array is true for T[0].
600
+ // Re-enable the branch once https://llvm.org/PR54705 is fixed.
601
+ #ifndef _LIBCUDACXX_USE_IS_ARRAY_FALLBACK
602
+ #if defined(_LIBCUDACXX_COMPILER_CLANG)
603
+ #define _LIBCUDACXX_USE_IS_ARRAY_FALLBACK
604
+ #endif // _LIBCUDACXX_COMPILER_CLANG
605
+ #endif // !_LIBCUDACXX_USE_IS_ARRAY_FALLBACK
606
+
607
+ #if __check_builtin(is_assignable) \
608
+ || defined(_LIBCUDACXX_COMPILER_MSVC)
609
+ #define _LIBCUDACXX_IS_ASSIGNABLE(...) __is_assignable(__VA_ARGS__)
610
+ #endif // __check_builtin(is_assignable)
611
+
612
+ #if __check_builtin(is_base_of) \
613
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \
614
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
615
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
616
+ #define _LIBCUDACXX_IS_BASE_OF(...) __is_base_of(__VA_ARGS__)
617
+ #endif // __check_builtin(is_base_of)
618
+
619
+ #if __check_builtin(is_class) \
620
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \
621
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
622
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
623
+ #define _LIBCUDACXX_IS_CLASS(...) __is_class(__VA_ARGS__)
624
+ #endif // __check_builtin(is_class)
625
+
626
+ #if __check_builtin(is_constructible) \
627
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 800) \
628
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
629
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
630
+ #define _LIBCUDACXX_IS_CONSTRUCTIBLE(...) __is_constructible(__VA_ARGS__)
631
+ #endif // __check_builtin(is_constructible)
632
+
633
+ #if __check_builtin(is_convertible_to) \
634
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
635
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
636
+ #define _LIBCUDACXX_IS_CONVERTIBLE_TO(...) __is_convertible_to(__VA_ARGS__)
637
+ #endif // __check_builtin(is_convertible_to)
638
+
639
+ #if __check_builtin(is_destructible) \
640
+ || defined(_LIBCUDACXX_COMPILER_MSVC)
641
+ #define _LIBCUDACXX_IS_DESTRUCTIBLE(...) __is_destructible(__VA_ARGS__)
642
+ #endif // __check_builtin(is_destructible)
643
+
644
+ #if __check_builtin(is_empty) \
645
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \
646
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
647
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
648
+ #define _LIBCUDACXX_IS_EMPTY(...) __is_empty(__VA_ARGS__)
649
+ #endif // __check_builtin(is_empty)
650
+
651
+ #if __check_builtin(is_enum) \
652
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \
653
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
654
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
655
+ #define _LIBCUDACXX_IS_ENUM(...) __is_enum(__VA_ARGS__)
656
+ #endif // __check_builtin(is_enum)
657
+
658
+ #if __check_builtin(is_final) \
659
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 407) \
660
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
661
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
662
+ #define _LIBCUDACXX_IS_FINAL(...) __is_final(__VA_ARGS__)
663
+ #endif // __check_builtin(is_final)
664
+
665
+ #if __check_builtin(is_function) \
666
+ && !defined(_LIBCUDACXX_COMPILER_NVCC)
667
+ #define _LIBCUDACXX_IS_FUNCTION(...) __is_function(__VA_ARGS__)
668
+ #endif // __check_builtin(is_function)
669
+
670
+ #if __check_builtin(is_literal_type) \
671
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 406) \
672
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
673
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
674
+ #define _LIBCUDACXX_IS_LITERAL(...) __is_literal_type(__VA_ARGS__)
675
+ #endif // __check_builtin(is_literal_type)
676
+
677
+ #if __check_builtin(is_lvalue_reference)
678
+ #define _LIBCUDACXX_IS_LVALUE_REFERENCE(...) __is_lvalue_reference(__VA_ARGS__)
679
+ #endif // __check_builtin(is_lvalue_reference)
680
+
681
+ #ifndef _LIBCUDACXX_USE_IS_LVALUE_REFERENCE_FALLBACK
682
+ #if defined(_LIBCUDACXX_CUDACC_BELOW_11_3)
683
+ #define _LIBCUDACXX_USE_IS_LVALUE_REFERENCE_FALLBACK
684
+ #endif // nvcc < 11.3
685
+ #endif // !_LIBCUDACXX_USE_IS_LVALUE_REFERENCE_FALLBACK
686
+
687
+ #if __check_builtin(is_nothrow_assignable) \
688
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
689
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
690
+ #define _LIBCUDACXX_IS_NOTHROW_ASSIGNABLE(...) __is_nothrow_assignable(__VA_ARGS__)
691
+ #endif // __check_builtin(is_nothrow_assignable)
692
+
693
+ #if __check_builtin(is_nothrow_constructible) \
694
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
695
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
696
+ #define _LIBCUDACXX_IS_NOTHROW_CONSTRUCTIBLE(...) __is_nothrow_constructible(__VA_ARGS__)
697
+ #endif // __check_builtin(is_nothrow_constructible)
698
+
699
+ #if __check_builtin(is_nothrow_destructible) \
700
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
701
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
702
+ #define _LIBCUDACXX_IS_NOTHROW_DESTRUCTIBLE(...) __is_nothrow_destructible(__VA_ARGS__)
703
+ #endif // __check_builtin(is_nothrow_destructible)
704
+
705
+ #if __check_builtin(is_object)
706
+ #define _LIBCUDACXX_IS_OBJECT(...) __is_object(__VA_ARGS__)
707
+ #endif // __check_builtin(is_object)
708
+
709
+ #ifndef _LIBCUDACXX_USE_IS_OBJECT_FALLBACK
710
+ #if defined(_LIBCUDACXX_CUDACC_BELOW_11_3)
711
+ #define _LIBCUDACXX_USE_IS_OBJECT_FALLBACK
712
+ #endif // nvcc < 11.3
713
+ #endif // !_LIBCUDACXX_USE_IS_OBJECT_FALLBACK
714
+
715
+ #if __check_builtin(is_pod) \
716
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \
717
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
718
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
719
+ #define _LIBCUDACXX_IS_POD(...) __is_pod(__VA_ARGS__)
720
+ #endif // __check_builtin(is_pod)
721
+
722
+ // libstdc++ defines this as a function, breaking functionality
723
+ #if 0 // __check_builtin(is_pointer)
724
+ #define _LIBCUDACXX_IS_POINTER(...) __is_pointer(__VA_ARGS__)
725
+ #endif // __check_builtin(is_pointer)
726
+
727
+ #if __check_builtin(is_polymorphic) \
728
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \
729
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
730
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
731
+ #define _LIBCUDACXX_IS_POLYMORPHIC(...) __is_polymorphic(__VA_ARGS__)
732
+ #endif // __check_builtin(is_polymorphic)
733
+
734
+ #if __check_builtin(is_reference)
735
+ #define _LIBCUDACXX_IS_REFERENCE(...) __is_reference(__VA_ARGS__)
736
+ #endif // __check_builtin(is_reference)
737
+
738
+ // Disabled due to libstdc++ conflict
739
+ #if 0 // __check_builtin(is_referenceable)
740
+ #define _LIBCUDACXX_IS_REFERENCEABLE(...) __is_referenceable(__VA_ARGS__)
741
+ #endif // __check_builtin(is_referenceable)
742
+
743
+ #if __check_builtin(is_rvalue_reference)
744
+ #define _LIBCUDACXX_IS_RVALUE_REFERENCE(...) __is_rvalue_reference(__VA_ARGS__)
745
+ #endif // __check_builtin(is_rvalue_reference)
746
+
747
+ #if __check_builtin(is_same) \
748
+ && !defined(_LIBCUDACXX_COMPILER_NVCC)
749
+ #define _LIBCUDACXX_IS_SAME(...) __is_same(__VA_ARGS__)
750
+ #endif // __check_builtin(is_same)
751
+
752
+ // libstdc++ defines this as a function, breaking functionality
753
+ #if 0 // __check_builtin(is_scalar)
754
+ #define _LIBCUDACXX_IS_SCALAR(...) __is_scalar(__VA_ARGS__)
755
+ #endif // __check_builtin(is_scalar)
756
+
757
+ // libstdc++ defines this as a function, breaking functionality
758
+ #if 0 // __check_builtin(is_signed)
759
+ #define _LIBCUDACXX_IS_SIGNED(...) __is_signed(__VA_ARGS__)
760
+ #endif // __check_builtin(is_signed)
761
+
762
+ #if __check_builtin(is_standard_layout) \
763
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 407) \
764
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
765
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
766
+ #define _LIBCUDACXX_IS_STANDARD_LAYOUT(...) __is_standard_layout(__VA_ARGS__)
767
+ #endif // __check_builtin(is_standard_layout)
768
+
769
+ #if __check_builtin(is_trivial) \
770
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 405) \
771
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
772
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
773
+ #define _LIBCUDACXX_IS_TRIVIAL(...) __is_trivial(__VA_ARGS__)
774
+ #endif // __check_builtin(is_trivial)
775
+
776
+ #if __check_builtin(is_trivially_assignable) \
777
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 501) \
778
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
779
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
780
+ #define _LIBCUDACXX_IS_TRIVIALLY_ASSIGNABLE(...) __is_trivially_assignable(__VA_ARGS__)
781
+ #endif // __check_builtin(is_trivially_assignable)
782
+
783
+ #if __check_builtin(is_trivially_constructible) \
784
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 501) \
785
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
786
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
787
+ #define _LIBCUDACXX_IS_TRIVIALLY_CONSTRUCTIBLE(...) __is_trivially_constructible(__VA_ARGS__)
788
+ #endif // __check_builtin(is_trivially_constructible)
789
+
790
+ #if __check_builtin(is_trivially_copyable) \
791
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 501) \
792
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
793
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
794
+ #define _LIBCUDACXX_IS_TRIVIALLY_COPYABLE(...) __is_trivially_copyable(__VA_ARGS__)
795
+ #endif // __check_builtin(is_trivially_copyable)
796
+
797
+ #if __check_builtin(is_trivially_destructible) \
798
+ || defined(_LIBCUDACXX_COMPILER_MSVC)
799
+ #define _LIBCUDACXX_IS_TRIVIALLY_DESTRUCTIBLE(...) __is_trivially_destructible(__VA_ARGS__)
800
+ #endif // __check_builtin(is_trivially_destructible)
801
+
802
+ #if __check_builtin(is_union) \
803
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \
804
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
805
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
806
+ #define _LIBCUDACXX_IS_UNION(...) __is_union(__VA_ARGS__)
807
+ #endif // __check_builtin(is_union)
808
+
809
+ #if __check_builtin(is_unsigned)
810
+ #define _LIBCUDACXX_IS_UNSIGNED(...) __is_unsigned(__VA_ARGS__)
811
+ #endif // __check_builtin(is_unsigned)
812
+
813
+ #ifndef _LIBCUDACXX_USE_IS_UNSIGNED_FALLBACK
814
+ #if defined(_LIBCUDACXX_CUDACC_BELOW_11_3)
815
+ #define _LIBCUDACXX_USE_IS_UNSIGNED_FALLBACK
816
+ #endif // nvcc < 11.3
817
+ #endif // !_LIBCUDACXX_USE_IS_UNSIGNED_FALLBACK
818
+
819
+ // libstdc++ defines this as a function, breaking functionality
820
+ #if 0 // __check_builtin(is_void)
821
+ #define _LIBCUDACXX_IS_VOID(...) __is_void(__VA_ARGS__)
822
+ #endif // __check_builtin(is_void)
823
+
824
+ // Disabled due to libstdc++ conflict
825
+ #if 0 // __check_builtin(make_signed)
826
+ #define _LIBCUDACXX_MAKE_SIGNED(...) __make_signed(__VA_ARGS__)
827
+ #endif // __check_builtin(make_signed)
828
+
829
+ // Disabled due to libstdc++ conflict
830
+ #if 0 // __check_builtin(make_unsigned)
831
+ #define _LIBCUDACXX_MAKE_UNSIGNED(...) __make_unsigned(__VA_ARGS__)
832
+ #endif // __check_builtin(make_unsigned)
833
+
834
+ // Disabled due to libstdc++ conflict
835
+ #if 0 // __check_builtin(remove_all_extents)
836
+ #define _LIBCUDACXX_REMOVE_ALL_EXTENTS(...) __remove_all_extents(__VA_ARGS__)
837
+ #endif // __check_builtin(remove_all_extents)
838
+
839
+ // Disabled due to libstdc++ conflict
840
+ #if 0 // __check_builtin(remove_const)
841
+ #define _LIBCUDACXX_REMOVE_CONST(...) __remove_const(__VA_ARGS__)
842
+ #endif // __check_builtin(remove_const)
843
+
844
+ // Disabled due to libstdc++ conflict
845
+ #if 0 // __check_builtin(remove_cv)
846
+ #define _LIBCUDACXX_REMOVE_CV(...) __remove_cv(__VA_ARGS__)
847
+ #endif // __check_builtin(remove_cv)
848
+
849
+ // Disabled due to libstdc++ conflict
850
+ #if 0 // __check_builtin(remove_cvref)
851
+ #define _LIBCUDACXX_REMOVE_CVREF(...) __remove_cvref(__VA_ARGS__)
852
+ #endif // __check_builtin(remove_cvref)
853
+
854
+ // Disabled due to libstdc++ conflict
855
+ #if 0 // __check_builtin(remove_extent)
856
+ #define _LIBCUDACXX_REMOVE_EXTENT(...) __remove_extent(__VA_ARGS__)
857
+ #endif // __check_builtin(remove_extent)
858
+
859
+ // Disabled due to libstdc++ conflict
860
+ #if 0 // __check_builtin(remove_pointer)
861
+ #define _LIBCUDACXX_REMOVE_POINTER(...) __remove_pointer(__VA_ARGS__)
862
+ #endif // __check_builtin(remove_pointer)
863
+
864
+ // Disabled due to libstdc++ conflict
865
+ #if 0 // __check_builtin(remove_reference_t)
866
+ #define _LIBCUDACXX_REMOVE_REFERENCE_T(...) __remove_reference_t(__VA_ARGS__)
867
+ #endif // __check_builtin(remove_reference_t)
868
+
869
+ // Disabled due to libstdc++ conflict
870
+ #if 0 // __check_builtin(remove_volatile)
871
+ #define _LIBCUDACXX_REMOVE_VOLATILE(...) __remove_volatile(__VA_ARGS__)
872
+ #endif // __check_builtin(remove_volatile)
873
+
874
+ #if __check_builtin(underlying_type) \
875
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 407) \
876
+ || defined(_LIBCUDACXX_COMPILER_MSVC) \
877
+ || defined(_LIBCUDACXX_COMPILER_NVRTC)
878
+ #define _LIBCUDACXX_UNDERLYING_TYPE(...) __underlying_type(__VA_ARGS__)
879
+ #endif // __check_builtin(underlying_type)
880
+
881
+ #define _LIBCUDACXX_TOSTRING2(_STR) #_STR
882
+ #define _LIBCUDACXX_TOSTRING(_STR) _LIBCUDACXX_TOSTRING2(_STR)
883
+ #if defined(_LIBCUDACXX_CUDACC) && !defined(_LIBCUDACXX_COMPILER_CLANG_CUDA)
884
+ # if defined(__NVCC_DIAG_PRAGMA_SUPPORT__)
885
+ # if defined(_LIBCUDACXX_COMPILER_MSVC)
886
+ # define _LIBCUDACXX_NV_DIAG_SUPPRESS(_WARNING) __pragma(_LIBCUDACXX_TOSTRING(nv_diag_suppress _WARNING))
887
+ # define _LIBCUDACXX_NV_DIAG_DEFAULT(_WARNING) __pragma(_LIBCUDACXX_TOSTRING(nv_diag_default _WARNING))
888
+ # else // ^^^ MSVC ^^^ / vvv not MSVC
889
+ # define _LIBCUDACXX_NV_DIAG_SUPPRESS(_WARNING) \
890
+ _Pragma(_LIBCUDACXX_TOSTRING(nv_diagnostic push)) \
891
+ _Pragma(_LIBCUDACXX_TOSTRING(nv_diag_suppress _WARNING))
892
+ # define _LIBCUDACXX_NV_DIAG_DEFAULT(_WARNING) _Pragma(_LIBCUDACXX_TOSTRING(nv_diagnostic pop))
893
+ # endif // not MSVC
894
+ # elif defined(_LIBCUDACXX_COMPILER_NVHPC)
895
+ # define _LIBCUDACXX_NV_DIAG_SUPPRESS(_WARNING) \
896
+ _Pragma(_LIBCUDACXX_TOSTRING(diagnostic push)) \
897
+ _Pragma(_LIBCUDACXX_TOSTRING(diag_suppress _WARNING))
898
+ # define _LIBCUDACXX_NV_DIAG_DEFAULT(_WARNING) _Pragma(_LIBCUDACXX_TOSTRING(diagnostic pop))
899
+ # else // _LIBCUDACXX_CUDACC_BELOW_11_3
900
+ # if defined(_LIBCUDACXX_COMPILER_MSVC_2017) // MSVC 2017 has issues with restoring the warning
901
+ # define _LIBCUDACXX_NV_DIAG_SUPPRESS(_WARNING) __pragma(_LIBCUDACXX_TOSTRING(diag_suppress _WARNING))
902
+ # define _LIBCUDACXX_NV_DIAG_DEFAULT(_WARNING)
903
+ # elif defined(_LIBCUDACXX_COMPILER_MSVC)
904
+ # define _LIBCUDACXX_NV_DIAG_SUPPRESS(_WARNING) __pragma(_LIBCUDACXX_TOSTRING(diag_suppress _WARNING))
905
+ # define _LIBCUDACXX_NV_DIAG_DEFAULT(_WARNING) __pragma(_LIBCUDACXX_TOSTRING(diag_default _WARNING))
906
+ # else // ^^^ MSVC ^^^ / vvv not MSVC
907
+ # define _LIBCUDACXX_NV_DIAG_SUPPRESS(_WARNING) _Pragma(_LIBCUDACXX_TOSTRING(diag_suppress _WARNING))
908
+ # define _LIBCUDACXX_NV_DIAG_DEFAULT(_WARNING) _Pragma(_LIBCUDACXX_TOSTRING(diag_default _WARNING))
909
+ # endif // not MSVC
910
+ # endif // !__NVCC_DIAG_PRAGMA_SUPPORT__
911
+ #else // ^^^ _LIBCUDACXX_CUDACC ^^^ / vvv other compiler vvv
912
+ # define _LIBCUDACXX_NV_DIAG_SUPPRESS(_WARNING)
913
+ # define _LIBCUDACXX_NV_DIAG_DEFAULT(_WARNING)
914
+ #endif // other compilers
915
+
916
+ #if defined(_LIBCUDACXX_COMPILER_CLANG)
917
+
918
+ // _LIBCUDACXX_ALTERNATE_STRING_LAYOUT is an old name for
919
+ // _LIBCUDACXX_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility.
920
+ #if defined(_LIBCUDACXX_ALTERNATE_STRING_LAYOUT)
921
+ #define _LIBCUDACXX_ABI_ALTERNATE_STRING_LAYOUT
922
+ #endif
923
+
924
+ #if __cplusplus < 201103L
925
+ typedef __char16_t char16_t;
926
+ typedef __char32_t char32_t;
927
+ #endif
928
+
929
+ #if !(__has_feature(cxx_strong_enums))
930
+ #define _LIBCUDACXX_HAS_NO_STRONG_ENUMS
931
+ #endif
932
+
933
+ #if !(__has_feature(cxx_lambdas))
934
+ #define _LIBCUDACXX_HAS_NO_LAMBDAS
935
+ #endif
936
+
937
+ #if !(__has_feature(cxx_nullptr))
938
+ # if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCUDACXX_ABI_ALWAYS_USE_CXX11_NULLPTR)
939
+ # define nullptr __nullptr
940
+ # else
941
+ # define _LIBCUDACXX_HAS_NO_NULLPTR
942
+ # endif
943
+ #endif
944
+
945
+ #if !(__has_feature(cxx_rvalue_references))
946
+ #define _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES
947
+ #endif
948
+
949
+ #if !(__has_feature(cxx_auto_type))
950
+ #define _LIBCUDACXX_HAS_NO_AUTO_TYPE
951
+ #endif
952
+
953
+ #if !(__has_feature(cxx_variadic_templates))
954
+ #define _LIBCUDACXX_HAS_NO_VARIADICS
955
+ #endif
956
+
957
+ #if !(__has_feature(cxx_generalized_initializers))
958
+ #define _LIBCUDACXX_HAS_NO_GENERALIZED_INITIALIZERS
959
+ #endif
960
+
961
+ // Objective-C++ features (opt-in)
962
+ #if __has_feature(objc_arc)
963
+ #define _LIBCUDACXX_HAS_OBJC_ARC
964
+ #endif
965
+
966
+ #if __has_feature(objc_arc_weak)
967
+ #define _LIBCUDACXX_HAS_OBJC_ARC_WEAK
968
+ #endif
969
+
970
+ #if !(__has_feature(cxx_relaxed_constexpr))
971
+ #define _LIBCUDACXX_HAS_NO_CXX14_CONSTEXPR
972
+ #endif
973
+
974
+ #if !(__has_feature(cxx_variable_templates))
975
+ #define _LIBCUDACXX_HAS_NO_VARIABLE_TEMPLATES
976
+ #endif
977
+
978
+ #if !(__has_feature(cxx_noexcept))
979
+ #define _LIBCUDACXX_HAS_NO_NOEXCEPT
980
+ #endif
981
+
982
+ // Allow for build-time disabling of unsigned integer sanitization
983
+ #if !defined(_LIBCUDACXX_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK) && __has_attribute(no_sanitize)
984
+ #define _LIBCUDACXX_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow")))
985
+ #endif
986
+
987
+ #define _LIBCUDACXX_DISABLE_EXTENSION_WARNING __extension__
988
+
989
+ #elif defined(_LIBCUDACXX_COMPILER_GCC)
990
+
991
+ #ifndef _LIBCUDACXX_USE_IS_ASSIGNABLE_FALLBACK
992
+ // FIXME: GCC 8.0 supports this trait, but it has a bug.
993
+ // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91592
994
+ // https://godbolt.org/z/IljfIw
995
+ #define _LIBCUDACXX_USE_IS_ASSIGNABLE_FALLBACK
996
+ #endif // _LIBCUDACXX_USE_IS_ASSIGNABLE_FALLBACK
997
+
998
+ // Determine if GCC supports relaxed constexpr
999
+ #if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
1000
+ #define _LIBCUDACXX_HAS_NO_CXX14_CONSTEXPR
1001
+ #endif
1002
+
1003
+ // GCC 5 supports variable templates
1004
+ #if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
1005
+ #define _LIBCUDACXX_HAS_NO_VARIABLE_TEMPLATES
1006
+ #endif
1007
+
1008
+ #if _GNUC_VER < 600
1009
+ #define _LIBCUDACXX_GCC_MATH_IN_STD
1010
+ #endif
1011
+
1012
+ // NVCC cannot properly handle some deductions occuring within NOEXCEPT
1013
+ // C++17 mode causes reference instatiation errors in tuple
1014
+ #if (_GNUC_VER >= 702 && _GNUC_VER <= 805)
1015
+ #if defined(_LIBCUDACXX_COMPILER_NVCC) && _LIBCUDACXX_STD_VER == 17
1016
+ #define _LIBCUDACXX_NO_TUPLE_NOEXCEPT
1017
+ #endif
1018
+ #endif
1019
+
1020
+ #define _LIBCUDACXX_DISABLE_EXTENSION_WARNING __extension__
1021
+
1022
+ #elif defined(_LIBCUDACXX_COMPILER_MSVC)
1023
+
1024
+ #define _LIBCUDACXX_WARNING(x) __pragma(message(__FILE__ "(" _LIBCUDACXX_TOSTRING(__LINE__) ") : warning note: " x))
1025
+
1026
+ // https://github.com/microsoft/STL/blob/master/stl/inc/yvals_core.h#L353
1027
+ // warning C4100: 'quack': unreferenced formal parameter
1028
+ // warning C4127: conditional expression is constant
1029
+ // warning C4180: qualifier applied to function type has no meaning; ignored
1030
+ // warning C4197: 'purr': top-level volatile in cast is ignored
1031
+ // warning C4324: 'roar': structure was padded due to alignment specifier
1032
+ // warning C4455: literal suffix identifiers that do not start with an underscore are reserved
1033
+ // warning C4503: 'hum': decorated name length exceeded, name was truncated
1034
+ // warning C4522: 'woof' : multiple assignment operators specified
1035
+ // warning C4668: 'meow' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
1036
+ // warning C4800: 'boo': forcing value to bool 'true' or 'false' (performance warning)
1037
+ // warning C4996: 'meow': was declared deprecated
1038
+ #define _LIBCUDACXX_MSVC_DISABLED_WARNINGS \
1039
+ 4100 \
1040
+ 4127 \
1041
+ 4180 \
1042
+ 4197 \
1043
+ 4296 \
1044
+ 4324 \
1045
+ 4455 \
1046
+ 4503 \
1047
+ 4522 \
1048
+ 4668 \
1049
+ 4800 \
1050
+ 4996 \
1051
+ /**/
1052
+
1053
+ #if _MSC_VER < 1900
1054
+ #error "MSVC versions prior to Visual Studio 2015 are not supported"
1055
+ #endif
1056
+
1057
+ // MSVC implemented P0030R1 in 15.7, only available under C++17
1058
+ #if _MSC_VER < 1914
1059
+ #define _LIBCUDACXX_NO_HOST_CPP17_HYPOT
1060
+ #endif
1061
+
1062
+ #if _MSC_VER < 1920
1063
+ #define _LIBCUDACXX_HAS_NO_NOEXCEPT_SFINAE
1064
+ #define _LIBCUDACXX_HAS_NO_LOGICAL_METAFUNCTION_ALIASES
1065
+ #endif
1066
+
1067
+ // MSVC exposed __iso_volatile intrinsics beginning on 1924 for x86
1068
+ #if _MSC_VER < 1924
1069
+ #define _LIBCUDACXX_MSVC_HAS_NO_ISO_INTRIN
1070
+ #endif
1071
+
1072
+ #if _LIBCUDACXX_STD_VER < 14
1073
+ #define _LIBCUDACXX_HAS_NO_CXX14_CONSTEXPR
1074
+ #define _LIBCUDACXX_HAS_NO_VARIABLE_TEMPLATES
1075
+ #endif
1076
+
1077
+ #define _LIBCUDACXX_WEAK
1078
+
1079
+ #define _LIBCUDACXX_HAS_NO_VECTOR_EXTENSION
1080
+
1081
+ #define _LIBCUDACXX_DISABLE_EXTENSION_WARNING
1082
+
1083
+ #elif defined(_LIBCUDACXX_COMPILER_IBM)
1084
+
1085
+ #define _ATTRIBUTE(x) __attribute__((x))
1086
+
1087
+ #define _LIBCUDACXX_HAS_NO_UNICODE_CHARS
1088
+ #define _LIBCUDACXX_HAS_NO_VARIABLE_TEMPLATES
1089
+
1090
+ #if defined(_AIX)
1091
+ #define __MULTILOCALE_API
1092
+ #endif
1093
+
1094
+ #define _LIBCUDACXX_HAS_NO_VECTOR_EXTENSION
1095
+
1096
+ #elif defined(_LIBCUDACXX_COMPILER_NVRTC) || defined(_LIBCUDACXX_COMPILER_NVHPC)
1097
+
1098
+ #if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
1099
+ #define _LIBCUDACXX_HAS_NO_CXX14_CONSTEXPR
1100
+ #endif
1101
+
1102
+ #if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
1103
+ #define _LIBCUDACXX_HAS_NO_VARIABLE_TEMPLATES
1104
+ #endif
1105
+
1106
+ #define _LIBCUDACXX_DISABLE_EXTENSION_WARNING
1107
+
1108
+ #endif // _LIBCUDACXX_COMPILER_[CLANG|GCC|MSVC|IBM|NVRTC]
1109
+
1110
+ #if defined(_LIBCUDACXX_COMPILER_NVHPC) && !defined(__cuda_std__)
1111
+ // Forcefully disable visibility controls when used as the standard library with NVC++.
1112
+ // TODO: reevaluate.
1113
+ #define _LIBCUDACXX_HIDE_FROM_ABI
1114
+ #ifndef _LIBCUDACXX_DISABLE_EXTERN_TEMPLATE
1115
+ #define _LIBCUDACXX_DISABLE_EXTERN_TEMPLATE
1116
+ #endif
1117
+ #endif
1118
+
1119
+ #ifndef _LIBCUDACXX_FREESTANDING
1120
+ #if defined(__cuda_std__) \
1121
+ || !defined(__STDC_HOSTED__)
1122
+ # define _LIBCUDACXX_FREESTANDING
1123
+ #endif
1124
+ #endif // !_LIBCUDACXX_FREESTANDING
1125
+
1126
+ #ifndef _LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS
1127
+ #if defined(_LIBCUDACXX_COMPILER_NVRTC) \
1128
+ || (defined(_LIBCUDACXX_COMPILER_NVHPC) && !defined(__cuda_std__))
1129
+ # define _LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS
1130
+ #endif
1131
+ #endif // _LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS
1132
+
1133
+ #ifndef _LIBCUDACXX_HAS_CUDA_ATOMIC_EXT
1134
+ #if defined(__cuda_std__)
1135
+ # define _LIBCUDACXX_HAS_CUDA_ATOMIC_EXT
1136
+ #endif
1137
+ #endif // _LIBCUDACXX_HAS_CUDA_ATOMIC_EXT
1138
+
1139
+ #ifndef _LIBCUDACXX_HAS_EXTERNAL_ATOMIC_IMP
1140
+ #if defined(__cuda_std__)
1141
+ # define _LIBCUDACXX_HAS_EXTERNAL_ATOMIC_IMP
1142
+ #endif
1143
+ #endif // _LIBCUDACXX_HAS_EXTERNAL_ATOMIC_IMP
1144
+
1145
+ #ifndef _LIBCUDACXX_HAS_NO_ASAN
1146
+ #if defined(_LIBCUDACXX_COMPILER_GCC)
1147
+ # if !defined(__SANITIZE_ADDRESS__)
1148
+ # define _LIBCUDACXX_HAS_NO_ASAN
1149
+ # endif // !__SANITIZE_ADDRESS__
1150
+ #elif defined(_LIBCUDACXX_COMPILER_CLANG)
1151
+ # if !__has_feature(address_sanitizer)
1152
+ # define _LIBCUDACXX_HAS_NO_ASAN
1153
+ # endif // !__has_feature(address_sanitizer)
1154
+ #else
1155
+ # define _LIBCUDACXX_HAS_NO_ASAN
1156
+ #endif // _LIBCUDACXX_COMPILER[MSVC|IBM|NVHPC|NVRTC]
1157
+ #endif // _LIBCUDACXX_HAS_NO_ASAN
1158
+
1159
+ #ifndef _LIBCUDACXX_HAS_NO_CXX20_CHRONO_LITERALS
1160
+ #if defined(__cuda_std__) \
1161
+ || (defined(_LIBCUDACXX_COMPILER_CLANG) && _LIBCUDACXX_CLANG_VER < 800)
1162
+ # define _LIBCUDACXX_HAS_NO_CXX20_CHRONO_LITERALS
1163
+ #endif // __cuda_std__
1164
+ #endif // _LIBCUDACXX_HAS_NO_CXX20_CHRONO_LITERALS
1165
+
1166
+ #ifndef _LIBCUDACXX_HAS_NO_INT128
1167
+ #if defined(_LIBCUDACXX_COMPILER_MSVC) \
1168
+ || (defined(_LIBCUDACXX_COMPILER_NVRTC) && !defined(__CUDACC_RTC_INT128__)) \
1169
+ || (defined(_LIBCUDACXX_COMPILER_NVCC) && (_LIBCUDACXX_CUDACC_VER < 1105000)) \
1170
+ || !defined(__SIZEOF_INT128__)
1171
+ # define _LIBCUDACXX_HAS_NO_INT128
1172
+ #endif
1173
+ #endif // !_LIBCUDACXX_HAS_NO_INT128
1174
+
1175
+ #ifndef _LIBCUDACXX_HAS_NO_LONG_DOUBLE
1176
+ #if defined(_LIBCUDACXX_CUDACC)
1177
+ # define _LIBCUDACXX_HAS_NO_LONG_DOUBLE
1178
+ #endif
1179
+ #endif // _LIBCUDACXX_HAS_NO_LONG_DOUBLE
1180
+
1181
+ #ifndef _LIBCUDACXX_HAS_NO_ATTRIBUTE_NO_UNIQUE_ADDRESS
1182
+ #if __has_cpp_attribute(msvc::no_unique_address)
1183
+ // MSVC implements [[no_unique_address]] as a silent no-op currently.
1184
+ // (If/when MSVC breaks its C++ ABI, it will be changed to work as intended.)
1185
+ // However, MSVC implements [[msvc::no_unique_address]] which does what
1186
+ // [[no_unique_address]] is supposed to do, in general.
1187
+
1188
+ // Clang-cl does not yet (14.0) implement either [[no_unique_address]] or
1189
+ // [[msvc::no_unique_address]] though. If/when it does implement
1190
+ // [[msvc::no_unique_address]], this should be preferred though.
1191
+ # define _LIBCUDACXX_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
1192
+ #elif defined(_LIBCUDACXX_CUDACC_BELOW_11_3) \
1193
+ || (__has_cpp_attribute(no_unique_address) < 201803L)
1194
+ # define _LIBCUDACXX_HAS_NO_ATTRIBUTE_NO_UNIQUE_ADDRESS
1195
+ # define _LIBCUDACXX_NO_UNIQUE_ADDRESS
1196
+ #elif __has_cpp_attribute(no_unique_address)
1197
+ # define _LIBCUDACXX_NO_UNIQUE_ADDRESS [[no_unique_address]]
1198
+ #else
1199
+ # define _LIBCUDACXX_HAS_NO_ATTRIBUTE_NO_UNIQUE_ADDRESS
1200
+ # define _LIBCUDACXX_NO_UNIQUE_ADDRESS
1201
+ // Note that this can be replaced by #error as soon as clang-cl
1202
+ // implements msvc::no_unique_address, since there should be no C++20
1203
+ // compiler that doesn't support one of the two attributes at that point.
1204
+ // We generally don't want to use this macro outside of C++20-only code,
1205
+ // because using it conditionally in one language version only would make
1206
+ // the ABI inconsistent.
1207
+ #endif
1208
+ #endif // _LIBCUDACXX_HAS_NO_ATTRIBUTE_NO_UNIQUE_ADDRESS
1209
+
1210
+ #ifndef _LIBCUDACXX_HAS_NO_MONOTONIC_CLOCK
1211
+ #if defined(__cuda_std__)
1212
+ # define _LIBCUDACXX_HAS_NO_MONOTONIC_CLOCK
1213
+ #endif
1214
+ #endif // _LIBCUDACXX_HAS_NO_MONOTONIC_CLOCK
1215
+
1216
+ #ifndef _LIBCUDACXX_HAS_NO_PLATFORM_WAIT
1217
+ #if defined(__cuda_std__)
1218
+ # define _LIBCUDACXX_HAS_NO_PLATFORM_WAIT
1219
+ #endif
1220
+ #endif // _LIBCUDACXX_HAS_NO_PLATFORM_WAIT
1221
+
1222
+ #ifndef _LIBCUDACXX_HAS_NO_PRAGMA_PUSH_POP_MACRO
1223
+ #if (defined(_LIBCUDACXX_COMPILER_MSVC) && _MSC_VER < 1920) \
1224
+ || defined(_LIBCUDACXX_COMPILER_NVRTC) \
1225
+ || defined(_LIBCUDACXX_COMPILER_IBM)
1226
+ #define _LIBCUDACXX_HAS_NO_PRAGMA_PUSH_POP_MACRO
1227
+ #endif
1228
+ #endif // _LIBCUDACXX_HAS_NO_PRAGMA_PUSH_POP_MACRO
1229
+
1230
+ #ifndef _LIBCUDACXX_HAS_NO_THREAD_CONTENTION_TABLE
1231
+ #if defined(__cuda_std__)
1232
+ # define _LIBCUDACXX_HAS_NO_THREAD_CONTENTION_TABLE
1233
+ #endif
1234
+ #endif // _LIBCUDACXX_HAS_NO_THREAD_CONTENTION_TABLE
1235
+
1236
+ #ifndef _LIBCUDACXX_HAS_NO_TREE_BARRIER
1237
+ #if defined(__cuda_std__)
1238
+ # define _LIBCUDACXX_HAS_NO_TREE_BARRIER
1239
+ #endif
1240
+ #endif // _LIBCUDACXX_HAS_NO_TREE_BARRIER
1241
+
1242
+ #ifndef _LIBCUDACXX_HAS_NO_WCHAR_H
1243
+ #if defined(__cuda_std__)
1244
+ # define _LIBCUDACXX_HAS_NO_WCHAR_H
1245
+ #endif
1246
+ #endif // _LIBCUDACXX_HAS_NO_WCHAR_H
1247
+
1248
+ #ifndef _LIBCUDACXX_NO_EXCEPTIONS
1249
+ #if defined(__cuda_std__) \
1250
+ || (defined(_LIBCUDACXX_COMPILER_CLANG) && !(__has_feature(cxx_exceptions))) \
1251
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && !__EXCEPTIONS)
1252
+ # define _LIBCUDACXX_NO_EXCEPTIONS
1253
+ #endif
1254
+ #endif // !_LIBCUDACXX_NO_EXCEPTIONS
1255
+
1256
+ // Try to find out if RTTI is disabled.
1257
+ // g++ and cl.exe have RTTI on by default and define a macro when it is.
1258
+ #ifndef _LIBCUDACXX_NO_RTTI
1259
+ #if defined(__cuda_std__) \
1260
+ || (defined(_LIBCUDACXX_COMPILER_CLANG) && !(__has_feature(cxx_rtti))) \
1261
+ || (defined(_LIBCUDACXX_COMPILER_GCC) && !defined(__GXX_RTTI)) \
1262
+ || (defined(_LIBCUDACXX_COMPILER_MSVC) && !defined(_CPPRTTI))
1263
+ # define _LIBCUDACXX_NO_RTTI
1264
+ #endif
1265
+ #endif // !_LIBCUDACXX_NO_RTTI
1266
+
1267
+ #ifndef _LIBCUDACXX_NODEBUG_TYPE
1268
+ #if defined(__cuda_std__)
1269
+ # define _LIBCUDACXX_NODEBUG_TYPE
1270
+ #elif __has_attribute(__nodebug__) \
1271
+ && (defined(_LIBCUDACXX_COMPILER_CLANG) && _LIBCUDACXX_CLANG_VER >= 1210)
1272
+ # define _LIBCUDACXX_NODEBUG_TYPE __attribute__((nodebug))
1273
+ #else
1274
+ # define _LIBCUDACXX_NODEBUG_TYPE
1275
+ #endif
1276
+ #endif // !_LIBCUDACXX_NODEBUG_TYPE
1277
+
1278
+ #if defined(_LIBCUDACXX_COMPILER_MSVC)
1279
+ # define _LIBCUDACXX_NORETURN __declspec(noreturn)
1280
+ #elif __has_feature(cxx_attributes)
1281
+ # define _LIBCUDACXX_NORETURN [[noreturn]]
1282
+ #else
1283
+ # define _LIBCUDACXX_NORETURN __attribute__ ((noreturn))
1284
+ #endif
1285
+
1286
+ #if defined(_LIBCUDACXX_OBJECT_FORMAT_COFF)
1287
+
1288
+ #ifdef _DLL
1289
+ # define _LIBCUDACXX_CRT_FUNC __declspec(dllimport)
1290
+ #else
1291
+ # define _LIBCUDACXX_CRT_FUNC
1292
+ #endif
1293
+
1294
+ #if defined(_LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS)
1295
+ # define _LIBCUDACXX_DLL_VIS
1296
+ # define _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS
1297
+ # define _LIBCUDACXX_CLASS_TEMPLATE_INSTANTIATION_VIS
1298
+ # define _LIBCUDACXX_OVERRIDABLE_FUNC_VIS
1299
+ # define _LIBCUDACXX_EXPORTED_FROM_ABI
1300
+ #elif defined(_LIBCUDACXX_BUILDING_LIBRARY)
1301
+ # define _LIBCUDACXX_DLL_VIS __declspec(dllexport)
1302
+ # if defined(__MINGW32__)
1303
+ # define _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS _LIBCUDACXX_DLL_VIS
1304
+ # define _LIBCUDACXX_CLASS_TEMPLATE_INSTANTIATION_VIS
1305
+ # else
1306
+ # define _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS
1307
+ # define _LIBCUDACXX_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCUDACXX_DLL_VIS
1308
+ # endif
1309
+ # define _LIBCUDACXX_OVERRIDABLE_FUNC_VIS _LIBCUDACXX_DLL_VIS
1310
+ # define _LIBCUDACXX_EXPORTED_FROM_ABI __declspec(dllexport)
1311
+ #else
1312
+ # define _LIBCUDACXX_DLL_VIS __declspec(dllimport)
1313
+ # define _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS _LIBCUDACXX_DLL_VIS
1314
+ # define _LIBCUDACXX_CLASS_TEMPLATE_INSTANTIATION_VIS
1315
+ # define _LIBCUDACXX_OVERRIDABLE_FUNC_VIS
1316
+ # define _LIBCUDACXX_EXPORTED_FROM_ABI __declspec(dllimport)
1317
+ #endif
1318
+
1319
+ #define _LIBCUDACXX_TYPE_VIS _LIBCUDACXX_DLL_VIS
1320
+ #define _LIBCUDACXX_FUNC_VIS _LIBCUDACXX_DLL_VIS
1321
+ #define _LIBCUDACXX_EXCEPTION_ABI _LIBCUDACXX_DLL_VIS
1322
+ #define _LIBCUDACXX_HIDDEN
1323
+ #define _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1324
+ #define _LIBCUDACXX_TEMPLATE_VIS
1325
+ #define _LIBCUDACXX_ENUM_VIS
1326
+
1327
+ #endif // defined(_LIBCUDACXX_OBJECT_FORMAT_COFF)
1328
+
1329
+ #ifndef _LIBCUDACXX_HIDDEN
1330
+ # if !defined(_LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS)
1331
+ # define _LIBCUDACXX_HIDDEN __attribute__ ((__visibility__("hidden")))
1332
+ # else
1333
+ # define _LIBCUDACXX_HIDDEN
1334
+ # endif
1335
+ #endif
1336
+
1337
+ #ifndef _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1338
+ # if !defined(_LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS)
1339
+ // The inline should be removed once PR32114 is resolved
1340
+ # define _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCUDACXX_HIDDEN
1341
+ # else
1342
+ # define _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
1343
+ # endif
1344
+ #endif
1345
+
1346
+ #ifndef _LIBCUDACXX_FUNC_VIS
1347
+ # if !defined(_LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS)
1348
+ # define _LIBCUDACXX_FUNC_VIS __attribute__ ((__visibility__("default")))
1349
+ # else
1350
+ # define _LIBCUDACXX_FUNC_VIS
1351
+ # endif
1352
+ #endif
1353
+
1354
+ #ifndef _LIBCUDACXX_TYPE_VIS
1355
+ # if !defined(_LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS)
1356
+ # define _LIBCUDACXX_TYPE_VIS __attribute__ ((__visibility__("default")))
1357
+ # else
1358
+ # define _LIBCUDACXX_TYPE_VIS
1359
+ # endif
1360
+ #endif
1361
+
1362
+ #ifndef _LIBCUDACXX_TEMPLATE_VIS
1363
+ # if !defined(_LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS)
1364
+ # if __has_attribute(__type_visibility__)
1365
+ # define _LIBCUDACXX_TEMPLATE_VIS __attribute__ ((__type_visibility__("default")))
1366
+ # else
1367
+ # define _LIBCUDACXX_TEMPLATE_VIS __attribute__ ((__visibility__("default")))
1368
+ # endif
1369
+ # else
1370
+ # define _LIBCUDACXX_TEMPLATE_VIS
1371
+ # endif
1372
+ #endif
1373
+
1374
+ #ifndef _LIBCUDACXX_EXPORTED_FROM_ABI
1375
+ # if !defined(_LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS)
1376
+ # define _LIBCUDACXX_EXPORTED_FROM_ABI __attribute__((__visibility__("default")))
1377
+ # else
1378
+ # define _LIBCUDACXX_EXPORTED_FROM_ABI
1379
+ # endif
1380
+ #endif
1381
+
1382
+ #ifndef _LIBCUDACXX_OVERRIDABLE_FUNC_VIS
1383
+ #define _LIBCUDACXX_OVERRIDABLE_FUNC_VIS _LIBCUDACXX_FUNC_VIS
1384
+ #endif
1385
+
1386
+ #ifndef _LIBCUDACXX_EXCEPTION_ABI
1387
+ # if !defined(_LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS)
1388
+ # define _LIBCUDACXX_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
1389
+ # else
1390
+ # define _LIBCUDACXX_EXCEPTION_ABI
1391
+ # endif
1392
+ #endif
1393
+
1394
+ #ifndef _LIBCUDACXX_ENUM_VIS
1395
+ # if !defined(_LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
1396
+ # define _LIBCUDACXX_ENUM_VIS __attribute__ ((__type_visibility__("default")))
1397
+ # else
1398
+ # define _LIBCUDACXX_ENUM_VIS
1399
+ # endif
1400
+ #endif
1401
+
1402
+ #ifndef _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS
1403
+ # if !defined(_LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
1404
+ # define _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__visibility__("default")))
1405
+ # else
1406
+ # define _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS
1407
+ # endif
1408
+ #endif
1409
+
1410
+ #ifndef _LIBCUDACXX_CLASS_TEMPLATE_INSTANTIATION_VIS
1411
+ #define _LIBCUDACXX_CLASS_TEMPLATE_INSTANTIATION_VIS
1412
+ #endif
1413
+
1414
+ #if __has_attribute(internal_linkage)
1415
+ # define _LIBCUDACXX_INTERNAL_LINKAGE __attribute__ ((internal_linkage))
1416
+ #else
1417
+ # define _LIBCUDACXX_INTERNAL_LINKAGE _LIBCUDACXX_ALWAYS_INLINE
1418
+ #endif
1419
+
1420
+ #if __has_attribute(exclude_from_explicit_instantiation)
1421
+ # define _LIBCUDACXX_EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__ ((__exclude_from_explicit_instantiation__))
1422
+ #else
1423
+ // Try to approximate the effect of exclude_from_explicit_instantiation
1424
+ // (which is that entities are not assumed to be provided by explicit
1425
+ // template instantiations in the dylib) by always inlining those entities.
1426
+ # define _LIBCUDACXX_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCUDACXX_ALWAYS_INLINE
1427
+ #endif
1428
+
1429
+ #ifndef _LIBCUDACXX_HIDE_FROM_ABI_PER_TU
1430
+ # ifndef _LIBCUDACXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT
1431
+ # define _LIBCUDACXX_HIDE_FROM_ABI_PER_TU 0
1432
+ # else
1433
+ # define _LIBCUDACXX_HIDE_FROM_ABI_PER_TU 1
1434
+ # endif
1435
+ #endif
1436
+
1437
+ #ifndef _LIBCUDACXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT
1438
+ # ifdef _LIBCUDACXX_OBJECT_FORMAT_COFF // Windows binaries can't merge typeinfos.
1439
+ # define _LIBCUDACXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT 0
1440
+ #else
1441
+ // TODO: This isn't strictly correct on ELF platforms due to llvm.org/PR37398
1442
+ // And we should consider defaulting to OFF.
1443
+ # define _LIBCUDACXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT 1
1444
+ #endif
1445
+ #endif
1446
+
1447
+ #ifndef _LIBCUDACXX_HIDE_FROM_ABI
1448
+ # if _LIBCUDACXX_HIDE_FROM_ABI_PER_TU
1449
+ # define _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_HIDDEN _LIBCUDACXX_INTERNAL_LINKAGE
1450
+ # else
1451
+ # define _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_HIDDEN _LIBCUDACXX_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
1452
+ # endif
1453
+ #endif
1454
+
1455
+ #ifdef _LIBCUDACXX_BUILDING_LIBRARY
1456
+ # if _LIBCUDACXX_ABI_VERSION > 1
1457
+ # define _LIBCUDACXX_HIDE_FROM_ABI_AFTER_V1 _LIBCUDACXX_HIDE_FROM_ABI
1458
+ # else
1459
+ # define _LIBCUDACXX_HIDE_FROM_ABI_AFTER_V1
1460
+ # endif
1461
+ #else
1462
+ # define _LIBCUDACXX_HIDE_FROM_ABI_AFTER_V1 _LIBCUDACXX_HIDE_FROM_ABI
1463
+ #endif
1464
+
1465
+ #ifdef _LIBCUDACXX_CUDACC
1466
+ # define _LIBCUDACXX_HOST __host__
1467
+ # define _LIBCUDACXX_DEVICE __device__
1468
+ # define _LIBCUDACXX_HOST_DEVICE __host__ __device__
1469
+ # define _LIBCUDACXX_FORCE_INLINE __forceinline__
1470
+ #else // ^^^ _LIBCUDACXX_CUDACC ^^^ / vvv !_LIBCUDACXX_CUDACC
1471
+ # define _LIBCUDACXX_HOST
1472
+ # define _LIBCUDACXX_DEVICE
1473
+ # define _LIBCUDACXX_HOST_DEVICE
1474
+ # define _LIBCUDACXX_FORCE_INLINE
1475
+ #endif // !_LIBCUDACXX_CUDACC
1476
+
1477
+ // Just so we can migrate to the new macros gradually.
1478
+
1479
+ #ifdef __cuda_std__
1480
+ # define _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_HOST_DEVICE
1481
+ #else
1482
+ # define _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_HIDE_FROM_ABI
1483
+ #endif // __cuda_std__
1484
+
1485
+ #define _LIBCUDACXX_CONCAT1(_LIBCUDACXX_X,_LIBCUDACXX_Y) _LIBCUDACXX_X##_LIBCUDACXX_Y
1486
+ #define _LIBCUDACXX_CONCAT(_LIBCUDACXX_X,_LIBCUDACXX_Y) _LIBCUDACXX_CONCAT1(_LIBCUDACXX_X,_LIBCUDACXX_Y)
1487
+
1488
+ #ifndef _LIBCUDACXX_ABI_NAMESPACE
1489
+ #ifdef __cuda_std__
1490
+ # define _LIBCUDACXX_ABI_NAMESPACE _LIBCUDACXX_CONCAT(__,_LIBCUDACXX_CUDA_ABI_VERSION)
1491
+ #else
1492
+ # define _LIBCUDACXX_ABI_NAMESPACE _LIBCUDACXX_CONCAT(__,_LIBCUDACXX_ABI_VERSION)
1493
+ #endif // __cuda_std__
1494
+ #endif // _LIBCUDACXX_ABI_NAMESPACE
1495
+
1496
+ #ifdef __cuda_std__
1497
+ # define _LIBCUDACXX_BEGIN_NAMESPACE_STD_NOVERSION namespace cuda { namespace std {
1498
+ # define _LIBCUDACXX_END_NAMESPACE_STD_NOVERSION } }
1499
+ # define _CUDA_VSTD ::cuda::std::_LIBCUDACXX_ABI_NAMESPACE
1500
+ # define _CUDA_VRANGES ::cuda::std::ranges::_LIBCUDACXX_ABI_NAMESPACE
1501
+ #else
1502
+ # define _LIBCUDACXX_BEGIN_NAMESPACE_STD_NOVERSION namespace std {
1503
+ # define _LIBCUDACXX_END_NAMESPACE_STD_NOVERSION }
1504
+ # define _CUDA_VSTD ::std::_LIBCUDACXX_ABI_NAMESPACE
1505
+ # define _CUDA_VRANGES ::std::ranges::_LIBCUDACXX_ABI_NAMESPACE
1506
+ #endif
1507
+
1508
+ #ifdef __cuda_std__
1509
+ #define _LIBCUDACXX_BEGIN_NAMESPACE_CUDA namespace cuda { inline namespace _LIBCUDACXX_ABI_NAMESPACE {
1510
+ #define _LIBCUDACXX_END_NAMESPACE_CUDA } }
1511
+ #define _LIBCUDACXX_BEGIN_NAMESPACE_CUDA_DEVICE namespace cuda { namespace device { inline namespace _LIBCUDACXX_ABI_NAMESPACE {
1512
+ #define _LIBCUDACXX_END_NAMESPACE_CUDA_DEVICE } } }
1513
+ #define _LIBCUDACXX_BEGIN_NAMESPACE_CUDA_PTX namespace cuda { namespace ptx { inline namespace _LIBCUDACXX_ABI_NAMESPACE {
1514
+ #define _LIBCUDACXX_END_NAMESPACE_CUDA_PTX } } }
1515
+ #define _CUDA_VPTX ::cuda::ptx::_LIBCUDACXX_ABI_NAMESPACE
1516
+ #define _LIBCUDACXX_BEGIN_NAMESPACE_CUDA_DEVICE_EXPERIMENTAL namespace cuda { namespace device { namespace experimental { inline namespace _LIBCUDACXX_ABI_NAMESPACE {
1517
+ #define _LIBCUDACXX_END_NAMESPACE_CUDA_DEVICE_EXPERIMENTAL } } } }
1518
+ #endif
1519
+
1520
+ // Inline namespaces are available in Clang/GCC/MSVC regardless of C++ dialect.
1521
+ #define _LIBCUDACXX_BEGIN_NAMESPACE_STD _LIBCUDACXX_BEGIN_NAMESPACE_STD_NOVERSION inline namespace _LIBCUDACXX_ABI_NAMESPACE {
1522
+ #define _LIBCUDACXX_END_NAMESPACE_STD } _LIBCUDACXX_END_NAMESPACE_STD_NOVERSION
1523
+
1524
+ #ifndef __cuda_std__
1525
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD _LIBCUDACXX_END_NAMESPACE_STD
1526
+ #endif
1527
+
1528
+ #define _LIBCUDACXX_BEGIN_NAMESPACE_RANGES _LIBCUDACXX_BEGIN_NAMESPACE_STD_NOVERSION namespace ranges { inline namespace _LIBCUDACXX_ABI_NAMESPACE {
1529
+ #define _LIBCUDACXX_END_NAMESPACE_RANGES } } _LIBCUDACXX_END_NAMESPACE_STD_NOVERSION
1530
+
1531
+ #if !defined(__cuda_std__)
1532
+ _LIBCUDACXX_BEGIN_NAMESPACE_RANGES _LIBCUDACXX_END_NAMESPACE_RANGES
1533
+ #endif
1534
+
1535
+ #if _LIBCUDACXX_STD_VER > 17
1536
+ #define _LIBCUDACXX_BEGIN_NAMESPACE_RANGES_ABI inline namespace __cxx20 {
1537
+ #else
1538
+ #define _LIBCUDACXX_BEGIN_NAMESPACE_RANGES_ABI inline namespace __cxx17 {
1539
+ #endif
1540
+ #define _LIBCUDACXX_END_NAMESPACE_RANGES_ABI }
1541
+
1542
+ #define _LIBCUDACXX_BEGIN_NAMESPACE_CPO(_CPO) namespace _CPO { _LIBCUDACXX_BEGIN_NAMESPACE_RANGES_ABI
1543
+ #define _LIBCUDACXX_END_NAMESPACE_CPO } }
1544
+
1545
+ #if _LIBCUDACXX_STD_VER >= 17
1546
+ #define _LIBCUDACXX_BEGIN_NAMESPACE_FILESYSTEM \
1547
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD inline namespace __fs { namespace filesystem {
1548
+ #else
1549
+ #define _LIBCUDACXX_BEGIN_NAMESPACE_FILESYSTEM \
1550
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem {
1551
+ #endif
1552
+
1553
+ #define _LIBCUDACXX_END_NAMESPACE_FILESYSTEM \
1554
+ _LIBCUDACXX_END_NAMESPACE_STD } }
1555
+
1556
+ #define _CUDA_VSTD_FS _CUDA_VSTD::__fs::filesystem
1557
+
1558
+ #ifndef _LIBCUDACXX_PREFERRED_OVERLOAD
1559
+ # if __has_attribute(__enable_if__)
1560
+ # define _LIBCUDACXX_PREFERRED_OVERLOAD __attribute__ ((__enable_if__(true, "")))
1561
+ # endif
1562
+ #endif
1563
+
1564
+ #ifdef _LIBCUDACXX_HAS_NO_UNICODE_CHARS
1565
+ typedef unsigned short char16_t;
1566
+ typedef unsigned int char32_t;
1567
+ #endif // _LIBCUDACXX_HAS_NO_UNICODE_CHARS
1568
+
1569
+ #if defined(_LIBCUDACXX_COMPILER_GCC) \
1570
+ || defined(_LIBCUDACXX_COMPILER_CLANG)
1571
+ # define _LIBCUDACXX_NOALIAS __attribute__((__malloc__))
1572
+ #else
1573
+ # define _LIBCUDACXX_NOALIAS
1574
+ #endif
1575
+
1576
+ #if __has_feature(cxx_explicit_conversions) \
1577
+ || defined(_LIBCUDACXX_COMPILER_IBM) \
1578
+ || defined(_LIBCUDACXX_COMPILER_GCC) \
1579
+ || defined(_LIBCUDACXX_COMPILER_CLANG)
1580
+ # define _LIBCUDACXX_EXPLICIT explicit
1581
+ #else
1582
+ # define _LIBCUDACXX_EXPLICIT
1583
+ #endif
1584
+
1585
+ #if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete)
1586
+ #define _LIBCUDACXX_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
1587
+ #endif
1588
+
1589
+ #ifdef _LIBCUDACXX_HAS_NO_STRONG_ENUMS
1590
+ # define _LIBCUDACXX_DECLARE_STRONG_ENUM(x) struct _LIBCUDACXX_TYPE_VIS x { enum __lx
1591
+ # define _LIBCUDACXX_DECLARE_STRONG_ENUM_EPILOG(x) \
1592
+ __lx __v_; \
1593
+ _LIBCUDACXX_INLINE_VISIBILITY x(__lx __v) : __v_(__v) {} \
1594
+ _LIBCUDACXX_INLINE_VISIBILITY explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
1595
+ _LIBCUDACXX_INLINE_VISIBILITY operator int() const {return __v_;} \
1596
+ };
1597
+ #else // _LIBCUDACXX_HAS_NO_STRONG_ENUMS
1598
+ # define _LIBCUDACXX_DECLARE_STRONG_ENUM(x) enum class _LIBCUDACXX_ENUM_VIS x
1599
+ # define _LIBCUDACXX_DECLARE_STRONG_ENUM_EPILOG(x)
1600
+ #endif // _LIBCUDACXX_HAS_NO_STRONG_ENUMS
1601
+
1602
+ #ifdef _LIBCUDACXX_DEBUG
1603
+ # if _LIBCUDACXX_DEBUG == 0
1604
+ # define _LIBCUDACXX_DEBUG_LEVEL 1
1605
+ # elif _LIBCUDACXX_DEBUG == 1
1606
+ # define _LIBCUDACXX_DEBUG_LEVEL 2
1607
+ # else
1608
+ # error Supported values for _LIBCUDACXX_DEBUG are 0 and 1
1609
+ # endif
1610
+ # if !defined(_LIBCUDACXX_BUILDING_LIBRARY)
1611
+ # define _LIBCUDACXX_EXTERN_TEMPLATE(...)
1612
+ # endif
1613
+ #endif
1614
+
1615
+ #ifdef _LIBCUDACXX_DISABLE_EXTERN_TEMPLATE
1616
+ #define _LIBCUDACXX_EXTERN_TEMPLATE(...)
1617
+ #define _LIBCUDACXX_EXTERN_TEMPLATE2(...)
1618
+ #endif
1619
+
1620
+ #ifndef _LIBCUDACXX_EXTERN_TEMPLATE
1621
+ #define _LIBCUDACXX_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
1622
+ #endif
1623
+
1624
+ #ifndef _LIBCUDACXX_EXTERN_TEMPLATE2
1625
+ #define _LIBCUDACXX_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
1626
+ #endif
1627
+
1628
+ #if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCUDACXX_MSVCRT_LIKE) || \
1629
+ defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
1630
+ #define _LIBCUDACXX_LOCALE__L_EXTENSIONS 1
1631
+ #endif
1632
+
1633
+ #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
1634
+ // Most unix variants have catopen. These are the specific ones that don't.
1635
+ # if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION)
1636
+ # define _LIBCUDACXX_HAS_CATOPEN 1
1637
+ # endif
1638
+ #endif
1639
+
1640
+ #ifdef __FreeBSD__
1641
+ #define _DECLARE_C99_LDBL_MATH 1
1642
+ #endif
1643
+
1644
+ #if defined(_LIBCUDACXX_ABI_MICROSOFT) && !defined(_LIBCUDACXX_NO_VCRUNTIME)
1645
+ # define _LIBCUDACXX_DEFER_NEW_TO_VCRUNTIME
1646
+ #endif
1647
+
1648
+ // If we are getting operator new from the MSVC CRT, then allocation overloads
1649
+ // for align_val_t were added in 19.12, aka VS 2017 version 15.3.
1650
+ #if defined(_LIBCUDACXX_MSVCRT) && defined(_LIBCUDACXX_COMPILER_MSVC) && _MSC_VER < 1912
1651
+ # define _LIBCUDACXX_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
1652
+ #elif defined(_LIBCUDACXX_ABI_VCRUNTIME) && !defined(__cpp_aligned_new)
1653
+ // We're deferring to Microsoft's STL to provide aligned new et al. We don't
1654
+ // have it unless the language feature test macro is defined.
1655
+ # define _LIBCUDACXX_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
1656
+ #endif
1657
+
1658
+ #if defined(__APPLE__)
1659
+ # if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
1660
+ defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
1661
+ # define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
1662
+ # endif
1663
+ #endif // defined(__APPLE__)
1664
+
1665
+ #if !defined(_LIBCUDACXX_HAS_NO_ALIGNED_ALLOCATION) && \
1666
+ (defined(_LIBCUDACXX_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) || \
1667
+ (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606))
1668
+ # define _LIBCUDACXX_HAS_NO_ALIGNED_ALLOCATION
1669
+ #endif
1670
+
1671
+ #if defined(__APPLE__) || defined(__FreeBSD__)
1672
+ #define _LIBCUDACXX_HAS_DEFAULTRUNELOCALE
1673
+ #endif
1674
+
1675
+ #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
1676
+ #define _LIBCUDACXX_WCTYPE_IS_MASK
1677
+ #endif
1678
+
1679
+ #if _LIBCUDACXX_STD_VER <= 17 || !defined(__cpp_char8_t)
1680
+ #define _LIBCUDACXX_NO_HAS_CHAR8_T
1681
+ #endif
1682
+
1683
+ // Deprecation macros.
1684
+ //
1685
+ // Deprecations warnings are always enabled, except when users explicitly opt-out
1686
+ // by defining _LIBCUDACXX_DISABLE_DEPRECATION_WARNINGS.
1687
+ // NVCC 11.1 and 11.2 are broken with the deprecated attribute, so disable it
1688
+ #if !defined(_LIBCUDACXX_DISABLE_DEPRECATION_WARNINGS) \
1689
+ && !defined(_LIBCUDACXX_CUDACC_BELOW_11_3)
1690
+ # if __has_attribute(deprecated)
1691
+ # define _LIBCUDACXX_DEPRECATED __attribute__ ((deprecated))
1692
+ # elif _LIBCUDACXX_STD_VER > 11
1693
+ # define _LIBCUDACXX_DEPRECATED [[deprecated]]
1694
+ # else
1695
+ # define _LIBCUDACXX_DEPRECATED
1696
+ # endif
1697
+ #else
1698
+ # define _LIBCUDACXX_DEPRECATED
1699
+ #endif
1700
+
1701
+ #define _LIBCUDACXX_DEPRECATED_IN_CXX11 _LIBCUDACXX_DEPRECATED
1702
+
1703
+ #if _LIBCUDACXX_STD_VER >= 14
1704
+ # define _LIBCUDACXX_DEPRECATED_IN_CXX14 _LIBCUDACXX_DEPRECATED
1705
+ #else
1706
+ # define _LIBCUDACXX_DEPRECATED_IN_CXX14
1707
+ #endif
1708
+
1709
+ #if _LIBCUDACXX_STD_VER >= 17
1710
+ # define _LIBCUDACXX_DEPRECATED_IN_CXX17 _LIBCUDACXX_DEPRECATED
1711
+ #else
1712
+ # define _LIBCUDACXX_DEPRECATED_IN_CXX17
1713
+ #endif
1714
+
1715
+ #if _LIBCUDACXX_STD_VER <= 11
1716
+ # define _LIBCUDACXX_EXPLICIT_AFTER_CXX11
1717
+ #else
1718
+ # define _LIBCUDACXX_EXPLICIT_AFTER_CXX11 explicit
1719
+ #endif
1720
+
1721
+ #if _LIBCUDACXX_STD_VER > 11 && !defined(_LIBCUDACXX_HAS_NO_CXX14_CONSTEXPR)
1722
+ # define _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 constexpr
1723
+ #else
1724
+ # define _LIBCUDACXX_CONSTEXPR_AFTER_CXX11
1725
+ #endif
1726
+
1727
+ #if _LIBCUDACXX_STD_VER > 14 && !defined(_LIBCUDACXX_HAS_NO_CXX14_CONSTEXPR)
1728
+ # define _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 constexpr
1729
+ #else
1730
+ # define _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
1731
+ #endif
1732
+
1733
+ #if _LIBCUDACXX_STD_VER > 17 && !defined(_LIBCUDACXX_HAS_NO_CXX14_CONSTEXPR)
1734
+ # define _LIBCUDACXX_CONSTEXPR_AFTER_CXX17 constexpr
1735
+ #else
1736
+ # define _LIBCUDACXX_CONSTEXPR_AFTER_CXX17
1737
+ #endif
1738
+
1739
+ // Macros to enter and leave a state where deprecation warnings are suppressed.
1740
+ #if defined(_LIBCUDACXX_COMPILER_CLANG) || defined(_LIBCUDACXX_COMPILER_GCC)
1741
+ # define _LIBCUDACXX_SUPPRESS_DEPRECATED_PUSH \
1742
+ _Pragma("GCC diagnostic push") \
1743
+ _Pragma("GCC diagnostic ignored \"-Wdeprecated\"") \
1744
+ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
1745
+ # define _LIBCUDACXX_SUPPRESS_DEPRECATED_POP \
1746
+ _Pragma("GCC diagnostic pop")
1747
+ #else
1748
+ # define _LIBCUDACXX_SUPPRESS_DEPRECATED_PUSH
1749
+ # define _LIBCUDACXX_SUPPRESS_DEPRECATED_POP
1750
+ #endif
1751
+
1752
+ // The _LIBCUDACXX_NODISCARD_ATTRIBUTE should only be used to define other
1753
+ // NODISCARD macros to the correct attribute.
1754
+ #if __has_cpp_attribute(nodiscard) || (defined(_LIBCUDACXX_COMPILER_MSVC) && _LIBCUDACXX_STD_VER > 14)
1755
+ # define _LIBCUDACXX_NODISCARD_ATTRIBUTE [[nodiscard]]
1756
+ #elif defined(_LIBCUDACXX_COMPILER_CLANG)
1757
+ # define _LIBCUDACXX_NODISCARD_ATTRIBUTE [[clang::warn_unused_result]]
1758
+ #else
1759
+ // We can't use GCC's [[gnu::warn_unused_result]] and
1760
+ // __attribute__((warn_unused_result)), because GCC does not silence them via
1761
+ // (void) cast.
1762
+ # define _LIBCUDACXX_NODISCARD_ATTRIBUTE
1763
+ #endif
1764
+
1765
+ // NVCC below 11.3 does not support nodiscard on friend functions
1766
+ // It always fails with clang
1767
+ #if defined(_LIBCUDACXX_CUDACC_BELOW_11_3) \
1768
+ || defined(_LIBCUDACXX_COMPILER_CLANG)
1769
+ # define _LIBCUDACXX_NODISCARD_FRIEND friend
1770
+ #else // ^^^ _LIBCUDACXX_CUDACC_BELOW_11_3 ^^^ / vvv !_LIBCUDACXX_CUDACC_BELOW_11_3 vvv
1771
+ # define _LIBCUDACXX_NODISCARD_FRIEND _LIBCUDACXX_NODISCARD_ATTRIBUTE friend
1772
+ #endif // !_LIBCUDACXX_CUDACC_BELOW_11_3 && !_LIBCUDACXX_COMPILER_CLANG
1773
+
1774
+ // _LIBCUDACXX_NODISCARD_EXT may be used to apply [[nodiscard]] to entities not
1775
+ // specified as such as an extension.
1776
+ #if defined(_LIBCUDACXX_ENABLE_NODISCARD) && !defined(_LIBCUDACXX_DISABLE_NODISCARD_EXT)
1777
+ # define _LIBCUDACXX_NODISCARD_EXT _LIBCUDACXX_NODISCARD_ATTRIBUTE
1778
+ #else
1779
+ # define _LIBCUDACXX_NODISCARD_EXT
1780
+ #endif
1781
+
1782
+ #if !defined(_LIBCUDACXX_DISABLE_NODISCARD_AFTER_CXX17) && \
1783
+ (_LIBCUDACXX_STD_VER > 17 || defined(_LIBCUDACXX_ENABLE_NODISCARD))
1784
+ # define _LIBCUDACXX_NODISCARD_AFTER_CXX17 _LIBCUDACXX_NODISCARD_ATTRIBUTE
1785
+ #else
1786
+ # define _LIBCUDACXX_NODISCARD_AFTER_CXX17
1787
+ #endif
1788
+
1789
+ #if _LIBCUDACXX_STD_VER > 14 && defined(__cpp_inline_variables) && (__cpp_inline_variables >= 201606L)
1790
+ # define _LIBCUDACXX_INLINE_VAR inline
1791
+ #else
1792
+ # define _LIBCUDACXX_INLINE_VAR
1793
+ #endif
1794
+
1795
+ #ifdef _LIBCUDACXX_HAS_NO_RVALUE_REFERENCES
1796
+ # define _LIBCUDACXX_EXPLICIT_MOVE(x) _CUDA_VSTD::move(x)
1797
+ #else
1798
+ # define _LIBCUDACXX_EXPLICIT_MOVE(x) (x)
1799
+ #endif
1800
+
1801
+ #ifndef _LIBCUDACXX_CONSTEXPR_IF_NODEBUG
1802
+ #if defined(_LIBCUDACXX_DEBUG) || defined(_LIBCUDACXX_HAS_NO_CXX14_CONSTEXPR)
1803
+ #define _LIBCUDACXX_CONSTEXPR_IF_NODEBUG
1804
+ #else
1805
+ #define _LIBCUDACXX_CONSTEXPR_IF_NODEBUG _LIBCUDACXX_CONSTEXPR_AFTER_CXX11
1806
+ #endif
1807
+ #endif
1808
+
1809
+ #if __has_attribute(no_destroy)
1810
+ # define _LIBCUDACXX_NO_DESTROY __attribute__((__no_destroy__))
1811
+ #else
1812
+ # define _LIBCUDACXX_NO_DESTROY
1813
+ #endif
1814
+
1815
+ #ifndef _LIBCUDACXX_HAS_NO_ASAN
1816
+ extern "C" _LIBCUDACXX_FUNC_VIS void __sanitizer_annotate_contiguous_container(
1817
+ const void *, const void *, const void *, const void *);
1818
+ #endif
1819
+
1820
+ #ifndef _LIBCUDACXX_WEAK
1821
+ #define _LIBCUDACXX_WEAK __attribute__((__weak__))
1822
+ #endif
1823
+
1824
+ // Redefine some macros for internal use
1825
+ #if defined(__cuda_std__)
1826
+ # undef _LIBCUDACXX_FUNC_VIS
1827
+ # define _LIBCUDACXX_FUNC_VIS _LIBCUDACXX_INLINE_VISIBILITY
1828
+ # undef _LIBCUDACXX_TYPE_VIS
1829
+ # define _LIBCUDACXX_TYPE_VIS
1830
+ #endif // __cuda_std__
1831
+
1832
+ // Thread API
1833
+ #ifndef _LIBCUDACXX_HAS_THREAD_API_EXTERNAL
1834
+ #if defined(_LIBCUDACXX_COMPILER_NVRTC) \
1835
+ || defined(__EMSCRIPTEN__)
1836
+ # define _LIBCUDACXX_HAS_THREAD_API_EXTERNAL
1837
+ #endif
1838
+ #endif // _LIBCUDACXX_HAS_THREAD_API_EXTERNAL
1839
+
1840
+ #ifndef _LIBCUDACXX_HAS_THREAD_API_CUDA
1841
+ #if defined(__cuda_std__) \
1842
+ && (defined(__CUDA_ARCH__) || defined(__EMSCRIPTEN__))
1843
+ # define _LIBCUDACXX_HAS_THREAD_API_CUDA
1844
+ #endif // __cuda_std__
1845
+ #endif // _LIBCUDACXX_HAS_THREAD_API_CUDA
1846
+
1847
+ #ifndef _LIBCUDACXX_HAS_THREAD_API_WIN32
1848
+ #if defined(_LIBCUDACXX_COMPILER_MSVC) \
1849
+ && !defined(_LIBCUDACXX_HAS_THREAD_API_CUDA)
1850
+ # define _LIBCUDACXX_HAS_THREAD_API_WIN32
1851
+ #endif
1852
+ #endif // _LIBCUDACXX_HAS_THREAD_API_WIN32
1853
+
1854
+ #if !defined(_LIBCUDACXX_HAS_NO_THREADS) \
1855
+ && !defined(_LIBCUDACXX_HAS_THREAD_API_PTHREAD) \
1856
+ && !defined(_LIBCUDACXX_HAS_THREAD_API_WIN32) \
1857
+ && !defined(_LIBCUDACXX_HAS_THREAD_API_EXTERNAL)
1858
+ # if defined(__FreeBSD__) || \
1859
+ defined(__Fuchsia__) || \
1860
+ defined(__wasi__) || \
1861
+ defined(__NetBSD__) || \
1862
+ defined(__linux__) || \
1863
+ defined(__GNU__) || \
1864
+ defined(__APPLE__) || \
1865
+ defined(__CloudABI__) || \
1866
+ defined(__sun__) || \
1867
+ (defined(__MINGW32__) && __has_include(<pthread.h>))
1868
+ # define _LIBCUDACXX_HAS_THREAD_API_PTHREAD
1869
+ # elif defined(_LIBCUDACXX_WIN32API)
1870
+ # define _LIBCUDACXX_HAS_THREAD_API_WIN32
1871
+ # else
1872
+ # define _LIBCUDACXX_UNSUPPORTED_THREAD_API
1873
+ # endif // _LIBCUDACXX_HAS_THREAD_API
1874
+ #endif // _LIBCUDACXX_HAS_NO_THREADS
1875
+
1876
+ #if defined(_LIBCUDACXX_HAS_THREAD_API_PTHREAD)
1877
+ #if defined(__ANDROID__) && __ANDROID_API__ >= 30
1878
+ #define _LIBCUDACXX_HAS_COND_CLOCKWAIT
1879
+ #elif defined(_LIBCUDACXX_GLIBC_PREREQ)
1880
+ #if _LIBCUDACXX_GLIBC_PREREQ(2, 30)
1881
+ #define _LIBCUDACXX_HAS_COND_CLOCKWAIT
1882
+ #endif
1883
+ #endif
1884
+ #endif
1885
+
1886
+ #if defined(_LIBCUDACXX_HAS_NO_THREADS) && defined(_LIBCUDACXX_HAS_THREAD_API_PTHREAD)
1887
+ #error _LIBCUDACXX_HAS_THREAD_API_PTHREAD may only be defined when \
1888
+ _LIBCUDACXX_HAS_NO_THREADS is not defined.
1889
+ #endif
1890
+
1891
+ #if defined(_LIBCUDACXX_HAS_NO_THREADS) && defined(_LIBCUDACXX_HAS_THREAD_API_EXTERNAL)
1892
+ #error _LIBCUDACXX_HAS_THREAD_API_EXTERNAL may not be defined when \
1893
+ _LIBCUDACXX_HAS_NO_THREADS is defined.
1894
+ #endif
1895
+
1896
+ #if defined(__STDCPP_THREADS__) && defined(_LIBCUDACXX_HAS_NO_THREADS)
1897
+ #error _LIBCUDACXX_HAS_NO_THREADS cannot be set when __STDCPP_THREADS__ is set.
1898
+ #endif
1899
+
1900
+ #if !defined(_LIBCUDACXX_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__)
1901
+ #define __STDCPP_THREADS__ 1
1902
+ #endif
1903
+
1904
+ // The glibc and Bionic implementation of pthreads implements
1905
+ // pthread_mutex_destroy as nop for regular mutexes. Additionally, Win32
1906
+ // mutexes have no destroy mechanism.
1907
+ //
1908
+ // This optimization can't be performed on Apple platforms, where
1909
+ // pthread_mutex_destroy can allow the kernel to release resources.
1910
+ // See https://llvm.org/D64298 for details.
1911
+ //
1912
+ // TODO(EricWF): Enable this optimization on Bionic after speaking to their
1913
+ // respective stakeholders.
1914
+ #if (defined(_LIBCUDACXX_HAS_THREAD_API_PTHREAD) && defined(__GLIBC__)) \
1915
+ || defined(_LIBCUDACXX_HAS_THREAD_API_WIN32)
1916
+ # define _LIBCUDACXX_HAS_TRIVIAL_MUTEX_DESTRUCTION
1917
+ #endif
1918
+
1919
+ // Destroying a condvar is a nop on Windows.
1920
+ //
1921
+ // This optimization can't be performed on Apple platforms, where
1922
+ // pthread_cond_destroy can allow the kernel to release resources.
1923
+ // See https://llvm.org/D64298 for details.
1924
+ //
1925
+ // TODO(EricWF): This is potentially true for some pthread implementations
1926
+ // as well.
1927
+ #if defined(_LIBCUDACXX_HAS_THREAD_API_WIN32)
1928
+ # define _LIBCUDACXX_HAS_TRIVIAL_CONDVAR_DESTRUCTION
1929
+ #endif
1930
+
1931
+ // Systems that use capability-based security (FreeBSD with Capsicum,
1932
+ // Nuxi CloudABI) may only provide local filesystem access (using *at()).
1933
+ // Functions like open(), rename(), unlink() and stat() should not be
1934
+ // used, as they attempt to access the global filesystem namespace.
1935
+ #ifdef __CloudABI__
1936
+ #define _LIBCUDACXX_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
1937
+ #endif
1938
+
1939
+ // CloudABI is intended for running networked services. Processes do not
1940
+ // have standard input and output channels.
1941
+ #ifdef __CloudABI__
1942
+ #define _LIBCUDACXX_HAS_NO_STDIN
1943
+ #define _LIBCUDACXX_HAS_NO_STDOUT
1944
+ #endif
1945
+
1946
+ // Some systems do not provide gets() in their C library, for security reasons.
1947
+ #ifndef _LIBCUDACXX_C_HAS_NO_GETS
1948
+ # if defined(_LIBCUDACXX_MSVCRT) || (defined(__FreeBSD__) && __FreeBSD__ >= 13)
1949
+ # define _LIBCUDACXX_C_HAS_NO_GETS
1950
+ # endif
1951
+ #endif
1952
+
1953
+ #if defined(__BIONIC__) || defined(__CloudABI__) || \
1954
+ defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCUDACXX_HAS_MUSL_LIBC)
1955
+ #define _LIBCUDACXX_PROVIDES_DEFAULT_RUNE_TABLE
1956
+ #endif
1957
+
1958
+ // Thread-unsafe functions such as strtok() and localtime()
1959
+ // are not available.
1960
+ #ifdef __CloudABI__
1961
+ #define _LIBCUDACXX_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
1962
+ #endif
1963
+
1964
+ // TODO: Support C11 Atomics?
1965
+ // #if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic)
1966
+ // # define _LIBCUDACXX_HAS_C_ATOMIC_IMP
1967
+ #if defined(_LIBCUDACXX_COMPILER_ICC)
1968
+ # define _LIBCUDACXX_HAS_GCC_ATOMIC_IMP
1969
+ #elif defined(_LIBCUDACXX_COMPILER_CLANG)
1970
+ # define _LIBCUDACXX_HAS_GCC_ATOMIC_IMP
1971
+ #elif defined(_LIBCUDACXX_COMPILER_GCC)
1972
+ # define _LIBCUDACXX_HAS_GCC_ATOMIC_IMP
1973
+ #elif defined(_LIBCUDACXX_COMPILER_NVHPC)
1974
+ # define _LIBCUDACXX_HAS_GCC_ATOMIC_IMP
1975
+ #elif defined(_LIBCUDACXX_COMPILER_MSVC)
1976
+ # define _LIBCUDACXX_HAS_MSVC_ATOMIC_IMPL
1977
+ #endif
1978
+
1979
+ // CUDA Atomics supersede host atomics in order to insert the host/device dispatch layer
1980
+ #if defined(_LIBCUDACXX_COMPILER_NVCC) || defined(_LIBCUDACXX_COMPILER_NVRTC) || defined(_LIBCUDACXX_COMPILER_NVHPC) || defined(_LIBCUDACXX_CUDACC)
1981
+ # define _LIBCUDACXX_HAS_CUDA_ATOMIC_IMPL
1982
+ #endif
1983
+
1984
+ #if (!defined(_LIBCUDACXX_HAS_C_ATOMIC_IMP) && \
1985
+ !defined(_LIBCUDACXX_HAS_GCC_ATOMIC_IMP) && \
1986
+ !defined(_LIBCUDACXX_HAS_EXTERNAL_ATOMIC_IMP)) \
1987
+ || defined(_LIBCUDACXX_HAS_NO_THREADS)
1988
+ # define _LIBCUDACXX_HAS_NO_ATOMIC_HEADER
1989
+ #else
1990
+ # ifdef __cuda_std__
1991
+ # undef _LIBCUDACXX_ATOMIC_FLAG_TYPE
1992
+ # define _LIBCUDACXX_ATOMIC_FLAG_TYPE int
1993
+ # endif
1994
+ # ifndef _LIBCUDACXX_ATOMIC_FLAG_TYPE
1995
+ # define _LIBCUDACXX_ATOMIC_FLAG_TYPE bool
1996
+ # endif
1997
+ # ifdef _LIBCUDACXX_FREESTANDING
1998
+ # define _LIBCUDACXX_ATOMIC_ONLY_USE_BUILTINS
1999
+ # endif
2000
+ #endif
2001
+
2002
+ #ifndef _LIBCUDACXX_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
2003
+ #define _LIBCUDACXX_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
2004
+ #endif
2005
+
2006
+ #if defined(_LIBCUDACXX_ENABLE_THREAD_SAFETY_ANNOTATIONS)
2007
+ # if defined(_LIBCUDACXX_COMPILER_CLANG) && __has_attribute(acquire_capability)
2008
+ // Work around the attribute handling in clang. When both __declspec and
2009
+ // __attribute__ are present, the processing goes awry preventing the definition
2010
+ // of the types.
2011
+ # if !defined(_LIBCUDACXX_OBJECT_FORMAT_COFF)
2012
+ # define _LIBCUDACXX_HAS_THREAD_SAFETY_ANNOTATIONS
2013
+ # endif
2014
+ # endif
2015
+ #endif
2016
+
2017
+ #if __has_attribute(require_constant_initialization)
2018
+ # define _LIBCUDACXX_SAFE_STATIC __attribute__((__require_constant_initialization__))
2019
+ #else
2020
+ # define _LIBCUDACXX_SAFE_STATIC
2021
+ #endif
2022
+
2023
+ #if !defined(_LIBCUDACXX_HAS_NO_OFF_T_FUNCTIONS)
2024
+ # if defined(_LIBCUDACXX_MSVCRT) || defined(_NEWLIB_VERSION)
2025
+ # define _LIBCUDACXX_HAS_NO_OFF_T_FUNCTIONS
2026
+ # endif
2027
+ #endif
2028
+
2029
+ #if __has_attribute(diagnose_if) && !defined(_LIBCUDACXX_DISABLE_ADDITIONAL_DIAGNOSTICS)
2030
+ # define _LIBCUDACXX_DIAGNOSE_WARNING(...) \
2031
+ __attribute__((diagnose_if(__VA_ARGS__, "warning")))
2032
+ # define _LIBCUDACXX_DIAGNOSE_ERROR(...) \
2033
+ __attribute__((diagnose_if(__VA_ARGS__, "error")))
2034
+ #else
2035
+ # define _LIBCUDACXX_DIAGNOSE_WARNING(...)
2036
+ # define _LIBCUDACXX_DIAGNOSE_ERROR(...)
2037
+ #endif
2038
+
2039
+ // Use a function like macro to imply that it must be followed by a semicolon
2040
+ #if __cplusplus > 201402L && __has_cpp_attribute(fallthrough)
2041
+ # define _LIBCUDACXX_FALLTHROUGH() [[fallthrough]]
2042
+ #elif defined(_LIBCUDACXX_COMPILER_NVRTC)
2043
+ # define _LIBCUDACXX_FALLTHROUGH() ((void)0)
2044
+ #elif __has_cpp_attribute(clang::fallthrough)
2045
+ # define _LIBCUDACXX_FALLTHROUGH() [[clang::fallthrough]]
2046
+ #elif defined(_LIBCUDACXX_COMPILER_NVHPC)
2047
+ # define _LIBCUDACXX_FALLTHROUGH()
2048
+ #elif __has_attribute(fallthough) || _GNUC_VER >= 700
2049
+ # define _LIBCUDACXX_FALLTHROUGH() __attribute__((__fallthrough__))
2050
+ #else
2051
+ # define _LIBCUDACXX_FALLTHROUGH() ((void)0)
2052
+ #endif
2053
+
2054
+ #if __has_attribute(__nodebug__)
2055
+ #define _LIBCUDACXX_NODEBUG __attribute__((__nodebug__))
2056
+ #else
2057
+ #define _LIBCUDACXX_NODEBUG
2058
+ #endif
2059
+
2060
+ # if __has_attribute(__preferred_name__)
2061
+ # define _LIBCUDACXX_PREFERRED_NAME(x) __attribute__((__preferred_name__(x)))
2062
+ # else
2063
+ # define _LIBCUDACXX_PREFERRED_NAME(x)
2064
+ # endif
2065
+
2066
+ #if defined(_LIBCUDACXX_ABI_MICROSOFT) && \
2067
+ (defined(_LIBCUDACXX_COMPILER_MSVC) || __has_declspec_attribute(empty_bases))
2068
+ # define _LIBCUDACXX_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
2069
+ #else
2070
+ # define _LIBCUDACXX_DECLSPEC_EMPTY_BASES
2071
+ #endif
2072
+
2073
+ #if defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_FEATURES)
2074
+ #define _LIBCUDACXX_ENABLE_CXX17_REMOVED_AUTO_PTR
2075
+ #define _LIBCUDACXX_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
2076
+ #define _LIBCUDACXX_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
2077
+ #define _LIBCUDACXX_ENABLE_CXX17_REMOVED_BINDERS
2078
+ #endif // _LIBCUDACXX_ENABLE_CXX17_REMOVED_FEATURES
2079
+
2080
+ #if !defined(__cpp_deduction_guides) || __cpp_deduction_guides < 201611
2081
+ #define _LIBCUDACXX_HAS_NO_DEDUCTION_GUIDES
2082
+ #endif
2083
+
2084
+ #if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L
2085
+ #define _LIBCUDACXX_HAS_NO_COROUTINES
2086
+ #endif
2087
+
2088
+ // We need `is_constant_evaluated` for clang and gcc. MSVC also needs extensive rework
2089
+ #if !defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED)
2090
+ #define _LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS
2091
+ #elif defined(__CUDACC_RTC__)
2092
+ #define _LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS
2093
+ #elif defined(_MSC_VER)
2094
+ #define _LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS
2095
+ #elif defined(_LIBCUDACXX_CUDACC_BELOW_11_8)
2096
+ #define _LIBCUDACXX_HAS_NO_CONSTEXPR_COMPLEX_OPERATIONS
2097
+ #endif
2098
+
2099
+ // FIXME: Correct this macro when either (A) a feature test macro for the
2100
+ // spaceship operator is provided, or (B) a compiler provides a complete
2101
+ // implementation.
2102
+ #define _LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR
2103
+
2104
+ #define _LIBCUDACXX_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
2105
+
2106
+ // The stream API was dropped and re-added in the dylib shipped on macOS
2107
+ // and iOS. We can only assume the dylib to provide these definitions for
2108
+ // macosx >= 10.9 and ios >= 7.0. Otherwise, the definitions are available
2109
+ // from the headers, but not from the dylib. Explicit instantiation
2110
+ // declarations for streams exist conditionally to this; if we provide
2111
+ // an explicit instantiation declaration and we try to deploy to a dylib
2112
+ // that does not provide those symbols, we'll get a load-time error.
2113
+ #if !defined(_LIBCUDACXX_BUILDING_LIBRARY) && \
2114
+ ((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
2115
+ __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1090) || \
2116
+ (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \
2117
+ __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000))
2118
+ # define _LIBCUDACXX_DO_NOT_ASSUME_STREAMS_EXPLICIT_INSTANTIATION_IN_DYLIB
2119
+ #endif
2120
+
2121
+ #if defined(_LIBCUDACXX_HAS_NO_PRAGMA_PUSH_POP_MACRO)
2122
+ # define _LIBCUDACXX_PUSH_MACROS
2123
+ # define _LIBCUDACXX_POP_MACROS
2124
+ #else
2125
+ // Don't warn about macro conflicts when we can restore them at the
2126
+ // end of the header.
2127
+ # ifndef _LIBCUDACXX_DISABLE_MACRO_CONFLICT_WARNINGS
2128
+ # define _LIBCUDACXX_DISABLE_MACRO_CONFLICT_WARNINGS
2129
+ # endif
2130
+ # if defined(_LIBCUDACXX_COMPILER_MSVC)
2131
+ # define _LIBCUDACXX_PUSH_MACROS \
2132
+ __pragma(push_macro("min")) \
2133
+ __pragma(push_macro("max"))
2134
+ # define _LIBCUDACXX_POP_MACROS \
2135
+ __pragma(pop_macro("min")) \
2136
+ __pragma(pop_macro("max"))
2137
+ # else
2138
+ # define _LIBCUDACXX_PUSH_MACROS \
2139
+ _Pragma("push_macro(\"min\")") \
2140
+ _Pragma("push_macro(\"max\")")
2141
+ # define _LIBCUDACXX_POP_MACROS \
2142
+ _Pragma("pop_macro(\"min\")") \
2143
+ _Pragma("pop_macro(\"max\")")
2144
+ # endif
2145
+ #endif // defined(_LIBCUDACXX_HAS_NO_PRAGMA_PUSH_POP_MACRO)
2146
+
2147
+ #if !defined(_LIBCUDACXX_NO_AUTO_LINK) && !defined(__cuda_std__)
2148
+ # if defined(_LIBCUDACXX_ABI_MICROSOFT) && !defined(_LIBCUDACXX_BUILDING_LIBRARY)
2149
+ # if defined(_DLL)
2150
+ # pragma comment(lib, "c++.lib")
2151
+ # else
2152
+ # pragma comment(lib, "libc++.lib")
2153
+ # endif
2154
+ # endif // defined(_LIBCUDACXX_ABI_MICROSOFT) && !defined(_LIBCUDACXX_BUILDING_LIBRARY)
2155
+ #endif // !defined(_LIBCUDACXX_NO_AUTO_LINK)
2156
+
2157
+ #define _LIBCUDACXX_UNUSED_VAR(x) ((void)(x))
2158
+
2159
+ // Configures the fopen close-on-exec mode character, if any. This string will
2160
+ // be appended to any mode string used by fstream for fopen/fdopen.
2161
+ //
2162
+ // Not all platforms support this, but it helps avoid fd-leaks on platforms that
2163
+ // do.
2164
+ #if defined(__BIONIC__)
2165
+ # define _LIBCUDACXX_FOPEN_CLOEXEC_MODE "e"
2166
+ #else
2167
+ # define _LIBCUDACXX_FOPEN_CLOEXEC_MODE
2168
+ #endif
2169
+
2170
+ # if __has_attribute(__format__)
2171
+ // The attribute uses 1-based indices for ordinary and static member functions.
2172
+ // The attribute uses 2-based indices for non-static member functions.
2173
+ # define _LIBCUDACXX_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) \
2174
+ __attribute__((__format__(archetype, format_string_index, first_format_arg_index)))
2175
+ # else
2176
+ # define _LIBCUDACXX_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) /* nothing */
2177
+ # endif
2178
+
2179
+ #ifndef _LIBCUDACXX_SYS_CLOCK_DURATION
2180
+ #if defined(__cuda_std__)
2181
+ # define _LIBCUDACXX_SYS_CLOCK_DURATION nanoseconds
2182
+ #else
2183
+ # define _LIBCUDACXX_SYS_CLOCK_DURATION microseconds
2184
+ #endif
2185
+ #endif // _LIBCUDACXX_SYS_CLOCK_DURATION
2186
+
2187
+ // There are a handful of public standard library types that are intended to
2188
+ // support CTAD but don't need any explicit deduction guides to do so. This
2189
+ // macro is used to mark them as such, which suppresses the
2190
+ // '-Wctad-maybe-unsupported' compiler warning when CTAD is used in user code
2191
+ // with these classes.
2192
+ #if (!defined(_LIBCUDACXX_COMPILER_GCC) || __GNUC__ > 6) \
2193
+ && _LIBCUDACXX_STD_VER >= 17
2194
+ # define _LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(_ClassName) \
2195
+ template <class ..._Tag> \
2196
+ _ClassName(typename _Tag::__allow_ctad...) -> _ClassName<_Tag...>
2197
+ #else
2198
+ # define _LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(_ClassName) static_assert(true, "")
2199
+ #endif
2200
+
2201
+ #if (defined(__CUDACC_VER_MAJOR__) && __CUDACC_VER_MAJOR__ <= 11) \
2202
+ && (defined(__CUDACC_VER_MINOR__) && __CUDACC_VER_MINOR__ <= 2)
2203
+ # define _LIBCUDACXX_CONSTEXPR_GLOBAL const
2204
+ #else
2205
+ # define _LIBCUDACXX_CONSTEXPR_GLOBAL constexpr
2206
+ #endif
2207
+
2208
+ #if defined(__CUDA_ARCH__)
2209
+ # define _LIBCUDACXX_CPO_ACCESSIBILITY _LIBCUDACXX_DEVICE _LIBCUDACXX_CONSTEXPR_GLOBAL
2210
+ #else
2211
+ # define _LIBCUDACXX_CPO_ACCESSIBILITY _LIBCUDACXX_INLINE_VAR constexpr
2212
+ #endif
2213
+
2214
+ #if _LIBCUDACXX_STD_VER > 14
2215
+ # define _LIBCUDACXX_TRAIT(__TRAIT, ...) __TRAIT##_v<__VA_ARGS__>
2216
+ #else
2217
+ # define _LIBCUDACXX_TRAIT(__TRAIT, ...) __TRAIT<__VA_ARGS__>::value
2218
+ #endif
2219
+
2220
+ // Older nvcc do not handle the constraint of `construct_at` in earlier std modes
2221
+ // So to preserve our performance optimization we default to the unconstrained
2222
+ // `__construct_at` and only in C++20 use `construct_at`
2223
+ #if _LIBCUDACXX_STD_VER > 17
2224
+ # define _LIBCUDACXX_CONSTRUCT_AT(_LOCATION, ...) \
2225
+ _CUDA_VSTD::construct_at(_CUDA_VSTD::addressof(_LOCATION), __VA_ARGS__)
2226
+ #else
2227
+ # define _LIBCUDACXX_CONSTRUCT_AT(_LOCATION, ...) \
2228
+ _CUDA_VSTD::__construct_at(_CUDA_VSTD::addressof(_LOCATION), __VA_ARGS__)
2229
+ #endif
2230
+
2231
+ #if !defined(_LIBCUDACXX_DISABLE_EXEC_CHECK)
2232
+ #if defined(_LIBCUDACXX_CUDACC) \
2233
+ && !defined(_LIBCUDACXX_COMPILER_NVRTC) \
2234
+ && !defined(_LIBCUDACXX_COMPILER_NVHPC_CUDA) \
2235
+ && !defined(_LIBCUDACXX_COMPILER_CLANG_CUDA)
2236
+ # if defined(_LIBCUDACXX_COMPILER_MSVC)
2237
+ # define _LIBCUDACXX_DISABLE_EXEC_CHECK __pragma("nv_exec_check_disable")
2238
+ # else // ^^^ _LIBCUDACXX_COMPILER_MSVC ^^^ / vvv !_LIBCUDACXX_COMPILER_MSVC vvv
2239
+ # define _LIBCUDACXX_DISABLE_EXEC_CHECK _Pragma("nv_exec_check_disable")
2240
+ # endif // !_LIBCUDACXX_COMPILER_MSVC
2241
+ #else // ^^^ !NVRTC && !NVHPC-cuda && !clang-cuda ^^^ / vvv NVRTC || NVHPC-cuda || clang-cuda vvv
2242
+ # define _LIBCUDACXX_DISABLE_EXEC_CHECK
2243
+ #endif // NVRTC || NVHPC-cuda || clang-cuda
2244
+ #endif // !_LIBCUDACXX_DISABLE_EXEC_CHECK
2245
+
2246
+ #define _LIBCUDACXX_HAS_NO_INCOMPLETE_RANGES
2247
+
2248
+ #endif // __cplusplus
2249
+
2250
+ #endif // _LIBCUDACXX_CONFIG
cuda_toolkit/include/__config_site.in ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ //===----------------------------------------------------------------------===//
8
+
9
+ #ifndef _LIBCUDACXX_CONFIG_SITE
10
+ #define _LIBCUDACXX_CONFIG_SITE
11
+
12
+ #cmakedefine _LIBCUDACXX_ABI_VERSION @_LIBCUDACXX_ABI_VERSION@
13
+ #cmakedefine _LIBCUDACXX_ABI_UNSTABLE
14
+ #cmakedefine _LIBCUDACXX_ABI_FORCE_ITANIUM
15
+ #cmakedefine _LIBCUDACXX_ABI_FORCE_MICROSOFT
16
+ #cmakedefine _LIBCUDACXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT
17
+ #cmakedefine _LIBCUDACXX_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
18
+ #cmakedefine _LIBCUDACXX_HAS_NO_STDIN
19
+ #cmakedefine _LIBCUDACXX_HAS_NO_STDOUT
20
+ #cmakedefine _LIBCUDACXX_HAS_NO_THREADS
21
+ #cmakedefine _LIBCUDACXX_HAS_NO_MONOTONIC_CLOCK
22
+ #cmakedefine _LIBCUDACXX_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
23
+ #cmakedefine _LIBCUDACXX_HAS_MUSL_LIBC
24
+ #cmakedefine _LIBCUDACXX_HAS_THREAD_API_PTHREAD
25
+ #cmakedefine _LIBCUDACXX_HAS_THREAD_API_EXTERNAL
26
+ #cmakedefine _LIBCUDACXX_HAS_THREAD_API_WIN32
27
+ #cmakedefine _LIBCUDACXX_HAS_THREAD_LIBRARY_EXTERNAL
28
+ #cmakedefine _LIBCUDACXX_DISABLE_VISIBILITY_ANNOTATIONS
29
+ #cmakedefine _LIBCUDACXX_NO_VCRUNTIME
30
+ #cmakedefine01 _LIBCUDACXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT
31
+ #cmakedefine _LIBCUDACXX_ABI_NAMESPACE @_LIBCUDACXX_ABI_NAMESPACE@
32
+ #cmakedefine _LIBCUDACXX_HAS_PARALLEL_ALGORITHMS
33
+
34
+ @_LIBCUDACXX_ABI_DEFINES@
35
+
36
+ #endif // _LIBCUDACXX_CONFIG_SITE
cuda_toolkit/include/__debug ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
8
+ //
9
+ //===----------------------------------------------------------------------===//
10
+
11
+ #ifndef _LIBCUDACXX___DEBUG
12
+ #define _LIBCUDACXX___DEBUG
13
+
14
+ #ifndef __cuda_std__
15
+ #include <__config>
16
+ #endif //__cuda_std__
17
+
18
+ #include "__assert"
19
+ #include "__type_traits/is_constant_evaluated.h"
20
+ #include "cstddef"
21
+
22
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
23
+ # pragma GCC system_header
24
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
25
+ # pragma clang system_header
26
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
27
+ # pragma system_header
28
+ #endif // no system header
29
+
30
+ #if defined(_LIBCUDACXX_ENABLE_DEBUG_MODE) && !defined(_LIBCUDACXX_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY)
31
+ # define _LIBCUDACXX_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
32
+ #endif
33
+
34
+ #if defined(_LIBCUDACXX_ENABLE_DEBUG_MODE) && !defined(_LIBCUDACXX_DEBUG_ITERATOR_BOUNDS_CHECKING)
35
+ # define _LIBCUDACXX_DEBUG_ITERATOR_BOUNDS_CHECKING
36
+ #endif
37
+
38
+ #ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE
39
+ # define _LIBCUDACXX_DEBUG_ASSERT(x, m) _LIBCUDACXX_ASSERT(::std::__libcpp_is_constant_evaluated() || (x), m)
40
+ #else
41
+ # define _LIBCUDACXX_DEBUG_ASSERT(x, m) ((void)0)
42
+ #endif
43
+
44
+ #if defined(_LIBCUDACXX_ENABLE_DEBUG_MODE) || defined(_LIBCUDACXX_BUILDING_LIBRARY)
45
+
46
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
47
+
48
+ struct _LIBCUDACXX_TYPE_VIS __c_node;
49
+
50
+ struct _LIBCUDACXX_TYPE_VIS __i_node
51
+ {
52
+ void* __i_;
53
+ __i_node* __next_;
54
+ __c_node* __c_;
55
+
56
+ __i_node(const __i_node&) = delete;
57
+ __i_node& operator=(const __i_node&) = delete;
58
+
59
+ _LIBCUDACXX_INLINE_VISIBILITY
60
+ __i_node(void* __i, __i_node* __next, __c_node* __c)
61
+ : __i_(__i), __next_(__next), __c_(__c) {}
62
+ ~__i_node();
63
+ };
64
+
65
+ struct _LIBCUDACXX_TYPE_VIS __c_node
66
+ {
67
+ void* __c_;
68
+ __c_node* __next_;
69
+ __i_node** beg_;
70
+ __i_node** end_;
71
+ __i_node** cap_;
72
+
73
+ __c_node(const __c_node&) = delete;
74
+ __c_node& operator=(const __c_node&) = delete;
75
+
76
+ _LIBCUDACXX_INLINE_VISIBILITY
77
+ explicit __c_node(void* __c, __c_node* __next)
78
+ : __c_(__c), __next_(__next), beg_(nullptr), end_(nullptr), cap_(nullptr) {}
79
+ virtual ~__c_node();
80
+
81
+ virtual bool __dereferenceable(const void*) const = 0;
82
+ virtual bool __decrementable(const void*) const = 0;
83
+ virtual bool __addable(const void*, ptrdiff_t) const = 0;
84
+ virtual bool __subscriptable(const void*, ptrdiff_t) const = 0;
85
+
86
+ void __add(__i_node* __i);
87
+ _LIBCUDACXX_HIDDEN void __remove(__i_node* __i);
88
+ };
89
+
90
+ template <class _Cont>
91
+ struct _C_node
92
+ : public __c_node
93
+ {
94
+ explicit _C_node(void* __c, __c_node* __n)
95
+ : __c_node(__c, __n) {}
96
+
97
+ bool __dereferenceable(const void*) const override;
98
+ bool __decrementable(const void*) const override;
99
+ bool __addable(const void*, ptrdiff_t) const override;
100
+ bool __subscriptable(const void*, ptrdiff_t) const override;
101
+ };
102
+
103
+ template <class _Cont>
104
+ inline bool
105
+ _C_node<_Cont>::__dereferenceable(const void* __i) const
106
+ {
107
+ typedef typename _Cont::const_iterator iterator;
108
+ const iterator* __j = static_cast<const iterator*>(__i);
109
+ _Cont* _Cp = static_cast<_Cont*>(__c_);
110
+ return _Cp->__dereferenceable(__j);
111
+ }
112
+
113
+ template <class _Cont>
114
+ inline bool
115
+ _C_node<_Cont>::__decrementable(const void* __i) const
116
+ {
117
+ typedef typename _Cont::const_iterator iterator;
118
+ const iterator* __j = static_cast<const iterator*>(__i);
119
+ _Cont* _Cp = static_cast<_Cont*>(__c_);
120
+ return _Cp->__decrementable(__j);
121
+ }
122
+
123
+ template <class _Cont>
124
+ inline bool
125
+ _C_node<_Cont>::__addable(const void* __i, ptrdiff_t __n) const
126
+ {
127
+ typedef typename _Cont::const_iterator iterator;
128
+ const iterator* __j = static_cast<const iterator*>(__i);
129
+ _Cont* _Cp = static_cast<_Cont*>(__c_);
130
+ return _Cp->__addable(__j, __n);
131
+ }
132
+
133
+ template <class _Cont>
134
+ inline bool
135
+ _C_node<_Cont>::__subscriptable(const void* __i, ptrdiff_t __n) const
136
+ {
137
+ typedef typename _Cont::const_iterator iterator;
138
+ const iterator* __j = static_cast<const iterator*>(__i);
139
+ _Cont* _Cp = static_cast<_Cont*>(__c_);
140
+ return _Cp->__subscriptable(__j, __n);
141
+ }
142
+
143
+ class _LIBCUDACXX_TYPE_VIS __libcpp_db
144
+ {
145
+ __c_node** __cbeg_;
146
+ __c_node** __cend_;
147
+ size_t __csz_;
148
+ __i_node** __ibeg_;
149
+ __i_node** __iend_;
150
+ size_t __isz_;
151
+
152
+ explicit __libcpp_db();
153
+ public:
154
+ __libcpp_db(const __libcpp_db&) = delete;
155
+ __libcpp_db& operator=(const __libcpp_db&) = delete;
156
+
157
+ ~__libcpp_db();
158
+
159
+ class __db_c_iterator;
160
+ class __db_c_const_iterator;
161
+ class __db_i_iterator;
162
+ class __db_i_const_iterator;
163
+
164
+ __db_c_const_iterator __c_end() const;
165
+ __db_i_const_iterator __i_end() const;
166
+
167
+ typedef __c_node*(_InsertConstruct)(void*, void*, __c_node*);
168
+
169
+ template <class _Cont>
170
+ _LIBCUDACXX_INLINE_VISIBILITY static __c_node* __create_C_node(void *__mem, void *__c, __c_node *__next) {
171
+ return ::new (__mem) _C_node<_Cont>(__c, __next);
172
+ }
173
+
174
+ template <class _Cont>
175
+ _LIBCUDACXX_INLINE_VISIBILITY
176
+ void __insert_c(_Cont* __c)
177
+ {
178
+ __insert_c(static_cast<void*>(__c), &__create_C_node<_Cont>);
179
+ }
180
+
181
+ void __insert_i(void* __i);
182
+ void __insert_c(void* __c, _InsertConstruct* __fn);
183
+ void __erase_c(void* __c);
184
+
185
+ void __insert_ic(void* __i, const void* __c);
186
+ void __iterator_copy(void* __i, const void* __i0);
187
+ void __erase_i(void* __i);
188
+
189
+ void* __find_c_from_i(void* __i) const;
190
+ void __invalidate_all(void* __c);
191
+ __c_node* __find_c_and_lock(void* __c) const;
192
+ __c_node* __find_c(void* __c) const;
193
+ void unlock() const;
194
+
195
+ void swap(void* __c1, void* __c2);
196
+
197
+
198
+ bool __dereferenceable(const void* __i) const;
199
+ bool __decrementable(const void* __i) const;
200
+ bool __addable(const void* __i, ptrdiff_t __n) const;
201
+ bool __subscriptable(const void* __i, ptrdiff_t __n) const;
202
+ bool __less_than_comparable(const void* __i, const void* __j) const;
203
+ private:
204
+ _LIBCUDACXX_HIDDEN
205
+ __i_node* __insert_iterator(void* __i);
206
+ _LIBCUDACXX_HIDDEN
207
+ __i_node* __find_iterator(const void* __i) const;
208
+
209
+ friend _LIBCUDACXX_FUNC_VIS __libcpp_db* __get_db();
210
+ };
211
+
212
+ _LIBCUDACXX_FUNC_VIS __libcpp_db* __get_db();
213
+ _LIBCUDACXX_FUNC_VIS const __libcpp_db* __get_const_db();
214
+
215
+ _LIBCUDACXX_END_NAMESPACE_STD
216
+
217
+ #endif // defined(_LIBCUDACXX_ENABLE_DEBUG_MODE) || defined(_LIBCUDACXX_BUILDING_LIBRARY)
218
+
219
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
220
+
221
+ template <class _Tp>
222
+ _LIBCUDACXX_INLINE_VISIBILITY
223
+ _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 inline void __debug_db_insert_c(_Tp* __c) {
224
+ #ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE
225
+ if (!__libcpp_is_constant_evaluated())
226
+ __get_db()->__insert_c(__c);
227
+ #else
228
+ (void)(__c);
229
+ #endif
230
+ }
231
+
232
+ template <class _Tp>
233
+ _LIBCUDACXX_INLINE_VISIBILITY
234
+ _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 inline void __debug_db_insert_i(_Tp* __i) {
235
+ #ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE
236
+ if (!__libcpp_is_constant_evaluated())
237
+ __get_db()->__insert_i(__i);
238
+ #else
239
+ (void)(__i);
240
+ #endif
241
+ }
242
+
243
+ template <class _Tp>
244
+ _LIBCUDACXX_INLINE_VISIBILITY
245
+ _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 inline void __debug_db_erase_c(_Tp* __c) {
246
+ #ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE
247
+ if (!__libcpp_is_constant_evaluated())
248
+ __get_db()->__erase_c(__c);
249
+ #else
250
+ (void)(__c);
251
+ #endif
252
+ }
253
+
254
+ template <class _Tp>
255
+ _LIBCUDACXX_INLINE_VISIBILITY
256
+ _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 inline void __debug_db_swap(_Tp* __lhs, _Tp* __rhs) {
257
+ #ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE
258
+ if (!__libcpp_is_constant_evaluated())
259
+ __get_db()->swap(__lhs, __rhs);
260
+ #else
261
+ (void)(__lhs);
262
+ (void)(__rhs);
263
+ #endif
264
+ }
265
+
266
+ template <class _Tp>
267
+ _LIBCUDACXX_INLINE_VISIBILITY
268
+ _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 inline void __debug_db_invalidate_all(_Tp* __c) {
269
+ #ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE
270
+ if (!__libcpp_is_constant_evaluated())
271
+ __get_db()->__invalidate_all(__c);
272
+ #else
273
+ (void)(__c);
274
+ #endif
275
+ }
276
+
277
+ _LIBCUDACXX_END_NAMESPACE_STD
278
+
279
+ #endif // _LIBCUDACXX___DEBUG
cuda_toolkit/include/__errc ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===---------------------------- __errc ----------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___ERRC
11
+ #define _LIBCUDACXX___ERRC
12
+
13
+ /*
14
+ system_error synopsis
15
+
16
+ namespace std
17
+ {
18
+
19
+ enum class errc
20
+ {
21
+ address_family_not_supported, // EAFNOSUPPORT
22
+ address_in_use, // EADDRINUSE
23
+ address_not_available, // EADDRNOTAVAIL
24
+ already_connected, // EISCONN
25
+ argument_list_too_long, // E2BIG
26
+ argument_out_of_domain, // EDOM
27
+ bad_address, // EFAULT
28
+ bad_file_descriptor, // EBADF
29
+ bad_message, // EBADMSG
30
+ broken_pipe, // EPIPE
31
+ connection_aborted, // ECONNABORTED
32
+ connection_already_in_progress, // EALREADY
33
+ connection_refused, // ECONNREFUSED
34
+ connection_reset, // ECONNRESET
35
+ cross_device_link, // EXDEV
36
+ destination_address_required, // EDESTADDRREQ
37
+ device_or_resource_busy, // EBUSY
38
+ directory_not_empty, // ENOTEMPTY
39
+ executable_format_error, // ENOEXEC
40
+ file_exists, // EEXIST
41
+ file_too_large, // EFBIG
42
+ filename_too_long, // ENAMETOOLONG
43
+ function_not_supported, // ENOSYS
44
+ host_unreachable, // EHOSTUNREACH
45
+ identifier_removed, // EIDRM
46
+ illegal_byte_sequence, // EILSEQ
47
+ inappropriate_io_control_operation, // ENOTTY
48
+ interrupted, // EINTR
49
+ invalid_argument, // EINVAL
50
+ invalid_seek, // ESPIPE
51
+ io_error, // EIO
52
+ is_a_directory, // EISDIR
53
+ message_size, // EMSGSIZE
54
+ network_down, // ENETDOWN
55
+ network_reset, // ENETRESET
56
+ network_unreachable, // ENETUNREACH
57
+ no_buffer_space, // ENOBUFS
58
+ no_child_process, // ECHILD
59
+ no_link, // ENOLINK
60
+ no_lock_available, // ENOLCK
61
+ no_message_available, // ENODATA
62
+ no_message, // ENOMSG
63
+ no_protocol_option, // ENOPROTOOPT
64
+ no_space_on_device, // ENOSPC
65
+ no_stream_resources, // ENOSR
66
+ no_such_device_or_address, // ENXIO
67
+ no_such_device, // ENODEV
68
+ no_such_file_or_directory, // ENOENT
69
+ no_such_process, // ESRCH
70
+ not_a_directory, // ENOTDIR
71
+ not_a_socket, // ENOTSOCK
72
+ not_a_stream, // ENOSTR
73
+ not_connected, // ENOTCONN
74
+ not_enough_memory, // ENOMEM
75
+ not_supported, // ENOTSUP
76
+ operation_canceled, // ECANCELED
77
+ operation_in_progress, // EINPROGRESS
78
+ operation_not_permitted, // EPERM
79
+ operation_not_supported, // EOPNOTSUPP
80
+ operation_would_block, // EWOULDBLOCK
81
+ owner_dead, // EOWNERDEAD
82
+ permission_denied, // EACCES
83
+ protocol_error, // EPROTO
84
+ protocol_not_supported, // EPROTONOSUPPORT
85
+ read_only_file_system, // EROFS
86
+ resource_deadlock_would_occur, // EDEADLK
87
+ resource_unavailable_try_again, // EAGAIN
88
+ result_out_of_range, // ERANGE
89
+ state_not_recoverable, // ENOTRECOVERABLE
90
+ stream_timeout, // ETIME
91
+ text_file_busy, // ETXTBSY
92
+ timed_out, // ETIMEDOUT
93
+ too_many_files_open_in_system, // ENFILE
94
+ too_many_files_open, // EMFILE
95
+ too_many_links, // EMLINK
96
+ too_many_symbolic_link_levels, // ELOOP
97
+ value_too_large, // EOVERFLOW
98
+ wrong_protocol_type // EPROTOTYPE
99
+ };
100
+
101
+ */
102
+
103
+ #include <__config>
104
+ #include <cerrno>
105
+
106
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
107
+ # pragma GCC system_header
108
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
109
+ # pragma clang system_header
110
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
111
+ # pragma system_header
112
+ #endif // no system header
113
+
114
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
115
+
116
+ // Some error codes are not present on all platforms, so we provide equivalents
117
+ // for them:
118
+
119
+ //enum class errc
120
+ _LIBCUDACXX_DECLARE_STRONG_ENUM(errc)
121
+ {
122
+ address_family_not_supported = EAFNOSUPPORT,
123
+ address_in_use = EADDRINUSE,
124
+ address_not_available = EADDRNOTAVAIL,
125
+ already_connected = EISCONN,
126
+ argument_list_too_long = E2BIG,
127
+ argument_out_of_domain = EDOM,
128
+ bad_address = EFAULT,
129
+ bad_file_descriptor = EBADF,
130
+ bad_message = EBADMSG,
131
+ broken_pipe = EPIPE,
132
+ connection_aborted = ECONNABORTED,
133
+ connection_already_in_progress = EALREADY,
134
+ connection_refused = ECONNREFUSED,
135
+ connection_reset = ECONNRESET,
136
+ cross_device_link = EXDEV,
137
+ destination_address_required = EDESTADDRREQ,
138
+ device_or_resource_busy = EBUSY,
139
+ directory_not_empty = ENOTEMPTY,
140
+ executable_format_error = ENOEXEC,
141
+ file_exists = EEXIST,
142
+ file_too_large = EFBIG,
143
+ filename_too_long = ENAMETOOLONG,
144
+ function_not_supported = ENOSYS,
145
+ host_unreachable = EHOSTUNREACH,
146
+ identifier_removed = EIDRM,
147
+ illegal_byte_sequence = EILSEQ,
148
+ inappropriate_io_control_operation = ENOTTY,
149
+ interrupted = EINTR,
150
+ invalid_argument = EINVAL,
151
+ invalid_seek = ESPIPE,
152
+ io_error = EIO,
153
+ is_a_directory = EISDIR,
154
+ message_size = EMSGSIZE,
155
+ network_down = ENETDOWN,
156
+ network_reset = ENETRESET,
157
+ network_unreachable = ENETUNREACH,
158
+ no_buffer_space = ENOBUFS,
159
+ no_child_process = ECHILD,
160
+ no_link = ENOLINK,
161
+ no_lock_available = ENOLCK,
162
+ #ifdef ENODATA
163
+ no_message_available = ENODATA,
164
+ #else
165
+ no_message_available = ENOMSG,
166
+ #endif
167
+ no_message = ENOMSG,
168
+ no_protocol_option = ENOPROTOOPT,
169
+ no_space_on_device = ENOSPC,
170
+ #ifdef ENOSR
171
+ no_stream_resources = ENOSR,
172
+ #else
173
+ no_stream_resources = ENOMEM,
174
+ #endif
175
+ no_such_device_or_address = ENXIO,
176
+ no_such_device = ENODEV,
177
+ no_such_file_or_directory = ENOENT,
178
+ no_such_process = ESRCH,
179
+ not_a_directory = ENOTDIR,
180
+ not_a_socket = ENOTSOCK,
181
+ #ifdef ENOSTR
182
+ not_a_stream = ENOSTR,
183
+ #else
184
+ not_a_stream = EINVAL,
185
+ #endif
186
+ not_connected = ENOTCONN,
187
+ not_enough_memory = ENOMEM,
188
+ not_supported = ENOTSUP,
189
+ operation_canceled = ECANCELED,
190
+ operation_in_progress = EINPROGRESS,
191
+ operation_not_permitted = EPERM,
192
+ operation_not_supported = EOPNOTSUPP,
193
+ operation_would_block = EWOULDBLOCK,
194
+ owner_dead = EOWNERDEAD,
195
+ permission_denied = EACCES,
196
+ protocol_error = EPROTO,
197
+ protocol_not_supported = EPROTONOSUPPORT,
198
+ read_only_file_system = EROFS,
199
+ resource_deadlock_would_occur = EDEADLK,
200
+ resource_unavailable_try_again = EAGAIN,
201
+ result_out_of_range = ERANGE,
202
+ state_not_recoverable = ENOTRECOVERABLE,
203
+ #ifdef ETIME
204
+ stream_timeout = ETIME,
205
+ #else
206
+ stream_timeout = ETIMEDOUT,
207
+ #endif
208
+ text_file_busy = ETXTBSY,
209
+ timed_out = ETIMEDOUT,
210
+ too_many_files_open_in_system = ENFILE,
211
+ too_many_files_open = EMFILE,
212
+ too_many_links = EMLINK,
213
+ too_many_symbolic_link_levels = ELOOP,
214
+ value_too_large = EOVERFLOW,
215
+ wrong_protocol_type = EPROTOTYPE
216
+ };
217
+ _LIBCUDACXX_DECLARE_STRONG_ENUM_EPILOG(errc)
218
+
219
+ _LIBCUDACXX_END_NAMESPACE_STD
220
+
221
+ #endif // _LIBCUDACXX___ERRC
cuda_toolkit/include/__functional_base ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX_FUNCTIONAL_BASE
11
+ #define _LIBCUDACXX_FUNCTIONAL_BASE
12
+
13
+ #ifndef __cuda_std__
14
+ #include <__config>
15
+ #include <typeinfo>
16
+ #include <exception>
17
+ #include <new>
18
+ #endif // __cuda_std__
19
+
20
+ #include "__functional/binary_function.h"
21
+ #include "__functional/operations.h"
22
+ #include "__functional/reference_wrapper.h"
23
+ #include "__functional/unary_function.h"
24
+ #include "__functional/weak_result_type.h"
25
+ #include "__type_traits/integral_constant.h"
26
+ #include "__type_traits/is_constructible.h"
27
+ #include "__type_traits/is_convertible.h"
28
+ #include "__type_traits/remove_cvref.h"
29
+ #include "__utility/forward.h"
30
+
31
+ #ifndef __cuda_std__
32
+ #include <__pragma_push>
33
+ #endif // __cuda_std__
34
+
35
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
36
+ # pragma GCC system_header
37
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
38
+ # pragma clang system_header
39
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
40
+ # pragma system_header
41
+ #endif // no system header
42
+
43
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
44
+
45
+ // allocator_arg_t
46
+
47
+ struct _LIBCUDACXX_TEMPLATE_VIS allocator_arg_t { explicit allocator_arg_t() = default; };
48
+
49
+ #if defined(_LIBCUDACXX_BUILDING_LIBRARY)
50
+ extern _LIBCUDACXX_EXPORTED_FROM_ABI const allocator_arg_t allocator_arg;
51
+ #else
52
+ /* _LIBCUDACXX_INLINE_VAR */ constexpr allocator_arg_t allocator_arg = allocator_arg_t();
53
+ #endif
54
+
55
+ // uses_allocator
56
+
57
+ template <class _Tp>
58
+ struct __has_allocator_type
59
+ {
60
+ private:
61
+ struct __two {char __lx; char __lxx;};
62
+ template <class _Up> _LIBCUDACXX_INLINE_VISIBILITY static __two __test(...);
63
+ template <class _Up> _LIBCUDACXX_INLINE_VISIBILITY static char __test(typename _Up::allocator_type* = 0);
64
+ public:
65
+ static const bool value = sizeof(__test<_Tp>(0)) == 1;
66
+ };
67
+
68
+ template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value>
69
+ struct __uses_allocator
70
+ : public integral_constant<bool,
71
+ is_convertible<_Alloc, typename _Tp::allocator_type>::value>
72
+ {
73
+ };
74
+
75
+ template <class _Tp, class _Alloc>
76
+ struct __uses_allocator<_Tp, _Alloc, false>
77
+ : public false_type
78
+ {
79
+ };
80
+
81
+ template <class _Tp, class _Alloc>
82
+ struct _LIBCUDACXX_TEMPLATE_VIS uses_allocator
83
+ : public __uses_allocator<_Tp, _Alloc>
84
+ {
85
+ };
86
+
87
+ #if _LIBCUDACXX_STD_VER > 14
88
+ template <class _Tp, class _Alloc>
89
+ _LIBCUDACXX_INLINE_VAR constexpr size_t uses_allocator_v = uses_allocator<_Tp, _Alloc>::value;
90
+ #endif
91
+
92
+ // allocator construction
93
+
94
+ template <class _Tp, class _Alloc, class ..._Args>
95
+ struct __uses_alloc_ctor_imp
96
+ {
97
+ typedef _LIBCUDACXX_NODEBUG_TYPE __remove_cvref_t<_Alloc> _RawAlloc;
98
+ static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value;
99
+ static const bool __ic =
100
+ is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
101
+ static const int value = __ua ? 2 - __ic : 0;
102
+ };
103
+
104
+ template <class _Tp, class _Alloc, class ..._Args>
105
+ struct __uses_alloc_ctor
106
+ : integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
107
+ {};
108
+
109
+ template <class _Tp, class _Allocator, class... _Args>
110
+ inline _LIBCUDACXX_INLINE_VISIBILITY
111
+ void __user_alloc_construct_impl (integral_constant<int, 0>, _Tp *__storage, const _Allocator &, _Args &&... __args )
112
+ {
113
+ new (__storage) _Tp (_CUDA_VSTD::forward<_Args>(__args)...);
114
+ }
115
+
116
+ // FIXME: This should have a version which takes a non-const alloc.
117
+ template <class _Tp, class _Allocator, class... _Args>
118
+ inline _LIBCUDACXX_INLINE_VISIBILITY
119
+ void __user_alloc_construct_impl (integral_constant<int, 1>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
120
+ {
121
+ new (__storage) _Tp (allocator_arg, __a, _CUDA_VSTD::forward<_Args>(__args)...);
122
+ }
123
+
124
+ // FIXME: This should have a version which takes a non-const alloc.
125
+ template <class _Tp, class _Allocator, class... _Args>
126
+ inline _LIBCUDACXX_INLINE_VISIBILITY
127
+ void __user_alloc_construct_impl (integral_constant<int, 2>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
128
+ {
129
+ new (__storage) _Tp (_CUDA_VSTD::forward<_Args>(__args)..., __a);
130
+ }
131
+
132
+ _LIBCUDACXX_END_NAMESPACE_STD
133
+
134
+ #ifndef __cuda_std__
135
+ #include <__pragma_pop>
136
+ #endif // __cuda_std__
137
+
138
+ #endif // _LIBCUDACXX_FUNCTIONAL_BASE
cuda_toolkit/include/__hash_table ADDED
The diff for this file is too large to render. See raw diff
 
cuda_toolkit/include/__libcpp_version ADDED
@@ -0,0 +1 @@
 
 
1
+ 10000
cuda_toolkit/include/__locale ADDED
@@ -0,0 +1,1557 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___LOCALE
11
+ #define _LIBCUDACXX___LOCALE
12
+
13
+ #include <__config>
14
+ #include <string>
15
+ #include <memory>
16
+ #include <utility>
17
+ #include <mutex>
18
+ #include <cstdint>
19
+ #include <cctype>
20
+ #include <locale.h>
21
+ #if defined(_LIBCUDACXX_MSVCRT_LIKE)
22
+ # include <cstring>
23
+ # include <support/win32/locale_win32.h>
24
+ #elif defined(_AIX)
25
+ # include <support/ibm/xlocale.h>
26
+ #elif defined(__ANDROID__)
27
+ # include <support/android/locale_bionic.h>
28
+ #elif defined(__sun__)
29
+ # include <xlocale.h>
30
+ # include <support/solaris/xlocale.h>
31
+ #elif defined(_NEWLIB_VERSION)
32
+ # include <support/newlib/xlocale.h>
33
+ #elif (defined(__APPLE__) || defined(__FreeBSD__) \
34
+ || defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
35
+ # include <xlocale.h>
36
+ #elif defined(__Fuchsia__)
37
+ # include <support/fuchsia/xlocale.h>
38
+ #elif defined(__wasi__)
39
+ // WASI libc uses musl's locales support.
40
+ # include <support/musl/xlocale.h>
41
+ #elif defined(_LIBCUDACXX_HAS_MUSL_LIBC)
42
+ # include <support/musl/xlocale.h>
43
+ #endif
44
+
45
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
46
+ # pragma GCC system_header
47
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
48
+ # pragma clang system_header
49
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
50
+ # pragma system_header
51
+ #endif // no system header
52
+
53
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
54
+
55
+ #if !defined(_LIBCUDACXX_LOCALE__L_EXTENSIONS)
56
+ struct __libcpp_locale_guard {
57
+ _LIBCUDACXX_INLINE_VISIBILITY
58
+ __libcpp_locale_guard(locale_t& __loc) : __old_loc_(uselocale(__loc)) {}
59
+
60
+ _LIBCUDACXX_INLINE_VISIBILITY
61
+ ~__libcpp_locale_guard() {
62
+ if (__old_loc_)
63
+ uselocale(__old_loc_);
64
+ }
65
+
66
+ locale_t __old_loc_;
67
+ private:
68
+ __libcpp_locale_guard(__libcpp_locale_guard const&);
69
+ __libcpp_locale_guard& operator=(__libcpp_locale_guard const&);
70
+ };
71
+ #elif defined(_LIBCUDACXX_MSVCRT_LIKE)
72
+ struct __libcpp_locale_guard {
73
+ __libcpp_locale_guard(locale_t __l) :
74
+ __status(_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)) {
75
+ // Setting the locale can be expensive even when the locale given is
76
+ // already the current locale, so do an explicit check to see if the
77
+ // current locale is already the one we want.
78
+ const char* __lc = __setlocale(nullptr);
79
+ // If every category is the same, the locale string will simply be the
80
+ // locale name, otherwise it will be a semicolon-separated string listing
81
+ // each category. In the second case, we know at least one category won't
82
+ // be what we want, so we only have to check the first case.
83
+ if (strcmp(__l.__get_locale(), __lc) != 0) {
84
+ __locale_all = _strdup(__lc);
85
+ if (__locale_all == nullptr)
86
+ __throw_bad_alloc();
87
+ __setlocale(__l.__get_locale());
88
+ }
89
+ }
90
+ ~__libcpp_locale_guard() {
91
+ // The CRT documentation doesn't explicitly say, but setlocale() does the
92
+ // right thing when given a semicolon-separated list of locale settings
93
+ // for the different categories in the same format as returned by
94
+ // setlocale(LC_ALL, nullptr).
95
+ if (__locale_all != nullptr) {
96
+ __setlocale(__locale_all);
97
+ free(__locale_all);
98
+ }
99
+ _configthreadlocale(__status);
100
+ }
101
+ static const char* __setlocale(const char* __locale) {
102
+ const char* __new_locale = setlocale(LC_ALL, __locale);
103
+ if (__new_locale == nullptr)
104
+ __throw_bad_alloc();
105
+ return __new_locale;
106
+ }
107
+ int __status;
108
+ char* __locale_all = nullptr;
109
+ };
110
+ #endif
111
+
112
+
113
+ class _LIBCUDACXX_TYPE_VIS locale;
114
+
115
+ template <class _Facet>
116
+ _LIBCUDACXX_INLINE_VISIBILITY
117
+ bool
118
+ has_facet(const locale&) noexcept;
119
+
120
+ template <class _Facet>
121
+ _LIBCUDACXX_INLINE_VISIBILITY
122
+ const _Facet&
123
+ use_facet(const locale&);
124
+
125
+ class _LIBCUDACXX_TYPE_VIS locale
126
+ {
127
+ public:
128
+ // types:
129
+ class _LIBCUDACXX_TYPE_VIS facet;
130
+ class _LIBCUDACXX_TYPE_VIS id;
131
+
132
+ typedef int category;
133
+ _LIBCUDACXX_AVAILABILITY_LOCALE_CATEGORY
134
+ static const category // values assigned here are for exposition only
135
+ none = 0,
136
+ collate = LC_COLLATE_MASK,
137
+ ctype = LC_CTYPE_MASK,
138
+ monetary = LC_MONETARY_MASK,
139
+ numeric = LC_NUMERIC_MASK,
140
+ time = LC_TIME_MASK,
141
+ messages = LC_MESSAGES_MASK,
142
+ all = collate | ctype | monetary | numeric | time | messages;
143
+
144
+ // construct/copy/destroy:
145
+ locale() noexcept;
146
+ locale(const locale&) noexcept;
147
+ explicit locale(const char*);
148
+ explicit locale(const string&);
149
+ locale(const locale&, const char*, category);
150
+ locale(const locale&, const string&, category);
151
+ template <class _Facet>
152
+ _LIBCUDACXX_INLINE_VISIBILITY locale(const locale&, _Facet*);
153
+ locale(const locale&, const locale&, category);
154
+
155
+ ~locale();
156
+
157
+ const locale& operator=(const locale&) noexcept;
158
+
159
+ template <class _Facet>
160
+ _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
161
+ locale combine(const locale&) const;
162
+
163
+ // locale operations:
164
+ string name() const;
165
+ bool operator==(const locale&) const;
166
+ bool operator!=(const locale& __y) const {return !(*this == __y);}
167
+ template <class _CharT, class _Traits, class _Allocator>
168
+ _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
169
+ bool operator()(const basic_string<_CharT, _Traits, _Allocator>&,
170
+ const basic_string<_CharT, _Traits, _Allocator>&) const;
171
+
172
+ // global locale objects:
173
+ static locale global(const locale&);
174
+ static const locale& classic();
175
+
176
+ private:
177
+ class __imp;
178
+ __imp* __locale_;
179
+
180
+ void __install_ctor(const locale&, facet*, long);
181
+ static locale& __global();
182
+ bool has_facet(id&) const;
183
+ const facet* use_facet(id&) const;
184
+
185
+ template <class _Facet> friend bool has_facet(const locale&) noexcept;
186
+ template <class _Facet> friend const _Facet& use_facet(const locale&);
187
+ };
188
+
189
+ class _LIBCUDACXX_TYPE_VIS locale::facet
190
+ : public __shared_count
191
+ {
192
+ protected:
193
+ _LIBCUDACXX_INLINE_VISIBILITY
194
+ explicit facet(size_t __refs = 0)
195
+ : __shared_count(static_cast<long>(__refs)-1) {}
196
+
197
+ virtual ~facet();
198
+
199
+ // facet(const facet&) = delete; // effectively done in __shared_count
200
+ // void operator=(const facet&) = delete;
201
+ private:
202
+ virtual void __on_zero_shared() noexcept;
203
+ };
204
+
205
+ class _LIBCUDACXX_TYPE_VIS locale::id
206
+ {
207
+ once_flag __flag_;
208
+ int32_t __id_;
209
+
210
+ static int32_t __next_id;
211
+ public:
212
+ _LIBCUDACXX_INLINE_VISIBILITY constexpr id() :__id_(0) {}
213
+ private:
214
+ void __init();
215
+ void operator=(const id&); // = delete;
216
+ id(const id&); // = delete;
217
+ public: // only needed for tests
218
+ long __get();
219
+
220
+ friend class locale;
221
+ friend class locale::__imp;
222
+ };
223
+
224
+ template <class _Facet>
225
+ inline _LIBCUDACXX_INLINE_VISIBILITY
226
+ locale::locale(const locale& __other, _Facet* __f)
227
+ {
228
+ __install_ctor(__other, __f, __f ? __f->id.__get() : 0);
229
+ }
230
+
231
+ template <class _Facet>
232
+ locale
233
+ locale::combine(const locale& __other) const
234
+ {
235
+ if (!_CUDA_VSTD::has_facet<_Facet>(__other))
236
+ __throw_runtime_error("locale::combine: locale missing facet");
237
+
238
+ return locale(*this, &const_cast<_Facet&>(_CUDA_VSTD::use_facet<_Facet>(__other)));
239
+ }
240
+
241
+ template <class _Facet>
242
+ inline _LIBCUDACXX_INLINE_VISIBILITY
243
+ bool
244
+ has_facet(const locale& __l) noexcept
245
+ {
246
+ return __l.has_facet(_Facet::id);
247
+ }
248
+
249
+ template <class _Facet>
250
+ inline _LIBCUDACXX_INLINE_VISIBILITY
251
+ const _Facet&
252
+ use_facet(const locale& __l)
253
+ {
254
+ return static_cast<const _Facet&>(*__l.use_facet(_Facet::id));
255
+ }
256
+
257
+ // template <class _CharT> class collate;
258
+
259
+ template <class _CharT>
260
+ class _LIBCUDACXX_TEMPLATE_VIS collate
261
+ : public locale::facet
262
+ {
263
+ public:
264
+ typedef _CharT char_type;
265
+ typedef basic_string<char_type> string_type;
266
+
267
+ _LIBCUDACXX_INLINE_VISIBILITY
268
+ explicit collate(size_t __refs = 0)
269
+ : locale::facet(__refs) {}
270
+
271
+ _LIBCUDACXX_INLINE_VISIBILITY
272
+ int compare(const char_type* __lo1, const char_type* __hi1,
273
+ const char_type* __lo2, const char_type* __hi2) const
274
+ {
275
+ return do_compare(__lo1, __hi1, __lo2, __hi2);
276
+ }
277
+
278
+ // FIXME(EricWF): The _LIBCUDACXX_ALWAYS_INLINE is needed on Windows to work
279
+ // around a dllimport bug that expects an external instantiation.
280
+ _LIBCUDACXX_INLINE_VISIBILITY
281
+ _LIBCUDACXX_ALWAYS_INLINE
282
+ string_type transform(const char_type* __lo, const char_type* __hi) const
283
+ {
284
+ return do_transform(__lo, __hi);
285
+ }
286
+
287
+ _LIBCUDACXX_INLINE_VISIBILITY
288
+ long hash(const char_type* __lo, const char_type* __hi) const
289
+ {
290
+ return do_hash(__lo, __hi);
291
+ }
292
+
293
+ static locale::id id;
294
+
295
+ protected:
296
+ ~collate();
297
+ virtual int do_compare(const char_type* __lo1, const char_type* __hi1,
298
+ const char_type* __lo2, const char_type* __hi2) const;
299
+ virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const
300
+ {return string_type(__lo, __hi);}
301
+ virtual long do_hash(const char_type* __lo, const char_type* __hi) const;
302
+ };
303
+
304
+ template <class _CharT> locale::id collate<_CharT>::id;
305
+
306
+ template <class _CharT>
307
+ collate<_CharT>::~collate()
308
+ {
309
+ }
310
+
311
+ template <class _CharT>
312
+ int
313
+ collate<_CharT>::do_compare(const char_type* __lo1, const char_type* __hi1,
314
+ const char_type* __lo2, const char_type* __hi2) const
315
+ {
316
+ for (; __lo2 != __hi2; ++__lo1, ++__lo2)
317
+ {
318
+ if (__lo1 == __hi1 || *__lo1 < *__lo2)
319
+ return -1;
320
+ if (*__lo2 < *__lo1)
321
+ return 1;
322
+ }
323
+ return __lo1 != __hi1;
324
+ }
325
+
326
+ template <class _CharT>
327
+ long
328
+ collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
329
+ {
330
+ size_t __h = 0;
331
+ const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
332
+ const size_t __mask = size_t(0xF) << (__sr + 4);
333
+ for(const char_type* __p = __lo; __p != __hi; ++__p)
334
+ {
335
+ __h = (__h << 4) + static_cast<size_t>(*__p);
336
+ size_t __g = __h & __mask;
337
+ __h ^= __g | (__g >> __sr);
338
+ }
339
+ return static_cast<long>(__h);
340
+ }
341
+
342
+ _LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS collate<char>)
343
+ _LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS collate<wchar_t>)
344
+
345
+ // template <class CharT> class collate_byname;
346
+
347
+ template <class _CharT> class _LIBCUDACXX_TEMPLATE_VIS collate_byname;
348
+
349
+ template <>
350
+ class _LIBCUDACXX_TYPE_VIS collate_byname<char>
351
+ : public collate<char>
352
+ {
353
+ locale_t __l;
354
+ public:
355
+ typedef char char_type;
356
+ typedef basic_string<char_type> string_type;
357
+
358
+ explicit collate_byname(const char* __n, size_t __refs = 0);
359
+ explicit collate_byname(const string& __n, size_t __refs = 0);
360
+
361
+ protected:
362
+ ~collate_byname();
363
+ virtual int do_compare(const char_type* __lo1, const char_type* __hi1,
364
+ const char_type* __lo2, const char_type* __hi2) const;
365
+ virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const;
366
+ };
367
+
368
+ template <>
369
+ class _LIBCUDACXX_TYPE_VIS collate_byname<wchar_t>
370
+ : public collate<wchar_t>
371
+ {
372
+ locale_t __l;
373
+ public:
374
+ typedef wchar_t char_type;
375
+ typedef basic_string<char_type> string_type;
376
+
377
+ explicit collate_byname(const char* __n, size_t __refs = 0);
378
+ explicit collate_byname(const string& __n, size_t __refs = 0);
379
+
380
+ protected:
381
+ ~collate_byname();
382
+
383
+ virtual int do_compare(const char_type* __lo1, const char_type* __hi1,
384
+ const char_type* __lo2, const char_type* __hi2) const;
385
+ virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const;
386
+ };
387
+
388
+ template <class _CharT, class _Traits, class _Allocator>
389
+ bool
390
+ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
391
+ const basic_string<_CharT, _Traits, _Allocator>& __y) const
392
+ {
393
+ return _CUDA_VSTD::use_facet<_CUDA_VSTD::collate<_CharT> >(*this).compare(
394
+ __x.data(), __x.data() + __x.size(),
395
+ __y.data(), __y.data() + __y.size()) < 0;
396
+ }
397
+
398
+ // template <class charT> class ctype
399
+
400
+ class _LIBCUDACXX_TYPE_VIS ctype_base
401
+ {
402
+ public:
403
+ #if defined(__GLIBC__)
404
+ typedef unsigned short mask;
405
+ static const mask space = _ISspace;
406
+ static const mask print = _ISprint;
407
+ static const mask cntrl = _IScntrl;
408
+ static const mask upper = _ISupper;
409
+ static const mask lower = _ISlower;
410
+ static const mask alpha = _ISalpha;
411
+ static const mask digit = _ISdigit;
412
+ static const mask punct = _ISpunct;
413
+ static const mask xdigit = _ISxdigit;
414
+ static const mask blank = _ISblank;
415
+ #if defined(__mips__)
416
+ static const mask __regex_word = static_cast<mask>(_ISbit(15));
417
+ #else
418
+ static const mask __regex_word = 0x80;
419
+ #endif
420
+ #elif defined(_LIBCUDACXX_MSVCRT_LIKE)
421
+ typedef unsigned short mask;
422
+ static const mask space = _SPACE;
423
+ static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT;
424
+ static const mask cntrl = _CONTROL;
425
+ static const mask upper = _UPPER;
426
+ static const mask lower = _LOWER;
427
+ static const mask alpha = _ALPHA;
428
+ static const mask digit = _DIGIT;
429
+ static const mask punct = _PUNCT;
430
+ static const mask xdigit = _HEX;
431
+ static const mask blank = _BLANK;
432
+ static const mask __regex_word = 0x80;
433
+ # define _LIBCUDACXX_CTYPE_MASK_IS_COMPOSITE_PRINT
434
+ #elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
435
+ # ifdef __APPLE__
436
+ typedef __uint32_t mask;
437
+ # elif defined(__FreeBSD__)
438
+ typedef unsigned long mask;
439
+ # elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
440
+ typedef unsigned short mask;
441
+ # endif
442
+ static const mask space = _CTYPE_S;
443
+ static const mask print = _CTYPE_R;
444
+ static const mask cntrl = _CTYPE_C;
445
+ static const mask upper = _CTYPE_U;
446
+ static const mask lower = _CTYPE_L;
447
+ static const mask alpha = _CTYPE_A;
448
+ static const mask digit = _CTYPE_D;
449
+ static const mask punct = _CTYPE_P;
450
+ static const mask xdigit = _CTYPE_X;
451
+
452
+ # if defined(__NetBSD__)
453
+ static const mask blank = _CTYPE_BL;
454
+ // NetBSD defines classes up to 0x2000
455
+ // see sys/ctype_bits.h, _CTYPE_Q
456
+ static const mask __regex_word = 0x8000;
457
+ # else
458
+ static const mask blank = _CTYPE_B;
459
+ static const mask __regex_word = 0x80;
460
+ # endif
461
+ #elif defined(__sun__) || defined(_AIX)
462
+ typedef unsigned int mask;
463
+ static const mask space = _ISSPACE;
464
+ static const mask print = _ISPRINT;
465
+ static const mask cntrl = _ISCNTRL;
466
+ static const mask upper = _ISUPPER;
467
+ static const mask lower = _ISLOWER;
468
+ static const mask alpha = _ISALPHA;
469
+ static const mask digit = _ISDIGIT;
470
+ static const mask punct = _ISPUNCT;
471
+ static const mask xdigit = _ISXDIGIT;
472
+ static const mask blank = _ISBLANK;
473
+ static const mask __regex_word = 0x80;
474
+ #elif defined(_NEWLIB_VERSION)
475
+ // Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.
476
+ typedef char mask;
477
+ static const mask space = _S;
478
+ static const mask print = _P | _U | _L | _N | _B;
479
+ static const mask cntrl = _C;
480
+ static const mask upper = _U;
481
+ static const mask lower = _L;
482
+ static const mask alpha = _U | _L;
483
+ static const mask digit = _N;
484
+ static const mask punct = _P;
485
+ static const mask xdigit = _X | _N;
486
+ static const mask blank = _B;
487
+ static const mask __regex_word = 0x80;
488
+ # define _LIBCUDACXX_CTYPE_MASK_IS_COMPOSITE_PRINT
489
+ # define _LIBCUDACXX_CTYPE_MASK_IS_COMPOSITE_ALPHA
490
+ # define _LIBCUDACXX_CTYPE_MASK_IS_COMPOSITE_XDIGIT
491
+ #else
492
+ typedef unsigned long mask;
493
+ static const mask space = 1<<0;
494
+ static const mask print = 1<<1;
495
+ static const mask cntrl = 1<<2;
496
+ static const mask upper = 1<<3;
497
+ static const mask lower = 1<<4;
498
+ static const mask alpha = 1<<5;
499
+ static const mask digit = 1<<6;
500
+ static const mask punct = 1<<7;
501
+ static const mask xdigit = 1<<8;
502
+ static const mask blank = 1<<9;
503
+ static const mask __regex_word = 1<<10;
504
+ #endif
505
+ static const mask alnum = alpha | digit;
506
+ static const mask graph = alnum | punct;
507
+
508
+ _LIBCUDACXX_INLINE_VISIBILITY ctype_base() {}
509
+ };
510
+
511
+ template <class _CharT> class _LIBCUDACXX_TEMPLATE_VIS ctype;
512
+
513
+ template <>
514
+ class _LIBCUDACXX_TYPE_VIS ctype<wchar_t>
515
+ : public locale::facet,
516
+ public ctype_base
517
+ {
518
+ public:
519
+ typedef wchar_t char_type;
520
+
521
+ _LIBCUDACXX_INLINE_VISIBILITY
522
+ explicit ctype(size_t __refs = 0)
523
+ : locale::facet(__refs) {}
524
+
525
+ _LIBCUDACXX_INLINE_VISIBILITY
526
+ bool is(mask __m, char_type __c) const
527
+ {
528
+ return do_is(__m, __c);
529
+ }
530
+
531
+ _LIBCUDACXX_INLINE_VISIBILITY
532
+ const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
533
+ {
534
+ return do_is(__low, __high, __vec);
535
+ }
536
+
537
+ _LIBCUDACXX_INLINE_VISIBILITY
538
+ const char_type* scan_is(mask __m, const char_type* __low, const char_type* __high) const
539
+ {
540
+ return do_scan_is(__m, __low, __high);
541
+ }
542
+
543
+ _LIBCUDACXX_INLINE_VISIBILITY
544
+ const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
545
+ {
546
+ return do_scan_not(__m, __low, __high);
547
+ }
548
+
549
+ _LIBCUDACXX_INLINE_VISIBILITY
550
+ char_type toupper(char_type __c) const
551
+ {
552
+ return do_toupper(__c);
553
+ }
554
+
555
+ _LIBCUDACXX_INLINE_VISIBILITY
556
+ const char_type* toupper(char_type* __low, const char_type* __high) const
557
+ {
558
+ return do_toupper(__low, __high);
559
+ }
560
+
561
+ _LIBCUDACXX_INLINE_VISIBILITY
562
+ char_type tolower(char_type __c) const
563
+ {
564
+ return do_tolower(__c);
565
+ }
566
+
567
+ _LIBCUDACXX_INLINE_VISIBILITY
568
+ const char_type* tolower(char_type* __low, const char_type* __high) const
569
+ {
570
+ return do_tolower(__low, __high);
571
+ }
572
+
573
+ _LIBCUDACXX_INLINE_VISIBILITY
574
+ char_type widen(char __c) const
575
+ {
576
+ return do_widen(__c);
577
+ }
578
+
579
+ _LIBCUDACXX_INLINE_VISIBILITY
580
+ const char* widen(const char* __low, const char* __high, char_type* __to) const
581
+ {
582
+ return do_widen(__low, __high, __to);
583
+ }
584
+
585
+ _LIBCUDACXX_INLINE_VISIBILITY
586
+ char narrow(char_type __c, char __dfault) const
587
+ {
588
+ return do_narrow(__c, __dfault);
589
+ }
590
+
591
+ _LIBCUDACXX_INLINE_VISIBILITY
592
+ const char_type* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const
593
+ {
594
+ return do_narrow(__low, __high, __dfault, __to);
595
+ }
596
+
597
+ static locale::id id;
598
+
599
+ protected:
600
+ ~ctype();
601
+ virtual bool do_is(mask __m, char_type __c) const;
602
+ virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const;
603
+ virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const;
604
+ virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const;
605
+ virtual char_type do_toupper(char_type) const;
606
+ virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
607
+ virtual char_type do_tolower(char_type) const;
608
+ virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
609
+ virtual char_type do_widen(char) const;
610
+ virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const;
611
+ virtual char do_narrow(char_type, char __dfault) const;
612
+ virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const;
613
+ };
614
+
615
+ template <>
616
+ class _LIBCUDACXX_TYPE_VIS ctype<char>
617
+ : public locale::facet, public ctype_base
618
+ {
619
+ const mask* __tab_;
620
+ bool __del_;
621
+ public:
622
+ typedef char char_type;
623
+
624
+ explicit ctype(const mask* __tab = 0, bool __del = false, size_t __refs = 0);
625
+
626
+ _LIBCUDACXX_INLINE_VISIBILITY
627
+ bool is(mask __m, char_type __c) const
628
+ {
629
+ return isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) !=0 : false;
630
+ }
631
+
632
+ _LIBCUDACXX_INLINE_VISIBILITY
633
+ const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
634
+ {
635
+ for (; __low != __high; ++__low, ++__vec)
636
+ *__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0;
637
+ return __low;
638
+ }
639
+
640
+ _LIBCUDACXX_INLINE_VISIBILITY
641
+ const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
642
+ {
643
+ for (; __low != __high; ++__low)
644
+ if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
645
+ break;
646
+ return __low;
647
+ }
648
+
649
+ _LIBCUDACXX_INLINE_VISIBILITY
650
+ const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
651
+ {
652
+ for (; __low != __high; ++__low)
653
+ if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)))
654
+ break;
655
+ return __low;
656
+ }
657
+
658
+ _LIBCUDACXX_INLINE_VISIBILITY
659
+ char_type toupper(char_type __c) const
660
+ {
661
+ return do_toupper(__c);
662
+ }
663
+
664
+ _LIBCUDACXX_INLINE_VISIBILITY
665
+ const char_type* toupper(char_type* __low, const char_type* __high) const
666
+ {
667
+ return do_toupper(__low, __high);
668
+ }
669
+
670
+ _LIBCUDACXX_INLINE_VISIBILITY
671
+ char_type tolower(char_type __c) const
672
+ {
673
+ return do_tolower(__c);
674
+ }
675
+
676
+ _LIBCUDACXX_INLINE_VISIBILITY
677
+ const char_type* tolower(char_type* __low, const char_type* __high) const
678
+ {
679
+ return do_tolower(__low, __high);
680
+ }
681
+
682
+ _LIBCUDACXX_INLINE_VISIBILITY
683
+ char_type widen(char __c) const
684
+ {
685
+ return do_widen(__c);
686
+ }
687
+
688
+ _LIBCUDACXX_INLINE_VISIBILITY
689
+ const char* widen(const char* __low, const char* __high, char_type* __to) const
690
+ {
691
+ return do_widen(__low, __high, __to);
692
+ }
693
+
694
+ _LIBCUDACXX_INLINE_VISIBILITY
695
+ char narrow(char_type __c, char __dfault) const
696
+ {
697
+ return do_narrow(__c, __dfault);
698
+ }
699
+
700
+ _LIBCUDACXX_INLINE_VISIBILITY
701
+ const char* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const
702
+ {
703
+ return do_narrow(__low, __high, __dfault, __to);
704
+ }
705
+
706
+ static locale::id id;
707
+
708
+ #ifdef _CACHED_RUNES
709
+ static const size_t table_size = _CACHED_RUNES;
710
+ #else
711
+ static const size_t table_size = 256; // FIXME: Don't hardcode this.
712
+ #endif
713
+ _LIBCUDACXX_INLINE_VISIBILITY const mask* table() const noexcept {return __tab_;}
714
+ static const mask* classic_table() noexcept;
715
+ #if defined(__GLIBC__) || defined(__EMSCRIPTEN__)
716
+ static const int* __classic_upper_table() noexcept;
717
+ static const int* __classic_lower_table() noexcept;
718
+ #endif
719
+ #if defined(__NetBSD__)
720
+ static const short* __classic_upper_table() noexcept;
721
+ static const short* __classic_lower_table() noexcept;
722
+ #endif
723
+
724
+ protected:
725
+ ~ctype();
726
+ virtual char_type do_toupper(char_type __c) const;
727
+ virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
728
+ virtual char_type do_tolower(char_type __c) const;
729
+ virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
730
+ virtual char_type do_widen(char __c) const;
731
+ virtual const char* do_widen(const char* __low, const char* __high, char_type* __to) const;
732
+ virtual char do_narrow(char_type __c, char __dfault) const;
733
+ virtual const char* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const;
734
+ };
735
+
736
+ // template <class CharT> class ctype_byname;
737
+
738
+ template <class _CharT> class _LIBCUDACXX_TEMPLATE_VIS ctype_byname;
739
+
740
+ template <>
741
+ class _LIBCUDACXX_TYPE_VIS ctype_byname<char>
742
+ : public ctype<char>
743
+ {
744
+ locale_t __l;
745
+
746
+ public:
747
+ explicit ctype_byname(const char*, size_t = 0);
748
+ explicit ctype_byname(const string&, size_t = 0);
749
+
750
+ protected:
751
+ ~ctype_byname();
752
+ virtual char_type do_toupper(char_type) const;
753
+ virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
754
+ virtual char_type do_tolower(char_type) const;
755
+ virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
756
+ };
757
+
758
+ template <>
759
+ class _LIBCUDACXX_TYPE_VIS ctype_byname<wchar_t>
760
+ : public ctype<wchar_t>
761
+ {
762
+ locale_t __l;
763
+
764
+ public:
765
+ explicit ctype_byname(const char*, size_t = 0);
766
+ explicit ctype_byname(const string&, size_t = 0);
767
+
768
+ protected:
769
+ ~ctype_byname();
770
+ virtual bool do_is(mask __m, char_type __c) const;
771
+ virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const;
772
+ virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const;
773
+ virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const;
774
+ virtual char_type do_toupper(char_type) const;
775
+ virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const;
776
+ virtual char_type do_tolower(char_type) const;
777
+ virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const;
778
+ virtual char_type do_widen(char) const;
779
+ virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const;
780
+ virtual char do_narrow(char_type, char __dfault) const;
781
+ virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const;
782
+ };
783
+
784
+ template <class _CharT>
785
+ inline _LIBCUDACXX_INLINE_VISIBILITY
786
+ bool
787
+ isspace(_CharT __c, const locale& __loc)
788
+ {
789
+ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c);
790
+ }
791
+
792
+ template <class _CharT>
793
+ inline _LIBCUDACXX_INLINE_VISIBILITY
794
+ bool
795
+ isprint(_CharT __c, const locale& __loc)
796
+ {
797
+ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c);
798
+ }
799
+
800
+ template <class _CharT>
801
+ inline _LIBCUDACXX_INLINE_VISIBILITY
802
+ bool
803
+ iscntrl(_CharT __c, const locale& __loc)
804
+ {
805
+ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c);
806
+ }
807
+
808
+ template <class _CharT>
809
+ inline _LIBCUDACXX_INLINE_VISIBILITY
810
+ bool
811
+ isupper(_CharT __c, const locale& __loc)
812
+ {
813
+ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c);
814
+ }
815
+
816
+ template <class _CharT>
817
+ inline _LIBCUDACXX_INLINE_VISIBILITY
818
+ bool
819
+ islower(_CharT __c, const locale& __loc)
820
+ {
821
+ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c);
822
+ }
823
+
824
+ template <class _CharT>
825
+ inline _LIBCUDACXX_INLINE_VISIBILITY
826
+ bool
827
+ isalpha(_CharT __c, const locale& __loc)
828
+ {
829
+ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c);
830
+ }
831
+
832
+ template <class _CharT>
833
+ inline _LIBCUDACXX_INLINE_VISIBILITY
834
+ bool
835
+ isdigit(_CharT __c, const locale& __loc)
836
+ {
837
+ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c);
838
+ }
839
+
840
+ template <class _CharT>
841
+ inline _LIBCUDACXX_INLINE_VISIBILITY
842
+ bool
843
+ ispunct(_CharT __c, const locale& __loc)
844
+ {
845
+ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c);
846
+ }
847
+
848
+ template <class _CharT>
849
+ inline _LIBCUDACXX_INLINE_VISIBILITY
850
+ bool
851
+ isxdigit(_CharT __c, const locale& __loc)
852
+ {
853
+ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c);
854
+ }
855
+
856
+ template <class _CharT>
857
+ inline _LIBCUDACXX_INLINE_VISIBILITY
858
+ bool
859
+ isalnum(_CharT __c, const locale& __loc)
860
+ {
861
+ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c);
862
+ }
863
+
864
+ template <class _CharT>
865
+ inline _LIBCUDACXX_INLINE_VISIBILITY
866
+ bool
867
+ isgraph(_CharT __c, const locale& __loc)
868
+ {
869
+ return use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c);
870
+ }
871
+
872
+ template <class _CharT>
873
+ inline _LIBCUDACXX_INLINE_VISIBILITY
874
+ _CharT
875
+ toupper(_CharT __c, const locale& __loc)
876
+ {
877
+ return use_facet<ctype<_CharT> >(__loc).toupper(__c);
878
+ }
879
+
880
+ template <class _CharT>
881
+ inline _LIBCUDACXX_INLINE_VISIBILITY
882
+ _CharT
883
+ tolower(_CharT __c, const locale& __loc)
884
+ {
885
+ return use_facet<ctype<_CharT> >(__loc).tolower(__c);
886
+ }
887
+
888
+ // codecvt_base
889
+
890
+ class _LIBCUDACXX_TYPE_VIS codecvt_base
891
+ {
892
+ public:
893
+ _LIBCUDACXX_INLINE_VISIBILITY codecvt_base() {}
894
+ enum result {ok, partial, error, noconv};
895
+ };
896
+
897
+ // template <class internT, class externT, class stateT> class codecvt;
898
+
899
+ template <class _InternT, class _ExternT, class _StateT> class _LIBCUDACXX_TEMPLATE_VIS codecvt;
900
+
901
+ // template <> class codecvt<char, char, mbstate_t>
902
+
903
+ template <>
904
+ class _LIBCUDACXX_TYPE_VIS codecvt<char, char, mbstate_t>
905
+ : public locale::facet,
906
+ public codecvt_base
907
+ {
908
+ public:
909
+ typedef char intern_type;
910
+ typedef char extern_type;
911
+ typedef mbstate_t state_type;
912
+
913
+ _LIBCUDACXX_INLINE_VISIBILITY
914
+ explicit codecvt(size_t __refs = 0)
915
+ : locale::facet(__refs) {}
916
+
917
+ _LIBCUDACXX_INLINE_VISIBILITY
918
+ result out(state_type& __st,
919
+ const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
920
+ extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
921
+ {
922
+ return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
923
+ }
924
+
925
+ _LIBCUDACXX_INLINE_VISIBILITY
926
+ result unshift(state_type& __st,
927
+ extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
928
+ {
929
+ return do_unshift(__st, __to, __to_end, __to_nxt);
930
+ }
931
+
932
+ _LIBCUDACXX_INLINE_VISIBILITY
933
+ result in(state_type& __st,
934
+ const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
935
+ intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
936
+ {
937
+ return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
938
+ }
939
+
940
+ _LIBCUDACXX_INLINE_VISIBILITY
941
+ int encoding() const noexcept
942
+ {
943
+ return do_encoding();
944
+ }
945
+
946
+ _LIBCUDACXX_INLINE_VISIBILITY
947
+ bool always_noconv() const noexcept
948
+ {
949
+ return do_always_noconv();
950
+ }
951
+
952
+ _LIBCUDACXX_INLINE_VISIBILITY
953
+ int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
954
+ {
955
+ return do_length(__st, __frm, __end, __mx);
956
+ }
957
+
958
+ _LIBCUDACXX_INLINE_VISIBILITY
959
+ int max_length() const noexcept
960
+ {
961
+ return do_max_length();
962
+ }
963
+
964
+ static locale::id id;
965
+
966
+ protected:
967
+ _LIBCUDACXX_INLINE_VISIBILITY
968
+ explicit codecvt(const char*, size_t __refs = 0)
969
+ : locale::facet(__refs) {}
970
+
971
+ ~codecvt();
972
+
973
+ virtual result do_out(state_type& __st,
974
+ const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
975
+ extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
976
+ virtual result do_in(state_type& __st,
977
+ const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
978
+ intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
979
+ virtual result do_unshift(state_type& __st,
980
+ extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
981
+ virtual int do_encoding() const noexcept;
982
+ virtual bool do_always_noconv() const noexcept;
983
+ virtual int do_length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
984
+ virtual int do_max_length() const noexcept;
985
+ };
986
+
987
+ // template <> class codecvt<wchar_t, char, mbstate_t>
988
+
989
+ template <>
990
+ class _LIBCUDACXX_TYPE_VIS codecvt<wchar_t, char, mbstate_t>
991
+ : public locale::facet,
992
+ public codecvt_base
993
+ {
994
+ locale_t __l;
995
+ public:
996
+ typedef wchar_t intern_type;
997
+ typedef char extern_type;
998
+ typedef mbstate_t state_type;
999
+
1000
+ explicit codecvt(size_t __refs = 0);
1001
+
1002
+ _LIBCUDACXX_INLINE_VISIBILITY
1003
+ result out(state_type& __st,
1004
+ const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1005
+ extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1006
+ {
1007
+ return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1008
+ }
1009
+
1010
+ _LIBCUDACXX_INLINE_VISIBILITY
1011
+ result unshift(state_type& __st,
1012
+ extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1013
+ {
1014
+ return do_unshift(__st, __to, __to_end, __to_nxt);
1015
+ }
1016
+
1017
+ _LIBCUDACXX_INLINE_VISIBILITY
1018
+ result in(state_type& __st,
1019
+ const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1020
+ intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
1021
+ {
1022
+ return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1023
+ }
1024
+
1025
+ _LIBCUDACXX_INLINE_VISIBILITY
1026
+ int encoding() const noexcept
1027
+ {
1028
+ return do_encoding();
1029
+ }
1030
+
1031
+ _LIBCUDACXX_INLINE_VISIBILITY
1032
+ bool always_noconv() const noexcept
1033
+ {
1034
+ return do_always_noconv();
1035
+ }
1036
+
1037
+ _LIBCUDACXX_INLINE_VISIBILITY
1038
+ int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
1039
+ {
1040
+ return do_length(__st, __frm, __end, __mx);
1041
+ }
1042
+
1043
+ _LIBCUDACXX_INLINE_VISIBILITY
1044
+ int max_length() const noexcept
1045
+ {
1046
+ return do_max_length();
1047
+ }
1048
+
1049
+ static locale::id id;
1050
+
1051
+ protected:
1052
+ explicit codecvt(const char*, size_t __refs = 0);
1053
+
1054
+ ~codecvt();
1055
+
1056
+ virtual result do_out(state_type& __st,
1057
+ const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1058
+ extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1059
+ virtual result do_in(state_type& __st,
1060
+ const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1061
+ intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
1062
+ virtual result do_unshift(state_type& __st,
1063
+ extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1064
+ virtual int do_encoding() const noexcept;
1065
+ virtual bool do_always_noconv() const noexcept;
1066
+ virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
1067
+ virtual int do_max_length() const noexcept;
1068
+ };
1069
+
1070
+ // template <> class codecvt<char16_t, char, mbstate_t>
1071
+
1072
+ template <>
1073
+ class _LIBCUDACXX_TYPE_VIS codecvt<char16_t, char, mbstate_t>
1074
+ : public locale::facet,
1075
+ public codecvt_base
1076
+ {
1077
+ public:
1078
+ typedef char16_t intern_type;
1079
+ typedef char extern_type;
1080
+ typedef mbstate_t state_type;
1081
+
1082
+ _LIBCUDACXX_INLINE_VISIBILITY
1083
+ explicit codecvt(size_t __refs = 0)
1084
+ : locale::facet(__refs) {}
1085
+
1086
+ _LIBCUDACXX_INLINE_VISIBILITY
1087
+ result out(state_type& __st,
1088
+ const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1089
+ extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1090
+ {
1091
+ return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1092
+ }
1093
+
1094
+ _LIBCUDACXX_INLINE_VISIBILITY
1095
+ result unshift(state_type& __st,
1096
+ extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1097
+ {
1098
+ return do_unshift(__st, __to, __to_end, __to_nxt);
1099
+ }
1100
+
1101
+ _LIBCUDACXX_INLINE_VISIBILITY
1102
+ result in(state_type& __st,
1103
+ const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1104
+ intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
1105
+ {
1106
+ return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1107
+ }
1108
+
1109
+ _LIBCUDACXX_INLINE_VISIBILITY
1110
+ int encoding() const noexcept
1111
+ {
1112
+ return do_encoding();
1113
+ }
1114
+
1115
+ _LIBCUDACXX_INLINE_VISIBILITY
1116
+ bool always_noconv() const noexcept
1117
+ {
1118
+ return do_always_noconv();
1119
+ }
1120
+
1121
+ _LIBCUDACXX_INLINE_VISIBILITY
1122
+ int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
1123
+ {
1124
+ return do_length(__st, __frm, __end, __mx);
1125
+ }
1126
+
1127
+ _LIBCUDACXX_INLINE_VISIBILITY
1128
+ int max_length() const noexcept
1129
+ {
1130
+ return do_max_length();
1131
+ }
1132
+
1133
+ static locale::id id;
1134
+
1135
+ protected:
1136
+ _LIBCUDACXX_INLINE_VISIBILITY
1137
+ explicit codecvt(const char*, size_t __refs = 0)
1138
+ : locale::facet(__refs) {}
1139
+
1140
+ ~codecvt();
1141
+
1142
+ virtual result do_out(state_type& __st,
1143
+ const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1144
+ extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1145
+ virtual result do_in(state_type& __st,
1146
+ const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1147
+ intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
1148
+ virtual result do_unshift(state_type& __st,
1149
+ extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1150
+ virtual int do_encoding() const noexcept;
1151
+ virtual bool do_always_noconv() const noexcept;
1152
+ virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
1153
+ virtual int do_max_length() const noexcept;
1154
+ };
1155
+
1156
+ // template <> class codecvt<char32_t, char, mbstate_t>
1157
+
1158
+ template <>
1159
+ class _LIBCUDACXX_TYPE_VIS codecvt<char32_t, char, mbstate_t>
1160
+ : public locale::facet,
1161
+ public codecvt_base
1162
+ {
1163
+ public:
1164
+ typedef char32_t intern_type;
1165
+ typedef char extern_type;
1166
+ typedef mbstate_t state_type;
1167
+
1168
+ _LIBCUDACXX_INLINE_VISIBILITY
1169
+ explicit codecvt(size_t __refs = 0)
1170
+ : locale::facet(__refs) {}
1171
+
1172
+ _LIBCUDACXX_INLINE_VISIBILITY
1173
+ result out(state_type& __st,
1174
+ const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1175
+ extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1176
+ {
1177
+ return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1178
+ }
1179
+
1180
+ _LIBCUDACXX_INLINE_VISIBILITY
1181
+ result unshift(state_type& __st,
1182
+ extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
1183
+ {
1184
+ return do_unshift(__st, __to, __to_end, __to_nxt);
1185
+ }
1186
+
1187
+ _LIBCUDACXX_INLINE_VISIBILITY
1188
+ result in(state_type& __st,
1189
+ const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1190
+ intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
1191
+ {
1192
+ return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
1193
+ }
1194
+
1195
+ _LIBCUDACXX_INLINE_VISIBILITY
1196
+ int encoding() const noexcept
1197
+ {
1198
+ return do_encoding();
1199
+ }
1200
+
1201
+ _LIBCUDACXX_INLINE_VISIBILITY
1202
+ bool always_noconv() const noexcept
1203
+ {
1204
+ return do_always_noconv();
1205
+ }
1206
+
1207
+ _LIBCUDACXX_INLINE_VISIBILITY
1208
+ int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
1209
+ {
1210
+ return do_length(__st, __frm, __end, __mx);
1211
+ }
1212
+
1213
+ _LIBCUDACXX_INLINE_VISIBILITY
1214
+ int max_length() const noexcept
1215
+ {
1216
+ return do_max_length();
1217
+ }
1218
+
1219
+ static locale::id id;
1220
+
1221
+ protected:
1222
+ _LIBCUDACXX_INLINE_VISIBILITY
1223
+ explicit codecvt(const char*, size_t __refs = 0)
1224
+ : locale::facet(__refs) {}
1225
+
1226
+ ~codecvt();
1227
+
1228
+ virtual result do_out(state_type& __st,
1229
+ const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
1230
+ extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1231
+ virtual result do_in(state_type& __st,
1232
+ const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
1233
+ intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
1234
+ virtual result do_unshift(state_type& __st,
1235
+ extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
1236
+ virtual int do_encoding() const noexcept;
1237
+ virtual bool do_always_noconv() const noexcept;
1238
+ virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
1239
+ virtual int do_max_length() const noexcept;
1240
+ };
1241
+
1242
+ // template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
1243
+
1244
+ template <class _InternT, class _ExternT, class _StateT>
1245
+ class _LIBCUDACXX_TEMPLATE_VIS codecvt_byname
1246
+ : public codecvt<_InternT, _ExternT, _StateT>
1247
+ {
1248
+ public:
1249
+ _LIBCUDACXX_INLINE_VISIBILITY
1250
+ explicit codecvt_byname(const char* __nm, size_t __refs = 0)
1251
+ : codecvt<_InternT, _ExternT, _StateT>(__nm, __refs) {}
1252
+ _LIBCUDACXX_INLINE_VISIBILITY
1253
+ explicit codecvt_byname(const string& __nm, size_t __refs = 0)
1254
+ : codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {}
1255
+ protected:
1256
+ ~codecvt_byname();
1257
+ };
1258
+
1259
+ template <class _InternT, class _ExternT, class _StateT>
1260
+ codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
1261
+ {
1262
+ }
1263
+
1264
+ _LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char, char, mbstate_t>)
1265
+ _LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>)
1266
+ _LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>)
1267
+ _LIBCUDACXX_EXTERN_TEMPLATE2(class _LIBCUDACXX_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>)
1268
+
1269
+ template <size_t _Np>
1270
+ struct __narrow_to_utf8
1271
+ {
1272
+ template <class _OutputIterator, class _CharT>
1273
+ _OutputIterator
1274
+ operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const;
1275
+ };
1276
+
1277
+ template <>
1278
+ struct __narrow_to_utf8<8>
1279
+ {
1280
+ template <class _OutputIterator, class _CharT>
1281
+ _LIBCUDACXX_INLINE_VISIBILITY
1282
+ _OutputIterator
1283
+ operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
1284
+ {
1285
+ for (; __wb < __we; ++__wb, ++__s)
1286
+ *__s = *__wb;
1287
+ return __s;
1288
+ }
1289
+ };
1290
+
1291
+ template <>
1292
+ struct _LIBCUDACXX_TEMPLATE_VIS __narrow_to_utf8<16>
1293
+ : public codecvt<char16_t, char, mbstate_t>
1294
+ {
1295
+ _LIBCUDACXX_INLINE_VISIBILITY
1296
+ __narrow_to_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
1297
+
1298
+ _LIBCUDACXX_EXPORTED_FROM_ABI ~__narrow_to_utf8();
1299
+
1300
+ template <class _OutputIterator, class _CharT>
1301
+ _LIBCUDACXX_INLINE_VISIBILITY
1302
+ _OutputIterator
1303
+ operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
1304
+ {
1305
+ result __r = ok;
1306
+ mbstate_t __mb;
1307
+ while (__wb < __we && __r != error)
1308
+ {
1309
+ const int __sz = 32;
1310
+ char __buf[__sz];
1311
+ char* __bn;
1312
+ const char16_t* __wn = (const char16_t*)__wb;
1313
+ __r = do_out(__mb, (const char16_t*)__wb, (const char16_t*)__we, __wn,
1314
+ __buf, __buf+__sz, __bn);
1315
+ if (__r == codecvt_base::error || __wn == (const char16_t*)__wb)
1316
+ __throw_runtime_error("locale not supported");
1317
+ for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
1318
+ *__s = *__p;
1319
+ __wb = (const _CharT*)__wn;
1320
+ }
1321
+ return __s;
1322
+ }
1323
+ };
1324
+
1325
+ template <>
1326
+ struct _LIBCUDACXX_TEMPLATE_VIS __narrow_to_utf8<32>
1327
+ : public codecvt<char32_t, char, mbstate_t>
1328
+ {
1329
+ _LIBCUDACXX_INLINE_VISIBILITY
1330
+ __narrow_to_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
1331
+
1332
+ _LIBCUDACXX_EXPORTED_FROM_ABI ~__narrow_to_utf8();
1333
+
1334
+ template <class _OutputIterator, class _CharT>
1335
+ _LIBCUDACXX_INLINE_VISIBILITY
1336
+ _OutputIterator
1337
+ operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
1338
+ {
1339
+ result __r = ok;
1340
+ mbstate_t __mb;
1341
+ while (__wb < __we && __r != error)
1342
+ {
1343
+ const int __sz = 32;
1344
+ char __buf[__sz];
1345
+ char* __bn;
1346
+ const char32_t* __wn = (const char32_t*)__wb;
1347
+ __r = do_out(__mb, (const char32_t*)__wb, (const char32_t*)__we, __wn,
1348
+ __buf, __buf+__sz, __bn);
1349
+ if (__r == codecvt_base::error || __wn == (const char32_t*)__wb)
1350
+ __throw_runtime_error("locale not supported");
1351
+ for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
1352
+ *__s = *__p;
1353
+ __wb = (const _CharT*)__wn;
1354
+ }
1355
+ return __s;
1356
+ }
1357
+ };
1358
+
1359
+ template <size_t _Np>
1360
+ struct __widen_from_utf8
1361
+ {
1362
+ template <class _OutputIterator>
1363
+ _OutputIterator
1364
+ operator()(_OutputIterator __s, const char* __nb, const char* __ne) const;
1365
+ };
1366
+
1367
+ template <>
1368
+ struct __widen_from_utf8<8>
1369
+ {
1370
+ template <class _OutputIterator>
1371
+ _LIBCUDACXX_INLINE_VISIBILITY
1372
+ _OutputIterator
1373
+ operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
1374
+ {
1375
+ for (; __nb < __ne; ++__nb, ++__s)
1376
+ *__s = *__nb;
1377
+ return __s;
1378
+ }
1379
+ };
1380
+
1381
+ template <>
1382
+ struct _LIBCUDACXX_TEMPLATE_VIS __widen_from_utf8<16>
1383
+ : public codecvt<char16_t, char, mbstate_t>
1384
+ {
1385
+ _LIBCUDACXX_INLINE_VISIBILITY
1386
+ __widen_from_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
1387
+
1388
+ _LIBCUDACXX_EXPORTED_FROM_ABI ~__widen_from_utf8();
1389
+
1390
+ template <class _OutputIterator>
1391
+ _LIBCUDACXX_INLINE_VISIBILITY
1392
+ _OutputIterator
1393
+ operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
1394
+ {
1395
+ result __r = ok;
1396
+ mbstate_t __mb;
1397
+ while (__nb < __ne && __r != error)
1398
+ {
1399
+ const int __sz = 32;
1400
+ char16_t __buf[__sz];
1401
+ char16_t* __bn;
1402
+ const char* __nn = __nb;
1403
+ __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn,
1404
+ __buf, __buf+__sz, __bn);
1405
+ if (__r == codecvt_base::error || __nn == __nb)
1406
+ __throw_runtime_error("locale not supported");
1407
+ for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s)
1408
+ *__s = (wchar_t)*__p;
1409
+ __nb = __nn;
1410
+ }
1411
+ return __s;
1412
+ }
1413
+ };
1414
+
1415
+ template <>
1416
+ struct _LIBCUDACXX_TEMPLATE_VIS __widen_from_utf8<32>
1417
+ : public codecvt<char32_t, char, mbstate_t>
1418
+ {
1419
+ _LIBCUDACXX_INLINE_VISIBILITY
1420
+ __widen_from_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
1421
+
1422
+ _LIBCUDACXX_EXPORTED_FROM_ABI ~__widen_from_utf8();
1423
+
1424
+ template <class _OutputIterator>
1425
+ _LIBCUDACXX_INLINE_VISIBILITY
1426
+ _OutputIterator
1427
+ operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
1428
+ {
1429
+ result __r = ok;
1430
+ mbstate_t __mb;
1431
+ while (__nb < __ne && __r != error)
1432
+ {
1433
+ const int __sz = 32;
1434
+ char32_t __buf[__sz];
1435
+ char32_t* __bn;
1436
+ const char* __nn = __nb;
1437
+ __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn,
1438
+ __buf, __buf+__sz, __bn);
1439
+ if (__r == codecvt_base::error || __nn == __nb)
1440
+ __throw_runtime_error("locale not supported");
1441
+ for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s)
1442
+ *__s = (wchar_t)*__p;
1443
+ __nb = __nn;
1444
+ }
1445
+ return __s;
1446
+ }
1447
+ };
1448
+
1449
+ // template <class charT> class numpunct
1450
+
1451
+ template <class _CharT> class _LIBCUDACXX_TEMPLATE_VIS numpunct;
1452
+
1453
+ template <>
1454
+ class _LIBCUDACXX_TYPE_VIS numpunct<char>
1455
+ : public locale::facet
1456
+ {
1457
+ public:
1458
+ typedef char char_type;
1459
+ typedef basic_string<char_type> string_type;
1460
+
1461
+ explicit numpunct(size_t __refs = 0);
1462
+
1463
+ _LIBCUDACXX_INLINE_VISIBILITY char_type decimal_point() const {return do_decimal_point();}
1464
+ _LIBCUDACXX_INLINE_VISIBILITY char_type thousands_sep() const {return do_thousands_sep();}
1465
+ _LIBCUDACXX_INLINE_VISIBILITY string grouping() const {return do_grouping();}
1466
+ _LIBCUDACXX_INLINE_VISIBILITY string_type truename() const {return do_truename();}
1467
+ _LIBCUDACXX_INLINE_VISIBILITY string_type falsename() const {return do_falsename();}
1468
+
1469
+ static locale::id id;
1470
+
1471
+ protected:
1472
+ ~numpunct();
1473
+ virtual char_type do_decimal_point() const;
1474
+ virtual char_type do_thousands_sep() const;
1475
+ virtual string do_grouping() const;
1476
+ virtual string_type do_truename() const;
1477
+ virtual string_type do_falsename() const;
1478
+
1479
+ char_type __decimal_point_;
1480
+ char_type __thousands_sep_;
1481
+ string __grouping_;
1482
+ };
1483
+
1484
+ template <>
1485
+ class _LIBCUDACXX_TYPE_VIS numpunct<wchar_t>
1486
+ : public locale::facet
1487
+ {
1488
+ public:
1489
+ typedef wchar_t char_type;
1490
+ typedef basic_string<char_type> string_type;
1491
+
1492
+ explicit numpunct(size_t __refs = 0);
1493
+
1494
+ _LIBCUDACXX_INLINE_VISIBILITY char_type decimal_point() const {return do_decimal_point();}
1495
+ _LIBCUDACXX_INLINE_VISIBILITY char_type thousands_sep() const {return do_thousands_sep();}
1496
+ _LIBCUDACXX_INLINE_VISIBILITY string grouping() const {return do_grouping();}
1497
+ _LIBCUDACXX_INLINE_VISIBILITY string_type truename() const {return do_truename();}
1498
+ _LIBCUDACXX_INLINE_VISIBILITY string_type falsename() const {return do_falsename();}
1499
+
1500
+ static locale::id id;
1501
+
1502
+ protected:
1503
+ ~numpunct();
1504
+ virtual char_type do_decimal_point() const;
1505
+ virtual char_type do_thousands_sep() const;
1506
+ virtual string do_grouping() const;
1507
+ virtual string_type do_truename() const;
1508
+ virtual string_type do_falsename() const;
1509
+
1510
+ char_type __decimal_point_;
1511
+ char_type __thousands_sep_;
1512
+ string __grouping_;
1513
+ };
1514
+
1515
+ // template <class charT> class numpunct_byname
1516
+
1517
+ template <class _CharT> class _LIBCUDACXX_TEMPLATE_VIS numpunct_byname;
1518
+
1519
+ template <>
1520
+ class _LIBCUDACXX_TYPE_VIS numpunct_byname<char>
1521
+ : public numpunct<char>
1522
+ {
1523
+ public:
1524
+ typedef char char_type;
1525
+ typedef basic_string<char_type> string_type;
1526
+
1527
+ explicit numpunct_byname(const char* __nm, size_t __refs = 0);
1528
+ explicit numpunct_byname(const string& __nm, size_t __refs = 0);
1529
+
1530
+ protected:
1531
+ ~numpunct_byname();
1532
+
1533
+ private:
1534
+ void __init(const char*);
1535
+ };
1536
+
1537
+ template <>
1538
+ class _LIBCUDACXX_TYPE_VIS numpunct_byname<wchar_t>
1539
+ : public numpunct<wchar_t>
1540
+ {
1541
+ public:
1542
+ typedef wchar_t char_type;
1543
+ typedef basic_string<char_type> string_type;
1544
+
1545
+ explicit numpunct_byname(const char* __nm, size_t __refs = 0);
1546
+ explicit numpunct_byname(const string& __nm, size_t __refs = 0);
1547
+
1548
+ protected:
1549
+ ~numpunct_byname();
1550
+
1551
+ private:
1552
+ void __init(const char*);
1553
+ };
1554
+
1555
+ _LIBCUDACXX_END_NAMESPACE_STD
1556
+
1557
+ #endif // _LIBCUDACXX___LOCALE
cuda_toolkit/include/__mutex_base ADDED
@@ -0,0 +1,542 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___MUTEX_BASE
11
+ #define _LIBCUDACXX___MUTEX_BASE
12
+
13
+ #include <__config>
14
+ #include <chrono>
15
+ #include <system_error>
16
+ #include <__threading_support>
17
+
18
+ #include <time.h>
19
+
20
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
21
+ # pragma GCC system_header
22
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
23
+ # pragma clang system_header
24
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
25
+ # pragma system_header
26
+ #endif // no system header
27
+
28
+ _LIBCUDACXX_PUSH_MACROS
29
+ #include <__undef_macros>
30
+
31
+
32
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
33
+
34
+ #ifndef _LIBCUDACXX_HAS_NO_THREADS
35
+
36
+ #ifndef _LIBCUDACXX_THREAD_SAFETY_ANNOTATION
37
+ # ifdef _LIBCUDACXX_HAS_THREAD_SAFETY_ANNOTATIONS
38
+ # define _LIBCUDACXX_THREAD_SAFETY_ANNOTATION(x) __attribute__((x))
39
+ # else
40
+ # define _LIBCUDACXX_THREAD_SAFETY_ANNOTATION(x)
41
+ # endif
42
+ #endif // _LIBCUDACXX_THREAD_SAFETY_ANNOTATION
43
+
44
+
45
+ class _LIBCUDACXX_TYPE_VIS _LIBCUDACXX_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex
46
+ {
47
+ __libcpp_mutex_t __m_ = _LIBCUDACXX_MUTEX_INITIALIZER;
48
+
49
+ public:
50
+ _LIBCUDACXX_INLINE_VISIBILITY
51
+ constexpr mutex() = default;
52
+
53
+ mutex(const mutex&) = delete;
54
+ mutex& operator=(const mutex&) = delete;
55
+
56
+ #if defined(_LIBCUDACXX_HAS_TRIVIAL_MUTEX_DESTRUCTION)
57
+ ~mutex() = default;
58
+ #else
59
+ ~mutex() noexcept;
60
+ #endif
61
+
62
+ void lock() _LIBCUDACXX_THREAD_SAFETY_ANNOTATION(acquire_capability());
63
+ bool try_lock() noexcept _LIBCUDACXX_THREAD_SAFETY_ANNOTATION(try_acquire_capability(true));
64
+ void unlock() noexcept _LIBCUDACXX_THREAD_SAFETY_ANNOTATION(release_capability());
65
+
66
+ typedef __libcpp_mutex_t* native_handle_type;
67
+ _LIBCUDACXX_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;}
68
+ };
69
+
70
+ static_assert(is_nothrow_default_constructible<mutex>::value,
71
+ "the default constructor for std::mutex must be nothrow");
72
+
73
+ struct _LIBCUDACXX_TYPE_VIS defer_lock_t { explicit defer_lock_t() = default; };
74
+ struct _LIBCUDACXX_TYPE_VIS try_to_lock_t { explicit try_to_lock_t() = default; };
75
+ struct _LIBCUDACXX_TYPE_VIS adopt_lock_t { explicit adopt_lock_t() = default; };
76
+
77
+ #if defined(_LIBCUDACXX_BUILDING_LIBRARY)
78
+
79
+ extern _LIBCUDACXX_EXPORTED_FROM_ABI const defer_lock_t defer_lock;
80
+ extern _LIBCUDACXX_EXPORTED_FROM_ABI const try_to_lock_t try_to_lock;
81
+ extern _LIBCUDACXX_EXPORTED_FROM_ABI const adopt_lock_t adopt_lock;
82
+
83
+ #else
84
+
85
+ /* _LIBCUDACXX_INLINE_VAR */ constexpr defer_lock_t defer_lock = defer_lock_t();
86
+ /* _LIBCUDACXX_INLINE_VAR */ constexpr try_to_lock_t try_to_lock = try_to_lock_t();
87
+ /* _LIBCUDACXX_INLINE_VAR */ constexpr adopt_lock_t adopt_lock = adopt_lock_t();
88
+
89
+ #endif
90
+
91
+ template <class _Mutex>
92
+ class _LIBCUDACXX_TEMPLATE_VIS _LIBCUDACXX_THREAD_SAFETY_ANNOTATION(scoped_lockable)
93
+ lock_guard
94
+ {
95
+ public:
96
+ typedef _Mutex mutex_type;
97
+
98
+ private:
99
+ mutex_type& __m_;
100
+ public:
101
+
102
+ _LIBCUDACXX_NODISCARD_EXT _LIBCUDACXX_INLINE_VISIBILITY
103
+ explicit lock_guard(mutex_type& __m) _LIBCUDACXX_THREAD_SAFETY_ANNOTATION(acquire_capability(__m))
104
+ : __m_(__m) {__m_.lock();}
105
+
106
+ _LIBCUDACXX_NODISCARD_EXT _LIBCUDACXX_INLINE_VISIBILITY
107
+ lock_guard(mutex_type& __m, adopt_lock_t) _LIBCUDACXX_THREAD_SAFETY_ANNOTATION(requires_capability(__m))
108
+ : __m_(__m) {}
109
+ _LIBCUDACXX_INLINE_VISIBILITY
110
+ ~lock_guard() _LIBCUDACXX_THREAD_SAFETY_ANNOTATION(release_capability()) {__m_.unlock();}
111
+
112
+ private:
113
+ lock_guard(lock_guard const&) = delete;
114
+ lock_guard& operator=(lock_guard const&) = delete;
115
+ };
116
+
117
+ template <class _Mutex>
118
+ class _LIBCUDACXX_TEMPLATE_VIS unique_lock
119
+ {
120
+ public:
121
+ typedef _Mutex mutex_type;
122
+
123
+ private:
124
+ mutex_type* __m_;
125
+ bool __owns_;
126
+
127
+ public:
128
+ _LIBCUDACXX_INLINE_VISIBILITY
129
+ unique_lock() noexcept : __m_(nullptr), __owns_(false) {}
130
+ _LIBCUDACXX_INLINE_VISIBILITY
131
+ explicit unique_lock(mutex_type& __m)
132
+ : __m_(_CUDA_VSTD::addressof(__m)), __owns_(true) {__m_->lock();}
133
+ _LIBCUDACXX_INLINE_VISIBILITY
134
+ unique_lock(mutex_type& __m, defer_lock_t) noexcept
135
+ : __m_(_CUDA_VSTD::addressof(__m)), __owns_(false) {}
136
+ _LIBCUDACXX_INLINE_VISIBILITY
137
+ unique_lock(mutex_type& __m, try_to_lock_t)
138
+ : __m_(_CUDA_VSTD::addressof(__m)), __owns_(__m.try_lock()) {}
139
+ _LIBCUDACXX_INLINE_VISIBILITY
140
+ unique_lock(mutex_type& __m, adopt_lock_t)
141
+ : __m_(_CUDA_VSTD::addressof(__m)), __owns_(true) {}
142
+ template <class _Clock, class _Duration>
143
+ _LIBCUDACXX_INLINE_VISIBILITY
144
+ unique_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __t)
145
+ : __m_(_CUDA_VSTD::addressof(__m)), __owns_(__m.try_lock_until(__t)) {}
146
+ template <class _Rep, class _Period>
147
+ _LIBCUDACXX_INLINE_VISIBILITY
148
+ unique_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __d)
149
+ : __m_(_CUDA_VSTD::addressof(__m)), __owns_(__m.try_lock_for(__d)) {}
150
+ _LIBCUDACXX_INLINE_VISIBILITY
151
+ ~unique_lock()
152
+ {
153
+ if (__owns_)
154
+ __m_->unlock();
155
+ }
156
+
157
+ private:
158
+ unique_lock(unique_lock const&); // = delete;
159
+ unique_lock& operator=(unique_lock const&); // = delete;
160
+
161
+ public:
162
+ _LIBCUDACXX_INLINE_VISIBILITY
163
+ unique_lock(unique_lock&& __u) noexcept
164
+ : __m_(__u.__m_), __owns_(__u.__owns_)
165
+ {__u.__m_ = nullptr; __u.__owns_ = false;}
166
+ _LIBCUDACXX_INLINE_VISIBILITY
167
+ unique_lock& operator=(unique_lock&& __u) noexcept
168
+ {
169
+ if (__owns_)
170
+ __m_->unlock();
171
+ __m_ = __u.__m_;
172
+ __owns_ = __u.__owns_;
173
+ __u.__m_ = nullptr;
174
+ __u.__owns_ = false;
175
+ return *this;
176
+ }
177
+
178
+ void lock();
179
+ bool try_lock();
180
+
181
+ template <class _Rep, class _Period>
182
+ bool try_lock_for(const chrono::duration<_Rep, _Period>& __d);
183
+ template <class _Clock, class _Duration>
184
+ bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
185
+
186
+ void unlock();
187
+
188
+ _LIBCUDACXX_INLINE_VISIBILITY
189
+ void swap(unique_lock& __u) noexcept
190
+ {
191
+ _CUDA_VSTD::swap(__m_, __u.__m_);
192
+ _CUDA_VSTD::swap(__owns_, __u.__owns_);
193
+ }
194
+ _LIBCUDACXX_INLINE_VISIBILITY
195
+ mutex_type* release() noexcept
196
+ {
197
+ mutex_type* __m = __m_;
198
+ __m_ = nullptr;
199
+ __owns_ = false;
200
+ return __m;
201
+ }
202
+
203
+ _LIBCUDACXX_INLINE_VISIBILITY
204
+ bool owns_lock() const noexcept {return __owns_;}
205
+ _LIBCUDACXX_INLINE_VISIBILITY
206
+ _LIBCUDACXX_EXPLICIT
207
+ operator bool () const noexcept {return __owns_;}
208
+ _LIBCUDACXX_INLINE_VISIBILITY
209
+ mutex_type* mutex() const noexcept {return __m_;}
210
+ };
211
+
212
+ template <class _Mutex>
213
+ void
214
+ unique_lock<_Mutex>::lock()
215
+ {
216
+ if (__m_ == nullptr)
217
+ __throw_system_error(EPERM, "unique_lock::lock: references null mutex");
218
+ if (__owns_)
219
+ __throw_system_error(EDEADLK, "unique_lock::lock: already locked");
220
+ __m_->lock();
221
+ __owns_ = true;
222
+ }
223
+
224
+ template <class _Mutex>
225
+ bool
226
+ unique_lock<_Mutex>::try_lock()
227
+ {
228
+ if (__m_ == nullptr)
229
+ __throw_system_error(EPERM, "unique_lock::try_lock: references null mutex");
230
+ if (__owns_)
231
+ __throw_system_error(EDEADLK, "unique_lock::try_lock: already locked");
232
+ __owns_ = __m_->try_lock();
233
+ return __owns_;
234
+ }
235
+
236
+ template <class _Mutex>
237
+ template <class _Rep, class _Period>
238
+ bool
239
+ unique_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d)
240
+ {
241
+ if (__m_ == nullptr)
242
+ __throw_system_error(EPERM, "unique_lock::try_lock_for: references null mutex");
243
+ if (__owns_)
244
+ __throw_system_error(EDEADLK, "unique_lock::try_lock_for: already locked");
245
+ __owns_ = __m_->try_lock_for(__d);
246
+ return __owns_;
247
+ }
248
+
249
+ template <class _Mutex>
250
+ template <class _Clock, class _Duration>
251
+ bool
252
+ unique_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
253
+ {
254
+ if (__m_ == nullptr)
255
+ __throw_system_error(EPERM, "unique_lock::try_lock_until: references null mutex");
256
+ if (__owns_)
257
+ __throw_system_error(EDEADLK, "unique_lock::try_lock_until: already locked");
258
+ __owns_ = __m_->try_lock_until(__t);
259
+ return __owns_;
260
+ }
261
+
262
+ template <class _Mutex>
263
+ void
264
+ unique_lock<_Mutex>::unlock()
265
+ {
266
+ if (!__owns_)
267
+ __throw_system_error(EPERM, "unique_lock::unlock: not locked");
268
+ __m_->unlock();
269
+ __owns_ = false;
270
+ }
271
+
272
+ template <class _Mutex>
273
+ inline _LIBCUDACXX_INLINE_VISIBILITY
274
+ void
275
+ swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) noexcept
276
+ {__x.swap(__y);}
277
+
278
+ //enum class cv_status
279
+ _LIBCUDACXX_DECLARE_STRONG_ENUM(cv_status)
280
+ {
281
+ no_timeout,
282
+ timeout
283
+ };
284
+ _LIBCUDACXX_DECLARE_STRONG_ENUM_EPILOG(cv_status)
285
+
286
+ class _LIBCUDACXX_TYPE_VIS condition_variable
287
+ {
288
+ __libcpp_condvar_t __cv_ = _LIBCUDACXX_CONDVAR_INITIALIZER;
289
+ public:
290
+ _LIBCUDACXX_INLINE_VISIBILITY
291
+ constexpr condition_variable() noexcept = default;
292
+
293
+ #ifdef _LIBCUDACXX_HAS_TRIVIAL_CONDVAR_DESTRUCTION
294
+ ~condition_variable() = default;
295
+ #else
296
+ ~condition_variable();
297
+ #endif
298
+
299
+ condition_variable(const condition_variable&) = delete;
300
+ condition_variable& operator=(const condition_variable&) = delete;
301
+
302
+ void notify_one() noexcept;
303
+ void notify_all() noexcept;
304
+
305
+ void wait(unique_lock<mutex>& __lk) noexcept;
306
+ template <class _Predicate>
307
+ _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
308
+ void wait(unique_lock<mutex>& __lk, _Predicate __pred);
309
+
310
+ template <class _Clock, class _Duration>
311
+ _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
312
+ cv_status
313
+ wait_until(unique_lock<mutex>& __lk,
314
+ const chrono::time_point<_Clock, _Duration>& __t);
315
+
316
+ template <class _Clock, class _Duration, class _Predicate>
317
+ _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
318
+ bool
319
+ wait_until(unique_lock<mutex>& __lk,
320
+ const chrono::time_point<_Clock, _Duration>& __t,
321
+ _Predicate __pred);
322
+
323
+ template <class _Rep, class _Period>
324
+ _LIBCUDACXX_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
325
+ cv_status
326
+ wait_for(unique_lock<mutex>& __lk,
327
+ const chrono::duration<_Rep, _Period>& __d);
328
+
329
+ template <class _Rep, class _Period, class _Predicate>
330
+ bool
331
+ _LIBCUDACXX_INLINE_VISIBILITY
332
+ wait_for(unique_lock<mutex>& __lk,
333
+ const chrono::duration<_Rep, _Period>& __d,
334
+ _Predicate __pred);
335
+
336
+ typedef __libcpp_condvar_t* native_handle_type;
337
+ _LIBCUDACXX_INLINE_VISIBILITY native_handle_type native_handle() {return &__cv_;}
338
+
339
+ private:
340
+ void __do_timed_wait(unique_lock<mutex>& __lk,
341
+ chrono::time_point<chrono::system_clock, chrono::nanoseconds>) noexcept;
342
+ #if defined(_LIBCUDACXX_HAS_COND_CLOCKWAIT)
343
+ void __do_timed_wait(unique_lock<mutex>& __lk,
344
+ chrono::time_point<chrono::steady_clock, chrono::nanoseconds>) noexcept;
345
+ #endif
346
+ template <class _Clock>
347
+ void __do_timed_wait(unique_lock<mutex>& __lk,
348
+ chrono::time_point<_Clock, chrono::nanoseconds>) noexcept;
349
+ };
350
+ #endif // !_LIBCUDACXX_HAS_NO_THREADS
351
+
352
+ template <class _Rep, class _Period>
353
+ inline _LIBCUDACXX_INLINE_VISIBILITY
354
+ typename enable_if
355
+ <
356
+ is_floating_point<_Rep>::value,
357
+ chrono::nanoseconds
358
+ >::type
359
+ __safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d)
360
+ {
361
+ using namespace chrono;
362
+ using __ratio = ratio_divide<_Period, nano>;
363
+ using __ns_rep = nanoseconds::rep;
364
+ _Rep __result_float = __d.count() * __ratio::num / __ratio::den;
365
+
366
+ _Rep __result_max = numeric_limits<__ns_rep>::max();
367
+ if (__result_float >= __result_max) {
368
+ return nanoseconds::max();
369
+ }
370
+
371
+ _Rep __result_min = numeric_limits<__ns_rep>::min();
372
+ if (__result_float <= __result_min) {
373
+ return nanoseconds::min();
374
+ }
375
+
376
+ return nanoseconds(static_cast<__ns_rep>(__result_float));
377
+ }
378
+
379
+ template <class _Rep, class _Period>
380
+ inline _LIBCUDACXX_INLINE_VISIBILITY
381
+ typename enable_if
382
+ <
383
+ !is_floating_point<_Rep>::value,
384
+ chrono::nanoseconds
385
+ >::type
386
+ __safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d)
387
+ {
388
+ using namespace chrono;
389
+ if (__d.count() == 0) {
390
+ return nanoseconds(0);
391
+ }
392
+
393
+ using __ratio = ratio_divide<_Period, nano>;
394
+ using __ns_rep = nanoseconds::rep;
395
+ __ns_rep __result_max = std::numeric_limits<__ns_rep>::max();
396
+ if (__d.count() > 0 && __d.count() > __result_max / __ratio::num) {
397
+ return nanoseconds::max();
398
+ }
399
+
400
+ __ns_rep __result_min = std::numeric_limits<__ns_rep>::min();
401
+ if (__d.count() < 0 && __d.count() < __result_min / __ratio::num) {
402
+ return nanoseconds::min();
403
+ }
404
+
405
+ __ns_rep __result = __d.count() * __ratio::num / __ratio::den;
406
+ if (__result == 0) {
407
+ return nanoseconds(1);
408
+ }
409
+
410
+ return nanoseconds(__result);
411
+ }
412
+
413
+ #ifndef _LIBCUDACXX_HAS_NO_THREADS
414
+ template <class _Predicate>
415
+ void
416
+ condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred)
417
+ {
418
+ while (!__pred())
419
+ wait(__lk);
420
+ }
421
+
422
+ template <class _Clock, class _Duration>
423
+ cv_status
424
+ condition_variable::wait_until(unique_lock<mutex>& __lk,
425
+ const chrono::time_point<_Clock, _Duration>& __t)
426
+ {
427
+ using namespace chrono;
428
+ using __clock_tp_ns = time_point<_Clock, nanoseconds>;
429
+
430
+ typename _Clock::time_point __now = _Clock::now();
431
+ if (__t <= __now)
432
+ return cv_status::timeout;
433
+
434
+ __clock_tp_ns __t_ns = __clock_tp_ns(__safe_nanosecond_cast(__t.time_since_epoch()));
435
+
436
+ __do_timed_wait(__lk, __t_ns);
437
+ return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout;
438
+ }
439
+
440
+ template <class _Clock, class _Duration, class _Predicate>
441
+ bool
442
+ condition_variable::wait_until(unique_lock<mutex>& __lk,
443
+ const chrono::time_point<_Clock, _Duration>& __t,
444
+ _Predicate __pred)
445
+ {
446
+ while (!__pred())
447
+ {
448
+ if (wait_until(__lk, __t) == cv_status::timeout)
449
+ return __pred();
450
+ }
451
+ return true;
452
+ }
453
+
454
+ template <class _Rep, class _Period>
455
+ cv_status
456
+ condition_variable::wait_for(unique_lock<mutex>& __lk,
457
+ const chrono::duration<_Rep, _Period>& __d)
458
+ {
459
+ using namespace chrono;
460
+ if (__d <= __d.zero())
461
+ return cv_status::timeout;
462
+ using __ns_rep = nanoseconds::rep;
463
+ steady_clock::time_point __c_now = steady_clock::now();
464
+
465
+ #if defined(_LIBCUDACXX_HAS_COND_CLOCKWAIT)
466
+ using __clock_tp_ns = time_point<steady_clock, nanoseconds>;
467
+ __ns_rep __now_count_ns = __safe_nanosecond_cast(__c_now.time_since_epoch()).count();
468
+ #else
469
+ using __clock_tp_ns = time_point<system_clock, nanoseconds>;
470
+ __ns_rep __now_count_ns = __safe_nanosecond_cast(system_clock::now().time_since_epoch()).count();
471
+ #endif
472
+
473
+ __ns_rep __d_ns_count = __safe_nanosecond_cast(__d).count();
474
+
475
+ if (__now_count_ns > numeric_limits<__ns_rep>::max() - __d_ns_count) {
476
+ __do_timed_wait(__lk, __clock_tp_ns::max());
477
+ } else {
478
+ __do_timed_wait(__lk, __clock_tp_ns(nanoseconds(__now_count_ns + __d_ns_count)));
479
+ }
480
+
481
+ return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
482
+ cv_status::timeout;
483
+ }
484
+
485
+ template <class _Rep, class _Period, class _Predicate>
486
+ inline
487
+ bool
488
+ condition_variable::wait_for(unique_lock<mutex>& __lk,
489
+ const chrono::duration<_Rep, _Period>& __d,
490
+ _Predicate __pred)
491
+ {
492
+ return wait_until(__lk, chrono::steady_clock::now() + __d,
493
+ _CUDA_VSTD::move(__pred));
494
+ }
495
+
496
+ #if defined(_LIBCUDACXX_HAS_COND_CLOCKWAIT)
497
+ inline
498
+ void
499
+ condition_variable::__do_timed_wait(unique_lock<mutex>& __lk,
500
+ chrono::time_point<chrono::steady_clock, chrono::nanoseconds> __tp) noexcept
501
+ {
502
+ using namespace chrono;
503
+ if (!__lk.owns_lock())
504
+ __throw_system_error(EPERM,
505
+ "condition_variable::timed wait: mutex not locked");
506
+ nanoseconds __d = __tp.time_since_epoch();
507
+ timespec __ts;
508
+ seconds __s = duration_cast<seconds>(__d);
509
+ using __ts_sec = decltype(__ts.tv_sec);
510
+ const __ts_sec __ts_sec_max = numeric_limits<__ts_sec>::max();
511
+ if (__s.count() < __ts_sec_max)
512
+ {
513
+ __ts.tv_sec = static_cast<__ts_sec>(__s.count());
514
+ __ts.tv_nsec = (__d - __s).count();
515
+ }
516
+ else
517
+ {
518
+ __ts.tv_sec = __ts_sec_max;
519
+ __ts.tv_nsec = giga::num - 1;
520
+ }
521
+ int __ec = pthread_cond_clockwait(&__cv_, __lk.mutex()->native_handle(), CLOCK_MONOTONIC, &__ts);
522
+ if (__ec != 0 && __ec != ETIMEDOUT)
523
+ __throw_system_error(__ec, "condition_variable timed_wait failed");
524
+ }
525
+ #endif // _LIBCUDACXX_HAS_COND_CLOCKWAIT
526
+
527
+ template <class _Clock>
528
+ inline
529
+ void
530
+ condition_variable::__do_timed_wait(unique_lock<mutex>& __lk,
531
+ chrono::time_point<_Clock, chrono::nanoseconds> __tp) noexcept
532
+ {
533
+ wait_for(__lk, __tp - _Clock::now());
534
+ }
535
+
536
+ #endif // !_LIBCUDACXX_HAS_NO_THREADS
537
+
538
+ _LIBCUDACXX_END_NAMESPACE_STD
539
+
540
+ _LIBCUDACXX_POP_MACROS
541
+
542
+ #endif // _LIBCUDACXX___MUTEX_BASE
cuda_toolkit/include/__node_handle ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___NODE_HANDLE
11
+ #define _LIBCUDACXX___NODE_HANDLE
12
+
13
+ #include <__config>
14
+ #include "__assert" // all public C++ headers provide the assertion handler
15
+ #include <memory>
16
+ #include <optional>
17
+
18
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
19
+ # pragma GCC system_header
20
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
21
+ # pragma clang system_header
22
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
23
+ # pragma system_header
24
+ #endif // no system header
25
+
26
+ _LIBCUDACXX_PUSH_MACROS
27
+ #include <__undef_macros>
28
+
29
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
30
+
31
+ #if _LIBCUDACXX_STD_VER > 14
32
+
33
+ // Specialized in __tree & __hash_table for their _NodeType.
34
+ template <class _NodeType, class _Alloc>
35
+ struct __generic_container_node_destructor;
36
+
37
+ template <class _NodeType, class _Alloc,
38
+ template <class, class> class _MapOrSetSpecifics>
39
+ class _LIBCUDACXX_TEMPLATE_VIS __basic_node_handle
40
+ : public _MapOrSetSpecifics<
41
+ _NodeType,
42
+ __basic_node_handle<_NodeType, _Alloc, _MapOrSetSpecifics>>
43
+ {
44
+ template <class _Tp, class _Compare, class _Allocator>
45
+ friend class __tree;
46
+ template <class _Tp, class _Hash, class _Equal, class _Allocator>
47
+ friend class __hash_table;
48
+ friend struct _MapOrSetSpecifics<
49
+ _NodeType, __basic_node_handle<_NodeType, _Alloc, _MapOrSetSpecifics>>;
50
+
51
+ typedef allocator_traits<_Alloc> __alloc_traits;
52
+ typedef typename __rebind_pointer<typename __alloc_traits::void_pointer,
53
+ _NodeType>::type
54
+ __node_pointer_type;
55
+
56
+ public:
57
+ typedef _Alloc allocator_type;
58
+
59
+ private:
60
+ __node_pointer_type __ptr_ = nullptr;
61
+ optional<allocator_type> __alloc_;
62
+
63
+ _LIBCUDACXX_INLINE_VISIBILITY
64
+ void __release_ptr()
65
+ {
66
+ __ptr_ = nullptr;
67
+ __alloc_ = _CUDA_VSTD::nullopt;
68
+ }
69
+
70
+ _LIBCUDACXX_INLINE_VISIBILITY
71
+ void __destroy_node_pointer()
72
+ {
73
+ if (__ptr_ != nullptr)
74
+ {
75
+ typedef typename __allocator_traits_rebind<
76
+ allocator_type, _NodeType>::type __node_alloc_type;
77
+ __node_alloc_type __alloc(*__alloc_);
78
+ __generic_container_node_destructor<_NodeType, __node_alloc_type>(
79
+ __alloc, true)(__ptr_);
80
+ __ptr_ = nullptr;
81
+ }
82
+ }
83
+
84
+ _LIBCUDACXX_INLINE_VISIBILITY
85
+ __basic_node_handle(__node_pointer_type __ptr,
86
+ allocator_type const& __alloc)
87
+ : __ptr_(__ptr), __alloc_(__alloc)
88
+ {
89
+ }
90
+
91
+ public:
92
+ _LIBCUDACXX_INLINE_VISIBILITY
93
+ __basic_node_handle() = default;
94
+
95
+ _LIBCUDACXX_INLINE_VISIBILITY
96
+ __basic_node_handle(__basic_node_handle&& __other) noexcept
97
+ : __ptr_(__other.__ptr_),
98
+ __alloc_(_CUDA_VSTD::move(__other.__alloc_))
99
+ {
100
+ __other.__ptr_ = nullptr;
101
+ __other.__alloc_ = _CUDA_VSTD::nullopt;
102
+ }
103
+
104
+ _LIBCUDACXX_INLINE_VISIBILITY
105
+ __basic_node_handle& operator=(__basic_node_handle&& __other)
106
+ {
107
+ _LIBCUDACXX_ASSERT(
108
+ __alloc_ == _CUDA_VSTD::nullopt ||
109
+ __alloc_traits::propagate_on_container_move_assignment::value ||
110
+ __alloc_ == __other.__alloc_,
111
+ "node_type with incompatible allocator passed to "
112
+ "node_type::operator=(node_type&&)");
113
+
114
+ __destroy_node_pointer();
115
+ __ptr_ = __other.__ptr_;
116
+
117
+ if (__alloc_traits::propagate_on_container_move_assignment::value ||
118
+ __alloc_ == _CUDA_VSTD::nullopt)
119
+ __alloc_ = _CUDA_VSTD::move(__other.__alloc_);
120
+
121
+ __other.__ptr_ = nullptr;
122
+ __other.__alloc_ = _CUDA_VSTD::nullopt;
123
+
124
+ return *this;
125
+ }
126
+
127
+ _LIBCUDACXX_INLINE_VISIBILITY
128
+ allocator_type get_allocator() const { return *__alloc_; }
129
+
130
+ _LIBCUDACXX_INLINE_VISIBILITY
131
+ explicit operator bool() const { return __ptr_ != nullptr; }
132
+
133
+ _LIBCUDACXX_NODISCARD_AFTER_CXX17 _LIBCUDACXX_INLINE_VISIBILITY
134
+ bool empty() const { return __ptr_ == nullptr; }
135
+
136
+ _LIBCUDACXX_INLINE_VISIBILITY
137
+ void swap(__basic_node_handle& __other) noexcept(
138
+ __alloc_traits::propagate_on_container_swap::value ||
139
+ __alloc_traits::is_always_equal::value)
140
+ {
141
+ using _CUDA_VSTD::swap;
142
+ swap(__ptr_, __other.__ptr_);
143
+ if (__alloc_traits::propagate_on_container_swap::value ||
144
+ __alloc_ == _CUDA_VSTD::nullopt || __other.__alloc_ == _CUDA_VSTD::nullopt)
145
+ swap(__alloc_, __other.__alloc_);
146
+ }
147
+
148
+ _LIBCUDACXX_INLINE_VISIBILITY
149
+ friend void swap(__basic_node_handle& __a, __basic_node_handle& __b)
150
+ noexcept(noexcept(__a.swap(__b))) { __a.swap(__b); }
151
+
152
+ _LIBCUDACXX_INLINE_VISIBILITY
153
+ ~__basic_node_handle()
154
+ {
155
+ __destroy_node_pointer();
156
+ }
157
+ };
158
+
159
+ template <class _NodeType, class _Derived>
160
+ struct __set_node_handle_specifics
161
+ {
162
+ typedef typename _NodeType::__node_value_type value_type;
163
+
164
+ _LIBCUDACXX_INLINE_VISIBILITY
165
+ value_type& value() const
166
+ {
167
+ return static_cast<_Derived const*>(this)->__ptr_->__value_;
168
+ }
169
+ };
170
+
171
+ template <class _NodeType, class _Derived>
172
+ struct __map_node_handle_specifics
173
+ {
174
+ typedef typename _NodeType::__node_value_type::key_type key_type;
175
+ typedef typename _NodeType::__node_value_type::mapped_type mapped_type;
176
+
177
+ _LIBCUDACXX_INLINE_VISIBILITY
178
+ key_type& key() const
179
+ {
180
+ return static_cast<_Derived const*>(this)->
181
+ __ptr_->__value_.__ref().first;
182
+ }
183
+
184
+ _LIBCUDACXX_INLINE_VISIBILITY
185
+ mapped_type& mapped() const
186
+ {
187
+ return static_cast<_Derived const*>(this)->
188
+ __ptr_->__value_.__ref().second;
189
+ }
190
+ };
191
+
192
+ template <class _NodeType, class _Alloc>
193
+ using __set_node_handle =
194
+ __basic_node_handle< _NodeType, _Alloc, __set_node_handle_specifics>;
195
+
196
+ template <class _NodeType, class _Alloc>
197
+ using __map_node_handle =
198
+ __basic_node_handle< _NodeType, _Alloc, __map_node_handle_specifics>;
199
+
200
+ template <class _Iterator, class _NodeType>
201
+ struct _LIBCUDACXX_TEMPLATE_VIS __insert_return_type
202
+ {
203
+ _Iterator position;
204
+ bool inserted;
205
+ _NodeType node;
206
+ };
207
+
208
+ #endif // _LIBCUDACXX_STD_VER > 14
209
+
210
+ _LIBCUDACXX_END_NAMESPACE_STD
211
+ _LIBCUDACXX_POP_MACROS
212
+
213
+ #endif
cuda_toolkit/include/__nullptr ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===--------------------------- __nullptr --------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX_NULLPTR
11
+ #define _LIBCUDACXX_NULLPTR
12
+
13
+ #include <__config>
14
+
15
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
16
+ # pragma GCC system_header
17
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
18
+ # pragma clang system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
20
+ # pragma system_header
21
+ #endif // no system header
22
+
23
+ #ifdef _LIBCUDACXX_HAS_NO_NULLPTR
24
+
25
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
26
+
27
+ struct _LIBCUDACXX_TEMPLATE_VIS nullptr_t
28
+ {
29
+ void* __lx;
30
+
31
+ struct __nat {int __for_bool_;};
32
+
33
+ _LIBCUDACXX_INLINE_VISIBILITY constexpr nullptr_t() : __lx(0) {}
34
+ _LIBCUDACXX_INLINE_VISIBILITY constexpr nullptr_t(int __nat::*) : __lx(0) {}
35
+
36
+ _LIBCUDACXX_INLINE_VISIBILITY constexpr operator int __nat::*() const {return 0;}
37
+
38
+ template <class _Tp>
39
+ _LIBCUDACXX_INLINE_VISIBILITY constexpr
40
+ operator _Tp* () const {return 0;}
41
+
42
+ template <class _Tp, class _Up>
43
+ _LIBCUDACXX_INLINE_VISIBILITY
44
+ operator _Tp _Up::* () const {return 0;}
45
+
46
+ friend _LIBCUDACXX_INLINE_VISIBILITY constexpr bool operator==(nullptr_t, nullptr_t) {return true;}
47
+ friend _LIBCUDACXX_INLINE_VISIBILITY constexpr bool operator!=(nullptr_t, nullptr_t) {return false;}
48
+ };
49
+
50
+ inline _LIBCUDACXX_INLINE_VISIBILITY constexpr nullptr_t __get_nullptr_t() {return nullptr_t(0);}
51
+
52
+ #define nullptr _CUDA_VSTD::__get_nullptr_t()
53
+
54
+ _LIBCUDACXX_END_NAMESPACE_STD
55
+
56
+ #else // _LIBCUDACXX_HAS_NO_NULLPTR
57
+
58
+ namespace std
59
+ {
60
+ typedef decltype(nullptr) nullptr_t;
61
+ }
62
+
63
+ #endif // _LIBCUDACXX_HAS_NO_NULLPTR
64
+
65
+ #endif // _LIBCUDACXX_NULLPTR
cuda_toolkit/include/__pragma_pop ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===---------------------------- chrono ----------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #if defined(_LIBCUDACXX_USE_PRAGMA_MSVC_WARNING)
11
+ #pragma warning(pop)
12
+ #endif
13
+
14
+ #if defined(_LIBCUDACXX_POP_MACROS)
15
+ _LIBCUDACXX_POP_MACROS
16
+ #endif
cuda_toolkit/include/__pragma_push ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===---------------------------- chrono ----------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifdef _LIBCUDACXX_IMPLICIT_SYSTEM_HEADER
11
+ #pragma GCC system_header
12
+ #endif
13
+
14
+ #if defined(_LIBCUDACXX_USE_PRAGMA_MSVC_WARNING)
15
+ #pragma warning(push)
16
+ #pragma warning(disable : _LIBCUDACXX_MSVC_DISABLED_WARNINGS)
17
+ #endif
18
+
19
+ #if defined(_LIBCUDACXX_PUSH_MACROS)
20
+ _LIBCUDACXX_PUSH_MACROS
21
+ #endif
22
+
23
+ #ifndef __cuda_std__
24
+ #include <__undef_macros>
25
+ #endif
cuda_toolkit/include/__split_buffer ADDED
@@ -0,0 +1,632 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ #ifndef _LIBCUDACXX_SPLIT_BUFFER
3
+ #define _LIBCUDACXX_SPLIT_BUFFER
4
+
5
+ #include <__config>
6
+ #include <type_traits>
7
+ #include <algorithm>
8
+
9
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
10
+ # pragma GCC system_header
11
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
12
+ # pragma clang system_header
13
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
14
+ # pragma system_header
15
+ #endif // no system header
16
+
17
+ _LIBCUDACXX_PUSH_MACROS
18
+ #include <__undef_macros>
19
+
20
+
21
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
22
+
23
+ template <bool>
24
+ class __split_buffer_common
25
+ {
26
+ protected:
27
+ void __throw_length_error() const;
28
+ void __throw_out_of_range() const;
29
+ };
30
+
31
+ template <class _Tp, class _Allocator = allocator<_Tp> >
32
+ struct __split_buffer
33
+ : private __split_buffer_common<true>
34
+ {
35
+ private:
36
+ __split_buffer(const __split_buffer&);
37
+ __split_buffer& operator=(const __split_buffer&);
38
+ public:
39
+ typedef _Tp value_type;
40
+ typedef _Allocator allocator_type;
41
+ typedef __libcpp_remove_reference_t<allocator_type> __alloc_rr;
42
+ typedef allocator_traits<__alloc_rr> __alloc_traits;
43
+ typedef value_type& reference;
44
+ typedef const value_type& const_reference;
45
+ typedef typename __alloc_traits::size_type size_type;
46
+ typedef typename __alloc_traits::difference_type difference_type;
47
+ typedef typename __alloc_traits::pointer pointer;
48
+ typedef typename __alloc_traits::const_pointer const_pointer;
49
+ typedef pointer iterator;
50
+ typedef const_pointer const_iterator;
51
+
52
+ pointer __first_;
53
+ pointer __begin_;
54
+ pointer __end_;
55
+ __compressed_pair<pointer, allocator_type> __end_cap_;
56
+
57
+ typedef __add_lvalue_reference_t<allocator_type> __alloc_ref;
58
+ typedef __add_lvalue_reference_t<allocator_type> __alloc_const_ref;
59
+
60
+ _LIBCUDACXX_INLINE_VISIBILITY __alloc_rr& __alloc() noexcept {return __end_cap_.second();}
61
+ _LIBCUDACXX_INLINE_VISIBILITY const __alloc_rr& __alloc() const noexcept {return __end_cap_.second();}
62
+ _LIBCUDACXX_INLINE_VISIBILITY pointer& __end_cap() noexcept {return __end_cap_.first();}
63
+ _LIBCUDACXX_INLINE_VISIBILITY const pointer& __end_cap() const noexcept {return __end_cap_.first();}
64
+
65
+ _LIBCUDACXX_INLINE_VISIBILITY
66
+ __split_buffer()
67
+ noexcept(is_nothrow_default_constructible<allocator_type>::value);
68
+ _LIBCUDACXX_INLINE_VISIBILITY
69
+ explicit __split_buffer(__alloc_rr& __a);
70
+ _LIBCUDACXX_INLINE_VISIBILITY
71
+ explicit __split_buffer(const __alloc_rr& __a);
72
+ __split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
73
+ ~__split_buffer();
74
+
75
+ __split_buffer(__split_buffer&& __c)
76
+ noexcept(is_nothrow_move_constructible<allocator_type>::value);
77
+ __split_buffer(__split_buffer&& __c, const __alloc_rr& __a);
78
+ __split_buffer& operator=(__split_buffer&& __c)
79
+ noexcept((__alloc_traits::propagate_on_container_move_assignment::value &&
80
+ is_nothrow_move_assignable<allocator_type>::value) ||
81
+ !__alloc_traits::propagate_on_container_move_assignment::value);
82
+
83
+ _LIBCUDACXX_INLINE_VISIBILITY iterator begin() noexcept {return __begin_;}
84
+ _LIBCUDACXX_INLINE_VISIBILITY const_iterator begin() const noexcept {return __begin_;}
85
+ _LIBCUDACXX_INLINE_VISIBILITY iterator end() noexcept {return __end_;}
86
+ _LIBCUDACXX_INLINE_VISIBILITY const_iterator end() const noexcept {return __end_;}
87
+
88
+ _LIBCUDACXX_INLINE_VISIBILITY
89
+ void clear() noexcept
90
+ {__destruct_at_end(__begin_);}
91
+ _LIBCUDACXX_INLINE_VISIBILITY size_type size() const {return static_cast<size_type>(__end_ - __begin_);}
92
+ _LIBCUDACXX_INLINE_VISIBILITY bool empty() const {return __end_ == __begin_;}
93
+ _LIBCUDACXX_INLINE_VISIBILITY size_type capacity() const {return static_cast<size_type>(__end_cap() - __first_);}
94
+ _LIBCUDACXX_INLINE_VISIBILITY size_type __front_spare() const {return static_cast<size_type>(__begin_ - __first_);}
95
+ _LIBCUDACXX_INLINE_VISIBILITY size_type __back_spare() const {return static_cast<size_type>(__end_cap() - __end_);}
96
+
97
+ _LIBCUDACXX_INLINE_VISIBILITY reference front() {return *__begin_;}
98
+ _LIBCUDACXX_INLINE_VISIBILITY const_reference front() const {return *__begin_;}
99
+ _LIBCUDACXX_INLINE_VISIBILITY reference back() {return *(__end_ - 1);}
100
+ _LIBCUDACXX_INLINE_VISIBILITY const_reference back() const {return *(__end_ - 1);}
101
+
102
+ void reserve(size_type __n);
103
+ void shrink_to_fit() noexcept;
104
+ void push_front(const_reference __x);
105
+ _LIBCUDACXX_INLINE_VISIBILITY void push_back(const_reference __x);
106
+ void push_front(value_type&& __x);
107
+ void push_back(value_type&& __x);
108
+ template <class... _Args>
109
+ void emplace_back(_Args&&... __args);
110
+
111
+ _LIBCUDACXX_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);}
112
+ _LIBCUDACXX_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);}
113
+
114
+ void __construct_at_end(size_type __n);
115
+ void __construct_at_end(size_type __n, const_reference __x);
116
+ template <class _InputIter>
117
+ typename enable_if
118
+ <
119
+ __is_cpp17_input_iterator<_InputIter>::value &&
120
+ !__is_cpp17_forward_iterator<_InputIter>::value,
121
+ void
122
+ >::type
123
+ __construct_at_end(_InputIter __first, _InputIter __last);
124
+ template <class _ForwardIterator>
125
+ typename enable_if
126
+ <
127
+ __is_cpp17_forward_iterator<_ForwardIterator>::value,
128
+ void
129
+ >::type
130
+ __construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
131
+
132
+ _LIBCUDACXX_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin)
133
+ {__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());}
134
+ _LIBCUDACXX_INLINE_VISIBILITY
135
+ void __destruct_at_begin(pointer __new_begin, false_type);
136
+ _LIBCUDACXX_INLINE_VISIBILITY
137
+ void __destruct_at_begin(pointer __new_begin, true_type);
138
+
139
+ _LIBCUDACXX_INLINE_VISIBILITY
140
+ void __destruct_at_end(pointer __new_last) noexcept
141
+ {__destruct_at_end(__new_last, false_type());}
142
+ _LIBCUDACXX_INLINE_VISIBILITY
143
+ void __destruct_at_end(pointer __new_last, false_type) noexcept;
144
+ _LIBCUDACXX_INLINE_VISIBILITY
145
+ void __destruct_at_end(pointer __new_last, true_type) noexcept;
146
+
147
+ void swap(__split_buffer& __x)
148
+ noexcept(!__alloc_traits::propagate_on_container_swap::value||
149
+ __is_nothrow_swappable<__alloc_rr>::value);
150
+
151
+ bool __invariants() const;
152
+
153
+ private:
154
+ _LIBCUDACXX_INLINE_VISIBILITY
155
+ void __move_assign_alloc(__split_buffer& __c, true_type)
156
+ noexcept(is_nothrow_move_assignable<allocator_type>::value)
157
+ {
158
+ __alloc() = _CUDA_VSTD::move(__c.__alloc());
159
+ }
160
+
161
+ _LIBCUDACXX_INLINE_VISIBILITY
162
+ void __move_assign_alloc(__split_buffer&, false_type) noexcept
163
+ {}
164
+
165
+ struct _ConstructTransaction {
166
+ explicit _ConstructTransaction(pointer* __p, size_type __n) noexcept
167
+ : __pos_(*__p), __end_(*__p + __n), __dest_(__p) {
168
+ }
169
+ ~_ConstructTransaction() {
170
+ *__dest_ = __pos_;
171
+ }
172
+ pointer __pos_;
173
+ const pointer __end_;
174
+ private:
175
+ pointer *__dest_;
176
+ };
177
+ };
178
+
179
+ template <class _Tp, class _Allocator>
180
+ bool
181
+ __split_buffer<_Tp, _Allocator>::__invariants() const
182
+ {
183
+ if (__first_ == nullptr)
184
+ {
185
+ if (__begin_ != nullptr)
186
+ return false;
187
+ if (__end_ != nullptr)
188
+ return false;
189
+ if (__end_cap() != nullptr)
190
+ return false;
191
+ }
192
+ else
193
+ {
194
+ if (__begin_ < __first_)
195
+ return false;
196
+ if (__end_ < __begin_)
197
+ return false;
198
+ if (__end_cap() < __end_)
199
+ return false;
200
+ }
201
+ return true;
202
+ }
203
+
204
+ // Default constructs __n objects starting at __end_
205
+ // throws if construction throws
206
+ // Precondition: __n > 0
207
+ // Precondition: size() + __n <= capacity()
208
+ // Postcondition: size() == size() + __n
209
+ template <class _Tp, class _Allocator>
210
+ void
211
+ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
212
+ {
213
+ _ConstructTransaction __tx(&this->__end_, __n);
214
+ for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
215
+ __alloc_traits::construct(this->__alloc(), _CUDA_VSTD::__to_raw_pointer(__tx.__pos_));
216
+ }
217
+ }
218
+
219
+ // Copy constructs __n objects starting at __end_ from __x
220
+ // throws if construction throws
221
+ // Precondition: __n > 0
222
+ // Precondition: size() + __n <= capacity()
223
+ // Postcondition: size() == old size() + __n
224
+ // Postcondition: [i] == __x for all i in [size() - __n, __n)
225
+ template <class _Tp, class _Allocator>
226
+ void
227
+ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
228
+ {
229
+ _ConstructTransaction __tx(&this->__end_, __n);
230
+ for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
231
+ __alloc_traits::construct(this->__alloc(),
232
+ _CUDA_VSTD::__to_raw_pointer(__tx.__pos_), __x);
233
+ }
234
+ }
235
+
236
+ template <class _Tp, class _Allocator>
237
+ template <class _InputIter>
238
+ typename enable_if
239
+ <
240
+ __is_cpp17_input_iterator<_InputIter>::value &&
241
+ !__is_cpp17_forward_iterator<_InputIter>::value,
242
+ void
243
+ >::type
244
+ __split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIter __last)
245
+ {
246
+ __alloc_rr& __a = this->__alloc();
247
+ for (; __first != __last; ++__first)
248
+ {
249
+ if (__end_ == __end_cap())
250
+ {
251
+ size_type __old_cap = __end_cap() - __first_;
252
+ size_type __new_cap = _CUDA_VSTD::max<size_type>(2 * __old_cap, 8);
253
+ __split_buffer __buf(__new_cap, 0, __a);
254
+ for (pointer __p = __begin_; __p != __end_; ++__p, (void)++__buf.__end_)
255
+ __alloc_traits::construct(__buf.__alloc(),
256
+ _CUDA_VSTD::__to_raw_pointer(__buf.__end_), _CUDA_VSTD::move(*__p));
257
+ swap(__buf);
258
+ }
259
+ __alloc_traits::construct(__a, _CUDA_VSTD::__to_raw_pointer(this->__end_), *__first);
260
+ ++this->__end_;
261
+ }
262
+ }
263
+
264
+ template <class _Tp, class _Allocator>
265
+ template <class _ForwardIterator>
266
+ typename enable_if
267
+ <
268
+ __is_cpp17_forward_iterator<_ForwardIterator>::value,
269
+ void
270
+ >::type
271
+ __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)
272
+ {
273
+ _ConstructTransaction __tx(&this->__end_, std::distance(__first, __last));
274
+ for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void)++__first) {
275
+ __alloc_traits::construct(this->__alloc(),
276
+ _CUDA_VSTD::__to_raw_pointer(__tx.__pos_), *__first);
277
+ }
278
+ }
279
+
280
+ template <class _Tp, class _Allocator>
281
+ inline
282
+ void
283
+ __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
284
+ {
285
+ while (__begin_ != __new_begin)
286
+ __alloc_traits::destroy(__alloc(), __to_raw_pointer(__begin_++));
287
+ }
288
+
289
+ template <class _Tp, class _Allocator>
290
+ inline
291
+ void
292
+ __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type)
293
+ {
294
+ __begin_ = __new_begin;
295
+ }
296
+
297
+ template <class _Tp, class _Allocator>
298
+ inline _LIBCUDACXX_INLINE_VISIBILITY
299
+ void
300
+ __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) noexcept
301
+ {
302
+ while (__new_last != __end_)
303
+ __alloc_traits::destroy(__alloc(), __to_raw_pointer(--__end_));
304
+ }
305
+
306
+ template <class _Tp, class _Allocator>
307
+ inline _LIBCUDACXX_INLINE_VISIBILITY
308
+ void
309
+ __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) noexcept
310
+ {
311
+ __end_ = __new_last;
312
+ }
313
+
314
+ template <class _Tp, class _Allocator>
315
+ __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a)
316
+ : __end_cap_(nullptr, __a)
317
+ {
318
+ __first_ = __cap != 0 ? __alloc_traits::allocate(__alloc(), __cap) : nullptr;
319
+ __begin_ = __end_ = __first_ + __start;
320
+ __end_cap() = __first_ + __cap;
321
+ }
322
+
323
+ template <class _Tp, class _Allocator>
324
+ inline
325
+ __split_buffer<_Tp, _Allocator>::__split_buffer()
326
+ noexcept(is_nothrow_default_constructible<allocator_type>::value)
327
+ : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr)
328
+ {
329
+ }
330
+
331
+ template <class _Tp, class _Allocator>
332
+ inline
333
+ __split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a)
334
+ : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
335
+ {
336
+ }
337
+
338
+ template <class _Tp, class _Allocator>
339
+ inline
340
+ __split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a)
341
+ : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
342
+ {
343
+ }
344
+
345
+ template <class _Tp, class _Allocator>
346
+ __split_buffer<_Tp, _Allocator>::~__split_buffer()
347
+ {
348
+ clear();
349
+ if (__first_)
350
+ __alloc_traits::deallocate(__alloc(), __first_, capacity());
351
+ }
352
+
353
+ template <class _Tp, class _Allocator>
354
+ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
355
+ noexcept(is_nothrow_move_constructible<allocator_type>::value)
356
+ : __first_(_CUDA_VSTD::move(__c.__first_)),
357
+ __begin_(_CUDA_VSTD::move(__c.__begin_)),
358
+ __end_(_CUDA_VSTD::move(__c.__end_)),
359
+ __end_cap_(_CUDA_VSTD::move(__c.__end_cap_))
360
+ {
361
+ __c.__first_ = nullptr;
362
+ __c.__begin_ = nullptr;
363
+ __c.__end_ = nullptr;
364
+ __c.__end_cap() = nullptr;
365
+ }
366
+
367
+ template <class _Tp, class _Allocator>
368
+ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a)
369
+ : __end_cap_(__second_tag(), __a)
370
+ {
371
+ if (__a == __c.__alloc())
372
+ {
373
+ __first_ = __c.__first_;
374
+ __begin_ = __c.__begin_;
375
+ __end_ = __c.__end_;
376
+ __end_cap() = __c.__end_cap();
377
+ __c.__first_ = nullptr;
378
+ __c.__begin_ = nullptr;
379
+ __c.__end_ = nullptr;
380
+ __c.__end_cap() = nullptr;
381
+ }
382
+ else
383
+ {
384
+ size_type __cap = __c.size();
385
+ __first_ = __alloc_traits::allocate(__alloc(), __cap);
386
+ __begin_ = __end_ = __first_;
387
+ __end_cap() = __first_ + __cap;
388
+ typedef move_iterator<iterator> _Ip;
389
+ __construct_at_end(_Ip(__c.begin()), _Ip(__c.end()));
390
+ }
391
+ }
392
+
393
+ template <class _Tp, class _Allocator>
394
+ __split_buffer<_Tp, _Allocator>&
395
+ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
396
+ noexcept((__alloc_traits::propagate_on_container_move_assignment::value &&
397
+ is_nothrow_move_assignable<allocator_type>::value) ||
398
+ !__alloc_traits::propagate_on_container_move_assignment::value)
399
+ {
400
+ clear();
401
+ shrink_to_fit();
402
+ __first_ = __c.__first_;
403
+ __begin_ = __c.__begin_;
404
+ __end_ = __c.__end_;
405
+ __end_cap() = __c.__end_cap();
406
+ __move_assign_alloc(__c,
407
+ integral_constant<bool,
408
+ __alloc_traits::propagate_on_container_move_assignment::value>());
409
+ __c.__first_ = __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;
410
+ return *this;
411
+ }
412
+
413
+ template <class _Tp, class _Allocator>
414
+ void
415
+ __split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
416
+ noexcept(!__alloc_traits::propagate_on_container_swap::value||
417
+ __is_nothrow_swappable<__alloc_rr>::value)
418
+ {
419
+ _CUDA_VSTD::swap(__first_, __x.__first_);
420
+ _CUDA_VSTD::swap(__begin_, __x.__begin_);
421
+ _CUDA_VSTD::swap(__end_, __x.__end_);
422
+ _CUDA_VSTD::swap(__end_cap(), __x.__end_cap());
423
+ __swap_allocator(__alloc(), __x.__alloc());
424
+ }
425
+
426
+ template <class _Tp, class _Allocator>
427
+ void
428
+ __split_buffer<_Tp, _Allocator>::reserve(size_type __n)
429
+ {
430
+ if (__n < capacity())
431
+ {
432
+ __split_buffer<value_type, __alloc_rr&> __t(__n, 0, __alloc());
433
+ __t.__construct_at_end(move_iterator<pointer>(__begin_),
434
+ move_iterator<pointer>(__end_));
435
+ _CUDA_VSTD::swap(__first_, __t.__first_);
436
+ _CUDA_VSTD::swap(__begin_, __t.__begin_);
437
+ _CUDA_VSTD::swap(__end_, __t.__end_);
438
+ _CUDA_VSTD::swap(__end_cap(), __t.__end_cap());
439
+ }
440
+ }
441
+
442
+ template <class _Tp, class _Allocator>
443
+ void
444
+ __split_buffer<_Tp, _Allocator>::shrink_to_fit() noexcept
445
+ {
446
+ if (capacity() > size())
447
+ {
448
+ #ifndef _LIBCUDACXX_NO_EXCEPTIONS
449
+ try
450
+ {
451
+ #endif // _LIBCUDACXX_NO_EXCEPTIONS
452
+ __split_buffer<value_type, __alloc_rr&> __t(size(), 0, __alloc());
453
+ __t.__construct_at_end(move_iterator<pointer>(__begin_),
454
+ move_iterator<pointer>(__end_));
455
+ __t.__end_ = __t.__begin_ + (__end_ - __begin_);
456
+ _CUDA_VSTD::swap(__first_, __t.__first_);
457
+ _CUDA_VSTD::swap(__begin_, __t.__begin_);
458
+ _CUDA_VSTD::swap(__end_, __t.__end_);
459
+ _CUDA_VSTD::swap(__end_cap(), __t.__end_cap());
460
+ #ifndef _LIBCUDACXX_NO_EXCEPTIONS
461
+ }
462
+ catch (...)
463
+ {
464
+ }
465
+ #endif // _LIBCUDACXX_NO_EXCEPTIONS
466
+ }
467
+ }
468
+
469
+ template <class _Tp, class _Allocator>
470
+ void
471
+ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
472
+ {
473
+ if (__begin_ == __first_)
474
+ {
475
+ if (__end_ < __end_cap())
476
+ {
477
+ difference_type __d = __end_cap() - __end_;
478
+ __d = (__d + 1) / 2;
479
+ __begin_ = _CUDA_VSTD::move_backward(__begin_, __end_, __end_ + __d);
480
+ __end_ += __d;
481
+ }
482
+ else
483
+ {
484
+ size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
485
+ __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
486
+ __t.__construct_at_end(move_iterator<pointer>(__begin_),
487
+ move_iterator<pointer>(__end_));
488
+ _CUDA_VSTD::swap(__first_, __t.__first_);
489
+ _CUDA_VSTD::swap(__begin_, __t.__begin_);
490
+ _CUDA_VSTD::swap(__end_, __t.__end_);
491
+ _CUDA_VSTD::swap(__end_cap(), __t.__end_cap());
492
+ }
493
+ }
494
+ __alloc_traits::construct(__alloc(), _CUDA_VSTD::__to_raw_pointer(__begin_-1), __x);
495
+ --__begin_;
496
+ }
497
+
498
+ template <class _Tp, class _Allocator>
499
+ void
500
+ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
501
+ {
502
+ if (__begin_ == __first_)
503
+ {
504
+ if (__end_ < __end_cap())
505
+ {
506
+ difference_type __d = __end_cap() - __end_;
507
+ __d = (__d + 1) / 2;
508
+ __begin_ = _CUDA_VSTD::move_backward(__begin_, __end_, __end_ + __d);
509
+ __end_ += __d;
510
+ }
511
+ else
512
+ {
513
+ size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
514
+ __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
515
+ __t.__construct_at_end(move_iterator<pointer>(__begin_),
516
+ move_iterator<pointer>(__end_));
517
+ _CUDA_VSTD::swap(__first_, __t.__first_);
518
+ _CUDA_VSTD::swap(__begin_, __t.__begin_);
519
+ _CUDA_VSTD::swap(__end_, __t.__end_);
520
+ _CUDA_VSTD::swap(__end_cap(), __t.__end_cap());
521
+ }
522
+ }
523
+ __alloc_traits::construct(__alloc(), _CUDA_VSTD::__to_raw_pointer(__begin_-1),
524
+ _CUDA_VSTD::move(__x));
525
+ --__begin_;
526
+ }
527
+
528
+ template <class _Tp, class _Allocator>
529
+ inline _LIBCUDACXX_INLINE_VISIBILITY
530
+ void
531
+ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
532
+ {
533
+ if (__end_ == __end_cap())
534
+ {
535
+ if (__begin_ > __first_)
536
+ {
537
+ difference_type __d = __begin_ - __first_;
538
+ __d = (__d + 1) / 2;
539
+ __end_ = _CUDA_VSTD::move(__begin_, __end_, __begin_ - __d);
540
+ __begin_ -= __d;
541
+ }
542
+ else
543
+ {
544
+ size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
545
+ __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
546
+ __t.__construct_at_end(move_iterator<pointer>(__begin_),
547
+ move_iterator<pointer>(__end_));
548
+ _CUDA_VSTD::swap(__first_, __t.__first_);
549
+ _CUDA_VSTD::swap(__begin_, __t.__begin_);
550
+ _CUDA_VSTD::swap(__end_, __t.__end_);
551
+ _CUDA_VSTD::swap(__end_cap(), __t.__end_cap());
552
+ }
553
+ }
554
+ __alloc_traits::construct(__alloc(), _CUDA_VSTD::__to_raw_pointer(__end_), __x);
555
+ ++__end_;
556
+ }
557
+
558
+ template <class _Tp, class _Allocator>
559
+ void
560
+ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
561
+ {
562
+ if (__end_ == __end_cap())
563
+ {
564
+ if (__begin_ > __first_)
565
+ {
566
+ difference_type __d = __begin_ - __first_;
567
+ __d = (__d + 1) / 2;
568
+ __end_ = _CUDA_VSTD::move(__begin_, __end_, __begin_ - __d);
569
+ __begin_ -= __d;
570
+ }
571
+ else
572
+ {
573
+ size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
574
+ __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
575
+ __t.__construct_at_end(move_iterator<pointer>(__begin_),
576
+ move_iterator<pointer>(__end_));
577
+ _CUDA_VSTD::swap(__first_, __t.__first_);
578
+ _CUDA_VSTD::swap(__begin_, __t.__begin_);
579
+ _CUDA_VSTD::swap(__end_, __t.__end_);
580
+ _CUDA_VSTD::swap(__end_cap(), __t.__end_cap());
581
+ }
582
+ }
583
+ __alloc_traits::construct(__alloc(), _CUDA_VSTD::__to_raw_pointer(__end_),
584
+ _CUDA_VSTD::move(__x));
585
+ ++__end_;
586
+ }
587
+
588
+ template <class _Tp, class _Allocator>
589
+ template <class... _Args>
590
+ void
591
+ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
592
+ {
593
+ if (__end_ == __end_cap())
594
+ {
595
+ if (__begin_ > __first_)
596
+ {
597
+ difference_type __d = __begin_ - __first_;
598
+ __d = (__d + 1) / 2;
599
+ __end_ = _CUDA_VSTD::move(__begin_, __end_, __begin_ - __d);
600
+ __begin_ -= __d;
601
+ }
602
+ else
603
+ {
604
+ size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
605
+ __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
606
+ __t.__construct_at_end(move_iterator<pointer>(__begin_),
607
+ move_iterator<pointer>(__end_));
608
+ _CUDA_VSTD::swap(__first_, __t.__first_);
609
+ _CUDA_VSTD::swap(__begin_, __t.__begin_);
610
+ _CUDA_VSTD::swap(__end_, __t.__end_);
611
+ _CUDA_VSTD::swap(__end_cap(), __t.__end_cap());
612
+ }
613
+ }
614
+ __alloc_traits::construct(__alloc(), _CUDA_VSTD::__to_raw_pointer(__end_),
615
+ _CUDA_VSTD::forward<_Args>(__args)...);
616
+ ++__end_;
617
+ }
618
+
619
+ template <class _Tp, class _Allocator>
620
+ inline _LIBCUDACXX_INLINE_VISIBILITY
621
+ void
622
+ swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)
623
+ noexcept(noexcept(__x.swap(__y)))
624
+ {
625
+ __x.swap(__y);
626
+ }
627
+
628
+ _LIBCUDACXX_END_NAMESPACE_STD
629
+
630
+ _LIBCUDACXX_POP_MACROS
631
+
632
+ #endif // _LIBCUDACXX_SPLIT_BUFFER
cuda_toolkit/include/__sso_allocator ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___SSO_ALLOCATOR
11
+ #define _LIBCUDACXX___SSO_ALLOCATOR
12
+
13
+ #include <__config>
14
+ #include <type_traits>
15
+ #include <new>
16
+
17
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
18
+ # pragma GCC system_header
19
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
20
+ # pragma clang system_header
21
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
22
+ # pragma system_header
23
+ #endif // no system header
24
+
25
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
26
+
27
+ template <class _Tp, size_t _Np> class _LIBCUDACXX_HIDDEN __sso_allocator;
28
+
29
+ template <size_t _Np>
30
+ class _LIBCUDACXX_HIDDEN __sso_allocator<void, _Np>
31
+ {
32
+ public:
33
+ typedef const void* const_pointer;
34
+ typedef void value_type;
35
+ };
36
+
37
+ template <class _Tp, size_t _Np>
38
+ class _LIBCUDACXX_HIDDEN __sso_allocator
39
+ {
40
+ typename aligned_storage<sizeof(_Tp) * _Np>::type buf_;
41
+ bool __allocated_;
42
+ public:
43
+ typedef size_t size_type;
44
+ typedef _Tp* pointer;
45
+ typedef _Tp value_type;
46
+
47
+ _LIBCUDACXX_INLINE_VISIBILITY __sso_allocator() throw() : __allocated_(false) {}
48
+ _LIBCUDACXX_INLINE_VISIBILITY __sso_allocator(const __sso_allocator&) throw() : __allocated_(false) {}
49
+ template <class _Up> _LIBCUDACXX_INLINE_VISIBILITY __sso_allocator(const __sso_allocator<_Up, _Np>&) throw()
50
+ : __allocated_(false) {}
51
+ private:
52
+ __sso_allocator& operator=(const __sso_allocator&);
53
+ public:
54
+ _LIBCUDACXX_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator<void, _Np>::const_pointer = 0)
55
+ {
56
+ if (!__allocated_ && __n <= _Np)
57
+ {
58
+ __allocated_ = true;
59
+ return (pointer)&buf_;
60
+ }
61
+ return static_cast<pointer>(_CUDA_VSTD::__libcpp_allocate(__n * sizeof(_Tp), _LIBCUDACXX_ALIGNOF(_Tp)));
62
+ }
63
+ _LIBCUDACXX_INLINE_VISIBILITY void deallocate(pointer __p, size_type __n)
64
+ {
65
+ if (__p == (pointer)&buf_)
66
+ __allocated_ = false;
67
+ else
68
+ _CUDA_VSTD::__libcpp_deallocate(__p, __n * sizeof(_Tp), _LIBCUDACXX_ALIGNOF(_Tp));
69
+ }
70
+ _LIBCUDACXX_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);}
71
+
72
+ _LIBCUDACXX_INLINE_VISIBILITY
73
+ bool operator==(__sso_allocator& __a) const {return &buf_ == &__a.buf_;}
74
+ _LIBCUDACXX_INLINE_VISIBILITY
75
+ bool operator!=(__sso_allocator& __a) const {return &buf_ != &__a.buf_;}
76
+ };
77
+
78
+ _LIBCUDACXX_END_NAMESPACE_STD
79
+
80
+ #endif // _LIBCUDACXX___SSO_ALLOCATOR
cuda_toolkit/include/__std_stream ADDED
@@ -0,0 +1,365 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___STD_STREAM
11
+ #define _LIBCUDACXX___STD_STREAM
12
+
13
+ #include <__config>
14
+ #include <ostream>
15
+ #include <istream>
16
+ #include <__locale>
17
+ #include <cstdio>
18
+
19
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
20
+ # pragma GCC system_header
21
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
22
+ # pragma clang system_header
23
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
24
+ # pragma system_header
25
+ #endif // no system header
26
+
27
+ _LIBCUDACXX_PUSH_MACROS
28
+ #include <__undef_macros>
29
+
30
+
31
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
32
+
33
+ static const int __limit = 8;
34
+
35
+ // __stdinbuf
36
+
37
+ template <class _CharT>
38
+ class _LIBCUDACXX_HIDDEN __stdinbuf
39
+ : public basic_streambuf<_CharT, char_traits<_CharT> >
40
+ {
41
+ public:
42
+ typedef _CharT char_type;
43
+ typedef char_traits<char_type> traits_type;
44
+ typedef typename traits_type::int_type int_type;
45
+ typedef typename traits_type::pos_type pos_type;
46
+ typedef typename traits_type::off_type off_type;
47
+ typedef typename traits_type::state_type state_type;
48
+
49
+ __stdinbuf(FILE* __fp, state_type* __st);
50
+
51
+ protected:
52
+ virtual int_type underflow();
53
+ virtual int_type uflow();
54
+ virtual int_type pbackfail(int_type __c = traits_type::eof());
55
+ virtual void imbue(const locale& __loc);
56
+
57
+ private:
58
+
59
+ FILE* __file_;
60
+ const codecvt<char_type, char, state_type>* __cv_;
61
+ state_type* __st_;
62
+ int __encoding_;
63
+ int_type __last_consumed_;
64
+ bool __last_consumed_is_next_;
65
+ bool __always_noconv_;
66
+
67
+ __stdinbuf(const __stdinbuf&);
68
+ __stdinbuf& operator=(const __stdinbuf&);
69
+
70
+ int_type __getchar(bool __consume);
71
+ };
72
+
73
+ template <class _CharT>
74
+ __stdinbuf<_CharT>::__stdinbuf(FILE* __fp, state_type* __st)
75
+ : __file_(__fp),
76
+ __st_(__st),
77
+ __last_consumed_(traits_type::eof()),
78
+ __last_consumed_is_next_(false)
79
+ {
80
+ imbue(this->getloc());
81
+ }
82
+
83
+ template <class _CharT>
84
+ void
85
+ __stdinbuf<_CharT>::imbue(const locale& __loc)
86
+ {
87
+ __cv_ = &use_facet<codecvt<char_type, char, state_type> >(__loc);
88
+ __encoding_ = __cv_->encoding();
89
+ __always_noconv_ = __cv_->always_noconv();
90
+ if (__encoding_ > __limit)
91
+ __throw_runtime_error("unsupported locale for standard input");
92
+ }
93
+
94
+ template <class _CharT>
95
+ typename __stdinbuf<_CharT>::int_type
96
+ __stdinbuf<_CharT>::underflow()
97
+ {
98
+ return __getchar(false);
99
+ }
100
+
101
+ template <class _CharT>
102
+ typename __stdinbuf<_CharT>::int_type
103
+ __stdinbuf<_CharT>::uflow()
104
+ {
105
+ return __getchar(true);
106
+ }
107
+
108
+ template <class _CharT>
109
+ typename __stdinbuf<_CharT>::int_type
110
+ __stdinbuf<_CharT>::__getchar(bool __consume)
111
+ {
112
+ if (__last_consumed_is_next_)
113
+ {
114
+ int_type __result = __last_consumed_;
115
+ if (__consume)
116
+ {
117
+ __last_consumed_ = traits_type::eof();
118
+ __last_consumed_is_next_ = false;
119
+ }
120
+ return __result;
121
+ }
122
+ char __extbuf[__limit];
123
+ int __nread = _CUDA_VSTD::max(1, __encoding_);
124
+ for (int __i = 0; __i < __nread; ++__i)
125
+ {
126
+ int __c = getc(__file_);
127
+ if (__c == EOF)
128
+ return traits_type::eof();
129
+ __extbuf[__i] = static_cast<char>(__c);
130
+ }
131
+ char_type __1buf;
132
+ if (__always_noconv_)
133
+ __1buf = static_cast<char_type>(__extbuf[0]);
134
+ else
135
+ {
136
+ const char* __enxt;
137
+ char_type* __inxt;
138
+ codecvt_base::result __r;
139
+ do
140
+ {
141
+ state_type __sv_st = *__st_;
142
+ __r = __cv_->in(*__st_, __extbuf, __extbuf + __nread, __enxt,
143
+ &__1buf, &__1buf + 1, __inxt);
144
+ switch (__r)
145
+ {
146
+ case _CUDA_VSTD::codecvt_base::ok:
147
+ break;
148
+ case codecvt_base::partial:
149
+ *__st_ = __sv_st;
150
+ if (__nread == sizeof(__extbuf))
151
+ return traits_type::eof();
152
+ {
153
+ int __c = getc(__file_);
154
+ if (__c == EOF)
155
+ return traits_type::eof();
156
+ __extbuf[__nread] = static_cast<char>(__c);
157
+ }
158
+ ++__nread;
159
+ break;
160
+ case codecvt_base::error:
161
+ return traits_type::eof();
162
+ case _CUDA_VSTD::codecvt_base::noconv:
163
+ __1buf = static_cast<char_type>(__extbuf[0]);
164
+ break;
165
+ }
166
+ } while (__r == _CUDA_VSTD::codecvt_base::partial);
167
+ }
168
+ if (!__consume)
169
+ {
170
+ for (int __i = __nread; __i > 0;)
171
+ {
172
+ if (ungetc(traits_type::to_int_type(__extbuf[--__i]), __file_) == EOF)
173
+ return traits_type::eof();
174
+ }
175
+ }
176
+ else
177
+ __last_consumed_ = traits_type::to_int_type(__1buf);
178
+ return traits_type::to_int_type(__1buf);
179
+ }
180
+
181
+ template <class _CharT>
182
+ typename __stdinbuf<_CharT>::int_type
183
+ __stdinbuf<_CharT>::pbackfail(int_type __c)
184
+ {
185
+ if (traits_type::eq_int_type(__c, traits_type::eof()))
186
+ {
187
+ if (!__last_consumed_is_next_)
188
+ {
189
+ __c = __last_consumed_;
190
+ __last_consumed_is_next_ = !traits_type::eq_int_type(__last_consumed_,
191
+ traits_type::eof());
192
+ }
193
+ return __c;
194
+ }
195
+ if (__last_consumed_is_next_)
196
+ {
197
+ char __extbuf[__limit];
198
+ char* __enxt;
199
+ const char_type __ci = traits_type::to_char_type(__last_consumed_);
200
+ const char_type* __inxt;
201
+ switch (__cv_->out(*__st_, &__ci, &__ci + 1, __inxt,
202
+ __extbuf, __extbuf + sizeof(__extbuf), __enxt))
203
+ {
204
+ case _CUDA_VSTD::codecvt_base::ok:
205
+ break;
206
+ case _CUDA_VSTD::codecvt_base::noconv:
207
+ __extbuf[0] = static_cast<char>(__last_consumed_);
208
+ __enxt = __extbuf + 1;
209
+ break;
210
+ case codecvt_base::partial:
211
+ case codecvt_base::error:
212
+ return traits_type::eof();
213
+ }
214
+ while (__enxt > __extbuf)
215
+ if (ungetc(*--__enxt, __file_) == EOF)
216
+ return traits_type::eof();
217
+ }
218
+ __last_consumed_ = __c;
219
+ __last_consumed_is_next_ = true;
220
+ return __c;
221
+ }
222
+
223
+ // __stdoutbuf
224
+
225
+ template <class _CharT>
226
+ class _LIBCUDACXX_HIDDEN __stdoutbuf
227
+ : public basic_streambuf<_CharT, char_traits<_CharT> >
228
+ {
229
+ public:
230
+ typedef _CharT char_type;
231
+ typedef char_traits<char_type> traits_type;
232
+ typedef typename traits_type::int_type int_type;
233
+ typedef typename traits_type::pos_type pos_type;
234
+ typedef typename traits_type::off_type off_type;
235
+ typedef typename traits_type::state_type state_type;
236
+
237
+ __stdoutbuf(FILE* __fp, state_type* __st);
238
+
239
+ protected:
240
+ virtual int_type overflow (int_type __c = traits_type::eof());
241
+ virtual streamsize xsputn(const char_type* __s, streamsize __n);
242
+ virtual int sync();
243
+ virtual void imbue(const locale& __loc);
244
+
245
+ private:
246
+ FILE* __file_;
247
+ const codecvt<char_type, char, state_type>* __cv_;
248
+ state_type* __st_;
249
+ bool __always_noconv_;
250
+
251
+ __stdoutbuf(const __stdoutbuf&);
252
+ __stdoutbuf& operator=(const __stdoutbuf&);
253
+ };
254
+
255
+ template <class _CharT>
256
+ __stdoutbuf<_CharT>::__stdoutbuf(FILE* __fp, state_type* __st)
257
+ : __file_(__fp),
258
+ __cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
259
+ __st_(__st),
260
+ __always_noconv_(__cv_->always_noconv())
261
+ {
262
+ }
263
+
264
+ template <class _CharT>
265
+ typename __stdoutbuf<_CharT>::int_type
266
+ __stdoutbuf<_CharT>::overflow(int_type __c)
267
+ {
268
+ char __extbuf[__limit];
269
+ char_type __1buf;
270
+ if (!traits_type::eq_int_type(__c, traits_type::eof()))
271
+ {
272
+ __1buf = traits_type::to_char_type(__c);
273
+ if (__always_noconv_)
274
+ {
275
+ if (fwrite(&__1buf, sizeof(char_type), 1, __file_) != 1)
276
+ return traits_type::eof();
277
+ }
278
+ else
279
+ {
280
+ char* __extbe = __extbuf;
281
+ codecvt_base::result __r;
282
+ char_type* pbase = &__1buf;
283
+ char_type* pptr = pbase + 1;
284
+ do
285
+ {
286
+ const char_type* __e;
287
+ __r = __cv_->out(*__st_, pbase, pptr, __e,
288
+ __extbuf,
289
+ __extbuf + sizeof(__extbuf),
290
+ __extbe);
291
+ if (__e == pbase)
292
+ return traits_type::eof();
293
+ if (__r == codecvt_base::noconv)
294
+ {
295
+ if (fwrite(pbase, 1, 1, __file_) != 1)
296
+ return traits_type::eof();
297
+ }
298
+ else if (__r == codecvt_base::ok || __r == codecvt_base::partial)
299
+ {
300
+ size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
301
+ if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb)
302
+ return traits_type::eof();
303
+ if (__r == codecvt_base::partial)
304
+ {
305
+ pbase = const_cast<char_type*>(__e);
306
+ }
307
+ }
308
+ else
309
+ return traits_type::eof();
310
+ } while (__r == codecvt_base::partial);
311
+ }
312
+ }
313
+ return traits_type::not_eof(__c);
314
+ }
315
+
316
+ template <class _CharT>
317
+ streamsize
318
+ __stdoutbuf<_CharT>::xsputn(const char_type* __s, streamsize __n)
319
+ {
320
+ if (__always_noconv_)
321
+ return fwrite(__s, sizeof(char_type), __n, __file_);
322
+ streamsize __i = 0;
323
+ for (; __i < __n; ++__i, ++__s)
324
+ if (overflow(traits_type::to_int_type(*__s)) == traits_type::eof())
325
+ break;
326
+ return __i;
327
+ }
328
+
329
+ template <class _CharT>
330
+ int
331
+ __stdoutbuf<_CharT>::sync()
332
+ {
333
+ char __extbuf[__limit];
334
+ codecvt_base::result __r;
335
+ do
336
+ {
337
+ char* __extbe;
338
+ __r = __cv_->unshift(*__st_, __extbuf,
339
+ __extbuf + sizeof(__extbuf),
340
+ __extbe);
341
+ size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
342
+ if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb)
343
+ return -1;
344
+ } while (__r == codecvt_base::partial);
345
+ if (__r == codecvt_base::error)
346
+ return -1;
347
+ if (fflush(__file_))
348
+ return -1;
349
+ return 0;
350
+ }
351
+
352
+ template <class _CharT>
353
+ void
354
+ __stdoutbuf<_CharT>::imbue(const locale& __loc)
355
+ {
356
+ sync();
357
+ __cv_ = &use_facet<codecvt<char_type, char, state_type> >(__loc);
358
+ __always_noconv_ = __cv_->always_noconv();
359
+ }
360
+
361
+ _LIBCUDACXX_END_NAMESPACE_STD
362
+
363
+ _LIBCUDACXX_POP_MACROS
364
+
365
+ #endif // _LIBCUDACXX___STD_STREAM
cuda_toolkit/include/__string ADDED
@@ -0,0 +1,990 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===-------------------------- __string ----------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX___STRING
11
+ #define _LIBCUDACXX___STRING
12
+
13
+ /*
14
+ string synopsis
15
+
16
+ namespace std
17
+ {
18
+
19
+ template <class charT>
20
+ struct char_traits
21
+ {
22
+ typedef charT char_type;
23
+ typedef ... int_type;
24
+ typedef streamoff off_type;
25
+ typedef streampos pos_type;
26
+ typedef mbstate_t state_type;
27
+
28
+ static constexpr void assign(char_type& c1, const char_type& c2) noexcept;
29
+ static constexpr bool eq(char_type c1, char_type c2) noexcept;
30
+ static constexpr bool lt(char_type c1, char_type c2) noexcept;
31
+
32
+ static constexpr int compare(const char_type* s1, const char_type* s2, size_t n);
33
+ static constexpr size_t length(const char_type* s);
34
+ static constexpr const char_type*
35
+ find(const char_type* s, size_t n, const char_type& a);
36
+ static char_type* move(char_type* s1, const char_type* s2, size_t n);
37
+ static char_type* copy(char_type* s1, const char_type* s2, size_t n);
38
+ static char_type* assign(char_type* s, size_t n, char_type a);
39
+
40
+ static constexpr int_type not_eof(int_type c) noexcept;
41
+ static constexpr char_type to_char_type(int_type c) noexcept;
42
+ static constexpr int_type to_int_type(char_type c) noexcept;
43
+ static constexpr bool eq_int_type(int_type c1, int_type c2) noexcept;
44
+ static constexpr int_type eof() noexcept;
45
+ };
46
+
47
+ template <> struct char_traits<char>;
48
+ template <> struct char_traits<wchar_t>;
49
+ template <> struct char_traits<char8_t>; // c++20
50
+
51
+ } // std
52
+
53
+ */
54
+
55
+ #include <__config>
56
+ #include <algorithm> // for search and min
57
+ #include <cstdio> // For EOF.
58
+ #include <memory> // for __murmur2_or_cityhash
59
+
60
+ #include "__assert" // all public C++ headers provide the assertion handler
61
+ #include <__debug>
62
+
63
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
64
+ # pragma GCC system_header
65
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
66
+ # pragma clang system_header
67
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
68
+ # pragma system_header
69
+ #endif // no system header
70
+
71
+ _LIBCUDACXX_PUSH_MACROS
72
+ #include <__undef_macros>
73
+
74
+ #include "__fwd/string.h"
75
+
76
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
77
+
78
+ // char_traits
79
+
80
+ template <class _CharT>
81
+ struct _LIBCUDACXX_TEMPLATE_VIS char_traits
82
+ {
83
+ typedef _CharT char_type;
84
+ typedef int int_type;
85
+ typedef streamoff off_type;
86
+ typedef streampos pos_type;
87
+ typedef mbstate_t state_type;
88
+
89
+ static inline void _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
90
+ assign(char_type& __c1, const char_type& __c2) noexcept {__c1 = __c2;}
91
+ static inline constexpr bool eq(char_type __c1, char_type __c2) noexcept
92
+ {return __c1 == __c2;}
93
+ static inline constexpr bool lt(char_type __c1, char_type __c2) noexcept
94
+ {return __c1 < __c2;}
95
+
96
+ static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
97
+ int compare(const char_type* __s1, const char_type* __s2, size_t __n);
98
+ _LIBCUDACXX_INLINE_VISIBILITY static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
99
+ size_t length(const char_type* __s);
100
+ _LIBCUDACXX_INLINE_VISIBILITY static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
101
+ const char_type* find(const char_type* __s, size_t __n, const char_type& __a);
102
+ static char_type* move(char_type* __s1, const char_type* __s2, size_t __n);
103
+ _LIBCUDACXX_INLINE_VISIBILITY
104
+ static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
105
+ _LIBCUDACXX_INLINE_VISIBILITY
106
+ static char_type* assign(char_type* __s, size_t __n, char_type __a);
107
+
108
+ static inline constexpr int_type not_eof(int_type __c) noexcept
109
+ {return eq_int_type(__c, eof()) ? ~eof() : __c;}
110
+ static inline constexpr char_type to_char_type(int_type __c) noexcept
111
+ {return char_type(__c);}
112
+ static inline constexpr int_type to_int_type(char_type __c) noexcept
113
+ {return int_type(__c);}
114
+ static inline constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept
115
+ {return __c1 == __c2;}
116
+ static inline constexpr int_type eof() noexcept
117
+ {return int_type(EOF);}
118
+ };
119
+
120
+ template <class _CharT>
121
+ _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 int
122
+ char_traits<_CharT>::compare(const char_type* __s1, const char_type* __s2, size_t __n)
123
+ {
124
+ for (; __n; --__n, ++__s1, ++__s2)
125
+ {
126
+ if (lt(*__s1, *__s2))
127
+ return -1;
128
+ if (lt(*__s2, *__s1))
129
+ return 1;
130
+ }
131
+ return 0;
132
+ }
133
+
134
+ template <class _CharT>
135
+ inline
136
+ _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 size_t
137
+ char_traits<_CharT>::length(const char_type* __s)
138
+ {
139
+ size_t __len = 0;
140
+ for (; !eq(*__s, char_type(0)); ++__s)
141
+ ++__len;
142
+ return __len;
143
+ }
144
+
145
+ template <class _CharT>
146
+ inline
147
+ _LIBCUDACXX_CONSTEXPR_AFTER_CXX14 const _CharT*
148
+ char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a)
149
+ {
150
+ for (; __n; --__n)
151
+ {
152
+ if (eq(*__s, __a))
153
+ return __s;
154
+ ++__s;
155
+ }
156
+ return 0;
157
+ }
158
+
159
+ template <class _CharT>
160
+ _CharT*
161
+ char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n)
162
+ {
163
+ char_type* __r = __s1;
164
+ if (__s1 < __s2)
165
+ {
166
+ for (; __n; --__n, ++__s1, ++__s2)
167
+ assign(*__s1, *__s2);
168
+ }
169
+ else if (__s2 < __s1)
170
+ {
171
+ __s1 += __n;
172
+ __s2 += __n;
173
+ for (; __n; --__n)
174
+ assign(*--__s1, *--__s2);
175
+ }
176
+ return __r;
177
+ }
178
+
179
+ template <class _CharT>
180
+ inline
181
+ _CharT*
182
+ char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n)
183
+ {
184
+ _LIBCUDACXX_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
185
+ char_type* __r = __s1;
186
+ for (; __n; --__n, ++__s1, ++__s2)
187
+ assign(*__s1, *__s2);
188
+ return __r;
189
+ }
190
+
191
+ template <class _CharT>
192
+ inline
193
+ _CharT*
194
+ char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)
195
+ {
196
+ char_type* __r = __s;
197
+ for (; __n; --__n, ++__s)
198
+ assign(*__s, __a);
199
+ return __r;
200
+ }
201
+
202
+ // char_traits<char>
203
+
204
+ template <>
205
+ struct _LIBCUDACXX_TEMPLATE_VIS char_traits<char>
206
+ {
207
+ typedef char char_type;
208
+ typedef int int_type;
209
+ typedef streamoff off_type;
210
+ typedef streampos pos_type;
211
+ typedef mbstate_t state_type;
212
+
213
+ static inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
214
+ void assign(char_type& __c1, const char_type& __c2) noexcept {__c1 = __c2;}
215
+ static inline constexpr bool eq(char_type __c1, char_type __c2) noexcept
216
+ {return __c1 == __c2;}
217
+ static inline constexpr bool lt(char_type __c1, char_type __c2) noexcept
218
+ {return (unsigned char)__c1 < (unsigned char)__c2;}
219
+
220
+ static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
221
+ int compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept;
222
+ static inline size_t _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
223
+ length(const char_type* __s) noexcept {return __builtin_strlen(__s);}
224
+ static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
225
+ const char_type* find(const char_type* __s, size_t __n, const char_type& __a) noexcept;
226
+ static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n) noexcept
227
+ {return __n == 0 ? __s1 : (char_type*) memmove(__s1, __s2, __n);}
228
+ static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) noexcept
229
+ {
230
+ _LIBCUDACXX_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
231
+ return __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n);
232
+ }
233
+ static inline char_type* assign(char_type* __s, size_t __n, char_type __a) noexcept
234
+ {return __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);}
235
+
236
+ static inline constexpr int_type not_eof(int_type __c) noexcept
237
+ {return eq_int_type(__c, eof()) ? ~eof() : __c;}
238
+ static inline constexpr char_type to_char_type(int_type __c) noexcept
239
+ {return char_type(__c);}
240
+ static inline constexpr int_type to_int_type(char_type __c) noexcept
241
+ {return int_type((unsigned char)__c);}
242
+ static inline constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept
243
+ {return __c1 == __c2;}
244
+ static inline constexpr int_type eof() noexcept
245
+ {return int_type(EOF);}
246
+ };
247
+
248
+ inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
249
+ int
250
+ char_traits<char>::compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept
251
+ {
252
+ if (__n == 0)
253
+ return 0;
254
+ #if __has_feature(cxx_constexpr_string_builtins)
255
+ return __builtin_memcmp(__s1, __s2, __n);
256
+ #elif _LIBCUDACXX_STD_VER <= 14
257
+ return memcmp(__s1, __s2, __n);
258
+ #else
259
+ for (; __n; --__n, ++__s1, ++__s2)
260
+ {
261
+ if (lt(*__s1, *__s2))
262
+ return -1;
263
+ if (lt(*__s2, *__s1))
264
+ return 1;
265
+ }
266
+ return 0;
267
+ #endif
268
+ }
269
+
270
+ inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
271
+ const char*
272
+ char_traits<char>::find(const char_type* __s, size_t __n, const char_type& __a) noexcept
273
+ {
274
+ if (__n == 0)
275
+ return nullptr;
276
+ #if __has_feature(cxx_constexpr_string_builtins)
277
+ return __builtin_char_memchr(__s, to_int_type(__a), __n);
278
+ #elif _LIBCUDACXX_STD_VER <= 14
279
+ return (const char_type*) memchr(__s, to_int_type(__a), __n);
280
+ #else
281
+ for (; __n; --__n)
282
+ {
283
+ if (eq(*__s, __a))
284
+ return __s;
285
+ ++__s;
286
+ }
287
+ return nullptr;
288
+ #endif
289
+ }
290
+
291
+
292
+ // char_traits<wchar_t>
293
+
294
+ template <>
295
+ struct _LIBCUDACXX_TEMPLATE_VIS char_traits<wchar_t>
296
+ {
297
+ typedef wchar_t char_type;
298
+ typedef wint_t int_type;
299
+ typedef streamoff off_type;
300
+ typedef streampos pos_type;
301
+ typedef mbstate_t state_type;
302
+
303
+ static inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
304
+ void assign(char_type& __c1, const char_type& __c2) noexcept {__c1 = __c2;}
305
+ static inline constexpr bool eq(char_type __c1, char_type __c2) noexcept
306
+ {return __c1 == __c2;}
307
+ static inline constexpr bool lt(char_type __c1, char_type __c2) noexcept
308
+ {return __c1 < __c2;}
309
+
310
+ static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
311
+ int compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept;
312
+ static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
313
+ size_t length(const char_type* __s) noexcept;
314
+ static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
315
+ const char_type* find(const char_type* __s, size_t __n, const char_type& __a) noexcept;
316
+ static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n) noexcept
317
+ {return __n == 0 ? __s1 : (char_type*)wmemmove(__s1, __s2, __n);}
318
+ static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) noexcept
319
+ {
320
+ _LIBCUDACXX_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
321
+ return __n == 0 ? __s1 : (char_type*)wmemcpy(__s1, __s2, __n);
322
+ }
323
+ static inline char_type* assign(char_type* __s, size_t __n, char_type __a) noexcept
324
+ {return __n == 0 ? __s : (char_type*)wmemset(__s, __a, __n);}
325
+
326
+ static inline constexpr int_type not_eof(int_type __c) noexcept
327
+ {return eq_int_type(__c, eof()) ? ~eof() : __c;}
328
+ static inline constexpr char_type to_char_type(int_type __c) noexcept
329
+ {return char_type(__c);}
330
+ static inline constexpr int_type to_int_type(char_type __c) noexcept
331
+ {return int_type(__c);}
332
+ static inline constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept
333
+ {return __c1 == __c2;}
334
+ static inline constexpr int_type eof() noexcept
335
+ {return int_type(WEOF);}
336
+ };
337
+
338
+ inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
339
+ int
340
+ char_traits<wchar_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept
341
+ {
342
+ if (__n == 0)
343
+ return 0;
344
+ #if __has_feature(cxx_constexpr_string_builtins)
345
+ return __builtin_wmemcmp(__s1, __s2, __n);
346
+ #elif _LIBCUDACXX_STD_VER <= 14
347
+ return wmemcmp(__s1, __s2, __n);
348
+ #else
349
+ for (; __n; --__n, ++__s1, ++__s2)
350
+ {
351
+ if (lt(*__s1, *__s2))
352
+ return -1;
353
+ if (lt(*__s2, *__s1))
354
+ return 1;
355
+ }
356
+ return 0;
357
+ #endif
358
+ }
359
+
360
+
361
+ template <class _Traits>
362
+ _LIBCUDACXX_INLINE_VISIBILITY
363
+ inline constexpr size_t __char_traits_length_checked(const typename _Traits::char_type* __s) noexcept {
364
+ #if _LIBCUDACXX_DEBUG_LEVEL >= 1
365
+ return __s ? _Traits::length(__s) : (_CUDA_VSTD::__libcpp_debug_function(_CUDA_VSTD::__libcpp_debug_info(__FILE__, __LINE__, "p == nullptr", "null pointer pass to non-null argument of char_traits<...>::length")), 0);
366
+ #else
367
+ return _Traits::length(__s);
368
+ #endif
369
+ }
370
+
371
+ inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
372
+ size_t
373
+ char_traits<wchar_t>::length(const char_type* __s) noexcept
374
+ {
375
+ #if __has_feature(cxx_constexpr_string_builtins)
376
+ return __builtin_wcslen(__s);
377
+ #elif _LIBCUDACXX_STD_VER <= 14
378
+ return wcslen(__s);
379
+ #else
380
+ size_t __len = 0;
381
+ for (; !eq(*__s, char_type(0)); ++__s)
382
+ ++__len;
383
+ return __len;
384
+ #endif
385
+ }
386
+
387
+ inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
388
+ const wchar_t*
389
+ char_traits<wchar_t>::find(const char_type* __s, size_t __n, const char_type& __a) noexcept
390
+ {
391
+ if (__n == 0)
392
+ return nullptr;
393
+ #if __has_feature(cxx_constexpr_string_builtins)
394
+ return __builtin_wmemchr(__s, __a, __n);
395
+ #elif _LIBCUDACXX_STD_VER <= 14
396
+ return wmemchr(__s, __a, __n);
397
+ #else
398
+ for (; __n; --__n)
399
+ {
400
+ if (eq(*__s, __a))
401
+ return __s;
402
+ ++__s;
403
+ }
404
+ return nullptr;
405
+ #endif
406
+ }
407
+
408
+
409
+ #ifndef _LIBCUDACXX_NO_HAS_CHAR8_T
410
+
411
+ template <>
412
+ struct _LIBCUDACXX_TEMPLATE_VIS char_traits<char8_t>
413
+ {
414
+ typedef char8_t char_type;
415
+ typedef unsigned int int_type;
416
+ typedef streamoff off_type;
417
+ typedef u8streampos pos_type;
418
+ typedef mbstate_t state_type;
419
+
420
+ static inline constexpr void assign(char_type& __c1, const char_type& __c2) noexcept
421
+ {__c1 = __c2;}
422
+ static inline constexpr bool eq(char_type __c1, char_type __c2) noexcept
423
+ {return __c1 == __c2;}
424
+ static inline constexpr bool lt(char_type __c1, char_type __c2) noexcept
425
+ {return __c1 < __c2;}
426
+
427
+ static constexpr
428
+ int compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept;
429
+
430
+ static constexpr
431
+ size_t length(const char_type* __s) noexcept;
432
+
433
+ _LIBCUDACXX_INLINE_VISIBILITY static constexpr
434
+ const char_type* find(const char_type* __s, size_t __n, const char_type& __a) noexcept;
435
+
436
+ static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) noexcept
437
+ {return __n == 0 ? __s1 : (char_type*) memmove(__s1, __s2, __n);}
438
+
439
+ static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) noexcept
440
+ {
441
+ _LIBCUDACXX_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
442
+ return __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n);
443
+ }
444
+
445
+ static char_type* assign(char_type* __s, size_t __n, char_type __a) noexcept
446
+ {return __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);}
447
+
448
+ static inline constexpr int_type not_eof(int_type __c) noexcept
449
+ {return eq_int_type(__c, eof()) ? ~eof() : __c;}
450
+ static inline constexpr char_type to_char_type(int_type __c) noexcept
451
+ {return char_type(__c);}
452
+ static inline constexpr int_type to_int_type(char_type __c) noexcept
453
+ {return int_type(__c);}
454
+ static inline constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept
455
+ {return __c1 == __c2;}
456
+ static inline constexpr int_type eof() noexcept
457
+ {return int_type(EOF);}
458
+ };
459
+
460
+ // TODO use '__builtin_strlen' if it ever supports char8_t ??
461
+ inline constexpr
462
+ size_t
463
+ char_traits<char8_t>::length(const char_type* __s) noexcept
464
+ {
465
+ size_t __len = 0;
466
+ for (; !eq(*__s, char_type(0)); ++__s)
467
+ ++__len;
468
+ return __len;
469
+ }
470
+
471
+ inline constexpr
472
+ int
473
+ char_traits<char8_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept
474
+ {
475
+ #if __has_feature(cxx_constexpr_string_builtins)
476
+ return __builtin_memcmp(__s1, __s2, __n);
477
+ #else
478
+ for (; __n; --__n, ++__s1, ++__s2)
479
+ {
480
+ if (lt(*__s1, *__s2))
481
+ return -1;
482
+ if (lt(*__s2, *__s1))
483
+ return 1;
484
+ }
485
+ return 0;
486
+ #endif
487
+ }
488
+
489
+ // TODO use '__builtin_char_memchr' if it ever supports char8_t ??
490
+ inline constexpr
491
+ const char8_t*
492
+ char_traits<char8_t>::find(const char_type* __s, size_t __n, const char_type& __a) noexcept
493
+ {
494
+ for (; __n; --__n)
495
+ {
496
+ if (eq(*__s, __a))
497
+ return __s;
498
+ ++__s;
499
+ }
500
+ return 0;
501
+ }
502
+
503
+ #endif // #_LIBCUDACXX_NO_HAS_CHAR8_T
504
+
505
+ #ifndef _LIBCUDACXX_HAS_NO_UNICODE_CHARS
506
+
507
+ template <>
508
+ struct _LIBCUDACXX_TEMPLATE_VIS char_traits<char16_t>
509
+ {
510
+ typedef char16_t char_type;
511
+ typedef uint_least16_t int_type;
512
+ typedef streamoff off_type;
513
+ typedef u16streampos pos_type;
514
+ typedef mbstate_t state_type;
515
+
516
+ static inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
517
+ void assign(char_type& __c1, const char_type& __c2) noexcept {__c1 = __c2;}
518
+ static inline constexpr bool eq(char_type __c1, char_type __c2) noexcept
519
+ {return __c1 == __c2;}
520
+ static inline constexpr bool lt(char_type __c1, char_type __c2) noexcept
521
+ {return __c1 < __c2;}
522
+
523
+ _LIBCUDACXX_INLINE_VISIBILITY static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
524
+ int compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept;
525
+ _LIBCUDACXX_INLINE_VISIBILITY static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
526
+ size_t length(const char_type* __s) noexcept;
527
+ _LIBCUDACXX_INLINE_VISIBILITY static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
528
+ const char_type* find(const char_type* __s, size_t __n, const char_type& __a) noexcept;
529
+ _LIBCUDACXX_INLINE_VISIBILITY
530
+ static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) noexcept;
531
+ _LIBCUDACXX_INLINE_VISIBILITY
532
+ static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) noexcept;
533
+ _LIBCUDACXX_INLINE_VISIBILITY
534
+ static char_type* assign(char_type* __s, size_t __n, char_type __a) noexcept;
535
+
536
+ static inline constexpr int_type not_eof(int_type __c) noexcept
537
+ {return eq_int_type(__c, eof()) ? ~eof() : __c;}
538
+ static inline constexpr char_type to_char_type(int_type __c) noexcept
539
+ {return char_type(__c);}
540
+ static inline constexpr int_type to_int_type(char_type __c) noexcept
541
+ {return int_type(__c);}
542
+ static inline constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept
543
+ {return __c1 == __c2;}
544
+ static inline constexpr int_type eof() noexcept
545
+ {return int_type(0xFFFF);}
546
+ };
547
+
548
+ inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
549
+ int
550
+ char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept
551
+ {
552
+ for (; __n; --__n, ++__s1, ++__s2)
553
+ {
554
+ if (lt(*__s1, *__s2))
555
+ return -1;
556
+ if (lt(*__s2, *__s1))
557
+ return 1;
558
+ }
559
+ return 0;
560
+ }
561
+
562
+ inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
563
+ size_t
564
+ char_traits<char16_t>::length(const char_type* __s) noexcept
565
+ {
566
+ size_t __len = 0;
567
+ for (; !eq(*__s, char_type(0)); ++__s)
568
+ ++__len;
569
+ return __len;
570
+ }
571
+
572
+ inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
573
+ const char16_t*
574
+ char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& __a) noexcept
575
+ {
576
+ for (; __n; --__n)
577
+ {
578
+ if (eq(*__s, __a))
579
+ return __s;
580
+ ++__s;
581
+ }
582
+ return 0;
583
+ }
584
+
585
+ inline
586
+ char16_t*
587
+ char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n) noexcept
588
+ {
589
+ char_type* __r = __s1;
590
+ if (__s1 < __s2)
591
+ {
592
+ for (; __n; --__n, ++__s1, ++__s2)
593
+ assign(*__s1, *__s2);
594
+ }
595
+ else if (__s2 < __s1)
596
+ {
597
+ __s1 += __n;
598
+ __s2 += __n;
599
+ for (; __n; --__n)
600
+ assign(*--__s1, *--__s2);
601
+ }
602
+ return __r;
603
+ }
604
+
605
+ inline
606
+ char16_t*
607
+ char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n) noexcept
608
+ {
609
+ _LIBCUDACXX_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
610
+ char_type* __r = __s1;
611
+ for (; __n; --__n, ++__s1, ++__s2)
612
+ assign(*__s1, *__s2);
613
+ return __r;
614
+ }
615
+
616
+ inline
617
+ char16_t*
618
+ char_traits<char16_t>::assign(char_type* __s, size_t __n, char_type __a) noexcept
619
+ {
620
+ char_type* __r = __s;
621
+ for (; __n; --__n, ++__s)
622
+ assign(*__s, __a);
623
+ return __r;
624
+ }
625
+
626
+ template <>
627
+ struct _LIBCUDACXX_TEMPLATE_VIS char_traits<char32_t>
628
+ {
629
+ typedef char32_t char_type;
630
+ typedef uint_least32_t int_type;
631
+ typedef streamoff off_type;
632
+ typedef u32streampos pos_type;
633
+ typedef mbstate_t state_type;
634
+
635
+ static inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
636
+ void assign(char_type& __c1, const char_type& __c2) noexcept {__c1 = __c2;}
637
+ static inline constexpr bool eq(char_type __c1, char_type __c2) noexcept
638
+ {return __c1 == __c2;}
639
+ static inline constexpr bool lt(char_type __c1, char_type __c2) noexcept
640
+ {return __c1 < __c2;}
641
+
642
+ _LIBCUDACXX_INLINE_VISIBILITY static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
643
+ int compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept;
644
+ _LIBCUDACXX_INLINE_VISIBILITY static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
645
+ size_t length(const char_type* __s) noexcept;
646
+ _LIBCUDACXX_INLINE_VISIBILITY static _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
647
+ const char_type* find(const char_type* __s, size_t __n, const char_type& __a) noexcept;
648
+ _LIBCUDACXX_INLINE_VISIBILITY
649
+ static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) noexcept;
650
+ _LIBCUDACXX_INLINE_VISIBILITY
651
+ static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) noexcept;
652
+ _LIBCUDACXX_INLINE_VISIBILITY
653
+ static char_type* assign(char_type* __s, size_t __n, char_type __a) noexcept;
654
+
655
+ static inline constexpr int_type not_eof(int_type __c) noexcept
656
+ {return eq_int_type(__c, eof()) ? ~eof() : __c;}
657
+ static inline constexpr char_type to_char_type(int_type __c) noexcept
658
+ {return char_type(__c);}
659
+ static inline constexpr int_type to_int_type(char_type __c) noexcept
660
+ {return int_type(__c);}
661
+ static inline constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept
662
+ {return __c1 == __c2;}
663
+ static inline constexpr int_type eof() noexcept
664
+ {return int_type(0xFFFFFFFF);}
665
+ };
666
+
667
+ inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
668
+ int
669
+ char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept
670
+ {
671
+ for (; __n; --__n, ++__s1, ++__s2)
672
+ {
673
+ if (lt(*__s1, *__s2))
674
+ return -1;
675
+ if (lt(*__s2, *__s1))
676
+ return 1;
677
+ }
678
+ return 0;
679
+ }
680
+
681
+ inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
682
+ size_t
683
+ char_traits<char32_t>::length(const char_type* __s) noexcept
684
+ {
685
+ size_t __len = 0;
686
+ for (; !eq(*__s, char_type(0)); ++__s)
687
+ ++__len;
688
+ return __len;
689
+ }
690
+
691
+ inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX14
692
+ const char32_t*
693
+ char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& __a) noexcept
694
+ {
695
+ for (; __n; --__n)
696
+ {
697
+ if (eq(*__s, __a))
698
+ return __s;
699
+ ++__s;
700
+ }
701
+ return 0;
702
+ }
703
+
704
+ inline
705
+ char32_t*
706
+ char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n) noexcept
707
+ {
708
+ char_type* __r = __s1;
709
+ if (__s1 < __s2)
710
+ {
711
+ for (; __n; --__n, ++__s1, ++__s2)
712
+ assign(*__s1, *__s2);
713
+ }
714
+ else if (__s2 < __s1)
715
+ {
716
+ __s1 += __n;
717
+ __s2 += __n;
718
+ for (; __n; --__n)
719
+ assign(*--__s1, *--__s2);
720
+ }
721
+ return __r;
722
+ }
723
+
724
+ inline
725
+ char32_t*
726
+ char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n) noexcept
727
+ {
728
+ _LIBCUDACXX_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
729
+ char_type* __r = __s1;
730
+ for (; __n; --__n, ++__s1, ++__s2)
731
+ assign(*__s1, *__s2);
732
+ return __r;
733
+ }
734
+
735
+ inline
736
+ char32_t*
737
+ char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a) noexcept
738
+ {
739
+ char_type* __r = __s;
740
+ for (; __n; --__n, ++__s)
741
+ assign(*__s, __a);
742
+ return __r;
743
+ }
744
+
745
+ #endif // _LIBCUDACXX_HAS_NO_UNICODE_CHARS
746
+
747
+ // helper fns for basic_string and string_view
748
+
749
+ // __str_find
750
+ template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
751
+ inline _SizeT _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY
752
+ __str_find(const _CharT *__p, _SizeT __sz,
753
+ _CharT __c, _SizeT __pos) noexcept
754
+ {
755
+ if (__pos >= __sz)
756
+ return __npos;
757
+ const _CharT* __r = _Traits::find(__p + __pos, __sz - __pos, __c);
758
+ if (__r == 0)
759
+ return __npos;
760
+ return static_cast<_SizeT>(__r - __p);
761
+ }
762
+
763
+ template <class _CharT, class _Traits>
764
+ inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 const _CharT *
765
+ __search_substring(const _CharT *__first1, const _CharT *__last1,
766
+ const _CharT *__first2, const _CharT *__last2) {
767
+ // Take advantage of knowing source and pattern lengths.
768
+ // Stop short when source is smaller than pattern.
769
+ const ptrdiff_t __len2 = __last2 - __first2;
770
+ if (__len2 == 0)
771
+ return __first1;
772
+
773
+ ptrdiff_t __len1 = __last1 - __first1;
774
+ if (__len1 < __len2)
775
+ return __last1;
776
+
777
+ // First element of __first2 is loop invariant.
778
+ _CharT __f2 = *__first2;
779
+ while (true) {
780
+ __len1 = __last1 - __first1;
781
+ // Check whether __first1 still has at least __len2 bytes.
782
+ if (__len1 < __len2)
783
+ return __last1;
784
+
785
+ // Find __f2 the first byte matching in __first1.
786
+ __first1 = _Traits::find(__first1, __len1 - __len2 + 1, __f2);
787
+ if (__first1 == 0)
788
+ return __last1;
789
+
790
+ // It is faster to compare from the first byte of __first1 even if we
791
+ // already know that it matches the first byte of __first2: this is because
792
+ // __first2 is most likely aligned, as it is user's "pattern" string, and
793
+ // __first1 + 1 is most likely not aligned, as the match is in the middle of
794
+ // the string.
795
+ if (_Traits::compare(__first1, __first2, __len2) == 0)
796
+ return __first1;
797
+
798
+ ++__first1;
799
+ }
800
+ }
801
+
802
+ template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
803
+ inline _SizeT _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY
804
+ __str_find(const _CharT *__p, _SizeT __sz,
805
+ const _CharT* __s, _SizeT __pos, _SizeT __n) noexcept
806
+ {
807
+ if (__pos > __sz)
808
+ return __npos;
809
+
810
+ if (__n == 0) // There is nothing to search, just return __pos.
811
+ return __pos;
812
+
813
+ const _CharT *__r = __search_substring<_CharT, _Traits>(
814
+ __p + __pos, __p + __sz, __s, __s + __n);
815
+
816
+ if (__r == __p + __sz)
817
+ return __npos;
818
+ return static_cast<_SizeT>(__r - __p);
819
+ }
820
+
821
+
822
+ // __str_rfind
823
+
824
+ template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
825
+ inline _SizeT _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY
826
+ __str_rfind(const _CharT *__p, _SizeT __sz,
827
+ _CharT __c, _SizeT __pos) noexcept
828
+ {
829
+ if (__sz < 1)
830
+ return __npos;
831
+ if (__pos < __sz)
832
+ ++__pos;
833
+ else
834
+ __pos = __sz;
835
+ for (const _CharT* __ps = __p + __pos; __ps != __p;)
836
+ {
837
+ if (_Traits::eq(*--__ps, __c))
838
+ return static_cast<_SizeT>(__ps - __p);
839
+ }
840
+ return __npos;
841
+ }
842
+
843
+ template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
844
+ inline _SizeT _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY
845
+ __str_rfind(const _CharT *__p, _SizeT __sz,
846
+ const _CharT* __s, _SizeT __pos, _SizeT __n) noexcept
847
+ {
848
+ __pos = _CUDA_VSTD::min(__pos, __sz);
849
+ if (__n < __sz - __pos)
850
+ __pos += __n;
851
+ else
852
+ __pos = __sz;
853
+ const _CharT* __r = _CUDA_VSTD::__find_end(
854
+ __p, __p + __pos, __s, __s + __n, _Traits::eq,
855
+ random_access_iterator_tag(), random_access_iterator_tag());
856
+ if (__n > 0 && __r == __p + __pos)
857
+ return __npos;
858
+ return static_cast<_SizeT>(__r - __p);
859
+ }
860
+
861
+ // __str_find_first_of
862
+ template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
863
+ inline _SizeT _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY
864
+ __str_find_first_of(const _CharT *__p, _SizeT __sz,
865
+ const _CharT* __s, _SizeT __pos, _SizeT __n) noexcept
866
+ {
867
+ if (__pos >= __sz || __n == 0)
868
+ return __npos;
869
+ const _CharT* __r = _CUDA_VSTD::__find_first_of_ce
870
+ (__p + __pos, __p + __sz, __s, __s + __n, _Traits::eq );
871
+ if (__r == __p + __sz)
872
+ return __npos;
873
+ return static_cast<_SizeT>(__r - __p);
874
+ }
875
+
876
+
877
+ // __str_find_last_of
878
+ template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
879
+ inline _SizeT _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY
880
+ __str_find_last_of(const _CharT *__p, _SizeT __sz,
881
+ const _CharT* __s, _SizeT __pos, _SizeT __n) noexcept
882
+ {
883
+ if (__n != 0)
884
+ {
885
+ if (__pos < __sz)
886
+ ++__pos;
887
+ else
888
+ __pos = __sz;
889
+ for (const _CharT* __ps = __p + __pos; __ps != __p;)
890
+ {
891
+ const _CharT* __r = _Traits::find(__s, __n, *--__ps);
892
+ if (__r)
893
+ return static_cast<_SizeT>(__ps - __p);
894
+ }
895
+ }
896
+ return __npos;
897
+ }
898
+
899
+
900
+ // __str_find_first_not_of
901
+ template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
902
+ inline _SizeT _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY
903
+ __str_find_first_not_of(const _CharT *__p, _SizeT __sz,
904
+ const _CharT* __s, _SizeT __pos, _SizeT __n) noexcept
905
+ {
906
+ if (__pos < __sz)
907
+ {
908
+ const _CharT* __pe = __p + __sz;
909
+ for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps)
910
+ if (_Traits::find(__s, __n, *__ps) == 0)
911
+ return static_cast<_SizeT>(__ps - __p);
912
+ }
913
+ return __npos;
914
+ }
915
+
916
+
917
+ template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
918
+ inline _SizeT _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY
919
+ __str_find_first_not_of(const _CharT *__p, _SizeT __sz,
920
+ _CharT __c, _SizeT __pos) noexcept
921
+ {
922
+ if (__pos < __sz)
923
+ {
924
+ const _CharT* __pe = __p + __sz;
925
+ for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps)
926
+ if (!_Traits::eq(*__ps, __c))
927
+ return static_cast<_SizeT>(__ps - __p);
928
+ }
929
+ return __npos;
930
+ }
931
+
932
+
933
+ // __str_find_last_not_of
934
+ template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
935
+ inline _SizeT _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY
936
+ __str_find_last_not_of(const _CharT *__p, _SizeT __sz,
937
+ const _CharT* __s, _SizeT __pos, _SizeT __n) noexcept
938
+ {
939
+ if (__pos < __sz)
940
+ ++__pos;
941
+ else
942
+ __pos = __sz;
943
+ for (const _CharT* __ps = __p + __pos; __ps != __p;)
944
+ if (_Traits::find(__s, __n, *--__ps) == 0)
945
+ return static_cast<_SizeT>(__ps - __p);
946
+ return __npos;
947
+ }
948
+
949
+
950
+ template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
951
+ inline _SizeT _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY
952
+ __str_find_last_not_of(const _CharT *__p, _SizeT __sz,
953
+ _CharT __c, _SizeT __pos) noexcept
954
+ {
955
+ if (__pos < __sz)
956
+ ++__pos;
957
+ else
958
+ __pos = __sz;
959
+ for (const _CharT* __ps = __p + __pos; __ps != __p;)
960
+ if (!_Traits::eq(*--__ps, __c))
961
+ return static_cast<_SizeT>(__ps - __p);
962
+ return __npos;
963
+ }
964
+
965
+ template<class _Ptr>
966
+ inline _LIBCUDACXX_INLINE_VISIBILITY
967
+ size_t __do_string_hash(_Ptr __p, _Ptr __e)
968
+ {
969
+ typedef typename iterator_traits<_Ptr>::value_type value_type;
970
+ return __murmur2_or_cityhash<size_t>()(__p, (__e-__p)*sizeof(value_type));
971
+ }
972
+
973
+ template <class _CharT, class _Iter, class _Traits=char_traits<_CharT> >
974
+ struct __quoted_output_proxy
975
+ {
976
+ _Iter __first;
977
+ _Iter __last;
978
+ _CharT __delim;
979
+ _CharT __escape;
980
+
981
+ __quoted_output_proxy(_Iter __f, _Iter __l, _CharT __d, _CharT __e)
982
+ : __first(__f), __last(__l), __delim(__d), __escape(__e) {}
983
+ // This would be a nice place for a string_ref
984
+ };
985
+
986
+ _LIBCUDACXX_END_NAMESPACE_STD
987
+
988
+ _LIBCUDACXX_POP_MACROS
989
+
990
+ #endif // _LIBCUDACXX___STRING
cuda_toolkit/include/__threading_support ADDED
@@ -0,0 +1,795 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+ #ifndef _LIBCUDACXX_THREADING_SUPPORT
11
+ #define _LIBCUDACXX_THREADING_SUPPORT
12
+
13
+ #ifndef __cuda_std__
14
+ #include <__config>
15
+ #include <errno.h>
16
+ #else
17
+ #include "__cuda/atomic_prelude.h"
18
+ #endif // __cuda_std__
19
+
20
+ #include "__assert" // all public C++ headers provide the assertion handler
21
+ #include "__functional/hash.h"
22
+ #include "chrono"
23
+ #include "climits"
24
+ #include "iosfwd"
25
+
26
+ #ifndef __cuda_std__
27
+ #include <__pragma_push>
28
+ #endif // __cuda_std__
29
+
30
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
31
+ # pragma GCC system_header
32
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
33
+ # pragma clang system_header
34
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
35
+ # pragma system_header
36
+ #endif // no system header
37
+
38
+ #if defined(_LIBCUDACXX_HAS_THREAD_API_EXTERNAL)
39
+ # ifndef __cuda_std__
40
+ # include <__external_threading>
41
+ # else
42
+ # define _LIBCUDACXX_THREAD_ABI_VISIBILITY inline _LIBCUDACXX_INLINE_VISIBILITY
43
+ # endif
44
+ #elif !defined(_LIBCUDACXX_HAS_NO_THREADS)
45
+
46
+ #if defined(_LIBCUDACXX_HAS_THREAD_API_PTHREAD)
47
+ # include <pthread.h>
48
+ # include <sched.h>
49
+ # include <semaphore.h>
50
+ # if defined(__APPLE__)
51
+ # include <dispatch/dispatch.h>
52
+ # endif
53
+ # if defined(__linux__)
54
+ # include <unistd.h>
55
+ # include <linux/futex.h>
56
+ # include <sys/syscall.h>
57
+ # endif
58
+ #endif
59
+
60
+ #if defined(_LIBCUDACXX_HAS_THREAD_API_WIN32)
61
+ # include <process.h>
62
+ # include <windows.h>
63
+ #endif
64
+
65
+ #if defined(_LIBCUDACXX_HAS_THREAD_LIBRARY_EXTERNAL) || \
66
+ defined(_LIBCUDACXX_BUILDING_THREAD_LIBRARY_EXTERNAL)
67
+ #define _LIBCUDACXX_THREAD_ABI_VISIBILITY _LIBCUDACXX_FUNC_VIS
68
+ #else
69
+ #define _LIBCUDACXX_THREAD_ABI_VISIBILITY inline _LIBCUDACXX_INLINE_VISIBILITY
70
+ #endif
71
+
72
+ #if defined(__FreeBSD__) && defined(_LIBCUDACXX_COMPILER_CLANG) && __has_attribute(no_thread_safety_analysis)
73
+ #define _LIBCUDACXX_NO_THREAD_SAFETY_ANALYSIS __attribute__((no_thread_safety_analysis))
74
+ #else
75
+ #define _LIBCUDACXX_NO_THREAD_SAFETY_ANALYSIS
76
+ #endif
77
+
78
+ typedef ::timespec __libcpp_timespec_t;
79
+ #endif // !defined(_LIBCUDACXX_HAS_NO_THREADS)
80
+
81
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
82
+
83
+ #if !defined(_LIBCUDACXX_HAS_NO_THREADS)
84
+
85
+ #define _LIBCUDACXX_POLLING_COUNT 16
86
+
87
+ _LIBCUDACXX_INLINE_VISIBILITY
88
+ inline void __libcpp_thread_yield_processor()
89
+ {
90
+ #if defined(__aarch64__)
91
+ # define __LIBCUDACXX_ASM_THREAD_YIELD (asm volatile ("yield" :::);)
92
+ #elif defined(__x86_64__)
93
+ # define __LIBCUDACXX_ASM_THREAD_YIELD (asm volatile ("pause" :::);)
94
+ #elif defined (__powerpc__)
95
+ # define __LIBCUDACXX_ASM_THREAD_YIELD (asm volatile ("or 27,27,27":::);)
96
+ #else
97
+ # define __LIBCUDACXX_ASM_THREAD_YIELD (;)
98
+ #endif
99
+ NV_IF_TARGET(
100
+ NV_IS_HOST,
101
+ __LIBCUDACXX_ASM_THREAD_YIELD
102
+ )
103
+ }
104
+
105
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
106
+ void __libcpp_thread_yield();
107
+
108
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
109
+ void __libcpp_thread_sleep_for(chrono::nanoseconds __ns);
110
+
111
+ template<class _Fn>
112
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
113
+ bool __libcpp_thread_poll_with_backoff(_Fn && __f, chrono::nanoseconds __max = chrono::nanoseconds::zero());
114
+
115
+ #if defined(_LIBCUDACXX_HAS_THREAD_API_PTHREAD)
116
+ // Mutex
117
+ typedef pthread_mutex_t __libcpp_mutex_t;
118
+ #define _LIBCUDACXX_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
119
+
120
+ typedef pthread_mutex_t __libcpp_recursive_mutex_t;
121
+
122
+ // Condition Variable
123
+ typedef pthread_cond_t __libcpp_condvar_t;
124
+ #define _LIBCUDACXX_CONDVAR_INITIALIZER PTHREAD_COND_INITIALIZER
125
+
126
+ // Semaphore
127
+ #if defined(__APPLE__)
128
+ typedef dispatch_semaphore_t __libcpp_semaphore_t;
129
+ # define _LIBCUDACXX_SEMAPHORE_MAX numeric_limits<long>::max()
130
+ #else
131
+ typedef sem_t __libcpp_semaphore_t;
132
+ # define _LIBCUDACXX_SEMAPHORE_MAX SEM_VALUE_MAX
133
+ #endif
134
+
135
+ // Execute once
136
+ typedef pthread_once_t __libcpp_exec_once_flag;
137
+ #define _LIBCUDACXX_EXEC_ONCE_INITIALIZER PTHREAD_ONCE_INIT
138
+
139
+ // Thread id
140
+ typedef pthread_t __libcpp_thread_id;
141
+
142
+ // Thread
143
+ #define _LIBCUDACXX_NULL_THREAD 0U
144
+
145
+ typedef pthread_t __libcpp_thread_t;
146
+
147
+ // Thread Local Storage
148
+ typedef pthread_key_t __libcpp_tls_key;
149
+
150
+ #define _LIBCUDACXX_TLS_DESTRUCTOR_CC
151
+ #elif !defined(_LIBCUDACXX_HAS_THREAD_API_EXTERNAL)
152
+ // Mutex
153
+ typedef void* __libcpp_mutex_t;
154
+ #define _LIBCUDACXX_MUTEX_INITIALIZER 0
155
+
156
+ #if defined(_M_IX86) || defined(__i386__) || defined(_M_ARM) || defined(__arm__)
157
+ typedef void* __libcpp_recursive_mutex_t[6];
158
+ #elif defined(_M_AMD64) || defined(__x86_64__) || defined(_M_ARM64) || defined(__aarch64__)
159
+ typedef void* __libcpp_recursive_mutex_t[5];
160
+ #else
161
+ # error Unsupported architecture
162
+ #endif
163
+
164
+ // Condition Variable
165
+ typedef void* __libcpp_condvar_t;
166
+ #define _LIBCUDACXX_CONDVAR_INITIALIZER 0
167
+
168
+ // Semaphore
169
+ typedef void* __libcpp_semaphore_t;
170
+
171
+ // Execute Once
172
+ typedef void* __libcpp_exec_once_flag;
173
+ #define _LIBCUDACXX_EXEC_ONCE_INITIALIZER 0
174
+
175
+ // Thread ID
176
+ typedef long __libcpp_thread_id;
177
+
178
+ // Thread
179
+ #define _LIBCUDACXX_NULL_THREAD 0U
180
+
181
+ typedef void* __libcpp_thread_t;
182
+
183
+ // Thread Local Storage
184
+ typedef long __libcpp_tls_key;
185
+
186
+ #define _LIBCUDACXX_TLS_DESTRUCTOR_CC __stdcall
187
+ #endif // !defined(_LIBCUDACXX_HAS_THREAD_API_PTHREAD) && !defined(_LIBCUDACXX_HAS_THREAD_API_EXTERNAL)
188
+
189
+ #if !defined(_LIBCUDACXX_HAS_THREAD_API_EXTERNAL)
190
+
191
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
192
+ __libcpp_timespec_t __libcpp_to_timespec(const chrono::nanoseconds& __ns);
193
+
194
+ // Mutex
195
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
196
+ int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m);
197
+
198
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY _LIBCUDACXX_NO_THREAD_SAFETY_ANALYSIS
199
+ int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m);
200
+
201
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY _LIBCUDACXX_NO_THREAD_SAFETY_ANALYSIS
202
+ bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m);
203
+
204
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY _LIBCUDACXX_NO_THREAD_SAFETY_ANALYSIS
205
+ int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m);
206
+
207
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
208
+ int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m);
209
+
210
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY _LIBCUDACXX_NO_THREAD_SAFETY_ANALYSIS
211
+ int __libcpp_mutex_lock(__libcpp_mutex_t *__m);
212
+
213
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY _LIBCUDACXX_NO_THREAD_SAFETY_ANALYSIS
214
+ bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m);
215
+
216
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY _LIBCUDACXX_NO_THREAD_SAFETY_ANALYSIS
217
+ int __libcpp_mutex_unlock(__libcpp_mutex_t *__m);
218
+
219
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
220
+ int __libcpp_mutex_destroy(__libcpp_mutex_t *__m);
221
+
222
+ // Condition variable
223
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
224
+ int __libcpp_condvar_signal(__libcpp_condvar_t* __cv);
225
+
226
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
227
+ int __libcpp_condvar_broadcast(__libcpp_condvar_t* __cv);
228
+
229
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY _LIBCUDACXX_NO_THREAD_SAFETY_ANALYSIS
230
+ int __libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m);
231
+
232
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY _LIBCUDACXX_NO_THREAD_SAFETY_ANALYSIS
233
+ int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
234
+ __libcpp_timespec_t *__ts);
235
+
236
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
237
+ int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv);
238
+
239
+ // Semaphore
240
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
241
+ bool __libcpp_semaphore_init(__libcpp_semaphore_t* __sem, int __init);
242
+
243
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
244
+ bool __libcpp_semaphore_destroy(__libcpp_semaphore_t* __sem);
245
+
246
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
247
+ bool __libcpp_semaphore_post(__libcpp_semaphore_t* __sem);
248
+
249
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
250
+ bool __libcpp_semaphore_wait(__libcpp_semaphore_t* __sem);
251
+
252
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
253
+ bool __libcpp_semaphore_wait_timed(__libcpp_semaphore_t* __sem, chrono::nanoseconds const& __ns);
254
+
255
+ // Execute once
256
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
257
+ int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
258
+ void (*init_routine)());
259
+
260
+ // Thread id
261
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
262
+ bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2);
263
+
264
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
265
+ bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2);
266
+
267
+ // Thread
268
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
269
+ bool __libcpp_thread_isnull(const __libcpp_thread_t *__t);
270
+
271
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
272
+ int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
273
+ void *__arg);
274
+
275
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
276
+ __libcpp_thread_id __libcpp_thread_get_current_id();
277
+
278
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
279
+ __libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t);
280
+
281
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
282
+ int __libcpp_thread_join(__libcpp_thread_t *__t);
283
+
284
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
285
+ int __libcpp_thread_detach(__libcpp_thread_t *__t);
286
+
287
+ // Thread local storage
288
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
289
+ int __libcpp_tls_create(__libcpp_tls_key* __key,
290
+ void(_LIBCUDACXX_TLS_DESTRUCTOR_CC* __at_exit)(void*));
291
+
292
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
293
+ void *__libcpp_tls_get(__libcpp_tls_key __key);
294
+
295
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
296
+ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
297
+
298
+ #endif // !defined(_LIBCUDACXX_HAS_THREAD_API_EXTERNAL)
299
+
300
+ #if !defined(_LIBCUDACXX_HAS_THREAD_LIBRARY_EXTERNAL) || defined(_LIBCUDACXX_BUILDING_THREAD_LIBRARY_EXTERNAL)
301
+
302
+ #if defined(_LIBCUDACXX_HAS_THREAD_API_CUDA)
303
+
304
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
305
+ void __libcpp_thread_yield() {}
306
+
307
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
308
+ void __libcpp_thread_sleep_for(chrono::nanoseconds __ns)
309
+ {
310
+ NV_IF_TARGET(
311
+ NV_IS_DEVICE, (
312
+ auto const __step = __ns.count();
313
+ assert(__step < numeric_limits<unsigned>::max());
314
+ asm volatile("nanosleep.u32 %0;"::"r"((unsigned)__step):);
315
+ )
316
+ )
317
+ }
318
+
319
+ #elif defined(_LIBCUDACXX_HAS_THREAD_API_PTHREAD)
320
+
321
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
322
+ __libcpp_timespec_t __libcpp_to_timespec(const chrono::nanoseconds& __ns)
323
+ {
324
+ using namespace chrono;
325
+ seconds __s = duration_cast<seconds>(__ns);
326
+ __libcpp_timespec_t __ts;
327
+ typedef decltype(__ts.tv_sec) ts_sec;
328
+ constexpr ts_sec __ts_sec_max = numeric_limits<ts_sec>::max();
329
+
330
+ if (__s.count() < __ts_sec_max)
331
+ {
332
+ __ts.tv_sec = static_cast<ts_sec>(__s.count());
333
+ __ts.tv_nsec = static_cast<decltype(__ts.tv_nsec)>((__ns - __s).count());
334
+ }
335
+ else
336
+ {
337
+ __ts.tv_sec = __ts_sec_max;
338
+ __ts.tv_nsec = 999999999; // (10^9 - 1)
339
+ }
340
+ return __ts;
341
+ }
342
+
343
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
344
+ int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m)
345
+ {
346
+ pthread_mutexattr_t attr;
347
+ int __ec = pthread_mutexattr_init(&attr);
348
+ if (__ec)
349
+ return __ec;
350
+ __ec = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
351
+ if (__ec) {
352
+ pthread_mutexattr_destroy(&attr);
353
+ return __ec;
354
+ }
355
+ __ec = pthread_mutex_init(__m, &attr);
356
+ if (__ec) {
357
+ pthread_mutexattr_destroy(&attr);
358
+ return __ec;
359
+ }
360
+ __ec = pthread_mutexattr_destroy(&attr);
361
+ if (__ec) {
362
+ pthread_mutex_destroy(__m);
363
+ return __ec;
364
+ }
365
+ return 0;
366
+ }
367
+
368
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
369
+ int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m)
370
+ {
371
+ return pthread_mutex_lock(__m);
372
+ }
373
+
374
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
375
+ bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
376
+ {
377
+ return pthread_mutex_trylock(__m) == 0;
378
+ }
379
+
380
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
381
+ int __libcpp_recursive_mutex_unlock(__libcpp_mutex_t *__m)
382
+ {
383
+ return pthread_mutex_unlock(__m);
384
+ }
385
+
386
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
387
+ int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m)
388
+ {
389
+ return pthread_mutex_destroy(__m);
390
+ }
391
+
392
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
393
+ int __libcpp_mutex_lock(__libcpp_mutex_t *__m)
394
+ {
395
+ return pthread_mutex_lock(__m);
396
+ }
397
+
398
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
399
+ bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
400
+ {
401
+ return pthread_mutex_trylock(__m) == 0;
402
+ }
403
+
404
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
405
+ int __libcpp_mutex_unlock(__libcpp_mutex_t *__m)
406
+ {
407
+ return pthread_mutex_unlock(__m);
408
+ }
409
+
410
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
411
+ int __libcpp_mutex_destroy(__libcpp_mutex_t *__m)
412
+ {
413
+ return pthread_mutex_destroy(__m);
414
+ }
415
+
416
+ // Condition Variable
417
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
418
+ int __libcpp_condvar_signal(__libcpp_condvar_t *__cv)
419
+ {
420
+ return pthread_cond_signal(__cv);
421
+ }
422
+
423
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
424
+ int __libcpp_condvar_broadcast(__libcpp_condvar_t *__cv)
425
+ {
426
+ return pthread_cond_broadcast(__cv);
427
+ }
428
+
429
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
430
+ int __libcpp_condvar_wait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m)
431
+ {
432
+ return pthread_cond_wait(__cv, __m);
433
+ }
434
+
435
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
436
+ int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
437
+ __libcpp_timespec_t *__ts)
438
+ {
439
+ return pthread_cond_timedwait(__cv, __m, __ts);
440
+ }
441
+
442
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
443
+ int __libcpp_condvar_destroy(__libcpp_condvar_t *__cv)
444
+ {
445
+ return pthread_cond_destroy(__cv);
446
+ }
447
+
448
+ // Semaphore
449
+ #if defined(__APPLE__)
450
+
451
+ bool __libcpp_semaphore_init(__libcpp_semaphore_t* __sem, int __init)
452
+ {
453
+ return (*__sem = dispatch_semaphore_create(__init)) != NULL;
454
+ }
455
+
456
+ bool __libcpp_semaphore_destroy(__libcpp_semaphore_t* __sem)
457
+ {
458
+ dispatch_release(*__sem);
459
+ return true;
460
+ }
461
+
462
+ bool __libcpp_semaphore_post(__libcpp_semaphore_t* __sem)
463
+ {
464
+ dispatch_semaphore_signal(*__sem);
465
+ return true;
466
+ }
467
+
468
+ bool __libcpp_semaphore_wait(__libcpp_semaphore_t* __sem)
469
+ {
470
+ return dispatch_semaphore_wait(*__sem, DISPATCH_TIME_FOREVER) == 0;
471
+ }
472
+
473
+ bool __libcpp_semaphore_wait_timed(__libcpp_semaphore_t* __sem, chrono::nanoseconds const& __ns)
474
+ {
475
+ return dispatch_semaphore_wait(*__sem, dispatch_time(DISPATCH_TIME_NOW, __ns.count())) == 0;
476
+ }
477
+
478
+ #else
479
+
480
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
481
+ bool __libcpp_semaphore_init(__libcpp_semaphore_t* __sem, int __init)
482
+ {
483
+ return sem_init(__sem, 0, __init) == 0;
484
+ }
485
+
486
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
487
+ bool __libcpp_semaphore_destroy(__libcpp_semaphore_t* __sem)
488
+ {
489
+ return sem_destroy(__sem) == 0;
490
+ }
491
+
492
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
493
+ bool __libcpp_semaphore_post(__libcpp_semaphore_t* __sem)
494
+ {
495
+ return sem_post(__sem) == 0;
496
+ }
497
+
498
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
499
+ bool __libcpp_semaphore_wait(__libcpp_semaphore_t* __sem)
500
+ {
501
+ return sem_wait(__sem) == 0;
502
+ }
503
+
504
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
505
+ bool __libcpp_semaphore_wait_timed(__libcpp_semaphore_t* __sem, chrono::nanoseconds const& __ns)
506
+ {
507
+ __libcpp_timespec_t __ts = __libcpp_to_timespec(__ns);
508
+ return sem_timedwait(__sem, &__ts) == 0;
509
+ }
510
+
511
+ #endif //__APPLE__
512
+
513
+ // Execute once
514
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
515
+ int __libcpp_execute_once(__libcpp_exec_once_flag *flag, void (*init_routine)())
516
+ {
517
+ return pthread_once(flag, init_routine);
518
+ }
519
+
520
+ // Thread id
521
+ // Returns non-zero if the thread ids are equal, otherwise 0
522
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
523
+ bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2)
524
+ {
525
+ return pthread_equal(t1, t2) != 0;
526
+ }
527
+
528
+ // Returns non-zero if t1 < t2, otherwise 0
529
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
530
+ bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2)
531
+ {
532
+ return t1 < t2;
533
+ }
534
+
535
+ // Thread
536
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
537
+ bool __libcpp_thread_isnull(const __libcpp_thread_t *__t)
538
+ {
539
+ return *__t == 0;
540
+ }
541
+
542
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
543
+ int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
544
+ void *__arg)
545
+ {
546
+ return pthread_create(__t, 0, __func, __arg);
547
+ }
548
+
549
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
550
+ __libcpp_thread_id __libcpp_thread_get_current_id()
551
+ {
552
+ return pthread_self();
553
+ }
554
+
555
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
556
+ __libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t)
557
+ {
558
+ return *__t;
559
+ }
560
+
561
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
562
+ int __libcpp_thread_join(__libcpp_thread_t *__t)
563
+ {
564
+ return pthread_join(*__t, 0);
565
+ }
566
+
567
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
568
+ int __libcpp_thread_detach(__libcpp_thread_t *__t)
569
+ {
570
+ return pthread_detach(*__t);
571
+ }
572
+
573
+ // Thread local storage
574
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
575
+ int __libcpp_tls_create(__libcpp_tls_key *__key, void (*__at_exit)(void *))
576
+ {
577
+ return pthread_key_create(__key, __at_exit);
578
+ }
579
+
580
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
581
+ void *__libcpp_tls_get(__libcpp_tls_key __key)
582
+ {
583
+ return pthread_getspecific(__key);
584
+ }
585
+
586
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
587
+ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p)
588
+ {
589
+ return pthread_setspecific(__key, __p);
590
+ }
591
+
592
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
593
+ void __libcpp_thread_yield()
594
+ {
595
+ sched_yield();
596
+ }
597
+
598
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
599
+ void __libcpp_thread_sleep_for(chrono::nanoseconds __ns)
600
+ {
601
+ __libcpp_timespec_t __ts = __libcpp_to_timespec(__ns);
602
+ while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR);
603
+ }
604
+
605
+ #if defined(__linux__) && !defined(_LIBCUDACXX_HAS_NO_PLATFORM_WAIT)
606
+
607
+ #define _LIBCUDACXX_HAS_PLATFORM_WAIT
608
+
609
+ typedef int __libcpp_platform_wait_t;
610
+
611
+ template<typename _Tp>
612
+ struct __libcpp_platform_wait_uses_type {
613
+ enum { __value = is_same<__remove_cv_t<_Tp>, __libcpp_platform_wait_t>::value };
614
+ };
615
+
616
+ template <class _Tp, typename enable_if<__libcpp_platform_wait_uses_type<_Tp>::__value, int>::type = 1>
617
+ void __libcpp_platform_wait(_Tp const* ptr, _Tp val, void const* timeout) {
618
+ syscall(SYS_futex, ptr, FUTEX_WAIT_PRIVATE, val, timeout, 0, 0);
619
+ }
620
+
621
+ template <class _Tp, typename enable_if<__libcpp_platform_wait_uses_type<_Tp>::__value, int>::type = 1>
622
+ void __libcpp_platform_wake(_Tp const* ptr, bool all) {
623
+ syscall(SYS_futex, ptr, FUTEX_WAKE_PRIVATE, all ? INT_MAX : 1, 0, 0, 0);
624
+ }
625
+
626
+ #endif // defined(__linux__) && !defined(_LIBCUDACXX_HAS_NO_PLATFORM_WAIT)
627
+
628
+ #elif defined(_LIBCUDACXX_HAS_THREAD_API_WIN32)
629
+
630
+ void __libcpp_thread_yield()
631
+ {
632
+ SwitchToThread();
633
+ }
634
+
635
+ void __libcpp_thread_sleep_for(chrono::nanoseconds __ns)
636
+ {
637
+ using namespace chrono;
638
+ // round-up to the nearest milisecond
639
+ milliseconds __ms =
640
+ duration_cast<milliseconds>(__ns + chrono::nanoseconds(999999));
641
+ Sleep(static_cast<DWORD>(__ms.count()));
642
+ }
643
+
644
+ #endif // defined(_LIBCUDACXX_HAS_THREAD_API_WIN32)
645
+
646
+ #endif // !defined(_LIBCUDACXX_HAS_THREAD_LIBRARY_EXTERNAL) || defined(_LIBCUDACXX_BUILDING_THREAD_LIBRARY_EXTERNAL)
647
+
648
+ template<class _Fn>
649
+ _LIBCUDACXX_THREAD_ABI_VISIBILITY
650
+ bool __libcpp_thread_poll_with_backoff(_Fn && __f, chrono::nanoseconds __max)
651
+ {
652
+ chrono::high_resolution_clock::time_point const __start = chrono::high_resolution_clock::now();
653
+ for(int __count = 0;;) {
654
+ if(__f())
655
+ return true;
656
+ if(__count < _LIBCUDACXX_POLLING_COUNT) {
657
+ if(__count > (_LIBCUDACXX_POLLING_COUNT >> 1))
658
+ __libcpp_thread_yield_processor();
659
+ __count += 1;
660
+ continue;
661
+ }
662
+ chrono::high_resolution_clock::duration const __elapsed = chrono::high_resolution_clock::now() - __start;
663
+ if(__max != chrono::nanoseconds::zero() &&
664
+ __max < __elapsed)
665
+ return false;
666
+ chrono::nanoseconds const __step = __elapsed / 4;
667
+ if(__step >= chrono::milliseconds(1))
668
+ __libcpp_thread_sleep_for(chrono::milliseconds(1));
669
+ else if(__step >= chrono::microseconds(10))
670
+ __libcpp_thread_sleep_for(__step);
671
+ else
672
+ __libcpp_thread_yield();
673
+ }
674
+ }
675
+
676
+ #ifndef _LIBCUDACXX_HAS_NO_THREAD_CONTENTION_TABLE
677
+
678
+ struct alignas(64) __libcpp_contention_t {
679
+ #if defined(_LIBCUDACXX_HAS_PLATFORM_WAIT)
680
+ ptrdiff_t __waiters = 0;
681
+ __libcpp_platform_wait_t __version = 0;
682
+ #else
683
+ ptrdiff_t __credit = 0;
684
+ __libcpp_mutex_t __mutex = _LIBCUDACXX_MUTEX_INITIALIZER;
685
+ __libcpp_condvar_t __condvar = _LIBCUDACXX_CONDVAR_INITIALIZER;
686
+ #endif
687
+ };
688
+
689
+ _LIBCUDACXX_FUNC_VIS
690
+ __libcpp_contention_t * __libcpp_contention_state(void const volatile * p) noexcept;
691
+
692
+ #endif // _LIBCUDACXX_HAS_NO_THREAD_CONTENTION_TABLE
693
+
694
+ #if !defined(_LIBCUDACXX_HAS_NO_TREE_BARRIER) && !defined(_LIBCUDACXX_HAS_NO_THREAD_FAVORITE_BARRIER_INDEX)
695
+
696
+ _LIBCUDACXX_EXPORTED_FROM_ABI
697
+ extern thread_local ptrdiff_t __libcpp_thread_favorite_barrier_index;
698
+
699
+ #endif
700
+
701
+ #ifndef __cuda_std__
702
+
703
+ class _LIBCUDACXX_TYPE_VIS thread;
704
+ class _LIBCUDACXX_TYPE_VIS __thread_id;
705
+
706
+ namespace this_thread
707
+ {
708
+
709
+ _LIBCUDACXX_INLINE_VISIBILITY __thread_id get_id() noexcept;
710
+
711
+ } // this_thread
712
+
713
+ template<> struct hash<__thread_id>;
714
+
715
+ class _LIBCUDACXX_TEMPLATE_VIS __thread_id
716
+ {
717
+ // FIXME: pthread_t is a pointer on Darwin but a long on Linux.
718
+ // NULL is the no-thread value on Darwin. Someone needs to check
719
+ // on other platforms. We assume 0 works everywhere for now.
720
+ __libcpp_thread_id __id_;
721
+
722
+ public:
723
+ _LIBCUDACXX_INLINE_VISIBILITY
724
+ __thread_id() noexcept : __id_(0) {}
725
+
726
+ friend _LIBCUDACXX_INLINE_VISIBILITY
727
+ bool operator==(__thread_id __x, __thread_id __y) noexcept
728
+ { // don't pass id==0 to underlying routines
729
+ if (__x.__id_ == 0) return __y.__id_ == 0;
730
+ if (__y.__id_ == 0) return false;
731
+ return __libcpp_thread_id_equal(__x.__id_, __y.__id_);
732
+ }
733
+ friend _LIBCUDACXX_INLINE_VISIBILITY
734
+ bool operator!=(__thread_id __x, __thread_id __y) noexcept
735
+ {return !(__x == __y);}
736
+ friend _LIBCUDACXX_INLINE_VISIBILITY
737
+ bool operator< (__thread_id __x, __thread_id __y) noexcept
738
+ { // id==0 is always less than any other thread_id
739
+ if (__x.__id_ == 0) return __y.__id_ != 0;
740
+ if (__y.__id_ == 0) return false;
741
+ return __libcpp_thread_id_less(__x.__id_, __y.__id_);
742
+ }
743
+ friend _LIBCUDACXX_INLINE_VISIBILITY
744
+ bool operator<=(__thread_id __x, __thread_id __y) noexcept
745
+ {return !(__y < __x);}
746
+ friend _LIBCUDACXX_INLINE_VISIBILITY
747
+ bool operator> (__thread_id __x, __thread_id __y) noexcept
748
+ {return __y < __x ;}
749
+ friend _LIBCUDACXX_INLINE_VISIBILITY
750
+ bool operator>=(__thread_id __x, __thread_id __y) noexcept
751
+ {return !(__x < __y);}
752
+
753
+ _LIBCUDACXX_INLINE_VISIBILITY
754
+ void __reset() { __id_ = 0; }
755
+
756
+ #ifndef __cuda_std__
757
+ template<class _CharT, class _Traits>
758
+ friend
759
+ _LIBCUDACXX_INLINE_VISIBILITY
760
+ basic_ostream<_CharT, _Traits>&
761
+ operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id);
762
+ #endif
763
+
764
+ private:
765
+ _LIBCUDACXX_INLINE_VISIBILITY
766
+ __thread_id(__libcpp_thread_id __id) : __id_(__id) {}
767
+
768
+ friend __thread_id this_thread::get_id() noexcept;
769
+ friend class _LIBCUDACXX_TYPE_VIS thread;
770
+ friend struct _LIBCUDACXX_TEMPLATE_VIS hash<__thread_id>;
771
+ };
772
+
773
+ namespace this_thread
774
+ {
775
+
776
+ inline _LIBCUDACXX_INLINE_VISIBILITY
777
+ __thread_id
778
+ get_id() noexcept
779
+ {
780
+ return __libcpp_thread_get_current_id();
781
+ }
782
+
783
+ } // this_thread
784
+
785
+ #endif // __cuda_std__
786
+
787
+ #endif // !_LIBCUDACXX_HAS_NO_THREADS
788
+
789
+ _LIBCUDACXX_END_NAMESPACE_STD
790
+
791
+ #ifndef __cuda_std__
792
+ #include <__pragma_pop>
793
+ #endif
794
+
795
+ #endif // _LIBCUDACXX_THREADING_SUPPORT
cuda_toolkit/include/__tree ADDED
The diff for this file is too large to render. See raw diff
 
cuda_toolkit/include/__undef_macros ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===------------------------ __undef_macros ------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ //
8
+ //===----------------------------------------------------------------------===//
9
+
10
+
11
+ #ifdef min
12
+ #if !defined(_LIBCUDACXX_DISABLE_MACRO_CONFLICT_WARNINGS)
13
+ #if defined(_LIBCUDACXX_WARNING)
14
+ _LIBCUDACXX_WARNING("macro min is incompatible with C++. Try #define NOMINMAX "
15
+ "before any Windows header. #undefing min")
16
+ #else
17
+ #warning: macro min is incompatible with C++. #undefing min
18
+ #endif
19
+ #endif
20
+ #undef min
21
+ #endif
22
+
23
+ #ifdef max
24
+ #if !defined(_LIBCUDACXX_DISABLE_MACRO_CONFLICT_WARNINGS)
25
+ #if defined(_LIBCUDACXX_WARNING)
26
+ _LIBCUDACXX_WARNING("macro max is incompatible with C++. Try #define NOMINMAX "
27
+ "before any Windows header. #undefing max")
28
+ #else
29
+ #warning: macro max is incompatible with C++. #undefing max
30
+ #endif
31
+ #endif
32
+ #undef max
33
+ #endif
cuda_toolkit/include/__verbose_abort ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // -*- C++ -*-
2
+ //===----------------------------------------------------------------------===//
3
+ //
4
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
+ // See https://llvm.org/LICENSE.txt for license information.
6
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
+ // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
8
+ //
9
+ //===----------------------------------------------------------------------===//
10
+
11
+ #ifndef _LIBCUDACXX___VERBOSE_ABORT
12
+ #define _LIBCUDACXX___VERBOSE_ABORT
13
+
14
+ #ifndef __cuda_std__
15
+ #include <__config>
16
+ #endif // __cuda_std__
17
+
18
+ #include "__availability"
19
+
20
+ #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
21
+ # pragma GCC system_header
22
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
23
+ # pragma clang system_header
24
+ #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
25
+ # pragma system_header
26
+ #endif // no system header
27
+
28
+ // Provide a default implementation of __libcpp_verbose_abort if we know that neither the built
29
+ // library nor the user is providing one. Otherwise, just declare it and use the one from the
30
+ // built library or the one provided by the user.
31
+ //
32
+ // We can't provide a great implementation because it needs to be pretty much
33
+ // dependency-free (this is included everywhere else in the library).
34
+ #if defined(_LIBCUDACXX_HAS_NO_VERBOSE_ABORT_IN_LIBRARY) && !defined(_LIBCUDACXX_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED)
35
+
36
+ extern "C" void abort();
37
+
38
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
39
+
40
+ _LIBCUDACXX_NORETURN _LIBCUDACXX_ATTRIBUTE_FORMAT(__printf__, 1, 2) _LIBCUDACXX_HIDE_FROM_ABI inline
41
+ void __libcpp_verbose_abort(const char *, ...) {
42
+ ::abort();
43
+ __builtin_unreachable(); // never reached, but needed to tell the compiler that the function never returns
44
+ }
45
+
46
+ _LIBCUDACXX_END_NAMESPACE_STD
47
+
48
+ #else
49
+
50
+ _LIBCUDACXX_BEGIN_NAMESPACE_STD
51
+
52
+ _LIBCUDACXX_NORETURN _LIBCUDACXX_OVERRIDABLE_FUNC_VIS _LIBCUDACXX_ATTRIBUTE_FORMAT(__printf__, 1, 2)
53
+ void __libcpp_verbose_abort(const char *__format, ...);
54
+
55
+ _LIBCUDACXX_END_NAMESPACE_STD
56
+
57
+ #endif
58
+
59
+ #endif // _LIBCUDACXX___VERBOSE_ABORT
cuda_toolkit/include/algorithm ADDED
The diff for this file is too large to render. See raw diff