From 9420f4e3238bcf03ee1b91bf6565052efcf2fd5b Mon Sep 17 00:00:00 2001 From: Michael Gschwind <61328285+mikekgfb@users.noreply.github.com> Date: Wed, 11 Dec 2024 09:32:25 -0800 Subject: [PATCH 1/3] bandaid for run-readme-pr-macos.yml incorrectly loading to MPS as per #1416 torchchat on hosts without MPS (which is all github hosts which use kvm to virtualize MacOS, but not MPS) should choose CPU as "fast" device. The logic is present (see discussion in #1416 ), but either not fully functional (that would be the easier one to fix, just print the result of get_device_str and fix the code!) or specifically ignored on load in torch/serialization.py (If this is the case, we're effectively looking at a core PyTorch issue....) In the meantime, this bandaid just forces the use of CPU on MacOS tests, to make MacOS tests run on CPU -- labeit hsortcircuiting test/execution of the "fast" device logic. Not ideal, but some testing beats no testing. --- .github/workflows/run-readme-pr-macos.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-readme-pr-macos.yml b/.github/workflows/run-readme-pr-macos.yml index 64afe2247..b11251132 100644 --- a/.github/workflows/run-readme-pr-macos.yml +++ b/.github/workflows/run-readme-pr-macos.yml @@ -33,7 +33,7 @@ jobs: sysctl machdep.cpu.core_count echo "::endgroup::" - .ci/scripts/run-docs readme + TORCHCHAT_DEVICE=cpu .ci/scripts/run-docs readme echo "::group::Completion" echo "tests complete" @@ -68,7 +68,7 @@ jobs: sysctl machdep.cpu.core_count echo "::endgroup::" - .ci/scripts/run-docs quantization + TORCHCHAT_DEVICE=cpu .ci/scripts/run-docs quantization echo "::group::Completion" echo "tests complete" @@ -103,7 +103,7 @@ jobs: sysctl machdep.cpu.core_count echo "::endgroup::" - .ci/scripts/run-docs gguf + TORCHCHAT_DEVICE=cpu .ci/scripts/run-docs gguf echo "::group::Completion" echo "tests complete" @@ -137,7 +137,7 @@ jobs: sysctl machdep.cpu.core_count echo "::endgroup::" - .ci/scripts/run-docs advanced + TORCHCHAT_DEVICE=cpu .ci/scripts/run-docs advanced echo "::group::Completion" echo "tests complete" From 63f83074deac66ef38ba6019a24289f6a2a27037 Mon Sep 17 00:00:00 2001 From: Michael Gschwind <61328285+mikekgfb@users.noreply.github.com> Date: Wed, 11 Dec 2024 09:45:04 -0800 Subject: [PATCH 2/3] Update run-readme-pr-macos.yml Add informational message to MacOS CPU tests --- .github/workflows/run-readme-pr-macos.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/run-readme-pr-macos.yml b/.github/workflows/run-readme-pr-macos.yml index b11251132..67c7a6cca 100644 --- a/.github/workflows/run-readme-pr-macos.yml +++ b/.github/workflows/run-readme-pr-macos.yml @@ -33,6 +33,7 @@ jobs: sysctl machdep.cpu.core_count echo "::endgroup::" + echo "using workaround for #1416 and #1315 by setting torchchat device explicitly" TORCHCHAT_DEVICE=cpu .ci/scripts/run-docs readme echo "::group::Completion" @@ -68,6 +69,7 @@ jobs: sysctl machdep.cpu.core_count echo "::endgroup::" + echo "using workaround for #1416 and #1315 by setting torchchat device explicitly" TORCHCHAT_DEVICE=cpu .ci/scripts/run-docs quantization echo "::group::Completion" @@ -103,6 +105,7 @@ jobs: sysctl machdep.cpu.core_count echo "::endgroup::" + echo "using workaround for #1416 and #1315 by setting torchchat device explicitly" TORCHCHAT_DEVICE=cpu .ci/scripts/run-docs gguf echo "::group::Completion" @@ -137,6 +140,7 @@ jobs: sysctl machdep.cpu.core_count echo "::endgroup::" + echo "using workaround for #1416 and #1315 by setting torchchat device explicitly" TORCHCHAT_DEVICE=cpu .ci/scripts/run-docs advanced echo "::group::Completion" From 1709bf9c9f522204b337b21b6b8956c483f551a1 Mon Sep 17 00:00:00 2001 From: Michael Gschwind <61328285+mikekgfb@users.noreply.github.com> Date: Sat, 28 Dec 2024 23:15:45 -0800 Subject: [PATCH 3/3] Update build_native.sh Update to C++11 ABI for AOTI, similar to ET --- torchchat/utils/scripts/build_native.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torchchat/utils/scripts/build_native.sh b/torchchat/utils/scripts/build_native.sh index 3c2c1c846..a935fa74c 100755 --- a/torchchat/utils/scripts/build_native.sh +++ b/torchchat/utils/scripts/build_native.sh @@ -93,7 +93,7 @@ popd if [[ "$TARGET" == "et" ]]; then cmake -S . -B ./cmake-out -DCMAKE_PREFIX_PATH=`python3 -c 'import torch;print(torch.utils.cmake_prefix_path)'` -DLINK_TORCHAO_OPS="${LINK_TORCHAO_OPS}" -DET_USE_ADAPTIVE_THREADS=ON -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=1" -G Ninja else - cmake -S . -B ./cmake-out -DCMAKE_PREFIX_PATH=`python3 -c 'import torch;print(torch.utils.cmake_prefix_path)'` -DLINK_TORCHAO_OPS="${LINK_TORCHAO_OPS}" -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" -G Ninja + cmake -S . -B ./cmake-out -DCMAKE_PREFIX_PATH=`python3 -c 'import torch;print(torch.utils.cmake_prefix_path)'` -DLINK_TORCHAO_OPS="${LINK_TORCHAO_OPS}" -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=1" -G Ninja fi cmake --build ./cmake-out --target "${TARGET}"_run