pytorch/tools
Stephen Jia cc51e100f5 [ET-VK] Enable Dynamic shape support via tensor virtual and physical resizing (#121598)
Summary:
## Context

This changeset lays the foundations for supporting dynamic shapes in the ExecuTorch Vulkan delegate via allowing Tensors to be resized in one of two ways:

1. Discarding underlying `vkImage` or `vkBuffer` and reallocating a new `vkImage` or `vkBuffer` with updated sizes. This method is intended to be used when the current `vkImage` or `vkBuffer` is not large enough to contain the new sizes.
2. Update the tensor's size metadata without reallocating any new resources. This allows shaders to interpret the underlying `vkImage` or `vkBuffer` as if it were smaller than it actually is, and allows command buffers to be preserved when sizes are changed.

Test Plan: Check CI. Tests have also been added to `vulkan_compute_api_test` that test the two methods of tensor resizing.

Differential Revision: D54728401

Pull Request resolved: https://github.com/pytorch/pytorch/pull/121598
Approved by: https://github.com/jorgep31415
2024-03-12 14:32:00 +00:00
..
alerts
amd_build [aot_inductor] move CppWrapperCodeGen into a separate file (#119871) 2024-02-16 08:14:20 +00:00
autograd Revert "Batch Norm Consolidation (#116092)" 2024-03-11 22:22:41 +00:00
bazel_tools
build/bazel Bump urllib3 from 2.0.6 to 2.0.7 in /tools/build/bazel (#111435) 2023-10-18 17:14:06 -07:00
build_defs Fix buck OSS build after #115570 (#115804) 2023-12-14 08:33:07 +00:00
code_analyzer [BE]: Enable RUFF PERF402 and apply fixes (#115505) 2023-12-20 18:01:24 +00:00
code_coverage
config
coverage_plugins_package
dynamo Replaced deprecated pkg_resources.packaging with packaging module (#113023) 2023-11-10 15:06:03 +00:00
gdb
github
iwyu [2/N] Cleanup header inclusions in torch_cpu by iwyu (#109964) 2023-11-19 20:56:32 +00:00
jit
linter Use dmypy instead of mypy in lintrunner (#118475) 2024-01-28 13:42:06 +00:00
lite_interpreter
lldb
onnx [torch/csrc/onnx] Use nested namespaces (3/N) (#113993) 2023-11-18 00:20:19 +00:00
pyi Fix torch.return_types init signature (#119284) 2024-02-23 21:52:34 +00:00
rules
rules_cc
setup_helpers [BE][Ez]: FURB129: remove unneeded readlines() (#119796) 2024-02-13 21:21:22 +00:00
shared
stats TD outside of test job (#118250) 2024-03-01 23:08:10 +00:00
test Fix round robin sharding (#121022) 2024-03-11 17:30:12 +00:00
testing Fix round robin sharding (#121022) 2024-03-11 17:30:12 +00:00
__init__.py
bazel.bzl
BUCK.bzl Reify view_func() closures as ViewFuncs (#118404) 2024-02-14 22:00:43 +00:00
BUCK.oss
build_libtorch.py
build_pytorch_libs.py
build_with_debinfo.py [EZ] Fix argument parsing in build_with_debinfo (#120088) 2024-02-16 20:06:52 +00:00
download_mnist.py
extract_scripts.py
gen_flatbuffers.sh
gen_vulkan_spv.py [ET-VK] Enable Dynamic shape support via tensor virtual and physical resizing (#121598) 2024-03-12 14:32:00 +00:00
generate_torch_version.py Enable import following in MYPYNOFOLLOW (now MYPYINDUCTOR) (#113830) 2023-11-17 18:24:21 +00:00
generated_dirs.txt
git_add_generated_dirs.sh
git_reset_generated_dirs.sh
nightly.py
nvcc_fix_deps.py [BE][Ez]: FURB129: remove unneeded readlines() (#119796) 2024-02-13 21:21:22 +00:00
pytorch.version
README.md
render_junit.py
substitute.py [Codemod][python/main_function] caffe2: (#113357) 2023-11-15 22:17:31 +00:00
update_masked_docs.py Use strict to toggle strict options in MYPYSTRICT (#118479) 2024-01-28 19:22:22 +00:00
vscode_settings.py

This folder contains a number of scripts which are used as part of the PyTorch build process. This directory also doubles as a Python module hierarchy (thus the __init__.py).

Overview

Modern infrastructure:

  • autograd - Code generation for autograd. This includes definitions of all our derivatives.
  • jit - Code generation for JIT
  • shared - Generic infrastructure that scripts in tools may find useful.
    • module_loader.py - Makes it easier to import arbitrary Python files in a script, without having to add them to the PYTHONPATH first.

Build system pieces:

  • setup_helpers - Helper code for searching for third-party dependencies on the user system.
  • build_pytorch_libs.py - cross-platform script that builds all of the constituent libraries of PyTorch, but not the PyTorch Python extension itself.
  • build_libtorch.py - Script for building libtorch, a standalone C++ library without Python support. This build script is tested in CI.

Developer tools which you might find useful:

Important if you want to run on AMD GPU:

  • amd_build - HIPify scripts, for transpiling CUDA into AMD HIP. Right now, PyTorch and Caffe2 share logic for how to do this transpilation, but have separate entry-points for transpiling either PyTorch or Caffe2 code.
    • build_amd.py - Top-level entry point for HIPifying our codebase.

Tools which are only situationally useful: