Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
5f1c6d7
rebase to latest main
Gasoonjia Sep 16, 2025
94d4001
add github ci for gpu pt install check
Gasoonjia Sep 16, 2025
a0332ff
add github ci for gpu pt install check
Gasoonjia Sep 16, 2025
433c239
recover torchao
Gasoonjia Sep 16, 2025
db7bef7
solve lint issue
Gasoonjia Sep 17, 2025
3d324c7
create install_utils.py for better structure
Gasoonjia Sep 17, 2025
a6e1918
Add skeleton code
larryliu0820 Aug 5, 2025
687688b
Add export_add.py
larryliu0820 Aug 6, 2025
0ce6928
prototype e2e works on latest ET
Gasoonjia Aug 8, 2025
9afb4ac
hacky support .so file seperation by hardcoding file path
Gasoonjia Aug 11, 2025
cef27e1
hacky support .so file seperation by hardcoding file path
Gasoonjia Aug 11, 2025
c85fc42
support latest backend interface
Gasoonjia Aug 12, 2025
2ab79f0
temp submit for execute model with weight
Gasoonjia Aug 19, 2025
17f1a5f
move input to GPU + using torch aoti kernel
Gasoonjia Aug 20, 2025
9b9c28b
remove temp dir in test script
Gasoonjia Aug 20, 2025
a7ae3b7
ignore aoti temp files
Gasoonjia Aug 20, 2025
3ec8a38
add get_device_type and get_device_index shim layer
Gasoonjia Aug 20, 2025
28d1294
e2e runnable on conv2d
Gasoonjia Aug 21, 2025
df1bec5
remove extra code
Gasoonjia Aug 21, 2025
db8a400
solved crash when destroying backend
Gasoonjia Aug 21, 2025
ece2776
change to use to_edge_transform_and_lower
Gasoonjia Aug 21, 2025
8e42a30
use aoti decomposition on lowable graph
Gasoonjia Aug 22, 2025
aa94acf
update test script to support raw aoti
Gasoonjia Aug 22, 2025
189871e
temp commit
Gasoonjia Aug 25, 2025
3ec8024
merge to 0825 main
Gasoonjia Aug 25, 2025
041f2b6
temp comit
Gasoonjia Aug 25, 2025
8c5bb3b
use env var to control debug mode
Gasoonjia Aug 26, 2025
687bcdf
enable dump runtime intermediate output for aoti delegated part
Gasoonjia Aug 26, 2025
eca93d1
resnet18 works
Gasoonjia Aug 28, 2025
7962fb3
centralize def type
Gasoonjia Sep 3, 2025
23de936
enabling llama31
Gasoonjia Sep 3, 2025
b792c7d
add llama31 for test
Gasoonjia Sep 4, 2025
01b306d
remove uncessary data from github
Gasoonjia Sep 4, 2025
3f22996
remove uncessary data from github
Gasoonjia Sep 4, 2025
cc06eda
add support fallback kernels check
Gasoonjia Sep 4, 2025
ef191c4
collect missing kernels while always generated fallback
Gasoonjia Sep 5, 2025
62fbd92
use ptd pipeline on .so file
Gasoonjia Sep 9, 2025
057f1fa
use cpu model as input
Gasoonjia Sep 10, 2025
034359a
remove mis-introed libtorch header
Gasoonjia Sep 11, 2025
bc559a6
remove unnecessary cuda stream functions
Gasoonjia Sep 11, 2025
490a2b2
remove debug print in c++
Gasoonjia Sep 11, 2025
558d0c2
remove debug print in c++ - 2
Gasoonjia Sep 12, 2025
5609a5d
use et_log and et::error for err and its msg
Gasoonjia Sep 12, 2025
5d4c928
remove spaghhtti code 1/n
Gasoonjia Sep 16, 2025
3e2f2b7
remove unnecessary export code
Gasoonjia Sep 17, 2025
32c14b1
set example input to only the very first partition
Gasoonjia Sep 17, 2025
3b02829
refactor aoti-driven backends
Gasoonjia Sep 18, 2025
2fe871c
code refacotr to backend/cuda and backend/aoti
Gasoonjia Sep 18, 2025
7542cae
solve cuda backend dependency issue
Gasoonjia Sep 18, 2025
f93d194
add cuda export ci
Gasoonjia Sep 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/docker/ci_commit_pins/pytorch.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4d4abec80f03cd8fdefe1d9cb3a60d3690cd777e
53a2908a10f414a2f85caa06703a26a40e873869
98 changes: 98 additions & 0 deletions .ci/scripts/test-cuda-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

set -exu

# shellcheck source=/dev/null
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"

CUDA_VERSION=${1:-"12.6"}

echo "=== Testing ExecutorTorch CUDA ${CUDA_VERSION} Build ==="

# Function to build and test ExecutorTorch with CUDA support
test_executorch_cuda_build() {
local cuda_version=$1

echo "Building ExecutorTorch with CUDA ${cuda_version} support..."
echo "ExecutorTorch will automatically detect CUDA and install appropriate PyTorch wheel"

# Check available resources before starting
echo "=== System Information ==="
echo "Available memory: $(free -h | grep Mem | awk '{print $2}')"
echo "Available disk space: $(df -h . | tail -1 | awk '{print $4}')"
echo "CPU cores: $(nproc)"
echo "CUDA version check:"
nvcc --version || echo "nvcc not found"
nvidia-smi || echo "nvidia-smi not found"

# Set CMAKE_ARGS to enable CUDA build - ExecutorTorch will handle PyTorch installation automatically
export CMAKE_ARGS="-DEXECUTORCH_BUILD_CUDA=ON"

echo "=== Starting ExecutorTorch Installation ==="
# Install ExecutorTorch with CUDA support with timeout and error handling
timeout 5400 ./install_executorch.sh || {
local exit_code=$?
echo "ERROR: install_executorch.sh failed with exit code: $exit_code"
if [ $exit_code -eq 124 ]; then
echo "ERROR: Installation timed out after 90 minutes"
fi
exit $exit_code
}

echo "SUCCESS: ExecutorTorch CUDA build completed"

# Verify the installation
echo "=== Verifying ExecutorTorch CUDA Installation ==="

# Test that ExecutorTorch was built successfully
python -c "
import executorch
print('SUCCESS: ExecutorTorch imported successfully')
"

# Test CUDA availability and show details
python -c "
try:
import torch
print('INFO: PyTorch version:', torch.__version__)
print('INFO: CUDA available:', torch.cuda.is_available())

if torch.cuda.is_available():
print('SUCCESS: CUDA is available for ExecutorTorch')
print('INFO: CUDA version:', torch.version.cuda)
print('INFO: GPU device count:', torch.cuda.device_count())
print('INFO: Current GPU device:', torch.cuda.current_device())
print('INFO: GPU device name:', torch.cuda.get_device_name())

# Test basic CUDA tensor operation
device = torch.device('cuda')
x = torch.randn(10, 10).to(device)
y = torch.randn(10, 10).to(device)
z = torch.mm(x, y)
print('SUCCESS: CUDA tensor operation completed on device:', z.device)
print('INFO: Result tensor shape:', z.shape)

print('SUCCESS: ExecutorTorch CUDA integration verified')
else:
print('WARNING: CUDA not detected, but ExecutorTorch built successfully')
exit(1)
except Exception as e:
print('ERROR: ExecutorTorch CUDA test failed:', e)
exit(1)
"

echo "SUCCESS: ExecutorTorch CUDA ${cuda_version} build and verification completed successfully"
}

# Main execution
echo "Current working directory: $(pwd)"
echo "Directory contents:"
ls -la

# Run the CUDA build test
test_executorch_cuda_build "${CUDA_VERSION}"
105 changes: 105 additions & 0 deletions .ci/scripts/test-cuda-export-aoti.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

set -exu

# shellcheck source=/dev/null
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"

CUDA_VERSION=${1:-"12.6"}

echo "=== Testing ExecutorTorch CUDA AOTI Export ${CUDA_VERSION} ==="

# Function to test CUDA AOTI export functionality
test_cuda_aoti_export() {
local cuda_version=$1

echo "Testing CUDA AOTI export with CUDA ${cuda_version} support..."

# Check available resources before starting
echo "=== System Information ==="
echo "Available memory: $(free -h | grep Mem | awk '{print $2}')"
echo "Available disk space: $(df -h . | tail -1 | awk '{print $4}')"
echo "CPU cores: $(nproc)"
echo "CUDA version check:"
nvcc --version || echo "nvcc not found"
nvidia-smi || echo "nvidia-smi not found"

# Set up environment for CUDA builds
export CMAKE_ARGS="-DEXECUTORCH_BUILD_CUDA=ON"

echo "=== Installing ExecutorTorch with CUDA support ==="
# Install ExecutorTorch with CUDA support with timeout and error handling
timeout 5400 ./install_executorch.sh || {
local exit_code=$?
echo "ERROR: install_executorch.sh failed with exit code: $exit_code"
if [ $exit_code -eq 124 ]; then
echo "ERROR: Installation timed out after 90 minutes"
fi
exit $exit_code
}

echo "SUCCESS: ExecutorTorch CUDA installation completed"

# Verify the installation
echo "=== Verifying ExecutorTorch CUDA Installation ==="

# Test that ExecutorTorch was built successfully
python -c "
import executorch
print('SUCCESS: ExecutorTorch imported successfully')
"

# Test CUDA availability and show details
python -c "
try:
import torch
print('INFO: PyTorch version:', torch.__version__)
print('INFO: CUDA available:', torch.cuda.is_available())

if torch.cuda.is_available():
print('SUCCESS: CUDA is available for ExecutorTorch')
print('INFO: CUDA version:', torch.version.cuda)
print('INFO: GPU device count:', torch.cuda.device_count())
print('INFO: Current GPU device:', torch.cuda.current_device())
print('INFO: GPU device name:', torch.cuda.get_device_name())

# Test basic CUDA tensor operation
device = torch.device('cuda')
x = torch.randn(10, 10).to(device)
y = torch.randn(10, 10).to(device)
z = torch.mm(x, y)
print('SUCCESS: CUDA tensor operation completed on device:', z.device)
print('INFO: Result tensor shape:', z.shape)

print('SUCCESS: ExecutorTorch CUDA integration verified')
else:
print('WARNING: CUDA not detected, but ExecutorTorch built successfully')
exit(1)
except Exception as e:
print('ERROR: ExecutorTorch CUDA test failed:', e)
exit(1)
"

echo "=== Running CUDA AOTI Export Tests ==="
# Run the CUDA AOTI export tests using the Python script
python .ci/scripts/test_cuda_export_aoti.py \
--models linear conv2d add resnet18 \
--export-mode export_aoti_only \
--timeout 600 \
--cleanup

echo "SUCCESS: ExecutorTorch CUDA AOTI export ${cuda_version} tests completed successfully"
}

# Main execution
echo "Current working directory: $(pwd)"
echo "Directory contents:"
ls -la

# Run the CUDA AOTI export test
test_cuda_aoti_export "${CUDA_VERSION}"
Loading
Loading