nvfuser-cu121-torch25 0.2.25.dev20250201__cp310-cp310-manylinux_2_28_x86_64.whl
Sign up to get free protection for your applications and to get access to all the features.
- nvfuser/_C.cpython-310-x86_64-linux-gnu.so +0 -0
- nvfuser/__init__.py +618 -0
- nvfuser/__init__.pyi +4 -0
- nvfuser/contrib/__init__.py +9 -0
- nvfuser/contrib/nn/__init__.py +13 -0
- nvfuser/contrib/nn/normalization.py +725 -0
- nvfuser/include/nvfuser/alias_analysis.h +116 -0
- nvfuser/include/nvfuser/bfs.h +929 -0
- nvfuser/include/nvfuser/codegen.h +26 -0
- nvfuser/include/nvfuser/compute_at.h +28 -0
- nvfuser/include/nvfuser/compute_at_map.h +394 -0
- nvfuser/include/nvfuser/contiguity.h +351 -0
- nvfuser/include/nvfuser/cuda_utils.h +50 -0
- nvfuser/include/nvfuser/debug.h +50 -0
- nvfuser/include/nvfuser/device_lower/analysis/bank_conflict.h +53 -0
- nvfuser/include/nvfuser/device_lower/analysis/circular_buffer.h +109 -0
- nvfuser/include/nvfuser/device_lower/analysis/device_version.h +65 -0
- nvfuser/include/nvfuser/device_lower/analysis/divisible_split.h +28 -0
- nvfuser/include/nvfuser/device_lower/analysis/fused_reduction.h +36 -0
- nvfuser/include/nvfuser/device_lower/analysis/index_compute.h +322 -0
- nvfuser/include/nvfuser/device_lower/analysis/predicate_elimination.h +71 -0
- nvfuser/include/nvfuser/device_lower/analysis/sync_information.h +47 -0
- nvfuser/include/nvfuser/device_lower/analysis/tensor_memory.h +65 -0
- nvfuser/include/nvfuser/device_lower/analysis/thread_predicate.h +158 -0
- nvfuser/include/nvfuser/device_lower/analysis/tma.h +93 -0
- nvfuser/include/nvfuser/device_lower/analysis/trivial_broadcast.h +75 -0
- nvfuser/include/nvfuser/device_lower/id_model_options.h +135 -0
- nvfuser/include/nvfuser/device_lower/lower2device.h +391 -0
- nvfuser/include/nvfuser/device_lower/pass/alias_memory.h +37 -0
- nvfuser/include/nvfuser/device_lower/pass/allocation.h +32 -0
- nvfuser/include/nvfuser/device_lower/pass/circular_buffer.h +191 -0
- nvfuser/include/nvfuser/device_lower/pass/expr_sort.h +17 -0
- nvfuser/include/nvfuser/device_lower/pass/fusion_simplifier.h +21 -0
- nvfuser/include/nvfuser/device_lower/pass/grid_serialization.h +26 -0
- nvfuser/include/nvfuser/device_lower/pass/index.h +200 -0
- nvfuser/include/nvfuser/device_lower/pass/inline_ptx.h +16 -0
- nvfuser/include/nvfuser/device_lower/pass/insert_syncs.h +39 -0
- nvfuser/include/nvfuser/device_lower/pass/instrument.h +24 -0
- nvfuser/include/nvfuser/device_lower/pass/loop_rotation.h +150 -0
- nvfuser/include/nvfuser/device_lower/pass/loops.h +68 -0
- nvfuser/include/nvfuser/device_lower/pass/magic_zero.h +86 -0
- nvfuser/include/nvfuser/device_lower/pass/misaligned_vectorization.h +118 -0
- nvfuser/include/nvfuser/device_lower/pass/predicate.h +23 -0
- nvfuser/include/nvfuser/device_lower/pass/replace_size.h +24 -0
- nvfuser/include/nvfuser/device_lower/pass/scalar_hoist.h +115 -0
- nvfuser/include/nvfuser/device_lower/pass/unroll.h +98 -0
- nvfuser/include/nvfuser/device_lower/pass/vectorize_welford.h +45 -0
- nvfuser/include/nvfuser/device_lower/pass/warp_reduce.h +23 -0
- nvfuser/include/nvfuser/device_lower/utils.h +382 -0
- nvfuser/include/nvfuser/device_lower/validation.h +74 -0
- nvfuser/include/nvfuser/disjoint_set.h +556 -0
- nvfuser/include/nvfuser/dispatch.h +334 -0
- nvfuser/include/nvfuser/driver_api.h +49 -0
- nvfuser/include/nvfuser/dynamic_transform.h +316 -0
- nvfuser/include/nvfuser/dynamic_type/C++20/type_traits +37 -0
- nvfuser/include/nvfuser/dynamic_type/dynamic_type.h +969 -0
- nvfuser/include/nvfuser/dynamic_type/error.h +24 -0
- nvfuser/include/nvfuser/dynamic_type/type_traits.h +703 -0
- nvfuser/include/nvfuser/evaluator_common.h +295 -0
- nvfuser/include/nvfuser/exceptions.h +283 -0
- nvfuser/include/nvfuser/expr_evaluator.h +125 -0
- nvfuser/include/nvfuser/expr_simplifier.h +218 -0
- nvfuser/include/nvfuser/flatbuffers/allocator.h +68 -0
- nvfuser/include/nvfuser/flatbuffers/array.h +253 -0
- nvfuser/include/nvfuser/flatbuffers/base.h +486 -0
- nvfuser/include/nvfuser/flatbuffers/buffer.h +154 -0
- nvfuser/include/nvfuser/flatbuffers/buffer_ref.h +53 -0
- nvfuser/include/nvfuser/flatbuffers/code_generator.h +80 -0
- nvfuser/include/nvfuser/flatbuffers/code_generators.h +234 -0
- nvfuser/include/nvfuser/flatbuffers/default_allocator.h +64 -0
- nvfuser/include/nvfuser/flatbuffers/detached_buffer.h +114 -0
- nvfuser/include/nvfuser/flatbuffers/flatbuffer_builder.h +1225 -0
- nvfuser/include/nvfuser/flatbuffers/flatbuffers.h +272 -0
- nvfuser/include/nvfuser/flatbuffers/flatc.h +130 -0
- nvfuser/include/nvfuser/flatbuffers/flex_flat_util.h +36 -0
- nvfuser/include/nvfuser/flatbuffers/flexbuffers.h +1889 -0
- nvfuser/include/nvfuser/flatbuffers/grpc.h +300 -0
- nvfuser/include/nvfuser/flatbuffers/hash.h +127 -0
- nvfuser/include/nvfuser/flatbuffers/idl.h +1359 -0
- nvfuser/include/nvfuser/flatbuffers/minireflect.h +420 -0
- nvfuser/include/nvfuser/flatbuffers/reflection.h +522 -0
- nvfuser/include/nvfuser/flatbuffers/reflection_generated.h +1471 -0
- nvfuser/include/nvfuser/flatbuffers/registry.h +128 -0
- nvfuser/include/nvfuser/flatbuffers/stl_emulation.h +513 -0
- nvfuser/include/nvfuser/flatbuffers/string.h +64 -0
- nvfuser/include/nvfuser/flatbuffers/struct.h +53 -0
- nvfuser/include/nvfuser/flatbuffers/table.h +168 -0
- nvfuser/include/nvfuser/flatbuffers/util.h +731 -0
- nvfuser/include/nvfuser/flatbuffers/vector.h +393 -0
- nvfuser/include/nvfuser/flatbuffers/vector_downward.h +273 -0
- nvfuser/include/nvfuser/flatbuffers/verifier.h +317 -0
- nvfuser/include/nvfuser/fusion.h +511 -0
- nvfuser/include/nvfuser/fusion_guard.h +37 -0
- nvfuser/include/nvfuser/fusion_profiler.h +311 -0
- nvfuser/include/nvfuser/fusion_segmenter.h +751 -0
- nvfuser/include/nvfuser/global_allocator.h +27 -0
- nvfuser/include/nvfuser/grouped_reduction.h +47 -0
- nvfuser/include/nvfuser/host_ir/container.h +60 -0
- nvfuser/include/nvfuser/host_ir/executor.h +152 -0
- nvfuser/include/nvfuser/host_ir/host_ir.h +320 -0
- nvfuser/include/nvfuser/host_ir/lower.h +35 -0
- nvfuser/include/nvfuser/id_model/circular_buffer_indexing.h +56 -0
- nvfuser/include/nvfuser/id_model/contiguity.h +166 -0
- nvfuser/include/nvfuser/id_model/id_model.h +359 -0
- nvfuser/include/nvfuser/id_model/id_model_index_compute.h +81 -0
- nvfuser/include/nvfuser/id_model/indexing.h +208 -0
- nvfuser/include/nvfuser/id_model/indexing_traversal.h +72 -0
- nvfuser/include/nvfuser/id_model/indexing_utils.h +62 -0
- nvfuser/include/nvfuser/id_model/loop_promotion.h +180 -0
- nvfuser/include/nvfuser/id_model/predicate_indexing.h +104 -0
- nvfuser/include/nvfuser/id_model/schedule.h +54 -0
- nvfuser/include/nvfuser/id_model/to_string.h +87 -0
- nvfuser/include/nvfuser/id_model/transform_replay.h +58 -0
- nvfuser/include/nvfuser/id_model/utils.h +176 -0
- nvfuser/include/nvfuser/id_model/validation_utils.h +55 -0
- nvfuser/include/nvfuser/index_compute.h +651 -0
- nvfuser/include/nvfuser/instrumentation.h +107 -0
- nvfuser/include/nvfuser/ir/all_nodes.h +14 -0
- nvfuser/include/nvfuser/ir/base_nodes.h +687 -0
- nvfuser/include/nvfuser/ir/builder.h +215 -0
- nvfuser/include/nvfuser/ir/builder_passkey.h +29 -0
- nvfuser/include/nvfuser/ir/cloner.h +185 -0
- nvfuser/include/nvfuser/ir/container.h +226 -0
- nvfuser/include/nvfuser/ir/graphviz.h +119 -0
- nvfuser/include/nvfuser/ir/interface_nodes.h +957 -0
- nvfuser/include/nvfuser/ir/internal_base_nodes.h +744 -0
- nvfuser/include/nvfuser/ir/internal_nodes.h +2792 -0
- nvfuser/include/nvfuser/ir/iostream.h +98 -0
- nvfuser/include/nvfuser/ir/printer.h +57 -0
- nvfuser/include/nvfuser/ir/utils.h +801 -0
- nvfuser/include/nvfuser/iter_visitor.h +661 -0
- nvfuser/include/nvfuser/kernel.h +299 -0
- nvfuser/include/nvfuser/kernel_db/kernel_db.h +109 -0
- nvfuser/include/nvfuser/kernel_db/utils.h +37 -0
- nvfuser/include/nvfuser/kernel_ir.h +1457 -0
- nvfuser/include/nvfuser/kernel_ir_dispatch.h +147 -0
- nvfuser/include/nvfuser/linked_hash_map.h +97 -0
- nvfuser/include/nvfuser/logical_domain_map.h +577 -0
- nvfuser/include/nvfuser/macros.h +23 -0
- nvfuser/include/nvfuser/mma_type.h +257 -0
- nvfuser/include/nvfuser/multidevice/c10d_mock.h +175 -0
- nvfuser/include/nvfuser/multidevice/communication.h +232 -0
- nvfuser/include/nvfuser/multidevice/communicator.h +179 -0
- nvfuser/include/nvfuser/multidevice/device_mesh.h +95 -0
- nvfuser/include/nvfuser/multidevice/executor.h +107 -0
- nvfuser/include/nvfuser/multidevice/multidevice.h +18 -0
- nvfuser/include/nvfuser/multidevice/utils.h +187 -0
- nvfuser/include/nvfuser/non_divisible_split.h +86 -0
- nvfuser/include/nvfuser/opaque_type.h +129 -0
- nvfuser/include/nvfuser/ops/alias.h +192 -0
- nvfuser/include/nvfuser/ops/all_ops.h +13 -0
- nvfuser/include/nvfuser/ops/arith.h +712 -0
- nvfuser/include/nvfuser/ops/composite.h +130 -0
- nvfuser/include/nvfuser/ops/indexing.h +55 -0
- nvfuser/include/nvfuser/ops/normalization.h +263 -0
- nvfuser/include/nvfuser/ops/utils.h +127 -0
- nvfuser/include/nvfuser/options.h +313 -0
- nvfuser/include/nvfuser/parallel_dimension_map.h +95 -0
- nvfuser/include/nvfuser/parallel_type_bitmap.h +365 -0
- nvfuser/include/nvfuser/polymorphic_value.h +432 -0
- nvfuser/include/nvfuser/predicate_compute.h +213 -0
- nvfuser/include/nvfuser/python_frontend/distributed_tensor.h +50 -0
- nvfuser/include/nvfuser/python_frontend/fusion_cache.h +298 -0
- nvfuser/include/nvfuser/python_frontend/fusion_definition.h +372 -0
- nvfuser/include/nvfuser/python_frontend/fusion_record.h +3124 -0
- nvfuser/include/nvfuser/python_frontend/fusion_state.h +143 -0
- nvfuser/include/nvfuser/python_frontend/python_bindings.h +27 -0
- nvfuser/include/nvfuser/python_frontend/segmentation.h +246 -0
- nvfuser/include/nvfuser/python_frontend/translation.h +20 -0
- nvfuser/include/nvfuser/python_frontend/translation_utils.h +308 -0
- nvfuser/include/nvfuser/scheduler/all_schedulers.h +17 -0
- nvfuser/include/nvfuser/scheduler/ampere_multi_matmul.h +206 -0
- nvfuser/include/nvfuser/scheduler/cache_policy_refiner.h +19 -0
- nvfuser/include/nvfuser/scheduler/compile_time_info.h +322 -0
- nvfuser/include/nvfuser/scheduler/debug_utils.h +68 -0
- nvfuser/include/nvfuser/scheduler/expr_eval_sched.h +45 -0
- nvfuser/include/nvfuser/scheduler/heuristic.h +113 -0
- nvfuser/include/nvfuser/scheduler/hopper_multi_matmul.h +204 -0
- nvfuser/include/nvfuser/scheduler/mark_aliases.h +19 -0
- nvfuser/include/nvfuser/scheduler/matmul.h +40 -0
- nvfuser/include/nvfuser/scheduler/matmul_heuristic.h +293 -0
- nvfuser/include/nvfuser/scheduler/matmul_heuristic_plugin.h +65 -0
- nvfuser/include/nvfuser/scheduler/matmul_heuristic_plugin_api.h +99 -0
- nvfuser/include/nvfuser/scheduler/matmul_utils.h +54 -0
- nvfuser/include/nvfuser/scheduler/mma_utils.h +500 -0
- nvfuser/include/nvfuser/scheduler/multi_matmul.h +74 -0
- nvfuser/include/nvfuser/scheduler/no_op.h +48 -0
- nvfuser/include/nvfuser/scheduler/normalization_inner.h +49 -0
- nvfuser/include/nvfuser/scheduler/normalization_inner_outer.h +51 -0
- nvfuser/include/nvfuser/scheduler/normalization_outer.h +48 -0
- nvfuser/include/nvfuser/scheduler/normalization_utils.h +379 -0
- nvfuser/include/nvfuser/scheduler/pointwise.h +183 -0
- nvfuser/include/nvfuser/scheduler/pointwise_heuristic.h +118 -0
- nvfuser/include/nvfuser/scheduler/pointwise_utils.h +24 -0
- nvfuser/include/nvfuser/scheduler/reduction.h +43 -0
- nvfuser/include/nvfuser/scheduler/reduction_heuristic.h +339 -0
- nvfuser/include/nvfuser/scheduler/reduction_utils.h +159 -0
- nvfuser/include/nvfuser/scheduler/registry.h +97 -0
- nvfuser/include/nvfuser/scheduler/registry_utils.h +111 -0
- nvfuser/include/nvfuser/scheduler/resize.h +41 -0
- nvfuser/include/nvfuser/scheduler/resize_heuristic.h +67 -0
- nvfuser/include/nvfuser/scheduler/runtime_info.h +166 -0
- nvfuser/include/nvfuser/scheduler/scheduler_types.h +80 -0
- nvfuser/include/nvfuser/scheduler/transpose.h +114 -0
- nvfuser/include/nvfuser/scheduler/transpose_heuristic.h +164 -0
- nvfuser/include/nvfuser/scheduler/utils.h +771 -0
- nvfuser/include/nvfuser/scheduler/vectorize_helper.h +349 -0
- nvfuser/include/nvfuser/serde/factory.h +55 -0
- nvfuser/include/nvfuser/serde/fusion_cache_generated.h +4319 -0
- nvfuser/include/nvfuser/serde/fusion_record.h +124 -0
- nvfuser/include/nvfuser/serde/polymorphic_value.h +52 -0
- nvfuser/include/nvfuser/serde/utils.h +34 -0
- nvfuser/include/nvfuser/struct.inl +127 -0
- nvfuser/include/nvfuser/swizzle.h +54 -0
- nvfuser/include/nvfuser/sys_utils.h +40 -0
- nvfuser/include/nvfuser/tensor_metadata.h +118 -0
- nvfuser/include/nvfuser/tma.h +124 -0
- nvfuser/include/nvfuser/transform_iter.h +522 -0
- nvfuser/include/nvfuser/transform_replay.h +297 -0
- nvfuser/include/nvfuser/transform_rfactor.h +33 -0
- nvfuser/include/nvfuser/transform_view.h +136 -0
- nvfuser/include/nvfuser/type.h +1125 -0
- nvfuser/include/nvfuser/type_promotion.h +61 -0
- nvfuser/include/nvfuser/utils.h +619 -0
- nvfuser/include/nvfuser/val_graph.h +446 -0
- nvfuser/include/nvfuser/val_graph_visitor.h +259 -0
- nvfuser/include/nvfuser/validator_utils.h +92 -0
- nvfuser/include/nvfuser/vectorization_info.h +31 -0
- nvfuser/include/nvfuser/visibility.h +21 -0
- nvfuser/lib/libnvfuser_codegen.so +0 -0
- nvfuser/nvfuser_version.py +69 -0
- nvfuser/pytorch_utils.py +184 -0
- nvfuser/share/cmake/nvfuser/NvfuserConfig-release.cmake +20 -0
- nvfuser/share/cmake/nvfuser/NvfuserConfig.cmake +106 -0
- nvfuser/utils.py +18 -0
- nvfuser/version.py +1 -0
- nvfuser_cu121_torch25-0.2.25.dev20250201.dist-info/LICENSE +976 -0
- nvfuser_cu121_torch25-0.2.25.dev20250201.dist-info/METADATA +20 -0
- nvfuser_cu121_torch25-0.2.25.dev20250201.dist-info/RECORD +242 -0
- nvfuser_cu121_torch25-0.2.25.dev20250201.dist-info/WHEEL +5 -0
- nvfuser_cu121_torch25-0.2.25.dev20250201.dist-info/top_level.txt +1 -0
- nvfuser_cu121_torch25.libs/libnvToolsExt-847d78f2.so.1.0.0 +0 -0
@@ -0,0 +1,311 @@
|
|
1
|
+
// clang-format off
|
2
|
+
/*
|
3
|
+
* SPDX-FileCopyrightText: Copyright (c) 2023-present NVIDIA CORPORATION & AFFILIATES.
|
4
|
+
* All rights reserved.
|
5
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
6
|
+
*/
|
7
|
+
// clang-format on
|
8
|
+
#pragma once
|
9
|
+
#include <chrono>
|
10
|
+
#include <unordered_map>
|
11
|
+
|
12
|
+
#include <c10/cuda/CUDAStream.h>
|
13
|
+
#include <cuda_runtime.h>
|
14
|
+
#include <cuda_utils.h>
|
15
|
+
#include <debug.h>
|
16
|
+
#include <options.h>
|
17
|
+
#include <utils.h>
|
18
|
+
#include <visibility.h>
|
19
|
+
|
20
|
+
namespace nvfuser {
|
21
|
+
|
22
|
+
//! \enum ProfilerState
|
23
|
+
//! \brief An enum used to represent the state of a profiling state machine
|
24
|
+
enum class ProfilerState {
|
25
|
+
Ready,
|
26
|
+
Running,
|
27
|
+
Finished,
|
28
|
+
Processed,
|
29
|
+
};
|
30
|
+
|
31
|
+
NVF_API std::ostream& operator<<(std::ostream&, const ProfilerState&);
|
32
|
+
|
33
|
+
//! \class CudaEventTimer
|
34
|
+
//! \brief A Cuda Events based timer that includes GPU time for kernels launched
|
35
|
+
//! between those events.
|
36
|
+
class CudaEventTimer {
|
37
|
+
public:
|
38
|
+
CudaEventTimer(cudaStream_t s);
|
39
|
+
~CudaEventTimer();
|
40
|
+
|
41
|
+
void reset();
|
42
|
+
void start();
|
43
|
+
void stop();
|
44
|
+
double time();
|
45
|
+
ProfilerState state() const;
|
46
|
+
|
47
|
+
private:
|
48
|
+
cudaStream_t stream_;
|
49
|
+
cudaEvent_t start_event_;
|
50
|
+
cudaEvent_t stop_event_;
|
51
|
+
double time_ms_;
|
52
|
+
ProfilerState state_;
|
53
|
+
};
|
54
|
+
|
55
|
+
//! \class HostTimer
|
56
|
+
//! \brief A std::chrono::stead_clock based timer of CPU activity.
|
57
|
+
class HostTimer {
|
58
|
+
public:
|
59
|
+
using Clock = std::chrono::steady_clock;
|
60
|
+
|
61
|
+
HostTimer();
|
62
|
+
|
63
|
+
void reset();
|
64
|
+
void start();
|
65
|
+
void stop();
|
66
|
+
double time();
|
67
|
+
ProfilerState state() const;
|
68
|
+
|
69
|
+
private:
|
70
|
+
Clock::time_point start_event_;
|
71
|
+
Clock::time_point stop_event_;
|
72
|
+
double time_ms_;
|
73
|
+
ProfilerState state_;
|
74
|
+
};
|
75
|
+
|
76
|
+
//! \struct DeviceDescriptor
|
77
|
+
//! \brief This struct captures the GPU information necessary to calculate the
|
78
|
+
//! the Peak Bandwidth of the specific GPU queried.
|
79
|
+
struct DeviceDescriptor {
|
80
|
+
//! Queries the GPU to populate the struct's data members and calculates the
|
81
|
+
//! peak bandwidth
|
82
|
+
static void generate(DeviceDescriptor& desc, int device);
|
83
|
+
|
84
|
+
//! Queried data members
|
85
|
+
int device{-1};
|
86
|
+
std::string name{"NVIDIA Unknown GPU"};
|
87
|
+
int bus_width{0};
|
88
|
+
int memory_clock{0};
|
89
|
+
|
90
|
+
//! Calculated data member
|
91
|
+
double peak_bandwidth_gbs{0.0};
|
92
|
+
};
|
93
|
+
|
94
|
+
//! \struct KernelProfile
|
95
|
+
//! \brief This struct captures the CUPTI profiled information from a kernel
|
96
|
+
//! generated by a segment.
|
97
|
+
struct KernelProfile {
|
98
|
+
std::string name{};
|
99
|
+
size_t segment_id{0};
|
100
|
+
int device{-1};
|
101
|
+
uint32_t stream{0};
|
102
|
+
uint32_t correlation_id{0};
|
103
|
+
|
104
|
+
double compile_time_ms{0.0};
|
105
|
+
double time_ms{0.0};
|
106
|
+
double effective_bandwidth_gbs{0.0};
|
107
|
+
double percentage_peak_bandwidth{0.0};
|
108
|
+
|
109
|
+
std::array<int32_t, 3> grid{0, 0, 0};
|
110
|
+
std::array<int32_t, 3> block{0, 0, 0};
|
111
|
+
std::array<uint32_t, 3> cluster{0, 0, 0};
|
112
|
+
|
113
|
+
std::array<int32_t, 2> shared_mem{0, 0};
|
114
|
+
uint32_t registers{0};
|
115
|
+
|
116
|
+
int64_t input_bytes{0};
|
117
|
+
int64_t output_bytes{0};
|
118
|
+
|
119
|
+
std::string device_name{};
|
120
|
+
double peak_bandwidth_gbs{0.0};
|
121
|
+
|
122
|
+
// These strings are here to capture the conversion
|
123
|
+
// in struct that can be reference when making a tuple
|
124
|
+
std::string grid_str{};
|
125
|
+
std::string block_str{};
|
126
|
+
std::string cluster_str{};
|
127
|
+
std::string shared_mem_str{};
|
128
|
+
|
129
|
+
std::string scheduler{};
|
130
|
+
};
|
131
|
+
|
132
|
+
struct ProfileAttrDescriptor {
|
133
|
+
std::string column_header{};
|
134
|
+
|
135
|
+
bool verbose{false};
|
136
|
+
bool segment{false};
|
137
|
+
bool list{false};
|
138
|
+
|
139
|
+
int column_width{0};
|
140
|
+
bool number{false};
|
141
|
+
int mantissa_width{0};
|
142
|
+
|
143
|
+
std::optional<double> unit_multiplier{std::nullopt};
|
144
|
+
};
|
145
|
+
|
146
|
+
//! \struct FusionProfile
|
147
|
+
//! \brief This struct captures the profiled information from Fusion that
|
148
|
+
//! includes aggregated times from the kernels generated by segments
|
149
|
+
//! encapsulated by a Fusion.
|
150
|
+
struct FusionProfile {
|
151
|
+
static auto toTuple(const FusionProfile& prof, size_t seg);
|
152
|
+
static auto toNocuptiTuple(const FusionProfile& prof);
|
153
|
+
|
154
|
+
void reset();
|
155
|
+
|
156
|
+
//! NOTE: The "first cupti index" is used to indicate which table column is
|
157
|
+
//! the first column that contains CUPTI based information. Therefore,
|
158
|
+
//! NVFUSER_DUMP=print.nocupti stops printing at this column.
|
159
|
+
static constexpr size_t first_cupti_idx{5};
|
160
|
+
static const std::vector<ProfileAttrDescriptor> profile_attr_descs;
|
161
|
+
|
162
|
+
bool verbose{isProfilerPrintingVerbose()};
|
163
|
+
int64_t fusion_id{-1};
|
164
|
+
int64_t segments{0};
|
165
|
+
|
166
|
+
double cuda_evt_time_ms{0.0};
|
167
|
+
double host_time_ms{0.0};
|
168
|
+
double compile_time_ms{0.0};
|
169
|
+
double kernel_time_ms{0.0};
|
170
|
+
|
171
|
+
double effective_bandwidth_gbs{0.0};
|
172
|
+
double percentage_peak_bandwidth{0.0};
|
173
|
+
|
174
|
+
int64_t input_bytes{0};
|
175
|
+
int64_t output_bytes{0};
|
176
|
+
|
177
|
+
//! Vector of of the KernelProfiles for each segment of a Fusion
|
178
|
+
std::vector<KernelProfile> kernel_profiles{};
|
179
|
+
};
|
180
|
+
|
181
|
+
std::ostream& operator<<(std::ostream&, const FusionProfile&);
|
182
|
+
|
183
|
+
//! \struct SegmentProfiler
|
184
|
+
//! \brief A class used to profile each segment of a Fusion
|
185
|
+
class SegmentProfiler {
|
186
|
+
public:
|
187
|
+
SegmentProfiler(uint32_t id, bool cupti_disabled);
|
188
|
+
|
189
|
+
void startCompile();
|
190
|
+
void stopCompile();
|
191
|
+
|
192
|
+
void startKernel();
|
193
|
+
void stopKernel();
|
194
|
+
|
195
|
+
void setDevice(int64_t device) {
|
196
|
+
device_ = (int)device;
|
197
|
+
}
|
198
|
+
void inputBytesAccessed(int64_t bytes);
|
199
|
+
void outputBytesAccessed(int64_t bytes);
|
200
|
+
|
201
|
+
void scheduler(const std::string& name);
|
202
|
+
const std::string& scheduler() const;
|
203
|
+
|
204
|
+
uint32_t segmentId() const;
|
205
|
+
int device() const {
|
206
|
+
return device_;
|
207
|
+
}
|
208
|
+
|
209
|
+
int64_t inputBytes() const {
|
210
|
+
return input_bytes_;
|
211
|
+
}
|
212
|
+
int64_t outputBytes() const {
|
213
|
+
return output_bytes_;
|
214
|
+
}
|
215
|
+
double compileTime() {
|
216
|
+
return compile_timer_.time();
|
217
|
+
}
|
218
|
+
ProfilerState state() const {
|
219
|
+
return kernel_profile_state_;
|
220
|
+
}
|
221
|
+
|
222
|
+
private:
|
223
|
+
bool cupti_disabled_;
|
224
|
+
|
225
|
+
int device_ = -1;
|
226
|
+
uint32_t segment_id_ = -1;
|
227
|
+
|
228
|
+
HostTimer compile_timer_;
|
229
|
+
int64_t input_bytes_ = -1;
|
230
|
+
int64_t output_bytes_ = -1;
|
231
|
+
std::string scheduler_ = "None";
|
232
|
+
ProfilerState kernel_profile_state_;
|
233
|
+
};
|
234
|
+
|
235
|
+
//! \struct FusionProfiler
|
236
|
+
//! \brief A singleton class to profile Fusions that can include multiple
|
237
|
+
//! segments.
|
238
|
+
class FusionProfiler {
|
239
|
+
FusionProfiler();
|
240
|
+
|
241
|
+
//! Method to access FusionProfiler singleton
|
242
|
+
static FusionProfiler* get();
|
243
|
+
|
244
|
+
public:
|
245
|
+
NVF_API static void reset();
|
246
|
+
NVF_API static ProfilerState state();
|
247
|
+
|
248
|
+
//! Profiling Methods
|
249
|
+
NVF_API static void start(bool cupti_disable = false);
|
250
|
+
NVF_API static void stop();
|
251
|
+
static void createSegments(size_t num);
|
252
|
+
static void startCompile();
|
253
|
+
static void stopCompile();
|
254
|
+
static void inputBytesAccessed(int64_t bytes);
|
255
|
+
static void outputBytesAccessed(int64_t bytes);
|
256
|
+
NVF_API static const FusionProfile& profile();
|
257
|
+
// An API to query the last kernel time measured that is convenient
|
258
|
+
// for profile a single kernel from the Fusion Executor. Note, there
|
259
|
+
// may be other kernels profiles as a code generated kernel requires
|
260
|
+
// allocated outputs.
|
261
|
+
NVF_API static double lastKernelTime();
|
262
|
+
static SegmentProfiler& segment(size_t idx);
|
263
|
+
|
264
|
+
//! Methods to capture Asynchronous CUPTI activity that get called from
|
265
|
+
//! functions registered with CUPTI.
|
266
|
+
//! Correlation ID -> Segment ID
|
267
|
+
static void recordAsyncCorrIdActivity(uint32_t seg_id, uint32_t corr_id);
|
268
|
+
//! Collects CUPTI Kernel Activity
|
269
|
+
static void recordAsyncKernelActivity(KernelProfile prof);
|
270
|
+
//! Ptr to the CUPTI Activity Buffer
|
271
|
+
static uint8_t* cuptiBufferPtr();
|
272
|
+
|
273
|
+
public:
|
274
|
+
// CUPTI buffer size 200.0 KB
|
275
|
+
// The original example code used an 8MB buffer. Such a larger buffer
|
276
|
+
// impacted host time overhead significantly.
|
277
|
+
// The buffer size needed to be raised to 200KB to allow for the fallback
|
278
|
+
// path that adds a lot of records via Cublas.
|
279
|
+
static constexpr size_t cupti_activity_buffer_size{size_t(200 * 1024)};
|
280
|
+
|
281
|
+
private:
|
282
|
+
// Because this method may resize `device_descriptors_`, a call to it may
|
283
|
+
// invalidate the references returned by previous calls.
|
284
|
+
const DeviceDescriptor& deviceDescriptor(int device_id);
|
285
|
+
|
286
|
+
//! Disables CUPTI usage in order to measure Host Time without CUPTI overhead
|
287
|
+
bool cupti_disabled_;
|
288
|
+
//! Buffer for Cupti to store Activity Buffers during async activity
|
289
|
+
std::vector<uint8_t> cupti_buffer_;
|
290
|
+
//! The state is used to check for errors in usage
|
291
|
+
ProfilerState state_;
|
292
|
+
|
293
|
+
//! Data members with information that is aggregated into a FusionProfile
|
294
|
+
int64_t fusion_id_;
|
295
|
+
FusionProfile profile_;
|
296
|
+
CudaEventTimer fusion_timer_;
|
297
|
+
HostTimer host_timer_;
|
298
|
+
//! Total compilation time if there is more than one segment
|
299
|
+
HostTimer compile_timer_;
|
300
|
+
std::vector<SegmentProfiler> segments_;
|
301
|
+
//! The FusionProfiler collects a cache of device descriptors so each segment
|
302
|
+
//! does not need to spend time re-generating the information.
|
303
|
+
std::vector<DeviceDescriptor> device_descriptors_;
|
304
|
+
|
305
|
+
//! These 2 data members are used to collect and connect asynchronous records,
|
306
|
+
//! generated by CUPTI, to the segments responsible for the activity
|
307
|
+
std::vector<KernelProfile> kernel_profiles_;
|
308
|
+
std::unordered_map<uint32_t, uint32_t> corrid_2_segid_;
|
309
|
+
};
|
310
|
+
|
311
|
+
} // namespace nvfuser
|