Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–789 unchanged (789 lines)
790 py::str is_expandable_s = "is_expandable";
791 py::str frames_s = "frames";
792 py::str forward_frames_s = "forward_frames";
793 py::str time_us_s = "time_us";
794 py::str compile_context_s = "compile_context";
795 py::str user_metadata_s = "user_metadata";
796
797 py::list empty_frames;
798 std::vector<CapturedTraceback*> to_gather_frames;
799 std::vector<py::dict> to_gather_dest;
800
801 auto add_frame_key = [&](const py::dict& d,
802 const std::shared_ptr<c10::GatheredContext>& ctx) {
…lines 803–908 unchanged (106 lines)
909 te.addr_;
910 trace_entry[size_s] = te.size_;
911 trace_entry[stream_s] = int64_t(te.stream_);
912 trace_entry[time_us_s] = te.time_.t_;
913 trace_entry[compile_context_s] = te.compile_context_;
914 trace_entry[user_metadata_s] = te.user_metadata_;
915 trace.append(trace_entry);
916 }
917 traces.append(trace);
918 }
919
920 py::list external_annotations;
921 for (const auto& ae : snapshot.external_annotations) {
…lines 922–2301 unchanged (1380 lines)

After

…lines 1–789 unchanged (789 lines)
790 py::str is_expandable_s = "is_expandable";
791 py::str frames_s = "frames";
792 py::str forward_frames_s = "forward_frames";
793 py::str time_us_s = "time_us";
794 py::str compile_context_s = "compile_context";
795 py::str user_metadata_s = "user_metadata";
796 py::str pool_id_s = "pool_id";
797
798 py::list empty_frames;
799 std::vector<CapturedTraceback*> to_gather_frames;
800 std::vector<py::dict> to_gather_dest;
801
802 auto add_frame_key = [&](const py::dict& d,
…lines 803–909 unchanged (107 lines)
910 te.addr_;
911 trace_entry[size_s] = te.size_;
912 trace_entry[stream_s] = int64_t(te.stream_);
913 trace_entry[time_us_s] = te.time_.t_;
914 trace_entry[compile_context_s] = te.compile_context_;
915 trace_entry[user_metadata_s] = te.user_metadata_;
916 trace_entry[pool_id_s] = te.mempool_;
917 trace.append(trace_entry);
918 }
919 traces.append(trace);
920 }
921
922 py::list external_annotations;
…lines 923–2303 unchanged (1381 lines)

Before

translation_unit
preproc_include
#include "#include"
system_lib_string "<ATen/ATen.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/core/TensorBody.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/cuda/CUDAConfig.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/detail/CUDAHooksInterface.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/native/ConvUtils.h>"
preproc_include
#include "#include"
system_lib_string "<c10/core/Device.h>"
preproc_include
#include "#include"
system_lib_string "<c10/core/TensorImpl.h>"
preproc_include
#include "#include"
system_lib_string "<c10/util/Exception.h>"
preproc_include
#include "#include"
system_lib_string "<c10/util/UniqueVoidPtr.h>"
preproc_include
#include "#include"
system_lib_string "<pybind11/pytypes.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/utils/python_arg_parser.h>"
preproc_include
#include "#include"
system_lib_string "<unordered_set>"
preproc_if
#if "#if"
call_expression
identifier "AT_CUDNN_ENABLED"
argument_list
( "("
) ")"
"\n\n"
#endif "#endif"
preproc_include
#include "#include"
system_lib_string "<ATen/cuda/CUDAContext.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/cuda/CUDAGeneratorImpl.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/cuda/CachingHostAllocator.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/cuda/Sleep.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/cuda/detail/CUDAHooks.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/cuda/jiterator.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/cuda/tunable/Tunable.h>"
preproc_include
#include "#include"
system_lib_string "<c10/core/AllocatorConfig.h>"
preproc_include
#include "#include"
system_lib_string "<c10/core/StorageImpl.h>"
preproc_include
#include "#include"
system_lib_string "<c10/cuda/CUDACachingAllocator.h>"
preproc_include
#include "#include"
system_lib_string "<c10/cuda/CUDAFunctions.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/cuda/CUDAGraphsUtils.cuh>"
preproc_ifdef
#ifdef "#ifdef"
identifier "USE_NCCL"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/cuda/python_nccl.h>"
#endif "#endif"
preproc_include
#include "#include"
system_lib_string "<c10/util/irange.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/CudaIPCTypes.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/Generator.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/cuda/CUDAPluggableAllocator.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/cuda/GdsFile.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/cuda/THCP.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/cuda/memory_snapshot.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/cuda/python_comm.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/profiler/python/combined_traceback.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/python_headers.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/utils/device_lazy_init.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/utils/pybind.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/utils/pycfunction_helpers.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/utils/python_numbers.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/utils/python_strings.h>"
preproc_include
#include "#include"
system_lib_string "<array>"
preproc_include
#include "#include"
system_lib_string "<chrono>"
preproc_include
#include "#include"
system_lib_string "<iostream>"
preproc_include
#include "#include"
system_lib_string "<sstream>"
preproc_include
#include "#include"
system_lib_string "<thread>"
preproc_include
#include "#include"
system_lib_string "<unordered_map>"
using_declaration
using "using"
namespace "namespace"
identifier "torch"
; ";"
comment "////////////////////////////////////////////////////////////"...
comment "// CUDA management methods"
comment "////////////////////////////////////////////////////////////"...
function_definition (+108 nodes collapsed)
function_definition (+123 nodes collapsed)
function_definition (+123 nodes collapsed)
function_definition (+83 nodes collapsed)
function_definition (+213 nodes collapsed)
function_definition (+66 nodes collapsed)
function_definition (+80 nodes collapsed)
function_definition (+54 nodes collapsed)
function_definition (+188 nodes collapsed)
function_definition (+84 nodes collapsed)
function_definition (+188 nodes collapsed)
function_definition (+272 nodes collapsed)
function_definition (+62 nodes collapsed)
function_definition (+72 nodes collapsed)
function_definition (+60 nodes collapsed)
function_definition (+191 nodes collapsed)
comment "// Unpack a PyObject to at::Scalar, throw an exception if it"...
function_definition (+160 nodes collapsed)
comment "// Entrypoint for the callable created by torch.cuda.jiterat"...
comment "// See jiterator.py for more details"
function_definition (+575 nodes collapsed)
function_definition (+175 nodes collapsed)
function_definition (+71 nodes collapsed)
function_definition (+76 nodes collapsed)
function_definition (+50 nodes collapsed)
function_definition (+48 nodes collapsed)
expression_statement
identifier "Py_RETURN_NONE"
; ";"
function_definition (+42 nodes collapsed)
function_definition (+83 nodes collapsed)
comment "// We need to ensure that as long as a thread will NEVER loo"...
comment "// as it holds the CUDA mutex. Otherwise another thread migh"...
comment "// try to e.g. allocate a new tensor which will cause a dead"...
comment "// have a single global, because it can be only set once (cu"...
comment "// recursive) by the thread that owns the mutex (obviously t"...
comment "// such thread)."
declaration
storage_class_specifier
static "static"
type_identifier "PyGILState_STATE"
identifier "cudaMutexGILState"
; ";"
function_definition (+119 nodes collapsed)
function_definition (+62 nodes collapsed)
function_definition (+88 nodes collapsed)
function_definition (+126 nodes collapsed)
function_definition (+150 nodes collapsed)
function_definition (+56 nodes collapsed)
declaration
type_identifier "END_HANDLE_TH_ERRORS"
identifier "Py_RETURN_NONE"
; ";"
ERROR
} "}"
function_definition (+51 nodes collapsed)
declaration
type_identifier "END_HANDLE_TH_ERRORS"
identifier "Py_RETURN_NONE"
; ";"
ERROR
} "}"
function_definition (+748 nodes collapsed)
function_definition (+78 nodes collapsed)
function_definition (+78 nodes collapsed)
function_definition (+538 nodes collapsed)
function_definition (+51 nodes collapsed)
function_definition (+51 nodes collapsed)
function_definition
type_identifier "PyObject"
pointer_declarator
* "*"
function_declarator
identifier "THCPModule_memorySnapshot"
parameter_list
( "("
parameter_declaration
type_identifier "PyObject"
pointer_declarator
* "*"
identifier "_unused"
, ","
parameter_declaration
type_identifier "PyObject"
pointer_declarator
* "*"
identifier "arg"
) ")"
compound_statement
{ "{"
declaration
type_identifier "HANDLE_TH_ERRORS"
init_declarator
qualified_identifier
namespace_identifier "c10"
:: "::"
qualified_identifier
namespace_identifier "cuda"
:: "::"
identifier "MempoolId_t"
ERROR
identifier "mempool_id"
= "="
initializer_list
{ "{"
number_literal "0"
, ","
number_literal "0"
} "}"
; ";"
declaration
primitive_type "bool"
init_declarator
identifier "include_traces"
= "="
true "true"
; ";"
if_statement (+345 nodes collapsed)
using_declaration
using "using"
qualified_identifier
namespace_identifier "c10"
:: "::"
qualified_identifier
namespace_identifier "CachingDeviceAllocator"
:: "::"
identifier "BlockInfo"
; ";"
using_declaration
using "using"
qualified_identifier
namespace_identifier "c10"
:: "::"
qualified_identifier
namespace_identifier "CachingDeviceAllocator"
:: "::"
identifier "SegmentInfo"
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "device_s"
= "="
string_literal
" "\""
string_content "device"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "address_s"
= "="
string_literal
" "\""
string_content "address"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "total_size_s"
= "="
string_literal
" "\""
string_content "total_size"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "allocated_size_s"
= "="
string_literal
" "\""
string_content "allocated_size"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "active_size_s"
= "="
string_literal
" "\""
string_content "active_size"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "requested_size_s"
= "="
string_literal
" "\""
string_content "requested_size"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "stream_s"
= "="
string_literal
" "\""
string_content "stream"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "segment_type_s"
= "="
string_literal
" "\""
string_content "segment_type"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "segment_pool_id"
= "="
string_literal
" "\""
string_content "segment_pool_id"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "large_s"
= "="
string_literal
" "\""
string_content "large"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "small_s"
= "="
string_literal
" "\""
string_content "small"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "size_s"
= "="
string_literal
" "\""
string_content "size"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "state_s"
= "="
string_literal
" "\""
string_content "state"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "active_allocated_s"
= "="
string_literal
" "\""
string_content "active_allocated"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "active_pending_free_s"
= "="
string_literal
" "\""
string_content "active_pending_free"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "inactive_s"
= "="
string_literal
" "\""
string_content "inactive"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "addr_s"
= "="
string_literal
" "\""
string_content "addr"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "blocks_s"
= "="
string_literal
" "\""
string_content "blocks"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "is_expandable_s"
= "="
string_literal
" "\""
string_content "is_expandable"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "frames_s"
= "="
string_literal
" "\""
string_content "frames"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "forward_frames_s"
= "="
string_literal
" "\""
string_content "forward_frames"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "time_us_s"
= "="
string_literal
" "\""
string_content "time_us"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "compile_context_s"
= "="
string_literal
" "\""
string_content "compile_context"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "user_metadata_s"
= "="
string_literal
" "\""
string_content "user_metadata"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "list"
identifier "empty_frames"
; ";"
declaration
qualified_identifier
namespace_identifier "std"
:: "::"
template_type
type_identifier "vector"
template_argument_list
< "<"
type_descriptor
type_identifier "CapturedTraceback"
abstract_pointer_declarator
* "*"
> ">"
identifier "to_gather_frames"
; ";"
declaration
qualified_identifier
namespace_identifier "std"
:: "::"
template_type
type_identifier "vector"
template_argument_list
< "<"
type_descriptor
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "dict"
> ">"
identifier "to_gather_dest"
; ";"
declaration (+110 nodes collapsed)
declaration (+368 nodes collapsed)
declaration (+24 nodes collapsed)
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "list"
identifier "segments"
; ";"
for_range_loop (+35 nodes collapsed)
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "list"
identifier "traces"
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "action_s"
= "="
string_literal
" "\""
string_content "action"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "alloc_s"
= "="
string_literal
" "\""
string_content "alloc"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "free_requested_s"
= "="
string_literal
" "\""
string_content "free_requested"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "free_completed_s"
= "="
string_literal
" "\""
string_content "free_completed"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "segment_alloc_s"
= "="
string_literal
" "\""
string_content "segment_alloc"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "segment_free_s"
= "="
string_literal
" "\""
string_content "segment_free"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "segment_map_s"
= "="
string_literal
" "\""
string_content "segment_map"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "segment_unmap_s"
= "="
string_literal
" "\""
string_content "segment_unmap"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "snapshot_s"
= "="
string_literal
" "\""
string_content "snapshot"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "oom_s"
= "="
string_literal
" "\""
string_content "oom"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "device_free_s"
= "="
string_literal
" "\""
string_content "device_free"
" "\""
; ";"
using_declaration
using "using"
qualified_identifier
namespace_identifier "c10"
:: "::"
qualified_identifier
namespace_identifier "CachingDeviceAllocator"
:: "::"
identifier "TraceEntry"
; ";"
declaration (+147 nodes collapsed)
for_range_loop
for "for"
( "("
type_qualifier
const "const"
placeholder_type_specifier
auto "auto"
reference_declarator
& "&"
identifier "traceInfo"
: ":"
field_expression
identifier "snapshot"
. "."
field_identifier "device_traces"
) ")"
compound_statement
{ "{"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "list"
identifier "trace"
; ";"
for_range_loop
for "for"
( "("
type_qualifier
const "const"
placeholder_type_specifier
auto "auto"
reference_declarator
& "&"
identifier "te"
: ":"
identifier "traceInfo"
) ")"
compound_statement
{ "{"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "dict"
identifier "trace_entry"
; ";"
if_statement (+51 nodes collapsed)
expression_statement
assignment_expression
subscript_expression
identifier "trace_entry"
subscript_argument_list
[ "["
identifier "action_s"
] "]"
= "="
call_expression
identifier "action_to_str"
argument_list
( "("
field_expression
identifier "te"
. "."
field_identifier "action_"
) ")"
; ";"
expression_statement (+28 nodes collapsed)
expression_statement
assignment_expression
subscript_expression
identifier "trace_entry"
subscript_argument_list
[ "["
identifier "size_s"
] "]"
= "="
field_expression
identifier "te"
. "."
field_identifier "size_"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "trace_entry"
subscript_argument_list
[ "["
identifier "stream_s"
] "]"
= "="
call_expression
primitive_type "int64_t"
argument_list
( "("
field_expression
identifier "te"
. "."
field_identifier "stream_"
) ")"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "trace_entry"
subscript_argument_list
[ "["
identifier "time_us_s"
] "]"
= "="
field_expression
field_expression
identifier "te"
. "."
field_identifier "time_"
. "."
field_identifier "t_"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "trace_entry"
subscript_argument_list
[ "["
identifier "compile_context_s"
] "]"
= "="
field_expression
identifier "te"
. "."
field_identifier "compile_context_"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "trace_entry"
subscript_argument_list
[ "["
identifier "user_metadata_s"
] "]"
= "="
field_expression
identifier "te"
. "."
field_identifier "user_metadata_"
; ";"
expression_statement
call_expression
field_expression
identifier "trace"
. "."
field_identifier "append"
argument_list
( "("
identifier "trace_entry"
) ")"
; ";"
} "}"
expression_statement
call_expression
field_expression
identifier "traces"
. "."
field_identifier "append"
argument_list
( "("
identifier "trace"
) ")"
; ";"
} "}"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "list"
identifier "external_annotations"
; ";"
for_range_loop (+112 nodes collapsed)
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "dict"
identifier "allocator_settings"
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "last_allocator_settings_s"
= "="
string_literal
" "\""
string_content "PYTORCH_CUDA_ALLOC_CONF"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "max_split_size_s"
= "="
string_literal
" "\""
string_content "max_split_size"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "garbage_collection_threshold_s"
= "="
string_literal
" "\""
string_content "garbage_collection_threshold"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "expandable_segments_s"
= "="
string_literal
" "\""
string_content "expandable_segments"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "pinned_num_register_threads_s"
= "="
string_literal
" "\""
string_content "pinned_num_register_threads"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "release_lock_on_malloc_s"
= "="
string_literal
" "\""
string_content "release_lock_on_cudamalloc"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "pinned_use_host_register_s"
= "="
string_literal
" "\""
string_content "pinned_use_cuda_host_register"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "roundup_power2_divisions_s"
= "="
string_literal
" "\""
string_content "roundup_power2_divisions"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "graph_capture_record_stream_reuse_s"
= "="
string_literal
" "\""
string_content "graph_capture_record_stream_reuse"
" "\""
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "allocator_settings"
subscript_argument_list
[ "["
identifier "last_allocator_settings_s"
] "]"
= "="
field_expression
field_expression
identifier "snapshot"
. "."
field_identifier "config_metadata"
. "."
field_identifier "last_allocator_settings"
; ";"
expression_statement (+22 nodes collapsed)
expression_statement
assignment_expression
subscript_expression
identifier "allocator_settings"
subscript_argument_list
[ "["
identifier "garbage_collection_threshold_s"
] "]"
= "="
field_expression
field_expression
identifier "snapshot"
. "."
field_identifier "config_metadata"
. "."
field_identifier "garbage_collection_threshold"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "allocator_settings"
subscript_argument_list
[ "["
identifier "expandable_segments_s"
] "]"
= "="
field_expression
field_expression
identifier "snapshot"
. "."
field_identifier "config_metadata"
. "."
field_identifier "expandable_segments"
; ";"
expression_statement (+22 nodes collapsed)
expression_statement
assignment_expression
subscript_expression
identifier "allocator_settings"
subscript_argument_list
[ "["
identifier "release_lock_on_malloc_s"
] "]"
= "="
field_expression
field_expression
identifier "snapshot"
. "."
field_identifier "config_metadata"
. "."
field_identifier "release_lock_on_malloc"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "allocator_settings"
subscript_argument_list
[ "["
identifier "pinned_use_host_register_s"
] "]"
= "="
field_expression
field_expression
identifier "snapshot"
. "."
field_identifier "config_metadata"
. "."
field_identifier "pinned_use_host_register"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "allocator_settings"
subscript_argument_list
[ "["
identifier "graph_capture_record_stream_reuse_s"
] "]"
= "="
field_expression
field_expression
identifier "snapshot"
. "."
field_identifier "config_metadata"
. "."
field_identifier "graph_capture_record_stream_reuse"
; ";"
declaration
sized_type_specifier
unsigned "unsigned"
primitive_type "int"
init_declarator
identifier "roundup_key"
= "="
number_literal "1"
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "dict"
identifier "roundup_settings"
; ";"
for_range_loop (+62 nodes collapsed)
expression_statement
assignment_expression
subscript_expression
identifier "allocator_settings"
subscript_argument_list
[ "["
identifier "roundup_power2_divisions_s"
] "]"
= "="
identifier "roundup_settings"
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "dict"
identifier "result"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "result"
subscript_argument_list
[ "["
string_literal
" "\""
string_content "segments"
" "\""
] "]"
= "="
identifier "segments"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "result"
subscript_argument_list
[ "["
string_literal
" "\""
string_content "device_traces"
" "\""
] "]"
= "="
identifier "traces"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "result"
subscript_argument_list
[ "["
string_literal
" "\""
string_content "allocator_settings"
" "\""
] "]"
= "="
identifier "allocator_settings"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "result"
subscript_argument_list
[ "["
string_literal
" "\""
string_content "external_annotations"
" "\""
] "]"
= "="
identifier "external_annotations"
; ";"
declaration
placeholder_type_specifier
auto "auto"
init_declarator
identifier "frames"
= "="
call_expression
identifier "py_symbolize"
argument_list
( "("
identifier "to_gather_frames"
) ")"
; ";"
for_range_loop (+183 nodes collapsed)
return_statement
return "return"
call_expression
field_expression
call_expression
field_expression
identifier "result"
. "."
field_identifier "release"
argument_list
( "("
) ")"
. "."
field_identifier "ptr"
argument_list
( "("
) ")"
; ";"
type_identifier "END_HANDLE_TH_ERRORS"
; ""
} "}"
function_definition (+185 nodes collapsed)
function_definition (+222 nodes collapsed)
function_definition (+139 nodes collapsed)
comment "////////////////////////////////////////////////////////////"...
comment "// Cuda module initialization"
comment "////////////////////////////////////////////////////////////"...
function_definition (+1386 nodes collapsed)
comment "// We choose to ignore certain blocks that are currently all"...
comment "// when we set the pool to its checkpoint. For those blocks,"...
comment "// to swap out the deleter function of their corresponding b"...
comment "// so that a deallocation is not triggered when they die."
function_definition (+191 nodes collapsed)
function_definition (+244 nodes collapsed)
function_definition (+3288 nodes collapsed)
function_definition (+111 nodes collapsed)
comment "// Callback for python part. Used for additional initializat"...
comment "// classes"
function_definition (+350 nodes collapsed)
function_definition (+53 nodes collapsed)
function_definition (+44 nodes collapsed)
function_definition (+67 nodes collapsed)
function_definition (+83 nodes collapsed)
function_definition (+67 nodes collapsed)
function_definition (+86 nodes collapsed)
function_definition (+67 nodes collapsed)
function_definition (+86 nodes collapsed)
function_definition (+67 nodes collapsed)
function_definition (+105 nodes collapsed)
function_definition (+56 nodes collapsed)
function_definition (+102 nodes collapsed)
function_definition (+56 nodes collapsed)
function_definition (+195 nodes collapsed)
function_definition (+56 nodes collapsed)
function_definition (+194 nodes collapsed)
function_definition (+474 nodes collapsed)
function_definition (+304 nodes collapsed)
function_definition (+102 nodes collapsed)
function_definition (+56 nodes collapsed)
function_definition (+311 nodes collapsed)
function_definition (+72 nodes collapsed)
function_definition (+124 nodes collapsed)
function_definition (+46 nodes collapsed)
function_definition (+180 nodes collapsed)
comment "// NOLINTNEXTLINE(*-c-arrays*, *-global-variables)"
declaration (+1160 nodes collapsed)
function_definition
type_identifier "PyMethodDef"
pointer_declarator
* "*"
function_declarator
identifier "THCPModule_methods"
parameter_list
( "("
) ")"
compound_statement
{ "{"
return_statement
return "return"
identifier "_THCPModule_methods"
; ";"
} "}"
namespace_definition (+225 nodes collapsed)
comment "// namespace torch::cuda"

After

translation_unit
preproc_include
#include "#include"
system_lib_string "<ATen/ATen.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/core/TensorBody.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/cuda/CUDAConfig.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/detail/CUDAHooksInterface.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/native/ConvUtils.h>"
preproc_include
#include "#include"
system_lib_string "<c10/core/Device.h>"
preproc_include
#include "#include"
system_lib_string "<c10/core/TensorImpl.h>"
preproc_include
#include "#include"
system_lib_string "<c10/util/Exception.h>"
preproc_include
#include "#include"
system_lib_string "<c10/util/UniqueVoidPtr.h>"
preproc_include
#include "#include"
system_lib_string "<pybind11/pytypes.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/utils/python_arg_parser.h>"
preproc_include
#include "#include"
system_lib_string "<unordered_set>"
preproc_if
#if "#if"
call_expression
identifier "AT_CUDNN_ENABLED"
argument_list
( "("
) ")"
"\n\n"
#endif "#endif"
preproc_include
#include "#include"
system_lib_string "<ATen/cuda/CUDAContext.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/cuda/CUDAGeneratorImpl.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/cuda/CachingHostAllocator.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/cuda/Sleep.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/cuda/detail/CUDAHooks.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/cuda/jiterator.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/cuda/tunable/Tunable.h>"
preproc_include
#include "#include"
system_lib_string "<c10/core/AllocatorConfig.h>"
preproc_include
#include "#include"
system_lib_string "<c10/core/StorageImpl.h>"
preproc_include
#include "#include"
system_lib_string "<c10/cuda/CUDACachingAllocator.h>"
preproc_include
#include "#include"
system_lib_string "<c10/cuda/CUDAFunctions.h>"
preproc_include
#include "#include"
system_lib_string "<ATen/cuda/CUDAGraphsUtils.cuh>"
preproc_ifdef
#ifdef "#ifdef"
identifier "USE_NCCL"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/cuda/python_nccl.h>"
#endif "#endif"
preproc_include
#include "#include"
system_lib_string "<c10/util/irange.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/CudaIPCTypes.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/Generator.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/cuda/CUDAPluggableAllocator.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/cuda/GdsFile.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/cuda/THCP.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/cuda/memory_snapshot.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/cuda/python_comm.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/profiler/python/combined_traceback.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/python_headers.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/utils/device_lazy_init.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/utils/pybind.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/utils/pycfunction_helpers.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/utils/python_numbers.h>"
preproc_include
#include "#include"
system_lib_string "<torch/csrc/utils/python_strings.h>"
preproc_include
#include "#include"
system_lib_string "<array>"
preproc_include
#include "#include"
system_lib_string "<chrono>"
preproc_include
#include "#include"
system_lib_string "<iostream>"
preproc_include
#include "#include"
system_lib_string "<sstream>"
preproc_include
#include "#include"
system_lib_string "<thread>"
preproc_include
#include "#include"
system_lib_string "<unordered_map>"
using_declaration
using "using"
namespace "namespace"
identifier "torch"
; ";"
comment "////////////////////////////////////////////////////////////"...
comment "// CUDA management methods"
comment "////////////////////////////////////////////////////////////"...
function_definition (+108 nodes collapsed)
function_definition (+123 nodes collapsed)
function_definition (+123 nodes collapsed)
function_definition (+83 nodes collapsed)
function_definition (+213 nodes collapsed)
function_definition (+66 nodes collapsed)
function_definition (+80 nodes collapsed)
function_definition (+54 nodes collapsed)
function_definition (+188 nodes collapsed)
function_definition (+84 nodes collapsed)
function_definition (+188 nodes collapsed)
function_definition (+272 nodes collapsed)
function_definition (+62 nodes collapsed)
function_definition (+72 nodes collapsed)
function_definition (+60 nodes collapsed)
function_definition (+191 nodes collapsed)
comment "// Unpack a PyObject to at::Scalar, throw an exception if it"...
function_definition (+160 nodes collapsed)
comment "// Entrypoint for the callable created by torch.cuda.jiterat"...
comment "// See jiterator.py for more details"
function_definition (+575 nodes collapsed)
function_definition (+175 nodes collapsed)
function_definition (+71 nodes collapsed)
function_definition (+76 nodes collapsed)
function_definition (+50 nodes collapsed)
function_definition (+48 nodes collapsed)
expression_statement
identifier "Py_RETURN_NONE"
; ";"
function_definition (+42 nodes collapsed)
function_definition (+83 nodes collapsed)
comment "// We need to ensure that as long as a thread will NEVER loo"...
comment "// as it holds the CUDA mutex. Otherwise another thread migh"...
comment "// try to e.g. allocate a new tensor which will cause a dead"...
comment "// have a single global, because it can be only set once (cu"...
comment "// recursive) by the thread that owns the mutex (obviously t"...
comment "// such thread)."
declaration
storage_class_specifier
static "static"
type_identifier "PyGILState_STATE"
identifier "cudaMutexGILState"
; ";"
function_definition (+119 nodes collapsed)
function_definition (+62 nodes collapsed)
function_definition (+88 nodes collapsed)
function_definition (+126 nodes collapsed)
function_definition (+150 nodes collapsed)
function_definition (+56 nodes collapsed)
declaration
type_identifier "END_HANDLE_TH_ERRORS"
identifier "Py_RETURN_NONE"
; ";"
ERROR
} "}"
function_definition (+51 nodes collapsed)
declaration
type_identifier "END_HANDLE_TH_ERRORS"
identifier "Py_RETURN_NONE"
; ";"
ERROR
} "}"
function_definition (+748 nodes collapsed)
function_definition (+78 nodes collapsed)
function_definition (+78 nodes collapsed)
function_definition (+538 nodes collapsed)
function_definition (+51 nodes collapsed)
function_definition (+51 nodes collapsed)
function_definition
type_identifier "PyObject"
pointer_declarator
* "*"
function_declarator
identifier "THCPModule_memorySnapshot"
parameter_list
( "("
parameter_declaration
type_identifier "PyObject"
pointer_declarator
* "*"
identifier "_unused"
, ","
parameter_declaration
type_identifier "PyObject"
pointer_declarator
* "*"
identifier "arg"
) ")"
compound_statement
{ "{"
declaration
type_identifier "HANDLE_TH_ERRORS"
init_declarator
qualified_identifier
namespace_identifier "c10"
:: "::"
qualified_identifier
namespace_identifier "cuda"
:: "::"
identifier "MempoolId_t"
ERROR
identifier "mempool_id"
= "="
initializer_list
{ "{"
number_literal "0"
, ","
number_literal "0"
} "}"
; ";"
declaration
primitive_type "bool"
init_declarator
identifier "include_traces"
= "="
true "true"
; ";"
if_statement (+345 nodes collapsed)
using_declaration
using "using"
qualified_identifier
namespace_identifier "c10"
:: "::"
qualified_identifier
namespace_identifier "CachingDeviceAllocator"
:: "::"
identifier "BlockInfo"
; ";"
using_declaration
using "using"
qualified_identifier
namespace_identifier "c10"
:: "::"
qualified_identifier
namespace_identifier "CachingDeviceAllocator"
:: "::"
identifier "SegmentInfo"
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "device_s"
= "="
string_literal
" "\""
string_content "device"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "address_s"
= "="
string_literal
" "\""
string_content "address"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "total_size_s"
= "="
string_literal
" "\""
string_content "total_size"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "allocated_size_s"
= "="
string_literal
" "\""
string_content "allocated_size"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "active_size_s"
= "="
string_literal
" "\""
string_content "active_size"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "requested_size_s"
= "="
string_literal
" "\""
string_content "requested_size"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "stream_s"
= "="
string_literal
" "\""
string_content "stream"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "segment_type_s"
= "="
string_literal
" "\""
string_content "segment_type"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "segment_pool_id"
= "="
string_literal
" "\""
string_content "segment_pool_id"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "large_s"
= "="
string_literal
" "\""
string_content "large"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "small_s"
= "="
string_literal
" "\""
string_content "small"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "size_s"
= "="
string_literal
" "\""
string_content "size"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "state_s"
= "="
string_literal
" "\""
string_content "state"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "active_allocated_s"
= "="
string_literal
" "\""
string_content "active_allocated"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "active_pending_free_s"
= "="
string_literal
" "\""
string_content "active_pending_free"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "inactive_s"
= "="
string_literal
" "\""
string_content "inactive"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "addr_s"
= "="
string_literal
" "\""
string_content "addr"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "blocks_s"
= "="
string_literal
" "\""
string_content "blocks"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "is_expandable_s"
= "="
string_literal
" "\""
string_content "is_expandable"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "frames_s"
= "="
string_literal
" "\""
string_content "frames"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "forward_frames_s"
= "="
string_literal
" "\""
string_content "forward_frames"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "time_us_s"
= "="
string_literal
" "\""
string_content "time_us"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "compile_context_s"
= "="
string_literal
" "\""
string_content "compile_context"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "user_metadata_s"
= "="
string_literal
" "\""
string_content "user_metadata"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "pool_id_s"
= "="
string_literal
" "\""
string_content "pool_id"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "list"
identifier "empty_frames"
; ";"
declaration
qualified_identifier
namespace_identifier "std"
:: "::"
template_type
type_identifier "vector"
template_argument_list
< "<"
type_descriptor
type_identifier "CapturedTraceback"
abstract_pointer_declarator
* "*"
> ">"
identifier "to_gather_frames"
; ";"
declaration
qualified_identifier
namespace_identifier "std"
:: "::"
template_type
type_identifier "vector"
template_argument_list
< "<"
type_descriptor
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "dict"
> ">"
identifier "to_gather_dest"
; ";"
declaration (+110 nodes collapsed)
declaration (+368 nodes collapsed)
declaration (+24 nodes collapsed)
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "list"
identifier "segments"
; ";"
for_range_loop (+35 nodes collapsed)
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "list"
identifier "traces"
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "action_s"
= "="
string_literal
" "\""
string_content "action"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "alloc_s"
= "="
string_literal
" "\""
string_content "alloc"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "free_requested_s"
= "="
string_literal
" "\""
string_content "free_requested"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "free_completed_s"
= "="
string_literal
" "\""
string_content "free_completed"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "segment_alloc_s"
= "="
string_literal
" "\""
string_content "segment_alloc"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "segment_free_s"
= "="
string_literal
" "\""
string_content "segment_free"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "segment_map_s"
= "="
string_literal
" "\""
string_content "segment_map"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "segment_unmap_s"
= "="
string_literal
" "\""
string_content "segment_unmap"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "snapshot_s"
= "="
string_literal
" "\""
string_content "snapshot"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "oom_s"
= "="
string_literal
" "\""
string_content "oom"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "device_free_s"
= "="
string_literal
" "\""
string_content "device_free"
" "\""
; ";"
using_declaration
using "using"
qualified_identifier
namespace_identifier "c10"
:: "::"
qualified_identifier
namespace_identifier "CachingDeviceAllocator"
:: "::"
identifier "TraceEntry"
; ";"
declaration (+147 nodes collapsed)
for_range_loop
for "for"
( "("
type_qualifier
const "const"
placeholder_type_specifier
auto "auto"
reference_declarator
& "&"
identifier "traceInfo"
: ":"
field_expression
identifier "snapshot"
. "."
field_identifier "device_traces"
) ")"
compound_statement
{ "{"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "list"
identifier "trace"
; ";"
for_range_loop
for "for"
( "("
type_qualifier
const "const"
placeholder_type_specifier
auto "auto"
reference_declarator
& "&"
identifier "te"
: ":"
identifier "traceInfo"
) ")"
compound_statement
{ "{"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "dict"
identifier "trace_entry"
; ";"
if_statement (+51 nodes collapsed)
expression_statement
assignment_expression
subscript_expression
identifier "trace_entry"
subscript_argument_list
[ "["
identifier "action_s"
] "]"
= "="
call_expression
identifier "action_to_str"
argument_list
( "("
field_expression
identifier "te"
. "."
field_identifier "action_"
) ")"
; ";"
expression_statement (+28 nodes collapsed)
expression_statement
assignment_expression
subscript_expression
identifier "trace_entry"
subscript_argument_list
[ "["
identifier "size_s"
] "]"
= "="
field_expression
identifier "te"
. "."
field_identifier "size_"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "trace_entry"
subscript_argument_list
[ "["
identifier "stream_s"
] "]"
= "="
call_expression
primitive_type "int64_t"
argument_list
( "("
field_expression
identifier "te"
. "."
field_identifier "stream_"
) ")"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "trace_entry"
subscript_argument_list
[ "["
identifier "time_us_s"
] "]"
= "="
field_expression
field_expression
identifier "te"
. "."
field_identifier "time_"
. "."
field_identifier "t_"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "trace_entry"
subscript_argument_list
[ "["
identifier "compile_context_s"
] "]"
= "="
field_expression
identifier "te"
. "."
field_identifier "compile_context_"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "trace_entry"
subscript_argument_list
[ "["
identifier "user_metadata_s"
] "]"
= "="
field_expression
identifier "te"
. "."
field_identifier "user_metadata_"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "trace_entry"
subscript_argument_list
[ "["
identifier "pool_id_s"
] "]"
= "="
field_expression
identifier "te"
. "."
field_identifier "mempool_"
; ";"
expression_statement
call_expression
field_expression
identifier "trace"
. "."
field_identifier "append"
argument_list
( "("
identifier "trace_entry"
) ")"
; ";"
} "}"
expression_statement
call_expression
field_expression
identifier "traces"
. "."
field_identifier "append"
argument_list
( "("
identifier "trace"
) ")"
; ";"
} "}"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "list"
identifier "external_annotations"
; ";"
for_range_loop (+112 nodes collapsed)
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "dict"
identifier "allocator_settings"
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "last_allocator_settings_s"
= "="
string_literal
" "\""
string_content "PYTORCH_CUDA_ALLOC_CONF"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "max_split_size_s"
= "="
string_literal
" "\""
string_content "max_split_size"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "garbage_collection_threshold_s"
= "="
string_literal
" "\""
string_content "garbage_collection_threshold"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "expandable_segments_s"
= "="
string_literal
" "\""
string_content "expandable_segments"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "pinned_num_register_threads_s"
= "="
string_literal
" "\""
string_content "pinned_num_register_threads"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "release_lock_on_malloc_s"
= "="
string_literal
" "\""
string_content "release_lock_on_cudamalloc"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "pinned_use_host_register_s"
= "="
string_literal
" "\""
string_content "pinned_use_cuda_host_register"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "roundup_power2_divisions_s"
= "="
string_literal
" "\""
string_content "roundup_power2_divisions"
" "\""
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "str"
init_declarator
identifier "graph_capture_record_stream_reuse_s"
= "="
string_literal
" "\""
string_content "graph_capture_record_stream_reuse"
" "\""
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "allocator_settings"
subscript_argument_list
[ "["
identifier "last_allocator_settings_s"
] "]"
= "="
field_expression
field_expression
identifier "snapshot"
. "."
field_identifier "config_metadata"
. "."
field_identifier "last_allocator_settings"
; ";"
expression_statement (+22 nodes collapsed)
expression_statement
assignment_expression
subscript_expression
identifier "allocator_settings"
subscript_argument_list
[ "["
identifier "garbage_collection_threshold_s"
] "]"
= "="
field_expression
field_expression
identifier "snapshot"
. "."
field_identifier "config_metadata"
. "."
field_identifier "garbage_collection_threshold"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "allocator_settings"
subscript_argument_list
[ "["
identifier "expandable_segments_s"
] "]"
= "="
field_expression
field_expression
identifier "snapshot"
. "."
field_identifier "config_metadata"
. "."
field_identifier "expandable_segments"
; ";"
expression_statement (+22 nodes collapsed)
expression_statement
assignment_expression
subscript_expression
identifier "allocator_settings"
subscript_argument_list
[ "["
identifier "release_lock_on_malloc_s"
] "]"
= "="
field_expression
field_expression
identifier "snapshot"
. "."
field_identifier "config_metadata"
. "."
field_identifier "release_lock_on_malloc"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "allocator_settings"
subscript_argument_list
[ "["
identifier "pinned_use_host_register_s"
] "]"
= "="
field_expression
field_expression
identifier "snapshot"
. "."
field_identifier "config_metadata"
. "."
field_identifier "pinned_use_host_register"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "allocator_settings"
subscript_argument_list
[ "["
identifier "graph_capture_record_stream_reuse_s"
] "]"
= "="
field_expression
field_expression
identifier "snapshot"
. "."
field_identifier "config_metadata"
. "."
field_identifier "graph_capture_record_stream_reuse"
; ";"
declaration
sized_type_specifier
unsigned "unsigned"
primitive_type "int"
init_declarator
identifier "roundup_key"
= "="
number_literal "1"
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "dict"
identifier "roundup_settings"
; ";"
for_range_loop (+62 nodes collapsed)
expression_statement
assignment_expression
subscript_expression
identifier "allocator_settings"
subscript_argument_list
[ "["
identifier "roundup_power2_divisions_s"
] "]"
= "="
identifier "roundup_settings"
; ";"
declaration
qualified_identifier
namespace_identifier "py"
:: "::"
type_identifier "dict"
identifier "result"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "result"
subscript_argument_list
[ "["
string_literal
" "\""
string_content "segments"
" "\""
] "]"
= "="
identifier "segments"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "result"
subscript_argument_list
[ "["
string_literal
" "\""
string_content "device_traces"
" "\""
] "]"
= "="
identifier "traces"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "result"
subscript_argument_list
[ "["
string_literal
" "\""
string_content "allocator_settings"
" "\""
] "]"
= "="
identifier "allocator_settings"
; ";"
expression_statement
assignment_expression
subscript_expression
identifier "result"
subscript_argument_list
[ "["
string_literal
" "\""
string_content "external_annotations"
" "\""
] "]"
= "="
identifier "external_annotations"
; ";"
declaration
placeholder_type_specifier
auto "auto"
init_declarator
identifier "frames"
= "="
call_expression
identifier "py_symbolize"
argument_list
( "("
identifier "to_gather_frames"
) ")"
; ";"
for_range_loop (+183 nodes collapsed)
return_statement
return "return"
call_expression
field_expression
call_expression
field_expression
identifier "result"
. "."
field_identifier "release"
argument_list
( "("
) ")"
. "."
field_identifier "ptr"
argument_list
( "("
) ")"
; ";"
type_identifier "END_HANDLE_TH_ERRORS"
; ""
} "}"
function_definition (+185 nodes collapsed)
function_definition (+222 nodes collapsed)
function_definition (+139 nodes collapsed)
comment "////////////////////////////////////////////////////////////"...
comment "// Cuda module initialization"
comment "////////////////////////////////////////////////////////////"...
function_definition (+1386 nodes collapsed)
comment "// We choose to ignore certain blocks that are currently all"...
comment "// when we set the pool to its checkpoint. For those blocks,"...
comment "// to swap out the deleter function of their corresponding b"...
comment "// so that a deallocation is not triggered when they die."
function_definition (+191 nodes collapsed)
function_definition (+244 nodes collapsed)
function_definition (+3288 nodes collapsed)
function_definition (+111 nodes collapsed)
comment "// Callback for python part. Used for additional initializat"...
comment "// classes"
function_definition (+350 nodes collapsed)
function_definition (+53 nodes collapsed)
function_definition (+44 nodes collapsed)
function_definition (+67 nodes collapsed)
function_definition (+83 nodes collapsed)
function_definition (+67 nodes collapsed)
function_definition (+86 nodes collapsed)
function_definition (+67 nodes collapsed)
function_definition (+86 nodes collapsed)
function_definition (+67 nodes collapsed)
function_definition (+105 nodes collapsed)
function_definition (+56 nodes collapsed)
function_definition (+102 nodes collapsed)
function_definition (+56 nodes collapsed)
function_definition (+195 nodes collapsed)
function_definition (+56 nodes collapsed)
function_definition (+194 nodes collapsed)
function_definition (+474 nodes collapsed)
function_definition (+304 nodes collapsed)
function_definition (+102 nodes collapsed)
function_definition (+56 nodes collapsed)
function_definition (+311 nodes collapsed)
function_definition (+72 nodes collapsed)
function_definition (+124 nodes collapsed)
function_definition (+46 nodes collapsed)
function_definition (+180 nodes collapsed)
comment "// NOLINTNEXTLINE(*-c-arrays*, *-global-variables)"
declaration (+1160 nodes collapsed)
function_definition
type_identifier "PyMethodDef"
pointer_declarator
* "*"
function_declarator
identifier "THCPModule_methods"
parameter_list
( "("
) ")"
compound_statement
{ "{"
return_statement
return "return"
identifier "_THCPModule_methods"
; ";"
} "}"
namespace_definition (+225 nodes collapsed)
comment "// namespace torch::cuda"