From d81e29b6993b63aed2421dfd5d2ed05663456d52 Mon Sep 17 00:00:00 2001 From: bjacob Date: Mon, 3 Apr 2023 15:08:30 -0400 Subject: [PATCH] `iree_get_platform` return just `${IREE_ARCH}-${CMAKE_SYSTEM_NAME}` (#12699) Fixes #12692 --- build_tools/cmake/iree_run_module_test.cmake | 36 ++++++++----------- .../python/cmake_builder/rules_test.py | 6 ++-- .../e2e_model_tests/test_definitions.py | 8 ++--- .../models/generated_e2e_model_tests.cmake | 22 ++++++------ 4 files changed, 32 insertions(+), 40 deletions(-) diff --git a/build_tools/cmake/iree_run_module_test.cmake b/build_tools/cmake/iree_run_module_test.cmake index 349228f36078..facf56c1e9bc 100644 --- a/build_tools/cmake/iree_run_module_test.cmake +++ b/build_tools/cmake/iree_run_module_test.cmake @@ -5,16 +5,11 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # Utility function to return the platform name in crosscompile. -# TODO(#12692): stop leaking CMAKE_SYSTEM_PROCESSOR values. +# List of CMAKE_SYSTEM_NAME values: +# https://gitlab.kitware.com/cmake/cmake/-/issues/21489#note_1077167 +# Examples: arm_64-Android arm_32-Linux x86_64-Windows arm_64-iOS riscv_64-Linux function(iree_get_platform PLATFORM) - if(ANDROID AND CMAKE_ANDROID_ARCH_ABI STREQUAL "arm64-v8a") - set(_PLATFORM "android-arm64-v8a") - elseif(IREE_ARCH STREQUAL "x86_64") - set(_PLATFORM "x86_64") - else() - set(_PLATFORM "${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_SYSTEM_NAME}") - endif() - set(${PLATFORM} "${_PLATFORM}" PARENT_SCOPE) + set(${PLATFORM} "${IREE_ARCH}-${CMAKE_SYSTEM_NAME}" PARENT_SCOPE) endfunction() # iree_run_module_test() @@ -34,13 +29,10 @@ endfunction() # containing the same. # LABELS: Additional labels to apply to the test. The package path and # "driver=${DRIVER}" are added automatically. -# XFAIL_PLATFORMS: List of platforms (all, x86_64, android-arm64-v8a, -# riscv64-Linux, riscv32-Linux) for which the test is expected to fail -# e.g. due to issues with the upstream llvm backend. The target will be -# run, but its pass/fail status will be inverted. -# UNSUPPORTED_PLATFORMS: List of platforms (x86_64, android-arm64-v8a, -# riscv64-Linux, riscv32-Linux) not supported by the test target. The -# target will be skipped entirely. +# XFAIL_PLATFORMS: List of platforms (see iree_get_platform) for which the +# test is expected to fail. The test pass/fail status is inverted. +# UNSUPPORTED_PLATFORMS: List of platforms (see iree_get_platform) for which +# the test is skipped entirely. # DEPS: (Optional) List of targets to build the test artifacts. # TIMEOUT: (optional) Test timeout. # @@ -73,8 +65,8 @@ endfunction() # EXPECTED_OUTPUT # "mobilenet_v1_fp32_expected_output.txt" # UNSUPPORTED_PLATFORMS -# "android-arm64-v8a" -# "riscv32-Linux" +# "arm_64-Android" +# "riscv_32-Linux" # ) function(iree_run_module_test) @@ -226,10 +218,10 @@ endfunction() # iree-run-module # LABELS: Additional labels to apply to the test. The package path and # "driver=${DRIVER}" are added automatically. -# XFAIL_PLATFORMS: List of platforms (all, x86_64, android-arm64-v8a, -# riscv64-Linux, riscv32-Linux) for which the test is expected to fail -# e.g. due to issues with the upstream llvm backend. The target will be -# run, but its pass/fail status will be inverted. +# XFAIL_PLATFORMS: List of platforms (see iree_get_platform) for which the +# test is expected to fail. The test pass/fail status is inverted. +# UNSUPPORTED_PLATFORMS: List of platforms (see iree_get_platform) for which +# the test is skipped entirely. # TIMEOUT: (optional) Test timeout. # # Example: diff --git a/build_tools/python/cmake_builder/rules_test.py b/build_tools/python/cmake_builder/rules_test.py index 7e1600fcb879..5b0f7f4e67f7 100644 --- a/build_tools/python/cmake_builder/rules_test.py +++ b/build_tools/python/cmake_builder/rules_test.py @@ -156,7 +156,7 @@ def test_build_iree_benchmark_suite_module_test(self): runner_args=["--x=0", "--y=1"], timeout_secs=10, labels=["defaults", "e2e"], - xfail_platforms=["arm", "ppc"]) + xfail_platforms=["arm_64-Android", "riscv_32-Linux"]) self.assertEqual( rule, @@ -180,8 +180,8 @@ def test_build_iree_benchmark_suite_module_test(self): "defaults" "e2e" XFAIL_PLATFORMS - "arm" - "ppc" + "arm_64-Android" + "riscv_32-Linux" ) """)) diff --git a/build_tools/python/e2e_model_tests/test_definitions.py b/build_tools/python/e2e_model_tests/test_definitions.py index 06ec1323f46b..c2810c7c7983 100644 --- a/build_tools/python/e2e_model_tests/test_definitions.py +++ b/build_tools/python/e2e_model_tests/test_definitions.py @@ -18,10 +18,10 @@ class CMakePlatform(enum.Enum): """Enum of CMake system platform string.""" - ANDROID_ARMV8_A = "android-arm64-v8a" - LINUX_RISCV32 = "riscv32-Linux" - LINUX_RISCV64 = "riscv64-Linux" - LINUX_X86_64 = "x86_64" + ANDROID_ARMV8_A = "arm_64-Android" + LINUX_RISCV32 = "riscv_32-Linux" + LINUX_RISCV64 = "riscv_64-Linux" + LINUX_X86_64 = "x86_64-Linux" # Compile config used for each CMake system platform. diff --git a/tests/e2e/models/generated_e2e_model_tests.cmake b/tests/e2e/models/generated_e2e_model_tests.cmake index daf65505620d..2157e2e1d287 100644 --- a/tests/e2e/models/generated_e2e_model_tests.cmake +++ b/tests/e2e/models/generated_e2e_model_tests.cmake @@ -12,8 +12,8 @@ iree_benchmark_suite_module_test( EXPECTED_OUTPUT "mobilenet_v1_fp32_expected_output.txt" MODULES - "riscv64-Linux=iree_MobileNetV1_fp32_module_e80d71ed8e86c0756226b2323e27e2c7c0fff8eddde59ba69e9222d36ee3eef6/module.vmfb" - "x86_64=iree_MobileNetV1_fp32_module_02cebfbec13685725c5b3c805c6c620ea3f885027bfbb14d17425798e391486f/module.vmfb" + "riscv_64-Linux=iree_MobileNetV1_fp32_module_e80d71ed8e86c0756226b2323e27e2c7c0fff8eddde59ba69e9222d36ee3eef6/module.vmfb" + "x86_64-Linux=iree_MobileNetV1_fp32_module_02cebfbec13685725c5b3c805c6c620ea3f885027bfbb14d17425798e391486f/module.vmfb" RUNNER_ARGS "--function=main" "--input=1x224x224x3xf32=0" @@ -28,9 +28,9 @@ iree_benchmark_suite_module_test( EXPECTED_OUTPUT "efficientnet_int8_expected_output.txt" MODULES - "riscv32-Linux=iree_EfficientNet_int8_module_f963d812114af925e0a4b110ee83aeb0e3b41d49fad19b3f449b6a9ccba43b8d/module.vmfb" - "riscv64-Linux=iree_EfficientNet_int8_module_e850fce2d36ddb09ccc34471641adb77418b93c0949d22ab75806d7cfc489ae3/module.vmfb" - "x86_64=iree_EfficientNet_int8_module_3926415c1504dfc277674fee17bdfbd68090634b8b52620d8d5755082a89a16d/module.vmfb" + "riscv_32-Linux=iree_EfficientNet_int8_module_f963d812114af925e0a4b110ee83aeb0e3b41d49fad19b3f449b6a9ccba43b8d/module.vmfb" + "riscv_64-Linux=iree_EfficientNet_int8_module_e850fce2d36ddb09ccc34471641adb77418b93c0949d22ab75806d7cfc489ae3/module.vmfb" + "x86_64-Linux=iree_EfficientNet_int8_module_3926415c1504dfc277674fee17bdfbd68090634b8b52620d8d5755082a89a16d/module.vmfb" RUNNER_ARGS "--function=main" "--input=1x224x224x3xui8=0" @@ -45,9 +45,9 @@ iree_benchmark_suite_module_test( EXPECTED_OUTPUT "deeplab_v3_fp32_input_0_expected_output.npy" MODULES - "android-arm64-v8a=iree_DeepLabV3_fp32_module_f06fff09f8cebc27d1674045712aaa60afe7aef388c4bc505897f55c3a0d8abb/module.vmfb" - "riscv64-Linux=iree_DeepLabV3_fp32_module_68f0eb37bb72d0d6605ecdf42691c64125960e122844b0beeae350871a445b1c/module.vmfb" - "x86_64=iree_DeepLabV3_fp32_module_87aead729018ce5f114501cecefb6315086eb2a21ae1b30984b1794f619871c6/module.vmfb" + "arm_64-Android=iree_DeepLabV3_fp32_module_f06fff09f8cebc27d1674045712aaa60afe7aef388c4bc505897f55c3a0d8abb/module.vmfb" + "riscv_64-Linux=iree_DeepLabV3_fp32_module_68f0eb37bb72d0d6605ecdf42691c64125960e122844b0beeae350871a445b1c/module.vmfb" + "x86_64-Linux=iree_DeepLabV3_fp32_module_87aead729018ce5f114501cecefb6315086eb2a21ae1b30984b1794f619871c6/module.vmfb" RUNNER_ARGS "--function=main" "--input=1x257x257x3xf32=0" @@ -63,9 +63,9 @@ iree_benchmark_suite_module_test( EXPECTED_OUTPUT "1x2xi8=[72 -72]" MODULES - "riscv32-Linux=iree_PersonDetect_int8_module_1ef2da238443010024d69ceb6fe6ab6fa8cf5f4ce7d424dace3a572592043e70/module.vmfb" - "riscv64-Linux=iree_PersonDetect_int8_module_14a15b9072caaee5e2a274a9bbc436a56d095611e5a8e9841f110741d34231f9/module.vmfb" - "x86_64=iree_PersonDetect_int8_module_eb56e91246a131fa41bd335c1c072ffb6e7ffe651ecf65f4eeb171b12848b0ed/module.vmfb" + "riscv_32-Linux=iree_PersonDetect_int8_module_1ef2da238443010024d69ceb6fe6ab6fa8cf5f4ce7d424dace3a572592043e70/module.vmfb" + "riscv_64-Linux=iree_PersonDetect_int8_module_14a15b9072caaee5e2a274a9bbc436a56d095611e5a8e9841f110741d34231f9/module.vmfb" + "x86_64-Linux=iree_PersonDetect_int8_module_eb56e91246a131fa41bd335c1c072ffb6e7ffe651ecf65f4eeb171b12848b0ed/module.vmfb" RUNNER_ARGS "--function=main" "--input=1x96x96x1xi8=0"