Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/addcdiv_meta.h +27 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/aminmax_cuda_dispatch.h +25 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/argmax_meta_dispatch.h +25 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/avg_pool3d_backward_ops.h +39 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/ceil_ops.h +50 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/fft_hfft.h +91 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/fliplr_native.h +21 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/linalg_inv_ex_meta_dispatch.h +25 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/linalg_solve_ex_native.h +22 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/select_compositeexplicitautograd_dispatch.h +24 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/silu_backward_compositeimplicitautograd_dispatch.h +23 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/sin_cuda_dispatch.h +26 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/special_i1e.h +39 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/special_polygamma_ops.h +39 -0
- videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/type_as_compositeimplicitautograd_dispatch.h +23 -0
- vllm/lib/python3.10/site-packages/torio/__init__.py +8 -0
- vllm/lib/python3.10/site-packages/torio/_extension/__init__.py +13 -0
- vllm/lib/python3.10/site-packages/torio/_extension/__pycache__/__init__.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/torio/_extension/__pycache__/utils.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/torio/_extension/utils.py +147 -0
- vllm/lib/python3.10/site-packages/torio/io/__init__.py +9 -0
- vllm/lib/python3.10/site-packages/torio/io/__pycache__/__init__.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/torio/io/__pycache__/_streaming_media_decoder.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/torio/io/__pycache__/_streaming_media_encoder.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/torio/io/_streaming_media_decoder.py +978 -0
- vllm/lib/python3.10/site-packages/torio/io/_streaming_media_encoder.py +502 -0
- vllm/lib/python3.10/site-packages/torio/utils/__init__.py +4 -0
- vllm/lib/python3.10/site-packages/torio/utils/__pycache__/__init__.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/torio/utils/__pycache__/ffmpeg_utils.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/torio/utils/ffmpeg_utils.py +247 -0
- vllm/lib/python3.10/site-packages/triton/backends/__pycache__/__init__.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/triton/backends/__pycache__/compiler.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/triton/backends/__pycache__/driver.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/triton/backends/amd/include/roctracer/ext/prof_protocol.h +107 -0
- vllm/lib/python3.10/site-packages/triton/backends/amd/include/roctracer/hsa_prof_str.h +0 -0
- vllm/lib/python3.10/site-packages/triton/backends/amd/include/roctracer/roctracer_hcc.h +24 -0
- vllm/lib/python3.10/site-packages/triton/backends/amd/include/roctracer/roctracer_hip.h +37 -0
- vllm/lib/python3.10/site-packages/triton/backends/amd/include/roctracer/roctracer_plugin.h +137 -0
- vllm/lib/python3.10/site-packages/triton/backends/nvidia/compiler.py +325 -0
- vllm/lib/python3.10/site-packages/triton/backends/nvidia/driver.py +385 -0
- vllm/lib/python3.10/site-packages/triton/backends/nvidia/include/Openmp/cupti_openmp.h +100 -0
- vllm/lib/python3.10/site-packages/triton/backends/nvidia/include/common_functions.h +65 -0
- vllm/lib/python3.10/site-packages/triton/backends/nvidia/include/cooperative_groups/details/invoke.h +189 -0
- vllm/lib/python3.10/site-packages/triton/backends/nvidia/include/cuda_gl_interop.h +514 -0
- vllm/lib/python3.10/site-packages/triton/backends/nvidia/include/cupti_metrics.h +825 -0
- vllm/lib/python3.10/site-packages/triton/backends/nvidia/include/cupti_result.h +346 -0
- vllm/lib/python3.10/site-packages/triton/backends/nvidia/include/cupti_runtime_cbid.h +481 -0
- vllm/lib/python3.10/site-packages/triton/backends/nvidia/include/cupti_version.h +134 -0
- vllm/lib/python3.10/site-packages/triton/backends/nvidia/include/sm_32_atomic_functions.h +122 -0
- vllm/lib/python3.10/site-packages/triton/backends/nvidia/include/sm_61_intrinsics.hpp +161 -0
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/addcdiv_meta.h
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from NativeMetaFunction.h
|
| 4 |
+
|
| 5 |
+
#include <c10/core/Scalar.h>
|
| 6 |
+
#include <c10/core/Storage.h>
|
| 7 |
+
#include <c10/core/TensorOptions.h>
|
| 8 |
+
#include <c10/util/Deprecated.h>
|
| 9 |
+
#include <c10/util/Optional.h>
|
| 10 |
+
#include <c10/core/QScheme.h>
|
| 11 |
+
#include <ATen/core/Reduction.h>
|
| 12 |
+
#include <ATen/TensorIterator.h>
|
| 13 |
+
#include <ATen/TensorMeta.h>
|
| 14 |
+
#include <tuple>
|
| 15 |
+
#include <vector>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
namespace meta {
|
| 19 |
+
|
| 20 |
+
struct TORCH_API structured_addcdiv : public TensorIteratorBase {
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
void meta(const at::Tensor & self, const at::Tensor & tensor1, const at::Tensor & tensor2, const at::Scalar & value);
|
| 24 |
+
};
|
| 25 |
+
|
| 26 |
+
} // namespace native
|
| 27 |
+
} // namespace at
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/aminmax_cuda_dispatch.h
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace cuda {
|
| 19 |
+
|
| 20 |
+
TORCH_API ::std::tuple<at::Tensor,at::Tensor> aminmax(const at::Tensor & self, c10::optional<int64_t> dim=c10::nullopt, bool keepdim=false);
|
| 21 |
+
TORCH_API ::std::tuple<at::Tensor &,at::Tensor &> aminmax_out(at::Tensor & min, at::Tensor & max, const at::Tensor & self, c10::optional<int64_t> dim=c10::nullopt, bool keepdim=false);
|
| 22 |
+
TORCH_API ::std::tuple<at::Tensor &,at::Tensor &> aminmax_outf(const at::Tensor & self, c10::optional<int64_t> dim, bool keepdim, at::Tensor & min, at::Tensor & max);
|
| 23 |
+
|
| 24 |
+
} // namespace cuda
|
| 25 |
+
} // namespace at
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/argmax_meta_dispatch.h
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace meta {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor argmax(const at::Tensor & self, c10::optional<int64_t> dim=c10::nullopt, bool keepdim=false);
|
| 21 |
+
TORCH_API at::Tensor & argmax_out(at::Tensor & out, const at::Tensor & self, c10::optional<int64_t> dim=c10::nullopt, bool keepdim=false);
|
| 22 |
+
TORCH_API at::Tensor & argmax_outf(const at::Tensor & self, c10::optional<int64_t> dim, bool keepdim, at::Tensor & out);
|
| 23 |
+
|
| 24 |
+
} // namespace meta
|
| 25 |
+
} // namespace at
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/avg_pool3d_backward_ops.h
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Operator.h
|
| 4 |
+
|
| 5 |
+
#include <tuple>
|
| 6 |
+
#include <vector>
|
| 7 |
+
|
| 8 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 9 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 10 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 11 |
+
#include <ATen/core/ATen_fwd.h>
|
| 12 |
+
|
| 13 |
+
namespace at {
|
| 14 |
+
namespace _ops {
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
struct TORCH_API avg_pool3d_backward_grad_input {
|
| 18 |
+
using schema = at::Tensor & (const at::Tensor &, const at::Tensor &, at::IntArrayRef, at::IntArrayRef, at::IntArrayRef, bool, bool, c10::optional<int64_t>, at::Tensor &);
|
| 19 |
+
using ptr_schema = schema*;
|
| 20 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 21 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::avg_pool3d_backward")
|
| 22 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "grad_input")
|
| 23 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "avg_pool3d_backward.grad_input(Tensor grad_output, Tensor self, int[3] kernel_size, int[3] stride, int[3] padding, bool ceil_mode, bool count_include_pad, int? divisor_override, *, Tensor(a!) grad_input) -> Tensor(a!)")
|
| 24 |
+
static at::Tensor & call(const at::Tensor & grad_output, const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride, at::IntArrayRef padding, bool ceil_mode, bool count_include_pad, c10::optional<int64_t> divisor_override, at::Tensor & grad_input);
|
| 25 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & grad_output, const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride, at::IntArrayRef padding, bool ceil_mode, bool count_include_pad, c10::optional<int64_t> divisor_override, at::Tensor & grad_input);
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
struct TORCH_API avg_pool3d_backward {
|
| 29 |
+
using schema = at::Tensor (const at::Tensor &, const at::Tensor &, at::IntArrayRef, at::IntArrayRef, at::IntArrayRef, bool, bool, c10::optional<int64_t>);
|
| 30 |
+
using ptr_schema = schema*;
|
| 31 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 32 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::avg_pool3d_backward")
|
| 33 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 34 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "avg_pool3d_backward(Tensor grad_output, Tensor self, int[3] kernel_size, int[3] stride, int[3] padding, bool ceil_mode, bool count_include_pad, int? divisor_override) -> Tensor")
|
| 35 |
+
static at::Tensor call(const at::Tensor & grad_output, const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride, at::IntArrayRef padding, bool ceil_mode, bool count_include_pad, c10::optional<int64_t> divisor_override);
|
| 36 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & grad_output, const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride, at::IntArrayRef padding, bool ceil_mode, bool count_include_pad, c10::optional<int64_t> divisor_override);
|
| 37 |
+
};
|
| 38 |
+
|
| 39 |
+
}} // namespace at::_ops
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/ceil_ops.h
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Operator.h
|
| 4 |
+
|
| 5 |
+
#include <tuple>
|
| 6 |
+
#include <vector>
|
| 7 |
+
|
| 8 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 9 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 10 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 11 |
+
#include <ATen/core/ATen_fwd.h>
|
| 12 |
+
|
| 13 |
+
namespace at {
|
| 14 |
+
namespace _ops {
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
struct TORCH_API ceil {
|
| 18 |
+
using schema = at::Tensor (const at::Tensor &);
|
| 19 |
+
using ptr_schema = schema*;
|
| 20 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 21 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::ceil")
|
| 22 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 23 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "ceil(Tensor self) -> Tensor")
|
| 24 |
+
static at::Tensor call(const at::Tensor & self);
|
| 25 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self);
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
struct TORCH_API ceil_ {
|
| 29 |
+
using schema = at::Tensor & (at::Tensor &);
|
| 30 |
+
using ptr_schema = schema*;
|
| 31 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 32 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::ceil_")
|
| 33 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 34 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "ceil_(Tensor(a!) self) -> Tensor(a!)")
|
| 35 |
+
static at::Tensor & call(at::Tensor & self);
|
| 36 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, at::Tensor & self);
|
| 37 |
+
};
|
| 38 |
+
|
| 39 |
+
struct TORCH_API ceil_out {
|
| 40 |
+
using schema = at::Tensor & (const at::Tensor &, at::Tensor &);
|
| 41 |
+
using ptr_schema = schema*;
|
| 42 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 43 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::ceil")
|
| 44 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out")
|
| 45 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "ceil.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)")
|
| 46 |
+
static at::Tensor & call(const at::Tensor & self, at::Tensor & out);
|
| 47 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::Tensor & out);
|
| 48 |
+
};
|
| 49 |
+
|
| 50 |
+
}} // namespace at::_ops
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/fft_hfft.h
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Function.h
|
| 4 |
+
|
| 5 |
+
#include <ATen/Context.h>
|
| 6 |
+
#include <ATen/DeviceGuard.h>
|
| 7 |
+
#include <ATen/TensorUtils.h>
|
| 8 |
+
#include <ATen/TracerMode.h>
|
| 9 |
+
#include <ATen/core/Generator.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
#include <ATen/core/Tensor.h>
|
| 12 |
+
#include <c10/core/Scalar.h>
|
| 13 |
+
#include <c10/core/Storage.h>
|
| 14 |
+
#include <c10/core/TensorOptions.h>
|
| 15 |
+
#include <c10/util/Deprecated.h>
|
| 16 |
+
#include <c10/util/Optional.h>
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
#include <ATen/ops/fft_hfft_ops.h>
|
| 21 |
+
|
| 22 |
+
namespace at {
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
// aten::fft_hfft(Tensor self, SymInt? n=None, int dim=-1, str? norm=None) -> Tensor
|
| 26 |
+
inline at::Tensor fft_hfft(const at::Tensor & self, c10::optional<int64_t> n=c10::nullopt, int64_t dim=-1, c10::optional<c10::string_view> norm=c10::nullopt) {
|
| 27 |
+
return at::_ops::fft_hfft::call(self, n.has_value() ? c10::make_optional(c10::SymInt(*n)) : c10::nullopt, dim, norm);
|
| 28 |
+
}
|
| 29 |
+
namespace symint {
|
| 30 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
|
| 31 |
+
at::Tensor fft_hfft(const at::Tensor & self, c10::optional<int64_t> n=c10::nullopt, int64_t dim=-1, c10::optional<c10::string_view> norm=c10::nullopt) {
|
| 32 |
+
return at::_ops::fft_hfft::call(self, n.has_value() ? c10::make_optional(c10::SymInt(*n)) : c10::nullopt, dim, norm);
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
// aten::fft_hfft(Tensor self, SymInt? n=None, int dim=-1, str? norm=None) -> Tensor
|
| 37 |
+
inline at::Tensor fft_hfft_symint(const at::Tensor & self, c10::optional<c10::SymInt> n=c10::nullopt, int64_t dim=-1, c10::optional<c10::string_view> norm=c10::nullopt) {
|
| 38 |
+
return at::_ops::fft_hfft::call(self, n, dim, norm);
|
| 39 |
+
}
|
| 40 |
+
namespace symint {
|
| 41 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
|
| 42 |
+
at::Tensor fft_hfft(const at::Tensor & self, c10::optional<c10::SymInt> n=c10::nullopt, int64_t dim=-1, c10::optional<c10::string_view> norm=c10::nullopt) {
|
| 43 |
+
return at::_ops::fft_hfft::call(self, n, dim, norm);
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
// aten::fft_hfft.out(Tensor self, SymInt? n=None, int dim=-1, str? norm=None, *, Tensor(a!) out) -> Tensor(a!)
|
| 48 |
+
inline at::Tensor & fft_hfft_out(at::Tensor & out, const at::Tensor & self, c10::optional<int64_t> n=c10::nullopt, int64_t dim=-1, c10::optional<c10::string_view> norm=c10::nullopt) {
|
| 49 |
+
return at::_ops::fft_hfft_out::call(self, n.has_value() ? c10::make_optional(c10::SymInt(*n)) : c10::nullopt, dim, norm, out);
|
| 50 |
+
}
|
| 51 |
+
namespace symint {
|
| 52 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
|
| 53 |
+
at::Tensor & fft_hfft_out(at::Tensor & out, const at::Tensor & self, c10::optional<int64_t> n=c10::nullopt, int64_t dim=-1, c10::optional<c10::string_view> norm=c10::nullopt) {
|
| 54 |
+
return at::_ops::fft_hfft_out::call(self, n.has_value() ? c10::make_optional(c10::SymInt(*n)) : c10::nullopt, dim, norm, out);
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
// aten::fft_hfft.out(Tensor self, SymInt? n=None, int dim=-1, str? norm=None, *, Tensor(a!) out) -> Tensor(a!)
|
| 59 |
+
inline at::Tensor & fft_hfft_outf(const at::Tensor & self, c10::optional<int64_t> n, int64_t dim, c10::optional<c10::string_view> norm, at::Tensor & out) {
|
| 60 |
+
return at::_ops::fft_hfft_out::call(self, n.has_value() ? c10::make_optional(c10::SymInt(*n)) : c10::nullopt, dim, norm, out);
|
| 61 |
+
}
|
| 62 |
+
namespace symint {
|
| 63 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
|
| 64 |
+
at::Tensor & fft_hfft_outf(const at::Tensor & self, c10::optional<int64_t> n, int64_t dim, c10::optional<c10::string_view> norm, at::Tensor & out) {
|
| 65 |
+
return at::_ops::fft_hfft_out::call(self, n.has_value() ? c10::make_optional(c10::SymInt(*n)) : c10::nullopt, dim, norm, out);
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
// aten::fft_hfft.out(Tensor self, SymInt? n=None, int dim=-1, str? norm=None, *, Tensor(a!) out) -> Tensor(a!)
|
| 70 |
+
inline at::Tensor & fft_hfft_symint_out(at::Tensor & out, const at::Tensor & self, c10::optional<c10::SymInt> n=c10::nullopt, int64_t dim=-1, c10::optional<c10::string_view> norm=c10::nullopt) {
|
| 71 |
+
return at::_ops::fft_hfft_out::call(self, n, dim, norm, out);
|
| 72 |
+
}
|
| 73 |
+
namespace symint {
|
| 74 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
|
| 75 |
+
at::Tensor & fft_hfft_out(at::Tensor & out, const at::Tensor & self, c10::optional<c10::SymInt> n=c10::nullopt, int64_t dim=-1, c10::optional<c10::string_view> norm=c10::nullopt) {
|
| 76 |
+
return at::_ops::fft_hfft_out::call(self, n, dim, norm, out);
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
// aten::fft_hfft.out(Tensor self, SymInt? n=None, int dim=-1, str? norm=None, *, Tensor(a!) out) -> Tensor(a!)
|
| 81 |
+
inline at::Tensor & fft_hfft_symint_outf(const at::Tensor & self, c10::optional<c10::SymInt> n, int64_t dim, c10::optional<c10::string_view> norm, at::Tensor & out) {
|
| 82 |
+
return at::_ops::fft_hfft_out::call(self, n, dim, norm, out);
|
| 83 |
+
}
|
| 84 |
+
namespace symint {
|
| 85 |
+
template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
|
| 86 |
+
at::Tensor & fft_hfft_outf(const at::Tensor & self, c10::optional<c10::SymInt> n, int64_t dim, c10::optional<c10::string_view> norm, at::Tensor & out) {
|
| 87 |
+
return at::_ops::fft_hfft_out::call(self, n, dim, norm, out);
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
}
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/fliplr_native.h
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from NativeFunction.h
|
| 4 |
+
|
| 5 |
+
#include <c10/core/Scalar.h>
|
| 6 |
+
#include <c10/core/Storage.h>
|
| 7 |
+
#include <c10/core/TensorOptions.h>
|
| 8 |
+
#include <c10/util/Deprecated.h>
|
| 9 |
+
#include <c10/util/Optional.h>
|
| 10 |
+
#include <c10/core/QScheme.h>
|
| 11 |
+
#include <ATen/core/Reduction.h>
|
| 12 |
+
#include <ATen/core/Tensor.h>
|
| 13 |
+
#include <tuple>
|
| 14 |
+
#include <vector>
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
namespace native {
|
| 19 |
+
TORCH_API at::Tensor fliplr(const at::Tensor & self);
|
| 20 |
+
} // namespace native
|
| 21 |
+
} // namespace at
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/linalg_inv_ex_meta_dispatch.h
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace meta {
|
| 19 |
+
|
| 20 |
+
TORCH_API ::std::tuple<at::Tensor,at::Tensor> linalg_inv_ex(const at::Tensor & A, bool check_errors=false);
|
| 21 |
+
TORCH_API ::std::tuple<at::Tensor &,at::Tensor &> linalg_inv_ex_out(at::Tensor & inverse, at::Tensor & info, const at::Tensor & A, bool check_errors=false);
|
| 22 |
+
TORCH_API ::std::tuple<at::Tensor &,at::Tensor &> linalg_inv_ex_outf(const at::Tensor & A, bool check_errors, at::Tensor & inverse, at::Tensor & info);
|
| 23 |
+
|
| 24 |
+
} // namespace meta
|
| 25 |
+
} // namespace at
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/linalg_solve_ex_native.h
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from NativeFunction.h
|
| 4 |
+
|
| 5 |
+
#include <c10/core/Scalar.h>
|
| 6 |
+
#include <c10/core/Storage.h>
|
| 7 |
+
#include <c10/core/TensorOptions.h>
|
| 8 |
+
#include <c10/util/Deprecated.h>
|
| 9 |
+
#include <c10/util/Optional.h>
|
| 10 |
+
#include <c10/core/QScheme.h>
|
| 11 |
+
#include <ATen/core/Reduction.h>
|
| 12 |
+
#include <ATen/core/Tensor.h>
|
| 13 |
+
#include <tuple>
|
| 14 |
+
#include <vector>
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
namespace native {
|
| 19 |
+
TORCH_API ::std::tuple<at::Tensor,at::Tensor> linalg_solve_ex(const at::Tensor & A, const at::Tensor & B, bool left=true, bool check_errors=false);
|
| 20 |
+
TORCH_API ::std::tuple<at::Tensor &,at::Tensor &> linalg_solve_ex_out(const at::Tensor & A, const at::Tensor & B, bool left, bool check_errors, at::Tensor & result, at::Tensor & info);
|
| 21 |
+
} // namespace native
|
| 22 |
+
} // namespace at
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/select_compositeexplicitautograd_dispatch.h
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace compositeexplicitautograd {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor select(const at::Tensor & self, int64_t dim, int64_t index);
|
| 21 |
+
TORCH_API at::Tensor select_symint(const at::Tensor & self, int64_t dim, c10::SymInt index);
|
| 22 |
+
|
| 23 |
+
} // namespace compositeexplicitautograd
|
| 24 |
+
} // namespace at
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/silu_backward_compositeimplicitautograd_dispatch.h
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace compositeimplicitautograd {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor silu_backward(const at::Tensor & grad_output, const at::Tensor & self);
|
| 21 |
+
|
| 22 |
+
} // namespace compositeimplicitautograd
|
| 23 |
+
} // namespace at
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/sin_cuda_dispatch.h
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace cuda {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor sin(const at::Tensor & self);
|
| 21 |
+
TORCH_API at::Tensor & sin_out(at::Tensor & out, const at::Tensor & self);
|
| 22 |
+
TORCH_API at::Tensor & sin_outf(const at::Tensor & self, at::Tensor & out);
|
| 23 |
+
TORCH_API at::Tensor & sin_(at::Tensor & self);
|
| 24 |
+
|
| 25 |
+
} // namespace cuda
|
| 26 |
+
} // namespace at
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/special_i1e.h
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Function.h
|
| 4 |
+
|
| 5 |
+
#include <ATen/Context.h>
|
| 6 |
+
#include <ATen/DeviceGuard.h>
|
| 7 |
+
#include <ATen/TensorUtils.h>
|
| 8 |
+
#include <ATen/TracerMode.h>
|
| 9 |
+
#include <ATen/core/Generator.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
#include <ATen/core/Tensor.h>
|
| 12 |
+
#include <c10/core/Scalar.h>
|
| 13 |
+
#include <c10/core/Storage.h>
|
| 14 |
+
#include <c10/core/TensorOptions.h>
|
| 15 |
+
#include <c10/util/Deprecated.h>
|
| 16 |
+
#include <c10/util/Optional.h>
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
#include <ATen/ops/special_i1e_ops.h>
|
| 21 |
+
|
| 22 |
+
namespace at {
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
// aten::special_i1e(Tensor self) -> Tensor
|
| 26 |
+
inline at::Tensor special_i1e(const at::Tensor & self) {
|
| 27 |
+
return at::_ops::special_i1e::call(self);
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
// aten::special_i1e.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
|
| 31 |
+
inline at::Tensor & special_i1e_out(at::Tensor & out, const at::Tensor & self) {
|
| 32 |
+
return at::_ops::special_i1e_out::call(self, out);
|
| 33 |
+
}
|
| 34 |
+
// aten::special_i1e.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
|
| 35 |
+
inline at::Tensor & special_i1e_outf(const at::Tensor & self, at::Tensor & out) {
|
| 36 |
+
return at::_ops::special_i1e_out::call(self, out);
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
}
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/special_polygamma_ops.h
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Operator.h
|
| 4 |
+
|
| 5 |
+
#include <tuple>
|
| 6 |
+
#include <vector>
|
| 7 |
+
|
| 8 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 9 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 10 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 11 |
+
#include <ATen/core/ATen_fwd.h>
|
| 12 |
+
|
| 13 |
+
namespace at {
|
| 14 |
+
namespace _ops {
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
struct TORCH_API special_polygamma {
|
| 18 |
+
using schema = at::Tensor (int64_t, const at::Tensor &);
|
| 19 |
+
using ptr_schema = schema*;
|
| 20 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 21 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::special_polygamma")
|
| 22 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 23 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "special_polygamma(int n, Tensor self) -> Tensor")
|
| 24 |
+
static at::Tensor call(int64_t n, const at::Tensor & self);
|
| 25 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, int64_t n, const at::Tensor & self);
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
struct TORCH_API special_polygamma_out {
|
| 29 |
+
using schema = at::Tensor & (int64_t, const at::Tensor &, at::Tensor &);
|
| 30 |
+
using ptr_schema = schema*;
|
| 31 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 32 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::special_polygamma")
|
| 33 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out")
|
| 34 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "special_polygamma.out(int n, Tensor self, *, Tensor(a!) out) -> Tensor(a!)")
|
| 35 |
+
static at::Tensor & call(int64_t n, const at::Tensor & self, at::Tensor & out);
|
| 36 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, int64_t n, const at::Tensor & self, at::Tensor & out);
|
| 37 |
+
};
|
| 38 |
+
|
| 39 |
+
}} // namespace at::_ops
|
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/type_as_compositeimplicitautograd_dispatch.h
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace compositeimplicitautograd {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor type_as(const at::Tensor & self, const at::Tensor & other);
|
| 21 |
+
|
| 22 |
+
} // namespace compositeimplicitautograd
|
| 23 |
+
} // namespace at
|
vllm/lib/python3.10/site-packages/torio/__init__.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from . import _extension # noqa # usort: skip
|
| 2 |
+
from . import io, utils
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
__all__ = [
|
| 6 |
+
"io",
|
| 7 |
+
"utils",
|
| 8 |
+
]
|
vllm/lib/python3.10/site-packages/torio/_extension/__init__.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .utils import _init_ffmpeg, _LazyImporter
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
_FFMPEG_EXT = None
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def lazy_import_ffmpeg_ext():
|
| 8 |
+
"""Load FFmpeg integration based on availability in lazy manner"""
|
| 9 |
+
|
| 10 |
+
global _FFMPEG_EXT
|
| 11 |
+
if _FFMPEG_EXT is None:
|
| 12 |
+
_FFMPEG_EXT = _LazyImporter("_torio_ffmpeg", _init_ffmpeg)
|
| 13 |
+
return _FFMPEG_EXT
|
vllm/lib/python3.10/site-packages/torio/_extension/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (479 Bytes). View file
|
|
|
vllm/lib/python3.10/site-packages/torio/_extension/__pycache__/utils.cpython-310.pyc
ADDED
|
Binary file (5.2 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/torio/_extension/utils.py
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import importlib
|
| 2 |
+
import logging
|
| 3 |
+
import os
|
| 4 |
+
import types
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
import torch
|
| 8 |
+
|
| 9 |
+
_LG = logging.getLogger(__name__)
|
| 10 |
+
_LIB_DIR = Path(__file__).parent.parent / "lib"
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class _LazyImporter(types.ModuleType):
|
| 14 |
+
"""Lazily import module/extension."""
|
| 15 |
+
|
| 16 |
+
def __init__(self, name, import_func):
|
| 17 |
+
super().__init__(name)
|
| 18 |
+
self.import_func = import_func
|
| 19 |
+
self.module = None
|
| 20 |
+
|
| 21 |
+
# Note:
|
| 22 |
+
# Python caches what was retrieved with `__getattr__`, so this method will not be
|
| 23 |
+
# called again for the same item.
|
| 24 |
+
def __getattr__(self, item):
|
| 25 |
+
self._import_once()
|
| 26 |
+
return getattr(self.module, item)
|
| 27 |
+
|
| 28 |
+
def __repr__(self):
|
| 29 |
+
if self.module is None:
|
| 30 |
+
return f"<module '{self.__module__}.{self.__class__.__name__}(\"{self.name}\")'>"
|
| 31 |
+
return repr(self.module)
|
| 32 |
+
|
| 33 |
+
def __dir__(self):
|
| 34 |
+
self._import_once()
|
| 35 |
+
return dir(self.module)
|
| 36 |
+
|
| 37 |
+
def _import_once(self):
|
| 38 |
+
if self.module is None:
|
| 39 |
+
self.module = self.import_func()
|
| 40 |
+
# Note:
|
| 41 |
+
# By attaching the module attributes to self,
|
| 42 |
+
# module attributes are directly accessible.
|
| 43 |
+
# This allows to avoid calling __getattr__ for every attribute access.
|
| 44 |
+
self.__dict__.update(self.module.__dict__)
|
| 45 |
+
|
| 46 |
+
def is_available(self):
|
| 47 |
+
try:
|
| 48 |
+
self._import_once()
|
| 49 |
+
except Exception:
|
| 50 |
+
return False
|
| 51 |
+
return True
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
def _get_lib_path(lib: str):
|
| 55 |
+
suffix = "pyd" if os.name == "nt" else "so"
|
| 56 |
+
path = _LIB_DIR / f"{lib}.{suffix}"
|
| 57 |
+
return path
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
def _load_lib(lib: str) -> bool:
|
| 61 |
+
"""Load extension module
|
| 62 |
+
|
| 63 |
+
Note:
|
| 64 |
+
In case `torio` is deployed with `pex` format, the library file
|
| 65 |
+
is not in a standard location.
|
| 66 |
+
In this case, we expect that `libtorio` is available somewhere
|
| 67 |
+
in the search path of dynamic loading mechanism, so that importing
|
| 68 |
+
`_torio` will have library loader find and load `libtorio`.
|
| 69 |
+
This is the reason why the function should not raising an error when the library
|
| 70 |
+
file is not found.
|
| 71 |
+
|
| 72 |
+
Returns:
|
| 73 |
+
bool:
|
| 74 |
+
True if the library file is found AND the library loaded without failure.
|
| 75 |
+
False if the library file is not found (like in the case where torio
|
| 76 |
+
is deployed with pex format, thus the shared library file is
|
| 77 |
+
in a non-standard location.).
|
| 78 |
+
If the library file is found but there is an issue loading the library,
|
| 79 |
+
(such as missing dependency) then this function raises the exception as-is.
|
| 80 |
+
|
| 81 |
+
Raises:
|
| 82 |
+
Exception:
|
| 83 |
+
If the library file is found, but there is an issue loading the library file,
|
| 84 |
+
(when underlying `ctype.DLL` throws an exception), this function will pass
|
| 85 |
+
the exception as-is, instead of catching it and returning bool.
|
| 86 |
+
The expected case is `OSError` thrown by `ctype.DLL` when a dynamic dependency
|
| 87 |
+
is not found.
|
| 88 |
+
This behavior was chosen because the expected failure case is not recoverable.
|
| 89 |
+
If a dependency is missing, then users have to install it.
|
| 90 |
+
"""
|
| 91 |
+
path = _get_lib_path(lib)
|
| 92 |
+
if not path.exists():
|
| 93 |
+
return False
|
| 94 |
+
torch.ops.load_library(path)
|
| 95 |
+
return True
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
_FFMPEG_VERS = ["6", "5", "4", ""]
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
def _find_versionsed_ffmpeg_extension(version: str):
|
| 102 |
+
ext = f"torio.lib._torio_ffmpeg{version}"
|
| 103 |
+
lib = f"libtorio_ffmpeg{version}"
|
| 104 |
+
|
| 105 |
+
if not importlib.util.find_spec(ext):
|
| 106 |
+
raise RuntimeError(f"FFmpeg{version} extension is not available.")
|
| 107 |
+
|
| 108 |
+
_load_lib(lib)
|
| 109 |
+
return importlib.import_module(ext)
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
def _find_ffmpeg_extension(ffmpeg_vers):
|
| 113 |
+
for ffmpeg_ver in ffmpeg_vers:
|
| 114 |
+
_LG.debug("Loading FFmpeg%s", ffmpeg_ver)
|
| 115 |
+
try:
|
| 116 |
+
ext = _find_versionsed_ffmpeg_extension(ffmpeg_ver)
|
| 117 |
+
_LG.debug("Successfully loaded FFmpeg%s", ffmpeg_ver)
|
| 118 |
+
return ext
|
| 119 |
+
except Exception:
|
| 120 |
+
_LG.debug("Failed to load FFmpeg%s extension.", ffmpeg_ver, exc_info=True)
|
| 121 |
+
continue
|
| 122 |
+
raise ImportError(
|
| 123 |
+
f"Failed to intialize FFmpeg extension. Tried versions: {ffmpeg_vers}. "
|
| 124 |
+
"Enable DEBUG logging to see more details about the error."
|
| 125 |
+
)
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
def _get_ffmpeg_versions():
|
| 129 |
+
ffmpeg_vers = _FFMPEG_VERS
|
| 130 |
+
# User override
|
| 131 |
+
if (ffmpeg_ver := os.environ.get("TORIO_USE_FFMPEG_VERSION")) is not None:
|
| 132 |
+
if ffmpeg_ver not in ffmpeg_vers:
|
| 133 |
+
raise ValueError(
|
| 134 |
+
f"The FFmpeg version '{ffmpeg_ver}' (read from TORIO_USE_FFMPEG_VERSION) "
|
| 135 |
+
f"is not one of supported values. Possible values are {ffmpeg_vers}"
|
| 136 |
+
)
|
| 137 |
+
ffmpeg_vers = [ffmpeg_ver]
|
| 138 |
+
return ffmpeg_vers
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
def _init_ffmpeg():
|
| 142 |
+
ffmpeg_vers = _get_ffmpeg_versions()
|
| 143 |
+
ext = _find_ffmpeg_extension(ffmpeg_vers)
|
| 144 |
+
ext.init()
|
| 145 |
+
if ext.get_log_level() > 8:
|
| 146 |
+
ext.set_log_level(8)
|
| 147 |
+
return ext
|
vllm/lib/python3.10/site-packages/torio/io/__init__.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from ._streaming_media_decoder import StreamingMediaDecoder
|
| 2 |
+
from ._streaming_media_encoder import CodecConfig, StreamingMediaEncoder
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
__all__ = [
|
| 6 |
+
"StreamingMediaDecoder",
|
| 7 |
+
"CodecConfig",
|
| 8 |
+
"StreamingMediaEncoder",
|
| 9 |
+
]
|
vllm/lib/python3.10/site-packages/torio/io/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (356 Bytes). View file
|
|
|
vllm/lib/python3.10/site-packages/torio/io/__pycache__/_streaming_media_decoder.cpython-310.pyc
ADDED
|
Binary file (31.5 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/torio/io/__pycache__/_streaming_media_encoder.cpython-310.pyc
ADDED
|
Binary file (19.7 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/torio/io/_streaming_media_decoder.py
ADDED
|
@@ -0,0 +1,978 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import os
|
| 4 |
+
from dataclasses import dataclass
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
from typing import BinaryIO, Dict, Iterator, Optional, Tuple, TypeVar, Union
|
| 7 |
+
|
| 8 |
+
import torch
|
| 9 |
+
import torio
|
| 10 |
+
from torch.utils._pytree import tree_map
|
| 11 |
+
|
| 12 |
+
ffmpeg_ext = torio._extension.lazy_import_ffmpeg_ext()
|
| 13 |
+
|
| 14 |
+
__all__ = [
|
| 15 |
+
"StreamingMediaDecoder",
|
| 16 |
+
]
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
@dataclass
|
| 20 |
+
class SourceStream:
|
| 21 |
+
"""The metadata of a source stream, returned by :meth:`~torio.io.StreamingMediaDecoder.get_src_stream_info`.
|
| 22 |
+
|
| 23 |
+
This class is used when representing streams of media type other than `audio` or `video`.
|
| 24 |
+
|
| 25 |
+
When source stream is `audio` or `video` type, :class:`SourceAudioStream` and
|
| 26 |
+
:class:`SourceVideoStream`, which reports additional media-specific attributes,
|
| 27 |
+
are used respectively.
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
+
media_type: str
|
| 31 |
+
"""The type of the stream.
|
| 32 |
+
One of ``"audio"``, ``"video"``, ``"data"``, ``"subtitle"``, ``"attachment"`` and empty string.
|
| 33 |
+
|
| 34 |
+
.. note::
|
| 35 |
+
Only audio and video streams are supported for output.
|
| 36 |
+
.. note::
|
| 37 |
+
Still images, such as PNG and JPEG formats are reported as video.
|
| 38 |
+
"""
|
| 39 |
+
codec: str
|
| 40 |
+
"""Short name of the codec. Such as ``"pcm_s16le"`` and ``"h264"``."""
|
| 41 |
+
codec_long_name: str
|
| 42 |
+
"""Detailed name of the codec.
|
| 43 |
+
|
| 44 |
+
Such as "`PCM signed 16-bit little-endian`" and "`H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10`".
|
| 45 |
+
"""
|
| 46 |
+
format: Optional[str]
|
| 47 |
+
"""Media format. Such as ``"s16"`` and ``"yuv420p"``.
|
| 48 |
+
|
| 49 |
+
Commonly found audio values are;
|
| 50 |
+
|
| 51 |
+
- ``"u8"``, ``"u8p"``: Unsigned 8-bit unsigned interger.
|
| 52 |
+
- ``"s16"``, ``"s16p"``: 16-bit signed integer.
|
| 53 |
+
- ``"s32"``, ``"s32p"``: 32-bit signed integer.
|
| 54 |
+
- ``"flt"``, ``"fltp"``: 32-bit floating-point.
|
| 55 |
+
|
| 56 |
+
.. note::
|
| 57 |
+
|
| 58 |
+
`p` at the end indicates the format is `planar`.
|
| 59 |
+
Channels are grouped together instead of interspersed in memory.
|
| 60 |
+
"""
|
| 61 |
+
bit_rate: Optional[int]
|
| 62 |
+
"""Bit rate of the stream in bits-per-second.
|
| 63 |
+
This is an estimated values based on the initial few frames of the stream.
|
| 64 |
+
For container formats and variable bit rate, it can be 0.
|
| 65 |
+
"""
|
| 66 |
+
num_frames: Optional[int]
|
| 67 |
+
"""The number of frames in the stream"""
|
| 68 |
+
bits_per_sample: Optional[int]
|
| 69 |
+
"""This is the number of valid bits in each output sample.
|
| 70 |
+
For compressed format, it can be 0.
|
| 71 |
+
"""
|
| 72 |
+
metadata: Dict[str, str]
|
| 73 |
+
"""Metadata attached to the source stream."""
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
@dataclass
|
| 77 |
+
class SourceAudioStream(SourceStream):
|
| 78 |
+
"""The metadata of an audio source stream, returned by :meth:`~torio.io.StreamingMediaDecoder.get_src_stream_info`.
|
| 79 |
+
|
| 80 |
+
This class is used when representing audio stream.
|
| 81 |
+
|
| 82 |
+
In addition to the attributes reported by :class:`SourceStream`,
|
| 83 |
+
the following attributes are reported.
|
| 84 |
+
"""
|
| 85 |
+
|
| 86 |
+
sample_rate: float
|
| 87 |
+
"""Sample rate of the audio."""
|
| 88 |
+
num_channels: int
|
| 89 |
+
"""Number of channels."""
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
@dataclass
|
| 93 |
+
class SourceVideoStream(SourceStream):
|
| 94 |
+
"""The metadata of a video source stream, returned by :meth:`~torio.io.StreamingMediaDecoder.get_src_stream_info`.
|
| 95 |
+
|
| 96 |
+
This class is used when representing video stream.
|
| 97 |
+
|
| 98 |
+
In addition to the attributes reported by :class:`SourceStream`,
|
| 99 |
+
the following attributes are reported.
|
| 100 |
+
"""
|
| 101 |
+
|
| 102 |
+
width: int
|
| 103 |
+
"""Width of the video frame in pixel."""
|
| 104 |
+
height: int
|
| 105 |
+
"""Height of the video frame in pixel."""
|
| 106 |
+
frame_rate: float
|
| 107 |
+
"""Frame rate."""
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
def _parse_si(i):
|
| 111 |
+
media_type = i.media_type
|
| 112 |
+
if media_type == "audio":
|
| 113 |
+
return SourceAudioStream(
|
| 114 |
+
media_type=i.media_type,
|
| 115 |
+
codec=i.codec_name,
|
| 116 |
+
codec_long_name=i.codec_long_name,
|
| 117 |
+
format=i.format,
|
| 118 |
+
bit_rate=i.bit_rate,
|
| 119 |
+
num_frames=i.num_frames,
|
| 120 |
+
bits_per_sample=i.bits_per_sample,
|
| 121 |
+
metadata=i.metadata,
|
| 122 |
+
sample_rate=i.sample_rate,
|
| 123 |
+
num_channels=i.num_channels,
|
| 124 |
+
)
|
| 125 |
+
if media_type == "video":
|
| 126 |
+
return SourceVideoStream(
|
| 127 |
+
media_type=i.media_type,
|
| 128 |
+
codec=i.codec_name,
|
| 129 |
+
codec_long_name=i.codec_long_name,
|
| 130 |
+
format=i.format,
|
| 131 |
+
bit_rate=i.bit_rate,
|
| 132 |
+
num_frames=i.num_frames,
|
| 133 |
+
bits_per_sample=i.bits_per_sample,
|
| 134 |
+
metadata=i.metadata,
|
| 135 |
+
width=i.width,
|
| 136 |
+
height=i.height,
|
| 137 |
+
frame_rate=i.frame_rate,
|
| 138 |
+
)
|
| 139 |
+
return SourceStream(
|
| 140 |
+
media_type=i.media_type,
|
| 141 |
+
codec=i.codec_name,
|
| 142 |
+
codec_long_name=i.codec_long_name,
|
| 143 |
+
format=None,
|
| 144 |
+
bit_rate=None,
|
| 145 |
+
num_frames=None,
|
| 146 |
+
bits_per_sample=None,
|
| 147 |
+
metadata=i.metadata,
|
| 148 |
+
)
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
@dataclass
|
| 152 |
+
class OutputStream:
|
| 153 |
+
"""Output stream configured on :class:`StreamingMediaDecoder`,
|
| 154 |
+
returned by :meth:`~torio.io.StreamingMediaDecoder.get_out_stream_info`.
|
| 155 |
+
"""
|
| 156 |
+
|
| 157 |
+
source_index: int
|
| 158 |
+
"""Index of the source stream that this output stream is connected."""
|
| 159 |
+
filter_description: str
|
| 160 |
+
"""Description of filter graph applied to the source stream."""
|
| 161 |
+
media_type: str
|
| 162 |
+
"""The type of the stream. ``"audio"`` or ``"video"``."""
|
| 163 |
+
format: str
|
| 164 |
+
"""Media format. Such as ``"s16"`` and ``"yuv420p"``.
|
| 165 |
+
|
| 166 |
+
Commonly found audio values are;
|
| 167 |
+
|
| 168 |
+
- ``"u8"``, ``"u8p"``: Unsigned 8-bit unsigned interger.
|
| 169 |
+
- ``"s16"``, ``"s16p"``: 16-bit signed integer.
|
| 170 |
+
- ``"s32"``, ``"s32p"``: 32-bit signed integer.
|
| 171 |
+
- ``"flt"``, ``"fltp"``: 32-bit floating-point.
|
| 172 |
+
|
| 173 |
+
.. note::
|
| 174 |
+
|
| 175 |
+
`p` at the end indicates the format is `planar`.
|
| 176 |
+
Channels are grouped together instead of interspersed in memory."""
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
@dataclass
|
| 180 |
+
class OutputAudioStream(OutputStream):
|
| 181 |
+
"""Information about an audio output stream configured with
|
| 182 |
+
:meth:`~torio.io.StreamingMediaDecoder.add_audio_stream` or
|
| 183 |
+
:meth:`~torio.io.StreamingMediaDecoder.add_basic_audio_stream`.
|
| 184 |
+
|
| 185 |
+
In addition to the attributes reported by :class:`OutputStream`,
|
| 186 |
+
the following attributes are reported.
|
| 187 |
+
"""
|
| 188 |
+
|
| 189 |
+
sample_rate: float
|
| 190 |
+
"""Sample rate of the audio."""
|
| 191 |
+
num_channels: int
|
| 192 |
+
"""Number of channels."""
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
@dataclass
|
| 196 |
+
class OutputVideoStream(OutputStream):
|
| 197 |
+
"""Information about a video output stream configured with
|
| 198 |
+
:meth:`~torio.io.StreamingMediaDecoder.add_video_stream` or
|
| 199 |
+
:meth:`~torio.io.StreamingMediaDecoder.add_basic_video_stream`.
|
| 200 |
+
|
| 201 |
+
In addition to the attributes reported by :class:`OutputStream`,
|
| 202 |
+
the following attributes are reported.
|
| 203 |
+
"""
|
| 204 |
+
|
| 205 |
+
width: int
|
| 206 |
+
"""Width of the video frame in pixel."""
|
| 207 |
+
height: int
|
| 208 |
+
"""Height of the video frame in pixel."""
|
| 209 |
+
frame_rate: float
|
| 210 |
+
"""Frame rate."""
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
def _parse_oi(i):
|
| 214 |
+
media_type = i.media_type
|
| 215 |
+
if media_type == "audio":
|
| 216 |
+
return OutputAudioStream(
|
| 217 |
+
source_index=i.source_index,
|
| 218 |
+
filter_description=i.filter_description,
|
| 219 |
+
media_type=i.media_type,
|
| 220 |
+
format=i.format,
|
| 221 |
+
sample_rate=i.sample_rate,
|
| 222 |
+
num_channels=i.num_channels,
|
| 223 |
+
)
|
| 224 |
+
if media_type == "video":
|
| 225 |
+
return OutputVideoStream(
|
| 226 |
+
source_index=i.source_index,
|
| 227 |
+
filter_description=i.filter_description,
|
| 228 |
+
media_type=i.media_type,
|
| 229 |
+
format=i.format,
|
| 230 |
+
width=i.width,
|
| 231 |
+
height=i.height,
|
| 232 |
+
frame_rate=i.frame_rate,
|
| 233 |
+
)
|
| 234 |
+
raise ValueError(f"Unexpected media_type: {i.media_type}({i})")
|
| 235 |
+
|
| 236 |
+
|
| 237 |
+
def _get_afilter_desc(sample_rate: Optional[int], fmt: Optional[str], num_channels: Optional[int]):
|
| 238 |
+
descs = []
|
| 239 |
+
if sample_rate is not None:
|
| 240 |
+
descs.append(f"aresample={sample_rate}")
|
| 241 |
+
if fmt is not None or num_channels is not None:
|
| 242 |
+
parts = []
|
| 243 |
+
if fmt is not None:
|
| 244 |
+
parts.append(f"sample_fmts={fmt}")
|
| 245 |
+
if num_channels is not None:
|
| 246 |
+
parts.append(f"channel_layouts={num_channels}c")
|
| 247 |
+
descs.append(f"aformat={':'.join(parts)}")
|
| 248 |
+
return ",".join(descs) if descs else None
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
def _get_vfilter_desc(frame_rate: Optional[float], width: Optional[int], height: Optional[int], fmt: Optional[str]):
|
| 252 |
+
descs = []
|
| 253 |
+
if frame_rate is not None:
|
| 254 |
+
descs.append(f"fps={frame_rate}")
|
| 255 |
+
scales = []
|
| 256 |
+
if width is not None:
|
| 257 |
+
scales.append(f"width={width}")
|
| 258 |
+
if height is not None:
|
| 259 |
+
scales.append(f"height={height}")
|
| 260 |
+
if scales:
|
| 261 |
+
descs.append(f"scale={':'.join(scales)}")
|
| 262 |
+
if fmt is not None:
|
| 263 |
+
descs.append(f"format=pix_fmts={fmt}")
|
| 264 |
+
return ",".join(descs) if descs else None
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
# Base class for ChunkTensor
|
| 268 |
+
# Based off of TrivialTensorViaComposition
|
| 269 |
+
# https://github.com/albanD/subclass_zoo/blob/0eeb1d68fb59879029c610bc407f2997ae43ba0a/trivial_tensors.py#L83
|
| 270 |
+
class ChunkTensorBase(torch.Tensor):
|
| 271 |
+
__torch_function__ = torch._C._disabled_torch_function_impl
|
| 272 |
+
|
| 273 |
+
@staticmethod
|
| 274 |
+
def __new__(cls, _elem, *_):
|
| 275 |
+
return super().__new__(cls, _elem)
|
| 276 |
+
|
| 277 |
+
@classmethod
|
| 278 |
+
def __torch_dispatch__(cls, func, _, args=(), kwargs=None):
|
| 279 |
+
def unwrap(t):
|
| 280 |
+
return t._elem if isinstance(t, cls) else t
|
| 281 |
+
|
| 282 |
+
return func(*tree_map(unwrap, args), **tree_map(unwrap, kwargs))
|
| 283 |
+
|
| 284 |
+
|
| 285 |
+
@dataclass
|
| 286 |
+
class ChunkTensor(ChunkTensorBase):
|
| 287 |
+
"""Decoded media frames with metadata.
|
| 288 |
+
|
| 289 |
+
The instance of this class represents the decoded video/audio frames with
|
| 290 |
+
metadata, and the instance itself behave like :py:class:`~torch.Tensor`.
|
| 291 |
+
|
| 292 |
+
Client codes can pass instance of this class as-if it's
|
| 293 |
+
:py:class:`~torch.Tensor` class, or call the methods defined on
|
| 294 |
+
:py:class:`~torch.Tensor` class.
|
| 295 |
+
|
| 296 |
+
Example:
|
| 297 |
+
>>> # Define input streams
|
| 298 |
+
>>> reader = StreamingMediaDecoder(...)
|
| 299 |
+
>>> reader.add_audio_stream(frames_per_chunk=4000, sample_rate=8000)
|
| 300 |
+
>>> reader.add_video_stream(frames_per_chunk=7, frame_rate=28)
|
| 301 |
+
>>> # Decode the streams and fetch frames
|
| 302 |
+
>>> reader.fill_buffer()
|
| 303 |
+
>>> audio_chunk, video_chunk = reader.pop_chunks()
|
| 304 |
+
|
| 305 |
+
>>> # Access metadata
|
| 306 |
+
>>> (audio_chunk.pts, video_chunks.pts)
|
| 307 |
+
(0.0, 0.0)
|
| 308 |
+
>>>
|
| 309 |
+
>>> # The second time the PTS is different
|
| 310 |
+
>>> reader.fill_buffer()
|
| 311 |
+
>>> audio_chunk, video_chunk = reader.pop_chunks()
|
| 312 |
+
>>> (audio_chunk.pts, video_chunks.pts)
|
| 313 |
+
(0.5, 0.25)
|
| 314 |
+
|
| 315 |
+
>>> # Call PyTorch ops on chunk
|
| 316 |
+
>>> audio_chunk.shape
|
| 317 |
+
torch.Size([4000, 2]
|
| 318 |
+
>>> power = torch.pow(video_chunk, 2)
|
| 319 |
+
>>>
|
| 320 |
+
>>> # the result is a plain torch.Tensor class
|
| 321 |
+
>>> type(power)
|
| 322 |
+
<class 'torch.Tensor'>
|
| 323 |
+
>>>
|
| 324 |
+
>>> # Metadata is not available on the result
|
| 325 |
+
>>> power.pts
|
| 326 |
+
AttributeError: 'Tensor' object has no attribute 'pts'
|
| 327 |
+
"""
|
| 328 |
+
|
| 329 |
+
# Keep it private for now
|
| 330 |
+
_elem: torch.Tensor
|
| 331 |
+
|
| 332 |
+
pts: float
|
| 333 |
+
"""Presentation time stamp of the first frame in the chunk.
|
| 334 |
+
|
| 335 |
+
Unit: second.
|
| 336 |
+
"""
|
| 337 |
+
|
| 338 |
+
|
| 339 |
+
def _format_doc(**kwargs):
|
| 340 |
+
def decorator(obj):
|
| 341 |
+
obj.__doc__ = obj.__doc__.format(**kwargs)
|
| 342 |
+
return obj
|
| 343 |
+
|
| 344 |
+
return decorator
|
| 345 |
+
|
| 346 |
+
|
| 347 |
+
_frames_per_chunk = """Number of frames returned as one chunk.
|
| 348 |
+
If the source stream is exhausted before enough frames are buffered,
|
| 349 |
+
then the chunk is returned as-is.
|
| 350 |
+
|
| 351 |
+
Providing ``-1`` disables chunking and :py:func:`pop_chunks` method
|
| 352 |
+
will concatenate all the buffered frames and return it."""
|
| 353 |
+
|
| 354 |
+
_buffer_chunk_size = """Internal buffer size.
|
| 355 |
+
When the number of chunks buffered exceeds this number, old frames are
|
| 356 |
+
dropped. For example, if ``frames_per_chunk`` is 5 and ``buffer_chunk_size`` is
|
| 357 |
+
3, then frames older than ``15`` are dropped.
|
| 358 |
+
Providing ``-1`` disables this behavior.
|
| 359 |
+
|
| 360 |
+
Default: ``3``."""
|
| 361 |
+
|
| 362 |
+
_audio_stream_index = """The source audio stream index.
|
| 363 |
+
If omitted, :py:attr:`default_audio_stream` is used."""
|
| 364 |
+
|
| 365 |
+
|
| 366 |
+
_video_stream_index = """The source video stream index.
|
| 367 |
+
If omitted, :py:attr:`default_video_stream` is used."""
|
| 368 |
+
|
| 369 |
+
_decoder = """The name of the decoder to be used.
|
| 370 |
+
When provided, use the specified decoder instead of the default one.
|
| 371 |
+
|
| 372 |
+
To list the available decoders, please use
|
| 373 |
+
:py:func:`~torio.utils.ffmpeg_utils.get_audio_decoders` for audio, and
|
| 374 |
+
:py:func:`~torio.utils.ffmpeg_utils.get_video_decoders` for video.
|
| 375 |
+
|
| 376 |
+
Default: ``None``."""
|
| 377 |
+
|
| 378 |
+
_decoder_option = """Options passed to decoder.
|
| 379 |
+
Mapping from str to str. (Default: ``None``)
|
| 380 |
+
|
| 381 |
+
To list decoder options for a decoder, you can use
|
| 382 |
+
``ffmpeg -h decoder=<DECODER>`` command.
|
| 383 |
+
|
| 384 |
+
|
|
| 385 |
+
|
| 386 |
+
In addition to decoder-specific options, you can also pass options related
|
| 387 |
+
to multithreading. They are effective only if the decoder support them.
|
| 388 |
+
If neither of them are provided, StreamingMediaDecoder defaults to single thread.
|
| 389 |
+
|
| 390 |
+
``"threads"``: The number of threads (in str).
|
| 391 |
+
Providing the value ``"0"`` will let FFmpeg decides based on its heuristics.
|
| 392 |
+
|
| 393 |
+
``"thread_type"``: Which multithreading method to use.
|
| 394 |
+
The valid values are ``"frame"`` or ``"slice"``.
|
| 395 |
+
Note that each decoder supports different set of methods.
|
| 396 |
+
If not provided, a default value is used.
|
| 397 |
+
|
| 398 |
+
- ``"frame"``: Decode more than one frame at once.
|
| 399 |
+
Each thread handles one frame.
|
| 400 |
+
This will increase decoding delay by one frame per thread
|
| 401 |
+
- ``"slice"``: Decode more than one part of a single frame at once.
|
| 402 |
+
|
| 403 |
+
|
|
| 404 |
+
"""
|
| 405 |
+
|
| 406 |
+
|
| 407 |
+
_hw_accel = """Enable hardware acceleration.
|
| 408 |
+
|
| 409 |
+
When video is decoded on CUDA hardware, for example
|
| 410 |
+
`decoder="h264_cuvid"`, passing CUDA device indicator to `hw_accel`
|
| 411 |
+
(i.e. `hw_accel="cuda:0"`) will make StreamingMediaDecoder place the resulting
|
| 412 |
+
frames directly on the specified CUDA device as CUDA tensor.
|
| 413 |
+
|
| 414 |
+
If `None`, the frame will be moved to CPU memory.
|
| 415 |
+
Default: ``None``."""
|
| 416 |
+
|
| 417 |
+
|
| 418 |
+
_format_audio_args = _format_doc(
|
| 419 |
+
frames_per_chunk=_frames_per_chunk,
|
| 420 |
+
buffer_chunk_size=_buffer_chunk_size,
|
| 421 |
+
stream_index=_audio_stream_index,
|
| 422 |
+
decoder=_decoder,
|
| 423 |
+
decoder_option=_decoder_option,
|
| 424 |
+
)
|
| 425 |
+
|
| 426 |
+
|
| 427 |
+
_format_video_args = _format_doc(
|
| 428 |
+
frames_per_chunk=_frames_per_chunk,
|
| 429 |
+
buffer_chunk_size=_buffer_chunk_size,
|
| 430 |
+
stream_index=_video_stream_index,
|
| 431 |
+
decoder=_decoder,
|
| 432 |
+
decoder_option=_decoder_option,
|
| 433 |
+
hw_accel=_hw_accel,
|
| 434 |
+
)
|
| 435 |
+
|
| 436 |
+
|
| 437 |
+
InputStreamTypes = TypeVar("InputStream", bound=SourceStream)
|
| 438 |
+
OutputStreamTypes = TypeVar("OutputStream", bound=OutputStream)
|
| 439 |
+
|
| 440 |
+
|
| 441 |
+
class StreamingMediaDecoder:
|
| 442 |
+
"""Fetch and decode audio/video streams chunk by chunk.
|
| 443 |
+
|
| 444 |
+
For the detailed usage of this class, please refer to the tutorial.
|
| 445 |
+
|
| 446 |
+
Args:
|
| 447 |
+
src (str, path-like, bytes or file-like object): The media source.
|
| 448 |
+
If string-type, it must be a resource indicator that FFmpeg can
|
| 449 |
+
handle. This includes a file path, URL, device identifier or
|
| 450 |
+
filter expression. The supported value depends on the FFmpeg found
|
| 451 |
+
in the system.
|
| 452 |
+
|
| 453 |
+
If bytes, it must be an encoded media data in contiguous memory.
|
| 454 |
+
|
| 455 |
+
If file-like object, it must support `read` method with the signature
|
| 456 |
+
`read(size: int) -> bytes`.
|
| 457 |
+
Additionally, if the file-like object has `seek` method, it uses
|
| 458 |
+
the method when parsing media metadata. This improves the reliability
|
| 459 |
+
of codec detection. The signagure of `seek` method must be
|
| 460 |
+
`seek(offset: int, whence: int) -> int`.
|
| 461 |
+
|
| 462 |
+
Please refer to the following for the expected signature and behavior
|
| 463 |
+
of `read` and `seek` method.
|
| 464 |
+
|
| 465 |
+
- https://docs.python.org/3/library/io.html#io.BufferedIOBase.read
|
| 466 |
+
- https://docs.python.org/3/library/io.html#io.IOBase.seek
|
| 467 |
+
|
| 468 |
+
format (str or None, optional):
|
| 469 |
+
Override the input format, or specify the source sound device.
|
| 470 |
+
Default: ``None`` (no override nor device input).
|
| 471 |
+
|
| 472 |
+
This argument serves two different usecases.
|
| 473 |
+
|
| 474 |
+
1) Override the source format.
|
| 475 |
+
This is useful when the input data do not contain a header.
|
| 476 |
+
|
| 477 |
+
2) Specify the input source device.
|
| 478 |
+
This allows to load media stream from hardware devices,
|
| 479 |
+
such as microphone, camera and screen, or a virtual device.
|
| 480 |
+
|
| 481 |
+
|
| 482 |
+
.. note::
|
| 483 |
+
|
| 484 |
+
This option roughly corresponds to ``-f`` option of ``ffmpeg`` command.
|
| 485 |
+
Please refer to the ffmpeg documentations for the possible values.
|
| 486 |
+
|
| 487 |
+
https://ffmpeg.org/ffmpeg-formats.html#Demuxers
|
| 488 |
+
|
| 489 |
+
Please use :py:func:`~torio.utils.ffmpeg_utils.get_demuxers` to list the
|
| 490 |
+
demultiplexers available in the current environment.
|
| 491 |
+
|
| 492 |
+
For device access, the available values vary based on hardware (AV device) and
|
| 493 |
+
software configuration (ffmpeg build).
|
| 494 |
+
|
| 495 |
+
https://ffmpeg.org/ffmpeg-devices.html#Input-Devices
|
| 496 |
+
|
| 497 |
+
Please use :py:func:`~torio.utils.ffmpeg_utils.get_input_devices` to list
|
| 498 |
+
the input devices available in the current environment.
|
| 499 |
+
|
| 500 |
+
option (dict of str to str, optional):
|
| 501 |
+
Custom option passed when initializing format context (opening source).
|
| 502 |
+
|
| 503 |
+
You can use this argument to change the input source before it is passed to decoder.
|
| 504 |
+
|
| 505 |
+
Default: ``None``.
|
| 506 |
+
|
| 507 |
+
buffer_size (int):
|
| 508 |
+
The internal buffer size in byte. Used only when `src` is file-like object.
|
| 509 |
+
|
| 510 |
+
Default: `4096`.
|
| 511 |
+
"""
|
| 512 |
+
|
| 513 |
+
def __init__(
|
| 514 |
+
self,
|
| 515 |
+
src: Union[str, Path, BinaryIO],
|
| 516 |
+
format: Optional[str] = None,
|
| 517 |
+
option: Optional[Dict[str, str]] = None,
|
| 518 |
+
buffer_size: int = 4096,
|
| 519 |
+
):
|
| 520 |
+
self.src = src
|
| 521 |
+
if isinstance(src, bytes):
|
| 522 |
+
self._be = ffmpeg_ext.StreamingMediaDecoderBytes(src, format, option, buffer_size)
|
| 523 |
+
elif hasattr(src, "read"):
|
| 524 |
+
self._be = ffmpeg_ext.StreamingMediaDecoderFileObj(src, format, option, buffer_size)
|
| 525 |
+
else:
|
| 526 |
+
self._be = ffmpeg_ext.StreamingMediaDecoder(os.path.normpath(src), format, option)
|
| 527 |
+
|
| 528 |
+
i = self._be.find_best_audio_stream()
|
| 529 |
+
self._default_audio_stream = None if i < 0 else i
|
| 530 |
+
i = self._be.find_best_video_stream()
|
| 531 |
+
self._default_video_stream = None if i < 0 else i
|
| 532 |
+
|
| 533 |
+
@property
|
| 534 |
+
def num_src_streams(self):
|
| 535 |
+
"""Number of streams found in the provided media source.
|
| 536 |
+
|
| 537 |
+
:type: int
|
| 538 |
+
"""
|
| 539 |
+
return self._be.num_src_streams()
|
| 540 |
+
|
| 541 |
+
@property
|
| 542 |
+
def num_out_streams(self):
|
| 543 |
+
"""Number of output streams configured by client code.
|
| 544 |
+
|
| 545 |
+
:type: int
|
| 546 |
+
"""
|
| 547 |
+
return self._be.num_out_streams()
|
| 548 |
+
|
| 549 |
+
@property
|
| 550 |
+
def default_audio_stream(self):
|
| 551 |
+
"""The index of default audio stream. ``None`` if there is no audio stream
|
| 552 |
+
|
| 553 |
+
:type: Optional[int]
|
| 554 |
+
"""
|
| 555 |
+
return self._default_audio_stream
|
| 556 |
+
|
| 557 |
+
@property
|
| 558 |
+
def default_video_stream(self):
|
| 559 |
+
"""The index of default video stream. ``None`` if there is no video stream
|
| 560 |
+
|
| 561 |
+
:type: Optional[int]
|
| 562 |
+
"""
|
| 563 |
+
return self._default_video_stream
|
| 564 |
+
|
| 565 |
+
def get_metadata(self) -> Dict[str, str]:
|
| 566 |
+
"""Get the metadata of the source media.
|
| 567 |
+
|
| 568 |
+
Returns:
|
| 569 |
+
dict
|
| 570 |
+
"""
|
| 571 |
+
return self._be.get_metadata()
|
| 572 |
+
|
| 573 |
+
def get_src_stream_info(self, i: int) -> InputStreamTypes:
|
| 574 |
+
"""Get the metadata of source stream
|
| 575 |
+
|
| 576 |
+
Args:
|
| 577 |
+
i (int): Stream index.
|
| 578 |
+
Returns:
|
| 579 |
+
InputStreamTypes:
|
| 580 |
+
Information about the source stream.
|
| 581 |
+
If the source stream is audio type, then
|
| 582 |
+
:class:`~torio.io._stream_reader.SourceAudioStream` is returned.
|
| 583 |
+
If it is video type, then
|
| 584 |
+
:class:`~torio.io._stream_reader.SourceVideoStream` is returned.
|
| 585 |
+
Otherwise :class:`~torio.io._stream_reader.SourceStream` class is returned.
|
| 586 |
+
"""
|
| 587 |
+
return _parse_si(self._be.get_src_stream_info(i))
|
| 588 |
+
|
| 589 |
+
def get_out_stream_info(self, i: int) -> OutputStreamTypes:
|
| 590 |
+
"""Get the metadata of output stream
|
| 591 |
+
|
| 592 |
+
Args:
|
| 593 |
+
i (int): Stream index.
|
| 594 |
+
Returns:
|
| 595 |
+
OutputStreamTypes
|
| 596 |
+
Information about the output stream.
|
| 597 |
+
If the output stream is audio type, then
|
| 598 |
+
:class:`~torio.io._stream_reader.OutputAudioStream` is returned.
|
| 599 |
+
If it is video type, then
|
| 600 |
+
:class:`~torio.io._stream_reader.OutputVideoStream` is returned.
|
| 601 |
+
"""
|
| 602 |
+
info = self._be.get_out_stream_info(i)
|
| 603 |
+
return _parse_oi(info)
|
| 604 |
+
|
| 605 |
+
def seek(self, timestamp: float, mode: str = "precise"):
|
| 606 |
+
"""Seek the stream to the given timestamp [second]
|
| 607 |
+
|
| 608 |
+
Args:
|
| 609 |
+
timestamp (float): Target time in second.
|
| 610 |
+
mode (str): Controls how seek is done.
|
| 611 |
+
Valid choices are;
|
| 612 |
+
|
| 613 |
+
* "key": Seek into the nearest key frame before the given timestamp.
|
| 614 |
+
* "any": Seek into any frame (including non-key frames) before the given timestamp.
|
| 615 |
+
* "precise": First seek into the nearest key frame before the given timestamp, then
|
| 616 |
+
decode frames until it reaches the closes frame to the given timestamp.
|
| 617 |
+
|
| 618 |
+
Note:
|
| 619 |
+
All the modes invalidate and reset the internal state of decoder.
|
| 620 |
+
When using "any" mode and if it ends up seeking into non-key frame,
|
| 621 |
+
the image decoded may be invalid due to lack of key frame.
|
| 622 |
+
Using "precise" will workaround this issue by decoding frames from previous
|
| 623 |
+
key frame, but will be slower.
|
| 624 |
+
"""
|
| 625 |
+
modes = {
|
| 626 |
+
"key": 0,
|
| 627 |
+
"any": 1,
|
| 628 |
+
"precise": 2,
|
| 629 |
+
}
|
| 630 |
+
if mode not in modes:
|
| 631 |
+
raise ValueError(f"The value of mode must be one of {list(modes.keys())}. Found: {mode}")
|
| 632 |
+
self._be.seek(timestamp, modes[mode])
|
| 633 |
+
|
| 634 |
+
@_format_audio_args
|
| 635 |
+
def add_basic_audio_stream(
|
| 636 |
+
self,
|
| 637 |
+
frames_per_chunk: int,
|
| 638 |
+
buffer_chunk_size: int = 3,
|
| 639 |
+
*,
|
| 640 |
+
stream_index: Optional[int] = None,
|
| 641 |
+
decoder: Optional[str] = None,
|
| 642 |
+
decoder_option: Optional[Dict[str, str]] = None,
|
| 643 |
+
format: Optional[str] = "fltp",
|
| 644 |
+
sample_rate: Optional[int] = None,
|
| 645 |
+
num_channels: Optional[int] = None,
|
| 646 |
+
):
|
| 647 |
+
"""Add output audio stream
|
| 648 |
+
|
| 649 |
+
Args:
|
| 650 |
+
frames_per_chunk (int): {frames_per_chunk}
|
| 651 |
+
|
| 652 |
+
buffer_chunk_size (int, optional): {buffer_chunk_size}
|
| 653 |
+
|
| 654 |
+
stream_index (int or None, optional): {stream_index}
|
| 655 |
+
|
| 656 |
+
decoder (str or None, optional): {decoder}
|
| 657 |
+
|
| 658 |
+
decoder_option (dict or None, optional): {decoder_option}
|
| 659 |
+
|
| 660 |
+
format (str, optional): Output sample format (precision).
|
| 661 |
+
|
| 662 |
+
If ``None``, the output chunk has dtype corresponding to
|
| 663 |
+
the precision of the source audio.
|
| 664 |
+
|
| 665 |
+
Otherwise, the sample is converted and the output dtype is changed
|
| 666 |
+
as following.
|
| 667 |
+
|
| 668 |
+
- ``"u8p"``: The output is ``torch.uint8`` type.
|
| 669 |
+
- ``"s16p"``: The output is ``torch.int16`` type.
|
| 670 |
+
- ``"s32p"``: The output is ``torch.int32`` type.
|
| 671 |
+
- ``"s64p"``: The output is ``torch.int64`` type.
|
| 672 |
+
- ``"fltp"``: The output is ``torch.float32`` type.
|
| 673 |
+
- ``"dblp"``: The output is ``torch.float64`` type.
|
| 674 |
+
|
| 675 |
+
Default: ``"fltp"``.
|
| 676 |
+
|
| 677 |
+
sample_rate (int or None, optional): If provided, resample the audio.
|
| 678 |
+
|
| 679 |
+
num_channels (int, or None, optional): If provided, change the number of channels.
|
| 680 |
+
"""
|
| 681 |
+
self.add_audio_stream(
|
| 682 |
+
frames_per_chunk,
|
| 683 |
+
buffer_chunk_size,
|
| 684 |
+
stream_index=stream_index,
|
| 685 |
+
decoder=decoder,
|
| 686 |
+
decoder_option=decoder_option,
|
| 687 |
+
filter_desc=_get_afilter_desc(sample_rate, format, num_channels),
|
| 688 |
+
)
|
| 689 |
+
|
| 690 |
+
@_format_video_args
|
| 691 |
+
def add_basic_video_stream(
|
| 692 |
+
self,
|
| 693 |
+
frames_per_chunk: int,
|
| 694 |
+
buffer_chunk_size: int = 3,
|
| 695 |
+
*,
|
| 696 |
+
stream_index: Optional[int] = None,
|
| 697 |
+
decoder: Optional[str] = None,
|
| 698 |
+
decoder_option: Optional[Dict[str, str]] = None,
|
| 699 |
+
format: Optional[str] = "rgb24",
|
| 700 |
+
frame_rate: Optional[int] = None,
|
| 701 |
+
width: Optional[int] = None,
|
| 702 |
+
height: Optional[int] = None,
|
| 703 |
+
hw_accel: Optional[str] = None,
|
| 704 |
+
):
|
| 705 |
+
"""Add output video stream
|
| 706 |
+
|
| 707 |
+
Args:
|
| 708 |
+
frames_per_chunk (int): {frames_per_chunk}
|
| 709 |
+
|
| 710 |
+
buffer_chunk_size (int, optional): {buffer_chunk_size}
|
| 711 |
+
|
| 712 |
+
stream_index (int or None, optional): {stream_index}
|
| 713 |
+
|
| 714 |
+
decoder (str or None, optional): {decoder}
|
| 715 |
+
|
| 716 |
+
decoder_option (dict or None, optional): {decoder_option}
|
| 717 |
+
|
| 718 |
+
format (str, optional): Change the format of image channels. Valid values are,
|
| 719 |
+
|
| 720 |
+
- ``"rgb24"``: 8 bits * 3 channels (R, G, B)
|
| 721 |
+
- ``"bgr24"``: 8 bits * 3 channels (B, G, R)
|
| 722 |
+
- ``"yuv420p"``: 8 bits * 3 channels (Y, U, V)
|
| 723 |
+
- ``"gray"``: 8 bits * 1 channels
|
| 724 |
+
|
| 725 |
+
Default: ``"rgb24"``.
|
| 726 |
+
|
| 727 |
+
frame_rate (int or None, optional): If provided, change the frame rate.
|
| 728 |
+
|
| 729 |
+
width (int or None, optional): If provided, change the image width. Unit: Pixel.
|
| 730 |
+
|
| 731 |
+
height (int or None, optional): If provided, change the image height. Unit: Pixel.
|
| 732 |
+
|
| 733 |
+
hw_accel (str or None, optional): {hw_accel}
|
| 734 |
+
"""
|
| 735 |
+
self.add_video_stream(
|
| 736 |
+
frames_per_chunk,
|
| 737 |
+
buffer_chunk_size,
|
| 738 |
+
stream_index=stream_index,
|
| 739 |
+
decoder=decoder,
|
| 740 |
+
decoder_option=decoder_option,
|
| 741 |
+
filter_desc=_get_vfilter_desc(frame_rate, width, height, format),
|
| 742 |
+
hw_accel=hw_accel,
|
| 743 |
+
)
|
| 744 |
+
|
| 745 |
+
@_format_audio_args
|
| 746 |
+
def add_audio_stream(
|
| 747 |
+
self,
|
| 748 |
+
frames_per_chunk: int,
|
| 749 |
+
buffer_chunk_size: int = 3,
|
| 750 |
+
*,
|
| 751 |
+
stream_index: Optional[int] = None,
|
| 752 |
+
decoder: Optional[str] = None,
|
| 753 |
+
decoder_option: Optional[Dict[str, str]] = None,
|
| 754 |
+
filter_desc: Optional[str] = None,
|
| 755 |
+
):
|
| 756 |
+
"""Add output audio stream
|
| 757 |
+
|
| 758 |
+
Args:
|
| 759 |
+
frames_per_chunk (int): {frames_per_chunk}
|
| 760 |
+
|
| 761 |
+
buffer_chunk_size (int, optional): {buffer_chunk_size}
|
| 762 |
+
|
| 763 |
+
stream_index (int or None, optional): {stream_index}
|
| 764 |
+
|
| 765 |
+
decoder (str or None, optional): {decoder}
|
| 766 |
+
|
| 767 |
+
decoder_option (dict or None, optional): {decoder_option}
|
| 768 |
+
|
| 769 |
+
filter_desc (str or None, optional): Filter description.
|
| 770 |
+
The list of available filters can be found at
|
| 771 |
+
https://ffmpeg.org/ffmpeg-filters.html
|
| 772 |
+
Note that complex filters are not supported.
|
| 773 |
+
|
| 774 |
+
"""
|
| 775 |
+
i = self.default_audio_stream if stream_index is None else stream_index
|
| 776 |
+
if i is None:
|
| 777 |
+
raise RuntimeError("There is no audio stream.")
|
| 778 |
+
self._be.add_audio_stream(
|
| 779 |
+
i,
|
| 780 |
+
frames_per_chunk,
|
| 781 |
+
buffer_chunk_size,
|
| 782 |
+
filter_desc,
|
| 783 |
+
decoder,
|
| 784 |
+
decoder_option or {},
|
| 785 |
+
)
|
| 786 |
+
|
| 787 |
+
@_format_video_args
|
| 788 |
+
def add_video_stream(
|
| 789 |
+
self,
|
| 790 |
+
frames_per_chunk: int,
|
| 791 |
+
buffer_chunk_size: int = 3,
|
| 792 |
+
*,
|
| 793 |
+
stream_index: Optional[int] = None,
|
| 794 |
+
decoder: Optional[str] = None,
|
| 795 |
+
decoder_option: Optional[Dict[str, str]] = None,
|
| 796 |
+
filter_desc: Optional[str] = None,
|
| 797 |
+
hw_accel: Optional[str] = None,
|
| 798 |
+
):
|
| 799 |
+
"""Add output video stream
|
| 800 |
+
|
| 801 |
+
Args:
|
| 802 |
+
frames_per_chunk (int): {frames_per_chunk}
|
| 803 |
+
|
| 804 |
+
buffer_chunk_size (int, optional): {buffer_chunk_size}
|
| 805 |
+
|
| 806 |
+
stream_index (int or None, optional): {stream_index}
|
| 807 |
+
|
| 808 |
+
decoder (str or None, optional): {decoder}
|
| 809 |
+
|
| 810 |
+
decoder_option (dict or None, optional): {decoder_option}
|
| 811 |
+
|
| 812 |
+
hw_accel (str or None, optional): {hw_accel}
|
| 813 |
+
|
| 814 |
+
filter_desc (str or None, optional): Filter description.
|
| 815 |
+
The list of available filters can be found at
|
| 816 |
+
https://ffmpeg.org/ffmpeg-filters.html
|
| 817 |
+
Note that complex filters are not supported.
|
| 818 |
+
"""
|
| 819 |
+
i = self.default_video_stream if stream_index is None else stream_index
|
| 820 |
+
if i is None:
|
| 821 |
+
raise RuntimeError("There is no video stream.")
|
| 822 |
+
self._be.add_video_stream(
|
| 823 |
+
i,
|
| 824 |
+
frames_per_chunk,
|
| 825 |
+
buffer_chunk_size,
|
| 826 |
+
filter_desc,
|
| 827 |
+
decoder,
|
| 828 |
+
decoder_option or {},
|
| 829 |
+
hw_accel,
|
| 830 |
+
)
|
| 831 |
+
|
| 832 |
+
def remove_stream(self, i: int):
|
| 833 |
+
"""Remove an output stream.
|
| 834 |
+
|
| 835 |
+
Args:
|
| 836 |
+
i (int): Index of the output stream to be removed.
|
| 837 |
+
"""
|
| 838 |
+
self._be.remove_stream(i)
|
| 839 |
+
|
| 840 |
+
def process_packet(self, timeout: Optional[float] = None, backoff: float = 10.0) -> int:
|
| 841 |
+
"""Read the source media and process one packet.
|
| 842 |
+
|
| 843 |
+
If a packet is read successfully, then the data in the packet will
|
| 844 |
+
be decoded and passed to corresponding output stream processors.
|
| 845 |
+
|
| 846 |
+
If the packet belongs to a source stream that is not connected to
|
| 847 |
+
an output stream, then the data are discarded.
|
| 848 |
+
|
| 849 |
+
When the source reaches EOF, then it triggers all the output stream
|
| 850 |
+
processors to enter drain mode. All the output stream processors
|
| 851 |
+
flush the pending frames.
|
| 852 |
+
|
| 853 |
+
Args:
|
| 854 |
+
timeout (float or None, optional): Timeout in milli seconds.
|
| 855 |
+
|
| 856 |
+
This argument changes the retry behavior when it failed to
|
| 857 |
+
process a packet due to the underlying media resource being
|
| 858 |
+
temporarily unavailable.
|
| 859 |
+
|
| 860 |
+
When using a media device such as a microphone, there are cases
|
| 861 |
+
where the underlying buffer is not ready.
|
| 862 |
+
Calling this function in such case would cause the system to report
|
| 863 |
+
`EAGAIN (resource temporarily unavailable)`.
|
| 864 |
+
|
| 865 |
+
* ``>=0``: Keep retrying until the given time passes.
|
| 866 |
+
|
| 867 |
+
* ``0<``: Keep retrying forever.
|
| 868 |
+
|
| 869 |
+
* ``None`` : No retrying and raise an exception immediately.
|
| 870 |
+
|
| 871 |
+
Default: ``None``.
|
| 872 |
+
|
| 873 |
+
Note:
|
| 874 |
+
|
| 875 |
+
The retry behavior is applicable only when the reason is the
|
| 876 |
+
unavailable resource. It is not invoked if the reason of failure is
|
| 877 |
+
other.
|
| 878 |
+
|
| 879 |
+
backoff (float, optional): Time to wait before retrying in milli seconds.
|
| 880 |
+
|
| 881 |
+
This option is effective only when `timeout` is effective. (not ``None``)
|
| 882 |
+
|
| 883 |
+
When `timeout` is effective, this `backoff` controls how long the function
|
| 884 |
+
should wait before retrying. Default: ``10.0``.
|
| 885 |
+
|
| 886 |
+
Returns:
|
| 887 |
+
int:
|
| 888 |
+
``0``
|
| 889 |
+
A packet was processed properly. The caller can keep
|
| 890 |
+
calling this function to buffer more frames.
|
| 891 |
+
|
| 892 |
+
``1``
|
| 893 |
+
The streamer reached EOF. All the output stream processors
|
| 894 |
+
flushed the pending frames. The caller should stop calling
|
| 895 |
+
this method.
|
| 896 |
+
"""
|
| 897 |
+
return self._be.process_packet(timeout, backoff)
|
| 898 |
+
|
| 899 |
+
def process_all_packets(self):
|
| 900 |
+
"""Process packets until it reaches EOF."""
|
| 901 |
+
self._be.process_all_packets()
|
| 902 |
+
|
| 903 |
+
def is_buffer_ready(self) -> bool:
|
| 904 |
+
"""Returns true if all the output streams have at least one chunk filled."""
|
| 905 |
+
return self._be.is_buffer_ready()
|
| 906 |
+
|
| 907 |
+
def pop_chunks(self) -> Tuple[Optional[ChunkTensor]]:
|
| 908 |
+
"""Pop one chunk from all the output stream buffers.
|
| 909 |
+
|
| 910 |
+
Returns:
|
| 911 |
+
Tuple[Optional[ChunkTensor]]:
|
| 912 |
+
Buffer contents.
|
| 913 |
+
If a buffer does not contain any frame, then `None` is returned instead.
|
| 914 |
+
"""
|
| 915 |
+
ret = []
|
| 916 |
+
for chunk in self._be.pop_chunks():
|
| 917 |
+
if chunk is None:
|
| 918 |
+
ret.append(None)
|
| 919 |
+
else:
|
| 920 |
+
ret.append(ChunkTensor(chunk.frames, chunk.pts))
|
| 921 |
+
return ret
|
| 922 |
+
|
| 923 |
+
def fill_buffer(self, timeout: Optional[float] = None, backoff: float = 10.0) -> int:
|
| 924 |
+
"""Keep processing packets until all buffers have at least one chunk
|
| 925 |
+
|
| 926 |
+
Arguments:
|
| 927 |
+
timeout (float or None, optional): See
|
| 928 |
+
:py:func:`~StreamingMediaDecoder.process_packet`. (Default: ``None``)
|
| 929 |
+
|
| 930 |
+
backoff (float, optional): See
|
| 931 |
+
:py:func:`~StreamingMediaDecoder.process_packet`. (Default: ``10.0``)
|
| 932 |
+
|
| 933 |
+
Returns:
|
| 934 |
+
int:
|
| 935 |
+
``0``
|
| 936 |
+
Packets are processed properly and buffers are
|
| 937 |
+
ready to be popped once.
|
| 938 |
+
|
| 939 |
+
``1``
|
| 940 |
+
The streamer reached EOF. All the output stream processors
|
| 941 |
+
flushed the pending frames. The caller should stop calling
|
| 942 |
+
this method.
|
| 943 |
+
"""
|
| 944 |
+
return self._be.fill_buffer(timeout, backoff)
|
| 945 |
+
|
| 946 |
+
def stream(
|
| 947 |
+
self, timeout: Optional[float] = None, backoff: float = 10.0
|
| 948 |
+
) -> Iterator[Tuple[Optional[ChunkTensor], ...]]:
|
| 949 |
+
"""Return an iterator that generates output tensors
|
| 950 |
+
|
| 951 |
+
Arguments:
|
| 952 |
+
timeout (float or None, optional): See
|
| 953 |
+
:py:func:`~StreamingMediaDecoder.process_packet`. (Default: ``None``)
|
| 954 |
+
|
| 955 |
+
backoff (float, optional): See
|
| 956 |
+
:py:func:`~StreamingMediaDecoder.process_packet`. (Default: ``10.0``)
|
| 957 |
+
|
| 958 |
+
Returns:
|
| 959 |
+
Iterator[Tuple[Optional[ChunkTensor], ...]]:
|
| 960 |
+
Iterator that yields a tuple of chunks that correspond to the output
|
| 961 |
+
streams defined by client code.
|
| 962 |
+
If an output stream is exhausted, then the chunk Tensor is substituted
|
| 963 |
+
with ``None``.
|
| 964 |
+
The iterator stops if all the output streams are exhausted.
|
| 965 |
+
"""
|
| 966 |
+
if self.num_out_streams == 0:
|
| 967 |
+
raise RuntimeError("No output stream is configured.")
|
| 968 |
+
|
| 969 |
+
while True:
|
| 970 |
+
if self.fill_buffer(timeout, backoff):
|
| 971 |
+
break
|
| 972 |
+
yield self.pop_chunks()
|
| 973 |
+
|
| 974 |
+
while True:
|
| 975 |
+
chunks = self.pop_chunks()
|
| 976 |
+
if all(c is None for c in chunks):
|
| 977 |
+
return
|
| 978 |
+
yield chunks
|
vllm/lib/python3.10/site-packages/torio/io/_streaming_media_enc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2 |
+
from pathlib import Path
|
| 3 |
+
from typing import BinaryIO, Dict, Optional, Union
|
| 4 |
+
|
| 5 |
+
import torch
|
| 6 |
+
import torio
|
| 7 |
+
|
| 8 |
+
ffmpeg_ext = torio._extension.lazy_import_ffmpeg_ext()
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
@dataclass
|
| 12 |
+
class CodecConfig:
|
| 13 |
+
"""Codec configuration."""
|
| 14 |
+
|
| 15 |
+
bit_rate: int = -1
|
| 16 |
+
"""Bit rate"""
|
| 17 |
+
|
| 18 |
+
compression_level: int = -1
|
| 19 |
+
"""Compression level"""
|
| 20 |
+
|
| 21 |
+
qscale: Optional[int] = None
|
| 22 |
+
"""Global quality factor. Enables variable bit rate. Valid values depend on encoder.
|
| 23 |
+
|
| 24 |
+
For example: MP3 takes ``0`` - ``9`` (https://trac.ffmpeg.org/wiki/Encode/MP3) while
|
| 25 |
+
libvorbis takes ``-1`` - ``10``.
|
| 26 |
+
"""
|
| 27 |
+
|
| 28 |
+
gop_size: int = -1
|
| 29 |
+
"""The number of pictures in a group of pictures, or 0 for intra_only"""
|
| 30 |
+
|
| 31 |
+
max_b_frames: int = -1
|
| 32 |
+
"""maximum number of B-frames between non-B-frames."""
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def _convert_config(cfg: CodecConfig):
|
| 36 |
+
if cfg is None:
|
| 37 |
+
return None
|
| 38 |
+
# Convert the codecconfig to C++ compatible type.
|
| 39 |
+
# omitting the return type annotation so as not to access ffmpeg_ext here.
|
| 40 |
+
return ffmpeg_ext.CodecConfig(
|
| 41 |
+
cfg.bit_rate,
|
| 42 |
+
cfg.compression_level,
|
| 43 |
+
cfg.qscale,
|
| 44 |
+
cfg.gop_size,
|
| 45 |
+
cfg.max_b_frames,
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
def _format_doc(**kwargs):
|
| 50 |
+
def decorator(obj):
|
| 51 |
+
obj.__doc__ = obj.__doc__.format(**kwargs)
|
| 52 |
+
return obj
|
| 53 |
+
|
| 54 |
+
return decorator
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
_encoder = """The name of the encoder to be used.
|
| 58 |
+
When provided, use the specified encoder instead of the default one.
|
| 59 |
+
|
| 60 |
+
To list the available encoders, please use
|
| 61 |
+
:py:func:`~torio.utils.ffmpeg_utils.get_audio_encoders` for audio, and
|
| 62 |
+
:py:func:`~torio.utils.ffmpeg_utils.get_video_encoders` for video.
|
| 63 |
+
|
| 64 |
+
Default: ``None``."""
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
_encoder_option = """Options passed to encoder.
|
| 68 |
+
Mapping from str to str.
|
| 69 |
+
|
| 70 |
+
To list encoder options for a encoder, you can use
|
| 71 |
+
``ffmpeg -h encoder=<ENCODER>`` command.
|
| 72 |
+
|
| 73 |
+
Default: ``None``.
|
| 74 |
+
|
| 75 |
+
|
|
| 76 |
+
|
| 77 |
+
In addition to encoder-specific options, you can also pass options related
|
| 78 |
+
to multithreading. They are effective only if the encoder support them.
|
| 79 |
+
If neither of them are provided, StreamReader defaults to single thread.
|
| 80 |
+
|
| 81 |
+
``"threads"``: The number of threads (in str).
|
| 82 |
+
Providing the value ``"0"`` will let FFmpeg decides based on its heuristics.
|
| 83 |
+
|
| 84 |
+
``"thread_type"``: Which multithreading method to use.
|
| 85 |
+
The valid values are ``"frame"`` or ``"slice"``.
|
| 86 |
+
Note that each encoder supports different set of methods.
|
| 87 |
+
If not provided, a default value is used.
|
| 88 |
+
|
| 89 |
+
- ``"frame"``: Encode more than one frame at once.
|
| 90 |
+
Each thread handles one frame.
|
| 91 |
+
This will increase decoding delay by one frame per thread
|
| 92 |
+
- ``"slice"``: Encode more than one part of a single frame at once.
|
| 93 |
+
|
| 94 |
+
|
|
| 95 |
+
"""
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
_encoder_format = """Format used to encode media.
|
| 99 |
+
When encoder supports multiple formats, passing this argument will override
|
| 100 |
+
the format used for encoding.
|
| 101 |
+
|
| 102 |
+
To list supported formats for the encoder, you can use
|
| 103 |
+
``ffmpeg -h encoder=<ENCODER>`` command.
|
| 104 |
+
|
| 105 |
+
Default: ``None``.
|
| 106 |
+
|
| 107 |
+
Note:
|
| 108 |
+
When ``encoder_format`` option is not provided, encoder uses its default format.
|
| 109 |
+
|
| 110 |
+
For example, when encoding audio into wav format, 16-bit signed integer is used,
|
| 111 |
+
and when encoding video into mp4 format (h264 encoder), one of YUV format is used.
|
| 112 |
+
|
| 113 |
+
This is because typically, 32-bit or 16-bit floating point is used in audio models but
|
| 114 |
+
they are not commonly used in audio formats. Similarly, RGB24 is commonly used in vision
|
| 115 |
+
models, but video formats usually (and better) support YUV formats.
|
| 116 |
+
"""
|
| 117 |
+
|
| 118 |
+
_codec_config = """Codec configuration. Please refer to :py:class:`CodecConfig` for
|
| 119 |
+
configuration options.
|
| 120 |
+
|
| 121 |
+
Default: ``None``."""
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
_filter_desc = """Additional processing to apply before encoding the input media.
|
| 125 |
+
"""
|
| 126 |
+
|
| 127 |
+
_format_common_args = _format_doc(
|
| 128 |
+
encoder=_encoder,
|
| 129 |
+
encoder_option=_encoder_option,
|
| 130 |
+
encoder_format=_encoder_format,
|
| 131 |
+
codec_config=_codec_config,
|
| 132 |
+
filter_desc=_filter_desc,
|
| 133 |
+
)
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
class StreamingMediaEncoder:
|
| 137 |
+
"""Encode and write audio/video streams chunk by chunk
|
| 138 |
+
|
| 139 |
+
Args:
|
| 140 |
+
dst (str, path-like or file-like object): The destination where the encoded data are written.
|
| 141 |
+
If string-type, it must be a resource indicator that FFmpeg can
|
| 142 |
+
handle. The supported value depends on the FFmpeg found in the system.
|
| 143 |
+
|
| 144 |
+
If file-like object, it must support `write` method with the signature
|
| 145 |
+
`write(data: bytes) -> int`.
|
| 146 |
+
|
| 147 |
+
Please refer to the following for the expected signature and behavior of
|
| 148 |
+
`write` method.
|
| 149 |
+
|
| 150 |
+
- https://docs.python.org/3/library/io.html#io.BufferedIOBase.write
|
| 151 |
+
|
| 152 |
+
format (str or None, optional):
|
| 153 |
+
Override the output format, or specify the output media device.
|
| 154 |
+
Default: ``None`` (no override nor device output).
|
| 155 |
+
|
| 156 |
+
This argument serves two different use cases.
|
| 157 |
+
|
| 158 |
+
1) Override the output format.
|
| 159 |
+
This is useful when writing raw data or in a format different from the extension.
|
| 160 |
+
|
| 161 |
+
2) Specify the output device.
|
| 162 |
+
This allows to output media streams to hardware devices,
|
| 163 |
+
such as speaker and video screen.
|
| 164 |
+
|
| 165 |
+
.. note::
|
| 166 |
+
|
| 167 |
+
This option roughly corresponds to ``-f`` option of ``ffmpeg`` command.
|
| 168 |
+
Please refer to the ffmpeg documentations for possible values.
|
| 169 |
+
|
| 170 |
+
https://ffmpeg.org/ffmpeg-formats.html#Muxers
|
| 171 |
+
|
| 172 |
+
Please use :py:func:`~torio.utils.ffmpeg_utils.get_muxers` to list the
|
| 173 |
+
multiplexers available in the current environment.
|
| 174 |
+
|
| 175 |
+
For device access, the available values vary based on hardware (AV device) and
|
| 176 |
+
software configuration (ffmpeg build).
|
| 177 |
+
Please refer to the ffmpeg documentations for possible values.
|
| 178 |
+
|
| 179 |
+
https://ffmpeg.org/ffmpeg-devices.html#Output-Devices
|
| 180 |
+
|
| 181 |
+
Please use :py:func:`~torio.utils.ffmpeg_utils.get_output_devices` to list
|
| 182 |
+
the output devices available in the current environment.
|
| 183 |
+
|
| 184 |
+
buffer_size (int):
|
| 185 |
+
The internal buffer size in byte. Used only when `dst` is a file-like object.
|
| 186 |
+
|
| 187 |
+
Default: `4096`.
|
| 188 |
+
"""
|
| 189 |
+
|
| 190 |
+
def __init__(
|
| 191 |
+
self,
|
| 192 |
+
dst: Union[str, Path, BinaryIO],
|
| 193 |
+
format: Optional[str] = None,
|
| 194 |
+
buffer_size: int = 4096,
|
| 195 |
+
):
|
| 196 |
+
if hasattr(dst, "write"):
|
| 197 |
+
self._s = ffmpeg_ext.StreamingMediaEncoderFileObj(dst, format, buffer_size)
|
| 198 |
+
else:
|
| 199 |
+
self._s = ffmpeg_ext.StreamingMediaEncoder(str(dst), format)
|
| 200 |
+
self._is_open = False
|
| 201 |
+
|
| 202 |
+
@_format_common_args
|
| 203 |
+
def add_audio_stream(
|
| 204 |
+
self,
|
| 205 |
+
sample_rate: int,
|
| 206 |
+
num_channels: int,
|
| 207 |
+
format: str = "flt",
|
| 208 |
+
*,
|
| 209 |
+
encoder: Optional[str] = None,
|
| 210 |
+
encoder_option: Optional[Dict[str, str]] = None,
|
| 211 |
+
encoder_sample_rate: Optional[int] = None,
|
| 212 |
+
encoder_num_channels: Optional[int] = None,
|
| 213 |
+
encoder_format: Optional[str] = None,
|
| 214 |
+
codec_config: Optional[CodecConfig] = None,
|
| 215 |
+
filter_desc: Optional[str] = None,
|
| 216 |
+
):
|
| 217 |
+
"""Add an output audio stream.
|
| 218 |
+
|
| 219 |
+
Args:
|
| 220 |
+
sample_rate (int): The sample rate.
|
| 221 |
+
|
| 222 |
+
num_channels (int): The number of channels.
|
| 223 |
+
|
| 224 |
+
format (str, optional): Input sample format, which determines the dtype
|
| 225 |
+
of the input tensor.
|
| 226 |
+
|
| 227 |
+
- ``"u8"``: The input tensor must be ``torch.uint8`` type.
|
| 228 |
+
- ``"s16"``: The input tensor must be ``torch.int16`` type.
|
| 229 |
+
- ``"s32"``: The input tensor must be ``torch.int32`` type.
|
| 230 |
+
- ``"s64"``: The input tensor must be ``torch.int64`` type.
|
| 231 |
+
- ``"flt"``: The input tensor must be ``torch.float32`` type.
|
| 232 |
+
- ``"dbl"``: The input tensor must be ``torch.float64`` type.
|
| 233 |
+
|
| 234 |
+
Default: ``"flt"``.
|
| 235 |
+
|
| 236 |
+
encoder (str or None, optional): {encoder}
|
| 237 |
+
|
| 238 |
+
encoder_option (dict or None, optional): {encoder_option}
|
| 239 |
+
|
| 240 |
+
encoder_sample_rate (int or None, optional): Override the sample rate used for encoding time.
|
| 241 |
+
Some encoders pose restriction on the sample rate used for encoding.
|
| 242 |
+
If the source sample rate is not supported by the encoder, the source sample rate is used,
|
| 243 |
+
otherwise a default one is picked.
|
| 244 |
+
|
| 245 |
+
For example, ``"opus"`` encoder only supports 48k Hz, so, when encoding a
|
| 246 |
+
waveform with ``"opus"`` encoder, it is always encoded as 48k Hz.
|
| 247 |
+
Meanwhile ``"mp3"`` (``"libmp3lame"``) supports 44.1k, 48k, 32k, 22.05k,
|
| 248 |
+
24k, 16k, 11.025k, 12k and 8k Hz.
|
| 249 |
+
If the original sample rate is one of these, then the original sample rate
|
| 250 |
+
is used, otherwise it will be resampled to a default one (44.1k).
|
| 251 |
+
When encoding into WAV format, there is no restriction on sample rate,
|
| 252 |
+
so the original sample rate will be used.
|
| 253 |
+
|
| 254 |
+
Providing ``encoder_sample_rate`` will override this behavior and
|
| 255 |
+
make encoder attempt to use the provided sample rate.
|
| 256 |
+
The provided value must be one support by the encoder.
|
| 257 |
+
|
| 258 |
+
encoder_num_channels (int or None, optional): Override the number of channels used for encoding.
|
| 259 |
+
|
| 260 |
+
Similar to sample rate, some encoders (such as ``"opus"``,
|
| 261 |
+
``"vorbis"`` and ``"g722"``) pose restriction on
|
| 262 |
+
the numbe of channels that can be used for encoding.
|
| 263 |
+
|
| 264 |
+
If the original number of channels is supported by encoder,
|
| 265 |
+
then it will be used, otherwise, the encoder attempts to
|
| 266 |
+
remix the channel to one of the supported ones.
|
| 267 |
+
|
| 268 |
+
Providing ``encoder_num_channels`` will override this behavior and
|
| 269 |
+
make encoder attempt to use the provided number of channels.
|
| 270 |
+
The provided value must be one support by the encoder.
|
| 271 |
+
|
| 272 |
+
encoder_format (str or None, optional): {encoder_format}
|
| 273 |
+
|
| 274 |
+
codec_config (CodecConfig or None, optional): {codec_config}
|
| 275 |
+
|
| 276 |
+
filter_desc (str or None, optional): {filter_desc}
|
| 277 |
+
"""
|
| 278 |
+
self._s.add_audio_stream(
|
| 279 |
+
sample_rate,
|
| 280 |
+
num_channels,
|
| 281 |
+
format,
|
| 282 |
+
encoder,
|
| 283 |
+
encoder_option,
|
| 284 |
+
encoder_format,
|
| 285 |
+
encoder_sample_rate,
|
| 286 |
+
encoder_num_channels,
|
| 287 |
+
_convert_config(codec_config),
|
| 288 |
+
filter_desc,
|
| 289 |
+
)
|
| 290 |
+
|
| 291 |
+
@_format_common_args
|
| 292 |
+
def add_video_stream(
|
| 293 |
+
self,
|
| 294 |
+
frame_rate: float,
|
| 295 |
+
width: int,
|
| 296 |
+
height: int,
|
| 297 |
+
format: str = "rgb24",
|
| 298 |
+
*,
|
| 299 |
+
encoder: Optional[str] = None,
|
| 300 |
+
encoder_option: Optional[Dict[str, str]] = None,
|
| 301 |
+
encoder_frame_rate: Optional[float] = None,
|
| 302 |
+
encoder_width: Optional[int] = None,
|
| 303 |
+
encoder_height: Optional[int] = None,
|
| 304 |
+
encoder_format: Optional[str] = None,
|
| 305 |
+
codec_config: Optional[CodecConfig] = None,
|
| 306 |
+
filter_desc: Optional[str] = None,
|
| 307 |
+
hw_accel: Optional[str] = None,
|
| 308 |
+
):
|
| 309 |
+
"""Add an output video stream.
|
| 310 |
+
|
| 311 |
+
This method has to be called before `open` is called.
|
| 312 |
+
|
| 313 |
+
Args:
|
| 314 |
+
frame_rate (float): Frame rate of the video.
|
| 315 |
+
|
| 316 |
+
width (int): Width of the video frame.
|
| 317 |
+
|
| 318 |
+
height (int): Height of the video frame.
|
| 319 |
+
|
| 320 |
+
format (str, optional): Input pixel format, which determines the
|
| 321 |
+
color channel order of the input tensor.
|
| 322 |
+
|
| 323 |
+
- ``"gray8"``: One channel, grayscale.
|
| 324 |
+
- ``"rgb24"``: Three channels in the order of RGB.
|
| 325 |
+
- ``"bgr24"``: Three channels in the order of BGR.
|
| 326 |
+
- ``"yuv444p"``: Three channels in the order of YUV.
|
| 327 |
+
|
| 328 |
+
Default: ``"rgb24"``.
|
| 329 |
+
|
| 330 |
+
In either case, the input tensor has to be ``torch.uint8`` type and
|
| 331 |
+
the shape must be (frame, channel, height, width).
|
| 332 |
+
|
| 333 |
+
encoder (str or None, optional): {encoder}
|
| 334 |
+
|
| 335 |
+
encoder_option (dict or None, optional): {encoder_option}
|
| 336 |
+
|
| 337 |
+
encoder_frame_rate (float or None, optional): Override the frame rate used for encoding.
|
| 338 |
+
|
| 339 |
+
Some encoders, (such as ``"mpeg1"`` and ``"mpeg2"``) pose restriction on the
|
| 340 |
+
frame rate that can be used for encoding.
|
| 341 |
+
If such case, if the source frame rate (provided as ``frame_rate``) is not
|
| 342 |
+
one of the supported frame rate, then a default one is picked, and the frame rate
|
| 343 |
+
is changed on-the-fly. Otherwise the source frame rate is used.
|
| 344 |
+
|
| 345 |
+
Providing ``encoder_frame_rate`` will override this behavior and
|
| 346 |
+
make encoder attempts to use the provided sample rate.
|
| 347 |
+
The provided value must be one support by the encoder.
|
| 348 |
+
|
| 349 |
+
encoder_width (int or None, optional): Width of the image used for encoding.
|
| 350 |
+
This allows to change the image size during encoding.
|
| 351 |
+
|
| 352 |
+
encoder_height (int or None, optional): Height of the image used for encoding.
|
| 353 |
+
This allows to change the image size during encoding.
|
| 354 |
+
|
| 355 |
+
encoder_format (str or None, optional): {encoder_format}
|
| 356 |
+
|
| 357 |
+
codec_config (CodecConfig or None, optional): {codec_config}
|
| 358 |
+
|
| 359 |
+
filter_desc (str or None, optional): {filter_desc}
|
| 360 |
+
|
| 361 |
+
hw_accel (str or None, optional): Enable hardware acceleration.
|
| 362 |
+
|
| 363 |
+
When video is encoded on CUDA hardware, for example
|
| 364 |
+
`encoder="h264_nvenc"`, passing CUDA device indicator to `hw_accel`
|
| 365 |
+
(i.e. `hw_accel="cuda:0"`) will make StreamingMediaEncoder expect video
|
| 366 |
+
chunk to be CUDA Tensor. Passing CPU Tensor will result in an error.
|
| 367 |
+
|
| 368 |
+
If `None`, the video chunk Tensor has to be CPU Tensor.
|
| 369 |
+
Default: ``None``.
|
| 370 |
+
"""
|
| 371 |
+
self._s.add_video_stream(
|
| 372 |
+
frame_rate,
|
| 373 |
+
width,
|
| 374 |
+
height,
|
| 375 |
+
format,
|
| 376 |
+
encoder,
|
| 377 |
+
encoder_option,
|
| 378 |
+
encoder_format,
|
| 379 |
+
encoder_frame_rate,
|
| 380 |
+
encoder_width,
|
| 381 |
+
encoder_height,
|
| 382 |
+
hw_accel,
|
| 383 |
+
_convert_config(codec_config),
|
| 384 |
+
filter_desc,
|
| 385 |
+
)
|
| 386 |
+
|
| 387 |
+
def set_metadata(self, metadata: Dict[str, str]):
|
| 388 |
+
"""Set file-level metadata
|
| 389 |
+
|
| 390 |
+
Args:
|
| 391 |
+
metadata (dict or None, optional): File-level metadata.
|
| 392 |
+
"""
|
| 393 |
+
self._s.set_metadata(metadata)
|
| 394 |
+
|
| 395 |
+
def _print_output_stream(self, i: int):
|
| 396 |
+
"""[debug] Print the registered stream information to stdout."""
|
| 397 |
+
self._s.dump_format(i)
|
| 398 |
+
|
| 399 |
+
def open(self, option: Optional[Dict[str, str]] = None) -> "StreamingMediaEncoder":
|
| 400 |
+
"""Open the output file / device and write the header.
|
| 401 |
+
|
| 402 |
+
:py:class:`StreamingMediaEncoder` is also a context manager and therefore supports the
|
| 403 |
+
``with`` statement.
|
| 404 |
+
This method returns the instance on which the method is called (i.e. `self`),
|
| 405 |
+
so that it can be used in `with` statement.
|
| 406 |
+
It is recommended to use context manager, as the file is closed automatically
|
| 407 |
+
when exiting from ``with`` clause.
|
| 408 |
+
|
| 409 |
+
Args:
|
| 410 |
+
option (dict or None, optional): Private options for protocol, device and muxer. See example.
|
| 411 |
+
|
| 412 |
+
Example - Protocol option
|
| 413 |
+
>>> s = StreamingMediaEncoder(dst="rtmp://localhost:1234/live/app", format="flv")
|
| 414 |
+
>>> s.add_video_stream(...)
|
| 415 |
+
>>> # Passing protocol option `listen=1` makes StreamingMediaEncoder act as RTMP server.
|
| 416 |
+
>>> with s.open(option={"listen": "1"}) as f:
|
| 417 |
+
>>> f.write_video_chunk(...)
|
| 418 |
+
|
| 419 |
+
Example - Device option
|
| 420 |
+
>>> s = StreamingMediaEncoder("-", format="sdl")
|
| 421 |
+
>>> s.add_video_stream(..., encoder_format="rgb24")
|
| 422 |
+
>>> # Open SDL video player with fullscreen
|
| 423 |
+
>>> with s.open(option={"window_fullscreen": "1"}):
|
| 424 |
+
>>> f.write_video_chunk(...)
|
| 425 |
+
|
| 426 |
+
Example - Muxer option
|
| 427 |
+
>>> s = StreamingMediaEncoder("foo.flac")
|
| 428 |
+
>>> s.add_audio_stream(...)
|
| 429 |
+
>>> s.set_metadata({"artist": "torio contributors"})
|
| 430 |
+
>>> # FLAC muxer has a private option to not write the header.
|
| 431 |
+
>>> # The resulting file does not contain the above metadata.
|
| 432 |
+
>>> with s.open(option={"write_header": "false"}) as f:
|
| 433 |
+
>>> f.write_audio_chunk(...)
|
| 434 |
+
"""
|
| 435 |
+
if not self._is_open:
|
| 436 |
+
self._s.open(option)
|
| 437 |
+
self._is_open = True
|
| 438 |
+
return self
|
| 439 |
+
|
| 440 |
+
def close(self):
|
| 441 |
+
"""Close the output
|
| 442 |
+
|
| 443 |
+
:py:class:`StreamingMediaEncoder` is also a context manager and therefore supports the
|
| 444 |
+
``with`` statement.
|
| 445 |
+
It is recommended to use context manager, as the file is closed automatically
|
| 446 |
+
when exiting from ``with`` clause.
|
| 447 |
+
|
| 448 |
+
See :py:meth:`StreamingMediaEncoder.open` for more detail.
|
| 449 |
+
"""
|
| 450 |
+
if self._is_open:
|
| 451 |
+
self._s.close()
|
| 452 |
+
self._is_open = False
|
| 453 |
+
|
| 454 |
+
def write_audio_chunk(self, i: int, chunk: torch.Tensor, pts: Optional[float] = None):
|
| 455 |
+
"""Write audio data
|
| 456 |
+
|
| 457 |
+
Args:
|
| 458 |
+
i (int): Stream index.
|
| 459 |
+
chunk (Tensor): Waveform tensor. Shape: `(frame, channel)`.
|
| 460 |
+
The ``dtype`` must match what was passed to :py:meth:`add_audio_stream` method.
|
| 461 |
+
pts (float, optional, or None): If provided, overwrite the presentation timestamp.
|
| 462 |
+
|
| 463 |
+
.. note::
|
| 464 |
+
|
| 465 |
+
The provided value is converted to integer value expressed in basis of
|
| 466 |
+
sample rate. Therefore, it is truncated to the nearest value of
|
| 467 |
+
``n / sample_rate``.
|
| 468 |
+
"""
|
| 469 |
+
self._s.write_audio_chunk(i, chunk, pts)
|
| 470 |
+
|
| 471 |
+
def write_video_chunk(self, i: int, chunk: torch.Tensor, pts: Optional[float] = None):
|
| 472 |
+
"""Write video/image data
|
| 473 |
+
|
| 474 |
+
Args:
|
| 475 |
+
i (int): Stream index.
|
| 476 |
+
chunk (Tensor): Video/image tensor.
|
| 477 |
+
Shape: `(time, channel, height, width)`.
|
| 478 |
+
The ``dtype`` must be ``torch.uint8``.
|
| 479 |
+
The shape (height, width and the number of channels) must match
|
| 480 |
+
what was configured when calling :py:meth:`add_video_stream`
|
| 481 |
+
pts (float, optional or None): If provided, overwrite the presentation timestamp.
|
| 482 |
+
|
| 483 |
+
.. note::
|
| 484 |
+
|
| 485 |
+
The provided value is converted to integer value expressed in basis of
|
| 486 |
+
frame rate. Therefore, it is truncated to the nearest value of
|
| 487 |
+
``n / frame_rate``.
|
| 488 |
+
"""
|
| 489 |
+
self._s.write_video_chunk(i, chunk, pts)
|
| 490 |
+
|
| 491 |
+
def flush(self):
|
| 492 |
+
"""Flush the frames from encoders and write the frames to the destination."""
|
| 493 |
+
self._s.flush()
|
| 494 |
+
|
| 495 |
+
def __enter__(self):
|
| 496 |
+
"""Context manager so that the destination is closed and data are flushed automatically."""
|
| 497 |
+
return self
|
| 498 |
+
|
| 499 |
+
def __exit__(self, exception_type, exception_value, traceback):
|
| 500 |
+
"""Context manager so that the destination is closed and data are flushed automatically."""
|
| 501 |
+
self.flush()
|
| 502 |
+
self.close()
|
vllm/lib/python3.10/site-packages/torio/utils/__init__.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from . import ffmpeg_utils
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
__all__ = ["ffmpeg_utils"]
|
vllm/lib/python3.10/site-packages/torio/utils/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (220 Bytes). View file
|
|
|
vllm/lib/python3.10/site-packages/torio/utils/__pycache__/ffmpeg_utils.cpython-310.pyc
ADDED
|
Binary file (8.84 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/torio/utils/ffmpeg_utils.py
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Module to change the configuration of FFmpeg libraries (such as libavformat).
|
| 2 |
+
|
| 3 |
+
It affects functionalities in :py:mod:`torio.io`.
|
| 4 |
+
"""
|
| 5 |
+
from typing import Dict, List, Tuple
|
| 6 |
+
|
| 7 |
+
import torio
|
| 8 |
+
|
| 9 |
+
ffmpeg_ext = torio._extension.lazy_import_ffmpeg_ext()
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def get_versions() -> Dict[str, Tuple[int]]:
|
| 13 |
+
"""Get the versions of FFmpeg libraries
|
| 14 |
+
|
| 15 |
+
Returns:
|
| 16 |
+
dict: mapping from library names to version string,
|
| 17 |
+
i.e. `"libavutil": (56, 22, 100)`.
|
| 18 |
+
"""
|
| 19 |
+
return ffmpeg_ext.get_versions()
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def get_log_level() -> int:
|
| 23 |
+
"""Get the log level of FFmpeg.
|
| 24 |
+
|
| 25 |
+
See :py:func:`set_log_level` for the detail.
|
| 26 |
+
"""
|
| 27 |
+
return ffmpeg_ext.get_log_level()
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def set_log_level(level: int):
|
| 31 |
+
"""Set the log level of FFmpeg (libavformat etc)
|
| 32 |
+
|
| 33 |
+
Arguments:
|
| 34 |
+
level (int): Log level. The larger, the more verbose.
|
| 35 |
+
|
| 36 |
+
The following values are common values, the corresponding ``ffmpeg``'s
|
| 37 |
+
``-loglevel`` option value and desription.
|
| 38 |
+
|
| 39 |
+
* ``-8`` (``quiet``):
|
| 40 |
+
Print no output.
|
| 41 |
+
* ``0`` (``panic``):
|
| 42 |
+
Something went really wrong and we will crash now.
|
| 43 |
+
* ``8`` (``fatal``):
|
| 44 |
+
Something went wrong and recovery is not possible.
|
| 45 |
+
For example, no header was found for a format which depends
|
| 46 |
+
on headers or an illegal combination of parameters is used.
|
| 47 |
+
* ``16`` (``error``):
|
| 48 |
+
Something went wrong and cannot losslessly be recovered.
|
| 49 |
+
However, not all future data is affected.
|
| 50 |
+
* ``24`` (``warning``):
|
| 51 |
+
Something somehow does not look correct.
|
| 52 |
+
This may or may not lead to problems.
|
| 53 |
+
* ``32`` (``info``):
|
| 54 |
+
Standard information.
|
| 55 |
+
* ``40`` (``verbose``):
|
| 56 |
+
Detailed information.
|
| 57 |
+
* ``48`` (``debug``):
|
| 58 |
+
Stuff which is only useful for libav* developers.
|
| 59 |
+
* ``56`` (``trace``):
|
| 60 |
+
Extremely verbose debugging, useful for libav* development.
|
| 61 |
+
|
| 62 |
+
"""
|
| 63 |
+
ffmpeg_ext.set_log_level(level)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def get_demuxers() -> Dict[str, str]:
|
| 67 |
+
"""Get the available demuxers.
|
| 68 |
+
|
| 69 |
+
Returns:
|
| 70 |
+
Dict[str, str]: Mapping from demuxer (format) short name to long name.
|
| 71 |
+
|
| 72 |
+
Example
|
| 73 |
+
>>> for k, v in get_demuxers().items():
|
| 74 |
+
>>> print(f"{k}: {v}")
|
| 75 |
+
... aa: Audible AA format files
|
| 76 |
+
... aac: raw ADTS AAC (Advanced Audio Coding)
|
| 77 |
+
... aax: CRI AAX
|
| 78 |
+
... ac3: raw AC-3
|
| 79 |
+
"""
|
| 80 |
+
return ffmpeg_ext.get_demuxers()
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
def get_muxers() -> Dict[str, str]:
|
| 84 |
+
"""Get the available muxers.
|
| 85 |
+
|
| 86 |
+
Returns:
|
| 87 |
+
Dict[str, str]: Mapping from muxer (format) short name to long name.
|
| 88 |
+
|
| 89 |
+
Example
|
| 90 |
+
>>> for k, v in get_muxers().items():
|
| 91 |
+
>>> print(f"{k}: {v}")
|
| 92 |
+
... a64: a64 - video for Commodore 64
|
| 93 |
+
... ac3: raw AC-3
|
| 94 |
+
... adts: ADTS AAC (Advanced Audio Coding)
|
| 95 |
+
... adx: CRI ADX
|
| 96 |
+
... aiff: Audio IFF
|
| 97 |
+
"""
|
| 98 |
+
return ffmpeg_ext.get_muxers()
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
def get_audio_decoders() -> Dict[str, str]:
|
| 102 |
+
"""Get the available audio decoders.
|
| 103 |
+
|
| 104 |
+
Returns:
|
| 105 |
+
Dict[str, str]: Mapping from decoder short name to long name.
|
| 106 |
+
|
| 107 |
+
Example
|
| 108 |
+
>>> for k, v in get_audio_decoders().items():
|
| 109 |
+
>>> print(f"{k}: {v}")
|
| 110 |
+
... a64: a64 - video for Commodore 64
|
| 111 |
+
... ac3: raw AC-3
|
| 112 |
+
... adts: ADTS AAC (Advanced Audio Coding)
|
| 113 |
+
... adx: CRI ADX
|
| 114 |
+
... aiff: Audio IFF
|
| 115 |
+
"""
|
| 116 |
+
return ffmpeg_ext.get_audio_decoders()
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
def get_audio_encoders() -> Dict[str, str]:
|
| 120 |
+
"""Get the available audio encoders.
|
| 121 |
+
|
| 122 |
+
Returns:
|
| 123 |
+
Dict[str, str]: Mapping from encoder short name to long name.
|
| 124 |
+
|
| 125 |
+
Example
|
| 126 |
+
>>> for k, v in get_audio_encoders().items():
|
| 127 |
+
>>> print(f"{k}: {v}")
|
| 128 |
+
... comfortnoise: RFC 3389 comfort noise generator
|
| 129 |
+
... s302m: SMPTE 302M
|
| 130 |
+
... aac: AAC (Advanced Audio Coding)
|
| 131 |
+
... ac3: ATSC A/52A (AC-3)
|
| 132 |
+
... ac3_fixed: ATSC A/52A (AC-3)
|
| 133 |
+
... alac: ALAC (Apple Lossless Audio Codec)
|
| 134 |
+
"""
|
| 135 |
+
return ffmpeg_ext.get_audio_encoders()
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
def get_video_decoders() -> Dict[str, str]:
|
| 139 |
+
"""Get the available video decoders.
|
| 140 |
+
|
| 141 |
+
Returns:
|
| 142 |
+
Dict[str, str]: Mapping from decoder short name to long name.
|
| 143 |
+
|
| 144 |
+
Example
|
| 145 |
+
>>> for k, v in get_video_decoders().items():
|
| 146 |
+
>>> print(f"{k}: {v}")
|
| 147 |
+
... aasc: Autodesk RLE
|
| 148 |
+
... aic: Apple Intermediate Codec
|
| 149 |
+
... alias_pix: Alias/Wavefront PIX image
|
| 150 |
+
... agm: Amuse Graphics Movie
|
| 151 |
+
... amv: AMV Video
|
| 152 |
+
... anm: Deluxe Paint Animation
|
| 153 |
+
"""
|
| 154 |
+
return ffmpeg_ext.get_video_decoders()
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
def get_video_encoders() -> Dict[str, str]:
|
| 158 |
+
"""Get the available video encoders.
|
| 159 |
+
|
| 160 |
+
Returns:
|
| 161 |
+
Dict[str, str]: Mapping from encoder short name to long name.
|
| 162 |
+
|
| 163 |
+
Example
|
| 164 |
+
>>> for k, v in get_audio_encoders().items():
|
| 165 |
+
>>> print(f"{k}: {v}")
|
| 166 |
+
... a64multi: Multicolor charset for Commodore 64
|
| 167 |
+
... a64multi5: Multicolor charset for Commodore 64, extended with 5th color (colram)
|
| 168 |
+
... alias_pix: Alias/Wavefront PIX image
|
| 169 |
+
... amv: AMV Video
|
| 170 |
+
... apng: APNG (Animated Portable Network Graphics) image
|
| 171 |
+
... asv1: ASUS V1
|
| 172 |
+
... asv2: ASUS V2
|
| 173 |
+
"""
|
| 174 |
+
return ffmpeg_ext.get_video_encoders()
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
def get_input_devices() -> Dict[str, str]:
|
| 178 |
+
"""Get the available input devices.
|
| 179 |
+
|
| 180 |
+
Returns:
|
| 181 |
+
Dict[str, str]: Mapping from device short name to long name.
|
| 182 |
+
|
| 183 |
+
Example
|
| 184 |
+
>>> for k, v in get_input_devices().items():
|
| 185 |
+
>>> print(f"{k}: {v}")
|
| 186 |
+
... avfoundation: AVFoundation input device
|
| 187 |
+
... lavfi: Libavfilter virtual input device
|
| 188 |
+
"""
|
| 189 |
+
return ffmpeg_ext.get_input_devices()
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
def get_output_devices() -> Dict[str, str]:
|
| 193 |
+
"""Get the available output devices.
|
| 194 |
+
|
| 195 |
+
Returns:
|
| 196 |
+
Dict[str, str]: Mapping from device short name to long name.
|
| 197 |
+
|
| 198 |
+
Example
|
| 199 |
+
>>> for k, v in get_output_devices().items():
|
| 200 |
+
>>> print(f"{k}: {v}")
|
| 201 |
+
... audiotoolbox: AudioToolbox output device
|
| 202 |
+
"""
|
| 203 |
+
return ffmpeg_ext.get_output_devices()
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
def get_input_protocols() -> List[str]:
|
| 207 |
+
"""Get the supported input protocols.
|
| 208 |
+
|
| 209 |
+
Returns:
|
| 210 |
+
List[str]: The names of supported input protocols
|
| 211 |
+
|
| 212 |
+
Example
|
| 213 |
+
>>> print(get_input_protocols())
|
| 214 |
+
... ['file', 'ftp', 'hls', 'http','https', 'pipe', 'rtmp', 'tcp', 'tls', 'udp', 'unix']
|
| 215 |
+
"""
|
| 216 |
+
return ffmpeg_ext.get_input_protocols()
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
def get_output_protocols() -> List[str]:
|
| 220 |
+
"""Get the supported output protocols.
|
| 221 |
+
|
| 222 |
+
Returns:
|
| 223 |
+
list of str: The names of supported output protocols
|
| 224 |
+
|
| 225 |
+
Example
|
| 226 |
+
>>> print(get_output_protocols())
|
| 227 |
+
... ['file', 'ftp', 'http', 'https', 'md5', 'pipe', 'prompeg', 'rtmp', 'tee', 'tcp', 'tls', 'udp', 'unix']
|
| 228 |
+
"""
|
| 229 |
+
return ffmpeg_ext.get_output_protocols()
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
def get_build_config() -> str:
|
| 233 |
+
"""Get the FFmpeg build configuration
|
| 234 |
+
|
| 235 |
+
Returns:
|
| 236 |
+
str: Build configuration string.
|
| 237 |
+
|
| 238 |
+
Example
|
| 239 |
+
>>> print(get_build_config())
|
| 240 |
+
--prefix=/Users/runner/miniforge3 --cc=arm64-apple-darwin20.0.0-clang --enable-gpl --enable-hardcoded-tables --enable-libfreetype --enable-libopenh264 --enable-neon --enable-libx264 --enable-libx265 --enable-libaom --enable-libsvtav1 --enable-libxml2 --enable-libvpx --enable-pic --enable-pthreads --enable-shared --disable-static --enable-version3 --enable-zlib --enable-libmp3lame --pkg-config=/Users/runner/miniforge3/conda-bld/ffmpeg_1646229390493/_build_env/bin/pkg-config --enable-cross-compile --arch=arm64 --target-os=darwin --cross-prefix=arm64-apple-darwin20.0.0- --host-cc=/Users/runner/miniforge3/conda-bld/ffmpeg_1646229390493/_build_env/bin/x86_64-apple-darwin13.4.0-clang # noqa
|
| 241 |
+
"""
|
| 242 |
+
return ffmpeg_ext.get_build_config()
|
| 243 |
+
|
| 244 |
+
|
| 245 |
+
def clear_cuda_context_cache():
|
| 246 |
+
"""Clear the CUDA context used by CUDA Hardware accelerated video decoding"""
|
| 247 |
+
ffmpeg_ext.clear_cuda_context_cache()
|
vllm/lib/python3.10/site-packages/triton/backends/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (1.82 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/triton/backends/__pycache__/compiler.cpython-310.pyc
ADDED
|
Binary file (3.33 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/triton/backends/__pycache__/driver.cpython-310.pyc
ADDED
|
Binary file (1.74 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/triton/backends/amd/include/roctracer/ext/prof_protocol.h
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Copyright (c) 2018-2022 Advanced Micro Devices, Inc.
|
| 2 |
+
|
| 3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 4 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 5 |
+
in the Software without restriction, including without limitation the rights
|
| 6 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 7 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 8 |
+
furnished to do so, subject to the following conditions:
|
| 9 |
+
|
| 10 |
+
The above copyright notice and this permission notice shall be included in
|
| 11 |
+
all copies or substantial portions of the Software.
|
| 12 |
+
|
| 13 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 14 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 15 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 16 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 17 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 18 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 19 |
+
THE SOFTWARE. */
|
| 20 |
+
|
| 21 |
+
#ifndef EXT_PROF_PROTOCOL_H_
|
| 22 |
+
#define EXT_PROF_PROTOCOL_H_
|
| 23 |
+
|
| 24 |
+
#include <stdint.h>
|
| 25 |
+
#include <stdlib.h>
|
| 26 |
+
|
| 27 |
+
/* Traced API domains */
|
| 28 |
+
typedef enum {
|
| 29 |
+
ACTIVITY_DOMAIN_HSA_API = 0, /* HSA API domain */
|
| 30 |
+
ACTIVITY_DOMAIN_HSA_OPS = 1, /* HSA async activity domain */
|
| 31 |
+
ACTIVITY_DOMAIN_HIP_OPS = 2, /* HIP async activity domain */
|
| 32 |
+
ACTIVITY_DOMAIN_HCC_OPS =
|
| 33 |
+
ACTIVITY_DOMAIN_HIP_OPS, /* HCC async activity domain */
|
| 34 |
+
ACTIVITY_DOMAIN_HIP_VDI =
|
| 35 |
+
ACTIVITY_DOMAIN_HIP_OPS, /* HIP VDI async activity domain */
|
| 36 |
+
ACTIVITY_DOMAIN_HIP_API = 3, /* HIP API domain */
|
| 37 |
+
ACTIVITY_DOMAIN_KFD_API = 4, /* KFD API domain */
|
| 38 |
+
ACTIVITY_DOMAIN_EXT_API = 5, /* External ID domain */
|
| 39 |
+
ACTIVITY_DOMAIN_ROCTX = 6, /* ROCTX domain */
|
| 40 |
+
ACTIVITY_DOMAIN_HSA_EVT = 7, /* HSA events */
|
| 41 |
+
ACTIVITY_DOMAIN_NUMBER
|
| 42 |
+
} activity_domain_t;
|
| 43 |
+
|
| 44 |
+
/* API callback type */
|
| 45 |
+
typedef void (*activity_rtapi_callback_t)(uint32_t domain, uint32_t cid,
|
| 46 |
+
const void* data, void* arg);
|
| 47 |
+
typedef uint32_t activity_kind_t;
|
| 48 |
+
typedef uint32_t activity_op_t;
|
| 49 |
+
|
| 50 |
+
/* API callback phase */
|
| 51 |
+
typedef enum {
|
| 52 |
+
ACTIVITY_API_PHASE_ENTER = 0,
|
| 53 |
+
ACTIVITY_API_PHASE_EXIT = 1
|
| 54 |
+
} activity_api_phase_t;
|
| 55 |
+
|
| 56 |
+
/* Trace record types */
|
| 57 |
+
|
| 58 |
+
/* Correlation id */
|
| 59 |
+
typedef uint64_t activity_correlation_id_t;
|
| 60 |
+
|
| 61 |
+
/* Timestamp in nanoseconds */
|
| 62 |
+
typedef uint64_t roctracer_timestamp_t;
|
| 63 |
+
|
| 64 |
+
/* Activity record type */
|
| 65 |
+
typedef struct activity_record_s {
|
| 66 |
+
uint32_t domain; /* activity domain id */
|
| 67 |
+
activity_kind_t kind; /* activity kind */
|
| 68 |
+
activity_op_t op; /* activity op */
|
| 69 |
+
union {
|
| 70 |
+
struct {
|
| 71 |
+
activity_correlation_id_t correlation_id; /* activity ID */
|
| 72 |
+
roctracer_timestamp_t begin_ns; /* host begin timestamp */
|
| 73 |
+
roctracer_timestamp_t end_ns; /* host end timestamp */
|
| 74 |
+
};
|
| 75 |
+
struct {
|
| 76 |
+
uint32_t se; /* sampled SE */
|
| 77 |
+
uint64_t cycle; /* sample cycle */
|
| 78 |
+
uint64_t pc; /* sample PC */
|
| 79 |
+
} pc_sample;
|
| 80 |
+
};
|
| 81 |
+
union {
|
| 82 |
+
struct {
|
| 83 |
+
int device_id; /* device id */
|
| 84 |
+
uint64_t queue_id; /* queue id */
|
| 85 |
+
};
|
| 86 |
+
struct {
|
| 87 |
+
uint32_t process_id; /* device id */
|
| 88 |
+
uint32_t thread_id; /* thread id */
|
| 89 |
+
};
|
| 90 |
+
struct {
|
| 91 |
+
activity_correlation_id_t external_id; /* external correlation id */
|
| 92 |
+
};
|
| 93 |
+
};
|
| 94 |
+
union {
|
| 95 |
+
size_t bytes; /* data size bytes */
|
| 96 |
+
const char* kernel_name; /* kernel name */
|
| 97 |
+
const char* mark_message;
|
| 98 |
+
};
|
| 99 |
+
} activity_record_t;
|
| 100 |
+
|
| 101 |
+
/* Activity sync callback type */
|
| 102 |
+
typedef void (*activity_sync_callback_t)(uint32_t cid, activity_record_t* record, const void* data,
|
| 103 |
+
void* arg);
|
| 104 |
+
/* Activity async callback type */
|
| 105 |
+
typedef void (*activity_async_callback_t)(uint32_t op, void* record, void* arg);
|
| 106 |
+
|
| 107 |
+
#endif /* EXT_PROF_PROTOCOL_H_ */
|
vllm/lib/python3.10/site-packages/triton/backends/amd/include/roctracer/hsa_prof_str.h
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
vllm/lib/python3.10/site-packages/triton/backends/amd/include/roctracer/roctracer_hcc.h
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Copyright (c) 2018-2022 Advanced Micro Devices, Inc.
|
| 2 |
+
|
| 3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 4 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 5 |
+
in the Software without restriction, including without limitation the rights
|
| 6 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 7 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 8 |
+
furnished to do so, subject to the following conditions:
|
| 9 |
+
|
| 10 |
+
The above copyright notice and this permission notice shall be included in
|
| 11 |
+
all copies or substantial portions of the Software.
|
| 12 |
+
|
| 13 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 14 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 15 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 16 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 17 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 18 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 19 |
+
THE SOFTWARE. */
|
| 20 |
+
|
| 21 |
+
#pragma message( \
|
| 22 |
+
"This file has been deprecated and marked for removal. Please use roctracer_hip.h instead.")
|
| 23 |
+
|
| 24 |
+
#include "roctracer_hip.h"
|
vllm/lib/python3.10/site-packages/triton/backends/amd/include/roctracer/roctracer_hip.h
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Copyright (c) 2018-2022 Advanced Micro Devices, Inc.
|
| 2 |
+
|
| 3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 4 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 5 |
+
in the Software without restriction, including without limitation the rights
|
| 6 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 7 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 8 |
+
furnished to do so, subject to the following conditions:
|
| 9 |
+
|
| 10 |
+
The above copyright notice and this permission notice shall be included in
|
| 11 |
+
all copies or substantial portions of the Software.
|
| 12 |
+
|
| 13 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 14 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 15 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 16 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 17 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 18 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 19 |
+
THE SOFTWARE. */
|
| 20 |
+
|
| 21 |
+
#ifndef ROCTRACER_HIP_H_
|
| 22 |
+
#define ROCTRACER_HIP_H_
|
| 23 |
+
|
| 24 |
+
#include "roctracer.h"
|
| 25 |
+
|
| 26 |
+
#include <hip/hip_runtime.h>
|
| 27 |
+
#include <hip/hip_deprecated.h>
|
| 28 |
+
#include <hip/amd_detail/hip_prof_str.h>
|
| 29 |
+
|
| 30 |
+
typedef enum {
|
| 31 |
+
HIP_OP_ID_DISPATCH = 0,
|
| 32 |
+
HIP_OP_ID_COPY = 1,
|
| 33 |
+
HIP_OP_ID_BARRIER = 2,
|
| 34 |
+
HIP_OP_ID_NUMBER = 3
|
| 35 |
+
} hip_op_id_t;
|
| 36 |
+
|
| 37 |
+
#endif // ROCTRACER_HIP_H_
|
vllm/lib/python3.10/site-packages/triton/backends/amd/include/roctracer/roctracer_plugin.h
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Copyright (c) 2022 Advanced Micro Devices, Inc.
|
| 2 |
+
|
| 3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 4 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 5 |
+
in the Software without restriction, including without limitation the rights
|
| 6 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 7 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 8 |
+
furnished to do so, subject to the following conditions:
|
| 9 |
+
|
| 10 |
+
The above copyright notice and this permission notice shall be included in
|
| 11 |
+
all copies or substantial portions of the Software.
|
| 12 |
+
|
| 13 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 14 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 15 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 16 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 17 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 18 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 19 |
+
THE SOFTWARE. */
|
| 20 |
+
|
| 21 |
+
/** \section roctracer_plugin_api ROCtracer Plugin API
|
| 22 |
+
*
|
| 23 |
+
* The ROCtracer Plugin API is used by the ROCtracer Tool to output all tracing
|
| 24 |
+
* information. Different implementations of the ROCtracer Plugin API can be
|
| 25 |
+
* developed that output the tracing data in different formats.
|
| 26 |
+
* The ROCtracer Tool can be configured to load a specific library that
|
| 27 |
+
* supports the user desired format.
|
| 28 |
+
*
|
| 29 |
+
* The API is not thread safe. It is the responsibility of the ROCtracer Tool
|
| 30 |
+
* to ensure the operations are synchronized and not called concurrently. There
|
| 31 |
+
* is no requirement for the ROCtracer Tool to report trace data in any
|
| 32 |
+
* specific order. If the format supported by plugin requires specific
|
| 33 |
+
* ordering, it is the responsibility of the plugin implementation to perform
|
| 34 |
+
* any necessary sorting.
|
| 35 |
+
*/
|
| 36 |
+
|
| 37 |
+
/**
|
| 38 |
+
* \file
|
| 39 |
+
* ROCtracer Tool Plugin API interface.
|
| 40 |
+
*/
|
| 41 |
+
|
| 42 |
+
#ifndef ROCTRACER_PLUGIN_H_
|
| 43 |
+
#define ROCTRACER_PLUGIN_H_
|
| 44 |
+
|
| 45 |
+
#include "roctracer.h"
|
| 46 |
+
|
| 47 |
+
#include <stdint.h>
|
| 48 |
+
|
| 49 |
+
#ifdef __cplusplus
|
| 50 |
+
extern "C" {
|
| 51 |
+
#endif /* __cplusplus */
|
| 52 |
+
|
| 53 |
+
/** \defgroup initialization_group Initialization and Finalization
|
| 54 |
+
*
|
| 55 |
+
* The ROCtracer Plugin API must be initialized before using any of the
|
| 56 |
+
* operations to report trace data, and finalized after the last trace data has
|
| 57 |
+
* been reported.
|
| 58 |
+
*
|
| 59 |
+
* @{
|
| 60 |
+
*/
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Initialize plugin.
|
| 64 |
+
*
|
| 65 |
+
* Must be called before any other operation.
|
| 66 |
+
*
|
| 67 |
+
* @param[in] roctracer_major_version The major version of the ROCtracer API
|
| 68 |
+
* being used by the ROCtracer Tool. An error is reported if this does not
|
| 69 |
+
* match the major version of the ROCtracer API used to build the plugin
|
| 70 |
+
* library. This ensures compatibility of the trace data format.
|
| 71 |
+
*
|
| 72 |
+
* @param[in] roctracer_minor_version The minor version of the ROCtracer API
|
| 73 |
+
* being used by the ROCtracer Tool. An error is reported if the
|
| 74 |
+
* \p roctracer_major_version matches and this is greater than the minor
|
| 75 |
+
* version of the ROCtracer API used to build the plugin library. This ensures
|
| 76 |
+
* compatibility of the trace data format.
|
| 77 |
+
*
|
| 78 |
+
* @return Returns 0 on success and -1 on error.
|
| 79 |
+
*/
|
| 80 |
+
ROCTRACER_EXPORT int roctracer_plugin_initialize(
|
| 81 |
+
uint32_t roctracer_major_version, uint32_t roctracer_minor_version);
|
| 82 |
+
|
| 83 |
+
/**
|
| 84 |
+
* Finalize plugin.
|
| 85 |
+
*
|
| 86 |
+
* This must be called after ::roctracer_plugin_initialize and after all trace
|
| 87 |
+
* data has been reported by ::roctracer_plugin_write_callback_record and
|
| 88 |
+
* ::roctracer_plugin_write_activity_records.
|
| 89 |
+
*/
|
| 90 |
+
ROCTRACER_EXPORT void roctracer_plugin_finalize();
|
| 91 |
+
|
| 92 |
+
/** @} */
|
| 93 |
+
|
| 94 |
+
/** \defgroup trace_record_write_functions Trace data reporting
|
| 95 |
+
*
|
| 96 |
+
* Operations to output trace data.
|
| 97 |
+
*
|
| 98 |
+
* @{
|
| 99 |
+
*/
|
| 100 |
+
|
| 101 |
+
/**
|
| 102 |
+
* Report a single callback trace data.
|
| 103 |
+
*
|
| 104 |
+
* @param[in] record Primarily domain independent trace data.
|
| 105 |
+
*
|
| 106 |
+
* @param[in] callback_data Domain specific trace data. The type of this
|
| 107 |
+
* argument depends on the values of \p record.domain.
|
| 108 |
+
*
|
| 109 |
+
* @return Returns 0 on success and -1 on error.
|
| 110 |
+
*/
|
| 111 |
+
ROCTRACER_EXPORT int roctracer_plugin_write_callback_record(
|
| 112 |
+
const roctracer_record_t* record, const void* callback_data);
|
| 113 |
+
|
| 114 |
+
/**
|
| 115 |
+
* Report a range of activity trace data.
|
| 116 |
+
*
|
| 117 |
+
* Reports a range of primarily domain independent trace data. The range is
|
| 118 |
+
* specified by a pointer to the first record and a pointer to one past the
|
| 119 |
+
* last record. ::roctracer_next_record is used to iterate the range in forward
|
| 120 |
+
* order.
|
| 121 |
+
*
|
| 122 |
+
* @param[in] begin Pointer to the first record.
|
| 123 |
+
*
|
| 124 |
+
* @param[in] end Pointer to one past the last record.
|
| 125 |
+
*
|
| 126 |
+
* @return Returns 0 on success and -1 on error.
|
| 127 |
+
*/
|
| 128 |
+
ROCTRACER_EXPORT int roctracer_plugin_write_activity_records(
|
| 129 |
+
const roctracer_record_t* begin, const roctracer_record_t* end);
|
| 130 |
+
|
| 131 |
+
/** @} */
|
| 132 |
+
|
| 133 |
+
#ifdef __cplusplus
|
| 134 |
+
} /* extern "C" */
|
| 135 |
+
#endif /* __cplusplus */
|
| 136 |
+
|
| 137 |
+
#endif /* ROCTRACER_PLUGIN_H_ */
|
vllm/lib/python3.10/site-packages/triton/backends/nvidia/compiler.py
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from triton.backends.compiler import BaseBackend, GPUTarget
|
| 2 |
+
from triton._C.libtriton import ir, passes, llvm, nvidia
|
| 3 |
+
|
| 4 |
+
from dataclasses import dataclass
|
| 5 |
+
import functools
|
| 6 |
+
from typing import Any, Tuple, Optional
|
| 7 |
+
import hashlib
|
| 8 |
+
import re
|
| 9 |
+
import tempfile
|
| 10 |
+
import signal
|
| 11 |
+
import os
|
| 12 |
+
import subprocess
|
| 13 |
+
from pathlib import Path
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
@functools.lru_cache()
|
| 17 |
+
def _path_to_binary(binary: str):
|
| 18 |
+
paths = [
|
| 19 |
+
os.environ.get(f"TRITON_{binary.upper()}_PATH", ""),
|
| 20 |
+
os.path.join(os.path.dirname(__file__), "bin", binary),
|
| 21 |
+
]
|
| 22 |
+
|
| 23 |
+
for bin in paths:
|
| 24 |
+
if os.path.exists(bin) and os.path.isfile(bin):
|
| 25 |
+
result = subprocess.check_output([bin, "--version"], stderr=subprocess.STDOUT)
|
| 26 |
+
if result is not None:
|
| 27 |
+
version = re.search(r".*release (\d+\.\d+).*", result.decode("utf-8"), flags=re.MULTILINE)
|
| 28 |
+
if version is not None:
|
| 29 |
+
return bin, version.group(1)
|
| 30 |
+
raise RuntimeError(f"Cannot find {binary}")
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
@functools.lru_cache()
|
| 34 |
+
def get_ptxas_version():
|
| 35 |
+
version = subprocess.check_output([_path_to_binary("ptxas")[0], "--version"]).decode("utf-8")
|
| 36 |
+
return version
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
@functools.lru_cache()
|
| 40 |
+
def ptx_get_version(cuda_version) -> int:
|
| 41 |
+
'''
|
| 42 |
+
Get the highest PTX version supported by the current CUDA driver.
|
| 43 |
+
'''
|
| 44 |
+
assert isinstance(cuda_version, str)
|
| 45 |
+
major, minor = map(int, cuda_version.split('.'))
|
| 46 |
+
if major == 12:
|
| 47 |
+
return 80 + minor
|
| 48 |
+
if major == 11:
|
| 49 |
+
return 70 + minor
|
| 50 |
+
if major == 10:
|
| 51 |
+
return 63 + minor
|
| 52 |
+
raise RuntimeError("Triton only support CUDA 10.0 or higher")
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
@functools.lru_cache(None)
|
| 56 |
+
def file_hash(path):
|
| 57 |
+
with open(path, "rb") as f:
|
| 58 |
+
return hashlib.sha256(f.read()).hexdigest()
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
@dataclass(frozen=True)
|
| 62 |
+
class CUDAOptions:
|
| 63 |
+
num_warps: int = 4
|
| 64 |
+
num_ctas: int = 1
|
| 65 |
+
num_stages: int = 3
|
| 66 |
+
# maxnreg corresponds to the ptx parameter .maxnreg, which controls the
|
| 67 |
+
# maximum number of 32-bit registers used by one thread.
|
| 68 |
+
maxnreg: Optional[int] = None
|
| 69 |
+
cluster_dims: tuple = (1, 1, 1)
|
| 70 |
+
ptx_version: int = None
|
| 71 |
+
enable_fp_fusion: bool = True
|
| 72 |
+
allow_fp8e4nv: bool = False
|
| 73 |
+
allow_fp8e4b15: bool = False
|
| 74 |
+
default_dot_input_precision: str = "tf32"
|
| 75 |
+
allowed_dot_input_precisions: Tuple[str] = ("tf32", "tf32x3", "ieee")
|
| 76 |
+
max_num_imprecise_acc_default: bool = None
|
| 77 |
+
extern_libs: dict = None
|
| 78 |
+
debug: bool = False
|
| 79 |
+
backend_name: str = 'cuda'
|
| 80 |
+
|
| 81 |
+
def __post_init__(self):
|
| 82 |
+
default_libdir = Path(__file__).parent / 'lib'
|
| 83 |
+
extern_libs = {} if self.extern_libs is None else dict(self.extern_libs)
|
| 84 |
+
if not extern_libs.get('libdevice', None):
|
| 85 |
+
extern_libs['libdevice'] = os.getenv("TRITON_LIBDEVICE_PATH", str(default_libdir / 'libdevice.10.bc'))
|
| 86 |
+
object.__setattr__(self, 'extern_libs', tuple(extern_libs.items()))
|
| 87 |
+
assert self.num_warps > 0 and (self.num_warps & (self.num_warps - 1)) == 0, \
|
| 88 |
+
"num_warps must be a power of 2"
|
| 89 |
+
|
| 90 |
+
def hash(self):
|
| 91 |
+
hash_dict = dict(self.__dict__)
|
| 92 |
+
hash_dict["extern_libs"] = tuple((k, file_hash(v)) for k, v in sorted(hash_dict["extern_libs"]))
|
| 93 |
+
key = "_".join([f"{name}-{val}" for name, val in sorted(hash_dict.items())])
|
| 94 |
+
return hashlib.sha256(key.encode("utf-8")).hexdigest()
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
class CUDABackend(BaseBackend):
|
| 98 |
+
|
| 99 |
+
@staticmethod
|
| 100 |
+
def supports_target(target: GPUTarget):
|
| 101 |
+
return target.backend == 'cuda'
|
| 102 |
+
|
| 103 |
+
def __init__(self, target: GPUTarget) -> None:
|
| 104 |
+
super().__init__(target)
|
| 105 |
+
self.capability = target.arch
|
| 106 |
+
assert isinstance(self.capability, int)
|
| 107 |
+
self.binary_ext = "cubin"
|
| 108 |
+
|
| 109 |
+
def parse_options(self, opts) -> Any:
|
| 110 |
+
args = {k: opts[k] for k in CUDAOptions.__dataclass_fields__.keys() if k in opts}
|
| 111 |
+
args["allow_fp8e4nv"] = self.capability >= 89
|
| 112 |
+
args["allow_fp8e4b15"] = self.capability < 90
|
| 113 |
+
args["max_num_imprecise_acc_default"] = 2**30 if self.capability == 90 else 0
|
| 114 |
+
return CUDAOptions(**args)
|
| 115 |
+
|
| 116 |
+
def pack_metadata(self, metadata):
|
| 117 |
+
return (
|
| 118 |
+
metadata.num_warps,
|
| 119 |
+
metadata.num_ctas,
|
| 120 |
+
metadata.shared,
|
| 121 |
+
metadata.cluster_dims[0],
|
| 122 |
+
metadata.cluster_dims[1],
|
| 123 |
+
metadata.cluster_dims[2],
|
| 124 |
+
)
|
| 125 |
+
|
| 126 |
+
def get_codegen_implementation(self):
|
| 127 |
+
import triton.language.extra.cuda as cuda
|
| 128 |
+
codegen_fns = {
|
| 129 |
+
"convert_custom_types":
|
| 130 |
+
cuda.convert_custom_float8_sm80 if self.capability >= 80 else cuda.convert_custom_float8_sm70
|
| 131 |
+
}
|
| 132 |
+
return codegen_fns
|
| 133 |
+
|
| 134 |
+
def load_dialects(self, ctx):
|
| 135 |
+
nvidia.load_dialects(ctx)
|
| 136 |
+
|
| 137 |
+
@staticmethod
|
| 138 |
+
def make_ttir(mod, metadata, opt):
|
| 139 |
+
pm = ir.pass_manager(mod.context)
|
| 140 |
+
pm.enable_debug()
|
| 141 |
+
passes.common.add_inliner(pm)
|
| 142 |
+
passes.ttir.add_rewrite_tensor_pointer(pm)
|
| 143 |
+
passes.ttir.add_combine(pm)
|
| 144 |
+
passes.common.add_canonicalizer(pm)
|
| 145 |
+
passes.ttir.add_reorder_broadcast(pm)
|
| 146 |
+
passes.common.add_cse(pm)
|
| 147 |
+
passes.common.add_licm(pm)
|
| 148 |
+
passes.common.add_symbol_dce(pm)
|
| 149 |
+
pm.run(mod)
|
| 150 |
+
return mod
|
| 151 |
+
|
| 152 |
+
@staticmethod
|
| 153 |
+
def make_ttgir(mod, metadata, opt, capability):
|
| 154 |
+
cluster_info = nvidia.ClusterInfo()
|
| 155 |
+
if opt.cluster_dims is not None:
|
| 156 |
+
cluster_info.clusterDimX = opt.cluster_dims[0]
|
| 157 |
+
cluster_info.clusterDimY = opt.cluster_dims[1]
|
| 158 |
+
cluster_info.clusterDimZ = opt.cluster_dims[2]
|
| 159 |
+
# TTIR -> TTGIR
|
| 160 |
+
pm = ir.pass_manager(mod.context)
|
| 161 |
+
pm.enable_debug()
|
| 162 |
+
passes.ttir.add_convert_to_ttgpuir(pm, f"cuda:{capability}", opt.num_warps, 32, opt.num_ctas)
|
| 163 |
+
# optimize TTGIR
|
| 164 |
+
passes.ttgpuir.add_coalesce(pm)
|
| 165 |
+
if capability // 10 >= 8:
|
| 166 |
+
passes.ttgpuir.add_f32_dot_tc(pm)
|
| 167 |
+
# TODO(Qingyi): Move PlanCTAPass to the front of CoalescePass
|
| 168 |
+
nvidia.passes.ttnvgpuir.add_plan_cta(pm, cluster_info)
|
| 169 |
+
passes.ttgpuir.add_remove_layout_conversions(pm)
|
| 170 |
+
passes.ttgpuir.add_optimize_thread_locality(pm)
|
| 171 |
+
passes.ttgpuir.add_accelerate_matmul(pm)
|
| 172 |
+
passes.ttgpuir.add_remove_layout_conversions(pm)
|
| 173 |
+
passes.ttgpuir.add_optimize_dot_operands(pm, capability >= 80)
|
| 174 |
+
passes.common.add_cse(pm)
|
| 175 |
+
if capability // 10 >= 8:
|
| 176 |
+
passes.ttgpuir.add_combine_tensor_select_and_if(pm)
|
| 177 |
+
passes.ttgpuir.add_pipeline(pm, opt.num_stages)
|
| 178 |
+
passes.ttgpuir.add_prefetch(pm)
|
| 179 |
+
passes.ttgpuir.add_optimize_dot_operands(pm, capability >= 80)
|
| 180 |
+
passes.ttgpuir.add_remove_layout_conversions(pm)
|
| 181 |
+
passes.ttgpuir.add_reduce_data_duplication(pm)
|
| 182 |
+
passes.ttgpuir.add_reorder_instructions(pm)
|
| 183 |
+
passes.common.add_cse(pm)
|
| 184 |
+
passes.common.add_symbol_dce(pm)
|
| 185 |
+
if capability // 10 >= 9:
|
| 186 |
+
nvidia.passes.ttnvgpuir.add_fence_insertion(pm)
|
| 187 |
+
nvidia.passes.ttnvgpuir.add_tma_lowering(pm)
|
| 188 |
+
passes.common.add_canonicalizer(pm)
|
| 189 |
+
pm.run(mod)
|
| 190 |
+
metadata["cluster_dims"] = (cluster_info.clusterDimX, cluster_info.clusterDimY, cluster_info.clusterDimZ)
|
| 191 |
+
return mod
|
| 192 |
+
|
| 193 |
+
@staticmethod
|
| 194 |
+
def make_llir(src, metadata, options, capability):
|
| 195 |
+
# warp-specialization mutates num_warps
|
| 196 |
+
num_warp_groups = src.get_int_attr("triton_gpu.num-warp-groups-per-cta")
|
| 197 |
+
if num_warp_groups is not None:
|
| 198 |
+
metadata["num_warps"] *= num_warp_groups
|
| 199 |
+
mod = src
|
| 200 |
+
# TritonGPU -> LLVM-IR (MLIR)
|
| 201 |
+
pm = ir.pass_manager(mod.context)
|
| 202 |
+
pm.enable_debug()
|
| 203 |
+
nvidia.passes.ttgpuir.add_decompose_unsupported_conversions(pm)
|
| 204 |
+
passes.ttgpuir.add_combine_tensor_select_and_if(pm)
|
| 205 |
+
passes.convert.add_scf_to_cf(pm)
|
| 206 |
+
passes.convert.add_index_to_llvmir(pm)
|
| 207 |
+
passes.ttgpuir.add_allocate_shared_memory(pm)
|
| 208 |
+
nvidia.passes.ttgpuir.add_to_llvmir(pm, capability)
|
| 209 |
+
nvidia.passes.ttnvgpuir.add_nvgpu_to_llvm(pm)
|
| 210 |
+
passes.convert.add_arith_to_llvmir(pm)
|
| 211 |
+
passes.common.add_canonicalizer(pm)
|
| 212 |
+
passes.common.add_cse(pm)
|
| 213 |
+
passes.common.add_symbol_dce(pm)
|
| 214 |
+
if os.environ.get("TRITON_DISABLE_LINE_INFO", "0") == "0":
|
| 215 |
+
passes.llvmir.add_di_scope(pm)
|
| 216 |
+
pm.run(mod)
|
| 217 |
+
# LLVM-IR (MLIR) -> LLVM-IR (LLVM)
|
| 218 |
+
llvm.init_targets()
|
| 219 |
+
context = llvm.context()
|
| 220 |
+
llvm_mod = llvm.to_module(mod, context)
|
| 221 |
+
nvidia.set_nvvm_reflect_ftz(llvm_mod)
|
| 222 |
+
|
| 223 |
+
# Set maxnreg on all kernels, if it was provided.
|
| 224 |
+
if options.maxnreg is not None:
|
| 225 |
+
for k in llvm_mod.get_functions():
|
| 226 |
+
if not k.is_declaration() and k.is_external_linkage():
|
| 227 |
+
k.set_nvvm_maxnreg(options.maxnreg)
|
| 228 |
+
|
| 229 |
+
if options.extern_libs:
|
| 230 |
+
paths = [path for (name, path) in options.extern_libs]
|
| 231 |
+
llvm.link_extern_libs(llvm_mod, paths)
|
| 232 |
+
|
| 233 |
+
llvm.optimize_module(llvm_mod, llvm.OPTIMIZE_O3)
|
| 234 |
+
|
| 235 |
+
# Get some metadata
|
| 236 |
+
metadata["shared"] = src.get_int_attr("triton_gpu.shared")
|
| 237 |
+
ret = str(llvm_mod)
|
| 238 |
+
del llvm_mod
|
| 239 |
+
del context
|
| 240 |
+
return ret
|
| 241 |
+
|
| 242 |
+
@staticmethod
|
| 243 |
+
def make_ptx(src, metadata, opt, capability):
|
| 244 |
+
ptx_version = opt.ptx_version
|
| 245 |
+
if ptx_version is None:
|
| 246 |
+
_, cuda_version = _path_to_binary("ptxas")
|
| 247 |
+
ptx_version = ptx_get_version(cuda_version)
|
| 248 |
+
|
| 249 |
+
# PTX 8.3 is the max version supported by llvm 3a83162168.
|
| 250 |
+
#
|
| 251 |
+
# To check if a newer PTX version is supported, increase this value
|
| 252 |
+
# and run a test. If it's not supported, LLVM will print a warning
|
| 253 |
+
# like "+ptx8.4 is not a recognized feature for this target".
|
| 254 |
+
llvm_ptx_version = min(83, ptx_version)
|
| 255 |
+
|
| 256 |
+
triple = 'nvptx64-nvidia-cuda'
|
| 257 |
+
proc = 'sm_90a' if capability == 90 else f'sm_{capability}'
|
| 258 |
+
features = f'+ptx{llvm_ptx_version}'
|
| 259 |
+
ret = llvm.translate_to_asm(src, triple, proc, features, ['nvptx-short-ptr'], opt.enable_fp_fusion, False)
|
| 260 |
+
# Find kernel names (there should only be one)
|
| 261 |
+
names = re.findall(r".visible .entry ([a-zA-Z_][a-zA-Z0-9_]*)", ret)
|
| 262 |
+
assert len(names) == 1
|
| 263 |
+
metadata["name"] = names[0]
|
| 264 |
+
# post-process
|
| 265 |
+
ptx_version = f'{ptx_version//10}.{ptx_version%10}'
|
| 266 |
+
ret = re.sub(r'\.version \d+\.\d+', f'.version {ptx_version}', ret, flags=re.MULTILINE)
|
| 267 |
+
# Remove the debug flag that prevents ptxas from optimizing the code
|
| 268 |
+
ret = re.sub(r",\s*debug|debug,\s*", "", ret)
|
| 269 |
+
if os.environ.get("NVPTX_ENABLE_DUMP", "0") == "1":
|
| 270 |
+
print("// -----// NVPTX Dump //----- //")
|
| 271 |
+
print(ret)
|
| 272 |
+
return ret
|
| 273 |
+
|
| 274 |
+
@staticmethod
|
| 275 |
+
def make_cubin(src, metadata, opt, capability):
|
| 276 |
+
ptxas, _ = _path_to_binary("ptxas")
|
| 277 |
+
with tempfile.NamedTemporaryFile(delete=False, mode='w', suffix='.ptx') as fsrc, \
|
| 278 |
+
tempfile.NamedTemporaryFile(delete=False, mode='r', suffix='.log') as flog:
|
| 279 |
+
fsrc.write(src)
|
| 280 |
+
fsrc.flush()
|
| 281 |
+
fbin = fsrc.name + '.o'
|
| 282 |
+
|
| 283 |
+
line_info = '' if os.environ.get('TRITON_DISABLE_LINE_INFO') else ' -lineinfo'
|
| 284 |
+
fmad = '' if opt.enable_fp_fusion else ' --fmad=false'
|
| 285 |
+
suffix = 'a ' if capability == 90 else ' '
|
| 286 |
+
if os.environ.get("DISABLE_PTXAS_OPT", "0") == "1":
|
| 287 |
+
cmd = f'{ptxas}{line_info}{fmad} -v --opt-level 0 --gpu-name=sm_{capability}{suffix}{fsrc.name} -o {fbin} 2> {flog.name}'
|
| 288 |
+
else:
|
| 289 |
+
cmd = f'{ptxas}{line_info}{fmad} -v --gpu-name=sm_{capability}{suffix}{fsrc.name} -o {fbin} 2> {flog.name}'
|
| 290 |
+
|
| 291 |
+
try:
|
| 292 |
+
subprocess.run(cmd, shell=True, check=True)
|
| 293 |
+
except subprocess.CalledProcessError as e:
|
| 294 |
+
with open(flog.name) as log_file:
|
| 295 |
+
log = log_file.read()
|
| 296 |
+
if e.returncode == 255:
|
| 297 |
+
raise RuntimeError(f'Internal Triton PTX codegen error: \n{log}')
|
| 298 |
+
elif e.returncode == 128 + signal.SIGSEGV:
|
| 299 |
+
raise RuntimeError(
|
| 300 |
+
f'Please run `ptxas {fsrc.name}` to confirm that this is a bug in `ptxas`\n{log}')
|
| 301 |
+
else:
|
| 302 |
+
raise RuntimeError(f'`ptxas` failed with error code {e.returncode}: \n{log}')
|
| 303 |
+
finally:
|
| 304 |
+
if os.path.exists(fsrc.name):
|
| 305 |
+
os.remove(fsrc.name)
|
| 306 |
+
if os.path.exists(flog.name):
|
| 307 |
+
os.remove(flog.name)
|
| 308 |
+
|
| 309 |
+
with open(fbin, 'rb') as f:
|
| 310 |
+
cubin = f.read()
|
| 311 |
+
if os.path.exists(fbin):
|
| 312 |
+
os.remove(fbin)
|
| 313 |
+
return cubin
|
| 314 |
+
|
| 315 |
+
def add_stages(self, stages, options):
|
| 316 |
+
stages["ttir"] = lambda src, metadata: self.make_ttir(src, metadata, options)
|
| 317 |
+
stages["ttgir"] = lambda src, metadata: self.make_ttgir(src, metadata, options, self.capability)
|
| 318 |
+
stages["llir"] = lambda src, metadata: self.make_llir(src, metadata, options, self.capability)
|
| 319 |
+
stages["ptx"] = lambda src, metadata: self.make_ptx(src, metadata, options, self.capability)
|
| 320 |
+
stages["cubin"] = lambda src, metadata: self.make_cubin(src, metadata, options, self.capability)
|
| 321 |
+
|
| 322 |
+
@functools.lru_cache()
|
| 323 |
+
def hash(self):
|
| 324 |
+
version = get_ptxas_version()
|
| 325 |
+
return f'{version}-{self.capability}'
|
vllm/lib/python3.10/site-packages/triton/backends/nvidia/driver.py
ADDED
|
@@ -0,0 +1,385 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import functools
|
| 2 |
+
import os
|
| 3 |
+
import hashlib
|
| 4 |
+
import subprocess
|
| 5 |
+
import tempfile
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
from triton.runtime.build import _build
|
| 8 |
+
from triton.runtime.cache import get_cache_manager
|
| 9 |
+
from triton.backends.compiler import GPUTarget
|
| 10 |
+
from triton.backends.driver import GPUDriver
|
| 11 |
+
|
| 12 |
+
dirname = os.path.dirname(os.path.realpath(__file__))
|
| 13 |
+
include_dir = [os.path.join(dirname, "include")]
|
| 14 |
+
libdevice_dir = os.path.join(dirname, "lib")
|
| 15 |
+
libraries = ['cuda']
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
@functools.lru_cache()
|
| 19 |
+
def libcuda_dirs():
|
| 20 |
+
env_libcuda_path = os.getenv("TRITON_LIBCUDA_PATH")
|
| 21 |
+
if env_libcuda_path:
|
| 22 |
+
return [env_libcuda_path]
|
| 23 |
+
|
| 24 |
+
libs = subprocess.check_output(["/sbin/ldconfig", "-p"]).decode()
|
| 25 |
+
# each line looks like the following:
|
| 26 |
+
# libcuda.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libcuda.so.1
|
| 27 |
+
locs = [line.split()[-1] for line in libs.splitlines() if "libcuda.so.1" in line]
|
| 28 |
+
dirs = [os.path.dirname(loc) for loc in locs]
|
| 29 |
+
env_ld_library_path = os.getenv("LD_LIBRARY_PATH")
|
| 30 |
+
if env_ld_library_path and not dirs:
|
| 31 |
+
dirs = [dir for dir in env_ld_library_path.split(":") if os.path.exists(os.path.join(dir, "libcuda.so.1"))]
|
| 32 |
+
msg = 'libcuda.so cannot found!\n'
|
| 33 |
+
if locs:
|
| 34 |
+
msg += 'Possible files are located at %s.' % str(locs)
|
| 35 |
+
msg += 'Please create a symlink of libcuda.so to any of the files.'
|
| 36 |
+
else:
|
| 37 |
+
msg += 'Please make sure GPU is set up and then run "/sbin/ldconfig"'
|
| 38 |
+
msg += ' (requires sudo) to refresh the linker cache.'
|
| 39 |
+
assert any(os.path.exists(os.path.join(path, 'libcuda.so.1')) for path in dirs), msg
|
| 40 |
+
return dirs
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
@functools.lru_cache()
|
| 44 |
+
def library_dirs():
|
| 45 |
+
return [libdevice_dir, *libcuda_dirs()]
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def compile_module_from_src(src, name):
|
| 49 |
+
key = hashlib.sha256(src.encode("utf-8")).hexdigest()
|
| 50 |
+
cache = get_cache_manager(key)
|
| 51 |
+
cache_path = cache.get_file(f"{name}.so")
|
| 52 |
+
if cache_path is None:
|
| 53 |
+
with tempfile.TemporaryDirectory() as tmpdir:
|
| 54 |
+
src_path = os.path.join(tmpdir, "main.c")
|
| 55 |
+
with open(src_path, "w") as f:
|
| 56 |
+
f.write(src)
|
| 57 |
+
so = _build(name, src_path, tmpdir, library_dirs(), include_dir, libraries)
|
| 58 |
+
with open(so, "rb") as f:
|
| 59 |
+
cache_path = cache.put(f.read(), f"{name}.so", binary=True)
|
| 60 |
+
import importlib.util
|
| 61 |
+
spec = importlib.util.spec_from_file_location(name, cache_path)
|
| 62 |
+
mod = importlib.util.module_from_spec(spec)
|
| 63 |
+
spec.loader.exec_module(mod)
|
| 64 |
+
return mod
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
# ------------------------
|
| 68 |
+
# Utils
|
| 69 |
+
# ------------------------
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
class CudaUtils(object):
|
| 73 |
+
|
| 74 |
+
def __new__(cls):
|
| 75 |
+
if not hasattr(cls, "instance"):
|
| 76 |
+
cls.instance = super(CudaUtils, cls).__new__(cls)
|
| 77 |
+
return cls.instance
|
| 78 |
+
|
| 79 |
+
def __init__(self):
|
| 80 |
+
mod = compile_module_from_src(Path(os.path.join(dirname, "driver.c")).read_text(), "cuda_utils")
|
| 81 |
+
self.load_binary = mod.load_binary
|
| 82 |
+
self.get_device_properties = mod.get_device_properties
|
| 83 |
+
self.cuOccupancyMaxActiveClusters = mod.cuOccupancyMaxActiveClusters
|
| 84 |
+
self.set_printf_fifo_size = mod.set_printf_fifo_size
|
| 85 |
+
self.fill_1d_tma_descriptor = mod.fill_1d_tma_descriptor
|
| 86 |
+
self.fill_2d_tma_descriptor = mod.fill_2d_tma_descriptor
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
# ------------------------
|
| 90 |
+
# Launcher
|
| 91 |
+
# ------------------------
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def ty_to_cpp(ty):
|
| 95 |
+
if ty[0] == '*':
|
| 96 |
+
return "CUdeviceptr"
|
| 97 |
+
return {
|
| 98 |
+
"i1": "int32_t",
|
| 99 |
+
"i8": "int8_t",
|
| 100 |
+
"i16": "int16_t",
|
| 101 |
+
"i32": "int32_t",
|
| 102 |
+
"i64": "int64_t",
|
| 103 |
+
"u1": "uint32_t",
|
| 104 |
+
"u8": "uint8_t",
|
| 105 |
+
"u16": "uint16_t",
|
| 106 |
+
"u32": "uint32_t",
|
| 107 |
+
"u64": "uint64_t",
|
| 108 |
+
"fp16": "float",
|
| 109 |
+
"bf16": "float",
|
| 110 |
+
"fp32": "float",
|
| 111 |
+
"f32": "float",
|
| 112 |
+
"fp64": "double",
|
| 113 |
+
}[ty]
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
def make_launcher(constants, signature, ids):
|
| 117 |
+
# Record the end of regular arguments;
|
| 118 |
+
# subsequent arguments are architecture-specific descriptors, such as tensor descriptors for CUDA.
|
| 119 |
+
arg_decls = ', '.join(f"{ty_to_cpp(ty)} arg{i}" for i, ty in signature.items())
|
| 120 |
+
|
| 121 |
+
def _extracted_type(ty):
|
| 122 |
+
if ty[0] == '*':
|
| 123 |
+
return "PyObject*"
|
| 124 |
+
return ty_to_cpp(ty)
|
| 125 |
+
|
| 126 |
+
def format_of(ty):
|
| 127 |
+
return {
|
| 128 |
+
"PyObject*": "O",
|
| 129 |
+
"float": "f",
|
| 130 |
+
"double": "d",
|
| 131 |
+
"long": "l",
|
| 132 |
+
"int8_t": "b",
|
| 133 |
+
"int16_t": "h",
|
| 134 |
+
"int32_t": "i",
|
| 135 |
+
"int64_t": "l",
|
| 136 |
+
"uint8_t": "B",
|
| 137 |
+
"uint16_t": "H",
|
| 138 |
+
"uint32_t": "I",
|
| 139 |
+
"uint64_t": "K",
|
| 140 |
+
}[ty]
|
| 141 |
+
|
| 142 |
+
args_format = ''.join([format_of(_extracted_type(ty)) for ty in signature.values()])
|
| 143 |
+
format = "iiiKKOOOO" + args_format
|
| 144 |
+
args_list = ', ' + ', '.join(f"&_arg{i}" for i, ty in signature.items()) if len(signature) > 0 else ''
|
| 145 |
+
|
| 146 |
+
# generate glue code
|
| 147 |
+
params = [i for i in signature.keys() if i not in constants]
|
| 148 |
+
src = f"""
|
| 149 |
+
#include \"cuda.h\"
|
| 150 |
+
#include <stdbool.h>
|
| 151 |
+
#include <Python.h>
|
| 152 |
+
#include <dlfcn.h>
|
| 153 |
+
|
| 154 |
+
static inline void gpuAssert(CUresult code, const char *file, int line)
|
| 155 |
+
{{
|
| 156 |
+
if (code != CUDA_SUCCESS)
|
| 157 |
+
{{
|
| 158 |
+
const char* prefix = "Triton Error [CUDA]: ";
|
| 159 |
+
const char* str;
|
| 160 |
+
cuGetErrorString(code, &str);
|
| 161 |
+
char err[1024] = {{0}};
|
| 162 |
+
strcat(err, prefix);
|
| 163 |
+
strcat(err, str);
|
| 164 |
+
PyGILState_STATE gil_state;
|
| 165 |
+
gil_state = PyGILState_Ensure();
|
| 166 |
+
PyErr_SetString(PyExc_RuntimeError, err);
|
| 167 |
+
PyGILState_Release(gil_state);
|
| 168 |
+
}}
|
| 169 |
+
}}
|
| 170 |
+
|
| 171 |
+
#define CUDA_CHECK(ans) {{ gpuAssert((ans), __FILE__, __LINE__); }}
|
| 172 |
+
|
| 173 |
+
typedef CUresult (*cuLaunchKernelEx_t)(const CUlaunchConfig* config, CUfunction f, void** kernelParams, void** extra);
|
| 174 |
+
|
| 175 |
+
static cuLaunchKernelEx_t getLaunchKernelExHandle() {{
|
| 176 |
+
// Open the shared library
|
| 177 |
+
void* handle = dlopen("libcuda.so.1", RTLD_LAZY);
|
| 178 |
+
if (!handle) {{
|
| 179 |
+
PyErr_SetString(PyExc_RuntimeError, "Failed to open libcuda.so.1");
|
| 180 |
+
return NULL;
|
| 181 |
+
}}
|
| 182 |
+
// Clear any existing error
|
| 183 |
+
dlerror();
|
| 184 |
+
cuLaunchKernelEx_t cuLaunchKernelExHandle = (cuLaunchKernelEx_t)dlsym(handle, "cuLaunchKernelEx");
|
| 185 |
+
// Check for errors
|
| 186 |
+
const char *dlsym_error = dlerror();
|
| 187 |
+
if (dlsym_error) {{
|
| 188 |
+
PyErr_SetString(PyExc_RuntimeError, "Failed to retrieve cuLaunchKernelEx from libcuda.so.1");
|
| 189 |
+
return NULL;
|
| 190 |
+
}}
|
| 191 |
+
return cuLaunchKernelExHandle;
|
| 192 |
+
}}
|
| 193 |
+
|
| 194 |
+
static void _launch(int gridX, int gridY, int gridZ, int num_warps, int num_ctas, int clusterDimX, int clusterDimY, int clusterDimZ, int shared_memory, CUstream stream, CUfunction function{', ' + arg_decls if len(arg_decls) > 0 else ''}) {{
|
| 195 |
+
void *params[] = {{ {', '.join(f"&arg{i}" for i in params)} }};
|
| 196 |
+
if (gridX*gridY*gridZ > 0) {{
|
| 197 |
+
if (num_ctas == 1) {{
|
| 198 |
+
CUDA_CHECK(cuLaunchKernel(function, gridX, gridY, gridZ, 32*num_warps, 1, 1, shared_memory, stream, params, 0));
|
| 199 |
+
}} else {{
|
| 200 |
+
CUlaunchAttribute launchAttr[2];
|
| 201 |
+
launchAttr[0].id = CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION;
|
| 202 |
+
launchAttr[0].value.clusterDim.x = clusterDimX;
|
| 203 |
+
launchAttr[0].value.clusterDim.y = clusterDimY;
|
| 204 |
+
launchAttr[0].value.clusterDim.z = clusterDimZ;
|
| 205 |
+
launchAttr[1].id = CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE;
|
| 206 |
+
launchAttr[1].value.clusterSchedulingPolicyPreference = CU_CLUSTER_SCHEDULING_POLICY_SPREAD;
|
| 207 |
+
CUlaunchConfig config;
|
| 208 |
+
config.gridDimX = gridX * clusterDimX;
|
| 209 |
+
config.gridDimY = gridY * clusterDimY;
|
| 210 |
+
config.gridDimZ = gridZ * clusterDimZ;
|
| 211 |
+
config.blockDimX = 32 * num_warps;
|
| 212 |
+
config.blockDimY = 1;
|
| 213 |
+
config.blockDimZ = 1;
|
| 214 |
+
config.sharedMemBytes = shared_memory;
|
| 215 |
+
config.hStream = stream;
|
| 216 |
+
config.attrs = launchAttr;
|
| 217 |
+
config.numAttrs = 2;
|
| 218 |
+
static cuLaunchKernelEx_t cuLaunchKernelExHandle = NULL;
|
| 219 |
+
if (cuLaunchKernelExHandle == NULL) {{
|
| 220 |
+
cuLaunchKernelExHandle = getLaunchKernelExHandle();
|
| 221 |
+
}}
|
| 222 |
+
CUDA_CHECK(cuLaunchKernelExHandle(&config, function, params, 0));
|
| 223 |
+
}}
|
| 224 |
+
}}
|
| 225 |
+
}}
|
| 226 |
+
|
| 227 |
+
typedef struct _DevicePtrInfo {{
|
| 228 |
+
CUdeviceptr dev_ptr;
|
| 229 |
+
bool valid;
|
| 230 |
+
}} DevicePtrInfo;
|
| 231 |
+
|
| 232 |
+
static inline DevicePtrInfo getPointer(PyObject *obj, int idx) {{
|
| 233 |
+
DevicePtrInfo ptr_info;
|
| 234 |
+
ptr_info.dev_ptr = 0;
|
| 235 |
+
ptr_info.valid = true;
|
| 236 |
+
if (PyLong_Check(obj)) {{
|
| 237 |
+
ptr_info.dev_ptr = PyLong_AsUnsignedLongLong(obj);
|
| 238 |
+
return ptr_info;
|
| 239 |
+
}}
|
| 240 |
+
if (obj == Py_None) {{
|
| 241 |
+
// valid nullptr
|
| 242 |
+
return ptr_info;
|
| 243 |
+
}}
|
| 244 |
+
PyObject *ptr = PyObject_GetAttrString(obj, "data_ptr");
|
| 245 |
+
if(ptr){{
|
| 246 |
+
PyObject *empty_tuple = PyTuple_New(0);
|
| 247 |
+
PyObject *ret = PyObject_Call(ptr, empty_tuple, NULL);
|
| 248 |
+
Py_DECREF(empty_tuple);
|
| 249 |
+
Py_DECREF(ptr);
|
| 250 |
+
if (!PyLong_Check(ret)) {{
|
| 251 |
+
PyErr_SetString(PyExc_TypeError, "data_ptr method of Pointer object must return 64-bit int");
|
| 252 |
+
ptr_info.valid = false;
|
| 253 |
+
return ptr_info;
|
| 254 |
+
}}
|
| 255 |
+
ptr_info.dev_ptr = PyLong_AsUnsignedLongLong(ret);
|
| 256 |
+
if(!ptr_info.dev_ptr)
|
| 257 |
+
return ptr_info;
|
| 258 |
+
uint64_t dev_ptr;
|
| 259 |
+
int status = cuPointerGetAttribute(&dev_ptr, CU_POINTER_ATTRIBUTE_DEVICE_POINTER, ptr_info.dev_ptr);
|
| 260 |
+
if (status == CUDA_ERROR_INVALID_VALUE) {{
|
| 261 |
+
PyErr_Format(PyExc_ValueError,
|
| 262 |
+
"Pointer argument (at %d) cannot be accessed from Triton (cpu tensor?)", idx);
|
| 263 |
+
ptr_info.valid = false;
|
| 264 |
+
}}
|
| 265 |
+
ptr_info.dev_ptr = dev_ptr;
|
| 266 |
+
Py_DECREF(ret); // Thanks ChatGPT!
|
| 267 |
+
return ptr_info;
|
| 268 |
+
}}
|
| 269 |
+
PyErr_SetString(PyExc_TypeError, "Pointer argument must be either uint64 or have data_ptr method");
|
| 270 |
+
ptr_info.valid = false;
|
| 271 |
+
return ptr_info;
|
| 272 |
+
}}
|
| 273 |
+
|
| 274 |
+
static PyObject* launch(PyObject* self, PyObject* args) {{
|
| 275 |
+
int gridX, gridY, gridZ;
|
| 276 |
+
uint64_t _stream;
|
| 277 |
+
uint64_t _function;
|
| 278 |
+
PyObject *launch_enter_hook = NULL;
|
| 279 |
+
PyObject *launch_exit_hook = NULL;
|
| 280 |
+
PyObject *kernel_metadata = NULL;
|
| 281 |
+
PyObject *launch_metadata = NULL;
|
| 282 |
+
{' '.join([f"{_extracted_type(ty)} _arg{i}; " for i, ty in signature.items()])}
|
| 283 |
+
if(!PyArg_ParseTuple(args, \"{format}\", &gridX, &gridY, &gridZ, &_stream, &_function,
|
| 284 |
+
&kernel_metadata, &launch_metadata,
|
| 285 |
+
&launch_enter_hook, &launch_exit_hook {args_list})) {{
|
| 286 |
+
return NULL;
|
| 287 |
+
}}
|
| 288 |
+
|
| 289 |
+
int num_warps, num_ctas, shared_memory, clusterDimX, clusterDimY, clusterDimZ;
|
| 290 |
+
if (!PyArg_ParseTuple(kernel_metadata, \"iiiiii\", &num_warps, &num_ctas, &shared_memory, &clusterDimX, &clusterDimY, &clusterDimZ)) {{
|
| 291 |
+
PyErr_SetString(PyExc_TypeError, "kernel_metadata must be a tuple");
|
| 292 |
+
return NULL;
|
| 293 |
+
}}
|
| 294 |
+
|
| 295 |
+
// extract launch metadata
|
| 296 |
+
if (launch_enter_hook != Py_None){{
|
| 297 |
+
PyObject* args = Py_BuildValue("(O)", launch_metadata);
|
| 298 |
+
PyObject* ret = PyObject_CallObject(launch_enter_hook, args);
|
| 299 |
+
Py_DECREF(args);
|
| 300 |
+
if (!ret)
|
| 301 |
+
return NULL;
|
| 302 |
+
}}
|
| 303 |
+
|
| 304 |
+
// raise exception asap
|
| 305 |
+
{"; ".join([f"DevicePtrInfo ptr_info{i} = getPointer(_arg{i}, {i}); if (!ptr_info{i}.valid) return NULL;" if ty[0] == "*" else "" for i, ty in signature.items()])};
|
| 306 |
+
Py_BEGIN_ALLOW_THREADS;
|
| 307 |
+
_launch(gridX, gridY, gridZ, num_warps, num_ctas, clusterDimX, clusterDimY, clusterDimZ, shared_memory, (CUstream)_stream, (CUfunction)_function{', ' + ', '.join(f"ptr_info{i}.dev_ptr" if ty[0]=="*" else f"_arg{i}"for i, ty in signature.items()) if len(signature) > 0 else ''});
|
| 308 |
+
Py_END_ALLOW_THREADS;
|
| 309 |
+
if (PyErr_Occurred()) {{
|
| 310 |
+
return NULL;
|
| 311 |
+
}}
|
| 312 |
+
|
| 313 |
+
if(launch_exit_hook != Py_None){{
|
| 314 |
+
PyObject* args = Py_BuildValue("(O)", launch_metadata);
|
| 315 |
+
PyObject* ret = PyObject_CallObject(launch_exit_hook, args);
|
| 316 |
+
Py_DECREF(args);
|
| 317 |
+
if (!ret)
|
| 318 |
+
return NULL;
|
| 319 |
+
|
| 320 |
+
}}
|
| 321 |
+
|
| 322 |
+
// return None
|
| 323 |
+
Py_INCREF(Py_None);
|
| 324 |
+
return Py_None;
|
| 325 |
+
}}
|
| 326 |
+
|
| 327 |
+
static PyMethodDef ModuleMethods[] = {{
|
| 328 |
+
{{"launch", launch, METH_VARARGS, "Entry point for all kernels with this signature"}},
|
| 329 |
+
{{NULL, NULL, 0, NULL}} // sentinel
|
| 330 |
+
}};
|
| 331 |
+
|
| 332 |
+
static struct PyModuleDef ModuleDef = {{
|
| 333 |
+
PyModuleDef_HEAD_INIT,
|
| 334 |
+
\"__triton_launcher\",
|
| 335 |
+
NULL, //documentation
|
| 336 |
+
-1, //size
|
| 337 |
+
ModuleMethods
|
| 338 |
+
}};
|
| 339 |
+
|
| 340 |
+
PyMODINIT_FUNC PyInit___triton_launcher(void) {{
|
| 341 |
+
PyObject *m = PyModule_Create(&ModuleDef);
|
| 342 |
+
if(m == NULL) {{
|
| 343 |
+
return NULL;
|
| 344 |
+
}}
|
| 345 |
+
PyModule_AddFunctions(m, ModuleMethods);
|
| 346 |
+
return m;
|
| 347 |
+
}}
|
| 348 |
+
"""
|
| 349 |
+
return src
|
| 350 |
+
|
| 351 |
+
|
| 352 |
+
class CudaLauncher(object):
|
| 353 |
+
|
| 354 |
+
def __init__(self, src, metadata):
|
| 355 |
+
ids = {"ids_of_const_exprs": src.fn.constexprs if hasattr(src, "fn") else tuple()}
|
| 356 |
+
constants = src.constants if hasattr(src, "constants") else dict()
|
| 357 |
+
cst_key = lambda i: src.fn.arg_names.index(i) if isinstance(i, str) else i
|
| 358 |
+
constants = {cst_key(key): value for key, value in constants.items()}
|
| 359 |
+
signature = {cst_key(key): value for key, value in src.signature.items()}
|
| 360 |
+
src = make_launcher(constants, signature, ids)
|
| 361 |
+
mod = compile_module_from_src(src, "__triton_launcher")
|
| 362 |
+
self.launch = mod.launch
|
| 363 |
+
|
| 364 |
+
def __call__(self, *args, **kwargs):
|
| 365 |
+
self.launch(*args, **kwargs)
|
| 366 |
+
|
| 367 |
+
|
| 368 |
+
class CudaDriver(GPUDriver):
|
| 369 |
+
|
| 370 |
+
def __init__(self):
|
| 371 |
+
self.utils = CudaUtils() # TODO: make static
|
| 372 |
+
self.launcher_cls = CudaLauncher
|
| 373 |
+
super().__init__()
|
| 374 |
+
|
| 375 |
+
def get_current_target(self):
|
| 376 |
+
device = self.get_current_device()
|
| 377 |
+
capability = self.get_device_capability(device)
|
| 378 |
+
capability = capability[0] * 10 + capability[1]
|
| 379 |
+
warp_size = 32
|
| 380 |
+
return GPUTarget("cuda", capability, warp_size)
|
| 381 |
+
|
| 382 |
+
@staticmethod
|
| 383 |
+
def is_active():
|
| 384 |
+
import torch
|
| 385 |
+
return torch.cuda.is_available() and (torch.version.hip is None)
|
vllm/lib/python3.10/site-packages/triton/backends/nvidia/include/Openmp/cupti_openmp.h
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2018 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#include <cuda_stdint.h>
|
| 51 |
+
#include "Openmp/omp-tools.h"
|
| 52 |
+
|
| 53 |
+
#if !defined(_CUPTI_OPENMP_H_)
|
| 54 |
+
#define _CUPTI_OPENMP_H_
|
| 55 |
+
|
| 56 |
+
#ifndef CUPTIAPI
|
| 57 |
+
#ifdef _WIN32
|
| 58 |
+
#define CUPTIAPI __stdcall
|
| 59 |
+
#else
|
| 60 |
+
#define CUPTIAPI
|
| 61 |
+
#endif
|
| 62 |
+
#endif
|
| 63 |
+
|
| 64 |
+
#if defined(__LP64__)
|
| 65 |
+
#define CUPTILP64 1
|
| 66 |
+
#elif defined(_WIN64)
|
| 67 |
+
#define CUPTILP64 1
|
| 68 |
+
#else
|
| 69 |
+
#undef CUPTILP64
|
| 70 |
+
#endif
|
| 71 |
+
|
| 72 |
+
#if defined(__cplusplus)
|
| 73 |
+
extern "C" {
|
| 74 |
+
#endif
|
| 75 |
+
|
| 76 |
+
#if defined(__GNUC__) && defined(CUPTI_LIB)
|
| 77 |
+
#pragma GCC visibility push(default)
|
| 78 |
+
#endif
|
| 79 |
+
|
| 80 |
+
/**
|
| 81 |
+
* \brief Initialize OPENMP support (deprecated, used before OpenMP 5.0)
|
| 82 |
+
*
|
| 83 |
+
*/
|
| 84 |
+
int CUPTIAPI cuptiOpenMpInitialize(ompt_function_lookup_t ompt_fn_lookup, const char *runtime_version, unsigned int ompt_version);
|
| 85 |
+
|
| 86 |
+
/**
|
| 87 |
+
* \brief Initialize OPENMP support
|
| 88 |
+
*
|
| 89 |
+
*/
|
| 90 |
+
int CUPTIAPI cuptiOpenMpInitialize_v2(ompt_function_lookup_t lookup, int initial_device_num, ompt_data_t *tool_data);
|
| 91 |
+
|
| 92 |
+
#if defined(__GNUC__) && defined(CUPTI_LIB)
|
| 93 |
+
#pragma GCC visibility pop
|
| 94 |
+
#endif
|
| 95 |
+
|
| 96 |
+
#if defined(__cplusplus)
|
| 97 |
+
}
|
| 98 |
+
#endif
|
| 99 |
+
|
| 100 |
+
#endif /*_CUPTI_OPENMP_H_*/
|
vllm/lib/python3.10/site-packages/triton/backends/nvidia/include/common_functions.h
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 1993-2018 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
|
| 51 |
+
#if defined(_MSC_VER)
|
| 52 |
+
#pragma message("common_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead.")
|
| 53 |
+
#else
|
| 54 |
+
#warning "common_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead."
|
| 55 |
+
#endif
|
| 56 |
+
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 57 |
+
#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_COMMON_FUNCTIONS_H_WRAPPER__
|
| 58 |
+
#endif
|
| 59 |
+
|
| 60 |
+
#include "crt/common_functions.h"
|
| 61 |
+
|
| 62 |
+
#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_COMMON_FUNCTIONS_H_WRAPPER__)
|
| 63 |
+
#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 64 |
+
#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_COMMON_FUNCTIONS_H_WRAPPER__
|
| 65 |
+
#endif
|
vllm/lib/python3.10/site-packages/triton/backends/nvidia/include/cooperative_groups/details/invoke.h
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 1993-2022 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#ifndef _CG_INVOKE_H
|
| 51 |
+
#define _CG_INVOKE_H
|
| 52 |
+
|
| 53 |
+
#include "info.h"
|
| 54 |
+
#include "helpers.h"
|
| 55 |
+
|
| 56 |
+
#if defined(_CG_CPP11_FEATURES)
|
| 57 |
+
|
| 58 |
+
_CG_BEGIN_NAMESPACE
|
| 59 |
+
|
| 60 |
+
namespace details {
|
| 61 |
+
|
| 62 |
+
template <typename Group>
|
| 63 |
+
struct _elect_group_supported : _CG_STL_NAMESPACE::false_type {};
|
| 64 |
+
#ifdef _CG_HAS_INSTR_ELECT
|
| 65 |
+
template<>
|
| 66 |
+
struct _elect_group_supported<coalesced_group> : _CG_STL_NAMESPACE::true_type {};
|
| 67 |
+
template<unsigned int Size, typename Parent>
|
| 68 |
+
struct _elect_group_supported<thread_block_tile<Size, Parent>> :
|
| 69 |
+
_CG_STL_NAMESPACE::integral_constant<bool, (Size <= 32)> {};
|
| 70 |
+
#endif
|
| 71 |
+
|
| 72 |
+
template <typename Group>
|
| 73 |
+
struct elect_group_supported : public _elect_group_supported<details::remove_qual<Group>> {};
|
| 74 |
+
|
| 75 |
+
template<typename Group>
|
| 76 |
+
_CG_STATIC_QUALIFIER bool elect_one(const Group& group, unsigned int mask, unsigned int& leader_lane) {
|
| 77 |
+
int is_leader = 0;
|
| 78 |
+
#ifdef _CG_HAS_INSTR_ELECT
|
| 79 |
+
asm("{\n\t"
|
| 80 |
+
" .reg .pred p;\n\t"
|
| 81 |
+
" elect.sync %0|p, %2;\n\t"
|
| 82 |
+
" @p mov.s32 %1, 1;\n\t"
|
| 83 |
+
"}"
|
| 84 |
+
: "+r"(leader_lane), "+r"(is_leader) : "r" (mask));
|
| 85 |
+
#endif
|
| 86 |
+
return is_leader;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
template<bool UseElect>
|
| 90 |
+
struct invoke_one_impl {};
|
| 91 |
+
|
| 92 |
+
template<>
|
| 93 |
+
struct invoke_one_impl<true> {
|
| 94 |
+
template<typename Group, typename Fn, typename... Args>
|
| 95 |
+
_CG_STATIC_QUALIFIER void invoke_one(const Group& group, Fn&& fn, Args&&... args) {
|
| 96 |
+
auto mask = details::_coalesced_group_data_access::get_mask(group);
|
| 97 |
+
unsigned int leader_lane = 0;
|
| 98 |
+
|
| 99 |
+
if (elect_one(group, mask, leader_lane)) {
|
| 100 |
+
_CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...);
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
template<typename Group, typename Fn, typename... Args>
|
| 105 |
+
_CG_STATIC_QUALIFIER auto invoke_one_broadcast(const Group& group, Fn&& fn, Args&&... args)
|
| 106 |
+
-> typename _CG_STL_NAMESPACE::remove_reference<
|
| 107 |
+
decltype(_CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...))>::type {
|
| 108 |
+
|
| 109 |
+
using ResultType = decltype(_CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...));
|
| 110 |
+
details::remove_qual<ResultType> result;
|
| 111 |
+
auto mask = details::_coalesced_group_data_access::get_mask(group);
|
| 112 |
+
unsigned int leader_lane = 0;
|
| 113 |
+
|
| 114 |
+
if (elect_one(group, mask, leader_lane)) {
|
| 115 |
+
result = _CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...);
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
// Need to use low level api instead of group.shfl, because elect_one returns lane id, not group rank.
|
| 119 |
+
return tile::shuffle_dispatch<ResultType>::shfl(result, mask, leader_lane, 32);
|
| 120 |
+
}
|
| 121 |
+
};
|
| 122 |
+
|
| 123 |
+
template<>
|
| 124 |
+
struct invoke_one_impl<false> {
|
| 125 |
+
template<typename Group, typename Fn, typename... Args>
|
| 126 |
+
_CG_STATIC_QUALIFIER void invoke_one(const Group& group, Fn&& fn, Args&&... args) {
|
| 127 |
+
if (group.thread_rank() == 0) {
|
| 128 |
+
_CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...);
|
| 129 |
+
}
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
template<typename Group, typename Fn, typename... Args>
|
| 133 |
+
_CG_STATIC_QUALIFIER auto invoke_one_broadcast(const Group& group, Fn&& fn, Args&&... args)
|
| 134 |
+
-> typename _CG_STL_NAMESPACE::remove_reference<
|
| 135 |
+
decltype(_CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...))>::type {
|
| 136 |
+
|
| 137 |
+
using ResultType = decltype(_CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...));
|
| 138 |
+
details::remove_qual<ResultType> result;
|
| 139 |
+
|
| 140 |
+
if (group.thread_rank() == 0) {
|
| 141 |
+
result = _CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...);
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
return group.shfl(result, 0);
|
| 145 |
+
}
|
| 146 |
+
};
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
}; // namespace details
|
| 150 |
+
|
| 151 |
+
template<typename Group, typename Fn, typename... Args>
|
| 152 |
+
_CG_QUALIFIER void invoke_one(const Group& group, Fn&& fn, Args&&... args) {
|
| 153 |
+
using impl = details::invoke_one_impl<details::elect_group_supported<Group>::value>;
|
| 154 |
+
impl::invoke_one(group, _CG_STL_NAMESPACE::forward<Fn>(fn), _CG_STL_NAMESPACE::forward<Args>(args)...);
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
template<typename Fn, typename... Args>
|
| 158 |
+
_CG_QUALIFIER auto invoke_one_broadcast(const coalesced_group& group, Fn&& fn, Args&&... args)
|
| 159 |
+
-> typename _CG_STL_NAMESPACE::remove_reference<
|
| 160 |
+
decltype(_CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...))>::type {
|
| 161 |
+
|
| 162 |
+
using ResultType = decltype(_CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...));
|
| 163 |
+
static_assert(!_CG_STL_NAMESPACE::is_same<ResultType, void>::value,
|
| 164 |
+
"For invocables returning void invoke_one should be used instead");
|
| 165 |
+
using impl = details::invoke_one_impl<details::elect_group_supported<coalesced_group>::value>;
|
| 166 |
+
return impl::invoke_one_broadcast(group,
|
| 167 |
+
_CG_STL_NAMESPACE::forward<Fn>(fn),
|
| 168 |
+
_CG_STL_NAMESPACE::forward<Args>(args)...);
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
template<unsigned int Size, typename Parent, typename Fn, typename... Args>
|
| 172 |
+
_CG_QUALIFIER auto invoke_one_broadcast(const thread_block_tile<Size, Parent>& group, Fn&& fn, Args&&... args)
|
| 173 |
+
-> typename _CG_STL_NAMESPACE::remove_reference<
|
| 174 |
+
decltype(_CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...))>::type {
|
| 175 |
+
|
| 176 |
+
using ResultType = decltype(_CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...));
|
| 177 |
+
static_assert(!_CG_STL_NAMESPACE::is_same<ResultType, void>::value,
|
| 178 |
+
"For invocables returning void invoke_one should be used instead");
|
| 179 |
+
using impl = details::invoke_one_impl<details::elect_group_supported<thread_block_tile<Size, Parent>>::value>;
|
| 180 |
+
return impl::invoke_one_broadcast(group,
|
| 181 |
+
_CG_STL_NAMESPACE::forward<Fn>(fn),
|
| 182 |
+
_CG_STL_NAMESPACE::forward<Args>(args)...);
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
_CG_END_NAMESPACE
|
| 186 |
+
|
| 187 |
+
#endif //_CG_CPP11_FEATURES
|
| 188 |
+
|
| 189 |
+
#endif // _CG_INVOKE_H
|
vllm/lib/python3.10/site-packages/triton/backends/nvidia/include/cuda_gl_interop.h
ADDED
|
@@ -0,0 +1,514 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 1993-2012 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(__CUDA_GL_INTEROP_H__)
|
| 51 |
+
#define __CUDA_GL_INTEROP_H__
|
| 52 |
+
|
| 53 |
+
#include "cuda_runtime_api.h"
|
| 54 |
+
|
| 55 |
+
#if defined(__APPLE__)
|
| 56 |
+
|
| 57 |
+
#include <OpenGL/gl.h>
|
| 58 |
+
|
| 59 |
+
#else /* __APPLE__ */
|
| 60 |
+
|
| 61 |
+
#if defined(__arm__) || defined(__aarch64__)
|
| 62 |
+
#ifndef GL_VERSION
|
| 63 |
+
#error Please include the appropriate gl headers before including cuda_gl_interop.h
|
| 64 |
+
#endif
|
| 65 |
+
#else
|
| 66 |
+
#include <GL/gl.h>
|
| 67 |
+
#endif
|
| 68 |
+
|
| 69 |
+
#endif /* __APPLE__ */
|
| 70 |
+
|
| 71 |
+
/** \cond impl_private */
|
| 72 |
+
#if defined(__DOXYGEN_ONLY__) || defined(CUDA_ENABLE_DEPRECATED)
|
| 73 |
+
#define __CUDA_DEPRECATED
|
| 74 |
+
#elif defined(_MSC_VER)
|
| 75 |
+
#define __CUDA_DEPRECATED __declspec(deprecated)
|
| 76 |
+
#elif defined(__GNUC__)
|
| 77 |
+
#define __CUDA_DEPRECATED __attribute__((deprecated))
|
| 78 |
+
#else
|
| 79 |
+
#define __CUDA_DEPRECATED
|
| 80 |
+
#endif
|
| 81 |
+
/** \endcond impl_private */
|
| 82 |
+
|
| 83 |
+
#if defined(__cplusplus)
|
| 84 |
+
extern "C" {
|
| 85 |
+
#endif /* __cplusplus */
|
| 86 |
+
|
| 87 |
+
/**
|
| 88 |
+
* \addtogroup CUDART_OPENGL OpenGL Interoperability
|
| 89 |
+
* This section describes the OpenGL interoperability functions of the CUDA
|
| 90 |
+
* runtime application programming interface. Note that mapping of OpenGL
|
| 91 |
+
* resources is performed with the graphics API agnostic, resource mapping
|
| 92 |
+
* interface described in \ref CUDART_INTEROP "Graphics Interopability".
|
| 93 |
+
*
|
| 94 |
+
* @{
|
| 95 |
+
*/
|
| 96 |
+
|
| 97 |
+
/**
|
| 98 |
+
* CUDA devices corresponding to the current OpenGL context
|
| 99 |
+
*/
|
| 100 |
+
enum cudaGLDeviceList
|
| 101 |
+
{
|
| 102 |
+
cudaGLDeviceListAll = 1, /**< The CUDA devices for all GPUs used by the current OpenGL context */
|
| 103 |
+
cudaGLDeviceListCurrentFrame = 2, /**< The CUDA devices for the GPUs used by the current OpenGL context in its currently rendering frame */
|
| 104 |
+
cudaGLDeviceListNextFrame = 3 /**< The CUDA devices for the GPUs to be used by the current OpenGL context in the next frame */
|
| 105 |
+
};
|
| 106 |
+
|
| 107 |
+
/**
|
| 108 |
+
* \brief Gets the CUDA devices associated with the current OpenGL context
|
| 109 |
+
*
|
| 110 |
+
* Returns in \p *pCudaDeviceCount the number of CUDA-compatible devices
|
| 111 |
+
* corresponding to the current OpenGL context. Also returns in \p *pCudaDevices
|
| 112 |
+
* at most \p cudaDeviceCount of the CUDA-compatible devices corresponding to
|
| 113 |
+
* the current OpenGL context. If any of the GPUs being used by the current OpenGL
|
| 114 |
+
* context are not CUDA capable then the call will return ::cudaErrorNoDevice.
|
| 115 |
+
*
|
| 116 |
+
* \param pCudaDeviceCount - Returned number of CUDA devices corresponding to the
|
| 117 |
+
* current OpenGL context
|
| 118 |
+
* \param pCudaDevices - Returned CUDA devices corresponding to the current
|
| 119 |
+
* OpenGL context
|
| 120 |
+
* \param cudaDeviceCount - The size of the output device array \p pCudaDevices
|
| 121 |
+
* \param deviceList - The set of devices to return. This set may be
|
| 122 |
+
* ::cudaGLDeviceListAll for all devices,
|
| 123 |
+
* ::cudaGLDeviceListCurrentFrame for the devices used to
|
| 124 |
+
* render the current frame (in SLI), or
|
| 125 |
+
* ::cudaGLDeviceListNextFrame for the devices used to
|
| 126 |
+
* render the next frame (in SLI).
|
| 127 |
+
*
|
| 128 |
+
* \return
|
| 129 |
+
* ::cudaSuccess,
|
| 130 |
+
* ::cudaErrorNoDevice,
|
| 131 |
+
* ::cudaErrorInvalidGraphicsContext,
|
| 132 |
+
* ::cudaErrorOperatingSystem,
|
| 133 |
+
* ::cudaErrorUnknown
|
| 134 |
+
*
|
| 135 |
+
* \note This function is not supported on Mac OS X.
|
| 136 |
+
* \notefnerr
|
| 137 |
+
*
|
| 138 |
+
* \sa
|
| 139 |
+
* ::cudaGraphicsUnregisterResource,
|
| 140 |
+
* ::cudaGraphicsMapResources,
|
| 141 |
+
* ::cudaGraphicsSubResourceGetMappedArray,
|
| 142 |
+
* ::cudaGraphicsResourceGetMappedPointer,
|
| 143 |
+
* ::cuGLGetDevices
|
| 144 |
+
*/
|
| 145 |
+
extern __host__ cudaError_t CUDARTAPI cudaGLGetDevices(unsigned int *pCudaDeviceCount, int *pCudaDevices, unsigned int cudaDeviceCount, enum cudaGLDeviceList deviceList);
|
| 146 |
+
|
| 147 |
+
/**
|
| 148 |
+
* \brief Register an OpenGL texture or renderbuffer object
|
| 149 |
+
*
|
| 150 |
+
* Registers the texture or renderbuffer object specified by \p image for access by CUDA.
|
| 151 |
+
* A handle to the registered object is returned as \p resource.
|
| 152 |
+
*
|
| 153 |
+
* \p target must match the type of the object, and must be one of ::GL_TEXTURE_2D,
|
| 154 |
+
* ::GL_TEXTURE_RECTANGLE, ::GL_TEXTURE_CUBE_MAP, ::GL_TEXTURE_3D, ::GL_TEXTURE_2D_ARRAY,
|
| 155 |
+
* or ::GL_RENDERBUFFER.
|
| 156 |
+
*
|
| 157 |
+
* The register flags \p flags specify the intended usage, as follows:
|
| 158 |
+
* - ::cudaGraphicsRegisterFlagsNone: Specifies no hints about how this
|
| 159 |
+
* resource will be used. It is therefore assumed that this resource will be
|
| 160 |
+
* read from and written to by CUDA. This is the default value.
|
| 161 |
+
* - ::cudaGraphicsRegisterFlagsReadOnly: Specifies that CUDA
|
| 162 |
+
* will not write to this resource.
|
| 163 |
+
* - ::cudaGraphicsRegisterFlagsWriteDiscard: Specifies that
|
| 164 |
+
* CUDA will not read from this resource and will write over the
|
| 165 |
+
* entire contents of the resource, so none of the data previously
|
| 166 |
+
* stored in the resource will be preserved.
|
| 167 |
+
* - ::cudaGraphicsRegisterFlagsSurfaceLoadStore: Specifies that CUDA will
|
| 168 |
+
* bind this resource to a surface reference.
|
| 169 |
+
* - ::cudaGraphicsRegisterFlagsTextureGather: Specifies that CUDA will perform
|
| 170 |
+
* texture gather operations on this resource.
|
| 171 |
+
*
|
| 172 |
+
* The following image formats are supported. For brevity's sake, the list is abbreviated.
|
| 173 |
+
* For ex., {GL_R, GL_RG} X {8, 16} would expand to the following 4 formats
|
| 174 |
+
* {GL_R8, GL_R16, GL_RG8, GL_RG16} :
|
| 175 |
+
* - GL_RED, GL_RG, GL_RGBA, GL_LUMINANCE, GL_ALPHA, GL_LUMINANCE_ALPHA, GL_INTENSITY
|
| 176 |
+
* - {GL_R, GL_RG, GL_RGBA} X {8, 16, 16F, 32F, 8UI, 16UI, 32UI, 8I, 16I, 32I}
|
| 177 |
+
* - {GL_LUMINANCE, GL_ALPHA, GL_LUMINANCE_ALPHA, GL_INTENSITY} X
|
| 178 |
+
* {8, 16, 16F_ARB, 32F_ARB, 8UI_EXT, 16UI_EXT, 32UI_EXT, 8I_EXT, 16I_EXT, 32I_EXT}
|
| 179 |
+
*
|
| 180 |
+
* The following image classes are currently disallowed:
|
| 181 |
+
* - Textures with borders
|
| 182 |
+
* - Multisampled renderbuffers
|
| 183 |
+
*
|
| 184 |
+
* \param resource - Pointer to the returned object handle
|
| 185 |
+
* \param image - name of texture or renderbuffer object to be registered
|
| 186 |
+
* \param target - Identifies the type of object specified by \p image
|
| 187 |
+
* \param flags - Register flags
|
| 188 |
+
*
|
| 189 |
+
* \return
|
| 190 |
+
* ::cudaSuccess,
|
| 191 |
+
* ::cudaErrorInvalidDevice,
|
| 192 |
+
* ::cudaErrorInvalidValue,
|
| 193 |
+
* ::cudaErrorInvalidResourceHandle,
|
| 194 |
+
* ::cudaErrorOperatingSystem,
|
| 195 |
+
* ::cudaErrorUnknown
|
| 196 |
+
* \notefnerr
|
| 197 |
+
*
|
| 198 |
+
* \sa
|
| 199 |
+
* ::cudaGraphicsUnregisterResource,
|
| 200 |
+
* ::cudaGraphicsMapResources,
|
| 201 |
+
* ::cudaGraphicsSubResourceGetMappedArray,
|
| 202 |
+
* ::cuGraphicsGLRegisterImage
|
| 203 |
+
*/
|
| 204 |
+
extern __host__ cudaError_t CUDARTAPI cudaGraphicsGLRegisterImage(struct cudaGraphicsResource **resource, GLuint image, GLenum target, unsigned int flags);
|
| 205 |
+
|
| 206 |
+
/**
|
| 207 |
+
* \brief Registers an OpenGL buffer object
|
| 208 |
+
*
|
| 209 |
+
* Registers the buffer object specified by \p buffer for access by
|
| 210 |
+
* CUDA. A handle to the registered object is returned as \p
|
| 211 |
+
* resource. The register flags \p flags specify the intended usage,
|
| 212 |
+
* as follows:
|
| 213 |
+
*
|
| 214 |
+
* - ::cudaGraphicsRegisterFlagsNone: Specifies no hints about how this
|
| 215 |
+
* resource will be used. It is therefore assumed that this resource will be
|
| 216 |
+
* read from and written to by CUDA. This is the default value.
|
| 217 |
+
* - ::cudaGraphicsRegisterFlagsReadOnly: Specifies that CUDA
|
| 218 |
+
* will not write to this resource.
|
| 219 |
+
* - ::cudaGraphicsRegisterFlagsWriteDiscard: Specifies that
|
| 220 |
+
* CUDA will not read from this resource and will write over the
|
| 221 |
+
* entire contents of the resource, so none of the data previously
|
| 222 |
+
* stored in the resource will be preserved.
|
| 223 |
+
*
|
| 224 |
+
* \param resource - Pointer to the returned object handle
|
| 225 |
+
* \param buffer - name of buffer object to be registered
|
| 226 |
+
* \param flags - Register flags
|
| 227 |
+
*
|
| 228 |
+
* \return
|
| 229 |
+
* ::cudaSuccess,
|
| 230 |
+
* ::cudaErrorInvalidDevice,
|
| 231 |
+
* ::cudaErrorInvalidValue,
|
| 232 |
+
* ::cudaErrorInvalidResourceHandle,
|
| 233 |
+
* ::cudaErrorOperatingSystem,
|
| 234 |
+
* ::cudaErrorUnknown
|
| 235 |
+
* \notefnerr
|
| 236 |
+
*
|
| 237 |
+
* \sa
|
| 238 |
+
* ::cudaGraphicsUnregisterResource,
|
| 239 |
+
* ::cudaGraphicsMapResources,
|
| 240 |
+
* ::cudaGraphicsResourceGetMappedPointer,
|
| 241 |
+
* ::cuGraphicsGLRegisterBuffer
|
| 242 |
+
*/
|
| 243 |
+
extern __host__ cudaError_t CUDARTAPI cudaGraphicsGLRegisterBuffer(struct cudaGraphicsResource **resource, GLuint buffer, unsigned int flags);
|
| 244 |
+
|
| 245 |
+
#ifdef _WIN32
|
| 246 |
+
#ifndef WGL_NV_gpu_affinity
|
| 247 |
+
typedef void* HGPUNV;
|
| 248 |
+
#endif
|
| 249 |
+
|
| 250 |
+
/**
|
| 251 |
+
* \brief Gets the CUDA device associated with hGpu
|
| 252 |
+
*
|
| 253 |
+
* Returns the CUDA device associated with a hGpu, if applicable.
|
| 254 |
+
*
|
| 255 |
+
* \param device - Returns the device associated with hGpu, or -1 if hGpu is
|
| 256 |
+
* not a compute device.
|
| 257 |
+
* \param hGpu - Handle to a GPU, as queried via WGL_NV_gpu_affinity
|
| 258 |
+
*
|
| 259 |
+
* \return
|
| 260 |
+
* ::cudaSuccess
|
| 261 |
+
* \notefnerr
|
| 262 |
+
*
|
| 263 |
+
* \sa
|
| 264 |
+
* ::WGL_NV_gpu_affinity,
|
| 265 |
+
* ::cuWGLGetDevice
|
| 266 |
+
*/
|
| 267 |
+
extern __host__ cudaError_t CUDARTAPI cudaWGLGetDevice(int *device, HGPUNV hGpu);
|
| 268 |
+
#endif
|
| 269 |
+
|
| 270 |
+
/** @} */ /* END CUDART_OPENGL */
|
| 271 |
+
|
| 272 |
+
/**
|
| 273 |
+
* \addtogroup CUDART_OPENGL_DEPRECATED OpenGL Interoperability [DEPRECATED]
|
| 274 |
+
* This section describes deprecated OpenGL interoperability functionality.
|
| 275 |
+
*
|
| 276 |
+
* @{
|
| 277 |
+
*/
|
| 278 |
+
|
| 279 |
+
/**
|
| 280 |
+
* CUDA GL Map Flags
|
| 281 |
+
*/
|
| 282 |
+
enum cudaGLMapFlags
|
| 283 |
+
{
|
| 284 |
+
cudaGLMapFlagsNone = 0, /**< Default; Assume resource can be read/written */
|
| 285 |
+
cudaGLMapFlagsReadOnly = 1, /**< CUDA kernels will not write to this resource */
|
| 286 |
+
cudaGLMapFlagsWriteDiscard = 2 /**< CUDA kernels will only write to and will not read from this resource */
|
| 287 |
+
};
|
| 288 |
+
|
| 289 |
+
/**
|
| 290 |
+
* \brief Sets a CUDA device to use OpenGL interoperability
|
| 291 |
+
*
|
| 292 |
+
* \deprecated This function is deprecated as of CUDA 5.0.
|
| 293 |
+
*
|
| 294 |
+
* This function is deprecated and should no longer be used. It is
|
| 295 |
+
* no longer necessary to associate a CUDA device with an OpenGL
|
| 296 |
+
* context in order to achieve maximum interoperability performance.
|
| 297 |
+
*
|
| 298 |
+
* This function will immediately initialize the primary context on
|
| 299 |
+
* \p device if needed.
|
| 300 |
+
*
|
| 301 |
+
* \param device - Device to use for OpenGL interoperability
|
| 302 |
+
*
|
| 303 |
+
* \return
|
| 304 |
+
* ::cudaSuccess,
|
| 305 |
+
* ::cudaErrorInvalidDevice,
|
| 306 |
+
* ::cudaErrorSetOnActiveProcess
|
| 307 |
+
* \notefnerr
|
| 308 |
+
*
|
| 309 |
+
* \sa ::cudaGraphicsGLRegisterBuffer, ::cudaGraphicsGLRegisterImage
|
| 310 |
+
*/
|
| 311 |
+
extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGLSetGLDevice(int device);
|
| 312 |
+
|
| 313 |
+
/**
|
| 314 |
+
* \brief Registers a buffer object for access by CUDA
|
| 315 |
+
*
|
| 316 |
+
* \deprecated This function is deprecated as of CUDA 3.0.
|
| 317 |
+
*
|
| 318 |
+
* Registers the buffer object of ID \p bufObj for access by
|
| 319 |
+
* CUDA. This function must be called before CUDA can map the buffer
|
| 320 |
+
* object. The OpenGL context used to create the buffer, or another
|
| 321 |
+
* context from the same share group, must be bound to the current
|
| 322 |
+
* thread when this is called.
|
| 323 |
+
*
|
| 324 |
+
* \param bufObj - Buffer object ID to register
|
| 325 |
+
*
|
| 326 |
+
* \return
|
| 327 |
+
* ::cudaSuccess,
|
| 328 |
+
* ::cudaErrorInitializationError
|
| 329 |
+
* \notefnerr
|
| 330 |
+
*
|
| 331 |
+
* \sa ::cudaGraphicsGLRegisterBuffer
|
| 332 |
+
*/
|
| 333 |
+
extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGLRegisterBufferObject(GLuint bufObj);
|
| 334 |
+
|
| 335 |
+
/**
|
| 336 |
+
* \brief Maps a buffer object for access by CUDA
|
| 337 |
+
*
|
| 338 |
+
* \deprecated This function is deprecated as of CUDA 3.0.
|
| 339 |
+
*
|
| 340 |
+
* Maps the buffer object of ID \p bufObj into the address space of
|
| 341 |
+
* CUDA and returns in \p *devPtr the base pointer of the resulting
|
| 342 |
+
* mapping. The buffer must have previously been registered by
|
| 343 |
+
* calling ::cudaGLRegisterBufferObject(). While a buffer is mapped
|
| 344 |
+
* by CUDA, any OpenGL operation which references the buffer will
|
| 345 |
+
* result in undefined behavior. The OpenGL context used to create
|
| 346 |
+
* the buffer, or another context from the same share group, must be
|
| 347 |
+
* bound to the current thread when this is called.
|
| 348 |
+
*
|
| 349 |
+
* All streams in the current thread are synchronized with the current
|
| 350 |
+
* GL context.
|
| 351 |
+
*
|
| 352 |
+
* \param devPtr - Returned device pointer to CUDA object
|
| 353 |
+
* \param bufObj - Buffer object ID to map
|
| 354 |
+
*
|
| 355 |
+
* \return
|
| 356 |
+
* ::cudaSuccess,
|
| 357 |
+
* ::cudaErrorMapBufferObjectFailed
|
| 358 |
+
* \notefnerr
|
| 359 |
+
*
|
| 360 |
+
* \sa ::cudaGraphicsMapResources
|
| 361 |
+
*/
|
| 362 |
+
extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGLMapBufferObject(void **devPtr, GLuint bufObj);
|
| 363 |
+
|
| 364 |
+
/**
|
| 365 |
+
* \brief Unmaps a buffer object for access by CUDA
|
| 366 |
+
*
|
| 367 |
+
* \deprecated This function is deprecated as of CUDA 3.0.
|
| 368 |
+
*
|
| 369 |
+
* Unmaps the buffer object of ID \p bufObj for access by CUDA. When
|
| 370 |
+
* a buffer is unmapped, the base address returned by
|
| 371 |
+
* ::cudaGLMapBufferObject() is invalid and subsequent references to
|
| 372 |
+
* the address result in undefined behavior. The OpenGL context used
|
| 373 |
+
* to create the buffer, or another context from the same share group,
|
| 374 |
+
* must be bound to the current thread when this is called.
|
| 375 |
+
*
|
| 376 |
+
* All streams in the current thread are synchronized with the current
|
| 377 |
+
* GL context.
|
| 378 |
+
*
|
| 379 |
+
* \param bufObj - Buffer object to unmap
|
| 380 |
+
*
|
| 381 |
+
* \return
|
| 382 |
+
* ::cudaSuccess,
|
| 383 |
+
* ::cudaErrorUnmapBufferObjectFailed
|
| 384 |
+
* \notefnerr
|
| 385 |
+
*
|
| 386 |
+
* \sa ::cudaGraphicsUnmapResources
|
| 387 |
+
*/
|
| 388 |
+
extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGLUnmapBufferObject(GLuint bufObj);
|
| 389 |
+
|
| 390 |
+
/**
|
| 391 |
+
* \brief Unregisters a buffer object for access by CUDA
|
| 392 |
+
*
|
| 393 |
+
* \deprecated This function is deprecated as of CUDA 3.0.
|
| 394 |
+
*
|
| 395 |
+
* Unregisters the buffer object of ID \p bufObj for access by CUDA
|
| 396 |
+
* and releases any CUDA resources associated with the buffer. Once a
|
| 397 |
+
* buffer is unregistered, it may no longer be mapped by CUDA. The GL
|
| 398 |
+
* context used to create the buffer, or another context from the
|
| 399 |
+
* same share group, must be bound to the current thread when this is
|
| 400 |
+
* called.
|
| 401 |
+
*
|
| 402 |
+
* \param bufObj - Buffer object to unregister
|
| 403 |
+
*
|
| 404 |
+
* \return
|
| 405 |
+
* ::cudaSuccess
|
| 406 |
+
* \notefnerr
|
| 407 |
+
*
|
| 408 |
+
* \sa ::cudaGraphicsUnregisterResource
|
| 409 |
+
*/
|
| 410 |
+
extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGLUnregisterBufferObject(GLuint bufObj);
|
| 411 |
+
|
| 412 |
+
/**
|
| 413 |
+
* \brief Set usage flags for mapping an OpenGL buffer
|
| 414 |
+
*
|
| 415 |
+
* \deprecated This function is deprecated as of CUDA 3.0.
|
| 416 |
+
*
|
| 417 |
+
* Set flags for mapping the OpenGL buffer \p bufObj
|
| 418 |
+
*
|
| 419 |
+
* Changes to flags will take effect the next time \p bufObj is mapped.
|
| 420 |
+
* The \p flags argument may be any of the following:
|
| 421 |
+
*
|
| 422 |
+
* - ::cudaGLMapFlagsNone: Specifies no hints about how this buffer will
|
| 423 |
+
* be used. It is therefore assumed that this buffer will be read from and
|
| 424 |
+
* written to by CUDA kernels. This is the default value.
|
| 425 |
+
* - ::cudaGLMapFlagsReadOnly: Specifies that CUDA kernels which access this
|
| 426 |
+
* buffer will not write to the buffer.
|
| 427 |
+
* - ::cudaGLMapFlagsWriteDiscard: Specifies that CUDA kernels which access
|
| 428 |
+
* this buffer will not read from the buffer and will write over the
|
| 429 |
+
* entire contents of the buffer, so none of the data previously stored in
|
| 430 |
+
* the buffer will be preserved.
|
| 431 |
+
*
|
| 432 |
+
* If \p bufObj has not been registered for use with CUDA, then
|
| 433 |
+
* ::cudaErrorInvalidResourceHandle is returned. If \p bufObj is presently
|
| 434 |
+
* mapped for access by CUDA, then ::cudaErrorUnknown is returned.
|
| 435 |
+
*
|
| 436 |
+
* \param bufObj - Registered buffer object to set flags for
|
| 437 |
+
* \param flags - Parameters for buffer mapping
|
| 438 |
+
*
|
| 439 |
+
* \return
|
| 440 |
+
* ::cudaSuccess,
|
| 441 |
+
* ::cudaErrorInvalidValue,
|
| 442 |
+
* ::cudaErrorInvalidResourceHandle,
|
| 443 |
+
* ::cudaErrorUnknown
|
| 444 |
+
* \notefnerr
|
| 445 |
+
*
|
| 446 |
+
* \sa ::cudaGraphicsResourceSetMapFlags
|
| 447 |
+
*/
|
| 448 |
+
extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGLSetBufferObjectMapFlags(GLuint bufObj, unsigned int flags);
|
| 449 |
+
|
| 450 |
+
/**
|
| 451 |
+
* \brief Maps a buffer object for access by CUDA
|
| 452 |
+
*
|
| 453 |
+
* \deprecated This function is deprecated as of CUDA 3.0.
|
| 454 |
+
*
|
| 455 |
+
* Maps the buffer object of ID \p bufObj into the address space of
|
| 456 |
+
* CUDA and returns in \p *devPtr the base pointer of the resulting
|
| 457 |
+
* mapping. The buffer must have previously been registered by
|
| 458 |
+
* calling ::cudaGLRegisterBufferObject(). While a buffer is mapped
|
| 459 |
+
* by CUDA, any OpenGL operation which references the buffer will
|
| 460 |
+
* result in undefined behavior. The OpenGL context used to create
|
| 461 |
+
* the buffer, or another context from the same share group, must be
|
| 462 |
+
* bound to the current thread when this is called.
|
| 463 |
+
*
|
| 464 |
+
* Stream /p stream is synchronized with the current GL context.
|
| 465 |
+
*
|
| 466 |
+
* \param devPtr - Returned device pointer to CUDA object
|
| 467 |
+
* \param bufObj - Buffer object ID to map
|
| 468 |
+
* \param stream - Stream to synchronize
|
| 469 |
+
*
|
| 470 |
+
* \return
|
| 471 |
+
* ::cudaSuccess,
|
| 472 |
+
* ::cudaErrorMapBufferObjectFailed
|
| 473 |
+
* \notefnerr
|
| 474 |
+
*
|
| 475 |
+
* \sa ::cudaGraphicsMapResources
|
| 476 |
+
*/
|
| 477 |
+
extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGLMapBufferObjectAsync(void **devPtr, GLuint bufObj, cudaStream_t stream);
|
| 478 |
+
|
| 479 |
+
/**
|
| 480 |
+
* \brief Unmaps a buffer object for access by CUDA
|
| 481 |
+
*
|
| 482 |
+
* \deprecated This function is deprecated as of CUDA 3.0.
|
| 483 |
+
*
|
| 484 |
+
* Unmaps the buffer object of ID \p bufObj for access by CUDA. When
|
| 485 |
+
* a buffer is unmapped, the base address returned by
|
| 486 |
+
* ::cudaGLMapBufferObject() is invalid and subsequent references to
|
| 487 |
+
* the address result in undefined behavior. The OpenGL context used
|
| 488 |
+
* to create the buffer, or another context from the same share group,
|
| 489 |
+
* must be bound to the current thread when this is called.
|
| 490 |
+
*
|
| 491 |
+
* Stream /p stream is synchronized with the current GL context.
|
| 492 |
+
*
|
| 493 |
+
* \param bufObj - Buffer object to unmap
|
| 494 |
+
* \param stream - Stream to synchronize
|
| 495 |
+
*
|
| 496 |
+
* \return
|
| 497 |
+
* ::cudaSuccess,
|
| 498 |
+
* ::cudaErrorUnmapBufferObjectFailed
|
| 499 |
+
* \notefnerr
|
| 500 |
+
*
|
| 501 |
+
* \sa ::cudaGraphicsUnmapResources
|
| 502 |
+
*/
|
| 503 |
+
extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGLUnmapBufferObjectAsync(GLuint bufObj, cudaStream_t stream);
|
| 504 |
+
|
| 505 |
+
/** @} */ /* END CUDART_OPENGL_DEPRECATED */
|
| 506 |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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2011-2020 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(_CUPTI_METRIC_H_)
|
| 51 |
+
#define _CUPTI_METRIC_H_
|
| 52 |
+
|
| 53 |
+
#include <cuda.h>
|
| 54 |
+
#include <string.h>
|
| 55 |
+
#include <cuda_stdint.h>
|
| 56 |
+
#include <cupti_result.h>
|
| 57 |
+
|
| 58 |
+
#ifndef CUPTIAPI
|
| 59 |
+
#ifdef _WIN32
|
| 60 |
+
#define CUPTIAPI __stdcall
|
| 61 |
+
#else
|
| 62 |
+
#define CUPTIAPI
|
| 63 |
+
#endif
|
| 64 |
+
#endif
|
| 65 |
+
|
| 66 |
+
#if defined(__cplusplus)
|
| 67 |
+
extern "C" {
|
| 68 |
+
#endif
|
| 69 |
+
|
| 70 |
+
#if defined(__GNUC__) && defined(CUPTI_LIB)
|
| 71 |
+
#pragma GCC visibility push(default)
|
| 72 |
+
#endif
|
| 73 |
+
|
| 74 |
+
/**
|
| 75 |
+
* \defgroup CUPTI_METRIC_API CUPTI Metric API
|
| 76 |
+
* Functions, types, and enums that implement the CUPTI Metric API.
|
| 77 |
+
*
|
| 78 |
+
* \note CUPTI metric API from the header cupti_metrics.h are not supported on devices
|
| 79 |
+
* with compute capability 7.5 and higher (i.e. Turing and later GPU architectures).
|
| 80 |
+
* These API will be deprecated in a future CUDA release. These are replaced by
|
| 81 |
+
* Profiling API in the header cupti_profiler_target.h and Perfworks metrics API
|
| 82 |
+
* in the headers nvperf_host.h and nvperf_target.h which are supported on
|
| 83 |
+
* devices with compute capability 7.0 and higher (i.e. Volta and later GPU
|
| 84 |
+
* architectures).
|
| 85 |
+
*
|
| 86 |
+
* @{
|
| 87 |
+
*/
|
| 88 |
+
|
| 89 |
+
/**
|
| 90 |
+
* \brief ID for a metric.
|
| 91 |
+
*
|
| 92 |
+
* A metric provides a measure of some aspect of the device.
|
| 93 |
+
*/
|
| 94 |
+
typedef uint32_t CUpti_MetricID;
|
| 95 |
+
|
| 96 |
+
/**
|
| 97 |
+
* \brief A metric category.
|
| 98 |
+
*
|
| 99 |
+
* Each metric is assigned to a category that represents the general
|
| 100 |
+
* type of the metric. A metric's category is accessed using \ref
|
| 101 |
+
* cuptiMetricGetAttribute and the CUPTI_METRIC_ATTR_CATEGORY
|
| 102 |
+
* attribute.
|
| 103 |
+
*/
|
| 104 |
+
typedef enum {
|
| 105 |
+
/**
|
| 106 |
+
* A memory related metric.
|
| 107 |
+
*/
|
| 108 |
+
CUPTI_METRIC_CATEGORY_MEMORY = 0,
|
| 109 |
+
/**
|
| 110 |
+
* An instruction related metric.
|
| 111 |
+
*/
|
| 112 |
+
CUPTI_METRIC_CATEGORY_INSTRUCTION = 1,
|
| 113 |
+
/**
|
| 114 |
+
* A multiprocessor related metric.
|
| 115 |
+
*/
|
| 116 |
+
CUPTI_METRIC_CATEGORY_MULTIPROCESSOR = 2,
|
| 117 |
+
/**
|
| 118 |
+
* A cache related metric.
|
| 119 |
+
*/
|
| 120 |
+
CUPTI_METRIC_CATEGORY_CACHE = 3,
|
| 121 |
+
/**
|
| 122 |
+
* A texture related metric.
|
| 123 |
+
*/
|
| 124 |
+
CUPTI_METRIC_CATEGORY_TEXTURE = 4,
|
| 125 |
+
/**
|
| 126 |
+
*A Nvlink related metric.
|
| 127 |
+
*/
|
| 128 |
+
CUPTI_METRIC_CATEGORY_NVLINK = 5,
|
| 129 |
+
/**
|
| 130 |
+
*A PCIe related metric.
|
| 131 |
+
*/
|
| 132 |
+
CUPTI_METRIC_CATEGORY_PCIE = 6,
|
| 133 |
+
CUPTI_METRIC_CATEGORY_FORCE_INT = 0x7fffffff,
|
| 134 |
+
} CUpti_MetricCategory;
|
| 135 |
+
|
| 136 |
+
/**
|
| 137 |
+
* \brief A metric evaluation mode.
|
| 138 |
+
*
|
| 139 |
+
* A metric can be evaluated per hardware instance to know the load balancing
|
| 140 |
+
* across instances of a domain or the metric can be evaluated in aggregate mode
|
| 141 |
+
* when the events involved in metric evaluation are from different event
|
| 142 |
+
* domains. It might be possible to evaluate some metrics in both
|
| 143 |
+
* modes for convenience. A metric's evaluation mode is accessed using \ref
|
| 144 |
+
* CUpti_MetricEvaluationMode and the CUPTI_METRIC_ATTR_EVALUATION_MODE
|
| 145 |
+
* attribute.
|
| 146 |
+
*/
|
| 147 |
+
typedef enum {
|
| 148 |
+
/**
|
| 149 |
+
* If this bit is set, the metric can be profiled for each instance of the
|
| 150 |
+
* domain. The event values passed to \ref cuptiMetricGetValue can contain
|
| 151 |
+
* values for one instance of the domain. And \ref cuptiMetricGetValue can
|
| 152 |
+
* be called for each instance.
|
| 153 |
+
*/
|
| 154 |
+
CUPTI_METRIC_EVALUATION_MODE_PER_INSTANCE = 1,
|
| 155 |
+
/**
|
| 156 |
+
* If this bit is set, the metric can be profiled over all instances. The
|
| 157 |
+
* event values passed to \ref cuptiMetricGetValue can be aggregated values
|
| 158 |
+
* of events for all instances of the domain.
|
| 159 |
+
*/
|
| 160 |
+
CUPTI_METRIC_EVALUATION_MODE_AGGREGATE = 1 << 1,
|
| 161 |
+
CUPTI_METRIC_EVALUATION_MODE_FORCE_INT = 0x7fffffff,
|
| 162 |
+
} CUpti_MetricEvaluationMode;
|
| 163 |
+
|
| 164 |
+
/**
|
| 165 |
+
* \brief Kinds of metric values.
|
| 166 |
+
*
|
| 167 |
+
* Metric values can be one of several different kinds. Corresponding
|
| 168 |
+
* to each kind is a member of the CUpti_MetricValue union. The metric
|
| 169 |
+
* value returned by \ref cuptiMetricGetValue should be accessed using
|
| 170 |
+
* the appropriate member of that union based on its value kind.
|
| 171 |
+
*/
|
| 172 |
+
typedef enum {
|
| 173 |
+
/**
|
| 174 |
+
* The metric value is a 64-bit double.
|
| 175 |
+
*/
|
| 176 |
+
CUPTI_METRIC_VALUE_KIND_DOUBLE = 0,
|
| 177 |
+
/**
|
| 178 |
+
* The metric value is a 64-bit unsigned integer.
|
| 179 |
+
*/
|
| 180 |
+
CUPTI_METRIC_VALUE_KIND_UINT64 = 1,
|
| 181 |
+
/**
|
| 182 |
+
* The metric value is a percentage represented by a 64-bit
|
| 183 |
+
* double. For example, 57.5% is represented by the value 57.5.
|
| 184 |
+
*/
|
| 185 |
+
CUPTI_METRIC_VALUE_KIND_PERCENT = 2,
|
| 186 |
+
/**
|
| 187 |
+
* The metric value is a throughput represented by a 64-bit
|
| 188 |
+
* integer. The unit for throughput values is bytes/second.
|
| 189 |
+
*/
|
| 190 |
+
CUPTI_METRIC_VALUE_KIND_THROUGHPUT = 3,
|
| 191 |
+
/**
|
| 192 |
+
* The metric value is a 64-bit signed integer.
|
| 193 |
+
*/
|
| 194 |
+
CUPTI_METRIC_VALUE_KIND_INT64 = 4,
|
| 195 |
+
/**
|
| 196 |
+
* The metric value is a utilization level, as represented by
|
| 197 |
+
* CUpti_MetricValueUtilizationLevel.
|
| 198 |
+
*/
|
| 199 |
+
CUPTI_METRIC_VALUE_KIND_UTILIZATION_LEVEL = 5,
|
| 200 |
+
|
| 201 |
+
CUPTI_METRIC_VALUE_KIND_FORCE_INT = 0x7fffffff
|
| 202 |
+
} CUpti_MetricValueKind;
|
| 203 |
+
|
| 204 |
+
/**
|
| 205 |
+
* \brief Enumeration of utilization levels for metrics values of kind
|
| 206 |
+
* CUPTI_METRIC_VALUE_KIND_UTILIZATION_LEVEL. Utilization values can
|
| 207 |
+
* vary from IDLE (0) to MAX (10) but the enumeration only provides
|
| 208 |
+
* specific names for a few values.
|
| 209 |
+
*/
|
| 210 |
+
typedef enum {
|
| 211 |
+
CUPTI_METRIC_VALUE_UTILIZATION_IDLE = 0,
|
| 212 |
+
CUPTI_METRIC_VALUE_UTILIZATION_LOW = 2,
|
| 213 |
+
CUPTI_METRIC_VALUE_UTILIZATION_MID = 5,
|
| 214 |
+
CUPTI_METRIC_VALUE_UTILIZATION_HIGH = 8,
|
| 215 |
+
CUPTI_METRIC_VALUE_UTILIZATION_MAX = 10,
|
| 216 |
+
CUPTI_METRIC_VALUE_UTILIZATION_FORCE_INT = 0x7fffffff
|
| 217 |
+
} CUpti_MetricValueUtilizationLevel;
|
| 218 |
+
|
| 219 |
+
/**
|
| 220 |
+
* \brief Metric attributes.
|
| 221 |
+
*
|
| 222 |
+
* Metric attributes describe properties of a metric. These attributes
|
| 223 |
+
* can be read using \ref cuptiMetricGetAttribute.
|
| 224 |
+
*/
|
| 225 |
+
typedef enum {
|
| 226 |
+
/**
|
| 227 |
+
* Metric name. Value is a null terminated const c-string.
|
| 228 |
+
*/
|
| 229 |
+
CUPTI_METRIC_ATTR_NAME = 0,
|
| 230 |
+
/**
|
| 231 |
+
* Short description of metric. Value is a null terminated const c-string.
|
| 232 |
+
*/
|
| 233 |
+
CUPTI_METRIC_ATTR_SHORT_DESCRIPTION = 1,
|
| 234 |
+
/**
|
| 235 |
+
* Long description of metric. Value is a null terminated const c-string.
|
| 236 |
+
*/
|
| 237 |
+
CUPTI_METRIC_ATTR_LONG_DESCRIPTION = 2,
|
| 238 |
+
/**
|
| 239 |
+
* Category of the metric. Value is of type CUpti_MetricCategory.
|
| 240 |
+
*/
|
| 241 |
+
CUPTI_METRIC_ATTR_CATEGORY = 3,
|
| 242 |
+
/**
|
| 243 |
+
* Value type of the metric. Value is of type CUpti_MetricValueKind.
|
| 244 |
+
*/
|
| 245 |
+
CUPTI_METRIC_ATTR_VALUE_KIND = 4,
|
| 246 |
+
/**
|
| 247 |
+
* Metric evaluation mode. Value is of type CUpti_MetricEvaluationMode.
|
| 248 |
+
*/
|
| 249 |
+
CUPTI_METRIC_ATTR_EVALUATION_MODE = 5,
|
| 250 |
+
CUPTI_METRIC_ATTR_FORCE_INT = 0x7fffffff,
|
| 251 |
+
} CUpti_MetricAttribute;
|
| 252 |
+
|
| 253 |
+
/**
|
| 254 |
+
* \brief A metric value.
|
| 255 |
+
*
|
| 256 |
+
* Metric values can be one of several different kinds. Corresponding
|
| 257 |
+
* to each kind is a member of the CUpti_MetricValue union. The metric
|
| 258 |
+
* value returned by \ref cuptiMetricGetValue should be accessed using
|
| 259 |
+
* the appropriate member of that union based on its value kind.
|
| 260 |
+
*/
|
| 261 |
+
typedef union {
|
| 262 |
+
/*
|
| 263 |
+
* Value for CUPTI_METRIC_VALUE_KIND_DOUBLE.
|
| 264 |
+
*/
|
| 265 |
+
double metricValueDouble;
|
| 266 |
+
/*
|
| 267 |
+
* Value for CUPTI_METRIC_VALUE_KIND_UINT64.
|
| 268 |
+
*/
|
| 269 |
+
uint64_t metricValueUint64;
|
| 270 |
+
/*
|
| 271 |
+
* Value for CUPTI_METRIC_VALUE_KIND_INT64.
|
| 272 |
+
*/
|
| 273 |
+
int64_t metricValueInt64;
|
| 274 |
+
/*
|
| 275 |
+
* Value for CUPTI_METRIC_VALUE_KIND_PERCENT. For example, 57.5% is
|
| 276 |
+
* represented by the value 57.5.
|
| 277 |
+
*/
|
| 278 |
+
double metricValuePercent;
|
| 279 |
+
/*
|
| 280 |
+
* Value for CUPTI_METRIC_VALUE_KIND_THROUGHPUT. The unit for
|
| 281 |
+
* throughput values is bytes/second.
|
| 282 |
+
*/
|
| 283 |
+
uint64_t metricValueThroughput;
|
| 284 |
+
/*
|
| 285 |
+
* Value for CUPTI_METRIC_VALUE_KIND_UTILIZATION_LEVEL.
|
| 286 |
+
*/
|
| 287 |
+
CUpti_MetricValueUtilizationLevel metricValueUtilizationLevel;
|
| 288 |
+
} CUpti_MetricValue;
|
| 289 |
+
|
| 290 |
+
/**
|
| 291 |
+
* \brief Device class.
|
| 292 |
+
*
|
| 293 |
+
* Enumeration of device classes for metric property
|
| 294 |
+
* CUPTI_METRIC_PROPERTY_DEVICE_CLASS.
|
| 295 |
+
*/
|
| 296 |
+
typedef enum {
|
| 297 |
+
CUPTI_METRIC_PROPERTY_DEVICE_CLASS_TESLA = 0,
|
| 298 |
+
CUPTI_METRIC_PROPERTY_DEVICE_CLASS_QUADRO = 1,
|
| 299 |
+
CUPTI_METRIC_PROPERTY_DEVICE_CLASS_GEFORCE = 2,
|
| 300 |
+
CUPTI_METRIC_PROPERTY_DEVICE_CLASS_TEGRA = 3,
|
| 301 |
+
} CUpti_MetricPropertyDeviceClass;
|
| 302 |
+
|
| 303 |
+
/**
|
| 304 |
+
* \brief Metric device properties.
|
| 305 |
+
*
|
| 306 |
+
* Metric device properties describe device properties which are needed for a metric.
|
| 307 |
+
* Some of these properties can be collected using cuDeviceGetAttribute.
|
| 308 |
+
*/
|
| 309 |
+
typedef enum {
|
| 310 |
+
/*
|
| 311 |
+
* Number of multiprocessors on a device. This can be collected
|
| 312 |
+
* using value of \param CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT of
|
| 313 |
+
* cuDeviceGetAttribute.
|
| 314 |
+
*/
|
| 315 |
+
CUPTI_METRIC_PROPERTY_MULTIPROCESSOR_COUNT,
|
| 316 |
+
/*
|
| 317 |
+
* Maximum number of warps on a multiprocessor. This can be
|
| 318 |
+
* collected using ratio of value of \param
|
| 319 |
+
* CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR and \param
|
| 320 |
+
* CU_DEVICE_ATTRIBUTE_WARP_SIZE of cuDeviceGetAttribute.
|
| 321 |
+
*/
|
| 322 |
+
CUPTI_METRIC_PROPERTY_WARPS_PER_MULTIPROCESSOR,
|
| 323 |
+
/*
|
| 324 |
+
* GPU Time for kernel in ns. This should be profiled using CUPTI
|
| 325 |
+
* Activity API.
|
| 326 |
+
*/
|
| 327 |
+
CUPTI_METRIC_PROPERTY_KERNEL_GPU_TIME,
|
| 328 |
+
/*
|
| 329 |
+
* Clock rate for device in KHz. This should be collected using
|
| 330 |
+
* value of \param CU_DEVICE_ATTRIBUTE_CLOCK_RATE of
|
| 331 |
+
* cuDeviceGetAttribute.
|
| 332 |
+
*/
|
| 333 |
+
CUPTI_METRIC_PROPERTY_CLOCK_RATE,
|
| 334 |
+
/*
|
| 335 |
+
* Number of Frame buffer units for device. This should be collected
|
| 336 |
+
* using value of \param CUPTI_DEVICE_ATTRIBUTE_MAX_FRAME_BUFFERS of
|
| 337 |
+
* cuptiDeviceGetAttribute.
|
| 338 |
+
*/
|
| 339 |
+
CUPTI_METRIC_PROPERTY_FRAME_BUFFER_COUNT,
|
| 340 |
+
/*
|
| 341 |
+
* Global memory bandwidth in KBytes/sec. This should be collected
|
| 342 |
+
* using value of \param CUPTI_DEVICE_ATTR_GLOBAL_MEMORY_BANDWIDTH
|
| 343 |
+
* of cuptiDeviceGetAttribute.
|
| 344 |
+
*/
|
| 345 |
+
CUPTI_METRIC_PROPERTY_GLOBAL_MEMORY_BANDWIDTH,
|
| 346 |
+
/*
|
| 347 |
+
* PCIE link rate in Mega bits/sec. This should be collected using
|
| 348 |
+
* value of \param CUPTI_DEVICE_ATTR_PCIE_LINK_RATE of
|
| 349 |
+
* cuptiDeviceGetAttribute.
|
| 350 |
+
*/
|
| 351 |
+
CUPTI_METRIC_PROPERTY_PCIE_LINK_RATE,
|
| 352 |
+
/*
|
| 353 |
+
* PCIE link width for device. This should be collected using
|
| 354 |
+
* value of \param CUPTI_DEVICE_ATTR_PCIE_LINK_WIDTH of
|
| 355 |
+
* cuptiDeviceGetAttribute.
|
| 356 |
+
*/
|
| 357 |
+
CUPTI_METRIC_PROPERTY_PCIE_LINK_WIDTH,
|
| 358 |
+
/*
|
| 359 |
+
* PCIE generation for device. This should be collected using
|
| 360 |
+
* value of \param CUPTI_DEVICE_ATTR_PCIE_GEN of
|
| 361 |
+
* cuptiDeviceGetAttribute.
|
| 362 |
+
*/
|
| 363 |
+
CUPTI_METRIC_PROPERTY_PCIE_GEN,
|
| 364 |
+
/*
|
| 365 |
+
* The device class. This should be collected using
|
| 366 |
+
* value of \param CUPTI_DEVICE_ATTR_DEVICE_CLASS of
|
| 367 |
+
* cuptiDeviceGetAttribute.
|
| 368 |
+
*/
|
| 369 |
+
CUPTI_METRIC_PROPERTY_DEVICE_CLASS,
|
| 370 |
+
/*
|
| 371 |
+
* Peak single precision floating point operations that
|
| 372 |
+
* can be performed in one cycle by the device.
|
| 373 |
+
* This should be collected using value of
|
| 374 |
+
* \param CUPTI_DEVICE_ATTR_FLOP_SP_PER_CYCLE of
|
| 375 |
+
* cuptiDeviceGetAttribute.
|
| 376 |
+
*/
|
| 377 |
+
CUPTI_METRIC_PROPERTY_FLOP_SP_PER_CYCLE,
|
| 378 |
+
/*
|
| 379 |
+
* Peak double precision floating point operations that
|
| 380 |
+
* can be performed in one cycle by the device.
|
| 381 |
+
* This should be collected using value of
|
| 382 |
+
* \param CUPTI_DEVICE_ATTR_FLOP_DP_PER_CYCLE of
|
| 383 |
+
* cuptiDeviceGetAttribute.
|
| 384 |
+
*/
|
| 385 |
+
CUPTI_METRIC_PROPERTY_FLOP_DP_PER_CYCLE,
|
| 386 |
+
/*
|
| 387 |
+
* Number of L2 units on a device. This can be collected
|
| 388 |
+
* using value of \param CUPTI_DEVICE_ATTR_MAX_L2_UNITS of
|
| 389 |
+
* cuDeviceGetAttribute.
|
| 390 |
+
*/
|
| 391 |
+
CUPTI_METRIC_PROPERTY_L2_UNITS,
|
| 392 |
+
/*
|
| 393 |
+
* Whether ECC support is enabled on the device. This can be
|
| 394 |
+
* collected using value of \param CU_DEVICE_ATTRIBUTE_ECC_ENABLED of
|
| 395 |
+
* cuDeviceGetAttribute.
|
| 396 |
+
*/
|
| 397 |
+
CUPTI_METRIC_PROPERTY_ECC_ENABLED,
|
| 398 |
+
/*
|
| 399 |
+
* Peak half precision floating point operations that
|
| 400 |
+
* can be performed in one cycle by the device.
|
| 401 |
+
* This should be collected using value of
|
| 402 |
+
* \param CUPTI_DEVICE_ATTR_FLOP_HP_PER_CYCLE of
|
| 403 |
+
* cuptiDeviceGetAttribute.
|
| 404 |
+
*/
|
| 405 |
+
CUPTI_METRIC_PROPERTY_FLOP_HP_PER_CYCLE,
|
| 406 |
+
/*
|
| 407 |
+
* NVLINK Bandwitdh for device. This should be collected
|
| 408 |
+
* using value of \param CUPTI_DEVICE_ATTR_GPU_CPU_NVLINK_BW of
|
| 409 |
+
* cuptiDeviceGetAttribute.
|
| 410 |
+
*/
|
| 411 |
+
CUPTI_METRIC_PROPERTY_GPU_CPU_NVLINK_BANDWIDTH,
|
| 412 |
+
} CUpti_MetricPropertyID;
|
| 413 |
+
|
| 414 |
+
/**
|
| 415 |
+
* \brief Get the total number of metrics available on any device.
|
| 416 |
+
*
|
| 417 |
+
* Returns the total number of metrics available on any CUDA-capable
|
| 418 |
+
* devices.
|
| 419 |
+
*
|
| 420 |
+
* \param numMetrics Returns the number of metrics
|
| 421 |
+
*
|
| 422 |
+
* \retval CUPTI_SUCCESS
|
| 423 |
+
* \retval CUPTI_ERROR_INVALID_PARAMETER if \p numMetrics is NULL
|
| 424 |
+
*/
|
| 425 |
+
CUptiResult CUPTIAPI cuptiGetNumMetrics(uint32_t *numMetrics);
|
| 426 |
+
|
| 427 |
+
/**
|
| 428 |
+
* \brief Get all the metrics available on any device.
|
| 429 |
+
*
|
| 430 |
+
* Returns the metric IDs in \p metricArray for all CUDA-capable
|
| 431 |
+
* devices. The size of the \p metricArray buffer is given by \p
|
| 432 |
+
* *arraySizeBytes. The size of the \p metricArray buffer must be at
|
| 433 |
+
* least \p numMetrics * sizeof(CUpti_MetricID) or all metric IDs will
|
| 434 |
+
* not be returned. The value returned in \p *arraySizeBytes contains
|
| 435 |
+
* the number of bytes returned in \p metricArray.
|
| 436 |
+
*
|
| 437 |
+
* \param arraySizeBytes The size of \p metricArray in bytes, and
|
| 438 |
+
* returns the number of bytes written to \p metricArray
|
| 439 |
+
* \param metricArray Returns the IDs of the metrics
|
| 440 |
+
*
|
| 441 |
+
* \retval CUPTI_SUCCESS
|
| 442 |
+
* \retval CUPTI_ERROR_INVALID_PARAMETER if \p arraySizeBytes or
|
| 443 |
+
* \p metricArray are NULL
|
| 444 |
+
*/
|
| 445 |
+
CUptiResult CUPTIAPI cuptiEnumMetrics(size_t *arraySizeBytes,
|
| 446 |
+
CUpti_MetricID *metricArray);
|
| 447 |
+
|
| 448 |
+
/**
|
| 449 |
+
* \brief Get the number of metrics for a device.
|
| 450 |
+
*
|
| 451 |
+
* Returns the number of metrics available for a device.
|
| 452 |
+
*
|
| 453 |
+
* \param device The CUDA device
|
| 454 |
+
* \param numMetrics Returns the number of metrics available for the
|
| 455 |
+
* device
|
| 456 |
+
*
|
| 457 |
+
* \retval CUPTI_SUCCESS
|
| 458 |
+
* \retval CUPTI_ERROR_NOT_INITIALIZED
|
| 459 |
+
* \retval CUPTI_ERROR_INVALID_DEVICE
|
| 460 |
+
* \retval CUPTI_ERROR_INVALID_PARAMETER if \p numMetrics is NULL
|
| 461 |
+
*/
|
| 462 |
+
CUptiResult CUPTIAPI cuptiDeviceGetNumMetrics(CUdevice device,
|
| 463 |
+
uint32_t *numMetrics);
|
| 464 |
+
|
| 465 |
+
/**
|
| 466 |
+
* \brief Get the metrics for a device.
|
| 467 |
+
*
|
| 468 |
+
* Returns the metric IDs in \p metricArray for a device. The size of
|
| 469 |
+
* the \p metricArray buffer is given by \p *arraySizeBytes. The size
|
| 470 |
+
* of the \p metricArray buffer must be at least \p numMetrics *
|
| 471 |
+
* sizeof(CUpti_MetricID) or else all metric IDs will not be
|
| 472 |
+
* returned. The value returned in \p *arraySizeBytes contains the
|
| 473 |
+
* number of bytes returned in \p metricArray.
|
| 474 |
+
*
|
| 475 |
+
* \param device The CUDA device
|
| 476 |
+
* \param arraySizeBytes The size of \p metricArray in bytes, and
|
| 477 |
+
* returns the number of bytes written to \p metricArray
|
| 478 |
+
* \param metricArray Returns the IDs of the metrics for the device
|
| 479 |
+
*
|
| 480 |
+
* \retval CUPTI_SUCCESS
|
| 481 |
+
* \retval CUPTI_ERROR_NOT_INITIALIZED
|
| 482 |
+
* \retval CUPTI_ERROR_INVALID_DEVICE
|
| 483 |
+
* \retval CUPTI_ERROR_INVALID_PARAMETER if \p arraySizeBytes or
|
| 484 |
+
* \p metricArray are NULL
|
| 485 |
+
*/
|
| 486 |
+
CUptiResult CUPTIAPI cuptiDeviceEnumMetrics(CUdevice device,
|
| 487 |
+
size_t *arraySizeBytes,
|
| 488 |
+
CUpti_MetricID *metricArray);
|
| 489 |
+
|
| 490 |
+
/**
|
| 491 |
+
* \brief Get a metric attribute.
|
| 492 |
+
*
|
| 493 |
+
* Returns a metric attribute in \p *value. The size of the \p
|
| 494 |
+
* value buffer is given by \p *valueSize. The value returned in \p
|
| 495 |
+
* *valueSize contains the number of bytes returned in \p value.
|
| 496 |
+
*
|
| 497 |
+
* If the attribute value is a c-string that is longer than \p
|
| 498 |
+
* *valueSize, then only the first \p *valueSize characters will be
|
| 499 |
+
* returned and there will be no terminating null byte.
|
| 500 |
+
*
|
| 501 |
+
* \param metric ID of the metric
|
| 502 |
+
* \param attrib The metric attribute to read
|
| 503 |
+
* \param valueSize The size of the \p value buffer in bytes, and
|
| 504 |
+
* returns the number of bytes written to \p value
|
| 505 |
+
* \param value Returns the attribute's value
|
| 506 |
+
*
|
| 507 |
+
* \retval CUPTI_SUCCESS
|
| 508 |
+
* \retval CUPTI_ERROR_NOT_INITIALIZED
|
| 509 |
+
* \retval CUPTI_ERROR_INVALID_METRIC_ID
|
| 510 |
+
* \retval CUPTI_ERROR_INVALID_PARAMETER if \p valueSize or \p value
|
| 511 |
+
* is NULL, or if \p attrib is not a metric attribute
|
| 512 |
+
* \retval CUPTI_ERROR_PARAMETER_SIZE_NOT_SUFFICIENT For non-c-string
|
| 513 |
+
* attribute values, indicates that the \p value buffer is too small
|
| 514 |
+
* to hold the attribute value.
|
| 515 |
+
*/
|
| 516 |
+
CUptiResult CUPTIAPI cuptiMetricGetAttribute(CUpti_MetricID metric,
|
| 517 |
+
CUpti_MetricAttribute attrib,
|
| 518 |
+
size_t *valueSize,
|
| 519 |
+
void *value);
|
| 520 |
+
|
| 521 |
+
/**
|
| 522 |
+
* \brief Find an metric by name.
|
| 523 |
+
*
|
| 524 |
+
* Find a metric by name and return the metric ID in \p *metric.
|
| 525 |
+
*
|
| 526 |
+
* \param device The CUDA device
|
| 527 |
+
* \param metricName The name of metric to find
|
| 528 |
+
* \param metric Returns the ID of the found metric or undefined if
|
| 529 |
+
* unable to find the metric
|
| 530 |
+
*
|
| 531 |
+
* \retval CUPTI_SUCCESS
|
| 532 |
+
* \retval CUPTI_ERROR_NOT_INITIALIZED
|
| 533 |
+
* \retval CUPTI_ERROR_INVALID_DEVICE
|
| 534 |
+
* \retval CUPTI_ERROR_INVALID_METRIC_NAME if unable to find a metric
|
| 535 |
+
* with name \p metricName. In this case \p *metric is undefined
|
| 536 |
+
* \retval CUPTI_ERROR_INVALID_PARAMETER if \p metricName or \p
|
| 537 |
+
* metric are NULL.
|
| 538 |
+
*/
|
| 539 |
+
CUptiResult CUPTIAPI cuptiMetricGetIdFromName(CUdevice device,
|
| 540 |
+
const char *metricName,
|
| 541 |
+
CUpti_MetricID *metric);
|
| 542 |
+
|
| 543 |
+
/**
|
| 544 |
+
* \brief Get number of events required to calculate a metric.
|
| 545 |
+
*
|
| 546 |
+
* Returns the number of events in \p numEvents that are required to
|
| 547 |
+
* calculate a metric.
|
| 548 |
+
*
|
| 549 |
+
* \param metric ID of the metric
|
| 550 |
+
* \param numEvents Returns the number of events required for the metric
|
| 551 |
+
*
|
| 552 |
+
* \retval CUPTI_SUCCESS
|
| 553 |
+
* \retval CUPTI_ERROR_NOT_INITIALIZED
|
| 554 |
+
* \retval CUPTI_ERROR_INVALID_METRIC_ID
|
| 555 |
+
* \retval CUPTI_ERROR_INVALID_PARAMETER if \p numEvents is NULL
|
| 556 |
+
*/
|
| 557 |
+
CUptiResult CUPTIAPI cuptiMetricGetNumEvents(CUpti_MetricID metric,
|
| 558 |
+
uint32_t *numEvents);
|
| 559 |
+
|
| 560 |
+
/**
|
| 561 |
+
* \brief Get the events required to calculating a metric.
|
| 562 |
+
*
|
| 563 |
+
* Gets the event IDs in \p eventIdArray required to calculate a \p
|
| 564 |
+
* metric. The size of the \p eventIdArray buffer is given by \p
|
| 565 |
+
* *eventIdArraySizeBytes and must be at least \p numEvents *
|
| 566 |
+
* sizeof(CUpti_EventID) or all events will not be returned. The value
|
| 567 |
+
* returned in \p *eventIdArraySizeBytes contains the number of bytes
|
| 568 |
+
* returned in \p eventIdArray.
|
| 569 |
+
*
|
| 570 |
+
* \param metric ID of the metric
|
| 571 |
+
* \param eventIdArraySizeBytes The size of \p eventIdArray in bytes,
|
| 572 |
+
* and returns the number of bytes written to \p eventIdArray
|
| 573 |
+
* \param eventIdArray Returns the IDs of the events required to
|
| 574 |
+
* calculate \p metric
|
| 575 |
+
*
|
| 576 |
+
* \retval CUPTI_SUCCESS
|
| 577 |
+
* \retval CUPTI_ERROR_NOT_INITIALIZED
|
| 578 |
+
* \retval CUPTI_ERROR_INVALID_METRIC_ID
|
| 579 |
+
* \retval CUPTI_ERROR_INVALID_PARAMETER if \p eventIdArraySizeBytes or \p
|
| 580 |
+
* eventIdArray are NULL.
|
| 581 |
+
*/
|
| 582 |
+
CUptiResult CUPTIAPI cuptiMetricEnumEvents(CUpti_MetricID metric,
|
| 583 |
+
size_t *eventIdArraySizeBytes,
|
| 584 |
+
CUpti_EventID *eventIdArray);
|
| 585 |
+
|
| 586 |
+
/**
|
| 587 |
+
* \brief Get number of properties required to calculate a metric.
|
| 588 |
+
*
|
| 589 |
+
* Returns the number of properties in \p numProp that are required to
|
| 590 |
+
* calculate a metric.
|
| 591 |
+
*
|
| 592 |
+
* \param metric ID of the metric
|
| 593 |
+
* \param numProp Returns the number of properties required for the
|
| 594 |
+
* metric
|
| 595 |
+
*
|
| 596 |
+
* \retval CUPTI_SUCCESS
|
| 597 |
+
* \retval CUPTI_ERROR_NOT_INITIALIZED
|
| 598 |
+
* \retval CUPTI_ERROR_INVALID_METRIC_ID
|
| 599 |
+
* \retval CUPTI_ERROR_INVALID_PARAMETER if \p numProp is NULL
|
| 600 |
+
*/
|
| 601 |
+
CUptiResult CUPTIAPI cuptiMetricGetNumProperties(CUpti_MetricID metric,
|
| 602 |
+
uint32_t *numProp);
|
| 603 |
+
|
| 604 |
+
/**
|
| 605 |
+
* \brief Get the properties required to calculating a metric.
|
| 606 |
+
*
|
| 607 |
+
* Gets the property IDs in \p propIdArray required to calculate a \p
|
| 608 |
+
* metric. The size of the \p propIdArray buffer is given by \p
|
| 609 |
+
* *propIdArraySizeBytes and must be at least \p numProp *
|
| 610 |
+
* sizeof(CUpti_DeviceAttribute) or all properties will not be
|
| 611 |
+
* returned. The value returned in \p *propIdArraySizeBytes contains
|
| 612 |
+
* the number of bytes returned in \p propIdArray.
|
| 613 |
+
*
|
| 614 |
+
* \param metric ID of the metric
|
| 615 |
+
* \param propIdArraySizeBytes The size of \p propIdArray in bytes,
|
| 616 |
+
* and returns the number of bytes written to \p propIdArray
|
| 617 |
+
* \param propIdArray Returns the IDs of the properties required to
|
| 618 |
+
* calculate \p metric
|
| 619 |
+
*
|
| 620 |
+
* \retval CUPTI_SUCCESS
|
| 621 |
+
* \retval CUPTI_ERROR_NOT_INITIALIZED
|
| 622 |
+
* \retval CUPTI_ERROR_INVALID_METRIC_ID
|
| 623 |
+
* \retval CUPTI_ERROR_INVALID_PARAMETER if \p propIdArraySizeBytes or \p
|
| 624 |
+
* propIdArray are NULL.
|
| 625 |
+
*/
|
| 626 |
+
CUptiResult CUPTIAPI cuptiMetricEnumProperties(CUpti_MetricID metric,
|
| 627 |
+
size_t *propIdArraySizeBytes,
|
| 628 |
+
CUpti_MetricPropertyID *propIdArray);
|
| 629 |
+
|
| 630 |
+
|
| 631 |
+
/**
|
| 632 |
+
* \brief For a metric get the groups of events that must be collected
|
| 633 |
+
* in the same pass.
|
| 634 |
+
*
|
| 635 |
+
* For a metric get the groups of events that must be collected in the
|
| 636 |
+
* same pass to ensure that the metric is calculated correctly. If the
|
| 637 |
+
* events are not collected as specified then the metric value may be
|
| 638 |
+
* inaccurate.
|
| 639 |
+
*
|
| 640 |
+
* The function returns NULL if a metric does not have any required
|
| 641 |
+
* event group. In this case the events needed for the metric can be
|
| 642 |
+
* grouped in any manner for collection.
|
| 643 |
+
*
|
| 644 |
+
* \param context The context for event collection
|
| 645 |
+
* \param metric The metric ID
|
| 646 |
+
* \param eventGroupSets Returns a CUpti_EventGroupSets object that
|
| 647 |
+
* indicates the events that must be collected in the same pass to
|
| 648 |
+
* ensure the metric is calculated correctly. Returns NULL if no
|
| 649 |
+
* grouping is required for metric
|
| 650 |
+
* \retval CUPTI_SUCCESS
|
| 651 |
+
* \retval CUPTI_ERROR_NOT_INITIALIZED
|
| 652 |
+
* \retval CUPTI_ERROR_INVALID_METRIC_ID
|
| 653 |
+
*/
|
| 654 |
+
CUptiResult CUPTIAPI cuptiMetricGetRequiredEventGroupSets(CUcontext context,
|
| 655 |
+
CUpti_MetricID metric,
|
| 656 |
+
CUpti_EventGroupSets **eventGroupSets);
|
| 657 |
+
|
| 658 |
+
/**
|
| 659 |
+
* \brief For a set of metrics, get the grouping that indicates the
|
| 660 |
+
* number of passes and the event groups necessary to collect the
|
| 661 |
+
* events required for those metrics.
|
| 662 |
+
*
|
| 663 |
+
* For a set of metrics, get the grouping that indicates the number of
|
| 664 |
+
* passes and the event groups necessary to collect the events
|
| 665 |
+
* required for those metrics.
|
| 666 |
+
*
|
| 667 |
+
* \see cuptiEventGroupSetsCreate for details on event group set
|
| 668 |
+
* creation.
|
| 669 |
+
*
|
| 670 |
+
* \param context The context for event collection
|
| 671 |
+
* \param metricIdArraySizeBytes Size of the metricIdArray in bytes
|
| 672 |
+
* \param metricIdArray Array of metric IDs
|
| 673 |
+
* \param eventGroupPasses Returns a CUpti_EventGroupSets object that
|
| 674 |
+
* indicates the number of passes required to collect the events and
|
| 675 |
+
* the events to collect on each pass
|
| 676 |
+
*
|
| 677 |
+
* \retval CUPTI_SUCCESS
|
| 678 |
+
* \retval CUPTI_ERROR_NOT_INITIALIZED
|
| 679 |
+
* \retval CUPTI_ERROR_INVALID_CONTEXT
|
| 680 |
+
* \retval CUPTI_ERROR_INVALID_METRIC_ID
|
| 681 |
+
* \retval CUPTI_ERROR_INVALID_PARAMETER if \p metricIdArray or
|
| 682 |
+
* \p eventGroupPasses is NULL
|
| 683 |
+
*/
|
| 684 |
+
CUptiResult CUPTIAPI cuptiMetricCreateEventGroupSets(CUcontext context,
|
| 685 |
+
size_t metricIdArraySizeBytes,
|
| 686 |
+
CUpti_MetricID *metricIdArray,
|
| 687 |
+
CUpti_EventGroupSets **eventGroupPasses);
|
| 688 |
+
|
| 689 |
+
/**
|
| 690 |
+
* \brief Calculate the value for a metric.
|
| 691 |
+
*
|
| 692 |
+
* Use the events collected for a metric to calculate the metric
|
| 693 |
+
* value. Metric value evaluation depends on the evaluation mode
|
| 694 |
+
* \ref CUpti_MetricEvaluationMode that the metric supports.
|
| 695 |
+
* If a metric has evaluation mode as CUPTI_METRIC_EVALUATION_MODE_PER_INSTANCE,
|
| 696 |
+
* then it assumes that the input event value is for one domain instance.
|
| 697 |
+
* If a metric has evaluation mode as CUPTI_METRIC_EVALUATION_MODE_AGGREGATE,
|
| 698 |
+
* it assumes that input event values are
|
| 699 |
+
* normalized to represent all domain instances on a device. For the
|
| 700 |
+
* most accurate metric collection, the events required for the metric
|
| 701 |
+
* should be collected for all profiled domain instances. For example,
|
| 702 |
+
* to collect all instances of an event, set the
|
| 703 |
+
* CUPTI_EVENT_GROUP_ATTR_PROFILE_ALL_DOMAIN_INSTANCES attribute on
|
| 704 |
+
* the group containing the event to 1. The normalized value for the
|
| 705 |
+
* event is then: (\p sum_event_values * \p totalInstanceCount) / \p
|
| 706 |
+
* instanceCount, where \p sum_event_values is the summation of the
|
| 707 |
+
* event values across all profiled domain instances, \p
|
| 708 |
+
* totalInstanceCount is obtained from querying
|
| 709 |
+
* CUPTI_EVENT_DOMAIN_ATTR_TOTAL_INSTANCE_COUNT and \p instanceCount
|
| 710 |
+
* is obtained from querying CUPTI_EVENT_GROUP_ATTR_INSTANCE_COUNT (or
|
| 711 |
+
* CUPTI_EVENT_DOMAIN_ATTR_INSTANCE_COUNT).
|
| 712 |
+
*
|
| 713 |
+
* \param device The CUDA device that the metric is being calculated for
|
| 714 |
+
* \param metric The metric ID
|
| 715 |
+
* \param eventIdArraySizeBytes The size of \p eventIdArray in bytes
|
| 716 |
+
* \param eventIdArray The event IDs required to calculate \p metric
|
| 717 |
+
* \param eventValueArraySizeBytes The size of \p eventValueArray in bytes
|
| 718 |
+
* \param eventValueArray The normalized event values required to
|
| 719 |
+
* calculate \p metric. The values must be order to match the order of
|
| 720 |
+
* events in \p eventIdArray
|
| 721 |
+
* \param timeDuration The duration over which the events were
|
| 722 |
+
* collected, in ns
|
| 723 |
+
* \param metricValue Returns the value for the metric
|
| 724 |
+
*
|
| 725 |
+
* \retval CUPTI_SUCCESS
|
| 726 |
+
* \retval CUPTI_ERROR_NOT_INITIALIZED
|
| 727 |
+
* \retval CUPTI_ERROR_INVALID_METRIC_ID
|
| 728 |
+
* \retval CUPTI_ERROR_INVALID_OPERATION
|
| 729 |
+
* \retval CUPTI_ERROR_PARAMETER_SIZE_NOT_SUFFICIENT if the
|
| 730 |
+
* eventIdArray does not contain all the events needed for metric
|
| 731 |
+
* \retval CUPTI_ERROR_INVALID_EVENT_VALUE if any of the
|
| 732 |
+
* event values required for the metric is CUPTI_EVENT_OVERFLOW
|
| 733 |
+
* \retval CUPTI_ERROR_INVALID_METRIC_VALUE if the computed metric value
|
| 734 |
+
* cannot be represented in the metric's value type. For example,
|
| 735 |
+
* if the metric value type is unsigned and the computed metric value is negative
|
| 736 |
+
* \retval CUPTI_ERROR_INVALID_PARAMETER if \p metricValue,
|
| 737 |
+
* \p eventIdArray or \p eventValueArray is NULL
|
| 738 |
+
*/
|
| 739 |
+
CUptiResult CUPTIAPI cuptiMetricGetValue(CUdevice device,
|
| 740 |
+
CUpti_MetricID metric,
|
| 741 |
+
size_t eventIdArraySizeBytes,
|
| 742 |
+
CUpti_EventID *eventIdArray,
|
| 743 |
+
size_t eventValueArraySizeBytes,
|
| 744 |
+
uint64_t *eventValueArray,
|
| 745 |
+
uint64_t timeDuration,
|
| 746 |
+
CUpti_MetricValue *metricValue);
|
| 747 |
+
|
| 748 |
+
/**
|
| 749 |
+
* \brief Calculate the value for a metric.
|
| 750 |
+
*
|
| 751 |
+
* Use the events and properties collected for a metric to calculate
|
| 752 |
+
* the metric value. Metric value evaluation depends on the evaluation
|
| 753 |
+
* mode \ref CUpti_MetricEvaluationMode that the metric supports. If
|
| 754 |
+
* a metric has evaluation mode as
|
| 755 |
+
* CUPTI_METRIC_EVALUATION_MODE_PER_INSTANCE, then it assumes that the
|
| 756 |
+
* input event value is for one domain instance. If a metric has
|
| 757 |
+
* evaluation mode as CUPTI_METRIC_EVALUATION_MODE_AGGREGATE, it
|
| 758 |
+
* assumes that input event values are normalized to represent all
|
| 759 |
+
* domain instances on a device. For the most accurate metric
|
| 760 |
+
* collection, the events required for the metric should be collected
|
| 761 |
+
* for all profiled domain instances. For example, to collect all
|
| 762 |
+
* instances of an event, set the
|
| 763 |
+
* CUPTI_EVENT_GROUP_ATTR_PROFILE_ALL_DOMAIN_INSTANCES attribute on
|
| 764 |
+
* the group containing the event to 1. The normalized value for the
|
| 765 |
+
* event is then: (\p sum_event_values * \p totalInstanceCount) / \p
|
| 766 |
+
* instanceCount, where \p sum_event_values is the summation of the
|
| 767 |
+
* event values across all profiled domain instances, \p
|
| 768 |
+
* totalInstanceCount is obtained from querying
|
| 769 |
+
* CUPTI_EVENT_DOMAIN_ATTR_TOTAL_INSTANCE_COUNT and \p instanceCount
|
| 770 |
+
* is obtained from querying CUPTI_EVENT_GROUP_ATTR_INSTANCE_COUNT (or
|
| 771 |
+
* CUPTI_EVENT_DOMAIN_ATTR_INSTANCE_COUNT).
|
| 772 |
+
*
|
| 773 |
+
* \param metric The metric ID
|
| 774 |
+
* \param eventIdArraySizeBytes The size of \p eventIdArray in bytes
|
| 775 |
+
* \param eventIdArray The event IDs required to calculate \p metric
|
| 776 |
+
* \param eventValueArraySizeBytes The size of \p eventValueArray in bytes
|
| 777 |
+
* \param eventValueArray The normalized event values required to
|
| 778 |
+
* calculate \p metric. The values must be order to match the order of
|
| 779 |
+
* events in \p eventIdArray
|
| 780 |
+
* \param propIdArraySizeBytes The size of \p propIdArray in bytes
|
| 781 |
+
* \param propIdArray The metric property IDs required to calculate \p metric
|
| 782 |
+
* \param propValueArraySizeBytes The size of \p propValueArray in bytes
|
| 783 |
+
* \param propValueArray The metric property values required to
|
| 784 |
+
* calculate \p metric. The values must be order to match the order of
|
| 785 |
+
* metric properties in \p propIdArray
|
| 786 |
+
* \param metricValue Returns the value for the metric
|
| 787 |
+
*
|
| 788 |
+
* \retval CUPTI_SUCCESS
|
| 789 |
+
* \retval CUPTI_ERROR_NOT_INITIALIZED
|
| 790 |
+
* \retval CUPTI_ERROR_INVALID_METRIC_ID
|
| 791 |
+
* \retval CUPTI_ERROR_INVALID_OPERATION
|
| 792 |
+
* \retval CUPTI_ERROR_PARAMETER_SIZE_NOT_SUFFICIENT if the
|
| 793 |
+
* eventIdArray does not contain all the events needed for metric
|
| 794 |
+
* \retval CUPTI_ERROR_INVALID_EVENT_VALUE if any of the
|
| 795 |
+
* event values required for the metric is CUPTI_EVENT_OVERFLOW
|
| 796 |
+
* \retval CUPTI_ERROR_NOT_COMPATIBLE if the computed metric value
|
| 797 |
+
* cannot be represented in the metric's value type. For example,
|
| 798 |
+
* if the metric value type is unsigned and the computed metric value is negative
|
| 799 |
+
* \retval CUPTI_ERROR_INVALID_PARAMETER if \p metricValue,
|
| 800 |
+
* \p eventIdArray or \p eventValueArray is NULL
|
| 801 |
+
*/
|
| 802 |
+
CUptiResult CUPTIAPI cuptiMetricGetValue2(CUpti_MetricID metric,
|
| 803 |
+
size_t eventIdArraySizeBytes,
|
| 804 |
+
CUpti_EventID *eventIdArray,
|
| 805 |
+
size_t eventValueArraySizeBytes,
|
| 806 |
+
uint64_t *eventValueArray,
|
| 807 |
+
size_t propIdArraySizeBytes,
|
| 808 |
+
CUpti_MetricPropertyID *propIdArray,
|
| 809 |
+
size_t propValueArraySizeBytes,
|
| 810 |
+
uint64_t *propValueArray,
|
| 811 |
+
CUpti_MetricValue *metricValue);
|
| 812 |
+
|
| 813 |
+
/** @} */ /* END CUPTI_METRIC_API */
|
| 814 |
+
|
| 815 |
+
#if defined(__GNUC__) && defined(CUPTI_LIB)
|
| 816 |
+
#pragma GCC visibility pop
|
| 817 |
+
#endif
|
| 818 |
+
|
| 819 |
+
#if defined(__cplusplus)
|
| 820 |
+
}
|
| 821 |
+
#endif
|
| 822 |
+
|
| 823 |
+
#endif /*_CUPTI_METRIC_H_*/
|
| 824 |
+
|
| 825 |
+
|
vllm/lib/python3.10/site-packages/triton/backends/nvidia/include/cupti_result.h
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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| 1 |
+
/*
|
| 2 |
+
* Copyright 2010-2021 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(_CUPTI_RESULT_H_)
|
| 51 |
+
#define _CUPTI_RESULT_H_
|
| 52 |
+
|
| 53 |
+
#ifndef CUPTIAPI
|
| 54 |
+
#ifdef _WIN32
|
| 55 |
+
#define CUPTIAPI __stdcall
|
| 56 |
+
#else
|
| 57 |
+
#define CUPTIAPI
|
| 58 |
+
#endif
|
| 59 |
+
#endif
|
| 60 |
+
|
| 61 |
+
#if defined(__cplusplus)
|
| 62 |
+
extern "C" {
|
| 63 |
+
#endif
|
| 64 |
+
|
| 65 |
+
#if defined(__GNUC__) && defined(CUPTI_LIB)
|
| 66 |
+
#pragma GCC visibility push(default)
|
| 67 |
+
#endif
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* \defgroup CUPTI_RESULT_API CUPTI Result Codes
|
| 71 |
+
* Error and result codes returned by CUPTI functions.
|
| 72 |
+
* @{
|
| 73 |
+
*/
|
| 74 |
+
|
| 75 |
+
/**
|
| 76 |
+
* \brief CUPTI result codes.
|
| 77 |
+
*
|
| 78 |
+
* Error and result codes returned by CUPTI functions.
|
| 79 |
+
*/
|
| 80 |
+
typedef enum {
|
| 81 |
+
/**
|
| 82 |
+
* No error.
|
| 83 |
+
*/
|
| 84 |
+
CUPTI_SUCCESS = 0,
|
| 85 |
+
/**
|
| 86 |
+
* One or more of the parameters is invalid.
|
| 87 |
+
*/
|
| 88 |
+
CUPTI_ERROR_INVALID_PARAMETER = 1,
|
| 89 |
+
/**
|
| 90 |
+
* The device does not correspond to a valid CUDA device.
|
| 91 |
+
*/
|
| 92 |
+
CUPTI_ERROR_INVALID_DEVICE = 2,
|
| 93 |
+
/**
|
| 94 |
+
* The context is NULL or not valid.
|
| 95 |
+
*/
|
| 96 |
+
CUPTI_ERROR_INVALID_CONTEXT = 3,
|
| 97 |
+
/**
|
| 98 |
+
* The event domain id is invalid.
|
| 99 |
+
*/
|
| 100 |
+
CUPTI_ERROR_INVALID_EVENT_DOMAIN_ID = 4,
|
| 101 |
+
/**
|
| 102 |
+
* The event id is invalid.
|
| 103 |
+
*/
|
| 104 |
+
CUPTI_ERROR_INVALID_EVENT_ID = 5,
|
| 105 |
+
/**
|
| 106 |
+
* The event name is invalid.
|
| 107 |
+
*/
|
| 108 |
+
CUPTI_ERROR_INVALID_EVENT_NAME = 6,
|
| 109 |
+
/**
|
| 110 |
+
* The current operation cannot be performed due to dependency on
|
| 111 |
+
* other factors.
|
| 112 |
+
*/
|
| 113 |
+
CUPTI_ERROR_INVALID_OPERATION = 7,
|
| 114 |
+
/**
|
| 115 |
+
* Unable to allocate enough memory to perform the requested
|
| 116 |
+
* operation.
|
| 117 |
+
*/
|
| 118 |
+
CUPTI_ERROR_OUT_OF_MEMORY = 8,
|
| 119 |
+
/**
|
| 120 |
+
* An error occurred on the performance monitoring hardware.
|
| 121 |
+
*/
|
| 122 |
+
CUPTI_ERROR_HARDWARE = 9,
|
| 123 |
+
/**
|
| 124 |
+
* The output buffer size is not sufficient to return all
|
| 125 |
+
* requested data.
|
| 126 |
+
*/
|
| 127 |
+
CUPTI_ERROR_PARAMETER_SIZE_NOT_SUFFICIENT = 10,
|
| 128 |
+
/**
|
| 129 |
+
* API is not implemented.
|
| 130 |
+
*/
|
| 131 |
+
CUPTI_ERROR_API_NOT_IMPLEMENTED = 11,
|
| 132 |
+
/**
|
| 133 |
+
* The maximum limit is reached.
|
| 134 |
+
*/
|
| 135 |
+
CUPTI_ERROR_MAX_LIMIT_REACHED = 12,
|
| 136 |
+
/**
|
| 137 |
+
* The object is not yet ready to perform the requested operation.
|
| 138 |
+
*/
|
| 139 |
+
CUPTI_ERROR_NOT_READY = 13,
|
| 140 |
+
/**
|
| 141 |
+
* The current operation is not compatible with the current state
|
| 142 |
+
* of the object
|
| 143 |
+
*/
|
| 144 |
+
CUPTI_ERROR_NOT_COMPATIBLE = 14,
|
| 145 |
+
/**
|
| 146 |
+
* CUPTI is unable to initialize its connection to the CUDA
|
| 147 |
+
* driver.
|
| 148 |
+
*/
|
| 149 |
+
CUPTI_ERROR_NOT_INITIALIZED = 15,
|
| 150 |
+
/**
|
| 151 |
+
* The metric id is invalid.
|
| 152 |
+
*/
|
| 153 |
+
CUPTI_ERROR_INVALID_METRIC_ID = 16,
|
| 154 |
+
/**
|
| 155 |
+
* The metric name is invalid.
|
| 156 |
+
*/
|
| 157 |
+
CUPTI_ERROR_INVALID_METRIC_NAME = 17,
|
| 158 |
+
/**
|
| 159 |
+
* The queue is empty.
|
| 160 |
+
*/
|
| 161 |
+
CUPTI_ERROR_QUEUE_EMPTY = 18,
|
| 162 |
+
/**
|
| 163 |
+
* Invalid handle (internal?).
|
| 164 |
+
*/
|
| 165 |
+
CUPTI_ERROR_INVALID_HANDLE = 19,
|
| 166 |
+
/**
|
| 167 |
+
* Invalid stream.
|
| 168 |
+
*/
|
| 169 |
+
CUPTI_ERROR_INVALID_STREAM = 20,
|
| 170 |
+
/**
|
| 171 |
+
* Invalid kind.
|
| 172 |
+
*/
|
| 173 |
+
CUPTI_ERROR_INVALID_KIND = 21,
|
| 174 |
+
/**
|
| 175 |
+
* Invalid event value.
|
| 176 |
+
*/
|
| 177 |
+
CUPTI_ERROR_INVALID_EVENT_VALUE = 22,
|
| 178 |
+
/**
|
| 179 |
+
* CUPTI is disabled due to conflicts with other enabled profilers
|
| 180 |
+
*/
|
| 181 |
+
CUPTI_ERROR_DISABLED = 23,
|
| 182 |
+
/**
|
| 183 |
+
* Invalid module.
|
| 184 |
+
*/
|
| 185 |
+
CUPTI_ERROR_INVALID_MODULE = 24,
|
| 186 |
+
/**
|
| 187 |
+
* Invalid metric value.
|
| 188 |
+
*/
|
| 189 |
+
CUPTI_ERROR_INVALID_METRIC_VALUE = 25,
|
| 190 |
+
/**
|
| 191 |
+
* The performance monitoring hardware is in use by other client.
|
| 192 |
+
*/
|
| 193 |
+
CUPTI_ERROR_HARDWARE_BUSY = 26,
|
| 194 |
+
/**
|
| 195 |
+
* The attempted operation is not supported on the current
|
| 196 |
+
* system or device.
|
| 197 |
+
*/
|
| 198 |
+
CUPTI_ERROR_NOT_SUPPORTED = 27,
|
| 199 |
+
/**
|
| 200 |
+
* Unified memory profiling is not supported on the system.
|
| 201 |
+
* Potential reason could be unsupported OS or architecture.
|
| 202 |
+
*/
|
| 203 |
+
CUPTI_ERROR_UM_PROFILING_NOT_SUPPORTED = 28,
|
| 204 |
+
/**
|
| 205 |
+
* Unified memory profiling is not supported on the device
|
| 206 |
+
*/
|
| 207 |
+
CUPTI_ERROR_UM_PROFILING_NOT_SUPPORTED_ON_DEVICE = 29,
|
| 208 |
+
/**
|
| 209 |
+
* Unified memory profiling is not supported on a multi-GPU
|
| 210 |
+
* configuration without P2P support between any pair of devices
|
| 211 |
+
*/
|
| 212 |
+
CUPTI_ERROR_UM_PROFILING_NOT_SUPPORTED_ON_NON_P2P_DEVICES = 30,
|
| 213 |
+
/**
|
| 214 |
+
* Unified memory profiling is not supported under the
|
| 215 |
+
* Multi-Process Service (MPS) environment. CUDA 7.5 removes this
|
| 216 |
+
* restriction.
|
| 217 |
+
*/
|
| 218 |
+
CUPTI_ERROR_UM_PROFILING_NOT_SUPPORTED_WITH_MPS = 31,
|
| 219 |
+
/**
|
| 220 |
+
* In CUDA 9.0, devices with compute capability 7.0 don't
|
| 221 |
+
* support CDP tracing
|
| 222 |
+
*/
|
| 223 |
+
CUPTI_ERROR_CDP_TRACING_NOT_SUPPORTED = 32,
|
| 224 |
+
/**
|
| 225 |
+
* Profiling on virtualized GPU is not supported.
|
| 226 |
+
*/
|
| 227 |
+
CUPTI_ERROR_VIRTUALIZED_DEVICE_NOT_SUPPORTED = 33,
|
| 228 |
+
/**
|
| 229 |
+
* Profiling results might be incorrect for CUDA applications
|
| 230 |
+
* compiled with nvcc version older than 9.0 for devices with
|
| 231 |
+
* compute capability 6.0 and 6.1.
|
| 232 |
+
* Profiling session will continue and CUPTI will notify it using this error code.
|
| 233 |
+
* User is advised to recompile the application code with nvcc version 9.0 or later.
|
| 234 |
+
* Ignore this warning if code is already compiled with the recommended nvcc version.
|
| 235 |
+
*/
|
| 236 |
+
CUPTI_ERROR_CUDA_COMPILER_NOT_COMPATIBLE = 34,
|
| 237 |
+
/**
|
| 238 |
+
* User doesn't have sufficient privileges which are required to
|
| 239 |
+
* start the profiling session.
|
| 240 |
+
* One possible reason for this may be that the NVIDIA driver or your system
|
| 241 |
+
* administrator may have restricted access to the NVIDIA GPU performance counters.
|
| 242 |
+
* To learn how to resolve this issue and find more information, please visit
|
| 243 |
+
* https://developer.nvidia.com/CUPTI_ERROR_INSUFFICIENT_PRIVILEGES
|
| 244 |
+
*/
|
| 245 |
+
CUPTI_ERROR_INSUFFICIENT_PRIVILEGES = 35,
|
| 246 |
+
/**
|
| 247 |
+
* Legacy CUPTI Profiling API i.e. event API from the header cupti_events.h and
|
| 248 |
+
* metric API from the header cupti_metrics.h are not compatible with the
|
| 249 |
+
* Profiling API in the header cupti_profiler_target.h and Perfworks metrics API
|
| 250 |
+
* in the headers nvperf_host.h and nvperf_target.h.
|
| 251 |
+
*/
|
| 252 |
+
CUPTI_ERROR_OLD_PROFILER_API_INITIALIZED = 36,
|
| 253 |
+
/**
|
| 254 |
+
* Missing definition of the OpenACC API routine in the linked OpenACC library.
|
| 255 |
+
*
|
| 256 |
+
* One possible reason is that OpenACC library is linked statically in the
|
| 257 |
+
* user application, which might not have the definition of all the OpenACC
|
| 258 |
+
* API routines needed for the OpenACC profiling, as compiler might ignore
|
| 259 |
+
* definitions for the functions not used in the application. This issue
|
| 260 |
+
* can be mitigated by linking the OpenACC library dynamically.
|
| 261 |
+
*/
|
| 262 |
+
CUPTI_ERROR_OPENACC_UNDEFINED_ROUTINE = 37,
|
| 263 |
+
/**
|
| 264 |
+
* Legacy CUPTI Profiling API i.e. event API from the header cupti_events.h and
|
| 265 |
+
* metric API from the header cupti_metrics.h are not supported on devices with
|
| 266 |
+
* compute capability 7.5 and higher (i.e. Turing and later GPU architectures).
|
| 267 |
+
* These API will be deprecated in a future CUDA release. These are replaced by
|
| 268 |
+
* Profiling API in the header cupti_profiler_target.h and Perfworks metrics API
|
| 269 |
+
* in the headers nvperf_host.h and nvperf_target.h.
|
| 270 |
+
*/
|
| 271 |
+
CUPTI_ERROR_LEGACY_PROFILER_NOT_SUPPORTED = 38,
|
| 272 |
+
/**
|
| 273 |
+
* CUPTI doesn't allow multiple callback subscribers. Only a single subscriber
|
| 274 |
+
* can be registered at a time.
|
| 275 |
+
* Same error code is used when application is launched using NVIDIA tools
|
| 276 |
+
* like nvprof, Visual Profiler, Nsight Systems, Nsight Compute, cuda-gdb and
|
| 277 |
+
* cuda-memcheck.
|
| 278 |
+
*/
|
| 279 |
+
CUPTI_ERROR_MULTIPLE_SUBSCRIBERS_NOT_SUPPORTED = 39,
|
| 280 |
+
/**
|
| 281 |
+
* Profiling on virtualized GPU is not allowed by hypervisor.
|
| 282 |
+
*/
|
| 283 |
+
CUPTI_ERROR_VIRTUALIZED_DEVICE_INSUFFICIENT_PRIVILEGES = 40,
|
| 284 |
+
/**
|
| 285 |
+
* Profiling and tracing are not allowed when confidential computing mode
|
| 286 |
+
* is enabled.
|
| 287 |
+
*/
|
| 288 |
+
CUPTI_ERROR_CONFIDENTIAL_COMPUTING_NOT_SUPPORTED = 41,
|
| 289 |
+
/**
|
| 290 |
+
* CUPTI does not support NVIDIA Crypto Mining Processors (CMP).
|
| 291 |
+
* For more information, please visit https://developer.nvidia.com/ERR_NVCMPGPU
|
| 292 |
+
*/
|
| 293 |
+
CUPTI_ERROR_CMP_DEVICE_NOT_SUPPORTED = 42,
|
| 294 |
+
/**
|
| 295 |
+
* An unknown internal error has occurred.
|
| 296 |
+
*/
|
| 297 |
+
CUPTI_ERROR_UNKNOWN = 999,
|
| 298 |
+
CUPTI_ERROR_FORCE_INT = 0x7fffffff
|
| 299 |
+
} CUptiResult;
|
| 300 |
+
|
| 301 |
+
/**
|
| 302 |
+
* \brief Get the descriptive string for a CUptiResult.
|
| 303 |
+
*
|
| 304 |
+
* Return the descriptive string for a CUptiResult in \p *str.
|
| 305 |
+
* \note \b Thread-safety: this function is thread safe.
|
| 306 |
+
*
|
| 307 |
+
* \param result The result to get the string for
|
| 308 |
+
* \param str Returns the string
|
| 309 |
+
*
|
| 310 |
+
* \retval CUPTI_SUCCESS on success
|
| 311 |
+
* \retval CUPTI_ERROR_INVALID_PARAMETER if \p str is NULL or \p
|
| 312 |
+
* result is not a valid CUptiResult
|
| 313 |
+
*/
|
| 314 |
+
CUptiResult CUPTIAPI cuptiGetResultString(CUptiResult result, const char **str);
|
| 315 |
+
|
| 316 |
+
/**
|
| 317 |
+
* @brief Get the descriptive message corresponding to error codes returned
|
| 318 |
+
* by CUPTI.
|
| 319 |
+
*
|
| 320 |
+
* Return the descriptive error message for a CUptiResult in \p *str.
|
| 321 |
+
* \note \b Thread-safety: this function is thread safe.
|
| 322 |
+
*
|
| 323 |
+
* \param result The result to get the descriptive error message for
|
| 324 |
+
* \param str Returns the error message string
|
| 325 |
+
*
|
| 326 |
+
* \retval CUPTI_SUCCESS on success
|
| 327 |
+
* \retval CUPTI_ERROR_INVALID_PARAMETER if \p str is NULL or \p
|
| 328 |
+
* result is not a valid CUptiResult
|
| 329 |
+
*
|
| 330 |
+
*/
|
| 331 |
+
|
| 332 |
+
CUptiResult CUPTIAPI cuptiGetErrorMessage(CUptiResult result, const char **str);
|
| 333 |
+
|
| 334 |
+
/** @} */ /* END CUPTI_RESULT_API */
|
| 335 |
+
|
| 336 |
+
#if defined(__GNUC__) && defined(CUPTI_LIB)
|
| 337 |
+
#pragma GCC visibility pop
|
| 338 |
+
#endif
|
| 339 |
+
|
| 340 |
+
#if defined(__cplusplus)
|
| 341 |
+
}
|
| 342 |
+
#endif
|
| 343 |
+
|
| 344 |
+
#endif /*_CUPTI_RESULT_H_*/
|
| 345 |
+
|
| 346 |
+
|
vllm/lib/python3.10/site-packages/triton/backends/nvidia/include/cupti_runtime_cbid.h
ADDED
|
@@ -0,0 +1,481 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
// *************************************************************************
|
| 3 |
+
// Definitions of indices for API functions, unique across entire API
|
| 4 |
+
// *************************************************************************
|
| 5 |
+
|
| 6 |
+
// This file is generated. Any changes you make will be lost during the next clean build.
|
| 7 |
+
// CUDA public interface, for type definitions and cu* function prototypes
|
| 8 |
+
|
| 9 |
+
typedef enum CUpti_runtime_api_trace_cbid_enum {
|
| 10 |
+
CUPTI_RUNTIME_TRACE_CBID_INVALID = 0,
|
| 11 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDriverGetVersion_v3020 = 1,
|
| 12 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaRuntimeGetVersion_v3020 = 2,
|
| 13 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetDeviceCount_v3020 = 3,
|
| 14 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetDeviceProperties_v3020 = 4,
|
| 15 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaChooseDevice_v3020 = 5,
|
| 16 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetChannelDesc_v3020 = 6,
|
| 17 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaCreateChannelDesc_v3020 = 7,
|
| 18 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaConfigureCall_v3020 = 8,
|
| 19 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaSetupArgument_v3020 = 9,
|
| 20 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetLastError_v3020 = 10,
|
| 21 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaPeekAtLastError_v3020 = 11,
|
| 22 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetErrorString_v3020 = 12,
|
| 23 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaLaunch_v3020 = 13,
|
| 24 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaFuncSetCacheConfig_v3020 = 14,
|
| 25 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaFuncGetAttributes_v3020 = 15,
|
| 26 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaSetDevice_v3020 = 16,
|
| 27 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetDevice_v3020 = 17,
|
| 28 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaSetValidDevices_v3020 = 18,
|
| 29 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaSetDeviceFlags_v3020 = 19,
|
| 30 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMalloc_v3020 = 20,
|
| 31 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMallocPitch_v3020 = 21,
|
| 32 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaFree_v3020 = 22,
|
| 33 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMallocArray_v3020 = 23,
|
| 34 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaFreeArray_v3020 = 24,
|
| 35 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMallocHost_v3020 = 25,
|
| 36 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaFreeHost_v3020 = 26,
|
| 37 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaHostAlloc_v3020 = 27,
|
| 38 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaHostGetDevicePointer_v3020 = 28,
|
| 39 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaHostGetFlags_v3020 = 29,
|
| 40 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemGetInfo_v3020 = 30,
|
| 41 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy_v3020 = 31,
|
| 42 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2D_v3020 = 32,
|
| 43 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyToArray_v3020 = 33,
|
| 44 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DToArray_v3020 = 34,
|
| 45 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyFromArray_v3020 = 35,
|
| 46 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DFromArray_v3020 = 36,
|
| 47 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyArrayToArray_v3020 = 37,
|
| 48 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DArrayToArray_v3020 = 38,
|
| 49 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyToSymbol_v3020 = 39,
|
| 50 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyFromSymbol_v3020 = 40,
|
| 51 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyAsync_v3020 = 41,
|
| 52 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyToArrayAsync_v3020 = 42,
|
| 53 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyFromArrayAsync_v3020 = 43,
|
| 54 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DAsync_v3020 = 44,
|
| 55 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DToArrayAsync_v3020 = 45,
|
| 56 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DFromArrayAsync_v3020 = 46,
|
| 57 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyToSymbolAsync_v3020 = 47,
|
| 58 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyFromSymbolAsync_v3020 = 48,
|
| 59 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemset_v3020 = 49,
|
| 60 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemset2D_v3020 = 50,
|
| 61 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemsetAsync_v3020 = 51,
|
| 62 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemset2DAsync_v3020 = 52,
|
| 63 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetSymbolAddress_v3020 = 53,
|
| 64 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetSymbolSize_v3020 = 54,
|
| 65 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaBindTexture_v3020 = 55,
|
| 66 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaBindTexture2D_v3020 = 56,
|
| 67 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaBindTextureToArray_v3020 = 57,
|
| 68 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaUnbindTexture_v3020 = 58,
|
| 69 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetTextureAlignmentOffset_v3020 = 59,
|
| 70 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetTextureReference_v3020 = 60,
|
| 71 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaBindSurfaceToArray_v3020 = 61,
|
| 72 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetSurfaceReference_v3020 = 62,
|
| 73 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGLSetGLDevice_v3020 = 63,
|
| 74 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGLRegisterBufferObject_v3020 = 64,
|
| 75 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGLMapBufferObject_v3020 = 65,
|
| 76 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGLUnmapBufferObject_v3020 = 66,
|
| 77 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGLUnregisterBufferObject_v3020 = 67,
|
| 78 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGLSetBufferObjectMapFlags_v3020 = 68,
|
| 79 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGLMapBufferObjectAsync_v3020 = 69,
|
| 80 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGLUnmapBufferObjectAsync_v3020 = 70,
|
| 81 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaWGLGetDevice_v3020 = 71,
|
| 82 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsGLRegisterImage_v3020 = 72,
|
| 83 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsGLRegisterBuffer_v3020 = 73,
|
| 84 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsUnregisterResource_v3020 = 74,
|
| 85 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsResourceSetMapFlags_v3020 = 75,
|
| 86 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsMapResources_v3020 = 76,
|
| 87 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsUnmapResources_v3020 = 77,
|
| 88 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsResourceGetMappedPointer_v3020 = 78,
|
| 89 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsSubResourceGetMappedArray_v3020 = 79,
|
| 90 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaVDPAUGetDevice_v3020 = 80,
|
| 91 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaVDPAUSetVDPAUDevice_v3020 = 81,
|
| 92 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsVDPAURegisterVideoSurface_v3020 = 82,
|
| 93 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsVDPAURegisterOutputSurface_v3020 = 83,
|
| 94 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D11GetDevice_v3020 = 84,
|
| 95 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D11GetDevices_v3020 = 85,
|
| 96 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D11SetDirect3DDevice_v3020 = 86,
|
| 97 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsD3D11RegisterResource_v3020 = 87,
|
| 98 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D10GetDevice_v3020 = 88,
|
| 99 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D10GetDevices_v3020 = 89,
|
| 100 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D10SetDirect3DDevice_v3020 = 90,
|
| 101 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsD3D10RegisterResource_v3020 = 91,
|
| 102 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D10RegisterResource_v3020 = 92,
|
| 103 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D10UnregisterResource_v3020 = 93,
|
| 104 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D10MapResources_v3020 = 94,
|
| 105 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D10UnmapResources_v3020 = 95,
|
| 106 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D10ResourceSetMapFlags_v3020 = 96,
|
| 107 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D10ResourceGetSurfaceDimensions_v3020 = 97,
|
| 108 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D10ResourceGetMappedArray_v3020 = 98,
|
| 109 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D10ResourceGetMappedPointer_v3020 = 99,
|
| 110 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D10ResourceGetMappedSize_v3020 = 100,
|
| 111 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D10ResourceGetMappedPitch_v3020 = 101,
|
| 112 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D9GetDevice_v3020 = 102,
|
| 113 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D9GetDevices_v3020 = 103,
|
| 114 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D9SetDirect3DDevice_v3020 = 104,
|
| 115 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D9GetDirect3DDevice_v3020 = 105,
|
| 116 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsD3D9RegisterResource_v3020 = 106,
|
| 117 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D9RegisterResource_v3020 = 107,
|
| 118 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D9UnregisterResource_v3020 = 108,
|
| 119 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D9MapResources_v3020 = 109,
|
| 120 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D9UnmapResources_v3020 = 110,
|
| 121 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D9ResourceSetMapFlags_v3020 = 111,
|
| 122 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D9ResourceGetSurfaceDimensions_v3020 = 112,
|
| 123 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D9ResourceGetMappedArray_v3020 = 113,
|
| 124 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D9ResourceGetMappedPointer_v3020 = 114,
|
| 125 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D9ResourceGetMappedSize_v3020 = 115,
|
| 126 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D9ResourceGetMappedPitch_v3020 = 116,
|
| 127 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D9Begin_v3020 = 117,
|
| 128 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D9End_v3020 = 118,
|
| 129 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D9RegisterVertexBuffer_v3020 = 119,
|
| 130 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D9UnregisterVertexBuffer_v3020 = 120,
|
| 131 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D9MapVertexBuffer_v3020 = 121,
|
| 132 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D9UnmapVertexBuffer_v3020 = 122,
|
| 133 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaThreadExit_v3020 = 123,
|
| 134 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaSetDoubleForDevice_v3020 = 124,
|
| 135 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaSetDoubleForHost_v3020 = 125,
|
| 136 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaThreadSynchronize_v3020 = 126,
|
| 137 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaThreadGetLimit_v3020 = 127,
|
| 138 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaThreadSetLimit_v3020 = 128,
|
| 139 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamCreate_v3020 = 129,
|
| 140 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamDestroy_v3020 = 130,
|
| 141 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamSynchronize_v3020 = 131,
|
| 142 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamQuery_v3020 = 132,
|
| 143 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaEventCreate_v3020 = 133,
|
| 144 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaEventCreateWithFlags_v3020 = 134,
|
| 145 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaEventRecord_v3020 = 135,
|
| 146 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaEventDestroy_v3020 = 136,
|
| 147 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaEventSynchronize_v3020 = 137,
|
| 148 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaEventQuery_v3020 = 138,
|
| 149 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaEventElapsedTime_v3020 = 139,
|
| 150 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMalloc3D_v3020 = 140,
|
| 151 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMalloc3DArray_v3020 = 141,
|
| 152 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemset3D_v3020 = 142,
|
| 153 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemset3DAsync_v3020 = 143,
|
| 154 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy3D_v3020 = 144,
|
| 155 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy3DAsync_v3020 = 145,
|
| 156 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaThreadSetCacheConfig_v3020 = 146,
|
| 157 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamWaitEvent_v3020 = 147,
|
| 158 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D11GetDirect3DDevice_v3020 = 148,
|
| 159 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaD3D10GetDirect3DDevice_v3020 = 149,
|
| 160 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaThreadGetCacheConfig_v3020 = 150,
|
| 161 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaPointerGetAttributes_v4000 = 151,
|
| 162 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaHostRegister_v4000 = 152,
|
| 163 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaHostUnregister_v4000 = 153,
|
| 164 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceCanAccessPeer_v4000 = 154,
|
| 165 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceEnablePeerAccess_v4000 = 155,
|
| 166 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceDisablePeerAccess_v4000 = 156,
|
| 167 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaPeerRegister_v4000 = 157,
|
| 168 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaPeerUnregister_v4000 = 158,
|
| 169 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaPeerGetDevicePointer_v4000 = 159,
|
| 170 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyPeer_v4000 = 160,
|
| 171 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyPeerAsync_v4000 = 161,
|
| 172 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy3DPeer_v4000 = 162,
|
| 173 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy3DPeerAsync_v4000 = 163,
|
| 174 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceReset_v3020 = 164,
|
| 175 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceSynchronize_v3020 = 165,
|
| 176 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetLimit_v3020 = 166,
|
| 177 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceSetLimit_v3020 = 167,
|
| 178 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetCacheConfig_v3020 = 168,
|
| 179 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceSetCacheConfig_v3020 = 169,
|
| 180 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaProfilerInitialize_v4000 = 170,
|
| 181 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaProfilerStart_v4000 = 171,
|
| 182 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaProfilerStop_v4000 = 172,
|
| 183 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetByPCIBusId_v4010 = 173,
|
| 184 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetPCIBusId_v4010 = 174,
|
| 185 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGLGetDevices_v4010 = 175,
|
| 186 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaIpcGetEventHandle_v4010 = 176,
|
| 187 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaIpcOpenEventHandle_v4010 = 177,
|
| 188 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaIpcGetMemHandle_v4010 = 178,
|
| 189 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaIpcOpenMemHandle_v4010 = 179,
|
| 190 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaIpcCloseMemHandle_v4010 = 180,
|
| 191 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaArrayGetInfo_v4010 = 181,
|
| 192 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaFuncSetSharedMemConfig_v4020 = 182,
|
| 193 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetSharedMemConfig_v4020 = 183,
|
| 194 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceSetSharedMemConfig_v4020 = 184,
|
| 195 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaCreateTextureObject_v5000 = 185,
|
| 196 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDestroyTextureObject_v5000 = 186,
|
| 197 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetTextureObjectResourceDesc_v5000 = 187,
|
| 198 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetTextureObjectTextureDesc_v5000 = 188,
|
| 199 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaCreateSurfaceObject_v5000 = 189,
|
| 200 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDestroySurfaceObject_v5000 = 190,
|
| 201 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetSurfaceObjectResourceDesc_v5000 = 191,
|
| 202 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMallocMipmappedArray_v5000 = 192,
|
| 203 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetMipmappedArrayLevel_v5000 = 193,
|
| 204 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaFreeMipmappedArray_v5000 = 194,
|
| 205 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaBindTextureToMipmappedArray_v5000 = 195,
|
| 206 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsResourceGetMappedMipmappedArray_v5000 = 196,
|
| 207 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamAddCallback_v5000 = 197,
|
| 208 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamCreateWithFlags_v5000 = 198,
|
| 209 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetTextureObjectResourceViewDesc_v5000 = 199,
|
| 210 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetAttribute_v5000 = 200,
|
| 211 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamDestroy_v5050 = 201,
|
| 212 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamCreateWithPriority_v5050 = 202,
|
| 213 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetPriority_v5050 = 203,
|
| 214 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetFlags_v5050 = 204,
|
| 215 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetStreamPriorityRange_v5050 = 205,
|
| 216 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMallocManaged_v6000 = 206,
|
| 217 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaOccupancyMaxActiveBlocksPerMultiprocessor_v6000 = 207,
|
| 218 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamAttachMemAsync_v6000 = 208,
|
| 219 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetErrorName_v6050 = 209,
|
| 220 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaOccupancyMaxActiveBlocksPerMultiprocessor_v6050 = 210,
|
| 221 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaLaunchKernel_v7000 = 211,
|
| 222 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetDeviceFlags_v7000 = 212,
|
| 223 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaLaunch_ptsz_v7000 = 213,
|
| 224 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaLaunchKernel_ptsz_v7000 = 214,
|
| 225 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy_ptds_v7000 = 215,
|
| 226 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2D_ptds_v7000 = 216,
|
| 227 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyToArray_ptds_v7000 = 217,
|
| 228 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DToArray_ptds_v7000 = 218,
|
| 229 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyFromArray_ptds_v7000 = 219,
|
| 230 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DFromArray_ptds_v7000 = 220,
|
| 231 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyArrayToArray_ptds_v7000 = 221,
|
| 232 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DArrayToArray_ptds_v7000 = 222,
|
| 233 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyToSymbol_ptds_v7000 = 223,
|
| 234 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyFromSymbol_ptds_v7000 = 224,
|
| 235 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyAsync_ptsz_v7000 = 225,
|
| 236 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyToArrayAsync_ptsz_v7000 = 226,
|
| 237 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyFromArrayAsync_ptsz_v7000 = 227,
|
| 238 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DAsync_ptsz_v7000 = 228,
|
| 239 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DToArrayAsync_ptsz_v7000 = 229,
|
| 240 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy2DFromArrayAsync_ptsz_v7000 = 230,
|
| 241 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyToSymbolAsync_ptsz_v7000 = 231,
|
| 242 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyFromSymbolAsync_ptsz_v7000 = 232,
|
| 243 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemset_ptds_v7000 = 233,
|
| 244 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemset2D_ptds_v7000 = 234,
|
| 245 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemsetAsync_ptsz_v7000 = 235,
|
| 246 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemset2DAsync_ptsz_v7000 = 236,
|
| 247 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetPriority_ptsz_v7000 = 237,
|
| 248 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetFlags_ptsz_v7000 = 238,
|
| 249 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamSynchronize_ptsz_v7000 = 239,
|
| 250 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamQuery_ptsz_v7000 = 240,
|
| 251 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamAttachMemAsync_ptsz_v7000 = 241,
|
| 252 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaEventRecord_ptsz_v7000 = 242,
|
| 253 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemset3D_ptds_v7000 = 243,
|
| 254 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemset3DAsync_ptsz_v7000 = 244,
|
| 255 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy3D_ptds_v7000 = 245,
|
| 256 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy3DAsync_ptsz_v7000 = 246,
|
| 257 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamWaitEvent_ptsz_v7000 = 247,
|
| 258 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamAddCallback_ptsz_v7000 = 248,
|
| 259 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy3DPeer_ptds_v7000 = 249,
|
| 260 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy3DPeerAsync_ptsz_v7000 = 250,
|
| 261 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags_v7000 = 251,
|
| 262 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemPrefetchAsync_v8000 = 252,
|
| 263 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemPrefetchAsync_ptsz_v8000 = 253,
|
| 264 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemAdvise_v8000 = 254,
|
| 265 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetP2PAttribute_v8000 = 255,
|
| 266 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsEGLRegisterImage_v7000 = 256,
|
| 267 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaEGLStreamConsumerConnect_v7000 = 257,
|
| 268 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaEGLStreamConsumerDisconnect_v7000 = 258,
|
| 269 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaEGLStreamConsumerAcquireFrame_v7000 = 259,
|
| 270 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaEGLStreamConsumerReleaseFrame_v7000 = 260,
|
| 271 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaEGLStreamProducerConnect_v7000 = 261,
|
| 272 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaEGLStreamProducerDisconnect_v7000 = 262,
|
| 273 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaEGLStreamProducerPresentFrame_v7000 = 263,
|
| 274 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaEGLStreamProducerReturnFrame_v7000 = 264,
|
| 275 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphicsResourceGetMappedEglFrame_v7000 = 265,
|
| 276 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemRangeGetAttribute_v8000 = 266,
|
| 277 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemRangeGetAttributes_v8000 = 267,
|
| 278 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaEGLStreamConsumerConnectWithFlags_v7000 = 268,
|
| 279 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaLaunchCooperativeKernel_v9000 = 269,
|
| 280 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaLaunchCooperativeKernel_ptsz_v9000 = 270,
|
| 281 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaEventCreateFromEGLSync_v9000 = 271,
|
| 282 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaLaunchCooperativeKernelMultiDevice_v9000 = 272,
|
| 283 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaFuncSetAttribute_v9000 = 273,
|
| 284 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaImportExternalMemory_v10000 = 274,
|
| 285 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaExternalMemoryGetMappedBuffer_v10000 = 275,
|
| 286 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaExternalMemoryGetMappedMipmappedArray_v10000 = 276,
|
| 287 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDestroyExternalMemory_v10000 = 277,
|
| 288 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaImportExternalSemaphore_v10000 = 278,
|
| 289 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaSignalExternalSemaphoresAsync_v10000 = 279,
|
| 290 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaSignalExternalSemaphoresAsync_ptsz_v10000 = 280,
|
| 291 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaWaitExternalSemaphoresAsync_v10000 = 281,
|
| 292 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaWaitExternalSemaphoresAsync_ptsz_v10000 = 282,
|
| 293 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDestroyExternalSemaphore_v10000 = 283,
|
| 294 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaLaunchHostFunc_v10000 = 284,
|
| 295 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaLaunchHostFunc_ptsz_v10000 = 285,
|
| 296 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphCreate_v10000 = 286,
|
| 297 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphKernelNodeGetParams_v10000 = 287,
|
| 298 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphKernelNodeSetParams_v10000 = 288,
|
| 299 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddKernelNode_v10000 = 289,
|
| 300 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddMemcpyNode_v10000 = 290,
|
| 301 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphMemcpyNodeGetParams_v10000 = 291,
|
| 302 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphMemcpyNodeSetParams_v10000 = 292,
|
| 303 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddMemsetNode_v10000 = 293,
|
| 304 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphMemsetNodeGetParams_v10000 = 294,
|
| 305 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphMemsetNodeSetParams_v10000 = 295,
|
| 306 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddHostNode_v10000 = 296,
|
| 307 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphHostNodeGetParams_v10000 = 297,
|
| 308 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddChildGraphNode_v10000 = 298,
|
| 309 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphChildGraphNodeGetGraph_v10000 = 299,
|
| 310 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddEmptyNode_v10000 = 300,
|
| 311 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphClone_v10000 = 301,
|
| 312 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphNodeFindInClone_v10000 = 302,
|
| 313 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphNodeGetType_v10000 = 303,
|
| 314 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphGetRootNodes_v10000 = 304,
|
| 315 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphNodeGetDependencies_v10000 = 305,
|
| 316 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphNodeGetDependentNodes_v10000 = 306,
|
| 317 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddDependencies_v10000 = 307,
|
| 318 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphRemoveDependencies_v10000 = 308,
|
| 319 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphDestroyNode_v10000 = 309,
|
| 320 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphInstantiate_v10000 = 310,
|
| 321 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphLaunch_v10000 = 311,
|
| 322 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphLaunch_ptsz_v10000 = 312,
|
| 323 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecDestroy_v10000 = 313,
|
| 324 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphDestroy_v10000 = 314,
|
| 325 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamBeginCapture_v10000 = 315,
|
| 326 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamBeginCapture_ptsz_v10000 = 316,
|
| 327 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamIsCapturing_v10000 = 317,
|
| 328 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamIsCapturing_ptsz_v10000 = 318,
|
| 329 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamEndCapture_v10000 = 319,
|
| 330 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamEndCapture_ptsz_v10000 = 320,
|
| 331 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphHostNodeSetParams_v10000 = 321,
|
| 332 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphGetNodes_v10000 = 322,
|
| 333 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphGetEdges_v10000 = 323,
|
| 334 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetCaptureInfo_v10010 = 324,
|
| 335 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetCaptureInfo_ptsz_v10010 = 325,
|
| 336 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecKernelNodeSetParams_v10010 = 326,
|
| 337 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaThreadExchangeStreamCaptureMode_v10010 = 327,
|
| 338 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetNvSciSyncAttributes_v10020 = 328,
|
| 339 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaOccupancyAvailableDynamicSMemPerBlock_v10200 = 329,
|
| 340 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamSetFlags_v10200 = 330,
|
| 341 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamSetFlags_ptsz_v10200 = 331,
|
| 342 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecMemcpyNodeSetParams_v10020 = 332,
|
| 343 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecMemsetNodeSetParams_v10020 = 333,
|
| 344 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecHostNodeSetParams_v10020 = 334,
|
| 345 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecUpdate_v10020 = 335,
|
| 346 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetFuncBySymbol_v11000 = 336,
|
| 347 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaCtxResetPersistingL2Cache_v11000 = 337,
|
| 348 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphKernelNodeCopyAttributes_v11000 = 338,
|
| 349 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphKernelNodeGetAttribute_v11000 = 339,
|
| 350 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphKernelNodeSetAttribute_v11000 = 340,
|
| 351 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamCopyAttributes_v11000 = 341,
|
| 352 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamCopyAttributes_ptsz_v11000 = 342,
|
| 353 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetAttribute_v11000 = 343,
|
| 354 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetAttribute_ptsz_v11000 = 344,
|
| 355 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamSetAttribute_v11000 = 345,
|
| 356 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamSetAttribute_ptsz_v11000 = 346,
|
| 357 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetTexture1DLinearMaxWidth_v11010 = 347,
|
| 358 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphUpload_v10000 = 348,
|
| 359 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphUpload_ptsz_v10000 = 349,
|
| 360 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddMemcpyNodeToSymbol_v11010 = 350,
|
| 361 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddMemcpyNodeFromSymbol_v11010 = 351,
|
| 362 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddMemcpyNode1D_v11010 = 352,
|
| 363 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphMemcpyNodeSetParamsToSymbol_v11010 = 353,
|
| 364 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphMemcpyNodeSetParamsFromSymbol_v11010 = 354,
|
| 365 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphMemcpyNodeSetParams1D_v11010 = 355,
|
| 366 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecMemcpyNodeSetParamsToSymbol_v11010 = 356,
|
| 367 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecMemcpyNodeSetParamsFromSymbol_v11010 = 357,
|
| 368 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecMemcpyNodeSetParams1D_v11010 = 358,
|
| 369 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaArrayGetSparseProperties_v11010 = 359,
|
| 370 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMipmappedArrayGetSparseProperties_v11010 = 360,
|
| 371 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecChildGraphNodeSetParams_v11010 = 361,
|
| 372 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddEventRecordNode_v11010 = 362,
|
| 373 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphEventRecordNodeGetEvent_v11010 = 363,
|
| 374 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphEventRecordNodeSetEvent_v11010 = 364,
|
| 375 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddEventWaitNode_v11010 = 365,
|
| 376 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphEventWaitNodeGetEvent_v11010 = 366,
|
| 377 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphEventWaitNodeSetEvent_v11010 = 367,
|
| 378 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecEventRecordNodeSetEvent_v11010 = 368,
|
| 379 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecEventWaitNodeSetEvent_v11010 = 369,
|
| 380 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaEventRecordWithFlags_v11010 = 370,
|
| 381 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaEventRecordWithFlags_ptsz_v11010 = 371,
|
| 382 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetDefaultMemPool_v11020 = 372,
|
| 383 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMallocAsync_v11020 = 373,
|
| 384 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMallocAsync_ptsz_v11020 = 374,
|
| 385 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaFreeAsync_v11020 = 375,
|
| 386 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaFreeAsync_ptsz_v11020 = 376,
|
| 387 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolTrimTo_v11020 = 377,
|
| 388 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolSetAttribute_v11020 = 378,
|
| 389 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolGetAttribute_v11020 = 379,
|
| 390 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolSetAccess_v11020 = 380,
|
| 391 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaArrayGetPlane_v11020 = 381,
|
| 392 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolGetAccess_v11020 = 382,
|
| 393 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolCreate_v11020 = 383,
|
| 394 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolDestroy_v11020 = 384,
|
| 395 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceSetMemPool_v11020 = 385,
|
| 396 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetMemPool_v11020 = 386,
|
| 397 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolExportToShareableHandle_v11020 = 387,
|
| 398 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolImportFromShareableHandle_v11020 = 388,
|
| 399 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolExportPointer_v11020 = 389,
|
| 400 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemPoolImportPointer_v11020 = 390,
|
| 401 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMallocFromPoolAsync_v11020 = 391,
|
| 402 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMallocFromPoolAsync_ptsz_v11020 = 392,
|
| 403 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaSignalExternalSemaphoresAsync_v2_v11020 = 393,
|
| 404 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaSignalExternalSemaphoresAsync_v2_ptsz_v11020 = 394,
|
| 405 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaWaitExternalSemaphoresAsync_v2_v11020 = 395,
|
| 406 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaWaitExternalSemaphoresAsync_v2_ptsz_v11020 = 396,
|
| 407 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddExternalSemaphoresSignalNode_v11020 = 397,
|
| 408 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphExternalSemaphoresSignalNodeGetParams_v11020 = 398,
|
| 409 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphExternalSemaphoresSignalNodeSetParams_v11020 = 399,
|
| 410 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddExternalSemaphoresWaitNode_v11020 = 400,
|
| 411 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphExternalSemaphoresWaitNodeGetParams_v11020 = 401,
|
| 412 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphExternalSemaphoresWaitNodeSetParams_v11020 = 402,
|
| 413 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecExternalSemaphoresSignalNodeSetParams_v11020 = 403,
|
| 414 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecExternalSemaphoresWaitNodeSetParams_v11020 = 404,
|
| 415 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceFlushGPUDirectRDMAWrites_v11030 = 405,
|
| 416 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetDriverEntryPoint_v11030 = 406,
|
| 417 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetDriverEntryPoint_ptsz_v11030 = 407,
|
| 418 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphDebugDotPrint_v11030 = 408,
|
| 419 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetCaptureInfo_v2_v11030 = 409,
|
| 420 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetCaptureInfo_v2_ptsz_v11030 = 410,
|
| 421 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamUpdateCaptureDependencies_v11030 = 411,
|
| 422 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamUpdateCaptureDependencies_ptsz_v11030 = 412,
|
| 423 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaUserObjectCreate_v11030 = 413,
|
| 424 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaUserObjectRetain_v11030 = 414,
|
| 425 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaUserObjectRelease_v11030 = 415,
|
| 426 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphRetainUserObject_v11030 = 416,
|
| 427 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphReleaseUserObject_v11030 = 417,
|
| 428 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphInstantiateWithFlags_v11040 = 418,
|
| 429 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddMemAllocNode_v11040 = 419,
|
| 430 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphMemAllocNodeGetParams_v11040 = 420,
|
| 431 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddMemFreeNode_v11040 = 421,
|
| 432 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphMemFreeNodeGetParams_v11040 = 422,
|
| 433 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGraphMemTrim_v11040 = 423,
|
| 434 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceGetGraphMemAttribute_v11040 = 424,
|
| 435 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaDeviceSetGraphMemAttribute_v11040 = 425,
|
| 436 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphNodeSetEnabled_v11060 = 426,
|
| 437 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphNodeGetEnabled_v11060 = 427,
|
| 438 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaArrayGetMemoryRequirements_v11060 = 428,
|
| 439 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMipmappedArrayGetMemoryRequirements_v11060 = 429,
|
| 440 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaLaunchKernelExC_v11060 = 430,
|
| 441 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaLaunchKernelExC_ptsz_v11060 = 431,
|
| 442 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaOccupancyMaxPotentialClusterSize_v11070 = 432,
|
| 443 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaOccupancyMaxActiveClusters_v11070 = 433,
|
| 444 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaCreateTextureObject_v2_v11080 = 434,
|
| 445 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetTextureObjectTextureDesc_v2_v11080 = 435,
|
| 446 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphInstantiateWithParams_v12000 = 436,
|
| 447 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphInstantiateWithParams_ptsz_v12000 = 437,
|
| 448 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecGetFlags_v12000 = 438,
|
| 449 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetKernel_v12000 = 439,
|
| 450 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGetDeviceProperties_v2_v12000 = 440,
|
| 451 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetId_v12000 = 441,
|
| 452 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetId_ptsz_v12000 = 442,
|
| 453 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphInstantiate_v12000 = 443,
|
| 454 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaInitDevice_v12000 = 444,
|
| 455 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddNode_v12020 = 445,
|
| 456 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphNodeSetParams_v12020 = 446,
|
| 457 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphExecNodeSetParams_v12020 = 447,
|
| 458 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemAdvise_v2_v12020 = 448,
|
| 459 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemPrefetchAsync_v2_v12020 = 449,
|
| 460 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaMemPrefetchAsync_v2_ptsz_v12020 = 450,
|
| 461 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaFuncGetName_v12030 = 451,
|
| 462 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamBeginCaptureToGraph_v12030 = 452,
|
| 463 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamBeginCaptureToGraph_ptsz_v12030 = 453,
|
| 464 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphConditionalHandleCreate_v12030 = 454,
|
| 465 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphGetEdges_v2_v12030 = 455,
|
| 466 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphNodeGetDependencies_v2_v12030 = 456,
|
| 467 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphNodeGetDependentNodes_v2_v12030 = 457,
|
| 468 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddDependencies_v2_v12030 = 458,
|
| 469 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphRemoveDependencies_v2_v12030 = 459,
|
| 470 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaGraphAddNode_v2_v12030 = 460,
|
| 471 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetCaptureInfo_v3_v12030 = 461,
|
| 472 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamGetCaptureInfo_v3_ptsz_v12030 = 462,
|
| 473 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamUpdateCaptureDependencies_v2_v12030 = 463,
|
| 474 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaStreamUpdateCaptureDependencies_v2_ptsz_v12030 = 464,
|
| 475 |
+
CUPTI_RUNTIME_TRACE_CBID_cuda465_v12040 = 465,
|
| 476 |
+
CUPTI_RUNTIME_TRACE_CBID_cuda466_v12040 = 466,
|
| 477 |
+
CUPTI_RUNTIME_TRACE_CBID_cudaFuncGetParamInfo_v12040 = 467,
|
| 478 |
+
CUPTI_RUNTIME_TRACE_CBID_SIZE = 468,
|
| 479 |
+
CUPTI_RUNTIME_TRACE_CBID_FORCE_INT = 0x7fffffff
|
| 480 |
+
} CUpti_runtime_api_trace_cbid;
|
| 481 |
+
|
vllm/lib/python3.10/site-packages/triton/backends/nvidia/include/cupti_version.h
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2010-2023 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(_CUPTI_VERSION_H_)
|
| 51 |
+
#define _CUPTI_VERSION_H_
|
| 52 |
+
|
| 53 |
+
#include <cuda_stdint.h>
|
| 54 |
+
#include <cupti_result.h>
|
| 55 |
+
|
| 56 |
+
#ifndef CUPTIAPI
|
| 57 |
+
#ifdef _WIN32
|
| 58 |
+
#define CUPTIAPI __stdcall
|
| 59 |
+
#else
|
| 60 |
+
#define CUPTIAPI
|
| 61 |
+
#endif
|
| 62 |
+
#endif
|
| 63 |
+
|
| 64 |
+
#if defined(__cplusplus)
|
| 65 |
+
extern "C" {
|
| 66 |
+
#endif
|
| 67 |
+
|
| 68 |
+
#if defined(__GNUC__) && defined(CUPTI_LIB)
|
| 69 |
+
#pragma GCC visibility push(default)
|
| 70 |
+
#endif
|
| 71 |
+
|
| 72 |
+
/**
|
| 73 |
+
* \defgroup CUPTI_VERSION_API CUPTI Version
|
| 74 |
+
* Function and macro to determine the CUPTI version.
|
| 75 |
+
* @{
|
| 76 |
+
*/
|
| 77 |
+
|
| 78 |
+
/**
|
| 79 |
+
* \brief The API version for this implementation of CUPTI.
|
| 80 |
+
*
|
| 81 |
+
* The API version for this implementation of CUPTI. This define along
|
| 82 |
+
* with \ref cuptiGetVersion can be used to dynamically detect if the
|
| 83 |
+
* version of CUPTI compiled against matches the version of the loaded
|
| 84 |
+
* CUPTI library.
|
| 85 |
+
*
|
| 86 |
+
* v1 : CUDAToolsSDK 4.0
|
| 87 |
+
* v2 : CUDAToolsSDK 4.1
|
| 88 |
+
* v3 : CUDA Toolkit 5.0
|
| 89 |
+
* v4 : CUDA Toolkit 5.5
|
| 90 |
+
* v5 : CUDA Toolkit 6.0
|
| 91 |
+
* v6 : CUDA Toolkit 6.5
|
| 92 |
+
* v7 : CUDA Toolkit 6.5(with sm_52 support)
|
| 93 |
+
* v8 : CUDA Toolkit 7.0
|
| 94 |
+
* v9 : CUDA Toolkit 8.0
|
| 95 |
+
* v10 : CUDA Toolkit 9.0
|
| 96 |
+
* v11 : CUDA Toolkit 9.1
|
| 97 |
+
* v12 : CUDA Toolkit 10.0, 10.1 and 10.2
|
| 98 |
+
* v13 : CUDA Toolkit 11.0
|
| 99 |
+
* v14 : CUDA Toolkit 11.1
|
| 100 |
+
* v15 : CUDA Toolkit 11.2, 11.3 and 11.4
|
| 101 |
+
* v16 : CUDA Toolkit 11.5
|
| 102 |
+
* v17 : CUDA Toolkit 11.6
|
| 103 |
+
* v18 : CUDA Toolkit 11.8
|
| 104 |
+
* v19 : CUDA Toolkit 12.0
|
| 105 |
+
* v20 : CUDA Toolkit 12.2
|
| 106 |
+
* v21 : CUDA Toolkit 12.3
|
| 107 |
+
* v22 : CUDA Toolkit 12.4
|
| 108 |
+
*/
|
| 109 |
+
#define CUPTI_API_VERSION 22
|
| 110 |
+
|
| 111 |
+
/**
|
| 112 |
+
* \brief Get the CUPTI API version.
|
| 113 |
+
*
|
| 114 |
+
* Return the API version in \p *version.
|
| 115 |
+
*
|
| 116 |
+
* \param version Returns the version
|
| 117 |
+
*
|
| 118 |
+
* \retval CUPTI_SUCCESS on success
|
| 119 |
+
* \retval CUPTI_ERROR_INVALID_PARAMETER if \p version is NULL
|
| 120 |
+
* \sa CUPTI_API_VERSION
|
| 121 |
+
*/
|
| 122 |
+
CUptiResult CUPTIAPI cuptiGetVersion(uint32_t *version);
|
| 123 |
+
|
| 124 |
+
/** @} */ /* END CUPTI_VERSION_API */
|
| 125 |
+
|
| 126 |
+
#if defined(__GNUC__) && defined(CUPTI_LIB)
|
| 127 |
+
#pragma GCC visibility pop
|
| 128 |
+
#endif
|
| 129 |
+
|
| 130 |
+
#if defined(__cplusplus)
|
| 131 |
+
}
|
| 132 |
+
#endif
|
| 133 |
+
|
| 134 |
+
#endif /*_CUPTI_VERSION_H_*/
|
vllm/lib/python3.10/site-packages/triton/backends/nvidia/include/sm_32_atomic_functions.h
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 1993-2023 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 35.235 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.35.235 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
//NOTE: For NVRTC, these declarations have been moved into the compiler (to reduce compile time)
|
| 51 |
+
#define EXCLUDE_FROM_RTC
|
| 52 |
+
|
| 53 |
+
#if !defined(__SM_32_ATOMIC_FUNCTIONS_H__)
|
| 54 |
+
#define __SM_32_ATOMIC_FUNCTIONS_H__
|
| 55 |
+
|
| 56 |
+
#if defined(__CUDACC_RTC__)
|
| 57 |
+
#define __SM_32_ATOMIC_FUNCTIONS_DECL__ __device__
|
| 58 |
+
#elif defined(_NVHPC_CUDA)
|
| 59 |
+
#define __SM_32_ATOMIC_FUNCTIONS_DECL__ extern __device__ __cudart_builtin__
|
| 60 |
+
#else /* !__CUDACC_RTC__ */
|
| 61 |
+
#define __SM_32_ATOMIC_FUNCTIONS_DECL__ static __inline__ __device__
|
| 62 |
+
#endif /* __CUDACC_RTC__ */
|
| 63 |
+
|
| 64 |
+
#if defined(__cplusplus) && defined(__CUDACC__)
|
| 65 |
+
|
| 66 |
+
#if defined(_NVHPC_CUDA) || !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 320
|
| 67 |
+
|
| 68 |
+
/*******************************************************************************
|
| 69 |
+
* *
|
| 70 |
+
* *
|
| 71 |
+
* *
|
| 72 |
+
*******************************************************************************/
|
| 73 |
+
|
| 74 |
+
#include "cuda_runtime_api.h"
|
| 75 |
+
|
| 76 |
+
#if !defined(__CUDA_ARCH__) && !defined(_NVHPC_CUDA)
|
| 77 |
+
#define __DEF_IF_HOST { }
|
| 78 |
+
#else /* !__CUDA_ARCH__ && !_NVHPC_CUDA */
|
| 79 |
+
#define __DEF_IF_HOST ;
|
| 80 |
+
#endif /* __CUDA_ARCH__ || _NVHPC_CUDA */
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
/*******************************************************************************
|
| 84 |
+
* *
|
| 85 |
+
* *
|
| 86 |
+
* *
|
| 87 |
+
*******************************************************************************/
|
| 88 |
+
|
| 89 |
+
__SM_32_ATOMIC_FUNCTIONS_DECL__ long long atomicMin(long long *address, long long val) __DEF_IF_HOST
|
| 90 |
+
|
| 91 |
+
__SM_32_ATOMIC_FUNCTIONS_DECL__ long long atomicMax(long long *address, long long val) __DEF_IF_HOST
|
| 92 |
+
|
| 93 |
+
__SM_32_ATOMIC_FUNCTIONS_DECL__ long long atomicAnd(long long *address, long long val) __DEF_IF_HOST
|
| 94 |
+
|
| 95 |
+
__SM_32_ATOMIC_FUNCTIONS_DECL__ long long atomicOr(long long *address, long long val) __DEF_IF_HOST
|
| 96 |
+
|
| 97 |
+
__SM_32_ATOMIC_FUNCTIONS_DECL__ long long atomicXor(long long *address, long long val) __DEF_IF_HOST
|
| 98 |
+
|
| 99 |
+
__SM_32_ATOMIC_FUNCTIONS_DECL__ unsigned long long atomicMin(unsigned long long *address, unsigned long long val) __DEF_IF_HOST
|
| 100 |
+
|
| 101 |
+
__SM_32_ATOMIC_FUNCTIONS_DECL__ unsigned long long atomicMax(unsigned long long *address, unsigned long long val) __DEF_IF_HOST
|
| 102 |
+
|
| 103 |
+
__SM_32_ATOMIC_FUNCTIONS_DECL__ unsigned long long atomicAnd(unsigned long long *address, unsigned long long val) __DEF_IF_HOST
|
| 104 |
+
|
| 105 |
+
__SM_32_ATOMIC_FUNCTIONS_DECL__ unsigned long long atomicOr(unsigned long long *address, unsigned long long val) __DEF_IF_HOST
|
| 106 |
+
|
| 107 |
+
__SM_32_ATOMIC_FUNCTIONS_DECL__ unsigned long long atomicXor(unsigned long long *address, unsigned long long val) __DEF_IF_HOST
|
| 108 |
+
|
| 109 |
+
#endif /* !__CUDA_ARCH__ || __CUDA_ARCH__ >= 320 */
|
| 110 |
+
|
| 111 |
+
#endif /* __cplusplus && __CUDACC__ */
|
| 112 |
+
|
| 113 |
+
#undef __DEF_IF_HOST
|
| 114 |
+
#undef __SM_32_ATOMIC_FUNCTIONS_DECL__
|
| 115 |
+
|
| 116 |
+
#if !defined(__CUDACC_RTC__) && defined(__CUDA_ARCH__)
|
| 117 |
+
#include "sm_32_atomic_functions.hpp"
|
| 118 |
+
#endif /* !__CUDACC_RTC__ && defined(__CUDA_ARCH__) */
|
| 119 |
+
|
| 120 |
+
#endif /* !__SM_32_ATOMIC_FUNCTIONS_H__ */
|
| 121 |
+
|
| 122 |
+
#undef EXCLUDE_FROM_RTC
|
vllm/lib/python3.10/site-packages/triton/backends/nvidia/include/sm_61_intrinsics.hpp
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2016 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(__SM_61_INTRINSICS_HPP__)
|
| 51 |
+
#define __SM_61_INTRINSICS_HPP__
|
| 52 |
+
|
| 53 |
+
#if defined(__CUDACC_RTC__)
|
| 54 |
+
#define __SM_61_INTRINSICS_DECL__ __device__
|
| 55 |
+
#else /* !__CUDACC_RTC__ */
|
| 56 |
+
#define __SM_61_INTRINSICS_DECL__ static __device__ __inline__
|
| 57 |
+
#endif /* __CUDACC_RTC__ */
|
| 58 |
+
|
| 59 |
+
#if defined(__cplusplus) && defined(__CUDACC__)
|
| 60 |
+
|
| 61 |
+
#if defined(_NVHPC_CUDA) || !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 610
|
| 62 |
+
|
| 63 |
+
/*******************************************************************************
|
| 64 |
+
* *
|
| 65 |
+
* *
|
| 66 |
+
* *
|
| 67 |
+
*******************************************************************************/
|
| 68 |
+
|
| 69 |
+
#include "cuda_runtime_api.h"
|
| 70 |
+
|
| 71 |
+
/*******************************************************************************
|
| 72 |
+
* *
|
| 73 |
+
* Below are implementations of SM-6.1 intrinsics which are included as *
|
| 74 |
+
* source (instead of being built in to the compiler) *
|
| 75 |
+
* *
|
| 76 |
+
*******************************************************************************/
|
| 77 |
+
|
| 78 |
+
// 4a
|
| 79 |
+
__SM_61_INTRINSICS_DECL__ int __dp4a(int srcA, int srcB, int c) {
|
| 80 |
+
int ret;
|
| 81 |
+
asm volatile ("dp4a.s32.s32 %0, %1, %2, %3;" : "=r"(ret) : "r"(srcA), "r"(srcB), "r"(c));
|
| 82 |
+
return ret;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
__SM_61_INTRINSICS_DECL__ unsigned int __dp4a(unsigned int srcA, unsigned int srcB, unsigned int c) {
|
| 86 |
+
unsigned int ret;
|
| 87 |
+
asm volatile ("dp4a.u32.u32 %0, %1, %2, %3;" : "=r"(ret) : "r"(srcA), "r"(srcB), "r"(c));
|
| 88 |
+
return ret;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
__SM_61_INTRINSICS_DECL__ int __dp4a(char4 srcA, char4 srcB, int c) {
|
| 92 |
+
int ret;
|
| 93 |
+
asm volatile ("dp4a.s32.s32 %0, %1, %2, %3;" : "=r"(ret) : "r"(*(int *)&srcA), "r"(*(int *)&srcB), "r"(c));
|
| 94 |
+
return ret;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
__SM_61_INTRINSICS_DECL__ unsigned int __dp4a(uchar4 srcA, uchar4 srcB, unsigned int c) {
|
| 98 |
+
unsigned int ret;
|
| 99 |
+
asm volatile ("dp4a.u32.u32 %0, %1, %2, %3;" : "=r"(ret) : "r"(*(unsigned int *)&srcA), "r"(*(unsigned int *)&srcB), "r"(c));
|
| 100 |
+
return ret;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
// 2a.lo
|
| 104 |
+
__SM_61_INTRINSICS_DECL__ int __dp2a_lo(int srcA, int srcB, int c) {
|
| 105 |
+
int ret;
|
| 106 |
+
asm volatile ("dp2a.lo.s32.s32 %0, %1, %2, %3;" : "=r"(ret) : "r"(srcA), "r"(srcB), "r"(c));
|
| 107 |
+
return ret;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
__SM_61_INTRINSICS_DECL__ unsigned int __dp2a_lo(unsigned int srcA, unsigned int srcB, unsigned int c) {
|
| 111 |
+
unsigned int ret;
|
| 112 |
+
asm volatile ("dp2a.lo.u32.u32 %0, %1, %2, %3;" : "=r"(ret) : "r"(srcA), "r"(srcB), "r"(c));
|
| 113 |
+
return ret;
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
__SM_61_INTRINSICS_DECL__ int __dp2a_lo(short2 srcA, char4 srcB, int c) {
|
| 117 |
+
int ret;
|
| 118 |
+
asm volatile ("dp2a.lo.s32.s32 %0, %1, %2, %3;" : "=r"(ret) : "r"(*(int *)&srcA), "r"(*(int *)&srcB), "r"(c));
|
| 119 |
+
return ret;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
__SM_61_INTRINSICS_DECL__ unsigned int __dp2a_lo(ushort2 srcA, uchar4 srcB, unsigned int c) {
|
| 123 |
+
unsigned int ret;
|
| 124 |
+
asm volatile ("dp2a.lo.u32.u32 %0, %1, %2, %3;" : "=r"(ret) : "r"(*(unsigned int *)&srcA), "r"(*(unsigned int *)&srcB), "r"(c));
|
| 125 |
+
return ret;
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
// 2a.hi
|
| 129 |
+
__SM_61_INTRINSICS_DECL__ int __dp2a_hi(int srcA, int srcB, int c) {
|
| 130 |
+
int ret;
|
| 131 |
+
asm volatile ("dp2a.hi.s32.s32 %0, %1, %2, %3;" : "=r"(ret) : "r"(srcA), "r"(srcB), "r"(c));
|
| 132 |
+
return ret;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
__SM_61_INTRINSICS_DECL__ unsigned int __dp2a_hi(unsigned int srcA, unsigned int srcB, unsigned int c) {
|
| 136 |
+
unsigned int ret;
|
| 137 |
+
asm volatile ("dp2a.hi.u32.u32 %0, %1, %2, %3;" : "=r"(ret) : "r"(srcA), "r"(srcB), "r"(c));
|
| 138 |
+
return ret;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
__SM_61_INTRINSICS_DECL__ int __dp2a_hi(short2 srcA, char4 srcB, int c) {
|
| 142 |
+
int ret;
|
| 143 |
+
asm volatile ("dp2a.hi.s32.s32 %0, %1, %2, %3;" : "=r"(ret) : "r"(*(int *)&srcA), "r"(*(int *)&srcB), "r"(c));
|
| 144 |
+
return ret;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
__SM_61_INTRINSICS_DECL__ unsigned int __dp2a_hi(ushort2 srcA, uchar4 srcB, unsigned int c) {
|
| 148 |
+
unsigned int ret;
|
| 149 |
+
asm volatile ("dp2a.hi.u32.u32 %0, %1, %2, %3;" : "=r"(ret) : "r"(*(unsigned int *)&srcA), "r"(*(unsigned int *)&srcB), "r"(c));
|
| 150 |
+
return ret;
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
#endif /* _NVHPC_CUDA || !__CUDA_ARCH__ || __CUDA_ARCH__ >= 610 */
|
| 155 |
+
|
| 156 |
+
#endif /* __cplusplus && __CUDACC__ */
|
| 157 |
+
|
| 158 |
+
#undef __SM_61_INTRINSICS_DECL__
|
| 159 |
+
|
| 160 |
+
#endif /* !__SM_61_INTRINSICS_HPP__ */
|
| 161 |
+
|