File tree Expand file tree Collapse file tree 4 files changed +53
-1
lines changed Expand file tree Collapse file tree 4 files changed +53
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ install_swiftshader() {
23
23
24
24
export VK_ICD_FILENAMES=" ${_swiftshader_dir} /swiftshader/build/Linux/vk_swiftshader_icd.json"
25
25
export LD_LIBRARY_PATH=" ${_swiftshader_dir} /swiftshader/build/Linux/"
26
+ export ETVK_USING_SWIFTSHADER=1
26
27
}
27
28
28
29
install_vulkan_sdk () {
Original file line number Diff line number Diff line change @@ -864,6 +864,43 @@ jobs:
864
864
PYTHON_EXECUTABLE=python bash examples/nxp/run_aot_example.sh
865
865
866
866
867
+ test-vulkan-models-linux :
868
+ name : test-vulkan-models-linux
869
+ uses : pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
870
+ permissions :
871
+ id-token : write
872
+ contents : read
873
+ with :
874
+ runner : linux.2xlarge
875
+ docker-image : ci-image:executorch-ubuntu-22.04-clang12
876
+ submodules : ' recursive'
877
+ ref : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
878
+ timeout : 90
879
+ script : |
880
+ set -eux
881
+
882
+ # The generic Linux job chooses to use base env, not the one setup by the image
883
+ CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
884
+ conda activate "${CONDA_ENV}"
885
+
886
+ # Setup swiftshader and Vulkan SDK which are required to build the Vulkan delegate
887
+ source .ci/scripts/setup-vulkan-linux-deps.sh
888
+
889
+ # Setup python
890
+ PYTHON_EXECUTABLE=python \
891
+ CMAKE_ARGS="-DEXECUTORCH_BUILD_VULKAN=ON" \
892
+ .ci/scripts/setup-linux.sh --build-tool "cmake"
893
+
894
+ PYTHON_EXECUTABLE=python bash backends/vulkan/test/scripts/test_model.sh --build
895
+
896
+ # Test models serially
897
+ models="mv2 mv3 edsr resnet18 resnet50 dl3"
898
+ for model in $models; do
899
+ python -m examples.vulkan.export --model_name=$model --test
900
+ done
901
+
902
+
903
+
867
904
nxp-build-test :
868
905
name : nxp-build-test
869
906
uses : pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
Original file line number Diff line number Diff line change @@ -49,6 +49,15 @@ function(gen_vulkan_shader_lib_cpp shaders_path)
49
49
set (VULKAN_SHADERGEN_ENV "" )
50
50
set (VULKAN_SHADERGEN_OUT_PATH ${CMAKE_BINARY_DIR} /vulkan_compute_shaders )
51
51
52
+ set (GEN_SPV_ARGS "--optimize" )
53
+ if (DEFINED ENV{ETVK_USING_SWIFTSHADER} )
54
+ if ("$ENV{ETVK_USING_SWIFTSHADER} " STREQUAL "1"
55
+ OR "$ENV{ETVK_USING_SWIFTSHADER} " STREQUAL "True"
56
+ )
57
+ list (APPEND GEN_SPV_ARGS "--replace-u16vecn" )
58
+ endif ()
59
+ endif ()
60
+
52
61
add_custom_command (
53
62
COMMENT "Generating Vulkan Compute Shaders"
54
63
OUTPUT ${VULKAN_SHADERGEN_OUT_PATH} /spv.cpp
@@ -58,7 +67,7 @@ function(gen_vulkan_shader_lib_cpp shaders_path)
58
67
${shaders_path} --output-path ${VULKAN_SHADERGEN_OUT_PATH}
59
68
--glslc-path=${GLSLC_PATH}
60
69
--tmp-dir-path=${VULKAN_SHADERGEN_OUT_PATH}/shader_cache/ --env
61
- ${VULKAN_GEN_ARG_ENV} --optimize
70
+ ${VULKAN_GEN_ARG_ENV} ${GEN_SPV_ARGS}
62
71
DEPENDS ${shaders_path} /*
63
72
${EXECUTORCH_ROOT} /backends/vulkan/runtime/gen_vulkan_spv.py
64
73
)
Original file line number Diff line number Diff line change 6
6
7
7
8
8
import logging
9
+ from collections import OrderedDict
9
10
from typing import List , Optional , Tuple
10
11
11
12
import executorch .backends .vulkan .utils as utils
@@ -114,6 +115,10 @@ def check_outputs_equal(
114
115
Helper function that checks if model output and reference output are equal with some tolerance.
115
116
Returns True if equal, False otherwise.
116
117
"""
118
+ # Convert OrderedDict to list if needed
119
+ if isinstance (ref_output , OrderedDict ):
120
+ ref_output = list (ref_output .values ())
121
+
117
122
# Compare the result from executor and eager mode directly
118
123
if isinstance (ref_output , tuple ) or isinstance (ref_output , list ):
119
124
# Multiple outputs executor always returns tuple, even if there is one output
You can’t perform that action at this time.
0 commit comments