Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jim19930609 committed Dec 27, 2022
1 parent f65dcce commit d820d80
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 9 additions & 8 deletions c_api/src/taichi_core_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<Runtime *>(vulkan_runtime));
break;
}
Expand Down
4 changes: 0 additions & 4 deletions cmake/TaichiCore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions taichi/common/utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <cstdlib>

inline bool is_ci() {
char *res = std::getenv("TI_CI");
if (res == nullptr)
return false;
return std::stoi(res);
}
15 changes: 8 additions & 7 deletions taichi/rhi/vulkan/vulkan_device_creator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d820d80

Please sign in to comment.