mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-26 16:44:54 +08:00
Compare commits
19 Commits
annotate_1
...
gh/eelliso
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a3621c97d | |||
| 2c78c6ec16 | |||
| 4544d7f26d | |||
| 4209813a03 | |||
| 4f3a6922db | |||
| ff2142aa1f | |||
| 236debc462 | |||
| ebaa24e6b9 | |||
| 4d758aad81 | |||
| 3666ad3356 | |||
| aa754f6ca9 | |||
| ec96e7e38c | |||
| a19f7e5441 | |||
| a87cdf060f | |||
| 39de0cfecf | |||
| ff9b14a06a | |||
| 199bd72200 | |||
| f7d99fc397 | |||
| d3f231b5df |
@ -241,7 +241,7 @@ def wait_for_connection(addr, port, timeout=15, attempt_cnt=5):
|
||||
try:
|
||||
with socket.create_connection((addr, port), timeout=timeout):
|
||||
return
|
||||
except (ConnectionRefusedError, TimeoutError): # noqa: PERF203
|
||||
except (ConnectionRefusedError, socket.timeout): # noqa: PERF203
|
||||
if i == attempt_cnt - 1:
|
||||
raise
|
||||
time.sleep(timeout)
|
||||
@ -1004,7 +1004,7 @@ if __name__ == "__main__":
|
||||
install_condaforge_python(host, args.python_version)
|
||||
sys.exit(0)
|
||||
|
||||
python_version = args.python_version if args.python_version is not None else "3.10"
|
||||
python_version = args.python_version if args.python_version is not None else "3.9"
|
||||
|
||||
if args.use_torch_from_pypi:
|
||||
configure_system(host, compiler=args.compiler, python_version=python_version)
|
||||
|
||||
@ -262,10 +262,13 @@ case "$tag" in
|
||||
TRITON_CPU=yes
|
||||
;;
|
||||
pytorch-linux-jammy-linter)
|
||||
PYTHON_VERSION=3.10
|
||||
# TODO: Use 3.9 here because of this issue https://github.com/python/mypy/issues/13627.
|
||||
# We will need to update mypy version eventually, but that's for another day. The task
|
||||
# would be to upgrade mypy to 1.0.0 with Python 3.11
|
||||
PYTHON_VERSION=3.9
|
||||
;;
|
||||
pytorch-linux-jammy-cuda12.8-cudnn9-py3.10-linter)
|
||||
PYTHON_VERSION=3.10
|
||||
pytorch-linux-jammy-cuda12.8-cudnn9-py3.9-linter)
|
||||
PYTHON_VERSION=3.9
|
||||
CUDA_VERSION=12.8.1
|
||||
;;
|
||||
pytorch-linux-jammy-aarch64-py3.10-gcc11)
|
||||
|
||||
@ -1 +1 @@
|
||||
bbb06c0334a6772b92d24bde54956e675c8c6604
|
||||
5ae38bdb0dc066c5823e34dc9797afb9de42c866
|
||||
|
||||
@ -112,6 +112,8 @@ ninja==1.11.1.3
|
||||
#Pinned versions: 1.11.1.3
|
||||
#test that import: run_test.py, test_cpp_extensions_aot.py,test_determination.py
|
||||
|
||||
numba==0.49.0 ; python_version < "3.9" and platform_machine != "s390x"
|
||||
numba==0.55.2 ; python_version == "3.9" and platform_machine != "s390x"
|
||||
numba==0.55.2 ; python_version == "3.10" and platform_machine != "s390x"
|
||||
numba==0.60.0 ; python_version == "3.12" and platform_machine != "s390x"
|
||||
#Description: Just-In-Time Compiler for Numerical Functions
|
||||
@ -132,7 +134,7 @@ numba==0.60.0 ; python_version == "3.12" and platform_machine != "s390x"
|
||||
#test_nn.py, test_namedtensor.py, test_linalg.py, test_jit_cuda_fuser.py,
|
||||
#test_jit.py, test_indexing.py, test_datapipe.py, test_dataloader.py,
|
||||
#test_binary_ufuncs.py
|
||||
numpy==1.22.4; python_version == "3.10"
|
||||
numpy==1.22.4; python_version == "3.9" or python_version == "3.10"
|
||||
numpy==1.26.2; python_version == "3.11" or python_version == "3.12"
|
||||
numpy==2.1.2; python_version >= "3.13"
|
||||
|
||||
@ -324,6 +326,8 @@ pywavelets==1.7.0 ; python_version >= "3.12"
|
||||
lxml==5.3.0
|
||||
#Description: This is a requirement of unittest-xml-reporting
|
||||
|
||||
# Python-3.9 binaries
|
||||
|
||||
PyGithub==2.3.0
|
||||
|
||||
sympy==1.13.3
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
sphinx==5.3.0
|
||||
#Description: This is used to generate PyTorch docs
|
||||
#Pinned versions: 5.3.0
|
||||
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git@d53b0ffb9b1cda68260693ea98f3483823c88d8e#egg=pytorch_sphinx_theme2
|
||||
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git@1657ad2fc1acdc98aa719eebecbb0128a7c13ce4#egg=pytorch_sphinx_theme2
|
||||
|
||||
# TODO: sphinxcontrib.katex 0.9.0 adds a local KaTeX server to speed up pre-rendering
|
||||
# but it doesn't seem to work and hangs around idly. The initial thought that it is probably
|
||||
|
||||
@ -72,7 +72,7 @@ def sample_vllm_test_library():
|
||||
]
|
||||
),
|
||||
"pytest -v -s entrypoints/llm/test_generate.py",
|
||||
"pytest -v -s entrypoints/offline_mode",
|
||||
"VLLM_USE_V1=0 pytest -v -s entrypoints/offline_mode",
|
||||
],
|
||||
},
|
||||
"vllm_regression_test": {
|
||||
|
||||
@ -35,11 +35,10 @@ fi
|
||||
|
||||
print_cmake_info
|
||||
if [[ ${BUILD_ENVIRONMENT} == *"distributed"* ]]; then
|
||||
# Needed for inductor benchmarks, as lots of HF networks make `torch.distribtued` calls
|
||||
USE_DISTRIBUTED=1 USE_OPENMP=1 WERROR=1 python setup.py bdist_wheel
|
||||
USE_OPENMP=1 WERROR=1 python setup.py bdist_wheel
|
||||
else
|
||||
# Explicitly set USE_DISTRIBUTED=0 to align with the default build config on mac. This also serves as the sole CI config that tests
|
||||
# that building with USE_DISTRIBUTED=0 works at all. See https://github.com/pytorch/pytorch/issues/86448
|
||||
# NB: we always build with distributed; USE_DISTRIBUTED turns off all
|
||||
# backends (specifically the gloo backend), so test that this case works too
|
||||
USE_DISTRIBUTED=0 USE_OPENMP=1 MACOSX_DEPLOYMENT_TARGET=11.0 WERROR=1 BUILD_TEST=OFF USE_PYTORCH_METAL=1 python setup.py bdist_wheel --plat-name macosx_11_0_arm64
|
||||
fi
|
||||
if which sccache > /dev/null; then
|
||||
|
||||
@ -13,9 +13,13 @@ if [[ ! $(python -c "import torch; print(int(torch.backends.openmp.is_available(
|
||||
fi
|
||||
popd
|
||||
|
||||
python -mpip install -r requirements.txt
|
||||
|
||||
# enable debug asserts in serialization
|
||||
export TORCH_SERIALIZATION_DEBUG=1
|
||||
|
||||
python -mpip install --no-input -r requirements.txt
|
||||
|
||||
setup_test_python() {
|
||||
# The CircleCI worker hostname doesn't resolve to an address.
|
||||
# This environment variable makes ProcessGroupGloo default to
|
||||
@ -55,7 +59,7 @@ test_python_shard() {
|
||||
|
||||
setup_test_python
|
||||
|
||||
time python test/run_test.py --verbose --exclude-jit-executor --exclude-distributed-tests --exclude-quantization-tests --shard "$1" "$NUM_TEST_SHARDS"
|
||||
time python test/run_test.py --verbose --exclude-jit-executor --exclude-distributed-tests --shard "$1" "$NUM_TEST_SHARDS"
|
||||
|
||||
assert_git_not_dirty
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ if [[ "${SHARD_NUMBER:-2}" == "2" ]]; then
|
||||
time python test/run_test.py --verbose -i distributed/test_c10d_spawn_gloo
|
||||
time python test/run_test.py --verbose -i distributed/test_c10d_spawn_nccl
|
||||
time python test/run_test.py --verbose -i distributed/test_compute_comm_reordering
|
||||
time python test/run_test.py --verbose -i distributed/test_aten_comm_compute_reordering
|
||||
time python test/run_test.py --verbose -i distributed/test_store
|
||||
time python test/run_test.py --verbose -i distributed/test_symmetric_memory
|
||||
time python test/run_test.py --verbose -i distributed/test_pg_wrapper
|
||||
|
||||
@ -322,29 +322,23 @@ test_python_shard() {
|
||||
|
||||
# modify LD_LIBRARY_PATH to ensure it has the conda env.
|
||||
# This set of tests has been shown to be buggy without it for the split-build
|
||||
time python test/run_test.py --exclude-jit-executor --exclude-distributed-tests --exclude-quantization-tests $INCLUDE_CLAUSE --shard "$1" "$NUM_TEST_SHARDS" --verbose $PYTHON_TEST_EXTRA_OPTION --upload-artifacts-while-running
|
||||
time python test/run_test.py --exclude-jit-executor --exclude-distributed-tests $INCLUDE_CLAUSE --shard "$1" "$NUM_TEST_SHARDS" --verbose $PYTHON_TEST_EXTRA_OPTION --upload-artifacts-while-running
|
||||
|
||||
assert_git_not_dirty
|
||||
}
|
||||
|
||||
test_python() {
|
||||
# shellcheck disable=SC2086
|
||||
time python test/run_test.py --exclude-jit-executor --exclude-distributed-tests --exclude-quantization-tests $INCLUDE_CLAUSE --verbose $PYTHON_TEST_EXTRA_OPTION
|
||||
time python test/run_test.py --exclude-jit-executor --exclude-distributed-tests $INCLUDE_CLAUSE --verbose $PYTHON_TEST_EXTRA_OPTION
|
||||
assert_git_not_dirty
|
||||
}
|
||||
|
||||
test_python_smoke() {
|
||||
# Smoke tests for H100/B200
|
||||
# Smoke tests for H100
|
||||
time python test/run_test.py --include test_matmul_cuda inductor/test_fp8 inductor/test_max_autotune $PYTHON_TEST_EXTRA_OPTION --upload-artifacts-while-running
|
||||
assert_git_not_dirty
|
||||
}
|
||||
|
||||
test_python_smoke_b200() {
|
||||
# Targeted smoke tests for B200 - staged approach to avoid too many failures
|
||||
time python test/run_test.py --include test_matmul_cuda inductor/test_fp8 $PYTHON_TEST_EXTRA_OPTION --upload-artifacts-while-running
|
||||
assert_git_not_dirty
|
||||
}
|
||||
|
||||
test_h100_distributed() {
|
||||
# Distributed tests at H100
|
||||
time python test/run_test.py --include distributed/_composable/test_composability/test_pp_composability.py $PYTHON_TEST_EXTRA_OPTION --upload-artifacts-while-running
|
||||
@ -390,7 +384,6 @@ test_dynamo_wrapped_shard() {
|
||||
--exclude-distributed-tests \
|
||||
--exclude-torch-export-tests \
|
||||
--exclude-aot-dispatch-tests \
|
||||
--exclude-quantization-tests \
|
||||
--shard "$1" "$NUM_TEST_SHARDS" \
|
||||
--verbose \
|
||||
--upload-artifacts-while-running
|
||||
@ -435,7 +428,7 @@ test_inductor_distributed() {
|
||||
|
||||
# this runs on both single-gpu and multi-gpu instance. It should be smart about skipping tests that aren't supported
|
||||
# with if required # gpus aren't available
|
||||
python test/run_test.py --include distributed/test_dynamo_distributed distributed/test_inductor_collectives distributed/test_compute_comm_reordering --verbose
|
||||
python test/run_test.py --include distributed/test_dynamo_distributed distributed/test_inductor_collectives distributed/test_aten_comm_compute_reordering distributed/test_compute_comm_reordering --verbose
|
||||
assert_git_not_dirty
|
||||
}
|
||||
|
||||
@ -1163,12 +1156,6 @@ test_distributed() {
|
||||
fi
|
||||
}
|
||||
|
||||
test_quantization() {
|
||||
echo "Testing quantization"
|
||||
|
||||
python test/test_quantization.py
|
||||
}
|
||||
|
||||
test_rpc() {
|
||||
echo "Testing RPC C++ tests"
|
||||
# NB: the ending test_rpc must match the current function name for the current
|
||||
@ -1586,7 +1573,7 @@ test_executorch() {
|
||||
test_linux_aarch64() {
|
||||
python test/run_test.py --include test_modules test_mkldnn test_mkldnn_fusion test_openmp test_torch test_dynamic_shapes \
|
||||
test_transformers test_multiprocessing test_numpy_interop test_autograd test_binary_ufuncs test_complex test_spectral_ops \
|
||||
test_foreach test_reductions test_unary_ufuncs test_tensor_creation_ops test_ops profiler/test_memory_profiler \
|
||||
test_foreach test_reductions test_unary_ufuncs test_tensor_creation_ops test_ops \
|
||||
distributed/elastic/timer/api_test distributed/elastic/timer/local_timer_example distributed/elastic/timer/local_timer_test \
|
||||
--shard "$SHARD_NUMBER" "$NUM_TEST_SHARDS" --verbose
|
||||
|
||||
@ -1662,8 +1649,6 @@ elif [[ "${TEST_CONFIG}" == *executorch* ]]; then
|
||||
test_executorch
|
||||
elif [[ "$TEST_CONFIG" == 'jit_legacy' ]]; then
|
||||
test_python_legacy_jit
|
||||
elif [[ "$TEST_CONFIG" == 'quantization' ]]; then
|
||||
test_quantization
|
||||
elif [[ "${BUILD_ENVIRONMENT}" == *libtorch* ]]; then
|
||||
# TODO: run some C++ tests
|
||||
echo "no-op at the moment"
|
||||
@ -1788,8 +1773,6 @@ elif [[ "${BUILD_ENVIRONMENT}" == *xpu* ]]; then
|
||||
test_xpu_bin
|
||||
elif [[ "${TEST_CONFIG}" == smoke ]]; then
|
||||
test_python_smoke
|
||||
elif [[ "${TEST_CONFIG}" == smoke_b200 ]]; then
|
||||
test_python_smoke_b200
|
||||
elif [[ "${TEST_CONFIG}" == h100_distributed ]]; then
|
||||
test_h100_distributed
|
||||
elif [[ "${TEST_CONFIG}" == "h100-symm-mem" ]]; then
|
||||
|
||||
@ -25,7 +25,7 @@ echo Copying over test times file
|
||||
robocopy /E "%PYTORCH_FINAL_PACKAGE_DIR_WIN%\.additional_ci_files" "%PROJECT_DIR_WIN%\.additional_ci_files"
|
||||
|
||||
echo Run nn tests
|
||||
python run_test.py --exclude-jit-executor --exclude-distributed-tests --exclude-quantization-tests --shard "%SHARD_NUMBER%" "%NUM_TEST_SHARDS%" --verbose
|
||||
python run_test.py --exclude-jit-executor --exclude-distributed-tests --shard "%SHARD_NUMBER%" "%NUM_TEST_SHARDS%" --verbose
|
||||
if ERRORLEVEL 1 goto fail
|
||||
|
||||
popd
|
||||
|
||||
@ -177,7 +177,8 @@ source ~/${desired_python}-build/bin/activate
|
||||
retry pip install "${PINNED_PACKAGES[@]}" -r "${pytorch_rootdir}/requirements.txt"
|
||||
retry brew install libomp
|
||||
|
||||
# For USE_DISTRIBUTED=1 on macOS, need libuv, which is build as part of tensorpipe submodule
|
||||
# For USE_DISTRIBUTED=1 on macOS, this enables gloo, which needs libuv, which
|
||||
# is build as part of tensorpipe submodule
|
||||
export USE_DISTRIBUTED=1
|
||||
|
||||
export USE_MKLDNN=OFF
|
||||
|
||||
2
.github/actions/setup-win/action.yml
vendored
2
.github/actions/setup-win/action.yml
vendored
@ -59,7 +59,7 @@ runs:
|
||||
set -x
|
||||
|
||||
# Create new py_tmp env with python-version
|
||||
${CONDA} create -y -n py_tmp python=${PYTHON_VERSION} intel-openmp libuv
|
||||
${CONDA} create -y -n py_tmp python=${PYTHON_VERSION} intel-openmp
|
||||
|
||||
PYTHON3=$(${CONDA_RUN} -n py_tmp which python3)
|
||||
EXIT_CODE=$?
|
||||
|
||||
2
.github/ci_commit_pins/vllm.txt
vendored
2
.github/ci_commit_pins/vllm.txt
vendored
@ -1 +1 @@
|
||||
1983609239caaab24ab1ed2bfa2aa92e8c76c1b1
|
||||
367a480bd3534edf27a8dac3c6f7ea8af9d1ed45
|
||||
|
||||
15
.github/merge_rules.yaml
vendored
15
.github/merge_rules.yaml
vendored
@ -525,21 +525,6 @@
|
||||
- Lint
|
||||
- pull
|
||||
|
||||
- name: typechecking
|
||||
patterns:
|
||||
- 'pyrefly.toml'
|
||||
- 'mypy.ini'
|
||||
- 'mypy-strict.ini'
|
||||
approved_by:
|
||||
- lolpack
|
||||
- maggiemoss
|
||||
- ndmitchell
|
||||
- kinto0
|
||||
mandatory_checks_name:
|
||||
- EasyCLA
|
||||
- Lint
|
||||
- pull
|
||||
|
||||
- name: superuser
|
||||
patterns:
|
||||
- '*'
|
||||
|
||||
2
.github/pytorch-probot.yml
vendored
2
.github/pytorch-probot.yml
vendored
@ -19,7 +19,6 @@ ciflow_push_tags:
|
||||
- ciflow/nightly
|
||||
- ciflow/periodic
|
||||
- ciflow/periodic-rocm-mi300
|
||||
- ciflow/quantization-periodic
|
||||
- ciflow/rocm
|
||||
- ciflow/rocm-mi300
|
||||
- ciflow/s390
|
||||
@ -37,7 +36,6 @@ ciflow_push_tags:
|
||||
- ciflow/win-arm64
|
||||
- ciflow/h100-symm-mem
|
||||
- ciflow/h100-cutlass-backend
|
||||
- ciflow/b200
|
||||
retryable_workflows:
|
||||
- pull
|
||||
- trunk
|
||||
|
||||
2
.github/scripts/generate_ci_workflows.py
vendored
2
.github/scripts/generate_ci_workflows.py
vendored
@ -155,7 +155,7 @@ LINUX_BINARY_SMOKE_WORKFLOWS = [
|
||||
package_type="manywheel",
|
||||
build_configs=generate_binary_build_matrix.generate_wheels_matrix(
|
||||
OperatingSystem.LINUX,
|
||||
arches=["13.0"],
|
||||
arches=["12.8"],
|
||||
python_versions=["3.12"],
|
||||
),
|
||||
branches="main",
|
||||
|
||||
@ -71,15 +71,12 @@ jobs:
|
||||
with:!{{ upload.binary_env_as_input(config) }}
|
||||
{%- if "aarch64" in build_environment %}
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
{%- elif "s390x" in build_environment %}
|
||||
runs_on: linux.s390x
|
||||
ALPINE_IMAGE: "docker.io/s390x/alpine"
|
||||
timeout-minutes: 420
|
||||
{%- elif config["gpu_arch_type"] == "rocm" %}
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
timeout-minutes: 300
|
||||
{%- elif "conda" in build_environment and config["gpu_arch_type"] == "cuda" %}
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.24xlarge.ephemeral
|
||||
|
||||
28
.github/workflows/_get-changed-files.yml
vendored
28
.github/workflows/_get-changed-files.yml
vendored
@ -2,12 +2,6 @@ name: Get Changed Files
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
all_files:
|
||||
description: "Whether to return all files instead of just changed files"
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
outputs:
|
||||
changed-files:
|
||||
description: "List of changed files (space-separated) or '*' if not in a PR"
|
||||
@ -32,23 +26,17 @@ jobs:
|
||||
# Get the PR number from the github context
|
||||
PR_NUMBER="${{ github.event.number }}"
|
||||
|
||||
# Check if all_files is requested
|
||||
if [ "${{ inputs.all_files }}" = "true" ]; then
|
||||
echo "all_files input is true, returning all files"
|
||||
echo "changed-files=*" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
# Use gh CLI to get changed files in the PR with explicit repo
|
||||
CHANGED_FILES=$(gh api repos/${{ github.repository }}/pulls/$PR_NUMBER/files --paginate --jq '.[] | select(.status != "removed") | .filename' | tr '\n' ' ' | sed 's/ $//')
|
||||
# Use gh CLI to get changed files in the PR with explicit repo
|
||||
CHANGED_FILES=$(gh api repos/${{ github.repository }}/pulls/$PR_NUMBER/files --paginate --jq '.[] | select(.status != "removed") | .filename' | tr '\n' ' ' | sed 's/ $//')
|
||||
|
||||
if [ -z "$CHANGED_FILES" ]; then
|
||||
echo "No changed files found, setting to '*'"
|
||||
CHANGED_FILES="*"
|
||||
fi
|
||||
|
||||
echo "Changed files: $CHANGED_FILES"
|
||||
echo "changed-files=$CHANGED_FILES" >> "$GITHUB_OUTPUT"
|
||||
if [ -z "$CHANGED_FILES" ]; then
|
||||
echo "No changed files found, setting to '*'"
|
||||
CHANGED_FILES="*"
|
||||
fi
|
||||
|
||||
echo "Changed files: $CHANGED_FILES"
|
||||
echo "changed-files=$CHANGED_FILES" >> "$GITHUB_OUTPUT"
|
||||
|
||||
else
|
||||
echo "Not in PR context, setting changed files to '*'"
|
||||
echo "changed-files=*" >> "$GITHUB_OUTPUT"
|
||||
|
||||
7
.github/workflows/build-triton-wheel.yml
vendored
7
.github/workflows/build-triton-wheel.yml
vendored
@ -50,7 +50,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
py_vers: [ "3.10", "3.11", "3.12", "3.13", "3.13t", "3.14", "3.14t" ]
|
||||
py_vers: [ "3.9", "3.10", "3.11", "3.12", "3.13", "3.13t", "3.14", "3.14t" ]
|
||||
device: ["cuda", "rocm", "xpu", "aarch64"]
|
||||
docker-image: ["pytorch/manylinux2_28-builder:cpu"]
|
||||
include:
|
||||
@ -108,6 +108,9 @@ jobs:
|
||||
|
||||
# Determine python executable for given version
|
||||
case $PY_VERS in
|
||||
3.9)
|
||||
PYTHON_EXECUTABLE=/opt/python/cp39-cp39/bin/python
|
||||
;;
|
||||
3.10)
|
||||
PYTHON_EXECUTABLE=/opt/python/cp310-cp310/bin/python
|
||||
;;
|
||||
@ -191,7 +194,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
py_vers: [ "3.10", "3.11", "3.12", "3.13", "3.13t", "3.14", "3.14t" ]
|
||||
py_vers: [ "3.9", "3.10", "3.11", "3.12", "3.13", "3.13t", "3.14", "3.14t" ]
|
||||
device: ["xpu"]
|
||||
timeout-minutes: 40
|
||||
env:
|
||||
|
||||
59
.github/workflows/create_release.yml
vendored
59
.github/workflows/create_release.yml
vendored
@ -35,7 +35,6 @@ jobs:
|
||||
contents: write
|
||||
outputs:
|
||||
pt_release_name: ${{ steps.release_name.outputs.pt_release_name }}
|
||||
pt_pep517_release_name: ${{ steps.release_name.outputs.pt_pep517_release_name }}
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
@ -54,12 +53,8 @@ jobs:
|
||||
tag_or_branch="${tag_or_branch#refs/heads/}"
|
||||
# replace directory separators with _ in branch name
|
||||
tag_or_branch="${tag_or_branch//\//_}"
|
||||
torch_version="$(python -c 'from tools.generate_torch_version import get_torch_version; print(get_torch_version())')"
|
||||
{
|
||||
echo "PT_RELEASE_NAME=pytorch-$tag_or_branch";
|
||||
echo "PT_RELEASE_FILE=pytorch-$tag_or_branch.tar.gz";
|
||||
echo "PT_PEP517_RELEASE_FILE=torch-${torch_version}.tar.gz";
|
||||
} >> "$GITHUB_ENV"
|
||||
echo "PT_RELEASE_NAME=pytorch-$tag_or_branch" >> "$GITHUB_ENV"
|
||||
echo "PT_RELEASE_FILE=pytorch-$tag_or_branch.tar.gz" >> "$GITHUB_ENV"
|
||||
- name: Checkout optional submodules
|
||||
run: python3 tools/optional_submodules.py
|
||||
- name: Copy docs requirements for inclusion
|
||||
@ -69,47 +64,30 @@ jobs:
|
||||
cp .ci/docker/requirements-docs.txt docs/requirements.txt
|
||||
- name: Create source distribution
|
||||
run: |
|
||||
# Create new folder with specified name so extracting the archive yields that
|
||||
rm -rf "/tmp/$PT_RELEASE_NAME"
|
||||
cp -r "$PWD" "/tmp/$PT_RELEASE_NAME"
|
||||
mv "/tmp/$PT_RELEASE_NAME" .
|
||||
# Cleanup
|
||||
rm -rf "$PT_RELEASE_NAME"/{.circleci,.ci}
|
||||
find "$PT_RELEASE_NAME" -name '.git*' -exec rm -rv {} \; || true
|
||||
# Create archive
|
||||
tar -czf "$PT_RELEASE_FILE" "$PT_RELEASE_NAME"
|
||||
echo "Created source archive $PT_RELEASE_FILE with content: $(ls -a "$PT_RELEASE_NAME")"
|
||||
- name: Create PEP 517 compatible source distribution
|
||||
run: |
|
||||
pip install build==1.2.2.post1 || exit 1
|
||||
python -m build --sdist || exit 1
|
||||
cd dist || exit 1
|
||||
# Create new folder with specified name so extracting the archive yields that
|
||||
rm -rf "/tmp/$PT_RELEASE_NAME"
|
||||
cp -r "$PWD" "/tmp/$PT_RELEASE_NAME"
|
||||
mv "/tmp/$PT_RELEASE_NAME" .
|
||||
# Cleanup
|
||||
rm -rf "$PT_RELEASE_NAME"/{.circleci,.ci}
|
||||
find "$PT_RELEASE_NAME" -name '.git*' -exec rm -rv {} \; || true
|
||||
# Create archive
|
||||
tar -czf "$PT_RELEASE_FILE" "$PT_RELEASE_NAME"
|
||||
echo "Created source archive $PT_RELEASE_FILE with content: $(ls -a "$PT_RELEASE_NAME")"
|
||||
- name: Upload source distribution for release
|
||||
if: ${{ github.event_name == 'release' }}
|
||||
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
|
||||
with:
|
||||
files: |
|
||||
${{ env.PT_RELEASE_FILE }}
|
||||
${{ env.PT_PEP517_RELEASE_FILE }}
|
||||
- name: Upload source distribution to GHA artifacts # for release tags
|
||||
files: ${{env.PT_RELEASE_FILE}}
|
||||
- name: Upload source distribution to GHA artifacts for release tags
|
||||
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'rc') }}
|
||||
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
|
||||
with:
|
||||
name: ${{ env.PT_RELEASE_FILE }}
|
||||
path: ${{ env.PT_RELEASE_FILE }}
|
||||
- name: Upload PEP 517 source distribution to GHA artifacts # for release tags
|
||||
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'rc') }}
|
||||
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
|
||||
with:
|
||||
name: ${{ env.PT_PEP517_RELEASE_FILE }}
|
||||
path: dist/${{ env.PT_PEP517_RELEASE_FILE }}
|
||||
- name: Set output
|
||||
id: release_name
|
||||
run: |
|
||||
{
|
||||
echo "pt_release_name=${{ env.PT_RELEASE_FILE }}";
|
||||
echo "pt_pep517_release_name=${{ env.PT_PEP517_RELEASE_FILE }}";
|
||||
} >> "${GITHUB_OUTPUT}"
|
||||
run: echo "pt_release_name=${{ env.PT_RELEASE_NAME }}.tar.gz" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
upload_source_code_to_s3:
|
||||
if: ${{ github.repository == 'pytorch/pytorch' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'rc') }}
|
||||
@ -125,9 +103,6 @@ jobs:
|
||||
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
|
||||
with:
|
||||
name: ${{ needs.release.outputs.pt_release_name }}
|
||||
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
|
||||
with:
|
||||
name: ${{ needs.release.outputs.pt_pep517_release_name }}
|
||||
- name: Configure AWS credentials(PyTorch account)
|
||||
uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 # v4.1.0
|
||||
with:
|
||||
@ -138,9 +113,7 @@ jobs:
|
||||
s3-bucket: pytorch
|
||||
s3-prefix: source_code/test
|
||||
if-no-files-found: warn
|
||||
path: |
|
||||
${{ needs.release.outputs.pt_release_name }}
|
||||
${{ needs.release.outputs.pt_pep517_release_name }}
|
||||
path: ${{ needs.release.outputs.pt_release_name }}
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name }}
|
||||
|
||||
2
.github/workflows/docker-builds.yml
vendored
2
.github/workflows/docker-builds.yml
vendored
@ -70,7 +70,7 @@ jobs:
|
||||
pytorch-linux-jammy-py3-clang18-asan,
|
||||
pytorch-linux-jammy-py3-clang12-onnx,
|
||||
pytorch-linux-jammy-linter,
|
||||
pytorch-linux-jammy-cuda12.8-cudnn9-py3.10-linter,
|
||||
pytorch-linux-jammy-cuda12.8-cudnn9-py3.9-linter,
|
||||
pytorch-linux-jammy-py3-clang12-executorch,
|
||||
pytorch-linux-jammy-py3.12-triton-cpu,
|
||||
pytorch-linux-noble-riscv64-py3.12-gcc14
|
||||
|
||||
56
.github/workflows/generated-linux-aarch64-binary-manywheel-nightly.yml
generated
vendored
56
.github/workflows/generated-linux-aarch64-binary-manywheel-nightly.yml
generated
vendored
@ -62,7 +62,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cpu-aarch64
|
||||
DESIRED_PYTHON: "3.10"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_10-cpu-aarch64
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -128,7 +128,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda12.6
|
||||
DESIRED_PYTHON: "3.10"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_10-cuda-aarch64-12_6
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -174,7 +174,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda12.8
|
||||
DESIRED_PYTHON: "3.10"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_10-cuda-aarch64-12_8
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -220,7 +220,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda13.0
|
||||
DESIRED_PYTHON: "3.10"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_10-cuda-aarch64-13_0
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -265,7 +265,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cpu-aarch64
|
||||
DESIRED_PYTHON: "3.11"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_11-cpu-aarch64
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -331,7 +331,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda12.6
|
||||
DESIRED_PYTHON: "3.11"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_11-cuda-aarch64-12_6
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -377,7 +377,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda12.8
|
||||
DESIRED_PYTHON: "3.11"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_11-cuda-aarch64-12_8
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -423,7 +423,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda13.0
|
||||
DESIRED_PYTHON: "3.11"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_11-cuda-aarch64-13_0
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -468,7 +468,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cpu-aarch64
|
||||
DESIRED_PYTHON: "3.12"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_12-cpu-aarch64
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -534,7 +534,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda12.6
|
||||
DESIRED_PYTHON: "3.12"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_12-cuda-aarch64-12_6
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -580,7 +580,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda12.8
|
||||
DESIRED_PYTHON: "3.12"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_12-cuda-aarch64-12_8
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -626,7 +626,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda13.0
|
||||
DESIRED_PYTHON: "3.12"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_12-cuda-aarch64-13_0
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -671,7 +671,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cpu-aarch64
|
||||
DESIRED_PYTHON: "3.13"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_13-cpu-aarch64
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -737,7 +737,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda12.6
|
||||
DESIRED_PYTHON: "3.13"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_13-cuda-aarch64-12_6
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -783,7 +783,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda12.8
|
||||
DESIRED_PYTHON: "3.13"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_13-cuda-aarch64-12_8
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -829,7 +829,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda13.0
|
||||
DESIRED_PYTHON: "3.13"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_13-cuda-aarch64-13_0
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -874,7 +874,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cpu-aarch64
|
||||
DESIRED_PYTHON: "3.13t"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_13t-cpu-aarch64
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -940,7 +940,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda12.6
|
||||
DESIRED_PYTHON: "3.13t"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_13t-cuda-aarch64-12_6
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -986,7 +986,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda12.8
|
||||
DESIRED_PYTHON: "3.13t"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_13t-cuda-aarch64-12_8
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -1032,7 +1032,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda13.0
|
||||
DESIRED_PYTHON: "3.13t"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_13t-cuda-aarch64-13_0
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -1077,7 +1077,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cpu-aarch64
|
||||
DESIRED_PYTHON: "3.14"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_14-cpu-aarch64
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -1143,7 +1143,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda12.6
|
||||
DESIRED_PYTHON: "3.14"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_14-cuda-aarch64-12_6
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -1189,7 +1189,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda12.8
|
||||
DESIRED_PYTHON: "3.14"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_14-cuda-aarch64-12_8
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -1235,7 +1235,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda13.0
|
||||
DESIRED_PYTHON: "3.14"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_14-cuda-aarch64-13_0
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -1280,7 +1280,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cpu-aarch64
|
||||
DESIRED_PYTHON: "3.14t"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_14t-cpu-aarch64
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -1346,7 +1346,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda12.6
|
||||
DESIRED_PYTHON: "3.14t"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_14t-cuda-aarch64-12_6
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -1392,7 +1392,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda12.8
|
||||
DESIRED_PYTHON: "3.14t"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_14t-cuda-aarch64-12_8
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
@ -1438,7 +1438,7 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda13.0
|
||||
DESIRED_PYTHON: "3.14t"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.arm64.r7g.12xlarge.memory
|
||||
runs_on: linux.arm64.m7g.4xlarge.ephemeral
|
||||
ALPINE_IMAGE: "arm64v8/alpine"
|
||||
build_name: manywheel-py3_14t-cuda-aarch64-13_0
|
||||
build_environment: linux-aarch64-binary-manywheel
|
||||
|
||||
2
.github/workflows/generated-linux-binary-libtorch-nightly.yml
generated
vendored
2
.github/workflows/generated-linux-binary-libtorch-nightly.yml
generated
vendored
@ -333,7 +333,6 @@ jobs:
|
||||
LIBTORCH_CONFIG: release
|
||||
LIBTORCH_VARIANT: shared-with-deps
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
timeout-minutes: 300
|
||||
build_name: libtorch-rocm6_3-shared-with-deps-release
|
||||
build_environment: linux-binary-libtorch
|
||||
secrets:
|
||||
@ -448,7 +447,6 @@ jobs:
|
||||
LIBTORCH_CONFIG: release
|
||||
LIBTORCH_VARIANT: shared-with-deps
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
timeout-minutes: 300
|
||||
build_name: libtorch-rocm6_4-shared-with-deps-release
|
||||
build_environment: linux-binary-libtorch
|
||||
secrets:
|
||||
|
||||
24
.github/workflows/generated-linux-binary-manywheel-main.yml
generated
vendored
24
.github/workflows/generated-linux-binary-manywheel-main.yml
generated
vendored
@ -42,7 +42,7 @@ jobs:
|
||||
issue_owner: ${{ github.event.pull_request.user.login || github.event.issue.user.login }}
|
||||
curr_branch: ${{ github.head_ref || github.ref_name }}
|
||||
curr_ref_type: ${{ github.ref_type }}
|
||||
manywheel-py3_12-cuda13_0-build:
|
||||
manywheel-py3_12-cuda12_8-build:
|
||||
if: ${{ github.repository_owner == 'pytorch' }}
|
||||
uses: ./.github/workflows/_binary-build-linux.yml
|
||||
needs: get-label-type
|
||||
@ -51,22 +51,22 @@ jobs:
|
||||
PACKAGE_TYPE: manywheel
|
||||
# TODO: This is a legacy variable that we eventually want to get rid of in
|
||||
# favor of GPU_ARCH_VERSION
|
||||
DESIRED_CUDA: cu130
|
||||
GPU_ARCH_VERSION: "13.0"
|
||||
DESIRED_CUDA: cu128
|
||||
GPU_ARCH_VERSION: "12.8"
|
||||
GPU_ARCH_TYPE: cuda
|
||||
DOCKER_IMAGE: manylinux2_28-builder
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda13.0
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda12.8
|
||||
DESIRED_PYTHON: "3.12"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
build_name: manywheel-py3_12-cuda13_0
|
||||
build_name: manywheel-py3_12-cuda12_8
|
||||
build_environment: linux-binary-manywheel
|
||||
PYTORCH_EXTRA_INSTALL_REQUIREMENTS: nvidia-cuda-nvrtc==13.0.48; platform_system == 'Linux' | nvidia-cuda-runtime==13.0.48; platform_system == 'Linux' | nvidia-cuda-cupti==13.0.48; platform_system == 'Linux' | nvidia-cudnn-cu13==9.13.0.50; platform_system == 'Linux' | nvidia-cublas==13.0.0.19; platform_system == 'Linux' | nvidia-cufft==12.0.0.15; platform_system == 'Linux' | nvidia-curand==10.4.0.35; platform_system == 'Linux' | nvidia-cusolver==12.0.3.29; platform_system == 'Linux' | nvidia-cusparse==12.6.2.49; platform_system == 'Linux' | nvidia-cusparselt-cu13==0.8.0; platform_system == 'Linux' | nvidia-nccl-cu13==2.27.7; platform_system == 'Linux' | nvidia-nvshmem-cu13==3.3.24; platform_system == 'Linux' | nvidia-nvtx==13.0.39; platform_system == 'Linux' | nvidia-nvjitlink==13.0.39; platform_system == 'Linux' | nvidia-cufile==1.15.0.42; platform_system == 'Linux'
|
||||
PYTORCH_EXTRA_INSTALL_REQUIREMENTS: nvidia-cuda-nvrtc-cu12==12.8.93; platform_system == 'Linux' | nvidia-cuda-runtime-cu12==12.8.90; platform_system == 'Linux' | nvidia-cuda-cupti-cu12==12.8.90; platform_system == 'Linux' | nvidia-cudnn-cu12==9.10.2.21; platform_system == 'Linux' | nvidia-cublas-cu12==12.8.4.1; platform_system == 'Linux' | nvidia-cufft-cu12==11.3.3.83; platform_system == 'Linux' | nvidia-curand-cu12==10.3.9.90; platform_system == 'Linux' | nvidia-cusolver-cu12==11.7.3.90; platform_system == 'Linux' | nvidia-cusparse-cu12==12.5.8.93; platform_system == 'Linux' | nvidia-cusparselt-cu12==0.7.1; platform_system == 'Linux' | nvidia-nccl-cu12==2.27.5; platform_system == 'Linux' | nvidia-nvshmem-cu12==3.3.24; platform_system == 'Linux' | nvidia-nvtx-cu12==12.8.90; platform_system == 'Linux' | nvidia-nvjitlink-cu12==12.8.93; platform_system == 'Linux' | nvidia-cufile-cu12==1.13.1.3; platform_system == 'Linux'
|
||||
secrets:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
manywheel-py3_12-cuda13_0-test: # Testing
|
||||
manywheel-py3_12-cuda12_8-test: # Testing
|
||||
if: ${{ github.repository_owner == 'pytorch' }}
|
||||
needs:
|
||||
- manywheel-py3_12-cuda13_0-build
|
||||
- manywheel-py3_12-cuda12_8-build
|
||||
- get-label-type
|
||||
uses: ./.github/workflows/_binary-test-linux.yml
|
||||
with:
|
||||
@ -74,13 +74,13 @@ jobs:
|
||||
PACKAGE_TYPE: manywheel
|
||||
# TODO: This is a legacy variable that we eventually want to get rid of in
|
||||
# favor of GPU_ARCH_VERSION
|
||||
DESIRED_CUDA: cu130
|
||||
GPU_ARCH_VERSION: "13.0"
|
||||
DESIRED_CUDA: cu128
|
||||
GPU_ARCH_VERSION: "12.8"
|
||||
GPU_ARCH_TYPE: cuda
|
||||
DOCKER_IMAGE: manylinux2_28-builder
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda13.0
|
||||
DOCKER_IMAGE_TAG_PREFIX: cuda12.8
|
||||
DESIRED_PYTHON: "3.12"
|
||||
build_name: manywheel-py3_12-cuda13_0
|
||||
build_name: manywheel-py3_12-cuda12_8
|
||||
build_environment: linux-binary-manywheel
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runs_on: linux.g4dn.4xlarge.nvidia.gpu # 12.8+ builds need sm_70+ runner
|
||||
|
||||
14
.github/workflows/generated-linux-binary-manywheel-nightly.yml
generated
vendored
14
.github/workflows/generated-linux-binary-manywheel-nightly.yml
generated
vendored
@ -323,7 +323,6 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: rocm6.3
|
||||
DESIRED_PYTHON: "3.10"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
timeout-minutes: 300
|
||||
build_name: manywheel-py3_10-rocm6_3
|
||||
build_environment: linux-binary-manywheel
|
||||
secrets:
|
||||
@ -435,7 +434,6 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: rocm6.4
|
||||
DESIRED_PYTHON: "3.10"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
timeout-minutes: 300
|
||||
build_name: manywheel-py3_10-rocm6_4
|
||||
build_environment: linux-binary-manywheel
|
||||
secrets:
|
||||
@ -917,7 +915,6 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: rocm6.3
|
||||
DESIRED_PYTHON: "3.11"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
timeout-minutes: 300
|
||||
build_name: manywheel-py3_11-rocm6_3
|
||||
build_environment: linux-binary-manywheel
|
||||
secrets:
|
||||
@ -1029,7 +1026,6 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: rocm6.4
|
||||
DESIRED_PYTHON: "3.11"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
timeout-minutes: 300
|
||||
build_name: manywheel-py3_11-rocm6_4
|
||||
build_environment: linux-binary-manywheel
|
||||
secrets:
|
||||
@ -1511,7 +1507,6 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: rocm6.3
|
||||
DESIRED_PYTHON: "3.12"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
timeout-minutes: 300
|
||||
build_name: manywheel-py3_12-rocm6_3
|
||||
build_environment: linux-binary-manywheel
|
||||
secrets:
|
||||
@ -1623,7 +1618,6 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: rocm6.4
|
||||
DESIRED_PYTHON: "3.12"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
timeout-minutes: 300
|
||||
build_name: manywheel-py3_12-rocm6_4
|
||||
build_environment: linux-binary-manywheel
|
||||
secrets:
|
||||
@ -2105,7 +2099,6 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: rocm6.3
|
||||
DESIRED_PYTHON: "3.13"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
timeout-minutes: 300
|
||||
build_name: manywheel-py3_13-rocm6_3
|
||||
build_environment: linux-binary-manywheel
|
||||
secrets:
|
||||
@ -2217,7 +2210,6 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: rocm6.4
|
||||
DESIRED_PYTHON: "3.13"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
timeout-minutes: 300
|
||||
build_name: manywheel-py3_13-rocm6_4
|
||||
build_environment: linux-binary-manywheel
|
||||
secrets:
|
||||
@ -2699,7 +2691,6 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: rocm6.3
|
||||
DESIRED_PYTHON: "3.13t"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
timeout-minutes: 300
|
||||
build_name: manywheel-py3_13t-rocm6_3
|
||||
build_environment: linux-binary-manywheel
|
||||
secrets:
|
||||
@ -2811,7 +2802,6 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: rocm6.4
|
||||
DESIRED_PYTHON: "3.13t"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
timeout-minutes: 300
|
||||
build_name: manywheel-py3_13t-rocm6_4
|
||||
build_environment: linux-binary-manywheel
|
||||
secrets:
|
||||
@ -3293,7 +3283,6 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: rocm6.3
|
||||
DESIRED_PYTHON: "3.14"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
timeout-minutes: 300
|
||||
build_name: manywheel-py3_14-rocm6_3
|
||||
build_environment: linux-binary-manywheel
|
||||
secrets:
|
||||
@ -3405,7 +3394,6 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: rocm6.4
|
||||
DESIRED_PYTHON: "3.14"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
timeout-minutes: 300
|
||||
build_name: manywheel-py3_14-rocm6_4
|
||||
build_environment: linux-binary-manywheel
|
||||
secrets:
|
||||
@ -3887,7 +3875,6 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: rocm6.3
|
||||
DESIRED_PYTHON: "3.14t"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
timeout-minutes: 300
|
||||
build_name: manywheel-py3_14t-rocm6_3
|
||||
build_environment: linux-binary-manywheel
|
||||
secrets:
|
||||
@ -3999,7 +3986,6 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: rocm6.4
|
||||
DESIRED_PYTHON: "3.14t"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
timeout-minutes: 300
|
||||
build_name: manywheel-py3_14t-rocm6_4
|
||||
build_environment: linux-binary-manywheel
|
||||
secrets:
|
||||
|
||||
1
.github/workflows/generated-linux-binary-manywheel-rocm-main.yml
generated
vendored
1
.github/workflows/generated-linux-binary-manywheel-rocm-main.yml
generated
vendored
@ -60,7 +60,6 @@ jobs:
|
||||
DOCKER_IMAGE_TAG_PREFIX: rocm6.4
|
||||
DESIRED_PYTHON: "3.10"
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
timeout-minutes: 300
|
||||
build_name: manywheel-py3_10-rocm6_4
|
||||
build_environment: linux-binary-manywheel-rocm
|
||||
secrets:
|
||||
|
||||
8
.github/workflows/lint.yml
vendored
8
.github/workflows/lint.yml
vendored
@ -31,8 +31,6 @@ jobs:
|
||||
if: github.repository_owner == 'pytorch'
|
||||
name: Get changed files
|
||||
uses: ./.github/workflows/_get-changed-files.yml
|
||||
with:
|
||||
all_files: ${{ contains(github.event.pull_request.labels.*.name, 'lint-all-files') || contains(github.event.pull_request.labels.*.name, 'Reverted') }}
|
||||
|
||||
lintrunner-clang:
|
||||
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
|
||||
@ -55,7 +53,7 @@ jobs:
|
||||
with:
|
||||
timeout: 120
|
||||
runner: "${{ needs.get-label-type.outputs.label-type }}linux.2xlarge"
|
||||
docker-image: ci-image:pytorch-linux-jammy-cuda12.8-cudnn9-py3.10-linter
|
||||
docker-image: ci-image:pytorch-linux-jammy-cuda12.8-cudnn9-py3.9-linter
|
||||
# NB: A shallow checkout won't work here because calculate-docker-image requires a full checkout
|
||||
# to run git rev-parse HEAD~:.ci/docker when a new image is needed
|
||||
fetch-depth: 0
|
||||
@ -266,10 +264,10 @@ jobs:
|
||||
with:
|
||||
submodules: false
|
||||
fetch-depth: 1
|
||||
- name: Setup Python 3.10
|
||||
- name: Setup Python 3.9
|
||||
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.9'
|
||||
architecture: x64
|
||||
cache: pip
|
||||
- name: Install dependencies
|
||||
|
||||
54
.github/workflows/quantization-periodic.yml
vendored
54
.github/workflows/quantization-periodic.yml
vendored
@ -1,54 +0,0 @@
|
||||
name: quantization-periodic
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- ciflow/quantization-periodic/*
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
# run weekly
|
||||
- cron: "45 0 * * 0"
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
get-default-label-prefix:
|
||||
name: get-default-label-prefix
|
||||
uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@main
|
||||
if: ${{ (github.event_name != 'schedule' || github.repository == 'pytorch/pytorch') && github.repository_owner == 'pytorch' }}
|
||||
with:
|
||||
triggering_actor: ${{ github.triggering_actor }}
|
||||
issue_owner: ${{ github.event.pull_request.user.login || github.event.issue.user.login }}
|
||||
curr_branch: ${{ github.head_ref || github.ref_name }}
|
||||
curr_ref_type: ${{ github.ref_type }}
|
||||
opt_out_experiments: lf
|
||||
|
||||
periodic-quantization-build:
|
||||
name: periodic-quantization-build
|
||||
uses: ./.github/workflows/_linux-build.yml
|
||||
needs: get-default-label-prefix
|
||||
with:
|
||||
runner_prefix: "${{ needs.get-default-label-prefix.outputs.label-type }}"
|
||||
build-environment: linux-jammy-cuda12.8-cudnn9-py3-gcc11
|
||||
docker-image-name: ci-image:pytorch-linux-jammy-cuda12.8-cudnn9-py3-gcc11
|
||||
cuda-arch-list: '8.9'
|
||||
test-matrix: |
|
||||
{ include: [
|
||||
{ config: "quantization", shard: 1, num_shards: 1, runner: "${{ needs.get-default-label-prefix.outputs.label-type }}linux.g6.4xlarge.experimental.nvidia.gpu" },
|
||||
]}
|
||||
secrets: inherit
|
||||
periodic-test-quantization:
|
||||
name: periodic-test-quantization
|
||||
uses: ./.github/workflows/_linux-test.yml
|
||||
needs: periodic-quantization-build
|
||||
with:
|
||||
build-environment: linux-jammy-cuda12.8-cudnn9-py3-gcc11
|
||||
docker-image: ${{ needs.periodic-quantization-build.outputs.docker-image }}
|
||||
test-matrix: ${{ needs.periodic-quantization-build.outputs.test-matrix }}
|
||||
secrets: inherit
|
||||
76
.github/workflows/test-b200.yml
vendored
76
.github/workflows/test-b200.yml
vendored
@ -1,76 +0,0 @@
|
||||
# B200 Smoke Tests CI Workflow
|
||||
#
|
||||
# This workflow runs smoke tests on B200 hardware
|
||||
#
|
||||
# Flow:
|
||||
# 1. Builds PyTorch with CUDA 12.8+ and sm100 architecture for B200
|
||||
# 2. Runs smoke tests on linux.dgx.b200 runner
|
||||
# 3. Tests executed are defined in .ci/pytorch/test.sh -> test_python_smoke() function
|
||||
#
|
||||
# Triggered by:
|
||||
# - Pull requests modifying this workflow file
|
||||
# - Manual dispatch
|
||||
# - Schedule (every 6 hours)
|
||||
# - Adding ciflow/b200 label to a PR (creates ciflow/b200/* tag)
|
||||
|
||||
name: B200 Smoke Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- .github/workflows/test-b200.yml
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: 0 4,10,16,22 * * * # every 6 hours
|
||||
push:
|
||||
tags:
|
||||
- ciflow/b200/*
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
|
||||
get-label-type:
|
||||
if: github.repository_owner == 'pytorch'
|
||||
name: get-label-type
|
||||
uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@main
|
||||
with:
|
||||
triggering_actor: ${{ github.triggering_actor }}
|
||||
issue_owner: ${{ github.event.pull_request.user.login || github.event.issue.user.login }}
|
||||
curr_branch: ${{ github.head_ref || github.ref_name }}
|
||||
curr_ref_type: ${{ github.ref_type }}
|
||||
|
||||
linux-jammy-cuda12_8-py3_10-gcc11-sm100-build:
|
||||
name: linux-jammy-cuda12.8-py3.10-gcc11-sm100
|
||||
uses: ./.github/workflows/_linux-build.yml
|
||||
needs: get-label-type
|
||||
with:
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
runner: linux.12xlarge.memory
|
||||
build-environment: linux-jammy-cuda12.8-py3.10-gcc11-sm100
|
||||
docker-image-name: ci-image:pytorch-linux-jammy-cuda12.8-cudnn9-py3-gcc11
|
||||
cuda-arch-list: '10.0'
|
||||
test-matrix: |
|
||||
{ include: [
|
||||
{ config: "smoke_b200", shard: 1, num_shards: 1, runner: "linux.dgx.b200" },
|
||||
]}
|
||||
# config: "smoke_b200" maps to test_python_smoke_b200() in .ci/pytorch/test.sh
|
||||
secrets: inherit
|
||||
|
||||
linux-jammy-cuda12_8-py3_10-gcc11-sm100-test:
|
||||
name: linux-jammy-cuda12.8-py3.10-gcc11-sm100
|
||||
uses: ./.github/workflows/_linux-test.yml
|
||||
needs:
|
||||
- linux-jammy-cuda12_8-py3_10-gcc11-sm100-build
|
||||
with:
|
||||
build-environment: linux-jammy-cuda12.8-py3.10-gcc11-sm100
|
||||
docker-image: ${{ needs.linux-jammy-cuda12_8-py3_10-gcc11-sm100-build.outputs.docker-image }}
|
||||
test-matrix: ${{ needs.linux-jammy-cuda12_8-py3_10-gcc11-sm100-build.outputs.test-matrix }}
|
||||
aws-role-to-assume: arn:aws:iam::308535385114:role/gha_workflow_s3_and_ecr_read_only
|
||||
secrets: inherit
|
||||
24
.github/workflows/unstable.yml
vendored
24
.github/workflows/unstable.yml
vendored
@ -53,3 +53,27 @@ jobs:
|
||||
issue_owner: ${{ github.event.pull_request.user.login || github.event.issue.user.login }}
|
||||
curr_branch: ${{ github.head_ref || github.ref_name }}
|
||||
curr_ref_type: ${{ github.ref_type }}
|
||||
|
||||
linux-jammy-py3_9-clang9-xla-build:
|
||||
name: linux-jammy-py3_9-clang9-xla
|
||||
uses: ./.github/workflows/_linux-build.yml
|
||||
needs: get-label-type
|
||||
with:
|
||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||
build-environment: linux-jammy-py3.9-clang9-xla
|
||||
docker-image-name: 308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/xla_base:v1.3-lite
|
||||
test-matrix: |
|
||||
{ include: [
|
||||
{ config: "xla", shard: 1, num_shards: 1, runner: "${{ needs.get-label-type.outputs.label-type }}linux.12xlarge" },
|
||||
]}
|
||||
secrets: inherit
|
||||
|
||||
linux-jammy-py3_9-clang9-xla-test:
|
||||
name: linux-jammy-py3_9-clang9-xla
|
||||
uses: ./.github/workflows/_linux-test.yml
|
||||
needs: linux-jammy-py3_9-clang9-xla-build
|
||||
with:
|
||||
build-environment: linux-jammy-py3.9-clang9-xla
|
||||
docker-image: ${{ needs.linux-jammy-py3_9-clang9-xla-build.outputs.docker-image }}
|
||||
test-matrix: ${{ needs.linux-jammy-py3_9-clang9-xla-build.outputs.test-matrix }}
|
||||
secrets: inherit
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -82,7 +82,6 @@ torch/return_types.pyi
|
||||
torch/nn/functional.pyi
|
||||
torch/utils/data/datapipes/datapipe.pyi
|
||||
torch/csrc/autograd/generated/*
|
||||
torch/csrc/functionalization/generated/*
|
||||
torch/csrc/lazy/generated/*.[!m]*
|
||||
torch_compile_debug/
|
||||
# Listed manually because some files in this directory are not generated
|
||||
|
||||
@ -49,7 +49,7 @@ init_command = [
|
||||
'mccabe==0.7.0',
|
||||
'pycodestyle==2.14.0',
|
||||
'pyflakes==3.4.0',
|
||||
'torchfix==0.4.0 ; python_version >= "3.10" and python_version < "3.13"',
|
||||
'torchfix==0.4.0 ; python_version >= "3.9" and python_version < "3.13"',
|
||||
]
|
||||
|
||||
|
||||
@ -153,7 +153,7 @@ init_command = [
|
||||
'python3',
|
||||
'tools/linter/adapters/pip_init.py',
|
||||
'--dry-run={{DRYRUN}}',
|
||||
'numpy==1.26.4 ; python_version >= "3.10" and python_version <= "3.11"',
|
||||
'numpy==1.26.4 ; python_version >= "3.9" and python_version <= "3.11"',
|
||||
'numpy==2.1.0 ; python_version >= "3.12"',
|
||||
'expecttest==0.3.0',
|
||||
'mypy==1.16.0',
|
||||
@ -196,7 +196,6 @@ exclude_patterns = [
|
||||
'tools/test/gen_operators_yaml_test.py',
|
||||
'tools/test/gen_oplist_test.py',
|
||||
'tools/test/test_selective_build.py',
|
||||
'tools/experimental/dynamic_shapes/torchfuzz/**',
|
||||
]
|
||||
command = [
|
||||
'python3',
|
||||
|
||||
@ -22,7 +22,6 @@ COMMON_COPTS = [
|
||||
"-DHAVE_SHM_UNLINK=1",
|
||||
"-D_FILE_OFFSET_BITS=64",
|
||||
"-DUSE_FBGEMM",
|
||||
"-DUSE_DISTRIBUTED",
|
||||
"-DAT_PER_OPERATOR_HEADERS",
|
||||
"-DATEN_THREADING=NATIVE",
|
||||
"-DNO_CUDNN_DESTROY_HANDLE",
|
||||
@ -91,8 +90,6 @@ generated_cpu_cpp = [
|
||||
"aten/src/ATen/NativeMetaFunctions.h",
|
||||
"aten/src/ATen/RegistrationDeclarations.h",
|
||||
"aten/src/ATen/VmapGeneratedPlumbing.h",
|
||||
"aten/src/ATen/ViewMetaClasses.h",
|
||||
"aten/src/ATen/ViewMetaClasses.cpp",
|
||||
"aten/src/ATen/core/aten_interned_strings.h",
|
||||
"aten/src/ATen/core/enum_tag.h",
|
||||
"aten/src/ATen/core/TensorBody.h",
|
||||
@ -813,7 +810,7 @@ cc_library(
|
||||
name = "torch_python",
|
||||
srcs = libtorch_python_core_sources
|
||||
+ if_cuda(libtorch_python_cuda_sources)
|
||||
+ if_cuda(libtorch_python_distributed_sources)
|
||||
+ libtorch_python_distributed_sources
|
||||
+ GENERATED_AUTOGRAD_PYTHON,
|
||||
hdrs = glob([
|
||||
"torch/csrc/generic/*.cpp",
|
||||
@ -1077,7 +1074,6 @@ test_suite(
|
||||
"aten/src/ATen/templates/LazyNonNativeIr.h",
|
||||
"aten/src/ATen/templates/RegisterDispatchKey.cpp",
|
||||
"aten/src/ATen/templates/RegisterDispatchDefinitions.ini",
|
||||
"aten/src/ATen/templates/ViewMetaClassesPythonBinding.cpp",
|
||||
"aten/src/ATen/native/native_functions.yaml",
|
||||
"aten/src/ATen/native/tags.yaml",
|
||||
"aten/src/ATen/native/ts_native_functions.yaml",
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.27 FATAL_ERROR)
|
||||
# cmake_policy(SET CMP0022 NEW) cmake_policy(SET CMP0023 NEW)
|
||||
|
||||
# Use compiler ID "AppleClang" instead of "Clang" for XCode. Not setting this
|
||||
# sometimes makes XCode C compiler gets detected as "Clang", even when the C++
|
||||
@ -180,8 +181,9 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(ppc64le)")
|
||||
set(CPU_POWER ON)
|
||||
endif()
|
||||
|
||||
# For non-supported platforms, turn USE_DISTRIBUTED off by default. It is not
|
||||
# tested and likely won't work without additional changes.
|
||||
# For non-supported platforms, turn USE_DISTRIBUTED off by default.
|
||||
# NB: USE_DISTRIBUTED simply disables the backend; distributed code
|
||||
# still gets built
|
||||
if(NOT LINUX AND NOT WIN32)
|
||||
set(USE_DISTRIBUTED
|
||||
OFF
|
||||
@ -261,11 +263,11 @@ option(USE_PYTORCH_METAL "Use Metal for PyTorch iOS build" OFF)
|
||||
option(USE_PYTORCH_METAL_EXPORT "Export Metal models on MacOSX desktop" OFF)
|
||||
option(USE_NATIVE_ARCH "Use -march=native" OFF)
|
||||
cmake_dependent_option(USE_MPS "Use MPS for macOS build" ON "MPS_FOUND" OFF)
|
||||
option(USE_DISTRIBUTED "Use distributed" ON)
|
||||
option(USE_DISTRIBUTED "Enable default distributed backends" ON)
|
||||
cmake_dependent_option(USE_NCCL "Use NCCL" ON
|
||||
"USE_DISTRIBUTED;USE_CUDA OR USE_ROCM;UNIX;NOT APPLE" OFF)
|
||||
cmake_dependent_option(USE_XCCL "Use XCCL" ON
|
||||
"USE_XPU;UNIX;NOT APPLE" OFF)
|
||||
"USE_DISTRIBUTED;USE_XPU;UNIX;NOT APPLE" OFF)
|
||||
cmake_dependent_option(USE_RCCL "Use RCCL" ON USE_NCCL OFF)
|
||||
cmake_dependent_option(USE_RCCL "Use RCCL" ON "USE_NCCL;NOT WIN32" OFF)
|
||||
cmake_dependent_option(USE_STATIC_NCCL "Use static NCCL" OFF "USE_NCCL" OFF)
|
||||
@ -437,11 +439,10 @@ if(WIN32)
|
||||
PATH_SUFFIXES lib
|
||||
NO_DEFAULT_PATH)
|
||||
if(NOT libuv_tmp_LIBRARY)
|
||||
set(USE_DISTRIBUTED OFF)
|
||||
set(USE_GLOO OFF)
|
||||
message(
|
||||
WARNING
|
||||
"Libuv is not installed in current conda env. Set USE_DISTRIBUTED to OFF. "
|
||||
"Libuv is not installed in current conda env. Set USE_GLOO to OFF. "
|
||||
"Please run command 'conda install -c conda-forge libuv=1.39' to install libuv."
|
||||
)
|
||||
else()
|
||||
@ -1481,4 +1482,4 @@ else()
|
||||
To do so please export USE_PRIORITIZED_TEXT_FOR_LD=1
|
||||
]])
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
105
MANIFEST.in
105
MANIFEST.in
@ -1,61 +1,20 @@
|
||||
# Reference: https://setuptools.pypa.io/en/latest/userguide/miscellaneous.html
|
||||
|
||||
# Include individual top-level files
|
||||
include CITATION.cff
|
||||
include CODEOWNERS
|
||||
include Dockerfile
|
||||
include LICENSE
|
||||
include MANIFEST.in
|
||||
include Makefile
|
||||
include NOTICE
|
||||
include .bc-linter.yml
|
||||
include .clang-format .clang-tidy
|
||||
include .cmakelintrc
|
||||
include .coveragerc
|
||||
include .dockerignore
|
||||
include .editorconfig
|
||||
include .flake8
|
||||
include .gdbinit
|
||||
include .lintrunner.toml
|
||||
include .lldbinit
|
||||
include codex_setup.sh
|
||||
include docker.Makefile
|
||||
include pyrefly.toml
|
||||
include ubsan.supp
|
||||
|
||||
# Include bazel and BUCK related files
|
||||
include BUILD.bazel BUCK.oss
|
||||
include WORKSPACE
|
||||
include *.bzl
|
||||
include .bazelignore .bazelrc .bazelversion
|
||||
|
||||
# Include general configuration files
|
||||
include *.ini
|
||||
# Include important top-level information
|
||||
include *.md
|
||||
# Include technical text files at the moment, comprises
|
||||
# version.txt, CMakeLists.txt, requirements.txt
|
||||
include *.txt
|
||||
|
||||
# Include ctags configuration
|
||||
include .ctags.d/*.ctags
|
||||
|
||||
# Include subfolders completely
|
||||
graft .devcontainer
|
||||
graft .vscode
|
||||
# Include source files in SDist
|
||||
include CMakeLists.txt
|
||||
include *.bzl *.bazel .bazel* BUILD *.BUILD BUILD.* WORKSPACE
|
||||
include BUCK BUCK.*
|
||||
include requirements*.txt
|
||||
include version.txt
|
||||
include [Mm]akefile *.[Mm]akefile [Mm]akefile.*
|
||||
include [Dd]ockerfile *.[Dd]ockerfile [Dd]ockerfile.* .dockerignore
|
||||
graft android
|
||||
graft aten
|
||||
graft benchmarks
|
||||
graft binaries
|
||||
graft c10
|
||||
graft caffe2
|
||||
graft cmake
|
||||
graft docs
|
||||
graft functorch
|
||||
graft ios
|
||||
graft mypy_plugins
|
||||
graft scripts
|
||||
graft test
|
||||
graft third_party
|
||||
graft tools
|
||||
graft torch
|
||||
@ -63,37 +22,29 @@ graft torchgen
|
||||
# FIXME: torch-xla build during codegen will fail if include this file in wheel
|
||||
exclude torchgen/BUILD.bazel
|
||||
|
||||
# The following exclusions omit parts from third-party dependencies that
|
||||
# contain invalid symlinks[1] and that are not needed for pytorch, such as
|
||||
# bindings for unused languages
|
||||
prune third_party/flatbuffers/java
|
||||
prune third_party/flatbuffers/kotlin
|
||||
prune third_party/ittapi/rust
|
||||
prune third_party/nccl/pkg/debian
|
||||
prune third_party/opentelemetry-cpp/third_party/prometheus-cpp/cmake/project-import-*
|
||||
|
||||
# The following document is also an invalid symlink[1] and superfluous
|
||||
exclude third_party/flatbuffers/docs/source/CONTRIBUTING.md
|
||||
|
||||
# Omit autogenerated code
|
||||
prune torchgen/packaged
|
||||
|
||||
# Omit caches, compiled, and scm related content
|
||||
prune */__pycache__
|
||||
prune **/.github
|
||||
prune **/.gitlab
|
||||
global-exclude *.o *.obj *.so *.dylib *.a *.pxd *.dll *.lib
|
||||
global-exclude *.py[cod] *.swp *~
|
||||
global-exclude .git .git-blame-ignore-revs .gitattributes .gitignore .gitmodules
|
||||
global-exclude .gitlab-ci.yml
|
||||
# Misc files and directories in SDist
|
||||
include *.md
|
||||
include CITATION.cff
|
||||
include LICENSE NOTICE
|
||||
include mypy*.ini
|
||||
graft benchmarks
|
||||
graft docs
|
||||
graft mypy_plugins
|
||||
graft scripts
|
||||
|
||||
# Misc files needed for custom setuptools command
|
||||
include .gitignore
|
||||
include .gitmodules
|
||||
|
||||
# [1] Invalid symlinks for the purposes of Python source distributions are,
|
||||
# according to the source distribution format[2] links pointing outside the
|
||||
# destination directory or links with a `..` component, which is those of
|
||||
# concern here.
|
||||
# Include test suites in SDist
|
||||
graft test
|
||||
include pytest.ini
|
||||
include .coveragerc
|
||||
|
||||
# [2] https://packaging.python.org/en/latest/specifications/source-distribution-format/#source-distribution-archive-features
|
||||
# Prune generated/compiled files
|
||||
prune torchgen/packaged
|
||||
prune */__pycache__
|
||||
global-exclude *.o *.obj *.so *.a *.dylib *.pxd *.dll *.lib *.py[cod]
|
||||
|
||||
prune */.git
|
||||
global-exclude .git *~ *.swp
|
||||
|
||||
@ -161,7 +161,7 @@ They require JetPack 4.2 and above, and [@dusty-nv](https://github.com/dusty-nv)
|
||||
|
||||
#### Prerequisites
|
||||
If you are installing from source, you will need:
|
||||
- Python 3.10 or later
|
||||
- Python 3.9 or later
|
||||
- A compiler that fully supports C++17, such as clang or gcc (gcc 9.4.0 or newer is required, on Linux)
|
||||
- Visual Studio or Visual Studio Build Tool (Windows only)
|
||||
|
||||
|
||||
@ -317,20 +317,10 @@ IF(USE_FBGEMM_GENAI)
|
||||
-greedy-reverse-local-assignment=1
|
||||
-fhip-new-launch-api)
|
||||
|
||||
# Only compile for gfx942 for now.
|
||||
# This is rather hacky, I could not figure out a clean solution :(
|
||||
set(HIP_CLANG_FLAGS_ORIGINAL ${HIP_CLANG_FLAGS})
|
||||
string(REGEX REPLACE "--offload-arch=[^ ]*" "" FILTERED_HIP_CLANG_FLAGS "${HIP_CLANG_FLAGS}")
|
||||
if("gfx942" IN_LIST PYTORCH_ROCM_ARCH)
|
||||
list(APPEND FILTERED_HIP_CLANG_FLAGS --offload-arch=gfx942;)
|
||||
endif()
|
||||
set(HIP_CLANG_FLAGS ${FILTERED_HIP_CLANG_FLAGS})
|
||||
|
||||
hip_add_library(
|
||||
fbgemm_genai STATIC
|
||||
${fbgemm_genai_native_rocm_hip}
|
||||
HIPCC_OPTIONS ${HIP_HCC_FLAGS} ${FBGEMM_GENAI_EXTRA_HIPCC_FLAGS})
|
||||
set(HIP_CLANG_FLAGS ${HIP_CLANG_FLAGS_ORIGINAL})
|
||||
set_target_properties(fbgemm_genai PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
target_compile_definitions(fbgemm_genai PRIVATE FBGEMM_GENAI_NO_EXTENDED_SHAPES)
|
||||
|
||||
|
||||
@ -401,13 +401,30 @@ T* toDLPackImpl(const Tensor& src) {
|
||||
// The following code detects whether the src follows
|
||||
// a continuous pattern. If the src follows such pattern (common-case)
|
||||
// then we do not need to normalize the strides.
|
||||
bool need_normalize_strides = src.dim() == 1 && src.size(0) == 1 && src.stride(0) != 1;
|
||||
bool need_normalize_strides = false;
|
||||
int64_t expected_stride = 1;
|
||||
for (int i = src.dim() - 1; i >= 0; i--) {
|
||||
// detect if we do not meet continuous pattern
|
||||
// and the size is 1, so there is opportunity to normalize
|
||||
if (src.stride(i) != expected_stride && src.size(i) == 1) {
|
||||
need_normalize_strides = true;
|
||||
break;
|
||||
}
|
||||
expected_stride *= src.size(i);
|
||||
}
|
||||
|
||||
// less common case, try normalizing the strides
|
||||
if (need_normalize_strides) {
|
||||
// create a new tensor with possibly normalized strides
|
||||
// gh-83069
|
||||
auto shape = src.sizes();
|
||||
view = src.as_strided(shape, {1}, src.storage_offset());
|
||||
auto strides = src.strides().vec();
|
||||
for (int i = 0; i < src.dim(); i++) {
|
||||
if (shape[i] < 2) {
|
||||
strides[i] = 1;
|
||||
}
|
||||
}
|
||||
view = src.as_strided(shape, strides, src.storage_offset());
|
||||
}
|
||||
|
||||
ATenDLMTensor<T>* atDLMTensor(new ATenDLMTensor<T>);
|
||||
|
||||
@ -9,6 +9,11 @@
|
||||
|
||||
namespace at::functionalization {
|
||||
|
||||
ViewMeta ViewMeta::to_out_idx(int64_t out_idx) {
|
||||
if (out_idx == this->out_index) return *this;
|
||||
return ViewMeta(forward_fn, reverse_fn, has_symbolic_inputs, is_multi_output, is_as_strided, out_idx);
|
||||
}
|
||||
|
||||
// Note [Functionalization: Alias Removal Part 2]
|
||||
// See Note [Functionalization: Alias Removal] for more details.
|
||||
// This function applies a single update from one of the views to the StorageImpl.
|
||||
@ -37,12 +42,12 @@ namespace at::functionalization {
|
||||
static const Tensor apply_update(const FunctionalStorageImpl::Update& update, const Tensor& base) {
|
||||
at::Tensor t = update.new_val;
|
||||
TORCH_INTERNAL_ASSERT(!at::functionalization::impl::isFunctionalTensor(t));
|
||||
if (update.view_metas.empty()) { return t; }
|
||||
if (update.view_metas.empty()) return t;
|
||||
|
||||
std::vector<at::Tensor> tmp_values({base});
|
||||
tmp_values.reserve(update.view_metas.size());
|
||||
for (size_t i = 0; i < update.view_metas.size() - 1; ++i) {
|
||||
at::Tensor next_view = update.view_metas[i]->forward(tmp_values.back());
|
||||
at::Tensor next_view = update.view_metas[i].forward_fn(tmp_values.back(), update.view_metas[i].out_index);
|
||||
// NB: We only actually need tmp_values for ops like select/slice/diagonal/squeeze/as_strided
|
||||
// All of these ops require additional information to recover the sizes of the original tensor.
|
||||
// If need to, we could probably apply this optimization and only bother computing tmp_values
|
||||
@ -50,8 +55,9 @@ static const Tensor apply_update(const FunctionalStorageImpl::Update& update, co
|
||||
tmp_values.push_back(std::move(next_view));
|
||||
}
|
||||
for(int64_t i = static_cast<int64_t>(update.view_metas.size()) - 1; i >= 0; --i) {
|
||||
int64_t out_idx = update.view_metas[i].out_index;
|
||||
// Each view inverse is implemented in ViewInverses.cpp.
|
||||
t = update.view_metas[i]->reverse(tmp_values[i], t);
|
||||
t = update.view_metas[i].reverse_fn(tmp_values[i], t, out_idx);
|
||||
}
|
||||
TORCH_INTERNAL_ASSERT(!at::functionalization::impl::isFunctionalTensor(t));
|
||||
return t;
|
||||
@ -105,13 +111,13 @@ FunctionalStorageImpl::FunctionalStorageImpl(const Tensor& base)
|
||||
TORCH_INTERNAL_ASSERT(!at::functionalization::impl::isFunctionalTensor(base_));
|
||||
}
|
||||
|
||||
void FunctionalStorageImpl::add_update(const Tensor& updated_val, const std::vector<std::shared_ptr<ViewMeta>>& metas) {
|
||||
void FunctionalStorageImpl::add_update(const Tensor& updated_val, const std::vector<ViewMeta>& metas) {
|
||||
TORCH_CHECK(!frozen_, "cannot mutate tensors with frozen storage");
|
||||
|
||||
if (metas.size() > 1) {
|
||||
for (size_t i = 1; i < metas.size(); ++i) {
|
||||
// Skipping this check for XLA. Would be good to add it back, but it is failing XLA CI
|
||||
TORCH_CHECK(updated_val.device().type() == c10::DeviceType::XLA || !metas[i]->is_as_strided,
|
||||
TORCH_CHECK(updated_val.device().type() == c10::DeviceType::XLA || !metas[i].is_as_strided,
|
||||
"During torch.compile, encountered a mutation on a view chain of length ", metas.size(), ", where view ", i,
|
||||
" was an as_strided() call. as_strided() is non-compositional, and therefore is not possible to functionalize properly today,"
|
||||
"so this behavior is banned in compile. As a workaround, you can either remove the mutation from the model code, or you "
|
||||
|
||||
@ -8,89 +8,44 @@ namespace at::functionalization {
|
||||
|
||||
// See Note [Functionalization Pass In Core]
|
||||
|
||||
enum class InverseReturnMode {
|
||||
/// Specifies that functional inverses should always return a view.
|
||||
AlwaysView,
|
||||
/// Specifies that functional inverses should always return a non-view / copy.
|
||||
NeverView,
|
||||
/// Specifies that functional inverses should return a view unless a (copying)
|
||||
/// scatter
|
||||
/// inverse exists, in which case that will be used instead.
|
||||
/// This avoids as_strided() calls that can be difficult for subclasses to
|
||||
/// handle.
|
||||
ViewOrScatterInverse,
|
||||
};
|
||||
|
||||
#define FUNCTIONALIZATION_VIEWMETA_NAME(TYPE) \
|
||||
static const char* name() { \
|
||||
return #TYPE; \
|
||||
}
|
||||
|
||||
#define FUNCTIONALIZATION_VIEWMETA_SERIALIZABLE_TUPLE(...) \
|
||||
using SerializableTuple = std::tuple<__VA_ARGS__>
|
||||
|
||||
// ViewMeta is a class used by the functionalization pass to navigate between
|
||||
// a base tensor and a view tensor.
|
||||
// For example, if I call `b = a.view1(...)`
|
||||
// the functionalization pass will generate and store a ViewMeta specialization
|
||||
// for `view1` operation on b that looks like:
|
||||
// the functionalization pass will generate and store a ViewMeta on b that looks
|
||||
// like:
|
||||
//
|
||||
// struct TORCH_API view1_ViewMeta : public ViewMeta {
|
||||
// FUNCTIONALIZATION_VIEWMETA_NAME(view1_ViewMeta);
|
||||
// FUNCTIONALIZATION_VIEWMETA_SERIALIZABLE_TUPLE(
|
||||
// bool /* reapply_views */,
|
||||
// const std::vector<int64_t>&);
|
||||
//
|
||||
// view1_ViewMeta(const SerializableTuple& tpl)
|
||||
// : view1_ViewMeta(std::get<0>(tpl), std::get<1>(tpl)) {}
|
||||
//
|
||||
// view1_ViewMeta(bool reapply_views, const std::vector<int64_t>& size)
|
||||
// : ViewMeta(/*has_symbolic_inputs=*/false),
|
||||
// reapply_views(reapply_views),
|
||||
// size(size) {}
|
||||
//
|
||||
// Tensor forward(const Tensor& base) override {
|
||||
// return base.view1(...);
|
||||
// ViewMeta(
|
||||
// [<captures>](const Tensor& base, int64_t mutated_view_idx) {
|
||||
// return base.view1(...);
|
||||
// },
|
||||
// [<captures>](const at::Tensor& base, const at::Tensor& mutated_view,
|
||||
// int64_t mutated_view_idx) -> at::Tensor {
|
||||
// return at::functionalization::impl::view1_inverse(base, mutated_view,
|
||||
// ...);
|
||||
// }
|
||||
//
|
||||
// Tensor reverse(const Tensor& base, const Tensor& mutated_view) override {
|
||||
// return at::functionalization::impl::view1_inverse(base, mutated_view,
|
||||
// ...);
|
||||
// }
|
||||
// The forward_fn lambda describes how to replay view1 on a tensor.
|
||||
//
|
||||
// SerializableTuple to_serializable_tuple() {
|
||||
// return std::make_tuple(reapply_views, size);
|
||||
// }
|
||||
//
|
||||
// bool reapply_views;
|
||||
// std::vector<int64_t> size;
|
||||
// };
|
||||
//
|
||||
// The forward function describes how to replay view1 on a tensor.
|
||||
//
|
||||
// The reverse function describes how, given a tensor that is already a view,
|
||||
// The reverse_fn lambda describes how, given a tensor that is already a view,
|
||||
// how to get the corresponding base tensor. See Note [Functionalization Pass:
|
||||
// View Inverses] for details.
|
||||
//
|
||||
// `SerializedTuple` is a typedef that defines an `std::tuple<...>` type
|
||||
// representing the `ViewMeta` instance state. Methods that take in/return such
|
||||
// a type are used for supporting pickle serialization.
|
||||
struct ViewMeta {
|
||||
ViewMeta(
|
||||
std::function<Tensor(const Tensor&, int64_t)> forward,
|
||||
std::function<Tensor(const Tensor&, const Tensor&, int64_t)> reverse,
|
||||
bool has_symbolic_inputs,
|
||||
bool is_multi_output = false,
|
||||
bool is_as_strided = false,
|
||||
int64_t out_idx = 0)
|
||||
: out_index(out_idx),
|
||||
: forward_fn(std::move(forward)),
|
||||
reverse_fn(std::move(reverse)),
|
||||
out_index(out_idx),
|
||||
is_multi_output(is_multi_output),
|
||||
is_as_strided(is_as_strided),
|
||||
has_symbolic_inputs(has_symbolic_inputs) {}
|
||||
|
||||
virtual ~ViewMeta() = default;
|
||||
|
||||
virtual Tensor forward(const Tensor& base) = 0;
|
||||
virtual Tensor reverse(const Tensor& base, const Tensor& mutated_view) = 0;
|
||||
|
||||
std::function<Tensor(const Tensor&, int64_t)> forward_fn;
|
||||
std::function<Tensor(const Tensor&, const Tensor&, int64_t)> reverse_fn;
|
||||
// See Note [out_idx in ViewMeta]
|
||||
int64_t out_index;
|
||||
|
||||
@ -102,17 +57,10 @@ struct ViewMeta {
|
||||
// Tells us if this view operation has any symbolic inputs
|
||||
bool has_symbolic_inputs;
|
||||
|
||||
// Returns a new ViewMeta with the same forward/reverse
|
||||
// Returns a copy of the current ViewMeta, if out_idx matches the current
|
||||
// out_index. Otherwise, returns a new ViewMeta with the same forward/reverse
|
||||
// functions, but a new out index.
|
||||
//
|
||||
// This method should be implemented by those `ViewMeta` that have more than
|
||||
// one output.
|
||||
virtual std::shared_ptr<ViewMeta> to_out_index(int64_t out_index) {
|
||||
TORCH_CHECK_NOT_IMPLEMENTED(
|
||||
false,
|
||||
"ViewMeta::to_out_index not implemented. ",
|
||||
"Likely because there's only one output.");
|
||||
}
|
||||
ViewMeta to_out_idx(int64_t out_idx);
|
||||
};
|
||||
|
||||
// FunctionalStorageImpl is a subclass of StorageImpl used by the
|
||||
@ -145,14 +93,14 @@ struct TORCH_API FunctionalStorageImpl : public c10::StorageImpl {
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
|
||||
const at::Tensor new_val;
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
|
||||
const std::vector<std::shared_ptr<ViewMeta>> view_metas;
|
||||
const std::vector<ViewMeta> view_metas;
|
||||
};
|
||||
|
||||
explicit FunctionalStorageImpl(const Tensor& value);
|
||||
|
||||
void add_update(
|
||||
const Tensor& updated_val,
|
||||
const std::vector<std::shared_ptr<ViewMeta>>& view_metas);
|
||||
const std::vector<ViewMeta>& view_metas);
|
||||
bool apply_updates();
|
||||
const Tensor& base() {
|
||||
return base_;
|
||||
|
||||
@ -129,19 +129,17 @@ void FunctionalTensorWrapper::freeze_storage() const {
|
||||
// - view_value: The output tensor that we need to wrap.
|
||||
// - base: The "base" of the view that `view_value` was generated from.
|
||||
// See Note [Functionalization: Alias Removal Part 2] for more details on the mutation replay logic.
|
||||
FunctionalTensorWrapper::FunctionalTensorWrapper(
|
||||
const Tensor& view_value,
|
||||
const FunctionalTensorWrapper* base,
|
||||
const std::shared_ptr<functionalization::ViewMeta>& meta)
|
||||
: c10::TensorImpl(
|
||||
c10::DispatchKeySet(DispatchKey::Functionalize),
|
||||
view_value.dtype(),
|
||||
base->storage().data_ptr().device()),
|
||||
value_(view_value),
|
||||
is_multi_output_view_(
|
||||
base->is_multi_output_view_ || meta->is_multi_output),
|
||||
was_storage_changed_(base->was_storage_changed_),
|
||||
is_symbolic_(base->is_symbolic_) {
|
||||
FunctionalTensorWrapper::FunctionalTensorWrapper(const Tensor& view_value, const FunctionalTensorWrapper* base, const functionalization::ViewMeta& meta)
|
||||
: c10::TensorImpl(
|
||||
c10::DispatchKeySet(DispatchKey::Functionalize),
|
||||
view_value.dtype(),
|
||||
base->storage().data_ptr().device()
|
||||
),
|
||||
value_(view_value),
|
||||
is_multi_output_view_(base->is_multi_output_view_ || meta.is_multi_output),
|
||||
was_storage_changed_(base->was_storage_changed_),
|
||||
is_symbolic_(base->is_symbolic_)
|
||||
{
|
||||
TORCH_INTERNAL_ASSERT(!at::functionalization::impl::isFunctionalTensor(value_));
|
||||
TORCH_INTERNAL_ASSERT(!value_.key_set().has(c10::DispatchKey::Functionalize));
|
||||
set_constructor_metadata();
|
||||
@ -150,10 +148,11 @@ FunctionalTensorWrapper::FunctionalTensorWrapper(
|
||||
view_metas_ = base->view_metas_; // copy
|
||||
}
|
||||
view_metas_.push_back(meta);
|
||||
maybe_mark_symbolic(meta.get());
|
||||
maybe_mark_symbolic(meta);
|
||||
storage_ = base->storage_; // alias this tensor's storage with the base tensor's
|
||||
}
|
||||
|
||||
|
||||
functionalization::FunctionalStorageImpl* FunctionalTensorWrapper::functional_storage_impl() const {
|
||||
return static_cast<functionalization::FunctionalStorageImpl*>(storage_.unsafeGetStorageImpl());
|
||||
}
|
||||
@ -177,18 +176,18 @@ bool FunctionalTensorWrapper::is_up_to_date() const {
|
||||
}
|
||||
|
||||
// See Note [Functionalization Pass - Inplace View Ops]
|
||||
void FunctionalTensorWrapper::mutate_view_meta(const std::shared_ptr<at::functionalization::ViewMeta>& meta) {
|
||||
void FunctionalTensorWrapper::mutate_view_meta(const at::functionalization::ViewMeta& meta) {
|
||||
view_metas_.push_back(meta);
|
||||
// Manually track the fact that this tensor received a metadata mutation!
|
||||
has_metadata_mutation_ = true;
|
||||
// Mark this tensor as being symbolic if there are any symbolic inputs used by the view operation.
|
||||
maybe_mark_symbolic(meta.get());
|
||||
maybe_mark_symbolic(meta);
|
||||
// Note [Functionalization Pass - Inplace View Ops]
|
||||
// So, these ops are special - they're mutation AND view ops. They get special codegen.
|
||||
// An example is transpose_, e.g. `a.transpose_()`
|
||||
// Calling transpose_() should ensure that a gets an alias, and append the new ViewMeta to a's current list of ViewMetas.
|
||||
at::AutoDispatchSkipFunctionalize guard;
|
||||
value_ = meta->forward(value_);
|
||||
value_ = meta.forward_fn(value_, meta.out_index);
|
||||
TORCH_INTERNAL_ASSERT(!value_.key_set().has(c10::DispatchKey::Functionalize));
|
||||
}
|
||||
|
||||
@ -369,8 +368,15 @@ void FunctionalTensorWrapper::sync_() {
|
||||
regenerate_from_base();
|
||||
}
|
||||
|
||||
const std::vector<std::shared_ptr<functionalization::ViewMeta>>& FunctionalTensorWrapper::view_metas() const {
|
||||
return view_metas_;
|
||||
Tensor FunctionalTensorWrapper::apply_view_metas(const Tensor& base) {
|
||||
auto t = base;
|
||||
|
||||
// Reapply views to get the viewed tensor from the base in alias_
|
||||
for (auto& view_meta: view_metas_) {
|
||||
t = view_meta.forward_fn(t, view_meta.out_index);
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
void FunctionalTensorWrapper::regenerate_from_base() {
|
||||
@ -379,7 +385,7 @@ void FunctionalTensorWrapper::regenerate_from_base() {
|
||||
auto t = storage_impl->base();
|
||||
|
||||
TORCH_INTERNAL_ASSERT(!at::functionalization::impl::isFunctionalTensor(t));
|
||||
t = at::functionalization::impl::apply_view_meta_sequence(t, view_metas_);
|
||||
t = apply_view_metas(t);
|
||||
TORCH_INTERNAL_ASSERT(!at::functionalization::impl::isFunctionalTensor(t));
|
||||
|
||||
replace_(t, /*from_lazy_regenerate=*/true);
|
||||
@ -721,11 +727,11 @@ bool isFunctionalTensor(const std::optional<Tensor>& t) {
|
||||
}
|
||||
|
||||
bool isFunctionalTensor(const c10::List<::std::optional<Tensor>>& t_list) {
|
||||
if (t_list.empty()) { return false; }
|
||||
if (t_list.empty()) return false;
|
||||
auto functional_count = 0;
|
||||
for (const auto i : c10::irange(t_list.size())) {
|
||||
auto const & e= t_list[i];
|
||||
if (!e.has_value() || !e->defined()) { continue; }
|
||||
if (!e.has_value() || !e->defined()) continue;
|
||||
if (isFunctionalTensor(e)) {
|
||||
++functional_count;
|
||||
}
|
||||
@ -735,10 +741,10 @@ bool isFunctionalTensor(const c10::List<::std::optional<Tensor>>& t_list) {
|
||||
|
||||
template <typename T>
|
||||
static bool isFunctionalTensorIListRef(c10::IListRef<T> list) {
|
||||
if (list.size() == 0) { return false; }
|
||||
if (list.size() == 0) return false;
|
||||
auto functional_count = 0;
|
||||
for (const auto& tensor : list) {
|
||||
if (!tensor.defined()) { continue; }
|
||||
if (!tensor.defined()) continue;
|
||||
if (isFunctionalTensor(tensor)) {
|
||||
++functional_count;
|
||||
}
|
||||
@ -756,28 +762,20 @@ void freeze_functional_tensor(const Tensor& tensor) {
|
||||
functional_base_impl->freeze_storage();
|
||||
}
|
||||
|
||||
Tensor create_functional_tensor_with_view_meta(
|
||||
const at::Tensor& view_to_wrap,
|
||||
const at::Tensor& base,
|
||||
const std::shared_ptr<functionalization::ViewMeta>& meta,
|
||||
int64_t out_idx) {
|
||||
Tensor create_functional_tensor_with_view_meta(const at::Tensor& view_to_wrap, const at::Tensor& base, functionalization::ViewMeta meta, int64_t out_idx) {
|
||||
TORCH_INTERNAL_ASSERT(!at::functionalization::impl::isFunctionalTensor(view_to_wrap));
|
||||
TORCH_INTERNAL_ASSERT(at::functionalization::impl::isFunctionalTensor(base));
|
||||
auto functional_base_impl = at::functionalization::impl::unsafeGetFunctionalWrapper(base);
|
||||
auto meta_ = meta;
|
||||
if (out_idx != 0) {
|
||||
// Note [out_idx in ViewMeta]
|
||||
// When a view op outputs multiple tensors, each output needs its own separate ViewMeta.
|
||||
// Each ViewMeta also tracks the index of the particular output tensor, which is needed in the reverse function.
|
||||
meta_ = meta->to_out_index(out_idx);
|
||||
meta = meta.to_out_idx(out_idx);
|
||||
}
|
||||
return at::detail::make_tensor<FunctionalTensorWrapper>(view_to_wrap, functional_base_impl, meta_);
|
||||
return at::detail::make_tensor<FunctionalTensorWrapper>(view_to_wrap, functional_base_impl, meta);
|
||||
}
|
||||
|
||||
std::vector<Tensor> create_functional_tensor_with_view_meta(
|
||||
ITensorListRef view_to_wrap,
|
||||
const at::Tensor& base,
|
||||
const std::shared_ptr<functionalization::ViewMeta>& meta) {
|
||||
std::vector<Tensor> create_functional_tensor_with_view_meta(ITensorListRef view_to_wrap, const at::Tensor& base, const functionalization::ViewMeta& meta) {
|
||||
std::vector<Tensor> outputs(view_to_wrap.size());
|
||||
int64_t i = 0;
|
||||
for (const auto& tensor : view_to_wrap) {
|
||||
@ -787,22 +785,12 @@ std::vector<Tensor> create_functional_tensor_with_view_meta(
|
||||
return outputs;
|
||||
}
|
||||
|
||||
void mutate_view_meta(const at::Tensor& self, const std::shared_ptr<functionalization::ViewMeta>& meta) {
|
||||
void mutate_view_meta(const at::Tensor& self, const functionalization::ViewMeta& meta) {
|
||||
TORCH_INTERNAL_ASSERT(at::functionalization::impl::isFunctionalTensor(self));
|
||||
auto self_impl = at::functionalization::impl::unsafeGetFunctionalWrapper(self);
|
||||
self_impl->mutate_view_meta(meta);
|
||||
}
|
||||
|
||||
Tensor apply_view_meta_sequence(
|
||||
const Tensor& base,
|
||||
const std::vector<std::shared_ptr<functionalization::ViewMeta>>& sequence) {
|
||||
Tensor r = base;
|
||||
for (auto& vm : sequence) {
|
||||
r = vm->forward(r);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
// Note [Propagating strides in the functionalization pass]
|
||||
// In order to properly compute stride information, the functionalization pass
|
||||
// calls each {view} reference implementations with meta tensors.
|
||||
@ -896,7 +884,7 @@ void functionalize_op_helper(const c10::OperatorHandle& op, torch::jit::Stack* s
|
||||
const auto& ivalue = returns[idx];
|
||||
if (ivalue.isTensor()) {
|
||||
const auto& t = ivalue.toTensor();
|
||||
if (!t.defined()) { continue; }
|
||||
if (!t.defined()) continue;
|
||||
at::functionalization::impl::sync(t);
|
||||
auto t_new = c10::IValue(at::functionalization::impl::from_functional_tensor(t));
|
||||
(*stack)[returns_begin + idx] = t_new;
|
||||
|
||||
@ -56,7 +56,7 @@ struct TORCH_API FunctionalTensorWrapper : public c10::TensorImpl {
|
||||
explicit FunctionalTensorWrapper(
|
||||
const Tensor& view_value,
|
||||
const FunctionalTensorWrapper* base,
|
||||
const std::shared_ptr<functionalization::ViewMeta>& meta);
|
||||
const functionalization::ViewMeta& meta);
|
||||
|
||||
// Get the underlying, actual tensor, that doesn't know anything about
|
||||
// functionalization.
|
||||
@ -99,17 +99,17 @@ struct TORCH_API FunctionalTensorWrapper : public c10::TensorImpl {
|
||||
->are_all_mutations_under_no_grad_or_inference_mode();
|
||||
}
|
||||
|
||||
void maybe_mark_symbolic(functionalization::ViewMeta* meta) {
|
||||
is_symbolic_ = is_symbolic_ | meta->has_symbolic_inputs;
|
||||
void maybe_mark_symbolic(const functionalization::ViewMeta& meta) {
|
||||
is_symbolic_ = is_symbolic_ | meta.has_symbolic_inputs;
|
||||
}
|
||||
|
||||
bool is_symbolic() const {
|
||||
return is_symbolic_;
|
||||
}
|
||||
|
||||
// Retrieves the ViewMeta sequence of this tensor.
|
||||
const std::vector<std::shared_ptr<functionalization::ViewMeta>>& view_metas()
|
||||
const;
|
||||
// Runs the forward_fn of every ViewMeta collected in the current instance
|
||||
// to some other base.
|
||||
Tensor apply_view_metas(const Tensor& base);
|
||||
|
||||
// Sync's the underlying tensor with its alias, if it's out of date. This
|
||||
// involves two steps: 1) Apply any pending updates/mutations to the alias 2)
|
||||
@ -146,8 +146,7 @@ struct TORCH_API FunctionalTensorWrapper : public c10::TensorImpl {
|
||||
// from the base tensor. This method is used by inplace-view ops like
|
||||
// transpose_. It appends a ViewMeta to the existing stack, and refreshes the
|
||||
// tensor by replaying the views off of the alias.
|
||||
void mutate_view_meta(
|
||||
const std::shared_ptr<at::functionalization::ViewMeta>& meta);
|
||||
void mutate_view_meta(const at::functionalization::ViewMeta& meta);
|
||||
|
||||
// Custom implementation of self.set_(src)
|
||||
void set__impl(const FunctionalTensorWrapper* other);
|
||||
@ -286,7 +285,7 @@ struct TORCH_API FunctionalTensorWrapper : public c10::TensorImpl {
|
||||
bool is_symbolic_ = false;
|
||||
|
||||
size_t generation_ = 0;
|
||||
std::vector<std::shared_ptr<at::functionalization::ViewMeta>> view_metas_;
|
||||
std::vector<at::functionalization::ViewMeta> view_metas_;
|
||||
|
||||
protected:
|
||||
static void copy_tensor_metadata(
|
||||
@ -378,20 +377,16 @@ TORCH_API void propagate_xla_data_direct(
|
||||
Tensor create_functional_tensor_with_view_meta(
|
||||
const Tensor& view_to_wrap,
|
||||
const Tensor& base,
|
||||
const std::shared_ptr<functionalization::ViewMeta>& meta,
|
||||
functionalization::ViewMeta meta,
|
||||
int64_t out_idx = 0);
|
||||
std::vector<Tensor> create_functional_tensor_with_view_meta(
|
||||
ITensorListRef view_to_wrap,
|
||||
const Tensor& base,
|
||||
const std::shared_ptr<functionalization::ViewMeta>& meta);
|
||||
const functionalization::ViewMeta& meta);
|
||||
|
||||
void mutate_view_meta(
|
||||
const Tensor& self,
|
||||
const std::shared_ptr<functionalization::ViewMeta>& meta);
|
||||
|
||||
TORCH_API Tensor apply_view_meta_sequence(
|
||||
const Tensor& base,
|
||||
const std::vector<std::shared_ptr<functionalization::ViewMeta>>& sequence);
|
||||
const functionalization::ViewMeta& meta);
|
||||
|
||||
void set_sizes_strides_offset(const Tensor& out, const Tensor& meta_out);
|
||||
void set_sizes_strides_offset(
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
#include <ATen/FunctionalizeFallbackKernel.h>
|
||||
|
||||
#include <ATen/core/dispatch/Dispatcher.h>
|
||||
#include <ATen/core/LegacyTypeDispatch.h>
|
||||
#include <ATen/EmptyTensor.h>
|
||||
@ -9,6 +7,7 @@
|
||||
#include <torch/library.h>
|
||||
#include <c10/util/irange.h>
|
||||
#include <c10/util/strides.h>
|
||||
#include <ATen/EmptyTensor.h>
|
||||
|
||||
#ifndef AT_PER_OPERATOR_HEADERS
|
||||
#include <ATen/ATen.h>
|
||||
@ -29,31 +28,6 @@
|
||||
#include <utility>
|
||||
#endif
|
||||
|
||||
namespace at::functionalization {
|
||||
|
||||
Tensor resize__ViewMeta::forward(const Tensor& base) {
|
||||
if (reapply_views) {
|
||||
return base.as_strided(size, c10::contiguous_strides(size));
|
||||
} else {
|
||||
return at::as_strided_copy(base, size, c10::contiguous_strides(size));
|
||||
}
|
||||
}
|
||||
|
||||
Tensor resize__ViewMeta::reverse(const Tensor& base, const Tensor& mutated_view) {
|
||||
return base.as_strided_scatter(
|
||||
mutated_view, size, c10::contiguous_strides(size));
|
||||
}
|
||||
|
||||
Tensor _unsafe_view_ViewMeta::forward(const Tensor& base) {
|
||||
return at::_unsafe_view_symint(base, size);
|
||||
}
|
||||
|
||||
Tensor _unsafe_view_ViewMeta::reverse(const Tensor& base, const Tensor& mutated_view) {
|
||||
return at::_unsafe_view_symint(mutated_view, base.sym_sizes());
|
||||
}
|
||||
|
||||
} // namespace at::functionalization
|
||||
|
||||
namespace {
|
||||
void functionalizeFallback(const c10::OperatorHandle& op, c10::DispatchKeySet dispatchKeySet [[maybe_unused]], torch::jit::Stack* stack) {
|
||||
const auto& schema = op.schema();
|
||||
@ -132,9 +106,7 @@ namespace {
|
||||
const auto& ivalue = returns[idx];
|
||||
if (ivalue.isTensor() && should_wrap_outputs) {
|
||||
const auto& t = ivalue.toTensor();
|
||||
if (!t.defined()) {
|
||||
continue;
|
||||
}
|
||||
if (!t.defined()) continue;
|
||||
auto t_new = c10::IValue(at::functionalization::impl::to_functional_tensor(t));
|
||||
(*stack)[returns_begin + idx] = t_new;
|
||||
} else if (ivalue.isTensorList() && should_wrap_outputs) {
|
||||
@ -197,8 +169,19 @@ static const at::Tensor & resize__functionalization(c10::DispatchKeySet dispatch
|
||||
// The output of resizing is equivalent to taking a slice of a larger tensor.
|
||||
// We have to emulate this "slicing" with an as_strided call.
|
||||
auto reapply_views = at::functionalization::impl::getFunctionalizationReapplyViewsTLS();
|
||||
auto view_meta = std::make_shared<at::functionalization::resize__ViewMeta>(
|
||||
reapply_views, size.vec());
|
||||
at::functionalization::ViewMeta view_meta = at::functionalization::ViewMeta(
|
||||
[reapply_views = reapply_views, size = size.vec()](const at::Tensor & base, int64_t mutated_view_idx [[maybe_unused]]) -> at::Tensor {
|
||||
if (reapply_views) {
|
||||
return base.as_strided(size, c10::contiguous_strides(size));
|
||||
} else {
|
||||
return at::as_strided_copy(base, size, c10::contiguous_strides(size));
|
||||
}
|
||||
},
|
||||
[size = size.vec()](const at::Tensor & base, const at::Tensor & mutated_view, int64_t mutated_view_idx [[maybe_unused]]) -> at::Tensor {
|
||||
return base.as_strided_scatter(mutated_view, size, c10::contiguous_strides(size));
|
||||
},
|
||||
/*has_symbolic_inputs=*/false
|
||||
);
|
||||
at::functionalization::impl::mutate_view_meta(self, view_meta);
|
||||
return self;
|
||||
}
|
||||
@ -317,11 +300,17 @@ static at::Tensor _unsafe_view_functionalize(const at::Tensor & self, at::SymInt
|
||||
tmp_output = at::_unsafe_view_symint(self_, size);
|
||||
}
|
||||
|
||||
bool has_symbolic_inputs = std::any_of(
|
||||
size.begin(), size.end(), [=](auto& s) { return s.is_symbolic(); });
|
||||
auto view_meta =
|
||||
std::make_shared<at::functionalization::_unsafe_view_ViewMeta>(
|
||||
has_symbolic_inputs, size.vec());
|
||||
bool has_symbolic_inputs = std::any_of(size.begin(), size.end(), [=](auto& s) { return s.is_symbolic(); });
|
||||
|
||||
at::functionalization::ViewMeta view_meta = at::functionalization::ViewMeta(
|
||||
[size = size.vec()](const at::Tensor & base, int64_t mutated_view_idx [[maybe_unused]]) -> at::Tensor {
|
||||
return at::_unsafe_view_symint(base, size);
|
||||
},
|
||||
[size = size.vec()](const at::Tensor & base, const at::Tensor & mutated_view, int64_t mutated_view_idx [[maybe_unused]]) -> at::Tensor {
|
||||
return at::_unsafe_view_symint(mutated_view, base.sym_sizes());
|
||||
},
|
||||
/*has_symbolic_inputs=*/has_symbolic_inputs
|
||||
);
|
||||
|
||||
auto out = at::functionalization::impl::create_functional_tensor_with_view_meta(tmp_output, self, std::move(view_meta));
|
||||
// See Note [Propagating strides in the functionalization pass]
|
||||
|
||||
@ -1,58 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <ATen/FunctionalStorageImpl.h>
|
||||
|
||||
namespace at::functionalization {
|
||||
|
||||
// `ViewMeta` implementation for `resize_` operation.
|
||||
struct TORCH_API resize__ViewMeta : public ViewMeta {
|
||||
FUNCTIONALIZATION_VIEWMETA_NAME(resize__ViewMeta)
|
||||
FUNCTIONALIZATION_VIEWMETA_SERIALIZABLE_TUPLE(
|
||||
bool /* reapply_views */,
|
||||
const std::vector<int64_t>&);
|
||||
|
||||
resize__ViewMeta(const SerializableTuple& tpl)
|
||||
: resize__ViewMeta(std::get<0>(tpl), std::get<1>(tpl)) {}
|
||||
|
||||
resize__ViewMeta(bool reapply_views, const std::vector<int64_t>& size)
|
||||
: ViewMeta(/*has_symbolic_inputs=*/false),
|
||||
reapply_views(reapply_views),
|
||||
size(size) {}
|
||||
|
||||
Tensor forward(const Tensor& base) override;
|
||||
Tensor reverse(const Tensor& base, const Tensor& mutated_view) override;
|
||||
|
||||
SerializableTuple to_serializable_tuple() {
|
||||
return std::make_tuple(reapply_views, size);
|
||||
}
|
||||
|
||||
bool reapply_views;
|
||||
std::vector<int64_t> size;
|
||||
};
|
||||
|
||||
// `ViewMeta` implementation for `_unsafe_view` operation.
|
||||
struct TORCH_API _unsafe_view_ViewMeta : public ViewMeta {
|
||||
FUNCTIONALIZATION_VIEWMETA_NAME(_unsafe_view_ViewMeta)
|
||||
FUNCTIONALIZATION_VIEWMETA_SERIALIZABLE_TUPLE(
|
||||
bool /* has_symbolic_inputs */,
|
||||
const std::vector<c10::SymInt>&);
|
||||
|
||||
_unsafe_view_ViewMeta(const SerializableTuple& tpl)
|
||||
: _unsafe_view_ViewMeta(std::get<0>(tpl), std::get<1>(tpl)) {}
|
||||
|
||||
_unsafe_view_ViewMeta(
|
||||
bool has_symbolic_inputs,
|
||||
const std::vector<c10::SymInt>& size)
|
||||
: ViewMeta(has_symbolic_inputs), size(size) {}
|
||||
|
||||
Tensor forward(const Tensor& base) override;
|
||||
Tensor reverse(const Tensor& base, const Tensor& mutated_view) override;
|
||||
|
||||
SerializableTuple to_serializable_tuple() {
|
||||
return std::make_tuple(has_symbolic_inputs, size);
|
||||
}
|
||||
|
||||
std::vector<c10::SymInt> size;
|
||||
};
|
||||
|
||||
} // namespace at::functionalization
|
||||
@ -1637,7 +1637,9 @@ bool gemm_and_bias(
|
||||
if (activation == GEMMAndBiasActivationEpilogue::RELU) {
|
||||
epilogue = CUBLASLT_EPILOGUE_RELU_BIAS;
|
||||
} else if (activation == GEMMAndBiasActivationEpilogue::GELU) {
|
||||
#if CUDA_VERSION >= 11040 || defined(USE_ROCM)
|
||||
epilogue = CUBLASLT_EPILOGUE_GELU_BIAS;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (bias != nullptr) {
|
||||
@ -1929,6 +1931,7 @@ void scaled_gemm(
|
||||
bool use_fast_accum) {
|
||||
// Note: see `cublasCommonArgs` for various non-intuitive manupulations
|
||||
// of input arguments to this function.
|
||||
#if CUDA_VERSION >= 11080 || defined(USE_ROCM)
|
||||
const auto computeType = CUBLAS_COMPUTE_32F;
|
||||
const auto scaleType = CUDA_R_32F;
|
||||
const float alpha_val = 1.0;
|
||||
@ -2130,6 +2133,8 @@ void scaled_gemm(
|
||||
" scaleType ",
|
||||
scaleType);
|
||||
return;
|
||||
#endif // if CUDA_VERSION >= 11080 || defined(USE_ROCM)
|
||||
TORCH_CHECK(false, "scaled_gemm is only supported for CUDA 11.8 and above");
|
||||
}
|
||||
|
||||
void int8_gemm(
|
||||
|
||||
@ -97,38 +97,43 @@ Tensor& fill_diagonal_(Tensor& self, const Scalar& fill_value, bool wrap) {
|
||||
int64_t nDims = self.dim();
|
||||
TORCH_CHECK(nDims >= 2, "dimensions must larger than 1");
|
||||
|
||||
auto height = self.sym_size(0);
|
||||
auto width = self.sym_size(1);
|
||||
int64_t height = self.size(0);
|
||||
int64_t width = self.size(1);
|
||||
|
||||
if (nDims > 2) {
|
||||
int64_t dim1 = height;
|
||||
for (const auto i : c10::irange(1, nDims)) {
|
||||
if (self.sym_size(i) != height) {
|
||||
if (self.size(i) != dim1) {
|
||||
TORCH_CHECK(false, "all dimensions of input must be of equal length");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto storage_offset = self.sym_storage_offset();
|
||||
auto size = std::min(height, width);
|
||||
int64_t storage_offset = self.storage_offset();
|
||||
std::vector<int64_t> sizes;
|
||||
std::vector<int64_t> strides;
|
||||
int64_t size = std::min(height, width);
|
||||
|
||||
int64_t stride = 0;
|
||||
for (const auto i : c10::irange(nDims)) {
|
||||
stride += self.stride(i);
|
||||
}
|
||||
std::vector<SymInt> strides{stride};
|
||||
std::vector<SymInt> sizes{size};
|
||||
strides.push_back(stride);
|
||||
sizes.push_back(size);
|
||||
|
||||
auto main_diag = self.as_strided_symint(sizes, strides, storage_offset);
|
||||
auto main_diag = self.as_strided(sizes, strides, storage_offset);
|
||||
main_diag.fill_(fill_value);
|
||||
|
||||
if (wrap && nDims == 2 && height > width + 1) {
|
||||
auto step = width + 1;
|
||||
auto wrap_size = ((self.numel() + step - 1) / step) - size;
|
||||
std::vector<SymInt> wrap_sizes{wrap_size};
|
||||
std::vector<int64_t> wrap_sizes;
|
||||
|
||||
auto offset = self.stride(0) * (width + 1);
|
||||
int64_t step = width + 1;
|
||||
int64_t wrap_size = ((self.numel() + step - 1) / step) - size;
|
||||
wrap_sizes.push_back(wrap_size);
|
||||
|
||||
auto wrap_diag = self.as_strided_symint(wrap_sizes, strides, storage_offset + offset);
|
||||
int64_t offset = self.stride(0) * (width + 1);
|
||||
|
||||
auto wrap_diag = self.as_strided(wrap_sizes, strides, storage_offset + offset);
|
||||
wrap_diag.fill_(fill_value);
|
||||
}
|
||||
|
||||
|
||||
@ -23,6 +23,8 @@ Tensor& max_unpooling2d_forward_out_cpu(
|
||||
// Nondeterministic with duplicate indices
|
||||
at::globalContext().alertNotDeterministic("max_unpooling2d_forward_out");
|
||||
|
||||
auto oheight = output_size[0];
|
||||
auto owidth = output_size[1];
|
||||
TORCH_CHECK(
|
||||
indices_.scalar_type() == at::ScalarType::Long,
|
||||
"elements in indices should be type int64 but got: ", indices_.scalar_type());
|
||||
@ -43,9 +45,6 @@ Tensor& max_unpooling2d_forward_out_cpu(
|
||||
self_.sizes(), " with dimension ", i , " being empty.");
|
||||
}
|
||||
|
||||
auto oheight = output_size[0];
|
||||
auto owidth = output_size[1];
|
||||
|
||||
auto memory_format = self_.suggest_memory_format();
|
||||
auto self = self_.contiguous(memory_format);
|
||||
auto indices = indices_.contiguous(memory_format);
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
#include <ATen/core/ATen_fwd.h>
|
||||
#include <c10/core/ScalarType.h>
|
||||
#define TORCH_ASSERT_ONLY_METHOD_OPERATORS
|
||||
#include <ATen/AccumulateType.h>
|
||||
#include <ATen/Dispatch.h>
|
||||
@ -1880,18 +1878,19 @@ Tensor repeat(const Tensor& self, IntArrayRef repeats) {
|
||||
|
||||
Tensor xtensor = self.expand(padded_size);
|
||||
|
||||
Tensor urtensor;
|
||||
Tensor result;
|
||||
if (self.is_quantized()) {
|
||||
urtensor = at::empty_quantized(target_size, self);
|
||||
result = at::empty_quantized(target_size, self);
|
||||
} else {
|
||||
urtensor = at::empty(target_size, self.options());
|
||||
result = at::empty(target_size, self.options());
|
||||
}
|
||||
|
||||
// return an empty tensor if one of the repeat dimensions is zero
|
||||
if (zero_tensor) {
|
||||
return urtensor;
|
||||
return result;
|
||||
}
|
||||
|
||||
Tensor urtensor = at::alias(result);
|
||||
for (const auto i : c10::irange(xtensor.dim())) {
|
||||
// can't unfold with step 0, so make sure step is at least 1
|
||||
// (it doesn't matter what it is in that case, because the size is 0).
|
||||
@ -1901,22 +1900,7 @@ Tensor repeat(const Tensor& self, IntArrayRef repeats) {
|
||||
|
||||
urtensor.copy_(xtensor.expand_as(urtensor));
|
||||
|
||||
// Combine the dimensions to produce the target_size.
|
||||
// xtensor dims: [a0, ..., ad-1]
|
||||
// urtensor dims: [a0, ..., ad-1, b0, ..., bd-1]
|
||||
// b dims are produced by unfold.
|
||||
// Transform urtensor to [a0 * b0, ..., ad-1 * bd-1]
|
||||
const int64_t n_dims = xtensor.dim();
|
||||
auto range_a = at::arange(xtensor.dim(), at::TensorOptions(at::kLong));
|
||||
auto range_b = range_a + n_dims;
|
||||
auto stacked = stack({std::move(range_a), std::move(range_b)}, 1).flatten();
|
||||
auto permutation = IntArrayRef(stacked.data_ptr<int64_t>(), n_dims * 2);
|
||||
// Permute from [a0, ..., ad-1, b0, ..., bd-1] to [a0, b0, ..., ad-1, bd-1]
|
||||
urtensor = urtensor.permute(permutation);
|
||||
// Reshape from [a0, b0, ..., ad-1, bd-1] to [a0 * b0, ..., ad-1 * bd-1]
|
||||
urtensor = urtensor.reshape(target_size);
|
||||
|
||||
return urtensor;
|
||||
return result;
|
||||
}
|
||||
|
||||
Tensor tile_symint(const Tensor& self, SymIntArrayRef reps) {
|
||||
|
||||
@ -999,41 +999,12 @@ void gpu_kernel_impl(TensorIteratorBase& iter, const func_t& f) {
|
||||
dtypes[i] = iter.dtype(i);
|
||||
}
|
||||
auto offset_calc = ::make_offset_calculator<traits::arity + 1>(iter);
|
||||
#ifdef USE_ROCM
|
||||
constexpr int grp_sz = 128;
|
||||
launch_legacy_kernel_manual_unroll<grp_sz, 4>(numel, [=] GPU_LAMBDA(int idx, bool unrl) {
|
||||
if (unrl) {
|
||||
auto offsets0 = offset_calc.get(idx);
|
||||
auto offsets1 = offset_calc.get(idx + grp_sz);
|
||||
auto offsets2 = offset_calc.get(idx + grp_sz * 2);
|
||||
auto offsets3 = offset_calc.get(idx + grp_sz * 3);
|
||||
void* out0 = data[0] + offsets0[0];
|
||||
void* out1 = data[0] + offsets1[0];
|
||||
void* out2 = data[0] + offsets2[0];
|
||||
void* out3 = data[0] + offsets3[0];
|
||||
arg0_t result0 = invoke(f, &data[1], &offsets0[1], &dtypes[1], 1);
|
||||
arg0_t result1 = invoke(f, &data[1], &offsets1[1], &dtypes[1], 1);
|
||||
arg0_t result2 = invoke(f, &data[1], &offsets2[1], &dtypes[1], 1);
|
||||
arg0_t result3 = invoke(f, &data[1], &offsets3[1], &dtypes[1], 1);
|
||||
c10::cast_and_store<arg0_t>(dtypes[0], out0, result0);
|
||||
c10::cast_and_store<arg0_t>(dtypes[0], out1, result1);
|
||||
c10::cast_and_store<arg0_t>(dtypes[0], out2, result2);
|
||||
c10::cast_and_store<arg0_t>(dtypes[0], out3, result3);
|
||||
} else {
|
||||
auto offsets = offset_calc.get(idx);
|
||||
void* out = data[0] + offsets[0];
|
||||
arg0_t result = invoke(f, &data[1], &offsets[1], &dtypes[1], 1);
|
||||
c10::cast_and_store<arg0_t>(dtypes[0], out, result);
|
||||
}
|
||||
});
|
||||
#else
|
||||
launch_legacy_kernel<128, 4>(numel, [=] GPU_LAMBDA(int idx) {
|
||||
auto offsets = offset_calc.get(idx);
|
||||
void* out = data[0] + offsets[0];
|
||||
arg0_t result = invoke(f, &data[1], &offsets[1], &dtypes[1], 1);
|
||||
c10::cast_and_store<arg0_t>(dtypes[0], out, result);
|
||||
});
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -125,6 +125,8 @@ Tensor& max_unpooling2d_forward_out_cuda(const Tensor& self_,
|
||||
TORCH_CHECK(
|
||||
indices_.scalar_type() == at::ScalarType::Long,
|
||||
"elements in indices should be type int64 but got: ", indices_.scalar_type());
|
||||
auto oheight = output_size[0];
|
||||
auto owidth = output_size[1];
|
||||
|
||||
TensorArg output_arg{output, "output", 1}, self_arg{self_, "self_", 2},
|
||||
indices_arg{indices_, "indices_", 3};
|
||||
@ -147,9 +149,6 @@ Tensor& max_unpooling2d_forward_out_cuda(const Tensor& self_,
|
||||
output_size.size() == 2,
|
||||
"There should be exactly two elements (height, width) in output_size, but got ", output_size.size(), " elements.");
|
||||
|
||||
auto oheight = output_size[0];
|
||||
auto owidth = output_size[1];
|
||||
|
||||
int64_t dimw = 2;
|
||||
int64_t dimh = 1;
|
||||
int64_t numBatch = 1;
|
||||
@ -218,6 +217,9 @@ static void max_unpooling3d_shape_check(
|
||||
IntArrayRef stride,
|
||||
IntArrayRef padding,
|
||||
const char *fn_name) {
|
||||
int64_t oT = output_size[0];
|
||||
int64_t oH = output_size[1];
|
||||
int64_t oW = output_size[2];
|
||||
TORCH_CHECK(
|
||||
indices.scalar_type() == at::ScalarType::Long,
|
||||
"elements in indices should be type int64 but got: ", indices.scalar_type());
|
||||
@ -248,10 +250,6 @@ static void max_unpooling3d_shape_check(
|
||||
"strides should be greater than zero, but got stride: ",
|
||||
stride);
|
||||
|
||||
int64_t oT = output_size[0];
|
||||
int64_t oH = output_size[1];
|
||||
int64_t oW = output_size[2];
|
||||
|
||||
int dimw = 3;
|
||||
int dimh = 2;
|
||||
int dimt = 1;
|
||||
@ -404,6 +402,8 @@ at::Tensor& max_unpooling2d_backward_out_cuda(const Tensor& grad_output_,
|
||||
const Tensor& indices_,
|
||||
IntArrayRef output_size,
|
||||
Tensor& grad_input) {
|
||||
int64_t oheight = output_size[0];
|
||||
int64_t owidth = output_size[1];
|
||||
TORCH_CHECK(grad_input.is_contiguous(), "grad_input must be contiguous");
|
||||
TORCH_CHECK(
|
||||
indices_.scalar_type() == at::ScalarType::Long,
|
||||
@ -426,9 +426,6 @@ at::Tensor& max_unpooling2d_backward_out_cuda(const Tensor& grad_output_,
|
||||
|
||||
TORCH_CHECK(output_size.size() == 2, "output_size must have two elements, got size: ", output_size.size());
|
||||
|
||||
int64_t oheight = output_size[0];
|
||||
int64_t owidth = output_size[1];
|
||||
|
||||
int64_t nInputCols, nInputRows, nInputPlane;
|
||||
|
||||
int dimw = 2;
|
||||
@ -508,14 +505,13 @@ at::Tensor& max_unpooling3d_backward_out_cuda(const Tensor& grad_output_,
|
||||
IntArrayRef padding,
|
||||
Tensor& grad_input) {
|
||||
TORCH_CHECK(grad_input.is_contiguous(), "grad_input must be contiguous");
|
||||
|
||||
max_unpooling3d_shape_check(
|
||||
self_, grad_output_, indices_, output_size, stride, padding, "max_unpooling3d_backward_out_cuda()");
|
||||
|
||||
int64_t oT = output_size[0];
|
||||
int64_t oH = output_size[1];
|
||||
int64_t oW = output_size[2];
|
||||
|
||||
max_unpooling3d_shape_check(
|
||||
self_, grad_output_, indices_, output_size, stride, padding, "max_unpooling3d_backward_out_cuda()");
|
||||
|
||||
int batchSize = 0;
|
||||
int inputSlices = 0;
|
||||
int inputTime = 0;
|
||||
|
||||
@ -300,6 +300,8 @@ void nonzero_static_cuda_out_impl(
|
||||
int64_t size,
|
||||
int64_t fill_value,
|
||||
Tensor& out) {
|
||||
#if defined(CUDA_VERSION) || defined(USE_ROCM)
|
||||
|
||||
Tensor self_contiguous_ = self.contiguous();
|
||||
// see comment in nonzero_cuda_out_impl on reqs for out
|
||||
bool out_correct_size =
|
||||
@ -375,6 +377,9 @@ void nonzero_static_cuda_out_impl(
|
||||
if (need_to_copy) {
|
||||
out.copy_(out_temp);
|
||||
}
|
||||
#else
|
||||
TORCH_CHECK(false, "Nonzero_static is not supported for cuda <= 11.4");
|
||||
#endif
|
||||
}
|
||||
|
||||
Tensor& nonzero_out_cuda(const Tensor& self, Tensor& out) {
|
||||
|
||||
@ -221,9 +221,22 @@ static const Tensor& _exec_fft(Tensor& out, const Tensor& self, IntArrayRef out_
|
||||
std::optional<CuFFTConfig> uncached_plan;
|
||||
const CuFFTConfig * config = nullptr;
|
||||
|
||||
// Workaround for gh-63152, gh-58724
|
||||
// Bluestein plans in CUDA 11.1 (cufft 10.3) cannot be re-used
|
||||
// Bluestein's algorithm is only used when a size has large prime factors,
|
||||
// sizes with only small prime factors can still be cached
|
||||
if (plan_cache.max_size() > 0) {
|
||||
bool use_caching = true;
|
||||
#ifdef CUFFT_VERSION
|
||||
if constexpr (10300 <= CUFFT_VERSION && CUFFT_VERSION < 10400) {
|
||||
// Only cache plans for transforms with small prime factors
|
||||
use_caching = std::none_of(
|
||||
signal_size.begin() + 1, signal_size.end(), [](int64_t dim_size) {
|
||||
return has_large_prime_factor(dim_size);
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
if (use_caching && plan_cache.max_size() > 0) {
|
||||
guard.lock();
|
||||
if (plan_cache.max_size() > 0) { // check again after acquiring the lock
|
||||
config = &plan_cache.lookup(Params);
|
||||
|
||||
@ -14,7 +14,7 @@ struct EmbeddingBagParams {
|
||||
::c10::metal::array<idx_type_t, 2> output_strides;
|
||||
::c10::metal::array<idx_type_t, 2> max_indices_strides;
|
||||
|
||||
idx_type_t per_sample_weights_stride;
|
||||
idx_type_t per_sample_weights_strides;
|
||||
|
||||
idx_type_t num_indices;
|
||||
idx_type_t num_bags;
|
||||
|
||||
@ -23,72 +23,54 @@ struct ReductionOpInit<EmbeddingBagMode::MAX, T> {
|
||||
template <EmbeddingBagMode M, typename T>
|
||||
struct ReductionOp {
|
||||
inline opmath_t<T> operator()(
|
||||
opmath_t<T> weight_val,
|
||||
T weight_val,
|
||||
opmath_t<T> out_val,
|
||||
bool is_first) {
|
||||
return weight_val + out_val;
|
||||
uint32_t per_sample_weights_index,
|
||||
constant T* per_sample_weights,
|
||||
uint32_t per_sample_weights_strides);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct ReductionOp<EmbeddingBagMode::SUM, T> {
|
||||
inline opmath_t<T> operator()(
|
||||
T weight_val,
|
||||
opmath_t<T> out_val,
|
||||
uint32_t per_sample_weights_index,
|
||||
constant T* per_sample_weights,
|
||||
uint32_t per_sample_weights_strides) {
|
||||
if (per_sample_weights_strides) {
|
||||
T per_sample_weight = per_sample_weights
|
||||
[per_sample_weights_strides * per_sample_weights_index];
|
||||
return static_cast<opmath_t<T>>(per_sample_weight) *
|
||||
static_cast<opmath_t<T>>(weight_val) +
|
||||
out_val;
|
||||
} else {
|
||||
return static_cast<opmath_t<T>>(weight_val) + out_val;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct ReductionOp<EmbeddingBagMode::MEAN, T> {
|
||||
inline opmath_t<T> operator()(
|
||||
T weight_val,
|
||||
opmath_t<T> out_val,
|
||||
uint32_t,
|
||||
constant T*,
|
||||
uint32_t) {
|
||||
return static_cast<opmath_t<T>>(weight_val) + out_val;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct ReductionOp<EmbeddingBagMode::MAX, T> {
|
||||
inline opmath_t<T> operator()(
|
||||
opmath_t<T> weight_val,
|
||||
T weight_val,
|
||||
opmath_t<T> out_val,
|
||||
bool is_first) {
|
||||
return (is_first || weight_val > out_val) ? weight_val : out_val;
|
||||
}
|
||||
};
|
||||
|
||||
template <EmbeddingBagMode M, typename T>
|
||||
struct MaybeApplyPerSampleWeight {
|
||||
inline opmath_t<T> operator()(
|
||||
opmath_t<T> weight_val,
|
||||
uint32_t per_sample_weights_index,
|
||||
constant T* per_sample_weights,
|
||||
uint32_t per_sample_weights_stride) {
|
||||
return weight_val;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct MaybeApplyPerSampleWeight<EmbeddingBagMode::SUM, T> {
|
||||
inline opmath_t<T> operator()(
|
||||
opmath_t<T> weight_val,
|
||||
uint32_t per_sample_weights_index,
|
||||
constant T* per_sample_weights,
|
||||
uint32_t per_sample_weights_stride) {
|
||||
if (per_sample_weights_stride) {
|
||||
T per_sample_weight = per_sample_weights
|
||||
[per_sample_weights_stride * per_sample_weights_index];
|
||||
return static_cast<opmath_t<T>>(per_sample_weight) * weight_val;
|
||||
} else {
|
||||
return weight_val;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <EmbeddingBagMode M, typename T, typename I>
|
||||
struct MaybeCalcMaxIndex {
|
||||
inline void operator()(
|
||||
opmath_t<T> weight_val,
|
||||
opmath_t<T> out_val,
|
||||
bool is_first,
|
||||
thread I& max_idx,
|
||||
I weight_idx,
|
||||
bool pad) {}
|
||||
};
|
||||
|
||||
template <typename T, typename I>
|
||||
struct MaybeCalcMaxIndex<EmbeddingBagMode::MAX, T, I> {
|
||||
inline void operator()(
|
||||
opmath_t<T> weight_val,
|
||||
opmath_t<T> out_val,
|
||||
bool is_first,
|
||||
thread I& max_idx,
|
||||
I weight_idx,
|
||||
bool pad) {
|
||||
max_idx = !pad && (is_first || weight_val > out_val) ? weight_idx : max_idx;
|
||||
uint32_t,
|
||||
constant T*,
|
||||
uint32_t) {
|
||||
return max(static_cast<opmath_t<T>>(weight_val), out_val);
|
||||
}
|
||||
};
|
||||
|
||||
@ -114,30 +96,6 @@ struct ReductionOpFinal<EmbeddingBagMode::MAX, T> {
|
||||
}
|
||||
};
|
||||
|
||||
template <EmbeddingBagMode M, typename I>
|
||||
struct MaybeWriteMaxIndex {
|
||||
inline void operator()(
|
||||
device I*,
|
||||
const constant ::c10::metal::array<uint32_t, 2>&,
|
||||
uint32_t,
|
||||
uint32_t,
|
||||
I) {}
|
||||
};
|
||||
|
||||
template <typename I>
|
||||
struct MaybeWriteMaxIndex<EmbeddingBagMode::MAX, I> {
|
||||
inline void operator()(
|
||||
device I* max_indices,
|
||||
const constant ::c10::metal::array<uint32_t, 2>& max_indices_strides,
|
||||
uint32_t bag_idx,
|
||||
uint32_t feature_idx,
|
||||
I max_idx) {
|
||||
max_indices
|
||||
[bag_idx * max_indices_strides[0] +
|
||||
feature_idx * max_indices_strides[1]] = max_idx;
|
||||
}
|
||||
};
|
||||
|
||||
template <EmbeddingBagMode M, typename T, typename I>
|
||||
void embedding_bag_impl(
|
||||
constant T* weight,
|
||||
@ -154,7 +112,7 @@ void embedding_bag_impl(
|
||||
auto num_bags = params.num_bags;
|
||||
auto feature_size = params.feature_size;
|
||||
auto padding_idx = params.padding_idx;
|
||||
auto per_sample_weights_stride = params.per_sample_weights_stride;
|
||||
auto per_sample_weights_strides = params.per_sample_weights_strides;
|
||||
constant auto& output_strides = params.output_strides;
|
||||
constant auto& weight_strides = params.weight_strides;
|
||||
constant auto& max_indices_strides = params.max_indices_strides;
|
||||
@ -162,6 +120,8 @@ void embedding_bag_impl(
|
||||
auto bag_idx = tid / feature_size;
|
||||
auto feature_idx = tid % feature_size;
|
||||
|
||||
output += bag_idx * output_strides[0] + feature_idx * output_strides[1];
|
||||
|
||||
uint32_t offsets_end = min(bag_idx + 1, num_bags - 1);
|
||||
bool is_last_bag = bag_idx + 1 == num_bags;
|
||||
uint32_t indices_start = static_cast<uint32_t>(offsets[bag_idx]);
|
||||
@ -171,37 +131,28 @@ void embedding_bag_impl(
|
||||
auto out_val = ReductionOpInit<M, T>()();
|
||||
|
||||
uint32_t bag_size_ = 0;
|
||||
I max_idx = 0;
|
||||
|
||||
for (uint32_t indices_idx = indices_start; indices_idx < indices_end;
|
||||
indices_idx++) {
|
||||
I weight_idx = indices[indices_idx];
|
||||
bool pad = (weight_idx == padding_idx);
|
||||
auto weight_val = static_cast<opmath_t<T>>(
|
||||
weight
|
||||
[static_cast<uint32_t>(weight_idx) * weight_strides[0] +
|
||||
feature_idx * weight_strides[1]]);
|
||||
T weight_val = weight
|
||||
[static_cast<uint32_t>(weight_idx) * weight_strides[0] +
|
||||
feature_idx * weight_strides[1]];
|
||||
|
||||
weight_val = MaybeApplyPerSampleWeight<M, T>()(
|
||||
weight_val, indices_idx, per_sample_weights, per_sample_weights_stride);
|
||||
|
||||
auto new_out_val = ReductionOp<M, T>()(weight_val, out_val, bag_size_ == 0);
|
||||
|
||||
MaybeCalcMaxIndex<M, T, I>()(
|
||||
weight_val, out_val, bag_size_ == 0, max_idx, weight_idx, pad);
|
||||
|
||||
out_val = pad ? out_val : new_out_val;
|
||||
offset2bag[indices_idx] = bag_idx;
|
||||
bag_size_ += static_cast<uint32_t>(!pad);
|
||||
|
||||
auto tmp_val = ReductionOp<M, T>()(
|
||||
weight_val,
|
||||
out_val,
|
||||
indices_idx,
|
||||
per_sample_weights,
|
||||
per_sample_weights_strides);
|
||||
|
||||
out_val = pad ? out_val : tmp_val;
|
||||
}
|
||||
|
||||
output[bag_idx * output_strides[0] + feature_idx * output_strides[1]] =
|
||||
ReductionOpFinal<M, T>()(out_val, bag_size_);
|
||||
|
||||
bag_size[bag_idx] = bag_size_;
|
||||
|
||||
MaybeWriteMaxIndex<M, I>()(
|
||||
max_indices, max_indices_strides, bag_idx, feature_idx, max_idx);
|
||||
*output = ReductionOpFinal<M, T>()(out_val, bag_size_);
|
||||
}
|
||||
|
||||
#define DISPATCH_IMPL(MODE) \
|
||||
|
||||
@ -198,7 +198,7 @@ static Tensor _mps_convolution_impl(const Tensor& input_t_,
|
||||
|
||||
if (input_t.is_contiguous(memory_format) && output_t.is_contiguous(memory_format) && is_macOS_15_0_or_newer) {
|
||||
inputNDArray = getMPSNDArray(input_t, inputShape);
|
||||
outputNDArray = getMPSNDArray(output_t, outputShape);
|
||||
outputNDArray = getMPSNDArray(*output, outputShape);
|
||||
}
|
||||
|
||||
auto cachedGraph = LookUpOrCreateCachedGraph<CachedGraph>(key, [&](auto mpsGraph, auto newCachedGraph) {
|
||||
@ -302,7 +302,7 @@ static Tensor _mps_convolution_impl(const Tensor& input_t_,
|
||||
}
|
||||
}
|
||||
auto outputPlaceholder = outputNDArray ? Placeholder(cachedGraph->outputTensor_, outputNDArray)
|
||||
: Placeholder(cachedGraph->outputTensor_, output_t);
|
||||
: Placeholder(cachedGraph->outputTensor_, *output);
|
||||
|
||||
NSMutableDictionary<MPSGraphTensor*, MPSGraphTensorData*>* feeds =
|
||||
[[[NSMutableDictionary alloc] initWithCapacity:3] autorelease];
|
||||
@ -315,7 +315,7 @@ static Tensor _mps_convolution_impl(const Tensor& input_t_,
|
||||
runMPSGraph(stream, cachedGraph->graph(), feeds, outputPlaceholder);
|
||||
}
|
||||
|
||||
return output_t;
|
||||
return *output;
|
||||
}
|
||||
|
||||
Tensor _mps_convolution(const Tensor& input_t,
|
||||
|
||||
@ -66,12 +66,11 @@ static std::tuple<Tensor, Tensor, Tensor, Tensor> _embedding_bag_mps_impl(
|
||||
int64_t num_indices = indices.size(0);
|
||||
int64_t num_bags = offsets.size(0);
|
||||
if (include_last_offset) {
|
||||
TORCH_CHECK(num_bags >= 1, "include_last_offset: number of offsets should be at least 1");
|
||||
num_bags -= 1;
|
||||
}
|
||||
int64_t feature_size = weight.size(1);
|
||||
|
||||
auto bag_size = at::empty({num_bags}, indices.options());
|
||||
auto bag_size = at::empty(offsets.sizes(), indices.options());
|
||||
auto offset2bag = at::empty({indices.size(0)}, indices.options());
|
||||
auto output = at::empty({num_bags, feature_size}, weight.options());
|
||||
|
||||
@ -95,7 +94,7 @@ static std::tuple<Tensor, Tensor, Tensor, Tensor> _embedding_bag_mps_impl(
|
||||
}
|
||||
|
||||
bool use_per_sample_weights = per_sample_weights_opt.has_value() && per_sample_weights_opt->defined();
|
||||
params.per_sample_weights_stride = use_per_sample_weights ? per_sample_weights_opt->stride(0) : 0;
|
||||
params.per_sample_weights_strides = use_per_sample_weights ? per_sample_weights_opt->stride(0) : 0;
|
||||
|
||||
params.num_indices = num_indices;
|
||||
params.num_bags = num_bags;
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
#include <ATen/ops/baddbmm_native.h>
|
||||
#include <ATen/ops/bmm_native.h>
|
||||
#include <ATen/ops/cholesky_native.h>
|
||||
#include <ATen/ops/eye_native.h>
|
||||
#include <ATen/ops/linalg_cholesky_ex_native.h>
|
||||
#include <ATen/ops/linalg_inv_ex_native.h>
|
||||
#include <ATen/ops/linalg_lu_factor_ex_native.h>
|
||||
@ -497,24 +496,26 @@ static void linalg_inv_ex_out_mps_impl(const Tensor& A, bool check_errors, const
|
||||
using namespace mps;
|
||||
TORCH_CHECK(result.is_mps(), "Output tensor is not MPS");
|
||||
TORCH_CHECK(!A.is_complex(), "linalg_inv: not supported for complex types yet!");
|
||||
using CachedGraph = MPSUnaryCachedGraph;
|
||||
|
||||
MPSStream* stream = getCurrentMPSStream();
|
||||
info.zero_();
|
||||
|
||||
if (A.numel() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!result.is_contiguous()) {
|
||||
result.unsafeGetTensorImpl()->empty_tensor_restride(MemoryFormat::Contiguous);
|
||||
}
|
||||
auto A_sizes = A.sizes();
|
||||
int ndim = A.dim();
|
||||
|
||||
Tensor LU = empty_like(A, MemoryFormat::Contiguous);
|
||||
Tensor identity = eye(A.size(-2), A.size(-1), A.scalar_type(), A.options().layout(), A.device()).expand_as(A);
|
||||
Tensor LU = empty_like(A);
|
||||
Tensor identity = zeros_like(A);
|
||||
Tensor pivots = empty({A_sizes.begin(), A_sizes.end() - 1}, A.options().dtype(kInt));
|
||||
// need to do this to keep the strides of the result tensor
|
||||
// mps's solve expects row major layout, while inductor
|
||||
// expects result to be column major
|
||||
Tensor tmp = empty_like(A, MemoryFormat::Contiguous);
|
||||
linalg_solve_out_mps_impl(A, identity, true, check_errors, tmp, LU, pivots, info);
|
||||
result.copy_(tmp);
|
||||
(ndim == 2 ? identity.diagonal() : identity.diagonal(0, -2, -1)).fill_(1);
|
||||
linalg_solve_out_mps_impl(A, identity, true, check_errors, result, LU, pivots, info);
|
||||
}
|
||||
|
||||
static Tensor& mm_out_mps_impl(const Tensor& self, const Tensor& other, Tensor& output) {
|
||||
|
||||
@ -519,13 +519,6 @@ static void max_unpool_out_mps_template(const Tensor& input,
|
||||
Tensor& output,
|
||||
const int32_t pooling_dims,
|
||||
const std::string& op_name) {
|
||||
TORCH_CHECK(output_size_.size() == static_cast<size_t>(pooling_dims),
|
||||
op_name,
|
||||
"There should be exactly ",
|
||||
pooling_dims,
|
||||
" elements but got ",
|
||||
output_size_.size());
|
||||
|
||||
auto dims = input.dim();
|
||||
auto leading_dims = input.dim() - pooling_dims;
|
||||
|
||||
|
||||
@ -3858,7 +3858,7 @@
|
||||
device_check: NoCheck # TensorIterator
|
||||
structured: True
|
||||
dispatch:
|
||||
CPU, CUDA, MTIA: aminmax_out
|
||||
CPU, CUDA: aminmax_out
|
||||
MPS: aminmax_out_mps
|
||||
|
||||
- func: _compute_linear_combination(Tensor input, Tensor coefficients) -> Tensor
|
||||
@ -3909,7 +3909,7 @@
|
||||
- func: amax.out(Tensor self, int[1] dim=[], bool keepdim=False, *, Tensor(a!) out) -> Tensor(a!)
|
||||
structured: True
|
||||
dispatch:
|
||||
CPU, CUDA, MTIA: amax_out
|
||||
CPU, CUDA: amax_out
|
||||
MPS: amax_out_mps
|
||||
|
||||
# Return: (Tensor output, Tensor indices)
|
||||
@ -4090,7 +4090,7 @@
|
||||
- func: amin.out(Tensor self, int[1] dim=[], bool keepdim=False, *, Tensor(a!) out) -> Tensor(a!)
|
||||
structured: True
|
||||
dispatch:
|
||||
CPU, CUDA, MTIA: amin_out
|
||||
CPU, CUDA: amin_out
|
||||
MPS: amin_out_mps
|
||||
|
||||
# TODO: Add this function to MPS dispatch key so that we avoid declaring it in
|
||||
|
||||
@ -158,46 +158,12 @@ c10::intrusive_ptr<EmbeddingPackedParamsBase> PackedEmbeddingBagWeight::prepack(
|
||||
return packed_ptr;
|
||||
}
|
||||
|
||||
#ifdef USE_FBGEMM
|
||||
namespace {
|
||||
/// Number of columns in the rowwise min/max buffer passed to the quantization function(s)
|
||||
constexpr int kRowwiseMinMaxNumCols = 2;
|
||||
|
||||
bool _validate_rowwise_min_max(
|
||||
const at::Tensor& weight,
|
||||
const std::optional<at::Tensor>& rowwise_min_max_opt) {
|
||||
const auto is_valid_rowwise_min_max = rowwise_min_max_opt.has_value();
|
||||
|
||||
if (is_valid_rowwise_min_max) {
|
||||
TORCH_CHECK(
|
||||
(rowwise_min_max_opt->dim() == 2 &&
|
||||
rowwise_min_max_opt->size(0) == weight.size(0) &&
|
||||
rowwise_min_max_opt->size(1) == kRowwiseMinMaxNumCols),
|
||||
"'rowwise_min_max' must be a 2D tensor with shape [num_rows(weight), 2].");
|
||||
}
|
||||
|
||||
return is_valid_rowwise_min_max;
|
||||
}
|
||||
|
||||
auto _get_rowwise_min_max_contig(
|
||||
const std::optional<at::Tensor>& rowwise_min_max_opt) {
|
||||
return rowwise_min_max_opt.has_value()
|
||||
? rowwise_min_max_opt->expect_contiguous(rowwise_min_max_opt->suggest_memory_format())
|
||||
: at::borrow_from_optional_tensor(rowwise_min_max_opt);
|
||||
}
|
||||
}
|
||||
#endif // USE_FBGEMM
|
||||
|
||||
namespace at::native {
|
||||
|
||||
// Note - This is a temporary pack function for embedding bag which quantizes
|
||||
// and packs the float weight tensor. In the next step it will be replaced by a
|
||||
// quantize and pack function once we support FP scale and FP zero_point
|
||||
//
|
||||
// The optional rowwise_min_max argument is to support callers to pass in the min/max
|
||||
// values of the weight tensor. If the rowwise_min_max is not provided, the min/max
|
||||
// values will be computed from the weight tensor.
|
||||
//
|
||||
// Python example examining a packed 8bit zero_point and scale:
|
||||
//
|
||||
// >> x = torch.from_numpy(np.array([[[10, 20], [30, 40]],[[50, 60], [70, 80]]],
|
||||
@ -255,10 +221,7 @@ namespace at::native {
|
||||
//
|
||||
// [[50. , 60.00000035],
|
||||
// [70. , 80.00000035]]])
|
||||
Tensor& qembeddingbag_byte_prepack_out(
|
||||
Tensor& output,
|
||||
const Tensor& weight,
|
||||
const std::optional<Tensor>& rowwise_min_max_opt) {
|
||||
Tensor& qembeddingbag_byte_prepack_out(Tensor& output, const Tensor& weight) {
|
||||
// The "last" dimension of an N-Dimensioned batch of embedding bags is
|
||||
// quantization channel. E.g. for a 2D embedding bag, this has
|
||||
// [ row, col ] dimensions, for batched of embedding bags, dimensions might be
|
||||
@ -293,16 +256,9 @@ Tensor& qembeddingbag_byte_prepack_out(
|
||||
auto* output_data = output.data_ptr<uint8_t>();
|
||||
|
||||
#ifdef USE_FBGEMM
|
||||
// Move these outside of the ifdef when we support non-FBGEMM flow.
|
||||
const auto is_valid_rowwise_min_max = _validate_rowwise_min_max(weight, rowwise_min_max_opt);
|
||||
const auto rowwise_min_max_contig = _get_rowwise_min_max_contig(rowwise_min_max_opt);
|
||||
|
||||
if (weight_contig->scalar_type() == at::ScalarType::Half) {
|
||||
const auto weight_data =
|
||||
static_cast<fbgemm::float16*>(weight_contig->data_ptr());
|
||||
const auto rowwise_min_max_data = is_valid_rowwise_min_max
|
||||
? static_cast<fbgemm::float16*>(rowwise_min_max_contig->data_ptr())
|
||||
: nullptr;
|
||||
at::parallel_for(
|
||||
0, embedding_rows, 1, [&](int64_t start_idx, int64_t end_idx) {
|
||||
fbgemm::FloatOrHalfToFused8BitRowwiseQuantizedSBFloat<
|
||||
@ -310,21 +266,17 @@ Tensor& qembeddingbag_byte_prepack_out(
|
||||
weight_data + start_idx * embedding_cols,
|
||||
end_idx - start_idx,
|
||||
embedding_cols,
|
||||
output_data + start_idx * output_columns,
|
||||
(is_valid_rowwise_min_max ? (rowwise_min_max_data + start_idx * kRowwiseMinMaxNumCols) : nullptr));
|
||||
output_data + start_idx * output_columns);
|
||||
});
|
||||
} else {
|
||||
const auto weight_data = weight_contig->data_ptr<float>();
|
||||
const auto rowwise_min_max_data =
|
||||
is_valid_rowwise_min_max ? rowwise_min_max_contig->data_ptr<float>() : nullptr;
|
||||
at::parallel_for(
|
||||
0, embedding_rows, 1, [&](int64_t start_idx, int64_t end_idx) {
|
||||
fbgemm::FloatOrHalfToFused8BitRowwiseQuantizedSBFloat<float>(
|
||||
weight_data + start_idx * embedding_cols,
|
||||
end_idx - start_idx,
|
||||
embedding_cols,
|
||||
output_data + start_idx * output_columns,
|
||||
(is_valid_rowwise_min_max ? (rowwise_min_max_data + start_idx * kRowwiseMinMaxNumCols) : nullptr));
|
||||
output_data + start_idx * output_columns);
|
||||
});
|
||||
}
|
||||
|
||||
@ -374,22 +326,6 @@ Tensor qembeddingbag_byte_prepack(const Tensor& weight) {
|
||||
return output;
|
||||
}
|
||||
|
||||
static Tensor qembeddingbag_byte_prepack_with_rowwise_min_max(
|
||||
const Tensor& weight,
|
||||
const Tensor& rowwise_min_max) {
|
||||
const auto weight_contig =
|
||||
weight.expect_contiguous(weight.suggest_memory_format());
|
||||
Tensor output = at::detail::empty_cpu(
|
||||
{0},
|
||||
at::kByte,
|
||||
weight_contig->layout(),
|
||||
weight_contig->device(),
|
||||
std::nullopt,
|
||||
std::nullopt);
|
||||
qembeddingbag_byte_prepack_out(output, weight, rowwise_min_max);
|
||||
return output;
|
||||
}
|
||||
|
||||
Tensor qembeddingbag_byte_prepack_meta(const Tensor& weight) {
|
||||
const auto weight_contig =
|
||||
weight.expect_contiguous(weight.suggest_memory_format());
|
||||
@ -399,7 +335,7 @@ Tensor qembeddingbag_byte_prepack_meta(const Tensor& weight) {
|
||||
"'embedding_bag_byte_prepack' only support float32 or float16.");
|
||||
const auto weight_sizes = weight.sym_sizes();
|
||||
const auto cols_dim = weight.ndimension() - 1;
|
||||
const auto& embedding_cols = weight_sizes[cols_dim];
|
||||
const auto embedding_cols = weight_sizes[cols_dim];
|
||||
// Add 8 bytes per column to store FP32 scale and zero_point per row.
|
||||
const auto output_columns = embedding_cols + 2 * sizeof(float);
|
||||
|
||||
@ -423,8 +359,7 @@ Tensor _qembeddingbag_nbit_prepack_helper(
|
||||
int bit_width,
|
||||
const bool optimized_qparams,
|
||||
const int64_t nbins,
|
||||
const double ratio,
|
||||
const std::optional<Tensor>& rowwise_min_max_opt = std::nullopt) {
|
||||
const double ratio) {
|
||||
TORCH_CHECK(
|
||||
weight.scalar_type() == at::ScalarType::Float ||
|
||||
weight.scalar_type() == at::ScalarType::Half,
|
||||
@ -466,17 +401,10 @@ Tensor _qembeddingbag_nbit_prepack_helper(
|
||||
auto* output_data = output.data_ptr<uint8_t>();
|
||||
|
||||
#ifdef USE_FBGEMM
|
||||
// Move these outside of the ifdef when we support non-FBGEMM flow.
|
||||
const auto is_valid_rowwise_min_max = _validate_rowwise_min_max(weight, rowwise_min_max_opt);
|
||||
const auto rowwise_min_max_contig = _get_rowwise_min_max_contig(rowwise_min_max_opt);
|
||||
|
||||
if (!optimized_qparams) {
|
||||
if (weight_contig.scalar_type() == at::ScalarType::Half) {
|
||||
const auto weight_data =
|
||||
static_cast<fbgemm::float16*>(weight_contig.data_ptr());
|
||||
const auto rowwise_min_max_data = is_valid_rowwise_min_max
|
||||
? static_cast<fbgemm::float16*>(rowwise_min_max_contig->data_ptr())
|
||||
: nullptr;
|
||||
at::parallel_for(
|
||||
0, embedding_rows, 1, [&](int64_t start_idx, int64_t end_idx) {
|
||||
fbgemm::FloatOrHalfToFusedNBitRowwiseQuantizedSBHalf<
|
||||
@ -485,13 +413,10 @@ Tensor _qembeddingbag_nbit_prepack_helper(
|
||||
weight_data + start_idx * embedding_cols,
|
||||
end_idx - start_idx,
|
||||
static_cast<int>(embedding_cols),
|
||||
output_data + start_idx * output_shape[1],
|
||||
(is_valid_rowwise_min_max ? (rowwise_min_max_data + start_idx * kRowwiseMinMaxNumCols) : nullptr));
|
||||
output_data + start_idx * output_shape[1]);
|
||||
});
|
||||
} else {
|
||||
const auto weight_data = weight_contig.data_ptr<float>();
|
||||
const auto rowwise_min_max_data =
|
||||
is_valid_rowwise_min_max ? rowwise_min_max_contig->data_ptr<float>() : nullptr;
|
||||
at::parallel_for(
|
||||
0, embedding_rows, 1, [&](int64_t start_idx, int64_t end_idx) {
|
||||
fbgemm::FloatOrHalfToFusedNBitRowwiseQuantizedSBHalf<float>(
|
||||
@ -499,8 +424,7 @@ Tensor _qembeddingbag_nbit_prepack_helper(
|
||||
weight_data + start_idx * embedding_cols,
|
||||
end_idx - start_idx,
|
||||
static_cast<int>(embedding_cols),
|
||||
output_data + start_idx * output_shape[1],
|
||||
(is_valid_rowwise_min_max ? (rowwise_min_max_data + start_idx * kRowwiseMinMaxNumCols) : nullptr));
|
||||
output_data + start_idx * output_shape[1]);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
@ -590,16 +514,6 @@ Tensor qembeddingbag_4bit_prepack(
|
||||
weight, 4 /*bit_width*/, optimized_qparams, nbins, ratio);
|
||||
}
|
||||
|
||||
Tensor qembeddingbag_4bit_prepack_with_rowwise_min_max(
|
||||
const Tensor& weight,
|
||||
const Tensor& rowwise_min_max,
|
||||
const bool optimized_qparams,
|
||||
const int64_t nbins,
|
||||
const double ratio) {
|
||||
return _qembeddingbag_nbit_prepack_helper(
|
||||
weight, 4 /*bit_width*/, optimized_qparams, nbins, ratio, rowwise_min_max);
|
||||
}
|
||||
|
||||
// Applies 2-bit row-wise quantization by determining the range
|
||||
// (maximum - minimum) and bias (minimum value) of each row in the input
|
||||
// matrix, and then scaling each element to an 2-bit number between 0 and
|
||||
@ -617,16 +531,6 @@ Tensor qembeddingbag_2bit_prepack(
|
||||
weight, 2 /*bit_width*/, optimized_qparams, nbins, ratio);
|
||||
}
|
||||
|
||||
Tensor qembeddingbag_2bit_prepack_with_rowwise_min_max(
|
||||
const Tensor& weight,
|
||||
const Tensor& rowwise_min_max,
|
||||
const bool optimized_qparams,
|
||||
const int64_t nbins,
|
||||
const double ratio) {
|
||||
return _qembeddingbag_nbit_prepack_helper(
|
||||
weight, 2 /*bit_width*/, optimized_qparams, nbins, ratio, rowwise_min_max);
|
||||
}
|
||||
|
||||
class QEmbeddingPackWeights final {
|
||||
public:
|
||||
static c10::intrusive_ptr<EmbeddingPackedParamsBase> run(const at::Tensor& weight) {
|
||||
@ -638,21 +542,12 @@ TORCH_LIBRARY_IMPL(quantized, CPU, m) {
|
||||
m.impl(
|
||||
TORCH_SELECTIVE_NAME("quantized::embedding_bag_byte_prepack"),
|
||||
TORCH_FN(qembeddingbag_byte_prepack));
|
||||
m.impl(
|
||||
TORCH_SELECTIVE_NAME("quantized::embedding_bag_byte_prepack_with_rowwise_min_max"),
|
||||
TORCH_FN(qembeddingbag_byte_prepack_with_rowwise_min_max));
|
||||
m.impl(
|
||||
TORCH_SELECTIVE_NAME("quantized::embedding_bag_4bit_prepack"),
|
||||
TORCH_FN(qembeddingbag_4bit_prepack));
|
||||
m.impl(
|
||||
TORCH_SELECTIVE_NAME("quantized::embedding_bag_4bit_prepack_with_rowwise_min_max"),
|
||||
TORCH_FN(qembeddingbag_4bit_prepack_with_rowwise_min_max));
|
||||
m.impl(
|
||||
TORCH_SELECTIVE_NAME("quantized::embedding_bag_2bit_prepack"),
|
||||
TORCH_FN(qembeddingbag_2bit_prepack));
|
||||
m.impl(
|
||||
TORCH_SELECTIVE_NAME("quantized::embedding_bag_2bit_prepack_with_rowwise_min_max"),
|
||||
TORCH_FN(qembeddingbag_2bit_prepack_with_rowwise_min_max));
|
||||
}
|
||||
|
||||
TORCH_LIBRARY_IMPL(quantized, QuantizedCPU, m) {
|
||||
|
||||
@ -3,10 +3,7 @@
|
||||
|
||||
namespace at::native {
|
||||
|
||||
Tensor& qembeddingbag_byte_prepack_out(
|
||||
Tensor& output,
|
||||
const Tensor& weight,
|
||||
const std::optional<Tensor>& rowwise_min_max_opt = std::nullopt);
|
||||
Tensor& qembeddingbag_byte_prepack_out(Tensor& output, const Tensor& weight);
|
||||
|
||||
Tensor qembeddingbag_byte_prepack(const Tensor& weight);
|
||||
|
||||
|
||||
@ -121,12 +121,9 @@ TORCH_LIBRARY(quantized, m) {
|
||||
m.def(TORCH_SELECTIVE_SCHEMA("quantized::embedding_bag_unpack(__torch__.torch.classes.quantized.EmbeddingPackedParamsBase W_prepack) -> Tensor W_origin"), {at::Tag::pt2_compliant_tag});
|
||||
m.def(TORCH_SELECTIVE_SCHEMA("quantized::embedding_bag_byte_prepack(Tensor weight) -> Tensor"), {at::Tag::pt2_compliant_tag});
|
||||
m.def(TORCH_SELECTIVE_SCHEMA("quantized::embedding_bag_byte_unpack(Tensor weight) -> Tensor"), {at::Tag::pt2_compliant_tag});
|
||||
m.def(TORCH_SELECTIVE_SCHEMA("quantized::embedding_bag_byte_prepack_with_rowwise_min_max(Tensor weight, Tensor rowwise_min_max) -> Tensor"), {at::Tag::pt2_compliant_tag});
|
||||
m.def(TORCH_SELECTIVE_SCHEMA("quantized::embedding_bag_4bit_prepack(Tensor weight, bool optimized_qparams=False, int nbins=200, float ratio=0.16) -> Tensor"), {at::Tag::pt2_compliant_tag});
|
||||
m.def(TORCH_SELECTIVE_SCHEMA("quantized::embedding_bag_4bit_prepack_with_rowwise_min_max(Tensor weight, Tensor rowwise_min_max, bool optimized_qparams=False, int nbins=200, float ratio=0.16) -> Tensor"), {at::Tag::pt2_compliant_tag});
|
||||
m.def(TORCH_SELECTIVE_SCHEMA("quantized::embedding_bag_4bit_unpack(Tensor weight) -> Tensor"), {at::Tag::pt2_compliant_tag});
|
||||
m.def(TORCH_SELECTIVE_SCHEMA("quantized::embedding_bag_2bit_prepack(Tensor weight, bool optimized_qparams=False, int nbins=200, float ratio=0.16) -> Tensor"), {at::Tag::pt2_compliant_tag});
|
||||
m.def(TORCH_SELECTIVE_SCHEMA("quantized::embedding_bag_2bit_prepack_with_rowwise_min_max(Tensor weight, Tensor rowwise_min_max, bool optimized_qparams=False, int nbins=200, float ratio=0.16) -> Tensor"), {at::Tag::pt2_compliant_tag});
|
||||
m.def(TORCH_SELECTIVE_SCHEMA("quantized::embedding_bag_2bit_unpack(Tensor weight) -> Tensor"), {at::Tag::pt2_compliant_tag});
|
||||
m.def(TORCH_SELECTIVE_SCHEMA("quantized::embedding_bag_byte_rowwise_offsets(Tensor weight, Tensor indices, Tensor? offsets=None, bool scale_grad_by_freq=False, int mode=0, bool pruned_weights=False, Tensor? per_sample_weights=None, Tensor? compressed_indices_mapping=None, bool include_last_offset=False) -> Tensor"), {at::Tag::pt2_compliant_tag});
|
||||
m.def(TORCH_SELECTIVE_SCHEMA("quantized::embedding_bag_4bit_rowwise_offsets(Tensor weight, Tensor indices, Tensor? offsets=None, bool scale_grad_by_freq=False, int mode=0, bool pruned_weights=False, Tensor? per_sample_weights=None, Tensor? compressed_indices_mapping=None, bool include_last_offset=False) -> Tensor"), {at::Tag::pt2_compliant_tag});
|
||||
|
||||
@ -120,7 +120,7 @@ at::Tensor _cslt_compress(const Tensor& sparse_input) {
|
||||
// buffer (in bytes)
|
||||
size_t orig_m = sparse_input.size(0);
|
||||
size_t div = orig_m * sparse_input.itemsize();
|
||||
size_t new_n = (compressed_size + div - 1) / div; // ceil(s,d) = (s+d-1)/d
|
||||
size_t new_n = (compressed_size + div - 1) / div; // floor
|
||||
auto compressed_tensor = sparse_input.new_empty({(int64_t)orig_m, (int64_t)new_n});
|
||||
|
||||
auto& allocator = *::c10::cuda::CUDACachingAllocator::get();
|
||||
@ -155,7 +155,7 @@ std::tuple<at::Tensor, int64_t, int64_t, int64_t, int64_t> _cslt_sparse_mm_impl(
|
||||
TORCH_CUDASPARSE_CHECK(cusparseLtInit(&handle));
|
||||
handle_initialized = true;
|
||||
}
|
||||
// cuSPARSELt constructs
|
||||
// cupsarselt constructs
|
||||
cusparseLtMatmulDescriptor_t matmul;
|
||||
cusparseLtMatmulPlan_t plan;
|
||||
cusparseLtMatmulAlgSelection_t alg_sel;
|
||||
|
||||
@ -2,12 +2,22 @@
|
||||
|
||||
// ${generated_comment}
|
||||
|
||||
#include <ATen/FunctionalStorageImpl.h>
|
||||
#include <ATen/Tensor.h>
|
||||
|
||||
namespace at {
|
||||
namespace functionalization {
|
||||
|
||||
enum class InverseReturnMode {
|
||||
/// Specifies that functional inverses should always return a view.
|
||||
AlwaysView,
|
||||
/// Specifies that functional inverses should always return a non-view / copy.
|
||||
NeverView,
|
||||
/// Specifies that functional inverses should return a view unless a (copying) scatter
|
||||
/// inverse exists, in which case that will be used instead.
|
||||
/// This avoids as_strided() calls that can be difficult for subclasses to handle.
|
||||
ViewOrScatterInverse,
|
||||
};
|
||||
|
||||
struct FunctionalInverses {
|
||||
|
||||
${view_inverse_declarations}
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#include <ATen/core/LegacyTypeDispatch.h>
|
||||
#include <ATen/EmptyTensor.h>
|
||||
#include <ATen/FunctionalTensorWrapper.h>
|
||||
#include <ATen/ViewMetaClasses.h>
|
||||
#include <ATen/FunctionalInverses.h>
|
||||
#include <ATen/MemoryOverlap.h>
|
||||
#include <torch/library.h>
|
||||
|
||||
|
||||
@ -1,19 +0,0 @@
|
||||
// ${generated_comment}
|
||||
|
||||
#include <ATen/FunctionalInverses.h>
|
||||
#include <ATen/ViewMetaClasses.h>
|
||||
|
||||
#ifndef AT_PER_OPERATOR_HEADERS
|
||||
#include <ATen/Operators.h>
|
||||
#include <ATen/NativeFunctions.h>
|
||||
#else
|
||||
${op_headers}
|
||||
#endif
|
||||
|
||||
namespace at {
|
||||
namespace functionalization {
|
||||
|
||||
${view_meta_implementations}
|
||||
|
||||
} // namespace functionalization
|
||||
} // namespace at
|
||||
@ -1,12 +0,0 @@
|
||||
#define TORCH_ASSERT_ONLY_METHOD_OPERATORS
|
||||
// ${generated_comment}
|
||||
|
||||
#include <ATen/FunctionalStorageImpl.h>
|
||||
|
||||
namespace at {
|
||||
namespace functionalization {
|
||||
|
||||
${view_meta_declarations}
|
||||
|
||||
} // namespace functionalization
|
||||
} // namespace at
|
||||
@ -1,11 +0,0 @@
|
||||
#include <ATen/ViewMetaClasses.h>
|
||||
#include <torch/csrc/functionalization/Module.h>
|
||||
|
||||
namespace torch::functionalization {
|
||||
|
||||
void initGenerated(PyObject* module) {
|
||||
auto functionalization = py::handle(module).cast<py::module>();
|
||||
$view_meta_bindings
|
||||
}
|
||||
|
||||
} // namespace torch::functionalization
|
||||
@ -78,8 +78,6 @@ def check_accuracy(actual_csv, expected_csv, expected_filename):
|
||||
"google/gemma-3-4b-it",
|
||||
"openai/whisper-tiny",
|
||||
"Qwen/Qwen3-0.6B",
|
||||
"mistralai/Mistral-7B-Instruct-v0.3",
|
||||
"openai/gpt-oss-20b",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@ -61,8 +61,6 @@ def check_graph_breaks(actual_csv, expected_csv, expected_filename):
|
||||
"google/gemma-3-4b-it",
|
||||
"openai/whisper-tiny",
|
||||
"Qwen/Qwen3-0.6B",
|
||||
"mistralai/Mistral-7B-Instruct-v0.3",
|
||||
"openai/gpt-oss-20b",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@ -191,11 +191,3 @@ openai/whisper-tiny,pass,0
|
||||
|
||||
|
||||
Qwen/Qwen3-0.6B,pass,0
|
||||
|
||||
|
||||
|
||||
mistralai/Mistral-7B-Instruct-v0.3,pass,0
|
||||
|
||||
|
||||
|
||||
openai/gpt-oss-20b,pass,0
|
||||
|
||||
|
@ -187,11 +187,3 @@ openai/whisper-tiny,fail_to_run,0
|
||||
|
||||
|
||||
Qwen/Qwen3-0.6B,fail_to_run,0
|
||||
|
||||
|
||||
|
||||
mistralai/Mistral-7B-Instruct-v0.3,fail_to_run,0
|
||||
|
||||
|
||||
|
||||
openai/gpt-oss-20b,fail_to_run,0
|
||||
|
||||
|
@ -191,11 +191,3 @@ openai/whisper-tiny,pass_due_to_skip,0
|
||||
|
||||
|
||||
Qwen/Qwen3-0.6B,pass_due_to_skip,0
|
||||
|
||||
|
||||
|
||||
mistralai/Mistral-7B-Instruct-v0.3,pass_due_to_skip,0
|
||||
|
||||
|
||||
|
||||
openai/gpt-oss-20b,pass_due_to_skip,0
|
||||
|
||||
|
@ -191,11 +191,3 @@ openai/whisper-tiny,pass_due_to_skip,0
|
||||
|
||||
|
||||
Qwen/Qwen3-0.6B,pass_due_to_skip,0
|
||||
|
||||
|
||||
|
||||
mistralai/Mistral-7B-Instruct-v0.3,pass_due_to_skip,0
|
||||
|
||||
|
||||
|
||||
openai/gpt-oss-20b,pass_due_to_skip,0
|
||||
|
||||
|
@ -191,11 +191,3 @@ openai/whisper-tiny,pass_due_to_skip,0
|
||||
|
||||
|
||||
Qwen/Qwen3-0.6B,pass_due_to_skip,0
|
||||
|
||||
|
||||
|
||||
mistralai/Mistral-7B-Instruct-v0.3,pass_due_to_skip,0
|
||||
|
||||
|
||||
|
||||
openai/gpt-oss-20b,pass_due_to_skip,0
|
||||
|
||||
|
@ -191,11 +191,3 @@ openai/whisper-tiny,pass,0
|
||||
|
||||
|
||||
Qwen/Qwen3-0.6B,pass,0
|
||||
|
||||
|
||||
|
||||
mistralai/Mistral-7B-Instruct-v0.3,pass,0
|
||||
|
||||
|
||||
|
||||
openai/gpt-oss-20b,pass,0
|
||||
|
||||
|
@ -191,11 +191,3 @@ openai/whisper-tiny,pass,0
|
||||
|
||||
|
||||
Qwen/Qwen3-0.6B,pass,0
|
||||
|
||||
|
||||
|
||||
mistralai/Mistral-7B-Instruct-v0.3,pass,0
|
||||
|
||||
|
||||
|
||||
openai/gpt-oss-20b,pass,0
|
||||
|
||||
|
@ -191,11 +191,3 @@ openai/whisper-tiny,pass,0
|
||||
|
||||
|
||||
Qwen/Qwen3-0.6B,pass,0
|
||||
|
||||
|
||||
|
||||
mistralai/Mistral-7B-Instruct-v0.3,pass,0
|
||||
|
||||
|
||||
|
||||
openai/gpt-oss-20b,pass,0
|
||||
|
||||
|
@ -191,11 +191,3 @@ openai/whisper-tiny,pass,0
|
||||
|
||||
|
||||
Qwen/Qwen3-0.6B,pass,0
|
||||
|
||||
|
||||
|
||||
mistralai/Mistral-7B-Instruct-v0.3,pass,0
|
||||
|
||||
|
||||
|
||||
openai/gpt-oss-20b,pass,0
|
||||
|
||||
|
@ -191,11 +191,3 @@ openai/whisper-tiny,pass,0
|
||||
|
||||
|
||||
Qwen/Qwen3-0.6B,pass,0
|
||||
|
||||
|
||||
|
||||
mistralai/Mistral-7B-Instruct-v0.3,pass,0
|
||||
|
||||
|
||||
|
||||
openai/gpt-oss-20b,pass,0
|
||||
|
||||
|
@ -11,8 +11,6 @@ skip:
|
||||
- GPTJForQuestionAnswering
|
||||
# Model too big
|
||||
- google/gemma-3-4b-it
|
||||
- openai/gpt-oss-20b
|
||||
- mistralai/Mistral-7B-Instruct-v0.3
|
||||
|
||||
device:
|
||||
cpu:
|
||||
@ -21,8 +19,6 @@ skip:
|
||||
- google/gemma-3-4b-it
|
||||
- openai/whisper-tiny
|
||||
- Qwen/Qwen3-0.6B
|
||||
- mistralai/Mistral-7B-Instruct-v0.3
|
||||
- openai/gpt-oss-20b
|
||||
|
||||
control_flow:
|
||||
- AllenaiLongformerBase
|
||||
@ -83,8 +79,6 @@ batch_size:
|
||||
google/gemma-3-4b-it: 8
|
||||
openai/whisper-tiny: 8
|
||||
Qwen/Qwen3-0.6B: 8
|
||||
mistralai/Mistral-7B-Instruct-v0.3: 8
|
||||
openai/gpt-oss-20b: 8
|
||||
|
||||
|
||||
tolerance:
|
||||
|
||||
@ -99,6 +99,4 @@ HF_LLM_MODELS: dict[str, Benchmark] = {
|
||||
"google/gemma-3-4b-it": TextGenerationBenchmark,
|
||||
"openai/whisper-tiny": WhisperBenchmark,
|
||||
"Qwen/Qwen3-0.6B": TextGenerationBenchmark,
|
||||
"mistralai/Mistral-7B-Instruct-v0.3": TextGenerationBenchmark,
|
||||
"openai/gpt-oss-20b": TextGenerationBenchmark,
|
||||
}
|
||||
|
||||
@ -51,5 +51,3 @@ google/gemma-2-2b,8
|
||||
google/gemma-3-4b-it,8
|
||||
openai/whisper-tiny,8
|
||||
Qwen/Qwen3-0.6B,8
|
||||
mistralai/Mistral-7B-Instruct-v0.3, 8
|
||||
openai/gpt-oss-20b, 8
|
||||
|
||||
@ -156,7 +156,7 @@ ROOT = "//" if IS_OSS else "//xplat/caffe2"
|
||||
# for targets in subfolders
|
||||
ROOT_PATH = "//" if IS_OSS else "//xplat/caffe2/"
|
||||
|
||||
C10 = "//c10:c10" if IS_OSS else "//xplat/caffe2/c10:c10"
|
||||
C10 = "//c10:c10" if IS_OSS else ("//xplat/caffe2/c10:c10_ovrsource" if is_arvr_mode() else "//xplat/caffe2/c10:c10")
|
||||
|
||||
# a dictionary maps third party library name to fbsource and oss target
|
||||
THIRD_PARTY_LIBS = {
|
||||
@ -391,8 +391,6 @@ def get_aten_generated_files(enabled_backends):
|
||||
"CompositeExplicitAutogradFunctions_inl.h",
|
||||
"CompositeExplicitAutogradNonFunctionalFunctions.h",
|
||||
"CompositeExplicitAutogradNonFunctionalFunctions_inl.h",
|
||||
"ViewMetaClasses.h",
|
||||
"ViewMetaClasses.cpp",
|
||||
"VmapGeneratedPlumbing.h",
|
||||
"core/ATenOpList.cpp",
|
||||
"core/TensorBody.h",
|
||||
@ -950,6 +948,7 @@ def define_buck_targets(
|
||||
[
|
||||
("torch/csrc/api/include", "torch/**/*.h"),
|
||||
("", "torch/csrc/**/*.h"),
|
||||
("", "torch/csrc/**/*.hpp"),
|
||||
("", "torch/nativert/**/*.h"),
|
||||
("", "torch/headeronly/**/*.h"),
|
||||
("", "torch/script.h"),
|
||||
@ -1194,7 +1193,6 @@ def define_buck_targets(
|
||||
"NativeMetaFunctions.h": ":gen_aten[NativeMetaFunctions.h]",
|
||||
"Operators.h": ":gen_aten[Operators.h]",
|
||||
"RedispatchFunctions.h": ":gen_aten[RedispatchFunctions.h]",
|
||||
"ViewMetaClasses.h": ":gen_aten[ViewMetaClasses.h]",
|
||||
"core/TensorBody.h": ":gen_aten[core/TensorBody.h]",
|
||||
"core/aten_interned_strings.h": ":gen_aten[core/aten_interned_strings.h]",
|
||||
"core/enum_tag.h": ":gen_aten[core/enum_tag.h]",
|
||||
@ -2050,6 +2048,7 @@ def define_buck_targets(
|
||||
("", "caffe2/utils/*.h"),
|
||||
("", "caffe2/core/*.h"),
|
||||
("", "torch/csrc/*.h"),
|
||||
("", "torch/csrc/*.hpp"),
|
||||
("", "torch/csrc/api/include/torch/*.h"),
|
||||
("", "torch/csrc/autograd/*.h"),
|
||||
("", "torch/csrc/autograd/*/*.h"),
|
||||
|
||||
@ -118,9 +118,6 @@ def define_targets(rules):
|
||||
":LazyNonNativeIr.h",
|
||||
":RegisterDispatchDefinitions.ini",
|
||||
":RegisterDispatchKey.cpp",
|
||||
":ViewMetaClassesPythonBinding.cpp",
|
||||
":ViewMetaClasses.cpp",
|
||||
":ViewMetaClasses.h",
|
||||
":native_functions.yaml",
|
||||
":shape_inference.h",
|
||||
":tags.yaml",
|
||||
@ -173,7 +170,6 @@ GENERATED_H = [
|
||||
"FunctionalInverses.h",
|
||||
"RedispatchFunctions.h",
|
||||
"RegistrationDeclarations.h",
|
||||
"ViewMetaClasses.h",
|
||||
"VmapGeneratedPlumbing.h",
|
||||
]
|
||||
|
||||
@ -250,7 +246,6 @@ GENERATED_CPP = [
|
||||
"RegisterFunctionalization_1.cpp",
|
||||
"RegisterFunctionalization_2.cpp",
|
||||
"RegisterFunctionalization_3.cpp",
|
||||
"ViewMetaClasses.cpp",
|
||||
]
|
||||
|
||||
GENERATED_CPP_CORE = [
|
||||
@ -312,7 +307,6 @@ _GENERATED_AUTOGRAD_PYTHON_CPP = [
|
||||
"torch/csrc/autograd/generated/python_torch_functions_1.cpp",
|
||||
"torch/csrc/autograd/generated/python_torch_functions_2.cpp",
|
||||
"torch/csrc/autograd/generated/python_variable_methods.cpp",
|
||||
"torch/csrc/functionalization/generated/ViewMetaClassesPythonBinding.cpp"
|
||||
]
|
||||
|
||||
GENERATED_AUTOGRAD_PYTHON = _GENERATED_AUTOGRAD_PYTHON_HEADERS + _GENERATED_AUTOGRAD_PYTHON_CPP
|
||||
|
||||
@ -1010,7 +1010,6 @@ libtorch_python_core_sources = [
|
||||
"torch/csrc/utils/disable_torch_function.cpp",
|
||||
"torch/csrc/utils/verbose.cpp",
|
||||
"torch/csrc/cpu/Module.cpp",
|
||||
"torch/csrc/functionalization/Module.cpp",
|
||||
"torch/csrc/instruction_counter/Module.cpp",
|
||||
"torch/nativert/python/Bindings.cpp",
|
||||
] + lazy_tensor_core_python_sources
|
||||
@ -1053,7 +1052,6 @@ def glob_libtorch_python_sources(gencode_pattern = ":generate-code[{}]"):
|
||||
"torch/csrc/autograd/generated/python_torch_functions_1.cpp",
|
||||
"torch/csrc/autograd/generated/python_torch_functions_2.cpp",
|
||||
"torch/csrc/autograd/generated/python_variable_methods.cpp",
|
||||
"torch/csrc/functionalization/generated/ViewMetaClassesPythonBinding.cpp",
|
||||
]]
|
||||
|
||||
_libtorch_python_sources.extend(libtorch_python_core_sources)
|
||||
|
||||
@ -3244,7 +3244,7 @@ class C10_TensorImpl_Size_Check_Dummy_Class : private TensorImpl {
|
||||
are_equal<sizeof(autograd_meta_), 4, FieldNameEnum::autograd_meta_>();
|
||||
are_equal<sizeof(extra_meta_), 4, FieldNameEnum::extra_meta_>();
|
||||
are_equal<sizeof(version_counter_), 4, FieldNameEnum::version_counter_>();
|
||||
are_equal<sizeof(pyobj_slot_), 4, FieldNameEnum::pyobj_slot_>();
|
||||
are_equal<sizeof(pyobj_slot_), 8, FieldNameEnum::pyobj_slot_>();
|
||||
is_le<sizeof(sizes_and_strides_), 88, FieldNameEnum::sizes_and_strides_>();
|
||||
are_equal<sizeof(storage_offset_), 8, FieldNameEnum::storage_offset_>();
|
||||
are_equal<sizeof(numel_), 8, FieldNameEnum::numel_>();
|
||||
|
||||
@ -14,6 +14,7 @@ namespace c10::cuda::CUDACachingAllocator::CudaMallocAsync {
|
||||
using namespace c10::CachingAllocator;
|
||||
using namespace c10::CachingDeviceAllocator;
|
||||
|
||||
#if CUDA_VERSION >= 11040 || defined(USE_ROCM)
|
||||
// CUDA device allocator that uses cudaMallocAsync to implement
|
||||
// the same interface as CUDACachingAllocator.cpp.
|
||||
|
||||
@ -925,4 +926,13 @@ CUDAAllocator* allocator() {
|
||||
return &device_allocator;
|
||||
}
|
||||
|
||||
#else
|
||||
// NOLINTNEXTLINE(misc-use-internal-linkage)
|
||||
CUDAAllocator* allocator() {
|
||||
TORCH_CHECK(false, "Cannot use CudaMallocAsyncAllocator with cuda < 11.4.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace c10::cuda::CUDACachingAllocator::CudaMallocAsync
|
||||
|
||||
@ -18,9 +18,9 @@ cuda_supported_platforms = [
|
||||
|
||||
def define_c10_ovrsource(name, is_mobile):
|
||||
if is_mobile:
|
||||
pp_flags = ["-DC10_MOBILE=1"]
|
||||
pp_flags = ["-DC10_MOBILE=1", "-DC10_USE_GLOG"]
|
||||
else:
|
||||
pp_flags = []
|
||||
pp_flags = ["-DC10_USE_GLOG"]
|
||||
|
||||
oxx_static_library(
|
||||
name = name,
|
||||
|
||||
@ -35,26 +35,26 @@ struct ExclusivelyOwnedTensorTraits {
|
||||
// incremented.
|
||||
const bool isUndefined = toDestroy == UndefinedTensorImpl::singleton();
|
||||
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(
|
||||
toDestroy->refcount() == 1 ||
|
||||
(toDestroy->refcount() == 0 && isUndefined),
|
||||
toDestroy->refcount_ == 1 || (toDestroy->refcount_ == 0 && isUndefined),
|
||||
"ExclusivelyOwned<Tensor> destroyed with isUndefined ",
|
||||
isUndefined,
|
||||
" and refcount ",
|
||||
toDestroy->refcount(),
|
||||
toDestroy->refcount_,
|
||||
", expected 1 or, if isUndefined, 0!");
|
||||
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(
|
||||
toDestroy->weakcount() == 1 ||
|
||||
(toDestroy->weakcount() == 0 &&
|
||||
toDestroy->weakcount_ == 1 ||
|
||||
(toDestroy->weakcount_ == 0 &&
|
||||
toDestroy == UndefinedTensorImpl::singleton()),
|
||||
"ExclusivelyOwned<Tensor> destroyed with isUndefined ",
|
||||
isUndefined,
|
||||
" and weakcount ",
|
||||
toDestroy->weakcount(),
|
||||
toDestroy->weakcount_,
|
||||
", expected 1 or, if isUndefined, 0!");
|
||||
if (!isUndefined) {
|
||||
#ifndef NDEBUG
|
||||
// Needed to pass the debug assertions in ~intrusive_ptr_target.
|
||||
toDestroy->combined_refcount_.store(0, std::memory_order_relaxed);
|
||||
toDestroy->refcount_ = 0;
|
||||
toDestroy->weakcount_ = 0;
|
||||
#endif
|
||||
delete toDestroy;
|
||||
}
|
||||
|
||||
@ -27,78 +27,7 @@ struct DontIncreaseRefcount {};
|
||||
} // namespace raw
|
||||
|
||||
namespace detail {
|
||||
constexpr uint64_t kImpracticallyHugeReferenceCount = 0x0FFFFFFF;
|
||||
constexpr uint64_t kImpracticallyHugeWeakReferenceCount =
|
||||
(kImpracticallyHugeReferenceCount << 32);
|
||||
constexpr uint64_t kReferenceCountOne = 1;
|
||||
constexpr uint64_t kWeakReferenceCountOne = (kReferenceCountOne << 32);
|
||||
constexpr uint64_t kUniqueRef = (kReferenceCountOne | kWeakReferenceCountOne);
|
||||
|
||||
template <class TTarget>
|
||||
struct intrusive_target_default_null_type final {
|
||||
static constexpr TTarget* singleton() noexcept {
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
template <class TTarget, class ToNullType, class FromNullType>
|
||||
TTarget* assign_ptr_(TTarget* rhs) {
|
||||
if (FromNullType::singleton() == rhs) {
|
||||
return ToNullType::singleton();
|
||||
} else {
|
||||
return rhs;
|
||||
}
|
||||
}
|
||||
|
||||
inline uint32_t refcount(uint64_t combined_refcount) {
|
||||
return static_cast<uint32_t>(combined_refcount);
|
||||
}
|
||||
|
||||
inline uint32_t weakcount(uint64_t combined_refcount) {
|
||||
return static_cast<uint32_t>(combined_refcount >> 32);
|
||||
}
|
||||
|
||||
// The only requirement for refcount increment is that it happens-before
|
||||
// decrement, so no additional memory ordering is needed.
|
||||
inline uint64_t atomic_combined_refcount_increment(
|
||||
std::atomic<uint64_t>& combined_refcount,
|
||||
uint64_t inc) {
|
||||
return combined_refcount.fetch_add(inc, std::memory_order_relaxed) + inc;
|
||||
}
|
||||
|
||||
inline uint32_t atomic_refcount_increment(
|
||||
std::atomic<uint64_t>& combined_refcount) {
|
||||
return detail::refcount(atomic_combined_refcount_increment(
|
||||
combined_refcount, kReferenceCountOne));
|
||||
}
|
||||
|
||||
inline uint32_t atomic_weakcount_increment(
|
||||
std::atomic<uint64_t>& combined_refcount) {
|
||||
return detail::weakcount(atomic_combined_refcount_increment(
|
||||
combined_refcount, kWeakReferenceCountOne));
|
||||
}
|
||||
|
||||
// The requirement is that all modifications to the managed object happen-before
|
||||
// invocation of the managed object destructor, and that allocation of the
|
||||
// managed object storage happens-before deallocation of the storage.
|
||||
//
|
||||
// To get this ordering, all non-final decrements must synchronize-with the
|
||||
// final decrement. So all non-final decrements have to store-release while the
|
||||
// final decrement has to load-acquire, either directly or with the help of
|
||||
// fences. But it's easiest just to have all decrements be acq-rel. And it turns
|
||||
// out, on modern architectures and chips, it's also fastest.
|
||||
inline uint64_t atomic_combined_refcount_decrement(
|
||||
std::atomic<uint64_t>& combined_refcount,
|
||||
uint64_t dec) {
|
||||
return combined_refcount.fetch_sub(dec, std::memory_order_acq_rel) - dec;
|
||||
}
|
||||
|
||||
inline uint32_t atomic_weakcount_decrement(
|
||||
std::atomic<uint64_t>& combined_refcount) {
|
||||
return detail::weakcount(atomic_combined_refcount_decrement(
|
||||
combined_refcount, kWeakReferenceCountOne));
|
||||
}
|
||||
|
||||
constexpr uint32_t kImpracticallyHugeReferenceCount = 0x0FFFFFFF;
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
@ -151,14 +80,8 @@ class C10_API intrusive_ptr_target {
|
||||
// atomically increment the use count, if it is greater than 0.
|
||||
// If it is not, you must report that the storage is dead.
|
||||
//
|
||||
//.We use a single combined count for refcount and weakcount so that
|
||||
// we can atomically operate on both at the same time for performance
|
||||
// and defined behaviors.
|
||||
//
|
||||
mutable std::atomic<uint64_t> combined_refcount_;
|
||||
static_assert(sizeof(std::atomic<uint64_t>) == 8);
|
||||
static_assert(alignof(std::atomic<uint64_t>) == 8);
|
||||
static_assert(std::atomic<uint64_t>::is_always_lock_free);
|
||||
mutable std::atomic<uint32_t> refcount_;
|
||||
mutable std::atomic<uint32_t> weakcount_;
|
||||
|
||||
template <typename T, typename NullType>
|
||||
friend class intrusive_ptr;
|
||||
@ -203,16 +126,16 @@ class C10_API intrusive_ptr_target {
|
||||
// caller of unsafe_adapt_non_heap_allocated wanted to
|
||||
// use). We choose our reference count such that the count
|
||||
// will not dip below kImpracticallyHugeReferenceCount regardless.
|
||||
refcount() == 0 ||
|
||||
refcount() >= detail::kImpracticallyHugeReferenceCount,
|
||||
refcount_.load() == 0 ||
|
||||
refcount_.load() >= detail::kImpracticallyHugeReferenceCount,
|
||||
"Tried to destruct an intrusive_ptr_target that still has intrusive_ptr to it; refcount was ",
|
||||
refcount());
|
||||
refcount_.load());
|
||||
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(
|
||||
// See ~intrusive_ptr for optimization that will frequently result in 1
|
||||
// at destruction time.
|
||||
weakcount() == 1 || weakcount() == 0 ||
|
||||
weakcount() == detail::kImpracticallyHugeReferenceCount - 1 ||
|
||||
weakcount() == detail::kImpracticallyHugeReferenceCount,
|
||||
weakcount_.load() == 1 || weakcount_.load() == 0 ||
|
||||
weakcount_.load() == detail::kImpracticallyHugeReferenceCount - 1 ||
|
||||
weakcount_.load() == detail::kImpracticallyHugeReferenceCount,
|
||||
"Tried to destruct an intrusive_ptr_target that still has weak_intrusive_ptr to it");
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#pragma warning(pop)
|
||||
@ -221,7 +144,7 @@ class C10_API intrusive_ptr_target {
|
||||
#endif
|
||||
}
|
||||
|
||||
constexpr intrusive_ptr_target() noexcept : combined_refcount_(0) {}
|
||||
constexpr intrusive_ptr_target() noexcept : refcount_(0), weakcount_(0) {}
|
||||
|
||||
// intrusive_ptr_target supports copy and move: but refcount and weakcount
|
||||
// don't participate (since they are intrinsic properties of the memory
|
||||
@ -254,17 +177,54 @@ class C10_API intrusive_ptr_target {
|
||||
* destructed), this function WILL NOT be called.
|
||||
*/
|
||||
virtual void release_resources() {}
|
||||
};
|
||||
|
||||
uint32_t refcount(std::memory_order order = std::memory_order_relaxed) const {
|
||||
return detail::refcount(combined_refcount_.load(order));
|
||||
}
|
||||
|
||||
uint32_t weakcount(
|
||||
std::memory_order order = std::memory_order_relaxed) const {
|
||||
return detail::weakcount(combined_refcount_.load(order));
|
||||
namespace detail {
|
||||
template <class TTarget>
|
||||
struct intrusive_target_default_null_type final {
|
||||
static constexpr TTarget* singleton() noexcept {
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
template <class TTarget, class ToNullType, class FromNullType>
|
||||
TTarget* assign_ptr_(TTarget* rhs) {
|
||||
if (FromNullType::singleton() == rhs) {
|
||||
return ToNullType::singleton();
|
||||
} else {
|
||||
return rhs;
|
||||
}
|
||||
}
|
||||
|
||||
// The only requirement for refcount increment is that it happens-before
|
||||
// decrement, so no additional memory ordering is needed.
|
||||
inline uint32_t atomic_refcount_increment(std::atomic<uint32_t>& refcount) {
|
||||
return refcount.fetch_add(1, std::memory_order_relaxed) + 1;
|
||||
}
|
||||
|
||||
inline uint32_t atomic_weakcount_increment(std::atomic<uint32_t>& weakcount) {
|
||||
return weakcount.fetch_add(1, std::memory_order_relaxed) + 1;
|
||||
}
|
||||
|
||||
// The requirement is that all modifications to the managed object happen-before
|
||||
// invocation of the managed object destructor, and that allocation of the
|
||||
// managed object storage happens-before deallocation of the storage.
|
||||
//
|
||||
// To get this ordering, all non-final decrements must synchronize-with the
|
||||
// final decrement. So all non-final decrements have to store-release while the
|
||||
// final decrement has to load-acquire, either directly or with the help of
|
||||
// fences. But it's easiest just to have all decrements be acq-rel. And it turns
|
||||
// out, on modern architectures and chips, it's also fastest.
|
||||
inline uint32_t atomic_refcount_decrement(std::atomic<uint32_t>& refcount) {
|
||||
return refcount.fetch_sub(1, std::memory_order_acq_rel) - 1;
|
||||
}
|
||||
|
||||
inline uint32_t atomic_weakcount_decrement(std::atomic<uint32_t>& weakcount) {
|
||||
return weakcount.fetch_sub(1, std::memory_order_acq_rel) - 1;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <class TTarget, class NullType>
|
||||
class weak_intrusive_ptr;
|
||||
|
||||
@ -315,7 +275,7 @@ class intrusive_ptr final {
|
||||
void retain_() {
|
||||
if (target_ != NullType::singleton()) {
|
||||
uint32_t new_refcount =
|
||||
detail::atomic_refcount_increment(target_->combined_refcount_);
|
||||
detail::atomic_refcount_increment(target_->refcount_);
|
||||
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(
|
||||
new_refcount != 1,
|
||||
"intrusive_ptr: Cannot increase refcount after it reached zero.");
|
||||
@ -324,25 +284,41 @@ class intrusive_ptr final {
|
||||
|
||||
void reset_() noexcept {
|
||||
if (target_ != NullType::singleton()) {
|
||||
if (target_->combined_refcount_.load(std::memory_order_acquire) ==
|
||||
detail::kUniqueRef) {
|
||||
// Both counts are 1, so there are no weak references and
|
||||
// we are releasing the last strong reference. No other
|
||||
// threads can observe the effects of this target_ deletion
|
||||
// call (e.g. calling use_count()) without a data race.
|
||||
target_->combined_refcount_.store(0, std::memory_order_relaxed);
|
||||
delete target_;
|
||||
return;
|
||||
#if defined(__linux__) && (defined(__aarch64__) || defined(__x86_64__))
|
||||
if constexpr (
|
||||
std::atomic<uint64_t>::is_always_lock_free &&
|
||||
std::atomic<uint32_t>::is_always_lock_free &&
|
||||
sizeof(std::atomic<uint64_t>) == 8 &&
|
||||
sizeof(std::atomic<uint32_t>) == 4) {
|
||||
auto both_counts_ =
|
||||
reinterpret_cast<std::atomic<uint64_t>*>(&target_->refcount_);
|
||||
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(
|
||||
(reinterpret_cast<std::uintptr_t>(both_counts_) %
|
||||
sizeof(std::atomic<uint64_t>)) == 0 &&
|
||||
(reinterpret_cast<std::uintptr_t>(&target_->weakcount_) -
|
||||
reinterpret_cast<std::uintptr_t>(both_counts_)) ==
|
||||
sizeof(std::atomic<uint32_t>));
|
||||
// 0x100000001ULL is a 64-bit number combination of both the refcount_
|
||||
// and weakcount_ being 1.
|
||||
constexpr uint64_t unique_ref_ = 0x100000001ULL;
|
||||
if (both_counts_->load(std::memory_order_acquire) == unique_ref_) {
|
||||
// Both counts are 1, so there are no weak references and
|
||||
// we are releasing the last strong reference. No other
|
||||
// threads can observe the effects of this target_ deletion
|
||||
// call (e.g. calling use_count()) without a data race.
|
||||
target_->refcount_.store(0, std::memory_order_relaxed);
|
||||
delete target_;
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
auto combined_refcount = detail::atomic_combined_refcount_decrement(
|
||||
target_->combined_refcount_, detail::kReferenceCountOne);
|
||||
if (detail::refcount(combined_refcount) == 0) {
|
||||
bool should_delete =
|
||||
(combined_refcount == detail::kWeakReferenceCountOne);
|
||||
if (detail::atomic_refcount_decrement(target_->refcount_) == 0) {
|
||||
// See comment above about weakcount. As long as refcount>0,
|
||||
// weakcount is one larger than the actual number of weak references.
|
||||
// So we need to decrement it here.
|
||||
bool should_delete =
|
||||
target_->weakcount_.load(std::memory_order_acquire) == 1;
|
||||
if (!should_delete) {
|
||||
// justification for const_cast: release_resources is basically a
|
||||
// destructor and a destructor always mutates the object, even for
|
||||
@ -350,8 +326,8 @@ class intrusive_ptr final {
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
|
||||
const_cast<std::remove_const_t<TTarget>*>(target_)
|
||||
->release_resources();
|
||||
should_delete = detail::atomic_weakcount_decrement(
|
||||
target_->combined_refcount_) == 0;
|
||||
should_delete =
|
||||
detail::atomic_weakcount_decrement(target_->weakcount_) == 0;
|
||||
}
|
||||
if (should_delete) {
|
||||
delete target_;
|
||||
@ -378,12 +354,12 @@ class intrusive_ptr final {
|
||||
// `mov`, whereas an atomic increment does a lock-prefixed `add`, which is
|
||||
// much more expensive: https://godbolt.org/z/eKPzj8.)
|
||||
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(
|
||||
target_->combined_refcount_.load(std::memory_order_relaxed) == 0,
|
||||
target_->refcount_ == 0 && target_->weakcount_ == 0,
|
||||
"intrusive_ptr: Newly-created target had non-zero refcounts. Does its "
|
||||
"constructor do something strange like incref or create an "
|
||||
"intrusive_ptr from `this`?");
|
||||
target_->combined_refcount_.store(
|
||||
detail::kUniqueRef, std::memory_order_relaxed);
|
||||
target_->refcount_.store(1, std::memory_order_relaxed);
|
||||
target_->weakcount_.store(1, std::memory_order_relaxed);
|
||||
}
|
||||
}
|
||||
|
||||
@ -506,14 +482,14 @@ class intrusive_ptr final {
|
||||
if (target_ == NullType::singleton()) {
|
||||
return 0;
|
||||
}
|
||||
return target_->refcount(std::memory_order_relaxed);
|
||||
return target_->refcount_.load(std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
uint32_t weak_use_count() const noexcept {
|
||||
if (target_ == NullType::singleton()) {
|
||||
return 0;
|
||||
}
|
||||
return target_->weakcount(std::memory_order_relaxed);
|
||||
return target_->weakcount_.load(std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
bool unique() const noexcept {
|
||||
@ -542,8 +518,8 @@ class intrusive_ptr final {
|
||||
*/
|
||||
static intrusive_ptr reclaim(TTarget* owning_ptr) {
|
||||
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(
|
||||
owning_ptr == NullType::singleton() || owning_ptr->refcount() == 0 ||
|
||||
owning_ptr->weakcount(),
|
||||
owning_ptr == NullType::singleton() ||
|
||||
owning_ptr->refcount_.load() == 0 || owning_ptr->weakcount_.load(),
|
||||
"TTarget violates the invariant that refcount > 0 => weakcount > 0");
|
||||
return intrusive_ptr(owning_ptr, raw::DontIncreaseRefcount{});
|
||||
}
|
||||
@ -614,11 +590,11 @@ class intrusive_ptr final {
|
||||
#ifdef NDEBUG
|
||||
expected_decrefs = 0;
|
||||
#endif
|
||||
result.target_->combined_refcount_.store(
|
||||
detail::refcount(
|
||||
detail::kImpracticallyHugeReferenceCount + expected_decrefs) |
|
||||
detail::kImpracticallyHugeWeakReferenceCount,
|
||||
result.target_->refcount_.store(
|
||||
detail::kImpracticallyHugeReferenceCount + expected_decrefs,
|
||||
std::memory_order_relaxed);
|
||||
result.target_->weakcount_.store(
|
||||
detail::kImpracticallyHugeReferenceCount, std::memory_order_relaxed);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -635,7 +611,7 @@ class intrusive_ptr final {
|
||||
static intrusive_ptr unsafe_reclaim_from_nonowning(TTarget* raw_ptr) {
|
||||
// See Note [Stack allocated intrusive_ptr_target safety]
|
||||
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(
|
||||
raw_ptr == NullType::singleton() || raw_ptr->refcount() > 0,
|
||||
raw_ptr == NullType::singleton() || raw_ptr->refcount_.load() > 0,
|
||||
"intrusive_ptr: Can only reclaim pointers that are owned by someone");
|
||||
auto ptr = reclaim(raw_ptr); // doesn't increase refcount
|
||||
ptr.retain_();
|
||||
@ -769,7 +745,7 @@ class weak_intrusive_ptr final {
|
||||
void retain_() {
|
||||
if (target_ != NullType::singleton()) {
|
||||
uint32_t new_weakcount =
|
||||
detail::atomic_weakcount_increment(target_->combined_refcount_);
|
||||
detail::atomic_weakcount_increment(target_->weakcount_);
|
||||
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(
|
||||
new_weakcount != 1,
|
||||
"weak_intrusive_ptr: Cannot increase weakcount after it reached zero.");
|
||||
@ -778,7 +754,7 @@ class weak_intrusive_ptr final {
|
||||
|
||||
void reset_() noexcept {
|
||||
if (target_ != NullType::singleton() &&
|
||||
detail::atomic_weakcount_decrement(target_->combined_refcount_) == 0) {
|
||||
detail::atomic_weakcount_decrement(target_->weakcount_) == 0) {
|
||||
// NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDelete)
|
||||
delete target_;
|
||||
}
|
||||
@ -911,7 +887,7 @@ class weak_intrusive_ptr final {
|
||||
if (target_ == NullType::singleton()) {
|
||||
return 0;
|
||||
}
|
||||
return target_->refcount(
|
||||
return target_->refcount_.load(
|
||||
std::memory_order_relaxed); // refcount, not weakcount!
|
||||
}
|
||||
|
||||
@ -919,7 +895,7 @@ class weak_intrusive_ptr final {
|
||||
if (target_ == NullType::singleton()) {
|
||||
return 0;
|
||||
}
|
||||
return target_->weakcount(std::memory_order_relaxed);
|
||||
return target_->weakcount_.load(std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
bool expired() const noexcept {
|
||||
@ -930,17 +906,16 @@ class weak_intrusive_ptr final {
|
||||
if (target_ == NullType::singleton()) {
|
||||
return intrusive_ptr<TTarget, NullType>();
|
||||
} else {
|
||||
auto combined_refcount =
|
||||
target_->combined_refcount_.load(std::memory_order_relaxed);
|
||||
auto refcount = target_->refcount_.load(std::memory_order_relaxed);
|
||||
do {
|
||||
if (detail::refcount(combined_refcount) == 0) {
|
||||
if (refcount == 0) {
|
||||
// Object already destructed, no strong references left anymore.
|
||||
// Return nullptr.
|
||||
return intrusive_ptr<TTarget, NullType>();
|
||||
}
|
||||
} while (!target_->combined_refcount_.compare_exchange_weak(
|
||||
combined_refcount,
|
||||
combined_refcount + detail::kReferenceCountOne,
|
||||
} while (!target_->refcount_.compare_exchange_weak(
|
||||
refcount,
|
||||
refcount + 1,
|
||||
std::memory_order_acquire,
|
||||
std::memory_order_relaxed));
|
||||
|
||||
@ -977,9 +952,9 @@ class weak_intrusive_ptr final {
|
||||
// if refcount == 0, weakcount only must be >0.
|
||||
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(
|
||||
owning_weak_ptr == NullType::singleton() ||
|
||||
owning_weak_ptr->weakcount() > 1 ||
|
||||
(owning_weak_ptr->refcount() == 0 &&
|
||||
owning_weak_ptr->weakcount() > 0),
|
||||
owning_weak_ptr->weakcount_.load() > 1 ||
|
||||
(owning_weak_ptr->refcount_.load() == 0 &&
|
||||
owning_weak_ptr->weakcount_.load() > 0),
|
||||
"weak_intrusive_ptr: Can only weak_intrusive_ptr::reclaim() owning pointers that were created using weak_intrusive_ptr::release().");
|
||||
return weak_intrusive_ptr(owning_weak_ptr);
|
||||
}
|
||||
@ -1058,7 +1033,7 @@ namespace intrusive_ptr {
|
||||
// NullType::singleton to this function
|
||||
inline void incref(intrusive_ptr_target* self) {
|
||||
if (self) {
|
||||
detail::atomic_refcount_increment(self->combined_refcount_);
|
||||
detail::atomic_refcount_increment(self->refcount_);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1092,7 +1067,7 @@ inline uint32_t use_count(intrusive_ptr_target* self) {
|
||||
namespace weak_intrusive_ptr {
|
||||
|
||||
inline void incref(weak_intrusive_ptr_target* self) {
|
||||
detail::atomic_weakcount_increment(self->combined_refcount_);
|
||||
detail::atomic_weakcount_increment(self->weakcount_);
|
||||
}
|
||||
|
||||
inline void decref(weak_intrusive_ptr_target* self) {
|
||||
|
||||
@ -316,7 +316,6 @@ set(GENERATED_CXX_PYTHON
|
||||
"${TORCH_SRC_DIR}/csrc/autograd/generated/python_special_functions.cpp"
|
||||
"${TORCH_SRC_DIR}/csrc/autograd/generated/python_return_types.cpp"
|
||||
"${TORCH_SRC_DIR}/csrc/autograd/generated/python_enum_tag.cpp"
|
||||
"${TORCH_SRC_DIR}/csrc/functionalization/generated/ViewMetaClassesPythonBinding.cpp"
|
||||
)
|
||||
|
||||
set(GENERATED_H_PYTHON
|
||||
@ -380,9 +379,6 @@ add_custom_command(
|
||||
"${TORCH_ROOT}/aten/src/ATen/templates/LazyIr.h"
|
||||
"${TORCH_ROOT}/aten/src/ATen/templates/LazyNonNativeIr.h"
|
||||
"${TORCH_ROOT}/aten/src/ATen/templates/RegisterDispatchKey.cpp"
|
||||
"${TORCH_ROOT}/aten/src/ATen/templates/ViewMetaClasses.h"
|
||||
"${TORCH_ROOT}/aten/src/ATen/templates/ViewMetaClasses.cpp"
|
||||
"${TORCH_ROOT}/aten/src/ATen/templates/ViewMetaClassesPythonBinding.cpp"
|
||||
${autograd_python}
|
||||
${autograd_yaml}
|
||||
${autograd_templates}
|
||||
@ -544,11 +540,9 @@ if(NOT INTERN_BUILD_MOBILE AND NOT BUILD_LITE_INTERPRETER)
|
||||
${TORCH_SRC_DIR}/csrc/utils/byte_order.cpp
|
||||
)
|
||||
|
||||
if(USE_DISTRIBUTED)
|
||||
append_filelist("libtorch_distributed_base_sources" TORCH_SRCS)
|
||||
if(NOT WIN32)
|
||||
append_filelist("libtorch_distributed_extra_sources" TORCH_SRCS)
|
||||
endif()
|
||||
append_filelist("libtorch_distributed_base_sources" TORCH_SRCS)
|
||||
if(NOT WIN32)
|
||||
append_filelist("libtorch_distributed_extra_sources" TORCH_SRCS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -579,32 +573,30 @@ if(USE_CUDA)
|
||||
list(APPEND Caffe2_GPU_SRCS
|
||||
${TORCH_SRC_DIR}/csrc/cuda/nccl.cpp)
|
||||
endif()
|
||||
if(USE_DISTRIBUTED)
|
||||
append_filelist("libtorch_cuda_distributed_base_sources" Caffe2_GPU_SRCS)
|
||||
if(NOT WIN32)
|
||||
append_filelist("libtorch_cuda_distributed_extra_sources" Caffe2_GPU_SRCS)
|
||||
set_source_files_properties(
|
||||
${TORCH_SRC_DIR}/csrc/distributed/c10d/ProcessGroupNCCL.cpp
|
||||
${TORCH_SRC_DIR}/csrc/distributed/c10d/cuda/utils.cpp
|
||||
${TORCH_SRC_DIR}/csrc/distributed/c10d/intra_node_comm.cpp
|
||||
${TORCH_SRC_DIR}/csrc/distributed/c10d/symm_mem/CudaDMAConnectivity.cpp
|
||||
${TORCH_SRC_DIR}/csrc/distributed/c10d/symm_mem/CUDASymmetricMemory.cu
|
||||
${TORCH_SRC_DIR}/csrc/distributed/c10d/symm_mem/CUDASymmetricMemoryOps.cu
|
||||
${TORCH_SRC_DIR}/csrc/distributed/c10d/symm_mem/CUDASymmetricMemoryUtils.cpp
|
||||
${TORCH_SRC_DIR}/csrc/distributed/c10d/symm_mem/NCCLSymmetricMemory.cu
|
||||
${TORCH_SRC_DIR}/csrc/distributed/c10d/symm_mem/cuda_mem_pool.cpp
|
||||
PROPERTIES COMPILE_FLAGS "-DPYTORCH_C10_DRIVER_API_SUPPORTED=1"
|
||||
)
|
||||
endif()
|
||||
append_filelist("libtorch_cuda_distributed_base_sources" Caffe2_GPU_SRCS)
|
||||
if(NOT WIN32)
|
||||
append_filelist("libtorch_cuda_distributed_extra_sources" Caffe2_GPU_SRCS)
|
||||
set_source_files_properties(
|
||||
${TORCH_SRC_DIR}/csrc/distributed/c10d/ProcessGroupNCCL.cpp
|
||||
${TORCH_SRC_DIR}/csrc/distributed/c10d/cuda/utils.cpp
|
||||
${TORCH_SRC_DIR}/csrc/distributed/c10d/intra_node_comm.cpp
|
||||
${TORCH_SRC_DIR}/csrc/distributed/c10d/symm_mem/CudaDMAConnectivity.cpp
|
||||
${TORCH_SRC_DIR}/csrc/distributed/c10d/symm_mem/CUDASymmetricMemory.cu
|
||||
${TORCH_SRC_DIR}/csrc/distributed/c10d/symm_mem/CUDASymmetricMemoryOps.cu
|
||||
${TORCH_SRC_DIR}/csrc/distributed/c10d/symm_mem/CUDASymmetricMemoryUtils.cpp
|
||||
${TORCH_SRC_DIR}/csrc/distributed/c10d/symm_mem/NCCLSymmetricMemory.cu
|
||||
${TORCH_SRC_DIR}/csrc/distributed/c10d/symm_mem/cuda_mem_pool.cpp
|
||||
PROPERTIES COMPILE_FLAGS "-DPYTORCH_C10_DRIVER_API_SUPPORTED=1"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(ASYNC_MM_FILE "${TORCH_SRC_DIR}/csrc/distributed/c10d/cuda/AsyncMM.cu")
|
||||
# Disable the warning to make cutlass warp-specialized cooperative kernel build for gcc-9
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set_source_files_properties(${ASYNC_MM_FILE} PROPERTIES COMPILE_FLAGS "-Wno-unused-but-set-variable")
|
||||
endif()
|
||||
if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0 AND CUDA_NVCC_FLAGS MATCHES ".*compute_90.*")
|
||||
set_source_files_properties(${ASYNC_MM_FILE} PROPERTIES COMPILE_FLAGS "-gencode arch=compute_90a,code=sm_90a")
|
||||
endif()
|
||||
set(ASYNC_MM_FILE "${TORCH_SRC_DIR}/csrc/distributed/c10d/cuda/AsyncMM.cu")
|
||||
# Disable the warning to make cutlass warp-specialized cooperative kernel build for gcc-9
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set_source_files_properties(${ASYNC_MM_FILE} PROPERTIES COMPILE_FLAGS "-Wno-unused-but-set-variable")
|
||||
endif()
|
||||
if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0 AND CUDA_NVCC_FLAGS MATCHES ".*compute_90.*")
|
||||
set_source_files_properties(${ASYNC_MM_FILE} PROPERTIES COMPILE_FLAGS "-gencode arch=compute_90a,code=sm_90a")
|
||||
endif()
|
||||
set_source_files_properties(
|
||||
${TORCH_ROOT}/aten/src/ATen/cuda/detail/LazyNVRTC.cpp
|
||||
@ -637,11 +629,9 @@ if(USE_ROCM)
|
||||
list(APPEND Caffe2_HIP_SRCS
|
||||
${TORCH_SRC_DIR}/csrc/cuda/nccl.cpp)
|
||||
endif()
|
||||
if(USE_DISTRIBUTED)
|
||||
append_filelist("libtorch_cuda_distributed_base_sources" Caffe2_HIP_SRCS)
|
||||
if(NOT WIN32)
|
||||
append_filelist("libtorch_cuda_distributed_extra_sources" Caffe2_HIP_SRCS)
|
||||
endif()
|
||||
append_filelist("libtorch_cuda_distributed_base_sources" Caffe2_HIP_SRCS)
|
||||
if(NOT WIN32)
|
||||
append_filelist("libtorch_cuda_distributed_extra_sources" Caffe2_HIP_SRCS)
|
||||
endif()
|
||||
# caffe2_nvrtc's stubs to driver APIs are useful for HIP.
|
||||
# See NOTE [ ATen NVRTC Stub and HIP ]
|
||||
@ -1362,12 +1352,10 @@ if(BUILD_TEST)
|
||||
add_subdirectory(${TORCH_ROOT}/test/cpp/jit ${CMAKE_BINARY_DIR}/test_jit)
|
||||
add_subdirectory(${TORCH_ROOT}/test/cpp/nativert ${CMAKE_BINARY_DIR}/test_nativert)
|
||||
add_subdirectory(${TORCH_ROOT}/test/inductor ${CMAKE_BINARY_DIR}/test_inductor)
|
||||
if(USE_DISTRIBUTED)
|
||||
add_subdirectory(${TORCH_ROOT}/test/cpp/c10d ${CMAKE_BINARY_DIR}/test_cpp_c10d)
|
||||
if(NOT WIN32)
|
||||
add_subdirectory(${TORCH_ROOT}/test/cpp/dist_autograd ${CMAKE_BINARY_DIR}/dist_autograd)
|
||||
add_subdirectory(${TORCH_ROOT}/test/cpp/rpc ${CMAKE_BINARY_DIR}/test_cpp_rpc)
|
||||
endif()
|
||||
add_subdirectory(${TORCH_ROOT}/test/cpp/c10d ${CMAKE_BINARY_DIR}/test_cpp_c10d)
|
||||
if(NOT WIN32)
|
||||
add_subdirectory(${TORCH_ROOT}/test/cpp/dist_autograd ${CMAKE_BINARY_DIR}/dist_autograd)
|
||||
add_subdirectory(${TORCH_ROOT}/test/cpp/rpc ${CMAKE_BINARY_DIR}/test_cpp_rpc)
|
||||
endif()
|
||||
if(NOT NO_API)
|
||||
add_subdirectory(${TORCH_ROOT}/test/cpp/api ${CMAKE_BINARY_DIR}/test_api)
|
||||
@ -1472,46 +1460,40 @@ if(BUILD_LITE_INTERPRETER)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# Pass USE_DISTRIBUTED to torch_cpu, as some codes in jit/pickler.cpp and
|
||||
# jit/unpickler.cpp need to be compiled only when USE_DISTRIBUTED is set
|
||||
if(USE_DISTRIBUTED)
|
||||
target_compile_definitions(torch_cpu PUBLIC USE_DISTRIBUTED)
|
||||
if(USE_GLOO AND USE_C10D_GLOO)
|
||||
target_compile_definitions(torch_cpu PUBLIC USE_C10D_GLOO)
|
||||
if(USE_GLOO AND USE_C10D_GLOO)
|
||||
target_compile_definitions(torch_cpu PUBLIC USE_C10D_GLOO)
|
||||
endif()
|
||||
if(USE_UCC AND USE_C10D_UCC)
|
||||
target_compile_definitions(torch_cpu PUBLIC USE_C10D_UCC)
|
||||
if(USE_CUDA)
|
||||
target_compile_definitions(torch_cuda PUBLIC USE_C10D_UCC)
|
||||
endif()
|
||||
if(USE_UCC AND USE_C10D_UCC)
|
||||
target_compile_definitions(torch_cpu PUBLIC USE_C10D_UCC)
|
||||
if(USE_CUDA)
|
||||
target_compile_definitions(torch_cuda PUBLIC USE_C10D_UCC)
|
||||
endif()
|
||||
endif()
|
||||
if(USE_NCCL AND USE_C10D_NCCL)
|
||||
if(USE_ROCM)
|
||||
target_compile_definitions(torch_hip PUBLIC USE_C10D_NCCL)
|
||||
else()
|
||||
target_compile_definitions(torch_cuda PUBLIC USE_C10D_NCCL)
|
||||
endif()
|
||||
if(USE_NCCL AND USE_C10D_NCCL)
|
||||
if(USE_ROCM)
|
||||
target_compile_definitions(torch_hip PUBLIC USE_C10D_NCCL)
|
||||
else()
|
||||
target_compile_definitions(torch_cuda PUBLIC USE_C10D_NCCL)
|
||||
endif()
|
||||
endif()
|
||||
if(USE_MPI AND USE_C10D_MPI)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set_source_files_properties(
|
||||
"${TORCH_SRC_DIR}/csrc/distributed/c10d/ProcessGroupMPI.cpp"
|
||||
PROPERTIES COMPILE_FLAGS -Wno-deprecated-declarations)
|
||||
endif()
|
||||
target_compile_definitions(torch_cpu PUBLIC USE_C10D_MPI)
|
||||
endif()
|
||||
# Pass USE_RPC in order to reduce use of
|
||||
# #if defined(USE_DISTRIBUTED) && !defined(_WIN32)
|
||||
# need to be removed when RPC is supported
|
||||
if(NOT WIN32)
|
||||
target_compile_definitions(torch_cpu PUBLIC USE_RPC)
|
||||
endif()
|
||||
# Pass USE_TENSORPIPE to torch_cpu as some parts of rpc/utils.cpp
|
||||
# can only be compiled with USE_TENSORPIPE is set.
|
||||
if(USE_TENSORPIPE)
|
||||
target_compile_definitions(torch_cpu PUBLIC USE_TENSORPIPE)
|
||||
endif()
|
||||
if(USE_MPI AND USE_C10D_MPI)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set_source_files_properties(
|
||||
"${TORCH_SRC_DIR}/csrc/distributed/c10d/ProcessGroupMPI.cpp"
|
||||
PROPERTIES COMPILE_FLAGS -Wno-deprecated-declarations)
|
||||
endif()
|
||||
target_compile_definitions(torch_cpu PUBLIC USE_C10D_MPI)
|
||||
endif()
|
||||
# Pass USE_RPC in order to reduce use of
|
||||
# #if defined(USE_DISTRIBUTED) && !defined(_WIN32)
|
||||
# need to be removed when RPC is supported
|
||||
if(NOT WIN32)
|
||||
target_compile_definitions(torch_cpu PUBLIC USE_RPC)
|
||||
endif()
|
||||
# Pass USE_TENSORPIPE to torch_cpu as some parts of rpc/utils.cpp
|
||||
# can only be compiled with USE_TENSORPIPE is set.
|
||||
if(USE_TENSORPIPE)
|
||||
target_compile_definitions(torch_cpu PUBLIC USE_TENSORPIPE)
|
||||
endif()
|
||||
|
||||
if(NOT INTERN_BUILD_MOBILE)
|
||||
|
||||
@ -821,9 +821,9 @@ if(NOT Python_Interpreter_FOUND)
|
||||
message(FATAL_ERROR "Python3 could not be found.")
|
||||
endif()
|
||||
|
||||
if(${Python_VERSION} VERSION_LESS 3.10)
|
||||
if(${Python_VERSION} VERSION_LESS 3.9)
|
||||
message(FATAL_ERROR
|
||||
"Found Python libraries version ${Python_VERSION}. Python < 3.10 is no longer supported by PyTorch.")
|
||||
"Found Python libraries version ${Python_VERSION}. Python < 3.9 is no longer supported by PyTorch.")
|
||||
endif()
|
||||
|
||||
# ---[ Python + Numpy
|
||||
@ -1134,7 +1134,7 @@ if(USE_CUDA AND CUDA_VERSION VERSION_LESS 13.0)
|
||||
include_directories(SYSTEM ${CUB_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
if(USE_DISTRIBUTED AND USE_TENSORPIPE)
|
||||
if(USE_TENSORPIPE)
|
||||
if(MSVC)
|
||||
message(WARNING "Tensorpipe cannot be used on Windows.")
|
||||
else()
|
||||
|
||||
14
cmake/External/aotriton.cmake
vendored
14
cmake/External/aotriton.cmake
vendored
@ -46,10 +46,9 @@ if(NOT __AOTRITON_INCLUDED)
|
||||
set(__AOTRITON_BASE_URL "https://github.com/ROCm/aotriton/releases/download/") # @lint-ignore
|
||||
set(__AOTRITON_Z "gz")
|
||||
# Set the default __AOTRITON_LIB path
|
||||
if(NOT WIN32)
|
||||
set(__AOTRITON_LIB "lib/libaotriton_v2.so")
|
||||
else()
|
||||
set(__AOTRITON_LIB "lib/aotriton_v2.lib")
|
||||
set(__AOTRITON_LIB "${__AOTRITON_INSTALL_DIR}/lib/libaotriton_v2.so")
|
||||
if(WIN32)
|
||||
set(__AOTRITON_LIB "${__AOTRITON_INSTALL_DIR}/lib/aotriton_v2.lib")
|
||||
endif()
|
||||
|
||||
function(aotriton_build_windows_dependencies dlfcn-win32_external xz_external dlfcn-win32_DIR liblzma_DIR)
|
||||
@ -144,7 +143,8 @@ if(NOT __AOTRITON_INCLUDED)
|
||||
-DHIP_PLATFORM=amd
|
||||
$<$<BOOL:${WIN32}>:-Ddlfcn-win32_DIR=${dlfcn-win32_DIR}>
|
||||
$<$<BOOL:${WIN32}>:-Dliblzma_DIR=${liblzma_DIR}>
|
||||
BUILD_BYPRODUCTS "${__AOTRITON_INSTALL_DIR}/${__AOTRITON_LIB}"
|
||||
BUILD_BYPRODUCTS
|
||||
"${__AOTRITON_LIB}"
|
||||
USES_TERMINAL_DOWNLOAD TRUE
|
||||
USES_TERMINAL_CONFIGURE TRUE
|
||||
USES_TERMINAL_BUILD TRUE
|
||||
@ -177,7 +177,7 @@ if(NOT __AOTRITON_INCLUDED)
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/aotriton_runtime"
|
||||
"${__AOTRITON_INSTALL_DIR}"
|
||||
BUILD_BYPRODUCTS "${__AOTRITON_INSTALL_DIR}/${__AOTRITON_LIB}"
|
||||
BUILD_BYPRODUCTS "${__AOTRITON_LIB}"
|
||||
)
|
||||
message(STATUS "Using AOTriton Runtime from pre-compiled binary ${__AOTRITON_URL}.\
|
||||
Set env variables AOTRITON_INSTALL_FROM_SOURCE=1 to build from source.")
|
||||
@ -267,7 +267,7 @@ if(NOT __AOTRITON_INCLUDED)
|
||||
endforeach()
|
||||
endforeach()
|
||||
endif()
|
||||
target_link_libraries(__caffe2_aotriton INTERFACE "${__AOTRITON_INSTALL_DIR}/${__AOTRITON_LIB}")
|
||||
target_link_libraries(__caffe2_aotriton INTERFACE ${__AOTRITON_LIB})
|
||||
target_include_directories(__caffe2_aotriton INTERFACE ${__AOTRITON_INSTALL_DIR}/include)
|
||||
set(AOTRITON_FOUND TRUE)
|
||||
endif() # __AOTRITON_INCLUDED
|
||||
|
||||
@ -193,13 +193,11 @@ function(caffe2_print_configuration_summary)
|
||||
message(STATUS " USE_PYTORCH_QNNPACK : ${USE_PYTORCH_QNNPACK}")
|
||||
message(STATUS " USE_XNNPACK : ${USE_XNNPACK}")
|
||||
message(STATUS " USE_DISTRIBUTED : ${USE_DISTRIBUTED}")
|
||||
if(${USE_DISTRIBUTED})
|
||||
message(STATUS " USE_MPI : ${USE_MPI}")
|
||||
message(STATUS " USE_GLOO : ${USE_GLOO}")
|
||||
message(STATUS " USE_GLOO_WITH_OPENSSL : ${USE_GLOO_WITH_OPENSSL}")
|
||||
message(STATUS " USE_GLOO_IBVERBS : ${USE_GLOO_IBVERBS}")
|
||||
message(STATUS " USE_TENSORPIPE : ${USE_TENSORPIPE}")
|
||||
endif()
|
||||
message(STATUS " USE_MPI : ${USE_MPI}")
|
||||
message(STATUS " USE_GLOO : ${USE_GLOO}")
|
||||
message(STATUS " USE_GLOO_WITH_OPENSSL : ${USE_GLOO_WITH_OPENSSL}")
|
||||
message(STATUS " USE_GLOO_IBVERBS : ${USE_GLOO_IBVERBS}")
|
||||
message(STATUS " USE_TENSORPIPE : ${USE_TENSORPIPE}")
|
||||
if(NOT "${SELECTED_OP_LIST}" STREQUAL "")
|
||||
message(STATUS " SELECTED_OP_LIST : ${SELECTED_OP_LIST}")
|
||||
endif()
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 168 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 89 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 418 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 256 KiB |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user