diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/assign_value.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/assign_value.h new file mode 100644 index 0000000000000000000000000000000000000000..d5b3d7125cd0ed56a28e5e60f213cf0b4a45b221 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/assign_value.h @@ -0,0 +1,51 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// the purpose of this header is to #include the assign_value.h header +// of the sequential, host, and device systems. It should be #included in any +// code which uses adl to dispatch assign_value + +#include + +// SCons can't see through the #defines below to figure out what this header +// includes, so we fake it out by specifying all possible files we might end up +// including inside an #if 0. +#if 0 +# include +# include +# include +# include +#endif + +#define __THRUST_HOST_SYSTEM_ASSIGN_VALUE_HEADER <__THRUST_HOST_SYSTEM_ROOT/detail/assign_value.h> +#include __THRUST_HOST_SYSTEM_ASSIGN_VALUE_HEADER +#undef __THRUST_HOST_SYSTEM_ASSIGN_VALUE_HEADER + +#define __THRUST_DEVICE_SYSTEM_ASSIGN_VALUE_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/detail/assign_value.h> +#include __THRUST_DEVICE_SYSTEM_ASSIGN_VALUE_HEADER +#undef __THRUST_DEVICE_SYSTEM_ASSIGN_VALUE_HEADER diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/async/copy.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/async/copy.h new file mode 100644 index 0000000000000000000000000000000000000000..91895addf042161e355db72c6c838533b8b88340 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/async/copy.h @@ -0,0 +1,41 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// The purpose of this header is to #include the async/copy.h header of the +// sequential, host, and device systems. It should be #included in any code +// which uses ADL to dispatch async copy. + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// #include + +// #define __THRUST_HOST_SYSTEM_ASYNC_COPY_HEADER <__THRUST_HOST_SYSTEM_ROOT/detail/async/copy.h> +// #include __THRUST_HOST_SYSTEM_ASYNC_COPY_HEADER +// #undef __THRUST_HOST_SYSTEM_ASYNC_COPY_HEADER + +#define __THRUST_DEVICE_SYSTEM_ASYNC_COPY_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/detail/async/copy.h> +#include __THRUST_DEVICE_SYSTEM_ASYNC_COPY_HEADER +#undef __THRUST_DEVICE_SYSTEM_ASYNC_COPY_HEADER diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/async/for_each.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/async/for_each.h new file mode 100644 index 0000000000000000000000000000000000000000..39da31b2be10e33c81db73beff127253ee3bb141 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/async/for_each.h @@ -0,0 +1,41 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// The purpose of this header is to #include the async/for_each.h header of the +// sequential, host, and device systems. It should be #included in any code +// which uses ADL to dispatch async for_each. + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// #include + +// #define __THRUST_HOST_SYSTEM_ASYNC_FOR_EACH_HEADER <__THRUST_HOST_SYSTEM_ROOT/detail/async/for_each.h> +// #include __THRUST_HOST_SYSTEM_ASYNC_FOR_EACH_HEADER +// #undef __THRUST_HOST_SYSTEM_ASYNC_FOR_EACH_HEADER + +#define __THRUST_DEVICE_SYSTEM_ASYNC_FOR_EACH_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/detail/async/for_each.h> +#include __THRUST_DEVICE_SYSTEM_ASYNC_FOR_EACH_HEADER +#undef __THRUST_DEVICE_SYSTEM_ASYNC_FOR_EACH_HEADER diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/async/reduce.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/async/reduce.h new file mode 100644 index 0000000000000000000000000000000000000000..eee553d04c2b8b49c48cb48f7580746a919a4744 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/async/reduce.h @@ -0,0 +1,41 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// The purpose of this header is to #include the async/reduce.h header of the +// sequential, host, and device systems. It should be #included in any code +// which uses ADL to dispatch async reduce. + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// #include + +// #define __THRUST_HOST_SYSTEM_ASYNC_REDUCE_HEADER <__THRUST_HOST_SYSTEM_ROOT/detail/async/reduce.h> +// #include __THRUST_HOST_SYSTEM_ASYNC_REDUCE_HEADER +// #undef __THRUST_HOST_SYSTEM_ASYNC_REDUCE_HEADER + +#define __THRUST_DEVICE_SYSTEM_ASYNC_REDUCE_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/detail/async/reduce.h> +#include __THRUST_DEVICE_SYSTEM_ASYNC_REDUCE_HEADER +#undef __THRUST_DEVICE_SYSTEM_ASYNC_REDUCE_HEADER diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/async/scan.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/async/scan.h new file mode 100644 index 0000000000000000000000000000000000000000..3ee9a9a867d621e2a6f2202166644793295e6389 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/async/scan.h @@ -0,0 +1,41 @@ +/* + * Copyright 2008-2020 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// The purpose of this header is to #include the async/scan.h header of the +// sequential, host, and device systems. It should be #included in any code +// which uses ADL to dispatch async scans. + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// #include + +// #define __THRUST_HOST_SYSTEM_ASYNC_SCAN_HEADER <__THRUST_HOST_SYSTEM_ROOT/detail/async/scan.h> +// #include __THRUST_HOST_SYSTEM_ASYNC_SCAN_HEADER +// #undef __THRUST_HOST_SYSTEM_ASYNC_SCAN_HEADER + +#define __THRUST_DEVICE_SYSTEM_ASYNC_SCAN_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/detail/async/scan.h> +#include __THRUST_DEVICE_SYSTEM_ASYNC_SCAN_HEADER +#undef __THRUST_DEVICE_SYSTEM_ASYNC_SCAN_HEADER diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/async/sort.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/async/sort.h new file mode 100644 index 0000000000000000000000000000000000000000..928936f82362f37c82b26edaff446d6d65b981f1 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/async/sort.h @@ -0,0 +1,41 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// The purpose of this header is to #include the async/sort.h header of the +// sequential, host, and device systems. It should be #included in any code +// which uses ADL to dispatch async sort. + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// #include + +// #define __THRUST_HOST_SYSTEM_ASYNC_SORT_HEADER <__THRUST_HOST_SYSTEM_ROOT/detail/async/sort.h> +// #include __THRUST_HOST_SYSTEM_ASYNC_SORT_HEADER +// #undef __THRUST_HOST_SYSTEM_ASYNC_SORT_HEADER + +#define __THRUST_DEVICE_SYSTEM_ASYNC_SORT_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/detail/async/sort.h> +#include __THRUST_DEVICE_SYSTEM_ASYNC_SORT_HEADER +#undef __THRUST_DEVICE_SYSTEM_ASYNC_SORT_HEADER diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/async/transform.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/async/transform.h new file mode 100644 index 0000000000000000000000000000000000000000..f69629edf112061779e6c4577e7ffd09db388440 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/async/transform.h @@ -0,0 +1,41 @@ +/* + * Copyright 2008-2018 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a transform of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// The purpose of this header is to #include the async/transform.h header of the +// sequential, host, and device systems. It should be #included in any code +// which uses ADL to dispatch async transform. + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// #include + +// #define __THRUST_HOST_SYSTEM_ASYNC_TRANSFORM_HEADER <__THRUST_HOST_SYSTEM_ROOT/detail/async/transform.h> +// #include __THRUST_HOST_SYSTEM_ASYNC_TRANSFORM_HEADER +// #undef __THRUST_HOST_SYSTEM_ASYNC_TRANSFORM_HEADER + +#define __THRUST_DEVICE_SYSTEM_ASYNC_TRANSFORM_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/detail/async/transform.h> +#include __THRUST_DEVICE_SYSTEM_ASYNC_TRANSFORM_HEADER +#undef __THRUST_DEVICE_SYSTEM_ASYNC_TRANSFORM_HEADER diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/copy.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/copy.h new file mode 100644 index 0000000000000000000000000000000000000000..31be3233343e6324de9baa16f3c7931cc50a726f --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/copy.h @@ -0,0 +1,51 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// the purpose of this header is to #include the copy.h header +// of the sequential, host, and device systems. It should be #included in any +// code which uses adl to dispatch copy + +#include + +// SCons can't see through the #defines below to figure out what this header +// includes, so we fake it out by specifying all possible files we might end up +// including inside an #if 0. +#if 0 +# include +# include +# include +# include +#endif + +#define __THRUST_HOST_SYSTEM_COPY_HEADER <__THRUST_HOST_SYSTEM_ROOT/detail/copy.h> +#include __THRUST_HOST_SYSTEM_COPY_HEADER +#undef __THRUST_HOST_SYSTEM_COPY_HEADER + +#define __THRUST_DEVICE_SYSTEM_COPY_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/detail/copy.h> +#include __THRUST_DEVICE_SYSTEM_COPY_HEADER +#undef __THRUST_DEVICE_SYSTEM_COPY_HEADER diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/find.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/find.h new file mode 100644 index 0000000000000000000000000000000000000000..92bae82980a5f88fe21cfc9b19af04310fb95a41 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/find.h @@ -0,0 +1,51 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a fill of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// the purpose of this header is to #include the find.h header +// of the sequential, host, and device systems. It should be #included in any +// code which uses adl to dispatch find + +#include + +// SCons can't see through the #defines below to figure out what this header +// includes, so we fake it out by specifying all possible files we might end up +// including inside an #if 0. +#if 0 +# include +# include +# include +# include +#endif + +#define __THRUST_HOST_SYSTEM_FIND_HEADER <__THRUST_HOST_SYSTEM_ROOT/detail/find.h> +#include __THRUST_HOST_SYSTEM_FIND_HEADER +#undef __THRUST_HOST_SYSTEM_FIND_HEADER + +#define __THRUST_DEVICE_SYSTEM_FIND_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/detail/find.h> +#include __THRUST_DEVICE_SYSTEM_FIND_HEADER +#undef __THRUST_DEVICE_SYSTEM_FIND_HEADER diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/for_each.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/for_each.h new file mode 100644 index 0000000000000000000000000000000000000000..055dbdfb4b3abd2b2a7242adef9e3708490ab33f --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/for_each.h @@ -0,0 +1,51 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// the purpose of this header is to #include the for_each.h header +// of the sequential, host, and device systems. It should be #included in any +// code which uses adl to dispatch for_each + +#include + +// SCons can't see through the #defines below to figure out what this header +// includes, so we fake it out by specifying all possible files we might end up +// including inside an #if 0. +#if 0 +# include +# include +# include +# include +#endif + +#define __THRUST_HOST_SYSTEM_FOR_EACH_HEADER <__THRUST_HOST_SYSTEM_ROOT/detail/for_each.h> +#include __THRUST_HOST_SYSTEM_FOR_EACH_HEADER +#undef __THRUST_HOST_SYSTEM_FOR_EACH_HEADER + +#define __THRUST_DEVICE_SYSTEM_FOR_EACH_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/detail/for_each.h> +#include __THRUST_DEVICE_SYSTEM_FOR_EACH_HEADER +#undef __THRUST_DEVICE_SYSTEM_FOR_EACH_HEADER diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/gather.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/gather.h new file mode 100644 index 0000000000000000000000000000000000000000..d5d6d3c44f24cb33fa438f3ec9dbb3e90792c185 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/gather.h @@ -0,0 +1,51 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a fill of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// the purpose of this header is to #include the gather.h header +// of the sequential, host, and device systems. It should be #included in any +// code which uses adl to dispatch gather + +#include + +// SCons can't see through the #defines below to figure out what this header +// includes, so we fake it out by specifying all possible files we might end up +// including inside an #if 0. +#if 0 +# include +# include +# include +# include +#endif + +#define __THRUST_HOST_SYSTEM_GATHER_HEADER <__THRUST_HOST_SYSTEM_ROOT/detail/gather.h> +#include __THRUST_HOST_SYSTEM_GATHER_HEADER +#undef __THRUST_HOST_SYSTEM_GATHER_HEADER + +#define __THRUST_DEVICE_SYSTEM_GATHER_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/detail/gather.h> +#include __THRUST_DEVICE_SYSTEM_GATHER_HEADER +#undef __THRUST_DEVICE_SYSTEM_GATHER_HEADER diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/iter_swap.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/iter_swap.h new file mode 100644 index 0000000000000000000000000000000000000000..7b5d9a5458c13631b3bb3acd561e2518e6558815 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/iter_swap.h @@ -0,0 +1,51 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// the purpose of this header is to #include the iter_swap.h header +// of the sequential, host, and device systems. It should be #included in any +// code which uses adl to dispatch iter_swap + +#include + +// SCons can't see through the #defines below to figure out what this header +// includes, so we fake it out by specifying all possible files we might end up +// including inside an #if 0. +#if 0 +# include +# include +# include +# include +#endif + +#define __THRUST_HOST_SYSTEM_ITER_SWAP_HEADER <__THRUST_HOST_SYSTEM_ROOT/detail/iter_swap.h> +#include __THRUST_HOST_SYSTEM_ITER_SWAP_HEADER +#undef __THRUST_HOST_SYSTEM_ITER_SWAP_HEADER + +#define __THRUST_DEVICE_SYSTEM_ITER_SWAP_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/detail/iter_swap.h> +#include __THRUST_DEVICE_SYSTEM_ITER_SWAP_HEADER +#undef __THRUST_DEVICE_SYSTEM_ITER_SWAP_HEADER diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/reduce.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/reduce.h new file mode 100644 index 0000000000000000000000000000000000000000..b2303da0df382eca66646afc30a107907eb05f65 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/reduce.h @@ -0,0 +1,51 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// the purpose of this header is to #include the reduce.h header +// of the sequential, host, and device systems. It should be #included in any +// code which uses adl to dispatch reduce + +#include + +// SCons can't see through the #defines below to figure out what this header +// includes, so we fake it out by specifying all possible files we might end up +// including inside an #if 0. +#if 0 +# include +# include +# include +# include +#endif + +#define __THRUST_HOST_SYSTEM_REDUCE_HEADER <__THRUST_HOST_SYSTEM_ROOT/detail/reduce.h> +#include __THRUST_HOST_SYSTEM_REDUCE_HEADER +#undef __THRUST_HOST_SYSTEM_REDUCE_HEADER + +#define __THRUST_DEVICE_SYSTEM_REDUCE_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/detail/reduce.h> +#include __THRUST_DEVICE_SYSTEM_REDUCE_HEADER +#undef __THRUST_DEVICE_SYSTEM_REDUCE_HEADER diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/set_operations.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/set_operations.h new file mode 100644 index 0000000000000000000000000000000000000000..4f311dc0f4b14a1ef1d0937778d41a21fa9c549d --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/set_operations.h @@ -0,0 +1,51 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a fill of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// the purpose of this header is to #include the set_operations.h header +// of the sequential, host, and device systems. It should be #included in any +// code which uses adl to dispatch set_operations + +#include + +// SCons can't see through the #defines below to figure out what this header +// includes, so we fake it out by specifying all possible files we might end up +// including inside an #if 0. +#if 0 +# include +# include +# include +# include +#endif + +#define __THRUST_HOST_SYSTEM_SET_OPERATIONS_HEADER <__THRUST_HOST_SYSTEM_ROOT/detail/set_operations.h> +#include __THRUST_HOST_SYSTEM_SET_OPERATIONS_HEADER +#undef __THRUST_HOST_SYSTEM_SET_OPERATIONS_HEADER + +#define __THRUST_DEVICE_SYSTEM_SET_OPERATIONS_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/detail/set_operations.h> +#include __THRUST_DEVICE_SYSTEM_SET_OPERATIONS_HEADER +#undef __THRUST_DEVICE_SYSTEM_SET_OPERATIONS_HEADER diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/swap_ranges.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/swap_ranges.h new file mode 100644 index 0000000000000000000000000000000000000000..0da9dd58f96ef4adf70caef15dd893a0f0ba2f2b --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/swap_ranges.h @@ -0,0 +1,51 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a fill of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// the purpose of this header is to #include the swap_ranges.h header +// of the sequential, host, and device systems. It should be #included in any +// code which uses adl to dispatch swap_ranges + +#include + +// SCons can't see through the #defines below to figure out what this header +// includes, so we fake it out by specifying all possible files we might end up +// including inside an #if 0. +#if 0 +# include +# include +# include +# include +#endif + +#define __THRUST_HOST_SYSTEM_SWAP_RANGES_HEADER <__THRUST_HOST_SYSTEM_ROOT/detail/swap_ranges.h> +#include __THRUST_HOST_SYSTEM_SWAP_RANGES_HEADER +#undef __THRUST_HOST_SYSTEM_SWAP_RANGES_HEADER + +#define __THRUST_DEVICE_SYSTEM_SWAP_RANGES_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/detail/swap_ranges.h> +#include __THRUST_DEVICE_SYSTEM_SWAP_RANGES_HEADER +#undef __THRUST_DEVICE_SYSTEM_SWAP_RANGES_HEADER diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/temporary_buffer.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/temporary_buffer.h new file mode 100644 index 0000000000000000000000000000000000000000..da166dd66bdf63e9508d332110011257ab894b20 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/temporary_buffer.h @@ -0,0 +1,51 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// the purpose of this header is to #include the temporary_buffer.h header +// of the sequential, host, and device systems. It should be #included in any +// code which uses adl to dispatch get_temporary_buffer or return_temporary_buffer + +#include + +// SCons can't see through the #defines below to figure out what this header +// includes, so we fake it out by specifying all possible files we might end up +// including inside an #if 0. +#if 0 +# include +# include +# include +# include +#endif + +#define __THRUST_HOST_SYSTEM_TEMPORARY_BUFFER_HEADER <__THRUST_HOST_SYSTEM_ROOT/detail/temporary_buffer.h> +#include __THRUST_HOST_SYSTEM_TEMPORARY_BUFFER_HEADER +#undef __THRUST_HOST_SYSTEM_TEMPORARY_BUFFER_HEADER + +#define __THRUST_DEVICE_SYSTEM_TEMPORARY_BUFFER_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/detail/temporary_buffer.h> +#include __THRUST_DEVICE_SYSTEM_TEMPORARY_BUFFER_HEADER +#undef __THRUST_DEVICE_SYSTEM_TEMPORARY_BUFFER_HEADER diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/uninitialized_fill.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/uninitialized_fill.h new file mode 100644 index 0000000000000000000000000000000000000000..6651923f7573e62bf6525df93062c203afca7af6 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/uninitialized_fill.h @@ -0,0 +1,51 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a fill of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// the purpose of this header is to #include the uninitialized_fill.h header +// of the sequential, host, and device systems. It should be #included in any +// code which uses adl to dispatch uninitialized_fill + +#include + +// SCons can't see through the #defines below to figure out what this header +// includes, so we fake it out by specifying all possible files we might end up +// including inside an #if 0. +#if 0 +# include +# include +# include +# include +#endif + +#define __THRUST_HOST_SYSTEM_UNINITIALIZED_FILL_HEADER <__THRUST_HOST_SYSTEM_ROOT/detail/uninitialized_fill.h> +#include __THRUST_HOST_SYSTEM_UNINITIALIZED_FILL_HEADER +#undef __THRUST_HOST_SYSTEM_UNINITIALIZED_FILL_HEADER + +#define __THRUST_DEVICE_SYSTEM_UNINITIALIZED_FILL_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/detail/uninitialized_fill.h> +#include __THRUST_DEVICE_SYSTEM_UNINITIALIZED_FILL_HEADER +#undef __THRUST_DEVICE_SYSTEM_UNINITIALIZED_FILL_HEADER diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/unique_by_key.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/unique_by_key.h new file mode 100644 index 0000000000000000000000000000000000000000..15d1869aa1486d026333fcf39b0cf3b9e1b74d3c --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/adl/unique_by_key.h @@ -0,0 +1,51 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a fill of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// the purpose of this header is to #include the unique_by_key.h header +// of the sequential, host, and device systems. It should be #included in any +// code which uses adl to dispatch unique_by_key + +#include + +// SCons can't see through the #defines below to figure out what this header +// includes, so we fake it out by specifying all possible files we might end up +// including inside an #if 0. +#if 0 +# include +# include +# include +# include +#endif + +#define __THRUST_HOST_SYSTEM_UNIQUE_BY_KEY_HEADER <__THRUST_HOST_SYSTEM_ROOT/detail/unique_by_key.h> +#include __THRUST_HOST_SYSTEM_UNIQUE_BY_KEY_HEADER +#undef __THRUST_HOST_SYSTEM_UNIQUE_BY_KEY_HEADER + +#define __THRUST_DEVICE_SYSTEM_UNIQUE_BY_KEY_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/detail/unique_by_key.h> +#include __THRUST_DEVICE_SYSTEM_UNIQUE_BY_KEY_HEADER +#undef __THRUST_DEVICE_SYSTEM_UNIQUE_BY_KEY_HEADER diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/adjacent_difference.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/adjacent_difference.h new file mode 100644 index 0000000000000000000000000000000000000000..f72b390bc3298109aa53464daddc61c35aec0c9f --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/adjacent_difference.h @@ -0,0 +1,76 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! \file adjacent_difference.h + * \brief Sequential implementation of adjacent_difference. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator adjacent_difference( + sequential::execution_policy&, + InputIterator first, + InputIterator last, + OutputIterator result, + BinaryFunction binary_op) +{ + using InputType = typename thrust::iterator_traits::value_type; + + if (first == last) + { + return result; + } + + InputType curr = *first; + + *result = curr; + + while (++first != last) + { + InputType next = *first; + *(++result) = binary_op(next, curr); + curr = next; + } + + return ++result; +} + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/assign_value.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/assign_value.h new file mode 100644 index 0000000000000000000000000000000000000000..66c16126176d200e4753bf5e02f01bd092b4838d --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/assign_value.h @@ -0,0 +1,48 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +template +_CCCL_HOST_DEVICE void assign_value(sequential::execution_policy&, Pointer1 dst, Pointer2 src) +{ + *thrust::raw_pointer_cast(dst) = *thrust::raw_pointer_cast(src); +} // end assign_value() + +} // namespace sequential +} // namespace detail +} // namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/binary_search.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/binary_search.h new file mode 100644 index 0000000000000000000000000000000000000000..b81843eceadd6e2dd15fe094854af9729e4dced5 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/binary_search.h @@ -0,0 +1,142 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! \file binary_search.h + * \brief Sequential implementation of binary search algorithms. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#include +#include +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE ForwardIterator lower_bound( + sequential::execution_policy&, + ForwardIterator first, + ForwardIterator last, + const T& val, + StrictWeakOrdering comp) +{ + // wrap comp + thrust::detail::wrapped_function wrapped_comp{comp}; + + using difference_type = typename thrust::iterator_difference::type; + + difference_type len = thrust::distance(first, last); + + while (len > 0) + { + difference_type half = len >> 1; + ForwardIterator middle = first; + + thrust::advance(middle, half); + + if (wrapped_comp(*middle, val)) + { + first = middle; + ++first; + len = len - half - 1; + } + else + { + len = half; + } + } + + return first; +} + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE ForwardIterator upper_bound( + sequential::execution_policy&, + ForwardIterator first, + ForwardIterator last, + const T& val, + StrictWeakOrdering comp) +{ + // wrap comp + thrust::detail::wrapped_function wrapped_comp{comp}; + + using difference_type = typename thrust::iterator_difference::type; + + difference_type len = thrust::distance(first, last); + + while (len > 0) + { + difference_type half = len >> 1; + ForwardIterator middle = first; + + thrust::advance(middle, half); + + if (wrapped_comp(val, *middle)) + { + len = half; + } + else + { + first = middle; + ++first; + len = len - half - 1; + } + } + + return first; +} + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE bool binary_search( + sequential::execution_policy& exec, + ForwardIterator first, + ForwardIterator last, + const T& val, + StrictWeakOrdering comp) +{ + ForwardIterator iter = sequential::lower_bound(exec, first, last, val, comp); + + // wrap comp + thrust::detail::wrapped_function wrapped_comp{comp}; + + return iter != last && !wrapped_comp(val, *iter); +} + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/copy.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/copy.h new file mode 100644 index 0000000000000000000000000000000000000000..a6f116e30e675a8903935daa28ce75347a4136da --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/copy.h @@ -0,0 +1,55 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! \file copy.h + * \brief Sequential implementations of copy algorithms. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +template +_CCCL_HOST_DEVICE OutputIterator +copy(sequential::execution_policy& exec, InputIterator first, InputIterator last, OutputIterator result); + +template +_CCCL_HOST_DEVICE OutputIterator +copy_n(sequential::execution_policy& exec, InputIterator first, Size n, OutputIterator result); + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END + +#include diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/copy.inl b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/copy.inl new file mode 100644 index 0000000000000000000000000000000000000000..b6a4958cacffd537c556523c0a3931e7a21cea45 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/copy.inl @@ -0,0 +1,125 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include +#include +#include +#include +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ +namespace copy_detail +{ + +// returns the raw pointer associated with a Pointer-like thing +template +_CCCL_HOST_DEVICE typename thrust::detail::pointer_traits::raw_pointer get(Pointer ptr) +{ + return thrust::detail::pointer_traits::get(ptr); +} + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator +copy(InputIterator first, + InputIterator last, + OutputIterator result, + thrust::detail::true_type) // is_indirectly_trivially_relocatable_to +{ + using Size = typename thrust::iterator_difference::type; + + const Size n = last - first; + thrust::system::detail::sequential::trivial_copy_n(get(&*first), n, get(&*result)); + return result + n; +} // end copy() + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator +copy(InputIterator first, + InputIterator last, + OutputIterator result, + thrust::detail::false_type) // is_indirectly_trivially_relocatable_to +{ + return thrust::system::detail::sequential::general_copy(first, last, result); +} // end copy() + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator copy_n( + InputIterator first, + Size n, + OutputIterator result, + thrust::detail::true_type) // is_indirectly_trivially_relocatable_to +{ + thrust::system::detail::sequential::trivial_copy_n(get(&*first), n, get(&*result)); + return result + n; +} // end copy_n() + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator copy_n( + InputIterator first, + Size n, + OutputIterator result, + thrust::detail::false_type) // is_indirectly_trivially_relocatable_to +{ + return thrust::system::detail::sequential::general_copy_n(first, n, result); +} // end copy_n() + +} // end namespace copy_detail + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator +copy(sequential::execution_policy&, InputIterator first, InputIterator last, OutputIterator result) +{ + return thrust::system::detail::sequential::copy_detail::copy( + first, last, result, typename thrust::is_indirectly_trivially_relocatable_to::type()); +} // end copy() + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator +copy_n(sequential::execution_policy&, InputIterator first, Size n, OutputIterator result) +{ + return thrust::system::detail::sequential::copy_detail::copy_n( + first, n, result, typename thrust::is_indirectly_trivially_relocatable_to::type()); +} // end copy_n() + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/copy_backward.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/copy_backward.h new file mode 100644 index 0000000000000000000000000000000000000000..5c88f533f763af10dab8ca1614f1871eaed372c7 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/copy_backward.h @@ -0,0 +1,55 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE BidirectionalIterator2 +copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last, BidirectionalIterator2 result) +{ + while (first != last) + { + --last; + --result; + *result = *last; + } + + return result; +} + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/copy_if.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/copy_if.h new file mode 100644 index 0000000000000000000000000000000000000000..360b9bc6a2bd8ff69f0e4657c0a64f6ce77f4a8d --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/copy_if.h @@ -0,0 +1,77 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! \file copy_if.h + * \brief Sequential implementation of copy_if. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator copy_if( + sequential::execution_policy&, + InputIterator1 first, + InputIterator1 last, + InputIterator2 stencil, + OutputIterator result, + Predicate pred) +{ + thrust::detail::wrapped_function wrapped_pred{pred}; + + while (first != last) + { + if (wrapped_pred(*stencil)) + { + *result = *first; + ++result; + } // end if + + ++first; + ++stencil; + } // end while + + return result; +} // end copy_if() + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/count.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/count.h new file mode 100644 index 0000000000000000000000000000000000000000..46b5e3997de4e64316b673cc27e81e163ca45d8b --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/count.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// this system has no special count functions diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/equal.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/equal.h new file mode 100644 index 0000000000000000000000000000000000000000..c16d767294fddbeb3ba97ebd2ca8a3523f63db9b --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/equal.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// this system has no special equal functions diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/execution_policy.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/execution_policy.h new file mode 100644 index 0000000000000000000000000000000000000000..d4834ebc89baf104f35378d31fef5e62a1ed8242 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/execution_policy.h @@ -0,0 +1,78 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +// this awkward sequence of definitions arises +// from the desire both for tag to derive +// from execution_policy and for execution_policy +// to convert to tag (when execution_policy is not +// an ancestor of tag) + +// forward declaration of tag +struct tag; + +// forward declaration of execution_policy +template +struct execution_policy; + +// specialize execution_policy for tag +template <> +struct execution_policy : thrust::execution_policy +{}; + +// tag's definition comes before the generic definition of execution_policy +struct tag : execution_policy +{ + _CCCL_HOST_DEVICE constexpr tag() {} +}; + +// allow conversion to tag when it is not a successor +template +struct execution_policy : thrust::execution_policy +{ + // allow conversion to tag + inline operator tag() const + { + return tag(); + } +}; + +_CCCL_GLOBAL_CONSTANT tag seq; + +} // namespace sequential +} // namespace detail +} // namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/extrema.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/extrema.h new file mode 100644 index 0000000000000000000000000000000000000000..ba8dfcd8e9067c02957d60790335e82144ced137 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/extrema.h @@ -0,0 +1,116 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! \file extrema.h + * \brief Sequential implementations of extrema functions. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE ForwardIterator min_element( + sequential::execution_policy&, ForwardIterator first, ForwardIterator last, BinaryPredicate comp) +{ + // wrap comp + thrust::detail::wrapped_function wrapped_comp{comp}; + + ForwardIterator imin = first; + + for (; first != last; ++first) + { + if (wrapped_comp(*first, *imin)) + { + imin = first; + } + } + + return imin; +} + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE ForwardIterator max_element( + sequential::execution_policy&, ForwardIterator first, ForwardIterator last, BinaryPredicate comp) +{ + // wrap comp + thrust::detail::wrapped_function wrapped_comp{comp}; + + ForwardIterator imax = first; + + for (; first != last; ++first) + { + if (wrapped_comp(*imax, *first)) + { + imax = first; + } + } + + return imax; +} + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE thrust::pair minmax_element( + sequential::execution_policy&, ForwardIterator first, ForwardIterator last, BinaryPredicate comp) +{ + // wrap comp + thrust::detail::wrapped_function wrapped_comp{comp}; + + ForwardIterator imin = first; + ForwardIterator imax = first; + + for (; first != last; ++first) + { + if (wrapped_comp(*first, *imin)) + { + imin = first; + } + + if (wrapped_comp(*imax, *first)) + { + imax = first; + } + } + + return thrust::make_pair(imin, imax); +} + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/fill.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/fill.h new file mode 100644 index 0000000000000000000000000000000000000000..4f678637a7dda1734fd7ab3fb8f5d88023dc9597 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/fill.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// this system has no special fill functions diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/for_each.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/for_each.h new file mode 100644 index 0000000000000000000000000000000000000000..e072fa2168981254bd7706318e3473b4b2359973 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/for_each.h @@ -0,0 +1,80 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! \file for_each.h + * \brief Sequential implementations of for_each functions. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE InputIterator +for_each(sequential::execution_policy&, InputIterator first, InputIterator last, UnaryFunction f) +{ + // wrap f + thrust::detail::wrapped_function wrapped_f{f}; + + for (; first != last; ++first) + { + wrapped_f(*first); + } + + return first; +} // end for_each() + +template +_CCCL_HOST_DEVICE InputIterator +for_each_n(sequential::execution_policy&, InputIterator first, Size n, UnaryFunction f) +{ + // wrap f + thrust::detail::wrapped_function wrapped_f{f}; + + for (Size i = 0; i != n; i++) + { + // we can dereference an OutputIterator if f does not + // try to use the reference for anything besides assignment + wrapped_f(*first); + ++first; + } + + return first; +} // end for_each_n() + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/gather.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/gather.h new file mode 100644 index 0000000000000000000000000000000000000000..ba04810996224e3a33e4e65c002fdfd21a66f6ba --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/gather.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// this system has no special gather functions diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/general_copy.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/general_copy.h new file mode 100644 index 0000000000000000000000000000000000000000..990085dd2f4ad409c1bdcfd36b05aa27dcf575a3 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/general_copy.h @@ -0,0 +1,121 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! \file general_copy.h + * \brief Sequential copy algorithms for general iterators. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ +namespace general_copy_detail +{ + +template +struct lazy_is_assignable : ::cuda::std::is_assignable +{}; + +// sometimes OutputIterator's reference type is reported as void +// in that case, just assume that we're able to assign to it OK +template +struct reference_is_assignable + : thrust::detail::eval_if< + ::cuda::std::is_same::type, void>::value, + thrust::detail::true_type, + lazy_is_assignable, thrust::iterator_reference>>::type +{}; + +// introduce an iterator assign helper to deal with assignments from +// a wrapped reference + +_CCCL_EXEC_CHECK_DISABLE +template +inline _CCCL_HOST_DEVICE ::cuda::std::enable_if_t::value> +iter_assign(OutputIterator dst, InputIterator src) +{ + *dst = *src; +} + +_CCCL_EXEC_CHECK_DISABLE +template +inline _CCCL_HOST_DEVICE +typename thrust::detail::disable_if::value>::type +iter_assign(OutputIterator dst, InputIterator src) +{ + using value_type = typename thrust::iterator_value::type; + + // insert a temporary and hope for the best + *dst = static_cast(*src); +} + +} // namespace general_copy_detail + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator general_copy(InputIterator first, InputIterator last, OutputIterator result) +{ + for (; first != last; ++first, (void) ++result) + { + // gcc 4.2 crashes while instantiating iter_assign +#if _CCCL_COMPILER(GCC, <, 4, 3) + *result = *first; +#else + general_copy_detail::iter_assign(result, first); +#endif + } + + return result; +} // end general_copy() + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator general_copy_n(InputIterator first, Size n, OutputIterator result) +{ + for (; n > Size(0); ++first, (void) ++result, (void) --n) + { + // gcc 4.2 crashes while instantiating iter_assign +#if _CCCL_COMPILER(GCC, <, 4, 3) + *result = *first; +#else + general_copy_detail::iter_assign(result, first); +#endif + } + + return result; +} // end general_copy_n() + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/generate.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/generate.h new file mode 100644 index 0000000000000000000000000000000000000000..bb451c07a831632757fb41e04414793ba706144d --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/generate.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// this system has no special generate functions diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/get_value.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/get_value.h new file mode 100644 index 0000000000000000000000000000000000000000..029982f95fd80493fd37394cc53a3e5d6dc79a02 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/get_value.h @@ -0,0 +1,49 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +template +_CCCL_HOST_DEVICE typename thrust::iterator_value::type +get_value(sequential::execution_policy&, Pointer ptr) +{ + return *thrust::raw_pointer_cast(ptr); +} // end get_value() + +} // namespace sequential +} // namespace detail +} // namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/inner_product.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/inner_product.h new file mode 100644 index 0000000000000000000000000000000000000000..65e86607ccc0d431d3db89ef36ed1f0d600eb440 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/inner_product.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// this system has no special inner_product functions diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/insertion_sort.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/insertion_sort.h new file mode 100644 index 0000000000000000000000000000000000000000..e66a54fd88f19919c6cf9dca7cfbe7c757219de6 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/insertion_sort.h @@ -0,0 +1,147 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#include +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE void insertion_sort(RandomAccessIterator first, RandomAccessIterator last, StrictWeakOrdering comp) +{ + using value_type = typename thrust::iterator_value::type; + + if (first == last) + { + return; + } + + // wrap comp + thrust::detail::wrapped_function wrapped_comp{comp}; + + for (RandomAccessIterator i = first + 1; i != last; ++i) + { + value_type tmp = *i; + + if (wrapped_comp(tmp, *first)) + { + // tmp is the smallest value encountered so far + sequential::copy_backward(first, i, i + 1); + + *first = tmp; + } + else + { + // tmp is not the smallest value, can avoid checking for j == first + RandomAccessIterator j = i; + RandomAccessIterator k = i - 1; + + while (wrapped_comp(tmp, *k)) + { + *j = *k; + j = k; + --k; + } + + *j = tmp; + } + } +} + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE void insertion_sort_by_key( + RandomAccessIterator1 first1, RandomAccessIterator1 last1, RandomAccessIterator2 first2, StrictWeakOrdering comp) +{ + using value_type1 = typename thrust::iterator_value::type; + using value_type2 = typename thrust::iterator_value::type; + + if (first1 == last1) + { + return; + } + + // wrap comp + thrust::detail::wrapped_function wrapped_comp{comp}; + + RandomAccessIterator1 i1 = first1 + 1; + RandomAccessIterator2 i2 = first2 + 1; + + for (; i1 != last1; ++i1, ++i2) + { + value_type1 tmp1 = *i1; + value_type2 tmp2 = *i2; + + if (wrapped_comp(tmp1, *first1)) + { + // tmp is the smallest value encountered so far + sequential::copy_backward(first1, i1, i1 + 1); + sequential::copy_backward(first2, i2, i2 + 1); + + *first1 = tmp1; + *first2 = tmp2; + } + else + { + // tmp is not the smallest value, can avoid checking for j == first + RandomAccessIterator1 j1 = i1; + RandomAccessIterator1 k1 = i1 - 1; + + RandomAccessIterator2 j2 = i2; + RandomAccessIterator2 k2 = i2 - 1; + + while (wrapped_comp(tmp1, *k1)) + { + *j1 = *k1; + *j2 = *k2; + + j1 = k1; + j2 = k2; + + --k1; + --k2; + } + + *j1 = tmp1; + *j2 = tmp2; + } + } +} + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/iter_swap.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/iter_swap.h new file mode 100644 index 0000000000000000000000000000000000000000..6789ee9d935622d9135621c9a431f3a29364c1cc --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/iter_swap.h @@ -0,0 +1,51 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include + +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +template +_CCCL_HOST_DEVICE void iter_swap(sequential::execution_policy&, Pointer1 a, Pointer2 b) +{ + using ::cuda::std::swap; + swap(*thrust::raw_pointer_cast(a), *thrust::raw_pointer_cast(b)); +} // end iter_swap() + +} // namespace sequential +} // namespace detail +} // namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/logical.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/logical.h new file mode 100644 index 0000000000000000000000000000000000000000..9769f19697735d86994bc3d121bfbbeab3882429 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/logical.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// this system has no special logical functions diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/malloc_and_free.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/malloc_and_free.h new file mode 100644 index 0000000000000000000000000000000000000000..031814101e4fbe68e3b362ba88eb38a3f956a712 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/malloc_and_free.h @@ -0,0 +1,56 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include + +#include // for malloc & free + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +template +inline _CCCL_HOST_DEVICE void* malloc(execution_policy&, std::size_t n) +{ + return std::malloc(n); +} // end mallc() + +template +inline _CCCL_HOST_DEVICE void free(sequential::execution_policy&, Pointer ptr) +{ + std::free(thrust::raw_pointer_cast(ptr)); +} // end mallc() + +} // namespace sequential +} // namespace detail +} // namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/merge.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/merge.h new file mode 100644 index 0000000000000000000000000000000000000000..1b60dd6d1dd79e697df53753d85dc9d371ded097 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/merge.h @@ -0,0 +1,81 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! \file merge.h + * \brief Sequential implementation of merge algorithms. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +template +_CCCL_HOST_DEVICE OutputIterator merge( + sequential::execution_policy& exec, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + OutputIterator result, + StrictWeakOrdering comp); + +template +_CCCL_HOST_DEVICE thrust::pair merge_by_key( + sequential::execution_policy& exec, + InputIterator1 keys_first1, + InputIterator1 keys_last1, + InputIterator2 keys_first2, + InputIterator2 keys_last2, + InputIterator3 values_first1, + InputIterator4 values_first2, + OutputIterator1 keys_result, + OutputIterator2 values_result, + StrictWeakOrdering comp); + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END + +#include diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/merge.inl b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/merge.inl new file mode 100644 index 0000000000000000000000000000000000000000..1d2bd8bb6c433ba795140e6574858ceb8c80e22d --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/merge.inl @@ -0,0 +1,151 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator merge( + sequential::execution_policy& exec, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + OutputIterator result, + StrictWeakOrdering comp) +{ + // wrap comp + thrust::detail::wrapped_function wrapped_comp{comp}; + + while (first1 != last1 && first2 != last2) + { + if (wrapped_comp(*first2, *first1)) + { + *result = *first2; + ++first2; + } // end if + else + { + *result = *first1; + ++first1; + } // end else + + ++result; + } // end while + + return thrust::copy(exec, first2, last2, thrust::copy(exec, first1, last1, result)); +} // end merge() + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE thrust::pair merge_by_key( + sequential::execution_policy&, + InputIterator1 keys_first1, + InputIterator1 keys_last1, + InputIterator2 keys_first2, + InputIterator2 keys_last2, + InputIterator3 values_first1, + InputIterator4 values_first2, + OutputIterator1 keys_result, + OutputIterator2 values_result, + StrictWeakOrdering comp) +{ + // wrap comp + thrust::detail::wrapped_function wrapped_comp{comp}; + + while (keys_first1 != keys_last1 && keys_first2 != keys_last2) + { + if (!wrapped_comp(*keys_first2, *keys_first1)) + { + // *keys_first1 <= *keys_first2 + *keys_result = *keys_first1; + *values_result = *values_first1; + ++keys_first1; + ++values_first1; + } + else + { + // *keys_first1 > keys_first2 + *keys_result = *keys_first2; + *values_result = *values_first2; + ++keys_first2; + ++values_first2; + } + + ++keys_result; + ++values_result; + } + + while (keys_first1 != keys_last1) + { + *keys_result = *keys_first1; + *values_result = *values_first1; + ++keys_first1; + ++values_first1; + ++keys_result; + ++values_result; + } + + while (keys_first2 != keys_last2) + { + *keys_result = *keys_first2; + *values_result = *values_first2; + ++keys_first2; + ++values_first2; + ++keys_result; + ++values_result; + } + + return thrust::make_pair(keys_result, values_result); +} + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/mismatch.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/mismatch.h new file mode 100644 index 0000000000000000000000000000000000000000..40d80c212ebda44e2c2645227e655aac7568a7d3 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/mismatch.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// this system has no special mismatch functions diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/partition.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/partition.h new file mode 100644 index 0000000000000000000000000000000000000000..cc744bb8866689a0eb3f3287c5773e1b22e6ae5a --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/partition.h @@ -0,0 +1,309 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! \file partition.h + * \brief Sequential implementations of partition functions. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace detail +{ + +// XXX WAR an unfortunate circular #inclusion problem +template +class temporary_array; + +} // namespace detail + +namespace system +{ +namespace detail +{ +namespace sequential +{ + +// TODO(bgruber): we should make this an alias of cuda::std::iter_swap +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE void iter_swap(ForwardIterator1 iter1, ForwardIterator2 iter2) +{ + // note: we cannot use swap(*iter1, *iter2) here, because the reference_type's could be proxy references, for which + // swap() is not guaranteed to work + using T = typename thrust::iterator_value::type; + T temp = ::cuda::std::move(*iter1); + *iter1 = ::cuda::std::move(*iter2); + *iter2 = ::cuda::std::move(temp); +} + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE ForwardIterator +partition(sequential::execution_policy&, ForwardIterator first, ForwardIterator last, Predicate pred) +{ + if (first == last) + { + return first; + } + + // wrap pred + thrust::detail::wrapped_function wrapped_pred{pred}; + + while (wrapped_pred(*first)) + { + if (++first == last) + { + return first; + } + } + + ForwardIterator next = first; + + while (++next != last) + { + if (wrapped_pred(*next)) + { + // Fully qualify name to disambiguate overloads found via ADL. + THRUST_NS_QUALIFIER::system::detail::sequential::iter_swap(first, next); + ++first; + } + } + + return first; +} + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE ForwardIterator partition( + sequential::execution_policy&, + ForwardIterator first, + ForwardIterator last, + InputIterator stencil_first, + Predicate pred) +{ + if (first == last) + { + return first; + } + + // wrap pred + thrust::detail::wrapped_function wrapped_pred{pred}; + + while (wrapped_pred(*stencil_first)) + { + ++stencil_first; + if (++first == last) + { + return first; + } + } + + ForwardIterator next = first; + + // advance stencil to next element as well + ++stencil_first; + + while (++next != last) + { + if (wrapped_pred(*stencil_first)) + { + // Fully qualify name to disambiguate overloads found via ADL. + THRUST_NS_QUALIFIER::system::detail::sequential::iter_swap(first, next); + ++first; + } + + ++stencil_first; + } + + return first; +} + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE ForwardIterator stable_partition( + sequential::execution_policy& exec, ForwardIterator first, ForwardIterator last, Predicate pred) +{ + if (first == last) + { + return first; + } + + // wrap pred + thrust::detail::wrapped_function wrapped_pred{pred}; + + using T = typename thrust::iterator_value::type; + + using TempRange = thrust::detail::temporary_array; + using TempIterator = typename TempRange::iterator; + + TempRange temp(exec, first, last); + + for (TempIterator iter = temp.begin(); iter != temp.end(); ++iter) + { + if (wrapped_pred(*iter)) + { + *first = *iter; + ++first; + } + } + + ForwardIterator middle = first; + + for (TempIterator iter = temp.begin(); iter != temp.end(); ++iter) + { + if (!wrapped_pred(*iter)) + { + *first = *iter; + ++first; + } + } + + return middle; +} + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE ForwardIterator stable_partition( + sequential::execution_policy& exec, + ForwardIterator first, + ForwardIterator last, + InputIterator stencil, + Predicate pred) +{ + // wrap pred + thrust::detail::wrapped_function wrapped_pred{pred}; + + using T = typename thrust::iterator_value::type; + + using TempRange = thrust::detail::temporary_array; + using TempIterator = typename TempRange::iterator; + + TempRange temp(exec, first, last); + + InputIterator stencil_iter = stencil; + for (TempIterator iter = temp.begin(); iter != temp.end(); ++iter, (void) ++stencil_iter) + { + if (wrapped_pred(*stencil_iter)) + { + *first = *iter; + ++first; + } + } + + ForwardIterator middle = first; + stencil_iter = stencil; + + for (TempIterator iter = temp.begin(); iter != temp.end(); ++iter, (void) ++stencil_iter) + { + if (!wrapped_pred(*stencil_iter)) + { + *first = *iter; + ++first; + } + } + + return middle; +} + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE thrust::pair stable_partition_copy( + sequential::execution_policy&, + InputIterator first, + InputIterator last, + OutputIterator1 out_true, + OutputIterator2 out_false, + Predicate pred) +{ + // wrap pred + thrust::detail::wrapped_function wrapped_pred{pred}; + + for (; first != last; ++first) + { + if (wrapped_pred(*first)) + { + *out_true = *first; + ++out_true; + } // end if + else + { + *out_false = *first; + ++out_false; + } // end else + } + + return thrust::make_pair(out_true, out_false); +} + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE thrust::pair stable_partition_copy( + sequential::execution_policy&, + InputIterator1 first, + InputIterator1 last, + InputIterator2 stencil, + OutputIterator1 out_true, + OutputIterator2 out_false, + Predicate pred) +{ + // wrap pred + thrust::detail::wrapped_function wrapped_pred{pred}; + + for (; first != last; ++first, (void) ++stencil) + { + if (wrapped_pred(*stencil)) + { + *out_true = *first; + ++out_true; + } // end if + else + { + *out_false = *first; + ++out_false; + } // end else + } + + return thrust::make_pair(out_true, out_false); +} + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/per_device_resource.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/per_device_resource.h new file mode 100644 index 0000000000000000000000000000000000000000..f02fcfcdc3ffb035a21d9189dfa72f235ff82146 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/per_device_resource.h @@ -0,0 +1,29 @@ +/* + * Copyright 2018 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// this system has no special per device resource functions diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/reduce.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/reduce.h new file mode 100644 index 0000000000000000000000000000000000000000..e75fbfd5409dfd12d21faddad3554f7c6291f192 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/reduce.h @@ -0,0 +1,70 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! \file reduce.h + * \brief Sequential implementation of reduce algorithm. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputType reduce( + sequential::execution_policy&, + InputIterator begin, + InputIterator end, + OutputType init, + BinaryFunction binary_op) +{ + // wrap binary_op + thrust::detail::wrapped_function wrapped_binary_op{binary_op}; + + // initialize the result + OutputType result = init; + + while (begin != end) + { + result = wrapped_binary_op(result, *begin); + ++begin; + } // end while + + return result; +} + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/reduce_by_key.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/reduce_by_key.h new file mode 100644 index 0000000000000000000000000000000000000000..2318c015cffb8f4dc2603ad72603d0b0a8ec8acd --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/reduce_by_key.h @@ -0,0 +1,104 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE thrust::pair reduce_by_key( + sequential::execution_policy&, + InputIterator1 keys_first, + InputIterator1 keys_last, + InputIterator2 values_first, + OutputIterator1 keys_output, + OutputIterator2 values_output, + BinaryPredicate binary_pred, + BinaryFunction binary_op) +{ + using InputKeyType = typename thrust::iterator_traits::value_type; + using InputValueType = typename thrust::iterator_traits::value_type; + + // Use the input iterator's value type per https://wg21.link/P0571 + using TemporaryType = typename thrust::iterator_value::type; + + if (keys_first != keys_last) + { + InputKeyType temp_key = *keys_first; + TemporaryType temp_value = *values_first; + + for (++keys_first, ++values_first; keys_first != keys_last; ++keys_first, (void) ++values_first) + { + InputKeyType key = *keys_first; + InputValueType value = *values_first; + + if (binary_pred(temp_key, key)) + { + temp_value = binary_op(temp_value, value); + } + else + { + *keys_output = temp_key; + *values_output = temp_value; + + ++keys_output; + ++values_output; + + temp_key = key; + temp_value = value; + } + } + + *keys_output = temp_key; + *values_output = temp_value; + + ++keys_output; + ++values_output; + } + + return thrust::make_pair(keys_output, values_output); +} + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/remove.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/remove.h new file mode 100644 index 0000000000000000000000000000000000000000..acaa5cdcf9b4073d7fcc21d3d45cb32923490cd9 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/remove.h @@ -0,0 +1,185 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! \file remove.h + * \brief Sequential implementations of remove functions. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE ForwardIterator +remove_if(sequential::execution_policy&, ForwardIterator first, ForwardIterator last, Predicate pred) +{ + // wrap pred + thrust::detail::wrapped_function wrapped_pred{pred}; + + // advance iterators until wrapped_pred(*first) is true or we reach the end of input + while (first != last && !wrapped_pred(*first)) + { + ++first; + } + + if (first == last) + { + return first; + } + + // result always trails first + ForwardIterator result = first; + + ++first; + + while (first != last) + { + if (!wrapped_pred(*first)) + { + *result = *first; + ++result; + } + ++first; + } + + return result; +} + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE ForwardIterator remove_if( + sequential::execution_policy&, + ForwardIterator first, + ForwardIterator last, + InputIterator stencil, + Predicate pred) +{ + // wrap pred + thrust::detail::wrapped_function wrapped_pred{pred}; + + // advance iterators until wrapped_pred(*stencil) is true or we reach the end of input + while (first != last && !wrapped_pred(*stencil)) + { + ++first; + ++stencil; + } + + if (first == last) + { + return first; + } + + // result always trails first + ForwardIterator result = first; + + ++first; + ++stencil; + + while (first != last) + { + if (!wrapped_pred(*stencil)) + { + *result = *first; + ++result; + } + ++first; + ++stencil; + } + + return result; +} + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator remove_copy_if( + sequential::execution_policy&, + InputIterator first, + InputIterator last, + OutputIterator result, + Predicate pred) +{ + // wrap pred + thrust::detail::wrapped_function wrapped_pred{pred}; + + while (first != last) + { + if (!wrapped_pred(*first)) + { + *result = *first; + ++result; + } + + ++first; + } + + return result; +} + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator remove_copy_if( + sequential::execution_policy&, + InputIterator1 first, + InputIterator1 last, + InputIterator2 stencil, + OutputIterator result, + Predicate pred) +{ + // wrap pred + thrust::detail::wrapped_function wrapped_pred{pred}; + + while (first != last) + { + if (!wrapped_pred(*stencil)) + { + *result = *first; + ++result; + } + + ++first; + ++stencil; + } + + return result; +} + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/replace.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/replace.h new file mode 100644 index 0000000000000000000000000000000000000000..bea87a2b8a02d0ee1f70e945ac932be4118885c5 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/replace.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// this system has no special replace functions diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/reverse.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/reverse.h new file mode 100644 index 0000000000000000000000000000000000000000..462388e34aab184f2c0e490aa1fc503c15b2a059 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/reverse.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// this system has no special reverse functions diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/scan.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/scan.h new file mode 100644 index 0000000000000000000000000000000000000000..86a132ba3e721de213ad7f1868c03313a7e37830 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/scan.h @@ -0,0 +1,161 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! \file scan.h + * \brief Sequential implementations of scan functions. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include +#include +#include +#include + +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator inclusive_scan( + sequential::execution_policy&, + InputIterator first, + InputIterator last, + OutputIterator result, + BinaryFunction binary_op) +{ + using namespace thrust::detail; + + // Use the input iterator's value type per https://wg21.link/P0571 + using ValueType = typename thrust::iterator_value::type; + + // wrap binary_op + thrust::detail::wrapped_function wrapped_binary_op{binary_op}; + + if (first != last) + { + ValueType sum = *first; + + *result = *first; + + for (++first, ++result; first != last; ++first, (void) ++result) + { + *result = sum = wrapped_binary_op(sum, *first); + } + } + + return result; +} + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator inclusive_scan( + sequential::execution_policy&, + InputIterator first, + InputIterator last, + OutputIterator result, + InitialValueType init, + BinaryFunction binary_op) +{ + using namespace thrust::detail; + + using ValueType = typename ::cuda::std:: + __accumulator_t::value_type, InitialValueType>; + + // wrap binary_op + thrust::detail::wrapped_function wrapped_binary_op{binary_op}; + + if (first != last) + { + ValueType sum = wrapped_binary_op(init, *first); + *result = sum; + ++first; + ++result; + + while (first != last) + { + *result = sum = wrapped_binary_op(sum, *first); + ++first; + ++result; + } + } + + return result; +} + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator exclusive_scan( + sequential::execution_policy&, + InputIterator first, + InputIterator last, + OutputIterator result, + InitialValueType init, + BinaryFunction binary_op) +{ + using namespace thrust::detail; + + // Use the initial value type per https://wg21.link/P0571 + using ValueType = InitialValueType; + + if (first != last) + { + ValueType tmp = *first; // temporary value allows in-situ scan + ValueType sum = init; + + *result = sum; + sum = binary_op(sum, tmp); + + for (++first, ++result; first != last; ++first, (void) ++result) + { + tmp = *first; + *result = sum; + sum = binary_op(sum, tmp); + } + } + + return result; +} + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/scan_by_key.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/scan_by_key.h new file mode 100644 index 0000000000000000000000000000000000000000..0bb3284409115f84fbffac6be65c25d7b187a441 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/scan_by_key.h @@ -0,0 +1,151 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! \file scan_by_key.h + * \brief Sequential implementation of scan_by_key functions. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator inclusive_scan_by_key( + sequential::execution_policy&, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + OutputIterator result, + BinaryPredicate binary_pred, + BinaryFunction binary_op) +{ + using KeyType = typename thrust::iterator_traits::value_type; + using ValueType = typename thrust::iterator_traits::value_type; + + // wrap binary_op + thrust::detail::wrapped_function wrapped_binary_op{binary_op}; + + if (first1 != last1) + { + KeyType prev_key = *first1; + ValueType prev_value = *first2; + + *result = prev_value; + + for (++first1, ++first2, ++result; first1 != last1; ++first1, (void) ++first2, (void) ++result) + { + KeyType key = *first1; + + if (binary_pred(prev_key, key)) + { + *result = prev_value = wrapped_binary_op(prev_value, *first2); + } + else + { + *result = prev_value = *first2; + } + + prev_key = key; + } + } + + return result; +} + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator exclusive_scan_by_key( + sequential::execution_policy&, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + OutputIterator result, + T init, + BinaryPredicate binary_pred, + BinaryFunction binary_op) +{ + using KeyType = typename thrust::iterator_traits::value_type; + using ValueType = T; + + if (first1 != last1) + { + KeyType temp_key = *first1; + ValueType temp_value = *first2; + + ValueType next = init; + + // first one is init + *result = next; + + next = binary_op(next, temp_value); + + for (++first1, ++first2, ++result; first1 != last1; ++first1, (void) ++first2, (void) ++result) + { + KeyType key = *first1; + + // use temp to permit in-place scans + temp_value = *first2; + + if (!binary_pred(temp_key, key)) + { + next = init; // reset sum + } + + *result = next; + next = binary_op(next, temp_value); + + temp_key = key; + } + } + + return result; +} + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/scatter.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/scatter.h new file mode 100644 index 0000000000000000000000000000000000000000..d6ec9fadbf55b352a9738bd044b7d919ce561a50 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/scatter.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// this system has no special scatter functions diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/sequence.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/sequence.h new file mode 100644 index 0000000000000000000000000000000000000000..45869142718c7d5761dcbbb4a6271fd82164787c --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/sequence.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// this system has no special sequence functions diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/set_operations.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/set_operations.h new file mode 100644 index 0000000000000000000000000000000000000000..1908ee72363c109c48759d6edbd5114dada1ad93 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/set_operations.h @@ -0,0 +1,212 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! \file set_operations.h + * \brief Sequential implementation of set operation functions. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator set_difference( + sequential::execution_policy& exec, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + OutputIterator result, + StrictWeakOrdering comp) +{ + // wrap comp + thrust::detail::wrapped_function wrapped_comp{comp}; + + while (first1 != last1 && first2 != last2) + { + if (wrapped_comp(*first1, *first2)) + { + *result = *first1; + ++first1; + ++result; + } // end if + else if (wrapped_comp(*first2, *first1)) + { + ++first2; + } // end else if + else + { + ++first1; + ++first2; + } // end else + } // end while + + return thrust::copy(exec, first1, last1, result); +} // end set_difference() + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator set_intersection( + sequential::execution_policy&, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + OutputIterator result, + StrictWeakOrdering comp) +{ + // wrap comp + thrust::detail::wrapped_function wrapped_comp{comp}; + + while (first1 != last1 && first2 != last2) + { + if (wrapped_comp(*first1, *first2)) + { + ++first1; + } // end if + else if (wrapped_comp(*first2, *first1)) + { + ++first2; + } // end else if + else + { + *result = *first1; + ++first1; + ++first2; + ++result; + } // end else + } // end while + + return result; +} // end set_intersection() + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator set_symmetric_difference( + sequential::execution_policy& exec, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + OutputIterator result, + StrictWeakOrdering comp) +{ + // wrap comp + thrust::detail::wrapped_function wrapped_comp{comp}; + + while (first1 != last1 && first2 != last2) + { + if (wrapped_comp(*first1, *first2)) + { + *result = *first1; + ++first1; + ++result; + } // end if + else if (wrapped_comp(*first2, *first1)) + { + *result = *first2; + ++first2; + ++result; + } // end else if + else + { + ++first1; + ++first2; + } // end else + } // end while + + return thrust::copy(exec, first2, last2, thrust::copy(exec, first1, last1, result)); +} // end set_symmetric_difference() + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator set_union( + sequential::execution_policy& exec, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + OutputIterator result, + StrictWeakOrdering comp) +{ + // wrap comp + thrust::detail::wrapped_function wrapped_comp{comp}; + + while (first1 != last1 && first2 != last2) + { + if (wrapped_comp(*first1, *first2)) + { + *result = *first1; + ++first1; + } // end if + else if (wrapped_comp(*first2, *first1)) + { + *result = *first2; + ++first2; + } // end else if + else + { + *result = *first1; + ++first1; + ++first2; + } // end else + + ++result; + } // end while + + return thrust::copy(exec, first2, last2, thrust::copy(exec, first1, last1, result)); +} // end set_union() + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/sort.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/sort.h new file mode 100644 index 0000000000000000000000000000000000000000..f1f6272d2f8e09bdab2d266e273501b53c5e69a0 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/sort.h @@ -0,0 +1,65 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! \file sort.h + * \brief Sequential implementations of sort algorithms. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +template +_CCCL_HOST_DEVICE void stable_sort( + sequential::execution_policy& exec, + RandomAccessIterator first, + RandomAccessIterator last, + StrictWeakOrdering comp); + +template +_CCCL_HOST_DEVICE void stable_sort_by_key( + sequential::execution_policy& exec, + RandomAccessIterator1 first1, + RandomAccessIterator1 last1, + RandomAccessIterator2 first2, + StrictWeakOrdering comp); + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END + +#include diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/sort.inl b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/sort.inl new file mode 100644 index 0000000000000000000000000000000000000000..7c74b33b891e83c61390ff63e57f519079e8f997 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/sort.inl @@ -0,0 +1,187 @@ +/* + * Copyright 2008-2021 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#include +#include +#include +#include +#include + +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ +namespace sort_detail +{ + +//////////////////// +// Primitive Sort // +//////////////////// + +template +struct needs_reverse : ::cuda::std::is_same> +{}; + +template +_CCCL_HOST_DEVICE void stable_sort( + sequential::execution_policy& exec, + RandomAccessIterator first, + RandomAccessIterator last, + StrictWeakOrdering, + thrust::detail::true_type) +{ + thrust::system::detail::sequential::stable_primitive_sort(exec, first, last); + + // if comp is greater then reverse the keys + using KeyType = typename thrust::iterator_traits::value_type; + + if (needs_reverse::value) + { + thrust::reverse(exec, first, last); + } +} + +template +_CCCL_HOST_DEVICE void stable_sort_by_key( + sequential::execution_policy& exec, + RandomAccessIterator1 first1, + RandomAccessIterator1 last1, + RandomAccessIterator2 first2, + StrictWeakOrdering, + thrust::detail::true_type) +{ + // if comp is greater then reverse the keys and values + using KeyType = typename thrust::iterator_traits::value_type; + + // note, we also have to reverse the (unordered) input to preserve stability + if (needs_reverse::value) + { + thrust::reverse(exec, first1, last1); + thrust::reverse(exec, first2, first2 + (last1 - first1)); + } + + thrust::system::detail::sequential::stable_primitive_sort_by_key(exec, first1, last1, first2); + + if (needs_reverse::value) + { + thrust::reverse(exec, first1, last1); + thrust::reverse(exec, first2, first2 + (last1 - first1)); + } +} + +//////////////// +// Merge Sort // +//////////////// + +template +_CCCL_HOST_DEVICE void stable_sort( + sequential::execution_policy& exec, + RandomAccessIterator first, + RandomAccessIterator last, + StrictWeakOrdering comp, + thrust::detail::false_type) +{ + thrust::system::detail::sequential::stable_merge_sort(exec, first, last, comp); +} + +template +_CCCL_HOST_DEVICE void stable_sort_by_key( + sequential::execution_policy& exec, + RandomAccessIterator1 first1, + RandomAccessIterator1 last1, + RandomAccessIterator2 first2, + StrictWeakOrdering comp, + thrust::detail::false_type) +{ + thrust::system::detail::sequential::stable_merge_sort_by_key(exec, first1, last1, first2, comp); +} + +template +struct use_primitive_sort + : ::cuda::std::_And<::cuda::std::is_arithmetic, + ::cuda::std::disjunction<::cuda::std::is_same>, + ::cuda::std::is_same>>> +{}; + +} // end namespace sort_detail + +template +_CCCL_HOST_DEVICE void stable_sort( + sequential::execution_policy& exec, + RandomAccessIterator first, + RandomAccessIterator last, + StrictWeakOrdering comp) +{ + // the compilation time of stable_primitive_sort is too expensive to use within a single CUDA thread + NV_IF_TARGET( + NV_IS_HOST, + (using KeyType = thrust::iterator_value_t; + sort_detail::use_primitive_sort use_primitive_sort; + sort_detail::stable_sort(exec, first, last, comp, use_primitive_sort);), + ( // NV_IS_DEVICE: + thrust::detail::false_type use_primitive_sort; + sort_detail::stable_sort(exec, first, last, comp, use_primitive_sort);)); +} + +template +_CCCL_HOST_DEVICE void stable_sort_by_key( + sequential::execution_policy& exec, + RandomAccessIterator1 first1, + RandomAccessIterator1 last1, + RandomAccessIterator2 first2, + StrictWeakOrdering comp) +{ + // the compilation time of stable_primitive_sort_by_key is too expensive to use within a single CUDA thread + NV_IF_TARGET( + NV_IS_HOST, + (using KeyType = thrust::iterator_value_t; + sort_detail::use_primitive_sort use_primitive_sort; + sort_detail::stable_sort_by_key(exec, first1, last1, first2, comp, use_primitive_sort);), + ( // NV_IS_DEVICE: + thrust::detail::false_type use_primitive_sort; + sort_detail::stable_sort_by_key(exec, first1, last1, first2, comp, use_primitive_sort);)); +} + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/stable_merge_sort.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/stable_merge_sort.h new file mode 100644 index 0000000000000000000000000000000000000000..9928608dec5262849c07900e8878294096256d23 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/stable_merge_sort.h @@ -0,0 +1,61 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +template +_CCCL_HOST_DEVICE void stable_merge_sort( + sequential::execution_policy& exec, + RandomAccessIterator begin, + RandomAccessIterator end, + StrictWeakOrdering comp); + +template +_CCCL_HOST_DEVICE void stable_merge_sort_by_key( + sequential::execution_policy& exec, + RandomAccessIterator1 keys_begin, + RandomAccessIterator1 keys_end, + RandomAccessIterator2 values_begin, + StrictWeakOrdering comp); + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END + +#include diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/stable_merge_sort.inl b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/stable_merge_sort.inl new file mode 100644 index 0000000000000000000000000000000000000000..415ff2a70a95ec92afb23d0717d766e919eab23f --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/stable_merge_sort.inl @@ -0,0 +1,360 @@ +/* + * Copyright 2008-2021 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#include +#include +#include +#include +#include + +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ +namespace stable_merge_sort_detail +{ + +template +_CCCL_HOST_DEVICE void inplace_merge( + sequential::execution_policy& exec, + RandomAccessIterator first, + RandomAccessIterator middle, + RandomAccessIterator last, + StrictWeakOrdering comp) +{ + using value_type = typename thrust::iterator_value::type; + + thrust::detail::temporary_array a(exec, first, middle); + thrust::detail::temporary_array b(exec, middle, last); + + thrust::merge(exec, a.begin(), a.end(), b.begin(), b.end(), first, comp); +} + +template +_CCCL_HOST_DEVICE void inplace_merge_by_key( + sequential::execution_policy& exec, + RandomAccessIterator1 first1, + RandomAccessIterator1 middle1, + RandomAccessIterator1 last1, + RandomAccessIterator2 first2, + StrictWeakOrdering comp) +{ + using value_type1 = typename thrust::iterator_value::type; + using value_type2 = typename thrust::iterator_value::type; + + RandomAccessIterator2 middle2 = first2 + (middle1 - first1); + RandomAccessIterator2 last2 = first2 + (last1 - first1); + + thrust::detail::temporary_array lhs1(exec, first1, middle1); + thrust::detail::temporary_array rhs1(exec, middle1, last1); + thrust::detail::temporary_array lhs2(exec, first2, middle2); + thrust::detail::temporary_array rhs2(exec, middle2, last2); + + thrust::merge_by_key( + exec, lhs1.begin(), lhs1.end(), rhs1.begin(), rhs1.end(), lhs2.begin(), rhs2.begin(), first1, first2, comp); +} + +template +_CCCL_HOST_DEVICE void +insertion_sort_each(RandomAccessIterator first, RandomAccessIterator last, Size partition_size, StrictWeakOrdering comp) +{ + if (partition_size > 1) + { + for (; first < last; first += partition_size) + { + RandomAccessIterator partition_last = (thrust::min)(last, first + partition_size); + + thrust::system::detail::sequential::insertion_sort(first, partition_last, comp); + } // end for + } // end if +} // end insertion_sort_each() + +template +_CCCL_HOST_DEVICE void insertion_sort_each_by_key( + RandomAccessIterator1 keys_first, + RandomAccessIterator1 keys_last, + RandomAccessIterator2 values_first, + Size partition_size, + StrictWeakOrdering comp) +{ + if (partition_size > 1) + { + for (; keys_first < keys_last; keys_first += partition_size, values_first += partition_size) + { + RandomAccessIterator1 keys_partition_last = (thrust::min)(keys_last, keys_first + partition_size); + + thrust::system::detail::sequential::insertion_sort_by_key(keys_first, keys_partition_last, values_first, comp); + } // end for + } // end if +} // end insertion_sort_each() + +template +_CCCL_HOST_DEVICE void merge_adjacent_partitions( + sequential::execution_policy& exec, + RandomAccessIterator1 first, + RandomAccessIterator1 last, + Size partition_size, + RandomAccessIterator2 result, + StrictWeakOrdering comp) +{ + for (; first < last; first += 2 * partition_size, result += 2 * partition_size) + { + RandomAccessIterator1 interval_middle = (thrust::min)(last, first + partition_size); + RandomAccessIterator1 interval_last = (thrust::min)(last, interval_middle + partition_size); + + thrust::merge(exec, first, interval_middle, interval_middle, interval_last, result, comp); + } // end for +} // end merge_adjacent_partitions() + +template +_CCCL_HOST_DEVICE void merge_adjacent_partitions_by_key( + sequential::execution_policy& exec, + RandomAccessIterator1 keys_first, + RandomAccessIterator1 keys_last, + RandomAccessIterator2 values_first, + Size partition_size, + RandomAccessIterator3 keys_result, + RandomAccessIterator4 values_result, + StrictWeakOrdering comp) +{ + Size stride = 2 * partition_size; + + for (; keys_first < keys_last; + keys_first += stride, values_first += stride, keys_result += stride, values_result += stride) + { + RandomAccessIterator1 keys_interval_middle = (thrust::min)(keys_last, keys_first + partition_size); + RandomAccessIterator1 keys_interval_last = (thrust::min)(keys_last, keys_interval_middle + partition_size); + + RandomAccessIterator2 values_first2 = values_first + (keys_interval_middle - keys_first); + + thrust::merge_by_key( + exec, + keys_first, + keys_interval_middle, + keys_interval_middle, + keys_interval_last, + values_first, + values_first2, + keys_result, + values_result, + comp); + } // end for +} // end merge_adjacent_partitions() + +template +_CCCL_HOST_DEVICE void iterative_stable_merge_sort( + sequential::execution_policy& exec, + RandomAccessIterator first, + RandomAccessIterator last, + StrictWeakOrdering comp) +{ + using value_type = typename thrust::iterator_value::type; + using difference_type = typename thrust::iterator_difference::type; + + difference_type n = last - first; + + thrust::detail::temporary_array temp(exec, n); + + // insertion sort each 32 element partition + difference_type partition_size = 32; + insertion_sort_each(first, last, partition_size, comp); + + // ping indicates whether or not the latest data is in the source range [first, last) + bool ping = true; + + // merge adjacent partitions until the partition size covers the entire range + for (; partition_size < n; partition_size *= 2, ping = !ping) + { + if (ping) + { + merge_adjacent_partitions(exec, first, last, partition_size, temp.begin(), comp); + } // end if + else + { + merge_adjacent_partitions(exec, temp.begin(), temp.end(), partition_size, first, comp); + } // end else + } // end for m + + if (!ping) + { + thrust::copy(exec, temp.begin(), temp.end(), first); + } // end if +} // end iterative_stable_merge_sort() + +template +_CCCL_HOST_DEVICE void iterative_stable_merge_sort_by_key( + sequential::execution_policy& exec, + RandomAccessIterator1 keys_first, + RandomAccessIterator1 keys_last, + RandomAccessIterator2 values_first, + StrictWeakOrdering comp) +{ + using value_type1 = typename thrust::iterator_value::type; + using value_type2 = typename thrust::iterator_value::type; + using difference_type = typename thrust::iterator_difference::type; + + difference_type n = keys_last - keys_first; + + thrust::detail::temporary_array keys_temp(exec, n); + thrust::detail::temporary_array values_temp(exec, n); + + // insertion sort each 32 element partition + difference_type partition_size = 32; + insertion_sort_each_by_key(keys_first, keys_last, values_first, partition_size, comp); + + // ping indicates whether or not the latest data is in the source range [first, last) + bool ping = true; + + // merge adjacent partitions until the partition size covers the entire range + for (; partition_size < n; partition_size *= 2, ping = !ping) + { + if (ping) + { + merge_adjacent_partitions_by_key( + exec, keys_first, keys_last, values_first, partition_size, keys_temp.begin(), values_temp.begin(), comp); + } // end if + else + { + merge_adjacent_partitions_by_key( + exec, keys_temp.begin(), keys_temp.end(), values_temp.begin(), partition_size, keys_first, values_first, comp); + } // end else + } // end for m + + if (!ping) + { + thrust::copy(exec, keys_temp.begin(), keys_temp.end(), keys_first); + thrust::copy(exec, values_temp.begin(), values_temp.end(), values_first); + } // end if +} // end iterative_stable_merge_sort() + +template +_CCCL_HOST_DEVICE void recursive_stable_merge_sort( + sequential::execution_policy& exec, + RandomAccessIterator first, + RandomAccessIterator last, + StrictWeakOrdering comp) +{ + if (last - first <= 32) + { + thrust::system::detail::sequential::insertion_sort(first, last, comp); + } // end if + else + { + RandomAccessIterator middle = first + (last - first) / 2; + + stable_merge_sort_detail::recursive_stable_merge_sort(exec, first, middle, comp); + stable_merge_sort_detail::recursive_stable_merge_sort(exec, middle, last, comp); + stable_merge_sort_detail::inplace_merge(exec, first, middle, last, comp); + } // end else +} // end recursive_stable_merge_sort() + +template +_CCCL_HOST_DEVICE void recursive_stable_merge_sort_by_key( + sequential::execution_policy& exec, + RandomAccessIterator1 first1, + RandomAccessIterator1 last1, + RandomAccessIterator2 first2, + StrictWeakOrdering comp) +{ + if (last1 - first1 <= 32) + { + thrust::system::detail::sequential::insertion_sort_by_key(first1, last1, first2, comp); + } // end if + else + { + RandomAccessIterator1 middle1 = first1 + (last1 - first1) / 2; + RandomAccessIterator2 middle2 = first2 + (last1 - first1) / 2; + + stable_merge_sort_detail::recursive_stable_merge_sort_by_key(exec, first1, middle1, first2, comp); + stable_merge_sort_detail::recursive_stable_merge_sort_by_key(exec, middle1, last1, middle2, comp); + stable_merge_sort_detail::inplace_merge_by_key(exec, first1, middle1, last1, first2, comp); + } // end else +} // end recursive_stable_merge_sort_by_key() + +} // end namespace stable_merge_sort_detail + +template +_CCCL_HOST_DEVICE void stable_merge_sort( + sequential::execution_policy& exec, + RandomAccessIterator first, + RandomAccessIterator last, + StrictWeakOrdering comp) +{ + NV_IF_TARGET(NV_IS_DEVICE, + ( + // avoid recursion in CUDA threads + stable_merge_sort_detail::iterative_stable_merge_sort(exec, first, last, comp);), + (stable_merge_sort_detail::recursive_stable_merge_sort(exec, first, last, comp);)); +} + +template +_CCCL_HOST_DEVICE void stable_merge_sort_by_key( + sequential::execution_policy& exec, + RandomAccessIterator1 first1, + RandomAccessIterator1 last1, + RandomAccessIterator2 first2, + StrictWeakOrdering comp) +{ + NV_IF_TARGET(NV_IS_DEVICE, + ( + // avoid recursion in CUDA threads + stable_merge_sort_detail::iterative_stable_merge_sort_by_key(exec, first1, last1, first2, comp);), + (stable_merge_sort_detail::recursive_stable_merge_sort_by_key(exec, first1, last1, first2, comp);)); +} + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/stable_primitive_sort.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/stable_primitive_sort.h new file mode 100644 index 0000000000000000000000000000000000000000..fc1ad810b048e14d822e18db49b98709b0558b51 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/stable_primitive_sort.h @@ -0,0 +1,54 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +template +_CCCL_HOST_DEVICE void stable_primitive_sort( + sequential::execution_policy& exec, RandomAccessIterator first, RandomAccessIterator last); + +template +_CCCL_HOST_DEVICE void stable_primitive_sort_by_key( + sequential::execution_policy& exec, + RandomAccessIterator1 keys_first, + RandomAccessIterator1 keys_last, + RandomAccessIterator2 values_first); + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END + +#include diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/stable_primitive_sort.inl b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/stable_primitive_sort.inl new file mode 100644 index 0000000000000000000000000000000000000000..333e25f665d02c0c5b514fcf79378984a0d3e27b --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/stable_primitive_sort.inl @@ -0,0 +1,130 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include +#include +#include +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ +namespace stable_primitive_sort_detail +{ + +template +struct enable_if_bool_sort + : ::cuda::std::enable_if<::cuda::std::is_same::type>::value> +{}; + +template +struct disable_if_bool_sort + : thrust::detail::disable_if<::cuda::std::is_same::type>::value> +{}; + +template +typename enable_if_bool_sort::type _CCCL_HOST_DEVICE stable_primitive_sort( + sequential::execution_policy& exec, RandomAccessIterator first, RandomAccessIterator last) +{ + // use stable_partition if we're sorting bool + // stable_partition puts true values first, so we need to logical_not + sequential::stable_partition(exec, first, last, thrust::logical_not()); +} + +template +typename disable_if_bool_sort::type _CCCL_HOST_DEVICE stable_primitive_sort( + sequential::execution_policy& exec, RandomAccessIterator first, RandomAccessIterator last) +{ + // call stable_radix_sort + sequential::stable_radix_sort(exec, first, last); +} + +struct logical_not_first +{ + template + _CCCL_HOST_DEVICE bool operator()(Tuple t) + { + return !thrust::get<0>(t); + } +}; + +template +typename enable_if_bool_sort::type _CCCL_HOST_DEVICE stable_primitive_sort_by_key( + sequential::execution_policy& exec, + RandomAccessIterator1 keys_first, + RandomAccessIterator1 keys_last, + RandomAccessIterator2 values_first) +{ + // use stable_partition if we're sorting bool + // stable_partition puts true values first, so we need to logical_not + sequential::stable_partition( + exec, + thrust::make_zip_iterator(thrust::make_tuple(keys_first, values_first)), + thrust::make_zip_iterator(thrust::make_tuple(keys_last, values_first)), + logical_not_first()); +} + +template +typename disable_if_bool_sort::type _CCCL_HOST_DEVICE stable_primitive_sort_by_key( + sequential::execution_policy& exec, + RandomAccessIterator1 keys_first, + RandomAccessIterator1 keys_last, + RandomAccessIterator2 values_first) +{ + // call stable_radix_sort_by_key + sequential::stable_radix_sort_by_key(exec, keys_first, keys_last, values_first); +} + +} // namespace stable_primitive_sort_detail + +template +_CCCL_HOST_DEVICE void stable_primitive_sort( + sequential::execution_policy& exec, RandomAccessIterator first, RandomAccessIterator last) +{ + stable_primitive_sort_detail::stable_primitive_sort(exec, first, last); +} + +template +_CCCL_HOST_DEVICE void stable_primitive_sort_by_key( + sequential::execution_policy& exec, + RandomAccessIterator1 keys_first, + RandomAccessIterator1 keys_last, + RandomAccessIterator2 values_first) +{ + stable_primitive_sort_detail::stable_primitive_sort_by_key(exec, keys_first, keys_last, values_first); +} + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/stable_radix_sort.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/stable_radix_sort.h new file mode 100644 index 0000000000000000000000000000000000000000..b5baaa1928830019d492a87e6cb3f99efd714add --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/stable_radix_sort.h @@ -0,0 +1,54 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +template +_CCCL_HOST_DEVICE void stable_radix_sort( + sequential::execution_policy& exec, RandomAccessIterator begin, RandomAccessIterator end); + +template +_CCCL_HOST_DEVICE void stable_radix_sort_by_key( + sequential::execution_policy& exec, + RandomAccessIterator1 keys_begin, + RandomAccessIterator1 keys_end, + RandomAccessIterator2 values_begin); + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END + +#include diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/stable_radix_sort.inl b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/stable_radix_sort.inl new file mode 100644 index 0000000000000000000000000000000000000000..c72a9fab86403a72efafa62506d26b93e4e35e20 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/stable_radix_sort.inl @@ -0,0 +1,593 @@ +/* + * Copyright 2008-2021 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ +namespace radix_sort_detail +{ + +template +struct RadixEncoder +{ + _CCCL_HOST_DEVICE T operator()(T x) const + { + return x; + } +}; + +template <> +struct RadixEncoder +{ + _CCCL_HOST_DEVICE unsigned char operator()(char x) const + { + if (std::numeric_limits::is_signed) + { + return static_cast(x) ^ static_cast(1) << (8 * sizeof(unsigned char) - 1); + } + else + { + return x; + } + } +}; + +template <> +struct RadixEncoder +{ + _CCCL_HOST_DEVICE unsigned char operator()(signed char x) const + { + return static_cast(x) ^ static_cast(1) << (8 * sizeof(unsigned char) - 1); + } +}; + +template <> +struct RadixEncoder +{ + _CCCL_HOST_DEVICE unsigned short operator()(short x) const + { + return static_cast(x) ^ static_cast(1) << (8 * sizeof(unsigned short) - 1); + } +}; + +template <> +struct RadixEncoder +{ + _CCCL_HOST_DEVICE unsigned long operator()(long x) const + { + return x ^ static_cast(1) << (8 * sizeof(unsigned int) - 1); + } +}; + +template <> +struct RadixEncoder +{ + _CCCL_HOST_DEVICE unsigned long operator()(long x) const + { + return x ^ static_cast(1) << (8 * sizeof(unsigned long) - 1); + } +}; + +template <> +struct RadixEncoder +{ + _CCCL_HOST_DEVICE unsigned long long operator()(long long x) const + { + return x ^ static_cast(1) << (8 * sizeof(unsigned long long) - 1); + } +}; + +// ideally we'd use uint32 here and uint64 below +template <> +struct RadixEncoder +{ + _CCCL_HOST_DEVICE std::uint32_t operator()(float x) const + { + union + { + float f; + std::uint32_t i; + } u; + u.f = x; + std::uint32_t mask = -static_cast(u.i >> 31) | (static_cast(1) << 31); + return u.i ^ mask; + } +}; + +template <> +struct RadixEncoder +{ + _CCCL_HOST_DEVICE std::uint64_t operator()(double x) const + { + union + { + double f; + std::uint64_t i; + } u; + u.f = x; + std::uint64_t mask = -static_cast(u.i >> 63) | (static_cast(1) << 63); + return u.i ^ mask; + } +}; + +// this functor returns a key's to its histogram bucket count and post-increments the bucket +template +struct bucket_functor +{ + using Encoder = RadixEncoder; + using EncodedType = decltype(::cuda::std::declval()(::cuda::std::declval())); + using result_type = size_t; + static const EncodedType BitMask = static_cast((1 << RadixBits) - 1); + + Encoder encode; + EncodedType bit_shift; + size_t* histogram; + + _CCCL_HOST_DEVICE bucket_functor(EncodedType bit_shift, size_t* histogram) + : encode() + , bit_shift(bit_shift) + , histogram(histogram) + {} + + inline _CCCL_HOST_DEVICE size_t operator()(KeyType key) + { + const EncodedType x = encode(key); + + // note that we mutate the histogram here + return histogram[(x >> bit_shift) & BitMask]++; + } +}; + +template +inline _CCCL_HOST_DEVICE void radix_shuffle_n( + sequential::execution_policy& exec, + RandomAccessIterator1 first, + const size_t n, + RandomAccessIterator2 result, + Integer bit_shift, + size_t* histogram) +{ + using KeyType = typename thrust::iterator_value::type; + + // note that we are going to mutate the histogram during this sequential scatter + thrust::scatter( + exec, + first, + first + n, + thrust::make_transform_iterator(first, bucket_functor(bit_shift, histogram)), + result); +} + +template +_CCCL_HOST_DEVICE void radix_shuffle_n( + sequential::execution_policy& exec, + RandomAccessIterator1 keys_first, + RandomAccessIterator2 values_first, + const size_t n, + RandomAccessIterator3 keys_result, + RandomAccessIterator4 values_result, + Integer bit_shift, + size_t* histogram) +{ + using KeyType = typename thrust::iterator_value::type; + + // note that we are going to mutate the histogram during this sequential scatter + thrust::scatter( + exec, + thrust::make_zip_iterator(thrust::make_tuple(keys_first, values_first)), + thrust::make_zip_iterator(thrust::make_tuple(keys_first + n, values_first + n)), + thrust::make_transform_iterator(keys_first, bucket_functor(bit_shift, histogram)), + thrust::make_zip_iterator(thrust::make_tuple(keys_result, values_result))); +} + +template +_CCCL_HOST_DEVICE void radix_sort( + sequential::execution_policy& exec, + RandomAccessIterator1 keys1, + RandomAccessIterator2 keys2, + RandomAccessIterator3 vals1, + RandomAccessIterator4 vals2, + const size_t N) +{ + using KeyType = typename thrust::iterator_value::type; + + using Encoder = RadixEncoder; + using EncodedType = decltype(::cuda::std::declval()(::cuda::std::declval())); + + const unsigned int NumHistograms = (8 * sizeof(EncodedType) + (RadixBits - 1)) / RadixBits; + const unsigned int HistogramSize = 1 << RadixBits; + + const EncodedType BitMask = static_cast((1 << RadixBits) - 1); + + Encoder encode; + + // storage for histograms + size_t histograms[NumHistograms][HistogramSize] = {{0}}; + + // see which passes can be eliminated + bool skip_shuffle[NumHistograms] = {false}; + + // false if most recent data is stored in (keys1,vals1) + bool flip = false; + + // compute histograms + for (size_t i = 0; i < N; i++) + { + const EncodedType x = encode(keys1[i]); + + for (unsigned int j = 0; j < NumHistograms; j++) + { + const auto BitShift = static_cast(RadixBits * j); + histograms[j][(x >> BitShift) & BitMask]++; + } + } + + // scan histograms + for (unsigned int i = 0; i < NumHistograms; i++) + { + size_t sum = 0; + + for (unsigned int j = 0; j < HistogramSize; j++) + { + size_t bin = histograms[i][j]; + + if (bin == N) + { + skip_shuffle[i] = true; + } + + histograms[i][j] = sum; + + sum = sum + bin; + } + } + + // shuffle keys and (optionally) values + for (unsigned int i = 0; i < NumHistograms; i++) + { + const EncodedType BitShift = static_cast(RadixBits * i); + + if (!skip_shuffle[i]) + { + if (flip) + { + if (HasValues) + { + radix_shuffle_n(exec, keys2, vals2, N, keys1, vals1, BitShift, histograms[i]); + } + else + { + radix_shuffle_n(exec, keys2, N, keys1, BitShift, histograms[i]); + } + } + else + { + if (HasValues) + { + radix_shuffle_n(exec, keys1, vals1, N, keys2, vals2, BitShift, histograms[i]); + } + else + { + radix_shuffle_n(exec, keys1, N, keys2, BitShift, histograms[i]); + } + } + + flip = (flip) ? false : true; + } + } + + // ensure final values are in (keys1,vals1) + if (flip) + { + thrust::copy(exec, keys2, keys2 + N, keys1); + + if (HasValues) + { + thrust::copy(exec, vals2, vals2 + N, vals1); + } + } +} + +// Select best radix sort parameters based on sizeof(T) and input size +// These particular values were determined through empirical testing on a Core i7 950 CPU +template +struct radix_sort_dispatcher +{}; + +template <> +struct radix_sort_dispatcher<1> +{ + template + _CCCL_HOST_DEVICE void operator()( + sequential::execution_policy& exec, + RandomAccessIterator1 keys1, + RandomAccessIterator2 keys2, + const size_t N) + { + radix_sort_detail::radix_sort<8, false>(exec, keys1, keys2, static_cast(0), static_cast(0), N); + } + + template + _CCCL_HOST_DEVICE void operator()( + sequential::execution_policy& exec, + RandomAccessIterator1 keys1, + RandomAccessIterator2 keys2, + RandomAccessIterator3 vals1, + RandomAccessIterator4 vals2, + const size_t N) + { + radix_sort_detail::radix_sort<8, true>(exec, keys1, keys2, vals1, vals2, N); + } +}; + +template <> +struct radix_sort_dispatcher<2> +{ + template + _CCCL_HOST_DEVICE void operator()( + sequential::execution_policy& exec, + RandomAccessIterator1 keys1, + RandomAccessIterator2 keys2, + const size_t N) + { +#ifdef __QNX__ + // XXX war for nvbug 200193674 + const bool condition = true; +#else + const bool condition = N < (1 << 16); +#endif + if (condition) + { + radix_sort_detail::radix_sort<8, false>(exec, keys1, keys2, static_cast(0), static_cast(0), N); + } + else + { + radix_sort_detail::radix_sort<16, false>(exec, keys1, keys2, static_cast(0), static_cast(0), N); + } + } + + template + _CCCL_HOST_DEVICE void operator()( + sequential::execution_policy& exec, + RandomAccessIterator1 keys1, + RandomAccessIterator2 keys2, + RandomAccessIterator3 vals1, + RandomAccessIterator4 vals2, + const size_t N) + { +#ifdef __QNX__ + // XXX war for nvbug 200193674 + const bool condition = true; +#else + const bool condition = N < (1 << 15); +#endif + if (condition) + { + radix_sort_detail::radix_sort<8, true>(exec, keys1, keys2, vals1, vals2, N); + } + else + { + radix_sort_detail::radix_sort<16, true>(exec, keys1, keys2, vals1, vals2, N); + } + } +}; + +template <> +struct radix_sort_dispatcher<4> +{ + template + _CCCL_HOST_DEVICE void operator()( + sequential::execution_policy& exec, + RandomAccessIterator1 keys1, + RandomAccessIterator2 keys2, + const size_t N) + { + if (N < (1 << 22)) + { + radix_sort_detail::radix_sort<8, false>(exec, keys1, keys2, static_cast(0), static_cast(0), N); + } + else + { + radix_sort_detail::radix_sort<4, false>(exec, keys1, keys2, static_cast(0), static_cast(0), N); + } + } + + template + _CCCL_HOST_DEVICE void operator()( + sequential::execution_policy& exec, + RandomAccessIterator1 keys1, + RandomAccessIterator2 keys2, + RandomAccessIterator3 vals1, + RandomAccessIterator4 vals2, + const size_t N) + { + if (N < (1 << 22)) + { + radix_sort_detail::radix_sort<8, true>(exec, keys1, keys2, vals1, vals2, N); + } + else + { + radix_sort_detail::radix_sort<3, true>(exec, keys1, keys2, vals1, vals2, N); + } + } +}; + +template <> +struct radix_sort_dispatcher<8> +{ + template + _CCCL_HOST_DEVICE void operator()( + sequential::execution_policy& exec, + RandomAccessIterator1 keys1, + RandomAccessIterator2 keys2, + const size_t N) + { + if (N < (1 << 21)) + { + radix_sort_detail::radix_sort<8, false>(exec, keys1, keys2, static_cast(0), static_cast(0), N); + } + else + { + radix_sort_detail::radix_sort<4, false>(exec, keys1, keys2, static_cast(0), static_cast(0), N); + } + } + + template + _CCCL_HOST_DEVICE void operator()( + sequential::execution_policy& exec, + RandomAccessIterator1 keys1, + RandomAccessIterator2 keys2, + RandomAccessIterator3 vals1, + RandomAccessIterator4 vals2, + const size_t N) + { + if (N < (1 << 21)) + { + radix_sort_detail::radix_sort<8, true>(exec, keys1, keys2, vals1, vals2, N); + } + else + { + radix_sort_detail::radix_sort<3, true>(exec, keys1, keys2, vals1, vals2, N); + } + } +}; + +template +_CCCL_HOST_DEVICE void radix_sort( + sequential::execution_policy& exec, + RandomAccessIterator1 keys1, + RandomAccessIterator2 keys2, + const size_t N) +{ + using KeyType = typename thrust::iterator_value::type; + radix_sort_dispatcher()(exec, keys1, keys2, N); +} + +template +_CCCL_HOST_DEVICE void radix_sort( + sequential::execution_policy& exec, + RandomAccessIterator1 keys1, + RandomAccessIterator2 keys2, + RandomAccessIterator3 vals1, + RandomAccessIterator4 vals2, + const size_t N) +{ + using KeyType = typename thrust::iterator_value::type; + radix_sort_dispatcher()(exec, keys1, keys2, vals1, vals2, N); +} + +} // namespace radix_sort_detail + +template +_CCCL_HOST_DEVICE void stable_radix_sort( + sequential::execution_policy& exec, RandomAccessIterator first, RandomAccessIterator last) +{ + using KeyType = typename thrust::iterator_value::type; + + size_t N = last - first; + + thrust::detail::temporary_array temp(exec, N); + + radix_sort_detail::radix_sort(exec, first, temp.begin(), N); +} + +template +_CCCL_HOST_DEVICE void stable_radix_sort_by_key( + sequential::execution_policy& exec, + RandomAccessIterator1 first1, + RandomAccessIterator1 last1, + RandomAccessIterator2 first2) +{ + using KeyType = typename thrust::iterator_value::type; + using ValueType = typename thrust::iterator_value::type; + + size_t N = last1 - first1; + + thrust::detail::temporary_array temp1(exec, N); + thrust::detail::temporary_array temp2(exec, N); + + radix_sort_detail::radix_sort(exec, first1, temp1.begin(), first2, temp2.begin(), N); +} + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/swap_ranges.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/swap_ranges.h new file mode 100644 index 0000000000000000000000000000000000000000..696c916cb870047492d3615875deab21448a4e07 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/swap_ranges.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// this system has no special swap_ranges functions diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/tabulate.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/tabulate.h new file mode 100644 index 0000000000000000000000000000000000000000..8bd301289a56f2f99d1d56579ba012a2ea9f00b9 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/tabulate.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// this system has no special tabulate functions diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/temporary_buffer.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/temporary_buffer.h new file mode 100644 index 0000000000000000000000000000000000000000..8da64673cb337c02e8312ca12bcdad1dc6e44df6 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/temporary_buffer.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// this system has no special temporary buffer functions diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/transform.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/transform.h new file mode 100644 index 0000000000000000000000000000000000000000..e077bcb8c991910f5083159e3cce7e7254671d8b --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/transform.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// this system has no special transform functions diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/transform_reduce.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/transform_reduce.h new file mode 100644 index 0000000000000000000000000000000000000000..7984a1763db62ef6c448e9c3a9e87b889abe9b2e --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/transform_reduce.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// this system has no special transform_reduce functions diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/transform_scan.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/transform_scan.h new file mode 100644 index 0000000000000000000000000000000000000000..0968d886dc52f20a71c2cdb4d68a8a6d524dd053 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/transform_scan.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// this system has no special version of this algorithm diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/trivial_copy.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/trivial_copy.h new file mode 100644 index 0000000000000000000000000000000000000000..30492b13ae9e12b367f42b303eb9f8bfd7092fcc --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/trivial_copy.h @@ -0,0 +1,69 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! \file trivial_copy.h + * \brief Sequential copy algorithms for plain-old-data. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include + +#include + +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +template +_CCCL_HOST_DEVICE T* trivial_copy_n(const T* first, std::ptrdiff_t n, T* result) +{ + if (n == 0) + { + // If `first` or `result` is an invalid pointer, + // the behavior of `std::memmove` is undefined, even if `n` is zero. + return result; + } + + T* return_value = nullptr; + + NV_IF_TARGET(NV_IS_HOST, + (std::memmove(result, first, n * sizeof(T)); return_value = result + n;), + ( // NV_IS_DEVICE: + return_value = thrust::system::detail::sequential::general_copy_n(first, n, result);)); + + return return_value; +} // end trivial_copy_n() + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/uninitialized_copy.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/uninitialized_copy.h new file mode 100644 index 0000000000000000000000000000000000000000..0968d886dc52f20a71c2cdb4d68a8a6d524dd053 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/uninitialized_copy.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// this system has no special version of this algorithm diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/uninitialized_fill.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/uninitialized_fill.h new file mode 100644 index 0000000000000000000000000000000000000000..ca6300b46b71a32b330e62ca16baaa18fdb3c901 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/uninitialized_fill.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header + +// this system has no special unintialized_fill functions diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/unique.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/unique.h new file mode 100644 index 0000000000000000000000000000000000000000..6947de13df0adeb45659cb100f9178c199b93a00 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/unique.h @@ -0,0 +1,121 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! \file unique.h + * \brief Sequential implementations of unique algorithms. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE OutputIterator unique_copy( + sequential::execution_policy&, + InputIterator first, + InputIterator last, + OutputIterator output, + BinaryPredicate binary_pred) +{ + using T = typename thrust::iterator_traits::value_type; + + if (first != last) + { + T prev = *first; + + for (++first; first != last; ++first) + { + T temp = *first; + + if (!binary_pred(prev, temp)) + { + *output = prev; + + ++output; + + prev = temp; + } + } + + *output = prev; + ++output; + } + + return output; +} // end unique_copy() + +template +_CCCL_HOST_DEVICE ForwardIterator unique( + sequential::execution_policy& exec, + ForwardIterator first, + ForwardIterator last, + BinaryPredicate binary_pred) +{ + // sequential unique_copy permits in-situ operation + return sequential::unique_copy(exec, first, last, first, binary_pred); +} // end unique() + +template +_CCCL_HOST_DEVICE typename thrust::iterator_traits::difference_type unique_count( + sequential::execution_policy&, ForwardIterator first, ForwardIterator last, BinaryPredicate binary_pred) +{ + using T = typename thrust::iterator_traits::value_type; + typename thrust::iterator_traits::difference_type count{}; + + if (first != last) + { + count++; + T prev = *first; + + for (++first; first != last; ++first) + { + T temp = *first; + + if (!binary_pred(prev, temp)) + { + count++; + prev = temp; + } + } + } + + return count; +} // end unique() + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/unique_by_key.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/unique_by_key.h new file mode 100644 index 0000000000000000000000000000000000000000..b1213d09799d55d1e74ac04d598e104a54271eb3 --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/detail/sequential/unique_by_key.h @@ -0,0 +1,112 @@ +/* + * Copyright 2008-2013 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! \file unique_by_key.h + * \brief Sequential implementations of unique_by_key algorithms. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace detail +{ +namespace sequential +{ + +_CCCL_EXEC_CHECK_DISABLE +template +_CCCL_HOST_DEVICE thrust::pair unique_by_key_copy( + sequential::execution_policy&, + InputIterator1 keys_first, + InputIterator1 keys_last, + InputIterator2 values_first, + OutputIterator1 keys_output, + OutputIterator2 values_output, + BinaryPredicate binary_pred) +{ + using InputKeyType = typename thrust::iterator_traits::value_type; + using OutputValueType = typename thrust::iterator_traits::value_type; + + if (keys_first != keys_last) + { + InputKeyType temp_key = *keys_first; + OutputValueType temp_value = *values_first; + + for (++keys_first, ++values_first; keys_first != keys_last; ++keys_first, (void) ++values_first) + { + InputKeyType key = *keys_first; + OutputValueType value = *values_first; + + if (!binary_pred(temp_key, key)) + { + *keys_output = temp_key; + *values_output = temp_value; + + ++keys_output; + ++values_output; + + temp_key = key; + temp_value = value; + } + } + + *keys_output = temp_key; + *values_output = temp_value; + + ++keys_output; + ++values_output; + } + + return thrust::make_pair(keys_output, values_output); +} // end unique_by_key_copy() + +template +_CCCL_HOST_DEVICE thrust::pair unique_by_key( + sequential::execution_policy& exec, + ForwardIterator1 keys_first, + ForwardIterator1 keys_last, + ForwardIterator2 values_first, + BinaryPredicate binary_pred) +{ + // sequential unique_by_key_copy() permits in-situ operation + return sequential::unique_by_key_copy( + exec, keys_first, keys_last, values_first, keys_first, values_first, binary_pred); +} // end unique_by_key() + +} // end namespace sequential +} // end namespace detail +} // end namespace system +THRUST_NAMESPACE_END diff --git a/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/tbb/memory_resource.h b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/tbb/memory_resource.h new file mode 100644 index 0000000000000000000000000000000000000000..a7ad064dc5c3c4cea8a25ac602b8b8f3f2206f0a --- /dev/null +++ b/vllm/lib/python3.10/site-packages/cupy/_core/include/cupy/_cccl/thrust/thrust/system/tbb/memory_resource.h @@ -0,0 +1,75 @@ +/* + * Copyright 2018-2020 NVIDIA Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! \file tbb/memory_resource.h + * \brief Memory resources for the TBB system. + */ + +#pragma once + +#include + +#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) +# pragma GCC system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) +# pragma clang system_header +#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) +# pragma system_header +#endif // no system header +#include +#include +#include + +THRUST_NAMESPACE_BEGIN +namespace system +{ +namespace tbb +{ + +//! \cond +namespace detail +{ +using native_resource = thrust::mr::fancy_pointer_resource>; + +using universal_native_resource = + thrust::mr::fancy_pointer_resource>; +} // namespace detail +//! \endcond + +/*! \addtogroup memory_resources Memory Resources + * \ingroup memory_management + * \{ + */ + +/*! The memory resource for the TBB system. Uses \p mr::new_delete_resource and + * tags it with \p tbb::pointer. + */ +using memory_resource = detail::native_resource; +/*! The unified memory resource for the TBB system. Uses + * \p mr::new_delete_resource and tags it with \p tbb::universal_pointer. + */ +using universal_memory_resource = detail::universal_native_resource; +// FIXME(bgruber): comment below is wrong or alias should be to universal_memory_resource +/*! An alias for \p tbb::universal_memory_resource. */ +using universal_host_pinned_memory_resource = detail::native_resource; + +/*! \} // memory_resources + */ + +} // namespace tbb +} // namespace system + +THRUST_NAMESPACE_END