From 83f3babafb01cbff74e16ad95e51ea5dd32c435a Mon Sep 17 00:00:00 2001 From: Hansong Zhang <107070759+kirklandsign@users.noreply.github.com> Date: Thu, 25 Sep 2025 10:09:35 -0700 Subject: [PATCH] Android use new glslc (#14596) Validated by workflow https://github.com/pytorch/executorch/actions/runs/18013292360 Currently download SDK each time when we build vulkan AAR. Co-authored-by: Stephen Jia (cherry picked from commit ebabf521678e3864a9c11daed99a40c1de77612d) --- .../workflows/android-release-artifacts.yml | 3 +++ backends/vulkan/cmake/ShaderLibrary.cmake | 25 ++++++++----------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/workflows/android-release-artifacts.yml b/.github/workflows/android-release-artifacts.yml index 89e604c75f3..1b746e37166 100644 --- a/.github/workflows/android-release-artifacts.yml +++ b/.github/workflows/android-release-artifacts.yml @@ -94,6 +94,9 @@ jobs: FLAVOR="${{ inputs.flavor }}" if [[ "$FLAVOR" == "vulkan+xnnpack" || -z "$FLAVOR" ]]; then + curl -O https://sdk.lunarg.com/sdk/download/1.4.321.1/linux/vulkansdk-linux-x86_64-1.4.321.1.tar.xz + tar xf vulkansdk-linux-x86_64-1.4.321.1.tar.xz -C /tmp + export PATH="/tmp/1.4.321.1/x86_64/bin:$PATH" export EXECUTORCH_BUILD_VULKAN=ON fi diff --git a/backends/vulkan/cmake/ShaderLibrary.cmake b/backends/vulkan/cmake/ShaderLibrary.cmake index 1b6838c4dfd..16a60abf6f3 100644 --- a/backends/vulkan/cmake/ShaderLibrary.cmake +++ b/backends/vulkan/cmake/ShaderLibrary.cmake @@ -24,22 +24,17 @@ if(NOT EXECUTORCH_ROOT) message("WARNING: EXECUTORCH_ROOT is not set! A failure is likely imminent.") endif() -if(ANDROID) - if(NOT ANDROID_NDK) - message(FATAL_ERROR "ANDROID_NDK not set") - endif() - - if(NOT GLSLC_PATH) - set(GLSLC_PATH - "${ANDROID_NDK}/shader-tools/${ANDROID_NDK_HOST_SYSTEM_NAME}/glslc" - ) - endif() -else() - find_program(GLSLC_PATH glslc PATHS $ENV{PATH}) +find_program(GLSLC_PATH glslc PATHS $ENV{PATH}) - if(NOT GLSLC_PATH) - message(FATAL_ERROR "USE_VULKAN glslc not found") - endif() +if(NOT GLSLC_PATH) + message( + FATAL_ERROR + "glslc from the Vulkan SDK must be installed to build the Vulkan backend. " + "Please install the Vulkan SDK 1.4.321.0 or newer from " + "https://vulkan.lunarg.com/sdk/home and ensure that the glslc binary is in your PATH. " + "Note that the glslc distributed with the Android NDK is not compatible since it " + "does not support the GL_EXT_integer_dot_product extension. " + ) endif() # Required to enable linking with --whole-archive