From dbfaf966b0f08ce879335135d951f38ea9f58593 Mon Sep 17 00:00:00 2001 From: Ivan Kobzarev Date: Fri, 29 Jan 2021 11:56:04 -0800 Subject: [PATCH] [android] turn on USE_VULKAN for android builds by default (#51291) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/51291 Turning on USE_VULKAN for android builds Remove standalone android vulkan build Testing all ci jobs (for master): https://github.com/pytorch/pytorch/pull/51292 Test Plan: Imported from OSS Reviewed By: AshkanAliabadi Differential Revision: D26141891 Pulled By: IvanKobzarev fbshipit-source-id: e8e1a4ab612c0786ce09217ab9370fd75a71eb00 --- .circleci/cimodel/data/simple/android_definitions.py | 1 - .circleci/config.yml | 6 ------ CMakeLists.txt | 8 +++++++- android/pytorch_android/CMakeLists.txt | 8 ++------ 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/.circleci/cimodel/data/simple/android_definitions.py b/.circleci/cimodel/data/simple/android_definitions.py index 0a5145e79b8..82483e4716b 100644 --- a/.circleci/cimodel/data/simple/android_definitions.py +++ b/.circleci/cimodel/data/simple/android_definitions.py @@ -79,7 +79,6 @@ WORKFLOW_DATA = [ AndroidJob(["x86_64"], "pytorch_linux_build"), AndroidJob(["arm", "v7a"], "pytorch_linux_build"), AndroidJob(["arm", "v8a"], "pytorch_linux_build"), - AndroidJob(["vulkan", "x86_32"], "pytorch_linux_build", is_master_only=False), AndroidGradleJob( "pytorch-linux-xenial-py3-clang5-android-ndk-r19c-gradle-build-x86_32", "pytorch_android_gradle_build-x86_32", diff --git a/.circleci/config.yml b/.circleci/config.yml index 3fceba2db8d..26ed69ae691 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7103,12 +7103,6 @@ workflows: name: pytorch_linux_xenial_py3_clang5_android_ndk_r19c_arm_v8a_build requires: - docker-pytorch-linux-xenial-py3-clang5-android-ndk-r19c - - pytorch_linux_build: - build_environment: "pytorch-linux-xenial-py3-clang5-android-ndk-r19c-vulkan-x86_32-build" - docker_image: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-py3-clang5-android-ndk-r19c" - name: pytorch_linux_xenial_py3_clang5_android_ndk_r19c_vulkan_x86_32_build - requires: - - docker-pytorch-linux-xenial-py3-clang5-android-ndk-r19c - pytorch_android_gradle_build-x86_32: filters: branches: diff --git a/CMakeLists.txt b/CMakeLists.txt index 550b7812f34..b2e36595c48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -219,7 +219,13 @@ option(USE_TENSORRT "Using Nvidia TensorRT library" OFF) cmake_dependent_option( USE_VALGRIND "Use Valgrind. Only available on Linux." ON "LINUX" OFF) -option(USE_VULKAN "Use Vulkan GPU backend" OFF) + +if(NOT DEFINED USE_VULKAN) + cmake_dependent_option( + USE_VULKAN "Use Vulkan GPU backend" ON + "ANDROID" OFF) +endif() + option(USE_VULKAN_FP16_INFERENCE "Vulkan - Use fp16 inference even on fp32 tensors" OFF) option(USE_VULKAN_RELAXED_PRECISION "Vulkan - Use relaxed precision math in the kernels (mediump)" OFF) option(USE_VULKAN_SHADERC_RUNTIME "Vulkan - Use runtime shader compilation (needs libshaderc)" OFF) diff --git a/android/pytorch_android/CMakeLists.txt b/android/pytorch_android/CMakeLists.txt index 290d5aba930..febd97ea4f3 100644 --- a/android/pytorch_android/CMakeLists.txt +++ b/android/pytorch_android/CMakeLists.txt @@ -17,17 +17,13 @@ endif() if(NOT TRACE_ENABLED) message(STATUS "TRACE_ENABLED OFF") endif() + set(USE_VULKAN OFF) -if(DEFINED ENV{USE_VULKAN}) - if($ENV{USE_VULKAN} STREQUAL "1") - message(STATUS "USE_VULKAN ON") - set(USE_VULKAN ON) - endif() -endif() set(pytorch_android_DIR ${CMAKE_CURRENT_LIST_DIR}/src/main/cpp) if(ANDROID_ABI) + set(USE_VULKAN ON) set(libtorch_include_DIR ${pytorch_android_DIR}/libtorch_include/${ANDROID_ABI}) set(BUILD_SUBDIR ${ANDROID_ABI}) elseif(BUILD_LIBTORCH_WITH_JNI)