blob: a634f640e8cbc66d408c142a4b70af2c009dec35 [file] [log] [blame]
Edward Yangce7910b2022-02-28 15:46:04 -08001# WARNING: the contents of this file must BOTH be valid Starlark (for Buck and
2
3# Bazel) as well as valid Python (for our cmake build). This means that
4# load() directives are not allowed (as they are not recognized by Python).
5# If you want to fix this, figure out how run this file from cmake with a proper
6# Starlark interpreter as part of the default OSS build process. If you need
7# some nontrivial Starlark features, make a separate bzl file (remember that
8
9# bzl files are not exported via ShipIt by default, so you may also need to
10# update PyTorch's ShipIt config)
11
Will Constable3547f202022-03-22 16:06:04 -070012# This is duplicated in caffe2/CMakeLists.txt for now and not yet used in buck
13GENERATED_LAZY_TS_CPP = [
14 "lazy/generated/LazyNativeFunctions.cpp",
15 "lazy/generated/RegisterAutogradLazy.cpp",
16 "lazy/generated/RegisterLazy.cpp",
17]
18
Nikita Shulga1571dd82020-06-30 13:42:01 -070019def libtorch_generated_sources(gencode_pattern):
20 return [gencode_pattern.format(name) for name in [
mikey dagitses096ff0e2022-05-04 06:48:20 -070021 "torch/csrc/autograd/generated/Functions.cpp",
22 "torch/csrc/autograd/generated/VariableType_0.cpp",
23 "torch/csrc/autograd/generated/VariableType_1.cpp",
24 "torch/csrc/autograd/generated/VariableType_2.cpp",
25 "torch/csrc/autograd/generated/VariableType_3.cpp",
26 "torch/csrc/autograd/generated/VariableType_4.cpp",
27 "torch/csrc/autograd/generated/TraceType_0.cpp",
28 "torch/csrc/autograd/generated/TraceType_1.cpp",
29 "torch/csrc/autograd/generated/TraceType_2.cpp",
30 "torch/csrc/autograd/generated/TraceType_3.cpp",
31 "torch/csrc/autograd/generated/TraceType_4.cpp",
32 "torch/csrc/autograd/generated/ADInplaceOrViewType_0.cpp",
33 "torch/csrc/autograd/generated/ADInplaceOrViewType_1.cpp",
Michael Ranieri689499f2020-10-09 20:15:14 -070034 ]]
Nikita Shulga70d36162020-04-14 21:45:30 -070035
Sam Estep707d2712020-10-29 18:42:03 -070036# copied from https://github.com/pytorch/pytorch/blob/f99a693cd9ff7a9b5fdc71357dac66b8192786d3/aten/src/ATen/core/CMakeLists.txt
Nikita Shulgaf3d2e332020-05-13 22:15:07 -070037jit_core_headers = [
Peter Bellcd9da322021-12-07 15:22:44 -080038 "torch/csrc/Export.h",
Nikita Shulgaf3d2e332020-05-13 22:15:07 -070039 "torch/csrc/jit/frontend/source_range.h",
Kimish Patele0fc4732021-05-04 09:17:43 -070040 "torch/csrc/jit/serialization/callstack_debug_info_serialization.h",
Nikita Shulgaf3d2e332020-05-13 22:15:07 -070041 "torch/csrc/jit/serialization/source_range_serialization.h",
42 "torch/csrc/jit/frontend/lexer.h",
43 "torch/csrc/jit/frontend/strtod.h",
44 "torch/csrc/jit/frontend/parser_constants.h",
45 "torch/csrc/jit/frontend/function_schema_parser.h",
46 "torch/csrc/jit/frontend/parse_string_literal.h",
47 "torch/csrc/jit/frontend/schema_type_parser.h",
48 "torch/csrc/jit/frontend/error_report.h",
49 "torch/csrc/jit/frontend/tree.h",
50 "torch/custom_class.h",
51 "torch/custom_class_detail.h",
52 "torch/library.h",
53]
54
55jit_core_sources = [
56 "torch/csrc/jit/frontend/error_report.cpp",
57 "torch/csrc/jit/frontend/function_schema_parser.cpp",
58 "torch/csrc/jit/frontend/lexer.cpp",
59 "torch/csrc/jit/frontend/schema_type_parser.cpp",
60 "torch/csrc/jit/frontend/strtod.cpp",
61 "torch/csrc/jit/frontend/source_range.cpp",
62]
63
Sam Estep707d2712020-10-29 18:42:03 -070064# copied from https://github.com/pytorch/pytorch/blob/0bde610c14b92d351b968a0228df29e92442b1cc/torch/CMakeLists.txt
Martin Yuanb35cdc52020-06-28 16:37:23 -070065# There are some common files used in both internal lite-interpreter and full-jit. Making a separate
66# list for the shared files.
67
68core_sources_common = [
albanDc23808d2020-12-22 12:07:00 -080069 "torch/csrc/autograd/autograd_meta.cpp",
70 "torch/csrc/autograd/forward_grad.cpp",
Martin Yuanb35cdc52020-06-28 16:37:23 -070071 "torch/csrc/jit/frontend/edit_distance.cpp",
Jacob Szwejbkae9263602022-01-20 10:04:43 -080072 "torch/csrc/jit/mobile/compatibility/runtime_compatibility.cpp",
Martin Yuanb35cdc52020-06-28 16:37:23 -070073 "torch/csrc/jit/mobile/type_parser.cpp",
Tugsbayasgalan (Tugsuu) Manlaibaatare849c8b2022-01-27 18:27:28 -080074 "torch/csrc/jit/operator_upgraders/version_map.cpp",
Martin Yuanb35cdc52020-06-28 16:37:23 -070075 "torch/csrc/jit/runtime/instruction.cpp",
76 "torch/csrc/jit/runtime/jit_exception.cpp",
77 "torch/csrc/jit/runtime/operator.cpp",
Pavithran Ramachandranbf69a612022-01-26 18:51:40 -080078 "torch/csrc/jit/mobile/register_ops_common_utils.cpp",
Martin Yuanb35cdc52020-06-28 16:37:23 -070079 "torch/csrc/jit/runtime/print_handler.cpp",
Tugsbayasgalan Manlaibaatar42c78ed2020-12-11 10:58:54 -080080 "torch/csrc/jit/runtime/slice_indices_adjust.cpp",
Martin Yuanb35cdc52020-06-28 16:37:23 -070081 "torch/csrc/jit/runtime/register_ops_utils.cpp",
82 "torch/csrc/jit/runtime/vararg_functions.cpp",
Pavithran Ramachandran3c003aa2021-09-17 10:22:41 -070083 "torch/csrc/jit/mobile/promoted_prim_ops.cpp",
84 "torch/csrc/jit/mobile/prim_ops_registery.cpp",
Taylor Robieebc66bf2021-12-16 10:32:13 -080085 "torch/csrc/profiler/util.cpp",
Pavithran Ramachandranc2ceba82021-11-04 15:52:03 -070086]
87
88torch_unpickler_common = [
Chen Lai9486fc32021-04-29 10:06:38 -070089 "torch/csrc/jit/serialization/import_read.cpp",
Martin Yuanb35cdc52020-06-28 16:37:23 -070090 "torch/csrc/jit/serialization/unpickler.cpp",
91]
92
Pavithran Ramachandranc2ceba82021-11-04 15:52:03 -070093libtorch_sources_common = sorted(core_sources_common + torch_unpickler_common)
Martin Yuanb35cdc52020-06-28 16:37:23 -070094
Dhruv Matani8c852de2021-06-06 13:14:28 -070095# The profilers are not needed in the lite interpreter build.
96libtorch_profiler_sources = [
PyTorch MergeBot8eb579e2022-10-14 14:56:59 +000097 "torch/csrc/autograd/profiler_legacy.cpp",
Dhruv Matani8c852de2021-06-06 13:14:28 -070098 "torch/csrc/autograd/profiler_kineto.cpp",
Taylor Robiedaf959c2022-03-16 10:20:44 -070099 "torch/csrc/profiler/collection.cpp",
Taylor Robiefb64f7b2022-10-26 16:56:51 -0700100 "torch/csrc/profiler/data_flow.cpp",
Taylor Robie786f9462022-01-11 15:56:17 -0800101 "torch/csrc/profiler/kineto_shim.cpp",
Jay Chae77665e92022-04-20 16:56:39 -0700102 "torch/csrc/profiler/kineto_client_interface.cpp",
Taylor Robiebea01842022-09-07 14:58:28 -0700103 "torch/csrc/profiler/orchestration/observer.cpp",
Taylor Robie32853872022-09-08 11:03:20 -0700104 "torch/csrc/profiler/orchestration/python_tracer.cpp",
Louis Feng5847cb52023-06-22 19:41:54 +0000105 "torch/csrc/profiler/standalone/execution_trace_observer.cpp",
Taylor Robie35fb0072022-10-13 07:49:00 -0700106 "torch/csrc/profiler/standalone/itt_observer.cpp",
107 "torch/csrc/profiler/standalone/nvtx_observer.cpp",
Taylor Robieb8f14b72022-10-13 07:48:58 -0700108 "torch/csrc/profiler/stubs/base.cpp",
Salil Desai8c80a462022-12-18 18:56:20 -0800109 "torch/csrc/profiler/orchestration/vulkan.cpp",
Digant Desai0fc7de32022-11-01 21:39:03 -0700110 "torch/csrc/profiler/perf.cpp",
Tristan Rice758d7de2021-11-18 21:44:53 -0800111 "torch/csrc/monitor/counters.cpp",
Jiawei Lvb4c4a012021-12-16 11:10:28 -0800112 "torch/csrc/monitor/events.cpp",
Dhruv Matani8c852de2021-06-06 13:14:28 -0700113]
114
Kimish Patel38c18512021-08-13 21:37:57 -0700115libtorch_edge_profiler_sources = libtorch_profiler_sources + [
116 "torch/csrc/jit/mobile/profiler_edge.cpp",
117]
118
Ann Shan330a1072020-07-27 15:36:37 -0700119core_trainer_sources = [
Michael Suo0bde6102020-02-20 16:46:16 -0800120 "torch/csrc/autograd/anomaly_mode.cpp",
121 "torch/csrc/autograd/autograd.cpp",
soulitzer90a64982021-08-27 14:59:08 -0700122 "torch/csrc/autograd/autograd_not_implemented_fallback.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800123 "torch/csrc/autograd/cpp_hook.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700124 "torch/csrc/autograd/custom_function.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800125 "torch/csrc/autograd/engine.cpp",
126 "torch/csrc/autograd/function.cpp",
soulitzerd5007d82023-11-06 15:22:50 -0500127 "torch/csrc/autograd/input_metadata.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800128 "torch/csrc/autograd/functions/accumulate_grad.cpp",
129 "torch/csrc/autograd/functions/basic_ops.cpp",
130 "torch/csrc/autograd/functions/tensor.cpp",
131 "torch/csrc/autograd/functions/utils.cpp",
132 "torch/csrc/autograd/input_buffer.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800133 "torch/csrc/autograd/record_function_ops.cpp",
134 "torch/csrc/autograd/saved_variable.cpp",
135 "torch/csrc/autograd/variable.cpp",
Peter Bell5f459272021-10-13 15:33:27 -0700136 "torch/csrc/autograd/utils/warnings.cpp",
soulitzer7f889342022-09-15 22:46:16 +0000137 "torch/csrc/autograd/jit_decomp_interface.cpp",
Ann Shan330a1072020-07-27 15:36:37 -0700138 "torch/csrc/jit/frontend/name_mangler.cpp",
139 "torch/csrc/jit/ir/type_hashing.cpp",
140 "torch/csrc/jit/serialization/pickler.cpp",
141 "torch/csrc/jit/serialization/type_name_uniquer.cpp",
Martin Yuan7a33d8b2020-07-15 21:13:24 -0700142]
143
Han Qi (qihqi)25eb7c32022-12-08 03:48:04 +0000144torch_mobile_core = [
145 # backend_debug_info.cpp provides
146 # __torch__.torch.classes.backend.BackendDebugInfo class
147 # This should not be needed eventually.
148 # TODO: Remove this dependency
149 "torch/csrc/jit/backends/backend_debug_info.cpp",
150 "torch/csrc/jit/mobile/compatibility/model_compatibility.cpp",
151 "torch/csrc/jit/mobile/function.cpp",
152 "torch/csrc/jit/mobile/import.cpp",
153 "torch/csrc/jit/mobile/flatbuffer_loader.cpp",
154 "torch/csrc/jit/mobile/interpreter.cpp",
155 "torch/csrc/jit/mobile/module.cpp",
156 "torch/csrc/jit/mobile/observer.cpp",
157 "torch/csrc/jit/mobile/parse_bytecode.cpp",
158 "torch/csrc/jit/mobile/parse_operators.cpp",
159 "torch/csrc/jit/mobile/quantization.cpp",
160 "torch/csrc/jit/mobile/upgrader_mobile.cpp",
161 "torch/csrc/jit/runtime/register_prim_ops.cpp",
162 "torch/csrc/jit/runtime/register_special_ops.cpp",
163]
164
165core_sources_full_mobile_no_backend_interface_xplat = [
Nikita Shulga70d36162020-04-14 21:45:30 -0700166 "torch/csrc/jit/api/function_impl.cpp",
167 "torch/csrc/jit/api/module.cpp",
168 "torch/csrc/jit/api/object.cpp",
Kimish Patele0fc4732021-05-04 09:17:43 -0700169 "torch/csrc/jit/backends/backend_debug_handler.cpp",
Meghan Lele3e019312020-07-07 20:53:22 -0700170 "torch/csrc/jit/backends/backend_detail.cpp",
Nikita Shulgaf235c652021-02-17 07:15:45 -0800171 "torch/csrc/jit/backends/backend_resolver.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700172 "torch/csrc/jit/codegen/fuser/codegen.cpp",
173 "torch/csrc/jit/codegen/fuser/compiler.cpp",
174 "torch/csrc/jit/codegen/fuser/executor.cpp",
175 "torch/csrc/jit/codegen/fuser/fallback.cpp",
176 "torch/csrc/jit/codegen/fuser/interface.cpp",
177 "torch/csrc/jit/codegen/fuser/kernel_cache.cpp",
178 "torch/csrc/jit/frontend/builtin_functions.cpp",
Mike Ruberry30fabd92020-04-16 04:54:26 -0700179 "torch/csrc/jit/frontend/versioned_symbols.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700180 "torch/csrc/jit/frontend/canonicalize_modified_loop.cpp",
181 "torch/csrc/jit/frontend/convert_to_ssa.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700182 "torch/csrc/jit/frontend/exit_transforms.cpp",
183 "torch/csrc/jit/frontend/inline_loop_condition.cpp",
184 "torch/csrc/jit/frontend/ir_emitter.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700185 "torch/csrc/jit/frontend/parser.cpp",
186 "torch/csrc/jit/frontend/schema_matching.cpp",
187 "torch/csrc/jit/frontend/script_type_parser.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700188 "torch/csrc/jit/frontend/sugared_value.cpp",
189 "torch/csrc/jit/frontend/tracer.cpp",
190 "torch/csrc/jit/ir/alias_analysis.cpp",
191 "torch/csrc/jit/ir/attributes.cpp",
192 "torch/csrc/jit/ir/constants.cpp",
193 "torch/csrc/jit/ir/ir.cpp",
194 "torch/csrc/jit/ir/irparser.cpp",
195 "torch/csrc/jit/ir/node_hashing.cpp",
196 "torch/csrc/jit/ir/scope.cpp",
197 "torch/csrc/jit/ir/subgraph_matcher.cpp",
Maxwell Nuyens0d0ebcd2023-02-10 17:12:52 +0000198 "torch/csrc/jit/ir/graph_utils.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700199 "torch/csrc/jit/jit_log.cpp",
Tugsbayasgalan Manlaibaatar559e2d82021-01-11 12:22:54 -0800200 "torch/csrc/jit/jit_opt_limit.cpp",
Priya Ramani206646d2021-09-15 19:12:47 -0700201 "torch/csrc/jit/mobile/nnc/aot_compiler.cpp",
Jiakai Liu5824a862021-06-19 06:09:31 -0700202 "torch/csrc/jit/mobile/nnc/backend.cpp",
203 "torch/csrc/jit/mobile/nnc/context.cpp",
204 "torch/csrc/jit/mobile/nnc/registry.cpp",
Tugsbayasgalan (Tugsuu) Manlaibaatardf3cbcf2021-12-24 12:21:40 -0800205 "torch/csrc/jit/operator_upgraders/utils.cpp",
Tugsbayasgalan (Tugsuu) Manlaibaatarb0fdca82022-01-05 23:55:49 -0800206 "torch/csrc/jit/operator_upgraders/upgraders.cpp",
Tugsbayasgalan (Tugsuu) Manlaibaatarc9bd1c62022-01-21 16:17:03 -0800207 "torch/csrc/jit/operator_upgraders/upgraders_entry.cpp",
Mike Iovined1c5f9e2022-02-17 10:18:33 -0800208 "torch/csrc/jit/passes/add_if_then_else.cpp",
Yanan Caod150d3e2020-10-02 14:39:14 -0700209 "torch/csrc/jit/passes/annotate_warns.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700210 "torch/csrc/jit/passes/bailout_graph.cpp",
Elias Ellison0d7be812022-04-25 16:08:57 +0000211 "torch/csrc/jit/passes/check_strict_fusion.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700212 "torch/csrc/jit/passes/batch_mm.cpp",
213 "torch/csrc/jit/passes/canonicalize.cpp",
Elias Ellison5183e3a2020-05-21 21:40:03 -0700214 "torch/csrc/jit/passes/canonicalize_graph_fuser_ops.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700215 "torch/csrc/jit/passes/clear_profiling.cpp",
216 "torch/csrc/jit/passes/clear_undefinedness.cpp",
217 "torch/csrc/jit/passes/common_subexpression_elimination.cpp",
Raghavan Raman259d19a2021-05-09 22:05:41 -0700218 "torch/csrc/jit/passes/concat_opt.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700219 "torch/csrc/jit/passes/constant_pooling.cpp",
220 "torch/csrc/jit/passes/constant_propagation.cpp",
Bin Baoadd291c2021-06-03 06:41:43 -0700221 "torch/csrc/jit/passes/restore_mutation.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700222 "torch/csrc/jit/passes/create_autodiff_subgraphs.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700223 "torch/csrc/jit/passes/dead_code_elimination.cpp",
Mike Iovine5bc89272021-11-08 08:39:58 -0800224 "torch/csrc/jit/passes/eliminate_no_ops.cpp",
Elias Ellison5da8a7b2020-08-31 11:45:27 -0700225 "torch/csrc/jit/passes/remove_redundant_profiles.cpp",
Mikhail Zolotukhin85c056a2021-03-30 13:55:06 -0700226 "torch/csrc/jit/passes/remove_exceptions.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700227 "torch/csrc/jit/passes/decompose_ops.cpp",
John Clowec8a71f2021-11-04 18:57:19 -0700228 "torch/csrc/jit/passes/dtype_analysis.cpp",
John Clowade83ed2022-01-13 13:55:26 -0800229 "torch/csrc/jit/passes/device_type_analysis.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700230 "torch/csrc/jit/passes/erase_number_types.cpp",
231 "torch/csrc/jit/passes/fixup_trace_scope_blocks.cpp",
232 "torch/csrc/jit/passes/freeze_module.cpp",
233 "torch/csrc/jit/passes/fuse_linear.cpp",
Kimish Patelc5dcf052020-07-09 16:20:22 -0700234 "torch/csrc/jit/passes/fuse_relu.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700235 "torch/csrc/jit/passes/graph_fuser.cpp",
236 "torch/csrc/jit/passes/graph_rewrite_helper.cpp",
237 "torch/csrc/jit/passes/guard_elimination.cpp",
Vasiliy Kuznetsov79b83282020-08-08 15:49:38 -0700238 "torch/csrc/jit/passes/hoist_conv_packed_params.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700239 "torch/csrc/jit/passes/inline_autodiff_subgraphs.cpp",
240 "torch/csrc/jit/passes/inline_forked_closures.cpp",
Supriya Rao199c73b2020-09-05 12:03:12 -0700241 "torch/csrc/jit/passes/inline_fork_wait.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700242 "torch/csrc/jit/passes/inliner.cpp",
243 "torch/csrc/jit/passes/inplace_check.cpp",
244 "torch/csrc/jit/passes/insert_guards.cpp",
245 "torch/csrc/jit/passes/lift_closures.cpp",
246 "torch/csrc/jit/passes/liveness.cpp",
247 "torch/csrc/jit/passes/loop_unrolling.cpp",
248 "torch/csrc/jit/passes/lower_grad_of.cpp",
249 "torch/csrc/jit/passes/lower_tuples.cpp",
Elias Ellisonf90dc742020-05-21 21:40:03 -0700250 "torch/csrc/jit/passes/normalize_ops.cpp",
Mike Iovine000e3a082021-08-13 10:18:03 -0700251 "torch/csrc/jit/passes/peephole_dict_idioms.cpp",
Elias Ellisonf5b31252020-05-06 15:49:37 -0700252 "torch/csrc/jit/passes/peephole_list_idioms.cpp",
Elias Ellison0d9f1c12021-05-21 08:48:13 -0700253 "torch/csrc/jit/passes/value_refinement_utils.cpp",
Elias Ellison30aeed72021-01-12 11:35:08 -0800254 "torch/csrc/jit/passes/peephole_alias_sensitive.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700255 "torch/csrc/jit/passes/pass_manager.cpp",
256 "torch/csrc/jit/passes/peephole.cpp",
Elias Ellison391603d2021-05-21 08:48:13 -0700257 "torch/csrc/jit/passes/peephole_non_tensor.cpp",
Elias Ellisonc516f842020-04-28 23:18:29 -0700258 "torch/csrc/jit/passes/create_functional_graphs.cpp",
Henry Tuf6eb8112022-05-12 00:48:39 +0000259 "torch/csrc/jit/passes/refine_tuple_types.cpp",
Elias Ellison3f323322020-07-08 14:31:15 -0700260 "torch/csrc/jit/passes/remove_mutation.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700261 "torch/csrc/jit/passes/prepack_folding.cpp",
Jerry Zhang0ed7fc52020-05-08 12:21:40 -0700262 "torch/csrc/jit/passes/fold_conv_bn.cpp",
min-jean-cho6d2b0cb2022-12-21 08:00:32 +0000263 "torch/csrc/jit/passes/fold_linear_bn.cpp",
Vasiliy Kuznetsovbf896a22022-03-03 07:17:57 -0800264 "torch/csrc/jit/passes/dbr_quantization/remove_redundant_aliases.cpp",
John Clow3bad5402021-10-08 10:54:16 -0700265 "torch/csrc/jit/passes/frozen_concat_linear.cpp",
Bin Baoc1a44222021-04-30 15:26:13 -0700266 "torch/csrc/jit/passes/frozen_conv_add_relu_fusion.cpp",
Elias Ellison035229c2021-01-12 11:35:08 -0800267 "torch/csrc/jit/passes/frozen_conv_folding.cpp",
min-jean-cho6d2b0cb2022-12-21 08:00:32 +0000268 "torch/csrc/jit/passes/frozen_linear_folding.cpp",
John Clow6cdea822021-10-05 20:07:01 -0700269 "torch/csrc/jit/passes/frozen_linear_transpose.cpp",
Elias Ellisonbfae3782021-03-01 21:14:16 -0800270 "torch/csrc/jit/passes/frozen_ops_to_mkldnn.cpp",
Elias Ellisona389b302021-01-12 11:35:08 -0800271 "torch/csrc/jit/passes/frozen_graph_optimizations.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700272 "torch/csrc/jit/passes/remove_expands.cpp",
Kimish Patelf954dd72020-05-12 14:36:25 -0700273 "torch/csrc/jit/passes/remove_dropout.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700274 "torch/csrc/jit/passes/requires_grad_analysis.cpp",
275 "torch/csrc/jit/passes/shape_analysis.cpp",
Elias Ellison5313baf2021-05-21 08:48:13 -0700276 "torch/csrc/jit/passes/integer_value_refinement.cpp",
Tugsbayasgalan (Tugsuu) Manlaibaatar4ae71c82021-12-25 13:01:35 -0800277 "torch/csrc/jit/passes/replacement_of_old_operators.cpp",
Elias Ellisonf39471a2021-05-21 08:48:13 -0700278 "torch/csrc/jit/passes/symbolic_shape_analysis.cpp",
Nikolay Korovaikoce842f42022-04-13 00:24:52 -0700279 "torch/csrc/jit/passes/symbolic_shape_cache.cpp",
Elias Ellisonfc82ad12021-10-28 17:07:44 -0700280 "torch/csrc/jit/passes/symbolic_shape_runtime_fusion.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700281 "torch/csrc/jit/passes/specialize_autogradzero.cpp",
Elias Ellison1c0faa72020-08-31 11:45:27 -0700282 "torch/csrc/jit/passes/update_differentiable_graph_requires_grad.cpp",
Mike Iovinefc6dd0b2021-08-23 17:26:27 -0700283 "torch/csrc/jit/passes/variadic_ops.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700284 "torch/csrc/jit/passes/subgraph_rewrite.cpp",
285 "torch/csrc/jit/passes/tensorexpr_fuser.cpp",
286 "torch/csrc/jit/passes/utils/memory_dag.cpp",
287 "torch/csrc/jit/passes/utils/subgraph_utils.cpp",
John Clow71d1d162021-09-24 13:48:19 -0700288 "torch/csrc/jit/passes/utils/optimization_utils.cpp",
John Clow77db7202021-11-18 16:25:21 -0800289 "torch/csrc/jit/passes/utils/op_registry.cpp",
chunyuan-w693a8dd2022-08-10 21:46:51 +0000290 "torch/csrc/jit/passes/mkldnn_rewrite.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700291 "torch/csrc/jit/passes/xnnpack_rewrite.cpp",
Ivan Kobzarev38522152020-06-20 14:08:52 -0700292 "torch/csrc/jit/passes/vulkan_rewrite.cpp",
Tao Xua277c092020-10-13 01:44:36 -0700293 "torch/csrc/jit/passes/metal_rewrite.cpp",
Jerry Zhang0ed7fc52020-05-08 12:21:40 -0700294 "torch/csrc/jit/passes/quantization/helper.cpp",
Jerry Zhangfd7e09a2020-06-17 23:33:01 -0700295 "torch/csrc/jit/passes/quantization/quantization_type.cpp",
Jerry Zhang0ed7fc52020-05-08 12:21:40 -0700296 "torch/csrc/jit/passes/quantization/insert_observers.cpp",
297 "torch/csrc/jit/passes/quantization/insert_quant_dequant.cpp",
298 "torch/csrc/jit/passes/quantization/dedup_module_uses.cpp",
299 "torch/csrc/jit/passes/quantization/finalize.cpp",
Kimish Patelbb12e4d2020-05-27 14:08:24 -0700300 "torch/csrc/jit/passes/quantization/fusion_passes.cpp",
Kimish Patel5c7e8012022-08-27 16:06:15 -0700301 "torch/csrc/jit/passes/quantization/register_packed_params.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700302 "torch/csrc/jit/python/update_graph_executor_opt.cpp",
Shuming Hub45880c2023-03-23 01:19:08 +0000303 "torch/csrc/jit/python/utf8_decoding_ignore.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700304 "torch/csrc/jit/runtime/argument_spec.cpp",
305 "torch/csrc/jit/runtime/autodiff.cpp",
306 "torch/csrc/jit/runtime/graph_executor.cpp",
Zhengxu Chen8b384582021-05-06 16:42:41 -0700307 "torch/csrc/jit/runtime/interpreter/frame.cpp",
308 "torch/csrc/jit/runtime/interpreter/preprocess_graph.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700309 "torch/csrc/jit/runtime/interpreter.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700310 "torch/csrc/jit/runtime/logging.cpp",
Elias Ellison0ecf1ad2022-03-29 11:32:31 -0700311 "torch/csrc/jit/runtime/simple_graph_executor_impl.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700312 "torch/csrc/jit/runtime/profiling_graph_executor_impl.cpp",
313 "torch/csrc/jit/runtime/profiling_record.cpp",
Zhengxu Chen2b0ec9c2021-05-24 18:22:01 -0700314 "torch/csrc/jit/runtime/script_profile.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700315 "torch/csrc/jit/runtime/symbolic_script.cpp",
eellisonf66fbb12021-05-27 17:52:46 -0700316 "torch/csrc/jit/runtime/symbolic_shape_registry.cpp",
Elias Ellisonaacdf292022-03-29 11:32:31 -0700317 "torch/csrc/jit/runtime/decomposition_registry.cpp",
318 "torch/csrc/jit/runtime/decomposition_registry_util.cpp",
Elias Ellisonf65eb092022-04-19 20:59:42 +0000319 "torch/csrc/jit/runtime/serialized_shape_function_registry.cpp",
Elias Ellison19b87292021-12-01 00:42:05 -0800320 "torch/csrc/jit/runtime/symbolic_shape_registry_util.cpp",
Nikolay Korovaikoa7ebf762021-10-24 18:03:00 -0700321 "torch/csrc/jit/runtime/jit_trace.cpp",
Kimish Patele0fc4732021-05-04 09:17:43 -0700322 "torch/csrc/jit/serialization/callstack_debug_info_serialization.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700323 "torch/csrc/jit/serialization/import.cpp",
324 "torch/csrc/jit/serialization/import_export_helpers.cpp",
325 "torch/csrc/jit/serialization/import_source.cpp",
326 "torch/csrc/jit/serialization/pickle.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700327 "torch/csrc/jit/serialization/python_print.cpp",
328 "torch/csrc/jit/serialization/source_range_serialization.cpp",
Mikhail Zolotukhinc6395132021-02-03 10:20:24 -0800329 "torch/csrc/jit/tensorexpr/block_codegen.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700330 "torch/csrc/jit/tensorexpr/bounds_inference.cpp",
Nick Gibson0edc6a32020-11-04 19:50:25 -0800331 "torch/csrc/jit/tensorexpr/bounds_overlap.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700332 "torch/csrc/jit/tensorexpr/codegen.cpp",
Cheng Chang109bc102021-02-01 13:04:20 -0800333 "torch/csrc/jit/tensorexpr/cpp_codegen.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700334 "torch/csrc/jit/tensorexpr/eval.cpp",
335 "torch/csrc/jit/tensorexpr/expr.cpp",
Ivan Kobzarev519e2262022-03-09 13:13:47 -0800336 "torch/csrc/jit/tensorexpr/external_functions_core.cpp",
Mikhail Zolotukhinc6395132021-02-03 10:20:24 -0800337 "torch/csrc/jit/tensorexpr/external_functions_registry.cpp",
Raghavan Ramand0c4ace2021-06-18 14:29:14 -0700338 "torch/csrc/jit/tensorexpr/graph_opt.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700339 "torch/csrc/jit/tensorexpr/hash_provider.cpp",
Bert Maher0a9764e2021-01-28 22:29:23 -0800340 "torch/csrc/jit/tensorexpr/intrinsic_symbols.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700341 "torch/csrc/jit/tensorexpr/ir.cpp",
Raghavan Ramane54ee9b2021-08-09 09:11:13 -0700342 "torch/csrc/jit/tensorexpr/ir_cloner.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700343 "torch/csrc/jit/tensorexpr/ir_mutator.cpp",
344 "torch/csrc/jit/tensorexpr/ir_printer.cpp",
345 "torch/csrc/jit/tensorexpr/ir_simplifier.cpp",
Mikhail Zolotukhine22da0a2021-03-01 20:35:17 -0800346 "torch/csrc/jit/tensorexpr/ir_verifier.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700347 "torch/csrc/jit/tensorexpr/ir_visitor.cpp",
348 "torch/csrc/jit/tensorexpr/kernel.cpp",
349 "torch/csrc/jit/tensorexpr/llvm_codegen.cpp",
350 "torch/csrc/jit/tensorexpr/llvm_jit.cpp",
351 "torch/csrc/jit/tensorexpr/loopnest.cpp",
Animesh Jain6896b2d2022-01-06 16:20:13 -0800352 "torch/csrc/jit/tensorexpr/loopnest_randomization.cpp",
Mikhail Zolotukhineee9ad02021-09-30 22:51:23 -0700353 "torch/csrc/jit/tensorexpr/lowerings.cpp",
Mikhail Zolotukhinc6395132021-02-03 10:20:24 -0800354 "torch/csrc/jit/tensorexpr/mem_dependency_checker.cpp",
Bert Maher90f84852021-04-08 21:54:52 -0700355 "torch/csrc/jit/tensorexpr/operators/conv2d.cpp",
Bert Maherbda40632021-06-16 05:07:43 -0700356 "torch/csrc/jit/tensorexpr/operators/matmul.cpp",
Mikhail Zolotukhin015e0072021-09-30 22:51:23 -0700357 "torch/csrc/jit/tensorexpr/operators/misc.cpp",
Bert Maher842a8312021-06-16 05:07:43 -0700358 "torch/csrc/jit/tensorexpr/operators/norm.cpp",
Mikhail Zolotukhin015e0072021-09-30 22:51:23 -0700359 "torch/csrc/jit/tensorexpr/operators/pointwise.cpp",
Ivan Kobzarev7fbcf792021-10-31 22:48:04 -0700360 "torch/csrc/jit/tensorexpr/operators/quantization.cpp",
Bert Maherbda40632021-06-16 05:07:43 -0700361 "torch/csrc/jit/tensorexpr/operators/reduction.cpp",
362 "torch/csrc/jit/tensorexpr/operators/softmax.cpp",
Nick Gibsoneab80932020-11-12 20:15:47 -0800363 "torch/csrc/jit/tensorexpr/reduction.cpp",
Nick Gibsonaabdef52020-08-11 11:15:38 -0700364 "torch/csrc/jit/tensorexpr/registerizer.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700365 "torch/csrc/jit/tensorexpr/tensor.cpp",
366 "torch/csrc/jit/tensorexpr/types.cpp",
367 "torch/csrc/jit/tensorexpr/unique_name_manager.cpp",
368 "torch/csrc/jit/testing/file_check.cpp",
PyTorch MergeBot2c313e72023-06-12 23:52:10 +0000369 "torch/csrc/profiler/unwind/unwind.cpp",
zdevito3fe34392023-10-03 16:42:11 -0700370 "torch/csrc/profiler/unwind/unwind_fb.cpp",
PyTorch MergeBot2c313e72023-06-12 23:52:10 +0000371 "torch/csrc/profiler/combined_traceback.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700372 "torch/csrc/jit/testing/hooks_for_testing.cpp",
David Berard53b4f6c2023-03-02 07:38:51 -0800373 "torch/csrc/utils/cpp_stacktraces.cpp",
goldenxuettb4e34292022-07-08 11:31:31 -0700374 "torch/csrc/utils/schema_info.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700375 "torch/csrc/utils/tensor_flatten.cpp",
376 "torch/csrc/utils/variadic.cpp",
Kimish Patel46800162021-09-01 12:38:39 -0700377]
Nikita Shulga70d36162020-04-14 21:45:30 -0700378
Han Qi (qihqi)25eb7c32022-12-08 03:48:04 +0000379core_sources_full_mobile_no_backend_interface = core_sources_full_mobile_no_backend_interface_xplat + [
380 # backend_debug_info.cpp provides
381 # __torch__.torch.classes.backend.BackendDebugInfo class
382 # This should not be needed eventually.
383 # TODO: Remove this dependency
384 "torch/csrc/jit/backends/backend_debug_info.cpp",
385 "torch/csrc/jit/mobile/compatibility/model_compatibility.cpp",
386 "torch/csrc/jit/mobile/function.cpp",
387 "torch/csrc/jit/mobile/import.cpp",
388 "torch/csrc/jit/mobile/flatbuffer_loader.cpp",
389 "torch/csrc/jit/mobile/interpreter.cpp",
390 "torch/csrc/jit/mobile/module.cpp",
391 "torch/csrc/jit/mobile/observer.cpp",
392 "torch/csrc/jit/mobile/parse_bytecode.cpp",
393 "torch/csrc/jit/mobile/parse_operators.cpp",
394 "torch/csrc/jit/mobile/quantization.cpp",
395 "torch/csrc/jit/mobile/upgrader_mobile.cpp",
396]
397
398
Amy He63554cf2021-08-17 10:31:02 -0700399core_sources_full_mobile = core_sources_full_mobile_no_backend_interface + [
400 "torch/csrc/jit/backends/backend_debug_info.cpp",
401 "torch/csrc/jit/backends/backend_interface.cpp",
402]
403
Martin Yuan6615eda2020-11-20 22:24:46 -0800404core_sources_full = core_sources_full_mobile + [
Bram Wastif4226b52020-12-10 14:01:36 -0800405 "torch/csrc/jit/runtime/static/fusion.cpp",
Don Jangfe7e1bd2022-02-28 00:29:16 -0800406 "torch/csrc/jit/runtime/static/generated_ops.cpp",
Martin Yuan6615eda2020-11-20 22:24:46 -0800407 "torch/csrc/jit/runtime/static/impl.cpp",
Don Jangae000752021-09-17 13:20:33 -0700408 "torch/csrc/jit/runtime/static/memory_planner.cpp",
Hao Lua07b0812021-07-14 02:12:20 -0700409 "torch/csrc/jit/runtime/static/native_ops.cpp",
Martin Yuan6615eda2020-11-20 22:24:46 -0800410 "torch/csrc/jit/runtime/static/ops.cpp",
Ansha Yu07978bd2020-12-08 05:52:48 -0800411 "torch/csrc/jit/runtime/static/passes.cpp",
Raghavan Ramana2399a72021-08-25 11:12:57 -0700412 "torch/csrc/jit/runtime/static/te_wrapper.cpp",
Mikhail Zolotukhinc6395132021-02-03 10:20:24 -0800413 "torch/csrc/jit/tensorexpr/external_functions.cpp",
Horace He31607ad2021-05-13 19:55:39 -0700414 "torch/csrc/jit/tensorexpr/external_functions_codegen.cpp",
Martin Yuan6615eda2020-11-20 22:24:46 -0800415]
416
Will Constablea8c0b362021-10-07 10:03:02 -0700417lazy_tensor_core_sources = [
Jiewen Tan6011c352021-11-10 07:02:44 -0800418 "torch/csrc/lazy/backend/backend_device.cpp",
Jiewen Tane6c435b2021-12-01 12:13:59 -0800419 "torch/csrc/lazy/backend/backend_interface.cpp",
Will Constabled6e60642021-11-10 12:51:43 -0800420 "torch/csrc/lazy/backend/lowering_context.cpp",
Will Constabled05c1ec2021-10-18 19:08:09 -0700421 "torch/csrc/lazy/core/config.cpp",
Will Constable328cfd52022-02-11 09:54:34 -0800422 "torch/csrc/lazy/core/debug_util.cpp",
Will Constablea8c0b362021-10-07 10:03:02 -0700423 "torch/csrc/lazy/core/hash.cpp",
Bin Bao0bbe21b2021-12-04 08:38:39 -0800424 "torch/csrc/lazy/core/helpers.cpp",
Will Constabled05c1ec2021-10-18 19:08:09 -0700425 "torch/csrc/lazy/core/ir.cpp",
Bin Bao0bbe21b2021-12-04 08:38:39 -0800426 "torch/csrc/lazy/core/ir_dump_util.cpp",
Will Constabled05c1ec2021-10-18 19:08:09 -0700427 "torch/csrc/lazy/core/ir_metadata.cpp",
Bin Bao23669482021-10-28 08:15:33 -0700428 "torch/csrc/lazy/core/ir_util.cpp",
Bin Baofe7b6442021-12-16 05:41:42 -0800429 "torch/csrc/lazy/core/lazy_graph_executor.cpp",
Bin Baoe6a49882021-12-16 05:41:42 -0800430 "torch/csrc/lazy/core/metrics.cpp",
431 "torch/csrc/lazy/core/multi_wait.cpp",
Antonio Kimf3f327e2022-04-28 02:07:02 +0000432 "torch/csrc/lazy/core/ops/arithmetic_ir_ops.cpp",
433 "torch/csrc/lazy/core/ops/utils.cpp",
Bin Baoa4734172021-11-09 11:59:01 -0800434 "torch/csrc/lazy/core/permutation_util.cpp",
Jiewen Tan8bed46e2021-11-04 14:10:26 -0700435 "torch/csrc/lazy/core/shape.cpp",
Will Constabled56d5302022-02-23 23:01:46 -0800436 "torch/csrc/lazy/core/shape_inference.cpp",
Bin Baofe7b6442021-12-16 05:41:42 -0800437 "torch/csrc/lazy/core/tensor.cpp",
Jiewen Tane02d8362021-12-22 03:20:35 -0800438 "torch/csrc/lazy/core/tensor_impl.cpp",
Bin Bao8a975c02021-12-07 16:45:11 -0800439 "torch/csrc/lazy/core/tensor_util.cpp",
Bin Baoe6a49882021-12-16 05:41:42 -0800440 "torch/csrc/lazy/core/thread_pool.cpp",
Bin Baof05710d2022-05-04 17:46:00 +0000441 "torch/csrc/lazy/core/trie.cpp",
Will Constablea8c0b362021-10-07 10:03:02 -0700442]
443
Will Constable3547f202022-03-22 16:06:04 -0700444# We can't build all of the ts backend under certain build configurations, e.g. mobile,
445# since it depends on things like autograd, meta functions, which may be disabled
446lazy_tensor_ts_sources = [
Antonio Kimf3f327e2022-04-28 02:07:02 +0000447 "torch/csrc/lazy/ts_backend/dynamic_ir.cpp",
Antonio Kim02c4d8772022-05-24 19:29:23 +0000448 "torch/csrc/lazy/ts_backend/config.cpp",
Antonio Kimf3f327e2022-04-28 02:07:02 +0000449 "torch/csrc/lazy/ts_backend/ops/device_data.cpp",
Antonio Kimf3f327e2022-04-28 02:07:02 +0000450 "torch/csrc/lazy/ts_backend/ops/generic.cpp",
Antonio Kimf3f327e2022-04-28 02:07:02 +0000451 "torch/csrc/lazy/ts_backend/tensor_aten_ops.cpp",
Will Constable3547f202022-03-22 16:06:04 -0700452 "torch/csrc/lazy/ts_backend/ts_autograd_functions.cpp",
453 "torch/csrc/lazy/ts_backend/ts_backend_impl.cpp",
Antonio Kimf3f327e2022-04-28 02:07:02 +0000454 "torch/csrc/lazy/ts_backend/ts_eager_fallback.cpp",
Will Constable3547f202022-03-22 16:06:04 -0700455 "torch/csrc/lazy/ts_backend/ts_lowering_context.cpp",
456 "torch/csrc/lazy/ts_backend/ts_native_functions.cpp",
Antonio Kim02c4d8772022-05-24 19:29:23 +0000457 "torch/csrc/lazy/ts_backend/ts_node.cpp",
Will Constable3547f202022-03-22 16:06:04 -0700458 "torch/csrc/lazy/ts_backend/ts_node_lowering.cpp",
Will Constable3547f202022-03-22 16:06:04 -0700459]
460
Will Constable328cfd52022-02-11 09:54:34 -0800461lazy_tensor_core_python_sources = [
462 "torch/csrc/lazy/python/init.cpp",
463 "torch/csrc/lazy/python/python_util.cpp",
464]
465
Bin Bao528ab472023-07-14 14:35:29 +0000466inductor_core_resources = [
Mu-Chu Leeeddce3c2023-11-14 14:08:25 -0800467 "torch/csrc/inductor/aoti_model_container_runner.cpp",
Bin Bao0f646b12023-09-16 16:46:26 +0000468 "torch/csrc/inductor/aoti_torch/shim_common.cpp",
Bin Bao9c2715b2023-09-21 00:25:24 +0000469 "torch/csrc/inductor/aoti_torch/tensor_converter.cpp",
Bin Bao528ab472023-07-14 14:35:29 +0000470 "torch/csrc/inductor/inductor_ops.cpp",
471]
472
Will Constablea8c0b362021-10-07 10:03:02 -0700473libtorch_core_sources = sorted(
474 core_sources_common +
Pavithran Ramachandranc2ceba82021-11-04 15:52:03 -0700475 torch_unpickler_common +
Will Constablea8c0b362021-10-07 10:03:02 -0700476 core_sources_full +
477 core_trainer_sources +
Bin Bao528ab472023-07-14 14:35:29 +0000478 inductor_core_resources +
Will Constablea8c0b362021-10-07 10:03:02 -0700479 libtorch_profiler_sources +
480 lazy_tensor_core_sources,
481)
Martin Yuanb35cdc52020-06-28 16:37:23 -0700482
Luca Wehrstedta1780432021-06-15 02:00:08 -0700483# These files are the only ones that are supported on Windows.
484libtorch_distributed_base_sources = [
Howard Huang693ed8b2022-08-31 11:42:08 -0700485 "torch/csrc/distributed/c10d/Backend.cpp",
Luca Wehrstedta0161502021-06-24 12:37:29 -0700486 "torch/csrc/distributed/c10d/FileStore.cpp",
Yifu Wangec18ef62023-10-25 10:49:20 -0700487 "torch/csrc/distributed/c10d/Functional.cpp",
Luca Wehrstedta0161502021-06-24 12:37:29 -0700488 "torch/csrc/distributed/c10d/GlooDeviceFactory.cpp",
Yifu Wangec18ef62023-10-25 10:49:20 -0700489 "torch/csrc/distributed/c10d/GroupRegistry.cpp",
Jiewen Tane757cf42022-06-13 20:33:28 +0000490 "torch/csrc/distributed/c10d/Ops.cpp",
Luca Wehrstedta0161502021-06-24 12:37:29 -0700491 "torch/csrc/distributed/c10d/ParamCommsUtils.cpp",
492 "torch/csrc/distributed/c10d/PrefixStore.cpp",
493 "torch/csrc/distributed/c10d/ProcessGroup.cpp",
494 "torch/csrc/distributed/c10d/ProcessGroupGloo.cpp",
495 "torch/csrc/distributed/c10d/ProcessGroupMPI.cpp",
496 "torch/csrc/distributed/c10d/ProcessGroupWrapper.cpp",
Luca Wehrstedta0161502021-06-24 12:37:29 -0700497 "torch/csrc/distributed/c10d/Store.cpp",
498 "torch/csrc/distributed/c10d/TCPStore.cpp",
Rodrigo Kumperafe284b02023-07-24 06:51:51 -0700499 "torch/csrc/distributed/c10d/TCPStoreBackend.cpp",
Rodrigo Kumpera26367512023-07-26 10:23:14 -0700500 "torch/csrc/distributed/c10d/TCPStoreLibUvBackend.cpp",
Luca Wehrstedta0161502021-06-24 12:37:29 -0700501 "torch/csrc/distributed/c10d/Utils.cpp",
Can Balioglu6e640a02021-11-16 20:47:57 -0800502 "torch/csrc/distributed/c10d/comm.cpp",
Can Balioglue1db2f12022-02-23 18:25:26 -0800503 "torch/csrc/distributed/c10d/debug.cpp",
Can Balioglu6e640a02021-11-16 20:47:57 -0800504 "torch/csrc/distributed/c10d/default_comm_hooks.cpp",
Can Balioglu6e640a02021-11-16 20:47:57 -0800505 "torch/csrc/distributed/c10d/logger.cpp",
Can Balioglue143f982022-02-23 18:25:26 -0800506 "torch/csrc/distributed/c10d/logging.cpp",
Tristan Riceed51b932022-05-13 23:38:31 +0000507 "torch/csrc/distributed/c10d/quantization/quantization.cpp",
Can Balioglu6e640a02021-11-16 20:47:57 -0800508 "torch/csrc/distributed/c10d/reducer.cpp",
509 "torch/csrc/distributed/c10d/sequence_num.cpp",
510 "torch/csrc/distributed/c10d/socket.cpp",
Howard Huang74ead612022-09-13 12:07:22 -0700511 "torch/csrc/distributed/c10d/Work.cpp",
Luca Wehrstedta1780432021-06-15 02:00:08 -0700512]
513
514# These files are only supported on Linux (and others) but not on Windows.
515libtorch_distributed_extra_sources = [
Wanchao Liangd4939182020-06-08 19:40:00 -0700516 "torch/csrc/distributed/autograd/autograd.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800517 "torch/csrc/distributed/autograd/utils.cpp",
518 "torch/csrc/distributed/autograd/context/container.cpp",
519 "torch/csrc/distributed/autograd/context/context.cpp",
520 "torch/csrc/distributed/autograd/engine/dist_engine.cpp",
521 "torch/csrc/distributed/autograd/functions/recvrpc_backward.cpp",
522 "torch/csrc/distributed/autograd/functions/sendrpc_backward.cpp",
523 "torch/csrc/distributed/autograd/rpc_messages/autograd_metadata.cpp",
524 "torch/csrc/distributed/autograd/rpc_messages/propagate_gradients_req.cpp",
525 "torch/csrc/distributed/autograd/rpc_messages/propagate_gradients_resp.cpp",
526 "torch/csrc/distributed/autograd/rpc_messages/cleanup_autograd_context_req.cpp",
527 "torch/csrc/distributed/autograd/rpc_messages/cleanup_autograd_context_resp.cpp",
528 "torch/csrc/distributed/autograd/rpc_messages/rpc_with_autograd.cpp",
Rohan Varma7e823822020-06-18 16:55:56 -0700529 "torch/csrc/distributed/autograd/rpc_messages/rpc_with_profiling_req.cpp",
530 "torch/csrc/distributed/autograd/rpc_messages/rpc_with_profiling_resp.cpp",
Pritam Damania781e0ed2020-11-07 21:02:48 -0800531 "torch/csrc/distributed/autograd/rpc_messages/rref_backward_req.cpp",
532 "torch/csrc/distributed/autograd/rpc_messages/rref_backward_resp.cpp",
Luca Wehrstedta0161502021-06-24 12:37:29 -0700533 "torch/csrc/distributed/c10d/HashStore.cpp",
534 "torch/csrc/distributed/c10d/ProcessGroupRoundRobin.cpp",
Luca Wehrstedt08ce5ee2021-06-18 05:12:27 -0700535 "torch/csrc/distributed/rpc/agent_utils.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800536 "torch/csrc/distributed/rpc/message.cpp",
Rohan Varma14f7e952020-06-22 10:57:24 -0700537 "torch/csrc/distributed/rpc/profiler/remote_profiler_manager.cpp",
Shihao Xu45baf0e2020-06-01 12:33:39 -0700538 "torch/csrc/distributed/rpc/profiler/server_process_global_profiler.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800539 "torch/csrc/distributed/rpc/python_call.cpp",
540 "torch/csrc/distributed/rpc/python_remote_call.cpp",
541 "torch/csrc/distributed/rpc/python_resp.cpp",
542 "torch/csrc/distributed/rpc/request_callback.cpp",
Pritam Damaniaff6e5602020-07-15 12:54:13 -0700543 "torch/csrc/distributed/rpc/request_callback_no_python.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800544 "torch/csrc/distributed/rpc/rpc_agent.cpp",
545 "torch/csrc/distributed/rpc/rref_context.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800546 "torch/csrc/distributed/rpc/rref_impl.cpp",
Pritam Damania781e0ed2020-11-07 21:02:48 -0800547 "torch/csrc/distributed/rpc/rref_proto.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800548 "torch/csrc/distributed/rpc/script_call.cpp",
549 "torch/csrc/distributed/rpc/script_remote_call.cpp",
550 "torch/csrc/distributed/rpc/script_resp.cpp",
Luca Wehrstedt08ce5ee2021-06-18 05:12:27 -0700551 "torch/csrc/distributed/rpc/tensorpipe_agent.cpp",
552 "torch/csrc/distributed/rpc/tensorpipe_utils.cpp",
Howard Huange8d29162021-07-20 13:49:10 -0700553 "torch/csrc/distributed/rpc/testing/faulty_tensorpipe_agent.cpp",
Shihao Xu45baf0e2020-06-01 12:33:39 -0700554 "torch/csrc/distributed/rpc/torchscript_functions.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800555 "torch/csrc/distributed/rpc/types.cpp",
556 "torch/csrc/distributed/rpc/utils.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700557]
558
Luca Wehrstedta1780432021-06-15 02:00:08 -0700559libtorch_distributed_sources = libtorch_distributed_base_sources + libtorch_distributed_extra_sources
560
Martin Yuanb35cdc52020-06-28 16:37:23 -0700561jit_sources_full = [
Christian Sarofeen6d24f8f2020-04-02 09:19:36 -0700562 "torch/csrc/jit/codegen/cuda/interface.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700563 "torch/csrc/jit/passes/lower_graph.cpp",
564 "torch/csrc/jit/runtime/register_c10_ops.cpp",
Martin Yuan8a41fa42020-08-29 03:10:40 -0700565 "torch/csrc/jit/runtime/register_prim_ops.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700566 "torch/csrc/jit/runtime/register_prim_ops_fulljit.cpp",
Martin Yuan8a41fa42020-08-29 03:10:40 -0700567 "torch/csrc/jit/runtime/register_special_ops.cpp",
Nikita Shulgad7fc05b2020-04-16 19:08:16 -0700568 "torch/csrc/jit/passes/remove_inplace_ops.cpp",
569 "torch/csrc/jit/passes/utils/check_alias_annotation.cpp",
jjsjann1231ec732b2021-10-27 12:09:53 -0700570 "torch/csrc/jit/passes/autocast.cpp",
Nikita Shulgad7fc05b2020-04-16 19:08:16 -0700571]
572
Raziel Alvarez Guevara2b38c092020-09-24 09:36:53 -0700573libtorch_core_jit_sources = sorted(jit_sources_full)
Martin Yuanb35cdc52020-06-28 16:37:23 -0700574
Chen Lai3fe58952021-10-08 20:10:54 -0700575torch_mobile_tracer_sources = [
576 "torch/csrc/jit/mobile/model_tracer/tracer.cpp",
577 "torch/csrc/jit/mobile/model_tracer/TensorUtils.cpp",
Chen Lai76efbcc2021-10-15 02:17:57 -0700578 "torch/csrc/jit/mobile/model_tracer/TracerRunner.cpp",
Chen Lai3fe58952021-10-08 20:10:54 -0700579 "torch/csrc/jit/mobile/model_tracer/MobileModelRunner.cpp",
580 "torch/csrc/jit/mobile/model_tracer/OperatorCallTracer.cpp",
581 "torch/csrc/jit/mobile/model_tracer/KernelDTypeTracer.cpp",
Dhruv Matani18a31cc2022-09-09 08:51:12 -0700582 "torch/csrc/jit/mobile/model_tracer/CustomClassTracer.cpp",
583 "torch/csrc/jit/mobile/model_tracer/BuildFeatureTracer.cpp",
Chen Lai3fe58952021-10-08 20:10:54 -0700584]
585
Kimish Patelf4a92162021-05-04 09:17:43 -0700586libtorch_lite_eager_symbolication = [
587 "torch/csrc/jit/frontend/source_range.cpp",
Kimish Patele0fc4732021-05-04 09:17:43 -0700588 "torch/csrc/jit/ir/scope.cpp",
Kimish Patelf4a92162021-05-04 09:17:43 -0700589 "torch/csrc/jit/mobile/debug_info.cpp",
Kimish Patele0fc4732021-05-04 09:17:43 -0700590 "torch/csrc/jit/serialization/callstack_debug_info_serialization.cpp",
Kimish Patelf4a92162021-05-04 09:17:43 -0700591 "torch/csrc/jit/serialization/source_range_serialization.cpp",
592 # Later we can split serialization and deserialization logic
593 # to have better separation within build and only build relevant parts.
594 "torch/csrc/jit/serialization/pickle.cpp",
595 "torch/csrc/jit/serialization/pickler.cpp",
596 "torch/csrc/jit/serialization/unpickler.cpp",
597]
598
Chen Lai14f7bf02021-02-21 01:41:55 -0800599# TODO: core_trainer_sources is not necessary for libtorch lite
Pavithran Ramachandranc2ceba82021-11-04 15:52:03 -0700600libtorch_lite_cmake_sources = sorted(
601 core_trainer_sources +
602 core_sources_common +
603 torch_unpickler_common +
604 torch_mobile_core,
605)
Chen Lai14f7bf02021-02-21 01:41:55 -0800606
Nikita Shulgad294c062020-04-27 16:07:01 -0700607libtorch_cmake_sources = libtorch_core_sources + libtorch_core_jit_sources
608
Nikita Shulgad7fc05b2020-04-16 19:08:16 -0700609libtorch_extra_sources = libtorch_core_jit_sources + [
Jiakai Liu7f606422020-07-06 14:18:38 -0700610 "torch/csrc/autograd/TraceTypeManual.cpp",
Nikita Shulgad7fc05b2020-04-16 19:08:16 -0700611 "torch/csrc/autograd/VariableTypeManual.cpp",
albanD73f009a2020-09-02 09:18:14 -0700612 "torch/csrc/autograd/FunctionsManual.cpp",
Nikita Shulgad7fc05b2020-04-16 19:08:16 -0700613 "torch/csrc/jit/api/module_save.cpp",
614 "torch/csrc/jit/codegen/fuser/cpu/fused_kernel.cpp",
Jacob Szwejbkae9263602022-01-20 10:04:43 -0800615 "torch/csrc/jit/mobile/compatibility/backport.cpp",
616 "torch/csrc/jit/mobile/compatibility/backport_manager.cpp",
617 "torch/csrc/jit/mobile/compatibility/model_compatibility.cpp",
Kimish Patelf4a92162021-05-04 09:17:43 -0700618 # To be included for eager symbolication in lite interpreter
619 # when it is built in libtorch
Tugsbayasgalan (Tugsuu) Manlaibaatare849c8b2022-01-27 18:27:28 -0800620 "torch/csrc/jit/mobile/debug_info.cpp",
621 "torch/csrc/jit/mobile/function.cpp",
Han Qi (qihqi)25eb7c32022-12-08 03:48:04 +0000622 "torch/csrc/jit/mobile/flatbuffer_loader.cpp",
Nikita Shulgad7fc05b2020-04-16 19:08:16 -0700623 "torch/csrc/jit/mobile/import.cpp",
Ann Shandfe7d272020-07-23 14:23:30 -0700624 "torch/csrc/jit/mobile/import_data.cpp",
Tugsbayasgalan (Tugsuu) Manlaibaatare849c8b2022-01-27 18:27:28 -0800625 "torch/csrc/jit/mobile/interpreter.cpp",
626 "torch/csrc/jit/mobile/module.cpp",
627 "torch/csrc/jit/mobile/observer.cpp",
Martin Yuan30a7c762021-09-11 22:22:28 -0700628 "torch/csrc/jit/mobile/parse_bytecode.cpp",
Mengwei Liueaf85fa2021-09-17 12:57:48 -0700629 "torch/csrc/jit/mobile/parse_operators.cpp",
Kimish Patelcfd18e12022-08-27 16:06:16 -0700630 "torch/csrc/jit/mobile/quantization.cpp",
Lunwen He73d51402021-05-14 12:53:18 -0700631 "torch/csrc/jit/mobile/train/export_data.cpp",
632 "torch/csrc/jit/mobile/train/optim/sgd.cpp",
633 "torch/csrc/jit/mobile/train/random.cpp",
634 "torch/csrc/jit/mobile/train/sequential.cpp",
Chen Lai9e4d60a2021-12-14 19:04:32 -0800635 "torch/csrc/jit/mobile/upgrader_mobile.cpp",
BowenBao08126c92020-08-30 18:33:47 -0700636 "torch/csrc/jit/serialization/onnx.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700637 "torch/csrc/jit/serialization/export.cpp",
Tugsbayasgalan (Tugsuu) Manlaibaatare849c8b2022-01-27 18:27:28 -0800638 "torch/csrc/jit/serialization/export_bytecode.cpp",
639 "torch/csrc/jit/serialization/export_module.cpp",
Han Qi (qihqi)25eb7c32022-12-08 03:48:04 +0000640 "torch/csrc/jit/serialization/flatbuffer_serializer.cpp",
Nikita Shulga70d36162020-04-14 21:45:30 -0700641 "torch/csrc/jit/serialization/import_legacy.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800642 "torch/csrc/utils/byte_order.cpp",
Peter Bell26391142021-01-05 17:15:37 -0800643 "torch/csrc/utils/out_types.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800644]
645
Nikita Shulga1571dd82020-06-30 13:42:01 -0700646def libtorch_sources(gencode_pattern = ":generate-code[{}]"):
Han Qi (qihqi)25eb7c32022-12-08 03:48:04 +0000647 return (
648 libtorch_generated_sources(gencode_pattern) + libtorch_core_sources + libtorch_distributed_sources + libtorch_extra_sources
649 )
Nikita Shulga70d36162020-04-14 21:45:30 -0700650
Nikita Shulga58551e52020-12-15 20:49:28 -0800651libtorch_cuda_core_sources = [
Will Constable4bbff922021-01-22 09:13:55 -0800652 "torch/csrc/CudaIPCTypes.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800653 "torch/csrc/cuda/comm.cpp",
Zachary DeVito736adc02022-10-04 21:50:27 -0700654 "torch/csrc/cuda/memory_snapshot.cpp",
Mu-Chu Leeeddce3c2023-11-14 14:08:25 -0800655 "torch/csrc/inductor/aoti_model_container_runner_cuda.cpp",
Bin Bao0f646b12023-09-16 16:46:26 +0000656 "torch/csrc/inductor/aoti_torch/shim_cuda.cpp",
Michael Suodbe850a2020-02-27 12:18:24 -0800657 "torch/csrc/jit/codegen/fuser/cuda/fused_kernel.cpp",
Taylor Robieb8f14b72022-10-13 07:48:58 -0700658 "torch/csrc/profiler/stubs/cuda.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800659 "torch/csrc/autograd/functions/comm.cpp",
David Berard8b1e4962021-12-06 21:04:14 -0800660 "torch/csrc/jit/passes/frozen_conv_add_relu_fusion_cuda.cpp",
Mikhail Zolotukhin35e7efe2020-03-16 11:38:29 -0700661 "torch/csrc/jit/tensorexpr/cuda_codegen.cpp",
Nikitha Malgi12b73fd2020-12-29 20:22:19 -0800662 "torch/csrc/jit/runtime/register_cuda_ops.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800663]
664
Luca Wehrstedta1780432021-06-15 02:00:08 -0700665# These files are the only ones that are supported on Windows.
666libtorch_cuda_distributed_base_sources = [
Luca Wehrstedta0161502021-06-24 12:37:29 -0700667 "torch/csrc/distributed/c10d/reducer_cuda.cpp",
Luca Wehrstedta1780432021-06-15 02:00:08 -0700668]
669
670# These files are only supported on Linux (and others) but not on Windows.
671libtorch_cuda_distributed_extra_sources = [
Luca Wehrstedta0161502021-06-24 12:37:29 -0700672 "torch/csrc/distributed/c10d/NCCLUtils.cpp",
673 "torch/csrc/distributed/c10d/ProcessGroupNCCL.cpp",
Terry Lam54bdaf72022-07-12 14:45:44 +0000674 "torch/csrc/distributed/c10d/ProcessGroupUCC.cpp",
675 "torch/csrc/distributed/c10d/UCCTracing.cpp",
676 "torch/csrc/distributed/c10d/UCCUtils.cpp",
Luca Wehrstedt08ce5ee2021-06-18 05:12:27 -0700677 "torch/csrc/distributed/rpc/tensorpipe_cuda.cpp",
Marjan Fariborz3b284ab2021-08-25 23:40:09 -0700678 "torch/csrc/distributed/c10d/quantization/quantization_gpu.cu",
Luca Wehrstedta1780432021-06-15 02:00:08 -0700679]
680
681libtorch_cuda_distributed_sources = libtorch_cuda_distributed_base_sources + libtorch_cuda_distributed_extra_sources
682
683libtorch_cuda_sources = libtorch_cuda_core_sources + libtorch_cuda_distributed_sources + [
Nikita Shulga58551e52020-12-15 20:49:28 -0800684 "torch/csrc/cuda/nccl.cpp",
685]
686
Michael Suo0bde6102020-02-20 16:46:16 -0800687torch_cpp_srcs = [
688 "torch/csrc/api/src/cuda.cpp", # this just forwards stuff, no real CUDA
689 "torch/csrc/api/src/data/datasets/mnist.cpp",
690 "torch/csrc/api/src/data/samplers/distributed.cpp",
691 "torch/csrc/api/src/data/samplers/random.cpp",
692 "torch/csrc/api/src/data/samplers/sequential.cpp",
693 "torch/csrc/api/src/data/samplers/stream.cpp",
694 "torch/csrc/api/src/enum.cpp",
Jiewen Tan641f6ef2021-07-19 23:15:51 -0700695 "torch/csrc/api/src/imethod.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800696 "torch/csrc/api/src/jit.cpp",
Ramin Azarmehr234df292023-03-14 20:27:40 +0000697 "torch/csrc/api/src/mps.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800698 "torch/csrc/api/src/serialize.cpp",
699 "torch/csrc/api/src/nn/init.cpp",
700 "torch/csrc/api/src/nn/module.cpp",
701 "torch/csrc/api/src/nn/modules/_functions.cpp",
702 "torch/csrc/api/src/nn/modules/activation.cpp",
Mansoore95657b2020-03-12 09:46:48 -0700703 "torch/csrc/api/src/nn/modules/adaptive.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800704 "torch/csrc/api/src/nn/modules/batchnorm.cpp",
705 "torch/csrc/api/src/nn/modules/normalization.cpp",
706 "torch/csrc/api/src/nn/modules/instancenorm.cpp",
707 "torch/csrc/api/src/nn/modules/conv.cpp",
708 "torch/csrc/api/src/nn/modules/dropout.cpp",
709 "torch/csrc/api/src/nn/modules/distance.cpp",
710 "torch/csrc/api/src/nn/modules/embedding.cpp",
711 "torch/csrc/api/src/nn/modules/fold.cpp",
712 "torch/csrc/api/src/nn/modules/linear.cpp",
713 "torch/csrc/api/src/nn/modules/loss.cpp",
714 "torch/csrc/api/src/nn/modules/padding.cpp",
715 "torch/csrc/api/src/nn/modules/pixelshuffle.cpp",
716 "torch/csrc/api/src/nn/modules/pooling.cpp",
717 "torch/csrc/api/src/nn/modules/rnn.cpp",
718 "torch/csrc/api/src/nn/modules/upsampling.cpp",
lixinyu98de1502020-08-07 11:48:15 -0700719 "torch/csrc/api/src/nn/modules/transformer.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800720 "torch/csrc/api/src/nn/modules/container/functional.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800721 "torch/csrc/api/src/nn/options/activation.cpp",
Mansoore95657b2020-03-12 09:46:48 -0700722 "torch/csrc/api/src/nn/options/adaptive.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800723 "torch/csrc/api/src/nn/options/batchnorm.cpp",
724 "torch/csrc/api/src/nn/options/conv.cpp",
725 "torch/csrc/api/src/nn/options/dropout.cpp",
726 "torch/csrc/api/src/nn/options/instancenorm.cpp",
727 "torch/csrc/api/src/nn/options/linear.cpp",
728 "torch/csrc/api/src/nn/options/normalization.cpp",
729 "torch/csrc/api/src/nn/options/embedding.cpp",
730 "torch/csrc/api/src/nn/options/padding.cpp",
731 "torch/csrc/api/src/nn/options/pooling.cpp",
732 "torch/csrc/api/src/nn/options/rnn.cpp",
733 "torch/csrc/api/src/nn/options/vision.cpp",
lixinyu98de1502020-08-07 11:48:15 -0700734 "torch/csrc/api/src/nn/options/transformer.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800735 "torch/csrc/api/src/optim/adagrad.cpp",
736 "torch/csrc/api/src/optim/adam.cpp",
Sotiris Lamprinidis41f2dbd2020-06-18 15:26:21 -0700737 "torch/csrc/api/src/optim/adamw.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800738 "torch/csrc/api/src/optim/lbfgs.cpp",
739 "torch/csrc/api/src/optim/optimizer.cpp",
740 "torch/csrc/api/src/optim/rmsprop.cpp",
741 "torch/csrc/api/src/optim/serialize.cpp",
742 "torch/csrc/api/src/optim/sgd.cpp",
James Butterworth37ab7112021-03-10 23:07:43 -0800743 "torch/csrc/api/src/optim/schedulers/lr_scheduler.cpp",
744 "torch/csrc/api/src/optim/schedulers/step_lr.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800745 "torch/csrc/api/src/serialize/input-archive.cpp",
746 "torch/csrc/api/src/serialize/output-archive.cpp",
747]
748
Yujun Zhao461014d2020-06-25 10:52:18 -0700749libtorch_python_cuda_core_sources = [
Michael Suo0bde6102020-02-20 16:46:16 -0800750 "torch/csrc/cuda/Event.cpp",
751 "torch/csrc/cuda/Module.cpp",
Yujun Zhao461014d2020-06-25 10:52:18 -0700752 "torch/csrc/cuda/python_comm.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800753 "torch/csrc/cuda/Stream.cpp",
Michael Carillic0681802020-12-14 10:49:57 -0800754 "torch/csrc/cuda/Graph.cpp",
Peter Bell5fc5cf62020-03-11 07:15:03 -0700755 "torch/csrc/cuda/shared/cudart.cpp",
Peter Bell5fc5cf62020-03-11 07:15:03 -0700756 "torch/csrc/cuda/shared/nvtx.cpp",
Yujun Zhao461014d2020-06-25 10:52:18 -0700757 "torch/csrc/cuda/utils.cpp",
Emilio Castilloc9d43902022-11-23 17:54:33 +0000758 "torch/csrc/cuda/CUDAPluggableAllocator.cpp",
Yujun Zhao461014d2020-06-25 10:52:18 -0700759]
760
761libtorch_python_cuda_sources = libtorch_python_cuda_core_sources + [
762 "torch/csrc/cuda/python_nccl.cpp",
763 "torch/csrc/cuda/shared/cudnn.cpp",
764 "torch/csrc/cuda/Tensor.cpp",
Michael Suo0bde6102020-02-20 16:46:16 -0800765]
766
Nikita Shulgad294c062020-04-27 16:07:01 -0700767libtorch_python_core_sources = [
Nikita Shulgad294c062020-04-27 16:07:01 -0700768 "torch/csrc/DataLoader.cpp",
769 "torch/csrc/Device.cpp",
770 "torch/csrc/Dtype.cpp",
771 "torch/csrc/DynamicTypes.cpp",
772 "torch/csrc/Exceptions.cpp",
773 "torch/csrc/Generator.cpp",
774 "torch/csrc/Layout.cpp",
775 "torch/csrc/MemoryFormat.cpp",
776 "torch/csrc/QScheme.cpp",
777 "torch/csrc/Module.cpp",
Kurt Mohler4d9920f2023-01-24 13:20:28 -0600778 "torch/csrc/PyInterpreter.cpp",
Nikita Shulgad294c062020-04-27 16:07:01 -0700779 "torch/csrc/python_dimname.cpp",
780 "torch/csrc/Size.cpp",
781 "torch/csrc/Storage.cpp",
Kurt Mohler272193d2022-06-01 19:00:58 +0000782 "torch/csrc/StorageMethods.cpp",
783 "torch/csrc/StorageSharing.cpp",
chengjun5741de82020-10-13 09:13:00 -0700784 "torch/csrc/Stream.cpp",
Nikita Shulgad294c062020-04-27 16:07:01 -0700785 "torch/csrc/TypeInfo.cpp",
786 "torch/csrc/api/src/python/init.cpp",
787 "torch/csrc/autograd/functions/init.cpp",
788 "torch/csrc/autograd/init.cpp",
Taylor Robie33e9a0b2021-11-15 23:30:05 -0800789 "torch/csrc/autograd/profiler_python.cpp",
Nikita Shulgad294c062020-04-27 16:07:01 -0700790 "torch/csrc/autograd/python_anomaly_mode.cpp",
Victor Quachee5a97d2021-07-15 08:07:56 -0700791 "torch/csrc/autograd/python_saved_variable_hooks.cpp",
Nikita Shulgad294c062020-04-27 16:07:01 -0700792 "torch/csrc/autograd/python_cpp_function.cpp",
793 "torch/csrc/autograd/python_engine.cpp",
794 "torch/csrc/autograd/python_function.cpp",
795 "torch/csrc/autograd/python_hook.cpp",
796 "torch/csrc/autograd/python_legacy_variable.cpp",
Antoni Viros i Martinc77368d2022-11-08 00:03:14 +0000797 "torch/csrc/autograd/python_nested_functions_manual.cpp",
Peter Bell44ede712021-08-25 15:05:14 -0700798 "torch/csrc/autograd/python_torch_functions_manual.cpp",
Nikita Shulgad294c062020-04-27 16:07:01 -0700799 "torch/csrc/autograd/python_variable.cpp",
800 "torch/csrc/autograd/python_variable_indexing.cpp",
Jason Anselc902b842023-07-23 17:17:29 -0700801 "torch/csrc/dynamo/python_compiled_autograd.cpp",
David Berard06b17372023-09-01 17:32:57 -0700802 "torch/csrc/dynamo/cpp_shim.cpp",
William Wen785676c2023-04-25 22:03:28 +0000803 "torch/csrc/dynamo/cpython_defs.c",
Jason Anself1fdb6e2022-10-11 23:01:21 +0000804 "torch/csrc/dynamo/eval_frame.c",
805 "torch/csrc/dynamo/guards.cpp",
806 "torch/csrc/dynamo/init.cpp",
Richard Zou5e5c3192022-09-22 06:56:40 -0700807 "torch/csrc/functorch/init.cpp",
Ramin Azarmehrbdd8f512023-02-12 21:22:28 +0000808 "torch/csrc/mps/Module.cpp",
eellisond5df0552020-05-07 18:13:35 -0700809 "torch/csrc/jit/backends/backend_init.cpp",
Nikita Shulgad294c062020-04-27 16:07:01 -0700810 "torch/csrc/jit/python/init.cpp",
811 "torch/csrc/jit/passes/onnx.cpp",
812 "torch/csrc/jit/passes/onnx/cast_all_constant_to_floating.cpp",
BowenBaocc792742022-02-11 13:58:46 -0800813 "torch/csrc/jit/passes/onnx/deduplicate_initializers.cpp",
Ksenija Stanojevicaf5d0bf2020-07-22 14:57:23 -0700814 "torch/csrc/jit/passes/onnx/eval_peephole.cpp",
Nikita Shulgad294c062020-04-27 16:07:01 -0700815 "torch/csrc/jit/passes/onnx/constant_fold.cpp",
BowenBao7f170582021-03-12 02:42:06 -0800816 "torch/csrc/jit/passes/onnx/constant_map.cpp",
Ksenija Stanojevice845b0a2020-08-11 20:29:12 -0700817 "torch/csrc/jit/passes/onnx/eliminate_unused_items.cpp",
BowenBao84275952020-08-03 22:31:54 -0700818 "torch/csrc/jit/passes/onnx/fixup_onnx_controlflow.cpp",
neginraoof15bc21c2020-12-03 23:05:43 -0800819 "torch/csrc/jit/passes/onnx/list_model_parameters.cpp",
Nikita Shulgad294c062020-04-27 16:07:01 -0700820 "torch/csrc/jit/passes/onnx/function_substitution.cpp",
821 "torch/csrc/jit/passes/onnx/helper.cpp",
822 "torch/csrc/jit/passes/onnx/peephole.cpp",
BowenBaoa6c87302020-08-06 20:30:41 -0700823 "torch/csrc/jit/passes/onnx/preprocess_for_onnx.cpp",
Nikita Shulgad294c062020-04-27 16:07:01 -0700824 "torch/csrc/jit/passes/onnx/prepare_division_for_onnx.cpp",
825 "torch/csrc/jit/passes/onnx/scalar_type_analysis.cpp",
826 "torch/csrc/jit/passes/onnx/unpack_quantized_weights.cpp",
neginraoof3d7c22a2020-09-04 15:19:37 -0700827 "torch/csrc/jit/passes/onnx/remove_inplace_ops_for_onnx.cpp",
BowenBao08126c92020-08-30 18:33:47 -0700828 "torch/csrc/jit/passes/onnx/shape_type_inference.cpp",
Nikita Shulga53a163a2021-10-22 13:36:41 -0700829 "torch/csrc/jit/passes/onnx/function_extraction.cpp",
BowenBao54a69422022-03-17 12:32:51 -0700830 "torch/csrc/jit/passes/onnx/onnx_log.cpp",
BowenBaodaca0ee2022-08-22 10:14:36 -0700831 "torch/csrc/jit/passes/onnx/naming.cpp",
Luca Wehrstedt1ac05cf2020-12-19 11:01:55 -0800832 "torch/csrc/jit/python/pybind_utils.cpp",
shubhambhokare195d87382022-08-03 23:30:19 +0000833 "torch/csrc/jit/passes/onnx/pattern_conversion/autograd_function_process.cpp",
BowenBao3f9c8032021-03-11 10:25:12 -0800834 "torch/csrc/jit/passes/onnx/pattern_conversion/common.cpp",
835 "torch/csrc/jit/passes/onnx/pattern_conversion/pattern_encapsulation.cpp",
836 "torch/csrc/jit/passes/onnx/pattern_conversion/pattern_conversion.cpp",
Nikita Shulgad294c062020-04-27 16:07:01 -0700837 "torch/csrc/jit/python/python_arg_flatten.cpp",
838 "torch/csrc/jit/python/python_custom_class.cpp",
Meghan Leleb14c3202021-05-27 10:24:11 -0700839 "torch/csrc/jit/python/python_dict.cpp",
Nikita Shulgad294c062020-04-27 16:07:01 -0700840 "torch/csrc/jit/python/python_interpreter.cpp",
841 "torch/csrc/jit/python/python_ir.cpp",
Meghan Lele4a2e8b52021-07-01 20:27:02 -0700842 "torch/csrc/jit/python/python_list.cpp",
Nikita Shulgad294c062020-04-27 16:07:01 -0700843 "torch/csrc/jit/python/python_tracer.cpp",
844 "torch/csrc/jit/python/script_init.cpp",
845 "torch/csrc/jit/frontend/concrete_module_type.cpp",
Zhengxu Chen8176ab62021-04-16 15:45:49 -0700846 "torch/csrc/jit/frontend/tree_views.cpp",
Nikita Shulgad294c062020-04-27 16:07:01 -0700847 "torch/csrc/jit/python/python_sugared_value.cpp",
848 "torch/csrc/jit/python/python_tree_views.cpp",
Bram Wastiada84042020-08-12 13:02:29 -0700849 "torch/csrc/jit/runtime/static/init.cpp",
Mikhail Zolotukhine9dc8fc2021-01-14 21:00:53 -0800850 "torch/csrc/jit/tensorexpr/tensorexpr_init.cpp",
Tristan Ricebfe1abd2022-01-12 13:33:49 -0800851 "torch/csrc/monitor/python_init.cpp",
Nikita Shulgad294c062020-04-27 16:07:01 -0700852 "torch/csrc/multiprocessing/init.cpp",
853 "torch/csrc/onnx/init.cpp",
Taylor Robie1fa9a372022-08-18 17:51:32 -0700854 "torch/csrc/profiler/python/init.cpp",
Zachary DeVitoe74f70d2023-03-15 15:14:10 -0700855 "torch/csrc/profiler/python/combined_traceback.cpp",
Nikita Shulgad294c062020-04-27 16:07:01 -0700856 "torch/csrc/serialization.cpp",
857 "torch/csrc/tensor/python_tensor.cpp",
858 "torch/csrc/utils/init.cpp",
859 "torch/csrc/utils/throughput_benchmark.cpp",
860 "torch/csrc/utils.cpp",
861 "torch/csrc/utils/cuda_lazy_init.cpp",
862 "torch/csrc/utils/invalid_arguments.cpp",
Antoni Viros i Martinc77368d2022-11-08 00:03:14 +0000863 "torch/csrc/utils/nested.cpp",
Nikita Shulgad294c062020-04-27 16:07:01 -0700864 "torch/csrc/utils/object_ptr.cpp",
865 "torch/csrc/utils/python_arg_parser.cpp",
866 "torch/csrc/utils/python_dispatch.cpp",
Edward Z. Yang1ff52222022-10-27 13:49:11 -0700867 "torch/csrc/utils/python_symnode.cpp",
Edward Z. Yangd3c01c72022-10-28 17:20:10 -0400868 "torch/csrc/utils/pybind.cpp",
Kurt Mohler4c5e4352023-09-12 22:26:05 +0000869 "torch/csrc/utils/pyobject_preservation.cpp",
Nikita Shulgad294c062020-04-27 16:07:01 -0700870 "torch/csrc/utils/structseq.cpp",
871 "torch/csrc/utils/tensor_apply.cpp",
872 "torch/csrc/utils/tensor_dtypes.cpp",
873 "torch/csrc/utils/tensor_layouts.cpp",
874 "torch/csrc/utils/tensor_memoryformats.cpp",
875 "torch/csrc/utils/tensor_qschemes.cpp",
876 "torch/csrc/utils/tensor_list.cpp",
877 "torch/csrc/utils/tensor_new.cpp",
878 "torch/csrc/utils/tensor_numpy.cpp",
879 "torch/csrc/utils/tensor_types.cpp",
Hameer Abbasi3d46e022020-08-05 20:39:27 -0700880 "torch/csrc/utils/disable_torch_function.cpp",
Jing Xu0e957462022-07-27 23:29:35 +0000881 "torch/csrc/utils/verbose.cpp",
leslie-fang-intel9832cfb2023-06-19 14:52:39 +0800882 "torch/csrc/cpu/Module.cpp",
Will Constable328cfd52022-02-11 09:54:34 -0800883] + lazy_tensor_core_python_sources
Nikita Shulgad294c062020-04-27 16:07:01 -0700884
gunandrose4uf07ac6a2020-09-25 12:35:42 -0700885libtorch_python_distributed_core_sources = [
Nikita Shulgad294c062020-04-27 16:07:01 -0700886 "torch/csrc/distributed/c10d/init.cpp",
Luca Wehrstedta0161502021-06-24 12:37:29 -0700887 "torch/csrc/distributed/c10d/python_comm_hook.cpp",
gunandrose4uf07ac6a2020-09-25 12:35:42 -0700888]
889
890libtorch_python_distributed_sources = libtorch_python_distributed_core_sources + [
891 "torch/csrc/distributed/autograd/init.cpp",
Nikita Shulgad294c062020-04-27 16:07:01 -0700892 "torch/csrc/distributed/rpc/init.cpp",
Nikita Shulgad294c062020-04-27 16:07:01 -0700893 "torch/csrc/distributed/rpc/py_rref.cpp",
894 "torch/csrc/distributed/rpc/python_functions.cpp",
895 "torch/csrc/distributed/rpc/python_rpc_handler.cpp",
896 "torch/csrc/distributed/rpc/request_callback_impl.cpp",
Nikita Shulgad294c062020-04-27 16:07:01 -0700897 "torch/csrc/distributed/rpc/testing/init.cpp",
898 "torch/csrc/distributed/rpc/unpickled_python_call.cpp",
899 "torch/csrc/distributed/rpc/unpickled_python_remote_call.cpp",
900 "torch/csrc/jit/runtime/register_distributed_ops.cpp",
901]
902
Nikita Shulga1571dd82020-06-30 13:42:01 -0700903def glob_libtorch_python_sources(gencode_pattern = ":generate-code[{}]"):
904 _libtorch_python_sources = [gencode_pattern.format(name) for name in [
mikey dagitses096ff0e2022-05-04 06:48:20 -0700905 "torch/csrc/autograd/generated/python_functions_0.cpp",
906 "torch/csrc/autograd/generated/python_functions_1.cpp",
907 "torch/csrc/autograd/generated/python_functions_2.cpp",
908 "torch/csrc/autograd/generated/python_functions_3.cpp",
909 "torch/csrc/autograd/generated/python_functions_4.cpp",
Mikayla Gawareckie217b302022-09-12 04:03:49 +0000910 "torch/csrc/autograd/generated/python_nested_functions.cpp",
mikey dagitses096ff0e2022-05-04 06:48:20 -0700911 "torch/csrc/autograd/generated/python_nn_functions.cpp",
912 "torch/csrc/autograd/generated/python_fft_functions.cpp",
913 "torch/csrc/autograd/generated/python_linalg_functions.cpp",
anjali41138350ac2022-06-10 21:48:56 +0000914 "torch/csrc/autograd/generated/python_enum_tag.cpp",
mikey dagitses096ff0e2022-05-04 06:48:20 -0700915 "torch/csrc/autograd/generated/python_return_types.cpp",
916 "torch/csrc/autograd/generated/python_sparse_functions.cpp",
917 "torch/csrc/autograd/generated/python_special_functions.cpp",
918 "torch/csrc/autograd/generated/python_torch_functions_0.cpp",
919 "torch/csrc/autograd/generated/python_torch_functions_1.cpp",
920 "torch/csrc/autograd/generated/python_torch_functions_2.cpp",
921 "torch/csrc/autograd/generated/python_variable_methods.cpp",
Nikita Shulga1571dd82020-06-30 13:42:01 -0700922 ]]
Michael Suo0bde6102020-02-20 16:46:16 -0800923
Nikita Shulgad294c062020-04-27 16:07:01 -0700924 _libtorch_python_sources.extend(libtorch_python_core_sources)
925 _libtorch_python_sources.extend(libtorch_python_distributed_sources)
926
Alexander Fix3da67ce2020-04-06 18:22:32 -0700927 return _libtorch_python_sources
Chen Lai502a8592021-02-26 11:24:10 -0800928
Nikita Shulga6cef5942022-12-31 00:02:43 +0000929# List of non-globed source used to build ATen core internally
930aten_cpu_non_globed_sources = [
931 "aten/src/ATen/detail/CUDAHooksInterface.cpp",
932 "aten/src/ATen/detail/HIPHooksInterface.cpp",
933 "aten/src/ATen/detail/MPSHooksInterface.cpp",
934 "aten/src/ATen/detail/ORTHooksInterface.cpp",
shibo197047d132023-07-29 12:56:03 +0000935 "aten/src/ATen/detail/PrivateUse1HooksInterface.cpp",
Xunsong, Huangb053a0f2023-03-10 12:17:14 +0000936 "aten/src/ATen/detail/XPUHooksInterface.cpp",
Richard Lic523d7d2023-04-26 23:00:34 +0000937 "aten/src/ATen/detail/MTIAHooksInterface.cpp",
George Whitef4796df2023-10-06 21:36:10 +0000938 "aten/src/ATen/detail/IPUHooksInterface.cpp",
Nikita Shulga6cef5942022-12-31 00:02:43 +0000939 "aten/src/ATen/record_function.cpp",
940 "aten/src/ATen/Dispatch.cpp",
941 "aten/src/ATen/SequenceNumber.cpp",
942]
943
944aten_cpu_non_globed_headers = [
945 "aten/src/ATen/CPUGeneratorImpl.h",
946 "aten/src/ATen/NumericUtils.h",
947 "aten/src/ATen/detail/CUDAHooksInterface.h",
948 "aten/src/ATen/detail/MPSHooksInterface.h",
949 "aten/src/ATen/detail/HIPHooksInterface.h",
950 "aten/src/ATen/detail/ORTHooksInterface.h",
shibo197047d132023-07-29 12:56:03 +0000951 "aten/src/ATen/detail/PrivateUse1HooksInterface.h",
Xunsong, Huangb053a0f2023-03-10 12:17:14 +0000952 "aten/src/ATen/detail/XPUHooksInterface.h",
Richard Lic523d7d2023-04-26 23:00:34 +0000953 "aten/src/ATen/detail/MTIAHooksInterface.h",
George Whitef4796df2023-10-06 21:36:10 +0000954 "aten/src/ATen/detail/IPUHooksInterface.h",
Nikita Shulga6cef5942022-12-31 00:02:43 +0000955]
956
Chen Lai98943bb2021-03-08 12:23:00 -0800957aten_cpu_source_non_codegen_list = [
Peter Bell6408cbd2021-06-03 11:42:14 -0700958 "aten/src/ATen/AccumulateType.cpp",
Richard Zou4b105342022-12-07 07:48:41 -0800959 "aten/src/ATen/LegacyBatchedTensorImpl.cpp",
Chen Lai502a8592021-02-26 11:24:10 -0800960 "aten/src/ATen/CPUGeneratorImpl.cpp",
961 "aten/src/ATen/Context.cpp",
962 "aten/src/ATen/DLConvertor.cpp",
Peter Bell6f4c4912022-01-18 15:57:30 -0800963 "aten/src/ATen/EmptyTensor.cpp",
Chen Lai502a8592021-02-26 11:24:10 -0800964 "aten/src/ATen/ExpandUtils.cpp",
Elias Ellisond881b292023-04-24 17:08:40 +0000965 "aten/src/ATen/CachedTensorUtils.cpp",
Brian Hirsh0032fa72021-10-28 10:43:11 -0700966 "aten/src/ATen/FunctionalInverses.cpp",
967 "aten/src/ATen/FunctionalStorageImpl.cpp",
968 "aten/src/ATen/FunctionalTensorWrapper.cpp",
Brian Hirsh4a2bbc62021-10-29 21:39:29 -0700969 "aten/src/ATen/FunctionalizeFallbackKernel.cpp",
Chen Lai502a8592021-02-26 11:24:10 -0800970 "aten/src/ATen/MemoryOverlap.cpp",
PyTorch MergeBotf68d6e82023-10-13 17:57:53 +0000971 "aten/src/ATen/MapAllocator.cpp",
Chen Lai502a8592021-02-26 11:24:10 -0800972 "aten/src/ATen/NamedTensorUtils.cpp",
Christian Puhrsch484c0de2022-03-02 07:29:19 -0800973 "aten/src/ATen/NestedTensorImpl.cpp",
Chen Lai502a8592021-02-26 11:24:10 -0800974 "aten/src/ATen/ParallelCommon.cpp",
975 "aten/src/ATen/ParallelNative.cpp",
976 "aten/src/ATen/ParallelNativeTBB.cpp",
977 "aten/src/ATen/ParallelOpenMP.cpp",
978 "aten/src/ATen/ParallelThreadPoolNative.cpp",
Edward Z. Yang3f108a52022-04-01 13:15:24 -0700979 "aten/src/ATen/PythonTorchFunctionTLS.cpp",
Elias Ellison70f4b352023-01-23 21:03:42 +0000980 "aten/src/ATen/ThreadLocalPythonObjects.cpp",
Chen Lai502a8592021-02-26 11:24:10 -0800981 "aten/src/ATen/ScalarOps.cpp",
Chen Lai502a8592021-02-26 11:24:10 -0800982 "aten/src/ATen/SparseTensorImpl.cpp",
Sameer Deshmukh5fb11422021-04-12 10:07:56 -0700983 "aten/src/ATen/SparseCsrTensorImpl.cpp",
Chen Lai502a8592021-02-26 11:24:10 -0800984 "aten/src/ATen/TensorGeometry.cpp",
985 "aten/src/ATen/TensorIndexing.cpp",
986 "aten/src/ATen/TensorMeta.cpp",
987 "aten/src/ATen/TensorNames.cpp",
988 "aten/src/ATen/TensorUtils.cpp",
989 "aten/src/ATen/ThreadLocalState.cpp",
Richard Zou698c35e2021-12-02 09:24:19 -0800990 "aten/src/ATen/FuncTorchTLS.cpp",
Chen Lai502a8592021-02-26 11:24:10 -0800991 "aten/src/ATen/Utils.cpp",
992 "aten/src/ATen/Version.cpp",
Richard Zou4b105342022-12-07 07:48:41 -0800993 "aten/src/ATen/LegacyVmapMode.cpp",
994 "aten/src/ATen/LegacyVmapTransforms.cpp",
Chen Lai502a8592021-02-26 11:24:10 -0800995 "aten/src/ATen/core/BackendSelectFallbackKernel.cpp",
996 "aten/src/ATen/core/DeprecatedTypeProperties.cpp",
997 "aten/src/ATen/core/DeprecatedTypePropertiesRegistry.cpp",
998 "aten/src/ATen/core/Dict.cpp",
999 "aten/src/ATen/core/Dimname.cpp",
1000 "aten/src/ATen/core/Formatting.cpp",
goldenxuette3a87092022-07-11 15:01:50 -07001001 "aten/src/ATen/core/function_schema.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001002 "aten/src/ATen/core/Generator.cpp",
rzou8124a6c2023-09-21 14:04:16 -07001003 "aten/src/ATen/core/PythonOpRegistrationTrampoline.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001004 "aten/src/ATen/core/List.cpp",
1005 "aten/src/ATen/core/NamedTensor.cpp",
1006 "aten/src/ATen/core/Tensor.cpp",
1007 "aten/src/ATen/core/VariableFallbackKernel.cpp",
1008 "aten/src/ATen/core/VariableHooksInterface.cpp",
Victor Bittorf52f1a072021-04-15 15:56:00 -07001009 "aten/src/ATen/core/Vitals.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001010 "aten/src/ATen/core/boxing/KernelFunction.cpp",
1011 "aten/src/ATen/core/custom_class.cpp",
1012 "aten/src/ATen/core/dispatch/DispatchKeyExtractor.cpp",
1013 "aten/src/ATen/core/dispatch/Dispatcher.cpp",
1014 "aten/src/ATen/core/dispatch/ObservedOperators.cpp",
1015 "aten/src/ATen/core/dispatch/OperatorEntry.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001016 "aten/src/ATen/core/interned_strings.cpp",
1017 "aten/src/ATen/core/ivalue.cpp",
1018 "aten/src/ATen/core/library.cpp",
1019 "aten/src/ATen/core/op_registration/infer_schema.cpp",
1020 "aten/src/ATen/core/op_registration/op_registration.cpp",
1021 "aten/src/ATen/core/operator_name.cpp",
Edward Z. Yang2d8f0912022-08-15 06:56:28 -07001022 "aten/src/ATen/core/TorchDispatchUtils.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001023 "aten/src/ATen/core/register_symbols.cpp",
Zhengxu Chen39f65fe2021-12-16 13:06:08 -08001024 "aten/src/ATen/core/class_type.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001025 "aten/src/ATen/core/type.cpp",
Zhengxu Chene7634f82022-01-11 13:47:58 -08001026 "aten/src/ATen/core/type_factory.cpp",
Zhengxu Chen649dda92022-01-07 11:19:15 -08001027 "aten/src/ATen/core/dynamic_type.cpp",
Zhengxu Chen3f3eae62022-01-07 18:32:35 -08001028 "aten/src/ATen/core/tensor_type.cpp",
Zhengxu Chenbc026c02022-01-07 11:19:15 -08001029 "aten/src/ATen/core/union_type.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001030 "aten/src/ATen/cpu/FlushDenormal.cpp",
1031 "aten/src/ATen/detail/CPUGuardImpl.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001032 "aten/src/ATen/metal/Context.cpp",
1033 "aten/src/ATen/native/AutogradComposite.cpp",
Michael Voznesenskycd7408e2022-09-19 20:48:09 +00001034 "aten/src/ATen/native/ComparisonUtils.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001035 "aten/src/ATen/native/DispatchStub.cpp",
1036 "aten/src/ATen/native/UpSample.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001037 "aten/src/ATen/native/mkldnn/BinaryOps.cpp",
1038 "aten/src/ATen/native/mkldnn/Conv.cpp",
chunyuan-w693a8dd2022-08-10 21:46:51 +00001039 "aten/src/ATen/native/mkldnn/ConvPrepack.cpp",
Masaya, Kato473d1932021-04-08 06:34:10 -07001040 "aten/src/ATen/native/mkldnn/Copy.cpp",
yanbing-jc7a7c2b2021-08-03 06:50:34 -07001041 "aten/src/ATen/native/mkldnn/Gelu.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001042 "aten/src/ATen/native/mkldnn/IDeepRegistration.cpp",
1043 "aten/src/ATen/native/mkldnn/Linear.cpp",
1044 "aten/src/ATen/native/mkldnn/MKLDNNCommon.cpp",
1045 "aten/src/ATen/native/mkldnn/MKLDNNConversions.cpp",
1046 "aten/src/ATen/native/mkldnn/MkldnnTensorMath.cpp",
1047 "aten/src/ATen/native/mkldnn/Normalization.cpp",
chunyuan-w693a8dd2022-08-10 21:46:51 +00001048 "aten/src/ATen/native/mkldnn/OpContext.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001049 "aten/src/ATen/native/mkldnn/Pooling.cpp",
yanbing-jcd33e412022-05-10 17:29:11 +00001050 "aten/src/ATen/native/mkldnn/Prelu.cpp",
chunyuan-w693a8dd2022-08-10 21:46:51 +00001051 "aten/src/ATen/native/mkldnn/RegisterMkldnnOpContextClass.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001052 "aten/src/ATen/native/mkldnn/Relu.cpp",
yanbing-j94a7c012023-01-18 04:41:18 +00001053 "aten/src/ATen/native/mkldnn/RNN.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001054 "aten/src/ATen/native/mkldnn/SoftMax.cpp",
1055 "aten/src/ATen/native/mkldnn/TensorFactories.cpp",
1056 "aten/src/ATen/native/mkldnn/TensorShape.cpp",
1057 "aten/src/ATen/native/mkldnn/UnaryOps.cpp",
1058 "aten/src/ATen/native/mkldnn/Utils.cpp",
haozhe.zhu752a8202021-09-17 09:52:47 -07001059 "aten/src/ATen/native/mkldnn/Matmul.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001060 "aten/src/ATen/native/quantized/cpu/init_qnnpack.cpp",
Kimish Patelefe2c042022-07-16 06:02:01 +00001061 # This is moved to aten_cpu because some of the custom ops use empty_with_tail_padding
1062 # which was available only within aten_native_cpu. Ideally the right fix is to make
1063 # empty_with_tail_padding into an op and use dispatcher with it. But exposing it as an op
1064 # has limited use and hence does not seem to really make sense.
1065 "aten/src/ATen/native/utils/Factory.cpp",
Victor Quach5abeac32021-08-13 07:47:12 -07001066 "aten/src/ATen/SavedTensorHooks.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001067 "aten/src/ATen/vulkan/Context.cpp",
Pavithran Ramachandran8beabff2021-10-20 20:40:12 -07001068 "aten/src/ATen/native/prim_native_functions.cpp",
Jing Xu0e957462022-07-27 23:29:35 +00001069 "aten/src/ATen/native/verbose_wrapper.cpp",
leslie-fang-intel9832cfb2023-06-19 14:52:39 +08001070 "aten/src/ATen/cpu/Utils.cpp",
Nikita Shulga6cef5942022-12-31 00:02:43 +00001071] + aten_cpu_non_globed_sources
Chen Lai502a8592021-02-26 11:24:10 -08001072
Chen Lai98943bb2021-03-08 12:23:00 -08001073aten_cpu_source_codegen_list = [
1074 "aten/src/ATen/native/cpu/AdaptiveAvgPoolKernel.cpp",
mingfeimadd045ab2021-06-25 16:34:57 -07001075 "aten/src/ATen/native/cpu/AdaptiveMaxPoolKernel.cpp",
Chen Lai98943bb2021-03-08 12:23:00 -08001076]
1077
Edward Yangce7910b2022-02-28 15:46:04 -08001078aten_ufunc_headers = [
1079 "aten/src/ATen/native/ufunc/add.h",
1080]
1081
H1Gdevd7d0fa22021-05-21 11:43:47 -07001082# When building lite interpreter in OSS, "aten/src/ATen/native/cpu/AdaptiveAvgPoolKernel.cpp" will go through
Chen Lai98943bb2021-03-08 12:23:00 -08001083# codegen process. The codegen version of this file, like Activation.cpp.DEFAULT.cpp, will be included
1084# in ${cpu_kernel_cpp} in aten/src/ATen/CMakeLists.txt. As a result, in aten/src/ATen/CMakeLists.txt,
1085# only aten_cpu_source_non_codegen_list need to be added to ${all_cpu_cpp}.
1086aten_cpu_source_list = sorted(aten_cpu_source_non_codegen_list + aten_cpu_source_codegen_list)
1087
1088# Same as ${aten_cpu_source_codegen_list}, this list will go through aten codegen, and be included in
1089# ${cpu_kernel_cpp} in aten/src/ATen/CMakeLists.txt.
1090aten_native_source_codegen_list = [
1091 "aten/src/ATen/native/cpu/Activation.cpp",
mingfeimabb19dc12021-06-09 21:05:35 -07001092 "aten/src/ATen/native/cpu/AvgPoolKernel.cpp",
Chen Lai98943bb2021-03-08 12:23:00 -08001093 "aten/src/ATen/native/cpu/BinaryOpsKernel.cpp",
1094 "aten/src/ATen/native/cpu/BlasKernel.cpp",
1095 "aten/src/ATen/native/cpu/CatKernel.cpp",
mingfeima054b90f2022-01-14 11:54:06 -08001096 "aten/src/ATen/native/cpu/ChannelShuffleKernel.cpp",
Chen Lai98943bb2021-03-08 12:23:00 -08001097 "aten/src/ATen/native/cpu/ComplexKernel.cpp",
1098 "aten/src/ATen/native/cpu/CopyKernel.cpp",
1099 "aten/src/ATen/native/cpu/CrossKernel.cpp",
1100 "aten/src/ATen/native/cpu/DepthwiseConvKernel.cpp",
1101 "aten/src/ATen/native/cpu/DistanceOpsKernel.cpp",
Peter Bell1841f762021-10-12 08:09:29 -07001102 "aten/src/ATen/native/cpu/DistributionKernels.cpp",
Liao, Xuan5516fe12023-08-18 21:22:08 +00001103 "aten/src/ATen/native/cpu/FlashAttentionKernel.cpp",
Chen Lai98943bb2021-03-08 12:23:00 -08001104 "aten/src/ATen/native/cpu/FillKernel.cpp",
1105 "aten/src/ATen/native/cpu/FunctionOfAMatrixUtilsKernel.cpp",
1106 "aten/src/ATen/native/cpu/GridSamplerKernel.cpp",
Saketh Are729f7cd2021-06-22 10:04:51 -07001107 "aten/src/ATen/native/cpu/HistogramKernel.cpp",
Chen Lai98943bb2021-03-08 12:23:00 -08001108 "aten/src/ATen/native/cpu/IndexKernel.cpp",
1109 "aten/src/ATen/native/cpu/LerpKernel.cpp",
1110 "aten/src/ATen/native/cpu/LinearAlgebraKernel.cpp",
mingfeima1e03a252021-04-20 15:00:55 -07001111 "aten/src/ATen/native/cpu/MaxPoolKernel.cpp",
Allen Goodmanb3ca3632022-06-24 20:57:38 +00001112 "aten/src/ATen/native/cpu/MaxPooling.cpp",
mingfeimac5ed31e2021-08-29 18:35:37 -07001113 "aten/src/ATen/native/cpu/MaxUnpoolKernel.cpp",
Chen Lai98943bb2021-03-08 12:23:00 -08001114 "aten/src/ATen/native/cpu/MultinomialKernel.cpp",
mingfeimaa683bc52023-09-18 09:49:50 +08001115 "aten/src/ATen/native/cpu/NativeMultiheadAttnKernel.cpp",
mingfeima69b09ec2023-06-14 13:02:38 +08001116 "aten/src/ATen/native/cpu/PaddingKernel.cpp",
mingfeimac0034942022-05-13 08:46:37 +08001117 "aten/src/ATen/native/cpu/PixelShuffleKernel.cpp",
Chen Lai98943bb2021-03-08 12:23:00 -08001118 "aten/src/ATen/native/cpu/PointwiseOpsKernel.cpp",
1119 "aten/src/ATen/native/cpu/PowKernel.cpp",
1120 "aten/src/ATen/native/cpu/RangeFactoriesKernel.cpp",
1121 "aten/src/ATen/native/cpu/ReduceAllOpsKernel.cpp",
1122 "aten/src/ATen/native/cpu/ReduceOpsKernel.cpp",
Peter Bell6408cbd2021-06-03 11:42:14 -07001123 "aten/src/ATen/native/cpu/RenormKernel.cpp",
Chen Lai98943bb2021-03-08 12:23:00 -08001124 "aten/src/ATen/native/cpu/ScatterGatherKernel.cpp",
1125 "aten/src/ATen/native/cpu/SoftMaxKernel.cpp",
1126 "aten/src/ATen/native/cpu/SortingKernel.cpp",
1127 "aten/src/ATen/native/cpu/StackKernel.cpp",
1128 "aten/src/ATen/native/cpu/SumKernel.cpp",
1129 "aten/src/ATen/native/cpu/TensorCompareKernel.cpp",
1130 "aten/src/ATen/native/cpu/UnaryOpsKernel.cpp",
1131 "aten/src/ATen/native/cpu/Unfold2d.cpp",
1132 "aten/src/ATen/native/cpu/UnfoldBackwardKernel.cpp",
1133 "aten/src/ATen/native/cpu/UpSampleKernel.cpp",
1134 "aten/src/ATen/native/cpu/UpSampleMoreKernel.cpp",
Allen Goodmanb3ca3632022-06-24 20:57:38 +00001135 "aten/src/ATen/native/cpu/WeightNormKernel.cpp",
Allen Goodmanb3308e22022-06-23 19:33:40 +00001136 "aten/src/ATen/native/cpu/airy_ai.cpp",
Chen Lai98943bb2021-03-08 12:23:00 -08001137 "aten/src/ATen/native/cpu/batch_norm_kernel.cpp",
1138 "aten/src/ATen/native/cpu/group_norm_kernel.cpp",
1139 "aten/src/ATen/native/cpu/layer_norm_kernel.cpp",
Allen Goodman63ef2a02022-06-29 14:53:37 +00001140 "aten/src/ATen/native/cpu/scaled_modified_bessel_k0.cpp",
Allen Goodmanb3ca3632022-06-24 20:57:38 +00001141 "aten/src/ATen/native/cpu/scaled_modified_bessel_k1.cpp",
Allen Goodmanab8797d2022-06-27 20:14:46 +00001142 "aten/src/ATen/native/cpu/spherical_bessel_j0.cpp",
mingfeima3ab58fd2023-01-12 10:19:29 +08001143 "aten/src/ATen/native/cpu/SampledAddmmKernel.cpp",
mingfeimac620ece2023-02-10 11:12:35 +08001144 "aten/src/ATen/native/cpu/SpmmReduceKernel.cpp",
Andrew M. James5a4c9e82022-06-29 16:50:32 -05001145 "aten/src/ATen/native/cpu/SparseFactories.cpp",
Chen Lai98943bb2021-03-08 12:23:00 -08001146 "aten/src/ATen/native/quantized/cpu/kernels/QuantizedOpKernels.cpp",
1147]
1148
1149# This aten native source file list will not go through aten codegen process
1150aten_native_source_non_codegen_list = [
Kimish Pateldb42ec42021-05-18 14:16:10 -07001151 "aten/src/ATen/native/ao_sparse/library.cpp",
1152 "aten/src/ATen/native/ao_sparse/quantized/cpu/fbgemm_utils.cpp",
1153 "aten/src/ATen/native/ao_sparse/quantized/cpu/qlinear.cpp",
Salil Desaieaf817d2022-07-06 10:56:13 -07001154 "aten/src/ATen/native/ao_sparse/quantized/cpu/qlinear_deserialize.cpp",
Kimish Pateldb42ec42021-05-18 14:16:10 -07001155 "aten/src/ATen/native/ao_sparse/quantized/cpu/qlinear_dynamic.cpp",
1156 "aten/src/ATen/native/ao_sparse/quantized/cpu/qlinear_prepack.cpp",
Salil Desaieaf817d2022-07-06 10:56:13 -07001157 "aten/src/ATen/native/ao_sparse/quantized/cpu/qlinear_serialize.cpp",
Kimish Pateldb42ec42021-05-18 14:16:10 -07001158 "aten/src/ATen/native/ao_sparse/quantized/cpu/qlinear_unpack.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001159 "aten/src/ATen/native/quantized/cpu/fbgemm_utils.cpp",
Supriya Rao92d33912021-07-21 10:01:19 -07001160 "aten/src/ATen/native/quantized/cpu/fused_obs_fake_quant.cpp",
dzdang5874a312022-05-31 11:02:37 -07001161 "aten/src/ATen/native/quantized/cpu/IntReprQuant.cpp",
1162 "aten/src/ATen/native/quantized/cpu/MakePerTensorQuantizedTensor.cpp",
1163 "aten/src/ATen/native/quantized/cpu/AdaptiveAveragePooling.cpp",
1164 "aten/src/ATen/native/quantized/cpu/AveragePool2d.cpp",
1165 "aten/src/ATen/native/quantized/cpu/AveragePool3d.cpp",
1166 "aten/src/ATen/native/quantized/cpu/BinaryOps.cpp",
1167 "aten/src/ATen/native/quantized/cpu/Normalization.cpp",
1168 "aten/src/ATen/native/quantized/cpu/ChannelShuffle.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001169 "aten/src/ATen/native/quantized/cpu/qclamp.cpp",
dzdang5874a312022-05-31 11:02:37 -07001170 "aten/src/ATen/native/quantized/cpu/TensorShape.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001171 "aten/src/ATen/native/quantized/cpu/qconv.cpp",
1172 "aten/src/ATen/native/quantized/cpu/qconv_prepack.cpp",
David Dang3a261f82022-03-17 06:01:57 -07001173 "aten/src/ATen/native/quantized/cpu/qconv_unpack_impl.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001174 "aten/src/ATen/native/quantized/cpu/qelu.cpp",
1175 "aten/src/ATen/native/quantized/cpu/qembeddingbag.cpp",
1176 "aten/src/ATen/native/quantized/cpu/qembeddingbag_prepack.cpp",
1177 "aten/src/ATen/native/quantized/cpu/qembeddingbag_unpack.cpp",
Weiwen Xia32bf5e02022-01-06 18:59:49 -08001178 "aten/src/ATen/native/quantized/cpu/qgelu.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001179 "aten/src/ATen/native/quantized/cpu/qhardsigmoid.cpp",
1180 "aten/src/ATen/native/quantized/cpu/qhardswish.cpp",
1181 "aten/src/ATen/native/quantized/cpu/qlinear.cpp",
1182 "aten/src/ATen/native/quantized/cpu/qlinear_dynamic.cpp",
Charles David Hernandez09615cd2021-11-15 16:38:35 -08001183 "aten/src/ATen/native/quantized/cpu/qconv_dynamic.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001184 "aten/src/ATen/native/quantized/cpu/qlinear_prepack.cpp",
dzdang5874a312022-05-31 11:02:37 -07001185 "aten/src/ATen/native/quantized/cpu/LinearUnpackImpl.cpp",
Salil Desai26b8a002022-02-04 17:36:40 -08001186 "aten/src/ATen/native/quantized/cpu/qmatmul.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001187 "aten/src/ATen/native/quantized/cpu/qmul.cpp",
1188 "aten/src/ATen/native/quantized/cpu/qnormalization.cpp",
dzdang5874a312022-05-31 11:02:37 -07001189 "aten/src/ATen/native/quantized/cpu/Pooling.cpp",
1190 "aten/src/ATen/native/quantized/cpu/ReduceOps.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001191 "aten/src/ATen/native/quantized/cpu/qrelu.cpp",
1192 "aten/src/ATen/native/quantized/cpu/qsigmoid.cpp",
Salil Desaica0ef522022-04-11 22:39:50 +00001193 "aten/src/ATen/native/quantized/cpu/qsoftmax.cpp",
dzdang5874a312022-05-31 11:02:37 -07001194 "aten/src/ATen/native/quantized/cpu/Sorting.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001195 "aten/src/ATen/native/quantized/cpu/qtanh.cpp",
1196 "aten/src/ATen/native/quantized/cpu/qthreshold.cpp",
dzdang5874a312022-05-31 11:02:37 -07001197 "aten/src/ATen/native/quantized/cpu/UpSampleBilinear2d.cpp",
1198 "aten/src/ATen/native/quantized/cpu/UpSampleNearest2d.cpp",
1199 "aten/src/ATen/native/quantized/cpu/UpSampleNearest3d.cpp",
1200 "aten/src/ATen/native/quantized/cpu/TensorOperators.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001201 "aten/src/ATen/native/quantized/Copy.cpp",
1202 "aten/src/ATen/native/quantized/QTensor.cpp",
1203 "aten/src/ATen/native/quantized/TensorCompare.cpp",
1204 "aten/src/ATen/native/quantized/TensorFactories.cpp",
dzdanga56f4e22022-06-06 10:49:37 -04001205 "aten/src/ATen/native/quantized/AffineQuantizer.cpp",
1206 "aten/src/ATen/native/quantized/AffineQuantizerBase.cpp",
1207 "aten/src/ATen/native/quantized/FakeQuantPerChannelAffine.cpp",
1208 "aten/src/ATen/native/quantized/FakeQuantPerTensorAffine.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001209 "aten/src/ATen/native/quantized/library.cpp",
dzdang2b6a0422022-06-08 08:18:34 -07001210 "aten/src/ATen/native/quantized/TensorAdvancedIndexing.cpp",
dzdang5874a312022-05-31 11:02:37 -07001211 "aten/src/ATen/native/quantized/cpu/RuyUtils.cpp",
1212 "aten/src/ATen/native/quantized/cpu/XnnpackUtils.cpp",
Mengwei Liue13229e2022-03-22 15:14:33 -07001213 "aten/src/ATen/native/quantized/qlinear_unpack.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001214 "aten/src/ATen/quantized/QTensorImpl.cpp",
1215 "aten/src/ATen/quantized/Quantizer.cpp",
1216 "aten/src/ATen/native/Activation.cpp",
1217 "aten/src/ATen/native/AdaptiveAveragePooling.cpp",
1218 "aten/src/ATen/native/AdaptiveAveragePooling3d.cpp",
1219 "aten/src/ATen/native/AdaptiveMaxPooling2d.cpp",
1220 "aten/src/ATen/native/AdaptiveMaxPooling3d.cpp",
1221 "aten/src/ATen/native/AffineGridGenerator.cpp",
1222 "aten/src/ATen/native/AveragePool2d.cpp",
1223 "aten/src/ATen/native/AveragePool3d.cpp",
1224 "aten/src/ATen/native/BatchLinearAlgebra.cpp",
Nikita Shulgad0dcebe2022-05-06 18:48:42 -07001225 "aten/src/ATen/native/BatchLinearAlgebraKernel.cpp",
Richard Zou4b105342022-12-07 07:48:41 -08001226 "aten/src/ATen/native/LegacyBatching.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001227 "aten/src/ATen/native/BinaryOps.cpp",
1228 "aten/src/ATen/native/Blas.cpp",
1229 "aten/src/ATen/native/BlasKernel.cpp",
1230 "aten/src/ATen/native/Bucketization.cpp",
1231 "aten/src/ATen/native/CPUBlas.cpp",
1232 "aten/src/ATen/native/ChanelShuffle.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001233 "aten/src/ATen/native/Col2Im.cpp",
Peter Bellf86bb2d2022-03-19 12:13:43 +00001234 "aten/src/ATen/native/PadNd.cpp",
xuanqib27c3552023-06-15 16:27:30 -07001235 "aten/src/ATen/native/Constraints.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001236 "aten/src/ATen/native/Convolution.cpp",
1237 "aten/src/ATen/native/ConvolutionMM2d.cpp",
1238 "aten/src/ATen/native/ConvolutionMM3d.cpp",
1239 "aten/src/ATen/native/ConvolutionTBC.cpp",
1240 "aten/src/ATen/native/Copy.cpp",
Heitor Schueroffec9c03c2021-06-29 13:59:46 -07001241 "aten/src/ATen/native/Correlation.cpp",
Brian Hirsh9134b0e2021-06-25 16:25:31 -07001242 "aten/src/ATen/native/CPUFallback.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001243 "aten/src/ATen/native/Cross.cpp",
1244 "aten/src/ATen/native/DilatedMaxPool2d.cpp",
1245 "aten/src/ATen/native/DilatedMaxPool3d.cpp",
1246 # Referenced by both native and ATen/Version.cpp. Does not reference to other native symbols
1247 # "aten/src/ATen/native/DispatchStub.cpp",
1248 # "aten/src/ATen/native/quantized/cpu/init_qnnpack.cpp",
1249 "aten/src/ATen/native/Distance.cpp",
1250 "aten/src/ATen/native/Distributions.cpp",
1251 "aten/src/ATen/native/Dropout.cpp",
1252 "aten/src/ATen/native/Embedding.cpp",
1253 "aten/src/ATen/native/EmbeddingBag.cpp",
1254 "aten/src/ATen/native/Fill.cpp",
1255 "aten/src/ATen/native/ForeachOpsKernels.cpp",
1256 "aten/src/ATen/native/FractionalMaxPool2d.cpp",
1257 "aten/src/ATen/native/FractionalMaxPool3d.cpp",
1258 "aten/src/ATen/native/FunctionOfAMatrixUtils.cpp",
1259 "aten/src/ATen/native/GatedLinearUnit.cpp",
1260 "aten/src/ATen/native/GridSampler.cpp",
Saketh Are729f7cd2021-06-22 10:04:51 -07001261 "aten/src/ATen/native/Histogram.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001262 "aten/src/ATen/native/Im2Col.cpp",
1263 "aten/src/ATen/native/IndexingUtils.cpp",
1264 "aten/src/ATen/native/Integration.cpp",
1265 "aten/src/ATen/native/Itertools.cpp",
1266 "aten/src/ATen/native/LegacyBridge.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001267 "aten/src/ATen/native/Lerp.cpp",
1268 "aten/src/ATen/native/Linear.cpp",
1269 "aten/src/ATen/native/LinearAlgebra.cpp",
1270 "aten/src/ATen/native/Loss.cpp",
1271 "aten/src/ATen/native/LossCTC.cpp",
1272 "aten/src/ATen/native/LossMultiLabelMargin.cpp",
1273 "aten/src/ATen/native/LossMultiMargin.cpp",
1274 "aten/src/ATen/native/LossNLL.cpp",
1275 "aten/src/ATen/native/LossNLL2d.cpp",
1276 "aten/src/ATen/native/MaxPooling.cpp",
1277 "aten/src/ATen/native/MaxUnpooling.cpp",
1278 "aten/src/ATen/native/Memory.cpp",
1279 "aten/src/ATen/native/MetaTensor.cpp",
1280 "aten/src/ATen/native/NNPACK.cpp",
1281 "aten/src/ATen/native/NaiveConvolutionTranspose2d.cpp",
1282 "aten/src/ATen/native/NaiveConvolutionTranspose3d.cpp",
1283 "aten/src/ATen/native/NaiveDilatedConvolution.cpp",
1284 "aten/src/ATen/native/NamedTensor.cpp",
1285 "aten/src/ATen/native/Normalization.cpp",
1286 "aten/src/ATen/native/Onehot.cpp",
1287 "aten/src/ATen/native/PackedSequence.cpp",
1288 "aten/src/ATen/native/PixelShuffle.cpp",
1289 "aten/src/ATen/native/PointwiseOps.cpp",
1290 "aten/src/ATen/native/Pooling.cpp",
1291 "aten/src/ATen/native/Pow.cpp",
PyTorch MergeBot5ce80022023-10-25 16:34:16 +00001292 "aten/src/ATen/native/QuantizedLinear.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001293 "aten/src/ATen/native/RNN.cpp",
1294 "aten/src/ATen/native/RangeFactories.cpp",
1295 "aten/src/ATen/native/ReduceAllOps.cpp",
1296 "aten/src/ATen/native/ReduceOps.cpp",
1297 "aten/src/ATen/native/ReflectionPad.cpp",
1298 "aten/src/ATen/native/Repeat.cpp",
1299 "aten/src/ATen/native/ReplicationPadding.cpp",
1300 "aten/src/ATen/native/Resize.cpp",
1301 "aten/src/ATen/native/RowwisePrune.cpp",
Serhat Yilmaz7e3cf1e2021-03-23 15:56:00 -07001302 "aten/src/ATen/native/SegmentReduce.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001303 "aten/src/ATen/native/Scalar.cpp",
1304 "aten/src/ATen/native/SobolEngineOps.cpp",
1305 "aten/src/ATen/native/SobolEngineOpsUtils.cpp",
1306 "aten/src/ATen/native/SoftMax.cpp",
1307 "aten/src/ATen/native/Sorting.cpp",
Nikita Shulga82daf982023-03-14 02:56:52 +00001308 "aten/src/ATen/native/SparseTensorUtils.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001309 "aten/src/ATen/native/SpectralOps.cpp",
1310 "aten/src/ATen/native/SummaryOps.cpp",
1311 "aten/src/ATen/native/TensorAdvancedIndexing.cpp",
1312 "aten/src/ATen/native/TensorCompare.cpp",
1313 "aten/src/ATen/native/TensorConversions.cpp",
1314 "aten/src/ATen/native/TensorFactories.cpp",
1315 "aten/src/ATen/native/TensorIteratorReduce.cpp",
1316 "aten/src/ATen/native/TensorProperties.cpp",
1317 "aten/src/ATen/native/TensorShape.cpp",
1318 "aten/src/ATen/native/TensorTransformations.cpp",
1319 "aten/src/ATen/native/TestOps.cpp",
1320 "aten/src/ATen/native/TriangularOps.cpp",
1321 "aten/src/ATen/native/TypeProperties.cpp",
1322 "aten/src/ATen/native/UnaryOps.cpp",
1323 "aten/src/ATen/native/Unfold2d.cpp",
1324 "aten/src/ATen/native/Unfold3d.cpp",
1325 "aten/src/ATen/native/UnfoldBackward.cpp",
1326 "aten/src/ATen/native/Unique.cpp",
1327 # Low-level functions that can be directly referenced
1328 # "aten/src/ATen/native/UpSample.cpp",
1329 "aten/src/ATen/native/UpSampleBicubic2d.cpp",
1330 "aten/src/ATen/native/UpSampleBilinear2d.cpp",
1331 "aten/src/ATen/native/UpSampleLinear1d.cpp",
1332 "aten/src/ATen/native/UpSampleNearest1d.cpp",
1333 "aten/src/ATen/native/UpSampleNearest2d.cpp",
1334 "aten/src/ATen/native/UpSampleNearest3d.cpp",
1335 "aten/src/ATen/native/UpSampleTrilinear3d.cpp",
1336 "aten/src/ATen/native/VariableMethodStubs.cpp",
1337 "aten/src/ATen/native/WeightNorm.cpp",
1338 "aten/src/ATen/native/group_norm.cpp",
1339 "aten/src/ATen/native/layer_norm.cpp",
Max Ren0b3a2392022-07-21 02:45:20 +00001340 "aten/src/ATen/native/mkl/LinearAlgebra.cpp",
1341 "aten/src/ATen/native/mkl/SparseBlasImpl.cpp",
1342 "aten/src/ATen/native/mkl/SparseCsrLinearAlgebra.cpp",
1343 "aten/src/ATen/native/mkl/SpectralOps.cpp",
Christian Puhrsch6fe41e72022-10-31 20:10:05 +00001344 "aten/src/ATen/native/nested/NestedTensorAliases.cpp",
1345 "aten/src/ATen/native/nested/NestedTensorBackward.cpp",
1346 "aten/src/ATen/native/nested/NestedTensorBinaryOps.cpp",
Antoni Viros i Martind94e33f2022-10-20 03:46:48 +00001347 "aten/src/ATen/native/nested/NestedTensorFactories.cpp",
Christian Puhrsch484c0de2022-03-02 07:29:19 -08001348 "aten/src/ATen/native/nested/NestedTensorMath.cpp",
Christian Puhrsch6fe41e72022-10-31 20:10:05 +00001349 "aten/src/ATen/native/nested/NestedTensorMatmul.cpp",
Scott Wolchok97c993c2022-04-13 09:46:33 -07001350 "aten/src/ATen/native/nested/NestedTensorTransformerFunctions.cpp",
Christian Puhrsch6fe41e72022-10-31 20:10:05 +00001351 "aten/src/ATen/native/nested/NestedTensorUnaryOps.cpp",
Driss Guessousf803fa92022-09-02 16:31:55 +00001352 "aten/src/ATen/native/nested/NestedTensorUtils.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001353 "aten/src/ATen/native/sparse/ParamUtils.cpp",
1354 "aten/src/ATen/native/sparse/SoftMax.cpp",
Ivan Yashchukcbf596b2021-11-09 12:30:24 -08001355 "aten/src/ATen/native/sparse/SparseBlas.cpp",
1356 "aten/src/ATen/native/sparse/SparseBlasImpl.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001357 "aten/src/ATen/native/sparse/SparseMatMul.cpp",
1358 "aten/src/ATen/native/sparse/SparseTensor.cpp",
Sameer Deshmukh5fb11422021-04-12 10:07:56 -07001359 "aten/src/ATen/native/sparse/SparseCsrTensor.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001360 "aten/src/ATen/native/sparse/SparseTensorMath.cpp",
Peter Bell1da17072021-12-01 05:41:43 -08001361 "aten/src/ATen/native/sparse/SparseUnaryOps.cpp",
Sameer Deshmukh5fb11422021-04-12 10:07:56 -07001362 "aten/src/ATen/native/sparse/SparseCsrTensorMath.cpp",
Andrew M. James5a4c9e82022-06-29 16:50:32 -05001363 "aten/src/ATen/native/sparse/SparseFactories.cpp",
Nikita Vedeneev880b9722022-07-14 20:36:18 +00001364 "aten/src/ATen/native/sparse/ValidateCompressedIndicesKernel.cpp",
nikitaved12ae3be2022-09-23 23:31:17 +00001365 "aten/src/ATen/native/sparse/SparseBinaryOpIntersectionKernel.cpp",
Nikita Vedeneevd0f4d622023-03-09 11:13:43 +00001366 "aten/src/ATen/native/sparse/FlattenIndicesKernel.cpp",
Scott Wolchoke816e172022-04-25 17:02:39 -07001367 "aten/src/ATen/native/transformers/attention.cpp",
Liao, Xuan71632d42023-08-19 16:14:37 +00001368 "aten/src/ATen/native/transformers/sdp_utils_cpp.cpp",
Scott Wolchoke816e172022-04-25 17:02:39 -07001369 "aten/src/ATen/native/transformers/transformer.cpp",
Akshit Khurana28fc59d2021-04-28 14:52:37 -07001370 "aten/src/ATen/native/xnnpack/Activation.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001371 "aten/src/ATen/native/xnnpack/ChannelShuffle.cpp",
1372 "aten/src/ATen/native/xnnpack/Convolution.cpp",
Akshit Khurana34830492021-04-28 14:52:37 -07001373 "aten/src/ATen/native/xnnpack/AveragePooling.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001374 "aten/src/ATen/native/xnnpack/Init.cpp",
1375 "aten/src/ATen/native/xnnpack/Linear.cpp",
1376 "aten/src/ATen/native/xnnpack/MaxPooling.cpp",
1377 "aten/src/ATen/native/xnnpack/OpContext.cpp",
1378 "aten/src/ATen/native/xnnpack/RegisterOpContextClass.cpp",
1379 "aten/src/ATen/native/xnnpack/Shim.cpp",
1380 # Files not in native, but depends on native symbols
1381 # "aten/src/ATen/TensorIndexing.cpp",
1382 "aten/src/ATen/TensorIterator.cpp",
Chen Lai502a8592021-02-26 11:24:10 -08001383]
Chen Lai98943bb2021-03-08 12:23:00 -08001384
1385# 1. Files in ATen/native with a few exceptions
1386# TODO: move the exceptions to proper locations
1387# 2. The whole aten native source list includes the list with and without aten codegen process.
1388aten_native_source_list = sorted(aten_native_source_non_codegen_list + aten_native_source_codegen_list)
Peter Bellbb456d22022-01-31 18:40:49 -08001389
1390# These are cpp files which need to go in the torch_cuda_cu library
1391# .cu files can be found via glob
1392aten_cuda_cu_source_list = [
1393 "aten/src/ATen/cuda/CUDABlas.cpp",
Peter Bellbb456d22022-01-31 18:40:49 -08001394 "aten/src/ATen/cuda/CUDASparseBlas.cpp",
1395 "aten/src/ATen/cuda/CublasHandlePool.cpp",
Peter Bellbb456d22022-01-31 18:40:49 -08001396 "aten/src/ATen/native/cuda/Activation.cpp",
Nikita Shulga6302cdb2022-03-01 12:58:49 -08001397 "aten/src/ATen/native/cuda/LinearAlgebraStubs.cpp",
Peter Bellbb456d22022-01-31 18:40:49 -08001398 "aten/src/ATen/native/cuda/Blas.cpp",
Peter Bell1ac7bb02022-02-28 21:36:35 -08001399 "aten/src/ATen/native/cuda/Distributions.cpp",
Peter Bellbb456d22022-01-31 18:40:49 -08001400 "aten/src/ATen/native/cuda/Equal.cpp",
Peter Bell28388b42022-02-15 07:11:37 -08001401 "aten/src/ATen/native/cuda/GridSampler.cpp",
Peter Bellbb456d22022-01-31 18:40:49 -08001402 "aten/src/ATen/native/cuda/IndexKernel.cpp",
1403 "aten/src/ATen/native/cuda/ReduceOps.cpp",
1404 "aten/src/ATen/native/cuda/ScanKernels.cpp",
1405 "aten/src/ATen/native/cuda/Sort.cpp",
1406 "aten/src/ATen/native/cuda/Sorting.cpp",
1407 "aten/src/ATen/native/cuda/TensorModeKernel.cpp",
1408 "aten/src/ATen/native/cuda/TensorShapeCUDA.cpp",
1409 "aten/src/ATen/native/cuda/TensorTopK.cpp",
1410 "aten/src/ATen/native/cuda/jit_utils.cpp",
Scott Wolchok97c993c2022-04-13 09:46:33 -07001411 "aten/src/ATen/native/nested/cuda/NestedTensorTransformerFunctions.cpp",
Peter Bellbb456d22022-01-31 18:40:49 -08001412 "aten/src/ATen/native/sparse/cuda/SparseBlas.cpp",
1413 "aten/src/ATen/native/sparse/cuda/SparseBlasImpl.cpp",
1414 "aten/src/ATen/native/sparse/cuda/SparseBlasLegacy.cpp",
1415 "aten/src/ATen/native/sparse/cuda/SparseCUDABlas.cpp",
drisspgad90ab32023-09-13 13:59:05 +00001416 "aten/src/ATen/native/transformers/cuda/flash_attn/flash_api.cpp",
Peter Bellbb456d22022-01-31 18:40:49 -08001417]
1418
1419# Files using thrust::sort_by_key need to be linked last
1420aten_cuda_with_sort_by_key_source_list = [
1421 # empty_cuda is needed by torch_cuda_cpp
1422 "aten/src/ATen/native/cuda/TensorFactories.cu",
1423]
1424
1425aten_cuda_cu_with_sort_by_key_source_list = [
1426 "aten/src/ATen/native/cuda/Unique.cu",
1427]
Chen Laibca75fd2022-11-12 21:41:31 -08001428
1429# Followings are source code for xnnpack delegate
1430
1431xnnpack_delegate_serializer_header = [
1432 "torch/csrc/jit/backends/xnnpack/serialization/serializer.h",
1433]
1434
1435xnnpack_delegate_serializer_source_list = [
1436 "torch/csrc/jit/backends/xnnpack/serialization/serializer.cpp",
1437]
1438
1439xnnpack_delegate_core_source_list = [
1440 "torch/csrc/jit/backends/xnnpack/compiler/xnn_compiler.cpp",
1441]
1442
1443xnnpack_delegate_core_header = [
1444 "torch/csrc/jit/backends/xnnpack/compiler/xnn_compiler.h",
1445 "torch/csrc/jit/backends/xnnpack/executor/xnn_executor.h",
1446]
1447
1448xnnpack_backend_header = [
1449 "torch/csrc/jit/backends/xnnpack/xnnpack_graph_builder.h",
1450] + xnnpack_delegate_core_header
1451
1452xnnpack_backend_source_list = [
1453 "torch/csrc/jit/backends/xnnpack/compiler/xnn_compiler.cpp",
1454 "torch/csrc/jit/backends/xnnpack/xnnpack_backend_lib.cpp",
1455 "torch/csrc/jit/backends/xnnpack/xnnpack_backend_preprocess.cpp",
1456 "torch/csrc/jit/backends/xnnpack/xnnpack_graph_builder.cpp",
1457] + xnnpack_delegate_core_source_list