diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index a0e63053fb4e4..20afd1fd1a720 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -103,7 +103,7 @@ jobs: docker exec --user dev check_clang_tidy /home/dev/taichi/.github/workflows/scripts/check_clang_tidy.sh "$CI_SETUP_CMAKE_ARGS" env: CR_PAT: ${{ secrets.GITHUB_TOKEN }} - CI_SETUP_CMAKE_ARGS: -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DTI_WITH_OPENGL:BOOL=ON -DTI_WITH_CC:BOOL=ON -DTI_WITH_VULKAN:BOOL=ON -DTI_BUILD_TESTS:BOOL=ON -DTI_BUILD_CI:BOOL=ON -DTI_WITH_BACKTRACE:BOOL=ON + CI_SETUP_CMAKE_ARGS: -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DTI_WITH_OPENGL:BOOL=ON -DTI_WITH_CC:BOOL=ON -DTI_WITH_VULKAN:BOOL=ON -DTI_BUILD_TESTS:BOOL=ON -DTI_WITH_BACKTRACE:BOOL=ON build_and_test_cpu_mac: name: Build and Test macos (CPU) @@ -149,7 +149,6 @@ jobs: -DTI_WITH_VULKAN:BOOL=ON -DTI_WITH_C_API=ON -DTI_WITH_BACKTRACE:BOOL=ON - -DTI_BUILD_CI:BOOL=ON -DTI_BUILD_TESTS:BOOL=${{ matrix.with_cpp_tests }} # [DEBUG] Copy this step around to enable debugging inside Github Action instances. @@ -215,7 +214,6 @@ jobs: -DTI_WITH_VULKAN:BOOL=ON -DTI_WITH_BACKTRACE:BOOL=ON -DTI_BUILD_TESTS:BOOL=ON - -DTI_BUILD_CI:BOOL=ON -DTI_WITH_C_API=ON - name: Check C-API Export Symbols @@ -304,7 +302,6 @@ jobs: -DTI_WITH_VULKAN:BOOL=OFF -DTI_WITH_OPENGL:BOOL=OFF -DTI_BUILD_TESTS:BOOL=ON - -DTI_BUILD_CI:BOOL=ON - name: Test id: test @@ -373,7 +370,6 @@ jobs: -DTI_WITH_DX12:BOOL=ON -DTI_WITH_CC:BOOL=OFF -DTI_BUILD_TESTS:BOOL=ON - -DTI_BUILD_CI:BOOL=ON -DTI_WITH_BACKTRACE=ON -DTI_WITH_C_API=ON @@ -435,7 +431,6 @@ jobs: -DTI_WITH_CC:BOOL=OFF -DTI_WITH_VULKAN:BOOL=ON -DTI_BUILD_TESTS:BOOL=ON - -DTI_BUILD_CI:BOOL=ON -DTI_WITH_BACKTRACE:BOOL=ON -DTI_WITH_C_API=ON diff --git a/CMakeLists.txt b/CMakeLists.txt index 360bf50dc0ff5..1a220b8570364 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,7 +64,6 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) option(USE_LLD "Use lld (from llvm) linker" OFF) option(USE_MOLD "Use mold (A Modern Linker)" OFF) -option(TI_BUILD_CI "(Internal Use) Enable certain validations and possible debuggers for Taichi CI system" OFF) option(TI_WITH_BACKTRACE "Use backward-cpp to print out C++ stack trace upon failure" OFF) if(LINUX OR APPLE) diff --git a/c_api/src/taichi_core_impl.cpp b/c_api/src/taichi_core_impl.cpp index 97faebef0ed10..920172ea59202 100644 --- a/c_api/src/taichi_core_impl.cpp +++ b/c_api/src/taichi_core_impl.cpp @@ -5,6 +5,7 @@ #include "taichi/program/ndarray.h" #include "taichi/program/texture.h" #include "taichi/common/virtual_dir.h" +#include "taichi/common/utils.h" bool is_vulkan_available() { #ifdef TI_WITH_VULKAN @@ -225,14 +226,14 @@ TiRuntime ti_create_runtime(TiArch arch) { switch (arch) { #ifdef TI_WITH_VULKAN case TI_ARCH_VULKAN: { -#ifdef TI_BUILD_CI - auto param = make_vulkan_runtime_creator_params(); - param.enable_validation_layer = true; - auto vulkan_runtime = new VulkanRuntimeOwned(std::move(param)); -#else - auto vulkan_runtime = new VulkanRuntimeOwned; -#endif - + VulkanRuntimeOwned *vulkan_runtime; + if (is_ci()) { + auto param = make_vulkan_runtime_creator_params(); + param.enable_validation_layer = true; + vulkan_runtime = new VulkanRuntimeOwned(std::move(param)); + } else { + vulkan_runtime = new VulkanRuntimeOwned; + } out = (TiRuntime)(static_cast(vulkan_runtime)); break; } diff --git a/cmake/TaichiCore.cmake b/cmake/TaichiCore.cmake index 3aaea31358214..241d8df91922a 100644 --- a/cmake/TaichiCore.cmake +++ b/cmake/TaichiCore.cmake @@ -97,10 +97,6 @@ if(TI_WITH_LLVM) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTI_WITH_LLVM") endif() -if(TI_BUILD_CI) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTI_BUILD_CI") -endif() - ## This version var is only used to locate slim_libdevice.10.bc if(NOT CUDA_VERSION) set(CUDA_VERSION 10.0) diff --git a/taichi/common/utils.h b/taichi/common/utils.h new file mode 100644 index 0000000000000..5c6cafd798981 --- /dev/null +++ b/taichi/common/utils.h @@ -0,0 +1,8 @@ +#include + +inline bool is_ci() { + char *res = std::getenv("TI_CI"); + if (res == nullptr) + return false; + return std::stoi(res); +} diff --git a/taichi/rhi/vulkan/vulkan_device_creator.cpp b/taichi/rhi/vulkan/vulkan_device_creator.cpp index 02181fdb4753c..1d56d557883c8 100644 --- a/taichi/rhi/vulkan/vulkan_device_creator.cpp +++ b/taichi/rhi/vulkan/vulkan_device_creator.cpp @@ -9,6 +9,7 @@ #include "taichi/rhi/vulkan/vulkan_common.h" #include "taichi/rhi/vulkan/vulkan_loader.h" #include "taichi/rhi/vulkan/vulkan_device.h" +#include "taichi/common/utils.h" namespace taichi::lang { namespace vulkan { @@ -72,13 +73,13 @@ vk_debug_callback(VkDebugUtilsMessageSeverityFlagBitsEXT message_severity, snprintf(msg_buf, sizeof(msg_buf), "Vulkan validation layer: %d, %s", message_type, p_callback_data->pMessage); -#ifdef TI_BUILD_CI - auto msg_name = std::string(p_callback_data->pMessageIdName); - if (!vk_ignore_validation_warning(msg_name)) - TI_ERROR(msg_buf); -#else - RHI_LOG_ERROR(msg_buf); -#endif + if (is_ci()) { + auto msg_name = std::string(p_callback_data->pMessageIdName); + if (!vk_ignore_validation_warning(msg_name)) + TI_ERROR(msg_buf); + } else { + RHI_LOG_ERROR(msg_buf); + } } return VK_FALSE;