Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[misc] Bump spdlog version and fix unformattable error #8543

Merged
merged 12 commits into from
Jun 17, 2024
8 changes: 8 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,11 @@
[submodule "external/backward_cpp"]
path = external/backward_cpp
url = https://github.com/bombela/backward-cpp.git
[submodule "./SPIRV-Tools"]
branch = main
[submodule "./SPIRV-Cross"]
branch = main
[submodule "./SPIRV-Headers"]
branch = main
[submodule "./SPIRV-Reflect"]
branch = main
22 changes: 11 additions & 11 deletions c_api/tests/c_api_behavior_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ TEST_F(CapiTest, TestBehaviorDestroyRuntime) {
TEST_F(CapiTest, TestBehaviorGetRuntimeCapabilities) {
auto inner = [this](TiArch arch) {
if (!ti::is_arch_available(arch)) {
TI_WARN("arch {} is not supported so the test is skipped", arch);
TI_WARN("arch {} is not supported so the test is skipped", int(arch));
return;
}

Expand Down Expand Up @@ -95,7 +95,7 @@ TEST_F(CapiTest, TestBehaviorGetRuntimeCapabilities) {
TEST_F(CapiTest, TestBehaviorAllocateMemory) {
auto inner = [&](TiArch arch) {
if (!ti::is_arch_available(arch)) {
TI_WARN("arch {} is not supported, so this test is skipped", arch);
TI_WARN("arch {} is not supported, so this test is skipped", int(arch));
return;
}

Expand Down Expand Up @@ -141,7 +141,7 @@ TEST_F(CapiTest, TestBehaviorAllocateMemory) {
TEST_F(CapiTest, TestBehaviorFreeMemory) {
auto inner = [this](TiArch arch) {
if (!ti::is_arch_available(arch)) {
TI_WARN("arch {} is not supported, so the test is skipped", arch);
TI_WARN("arch {} is not supported, so the test is skipped", int(arch));
return;
}

Expand Down Expand Up @@ -172,7 +172,7 @@ TEST_F(CapiTest, TestBehaviorFreeMemory) {
TEST_F(CapiTest, TestBehaviorMapMemory) {
auto inner = [this](TiArch arch) {
if (!ti::is_arch_available(arch)) {
TI_WARN("arch {} is not supported, so the test is skipped", arch);
TI_WARN("arch {} is not supported, so the test is skipped", int(arch));
return;
}

Expand Down Expand Up @@ -206,7 +206,7 @@ TEST_F(CapiTest, TestBehaviorMapMemory) {
TEST_F(CapiTest, TestBehaviorUnmapMemory) {
auto inner = [&](TiArch arch) {
if (!ti::is_arch_available(arch)) {
TI_WARN("arch {} is nor supported, so the test is skipped", arch);
TI_WARN("arch {} is nor supported, so the test is skipped", int(arch));
return;
}

Expand Down Expand Up @@ -252,7 +252,7 @@ inline TiImageAllocateInfo make_image_allocate_info() {
TEST_F(CapiTest, TestBehaviorAllocateImage) {
auto inner = [&](TiArch arch) {
if (!ti::is_arch_available(arch)) {
TI_WARN("arch {} is not supported, so the test is skipped", arch);
TI_WARN("arch {} is not supported, so the test is skipped", int(arch));
return;
}

Expand Down Expand Up @@ -305,7 +305,7 @@ TEST_F(CapiTest, TestBehaviorFreeImage) {
auto inner = [&](TiArch arch) {
// Attemp to free a normal 2D image
if (!ti::is_arch_available(arch)) {
TI_WARN("arch {} is not supported, so the test is skipped", arch);
TI_WARN("arch {} is not supported, so the test is skipped", int(arch));
return;
}

Expand Down Expand Up @@ -336,7 +336,7 @@ TEST_F(CapiTest, TestBehaviorFreeImage) {
TEST_F(CapiTest, TestBehaviorCopyMemoryDTD) {
auto inner = [&](TiArch arch) {
if (!ti::is_arch_available(arch)) {
TI_WARN("arch {} is not supported, so the test is skipped", arch);
TI_WARN("arch {} is not supported, so the test is skipped", int(arch));
return;
}

Expand Down Expand Up @@ -390,7 +390,7 @@ TEST_F(CapiTest, TestBehaviorLoadAOTModuleVulkan) {
const std::string module_path = folder_dir + std::string("/module.tcm");

if (!ti::is_arch_available(arch)) {
TI_WARN("arch {} is not supported, so the test is skipped", arch);
TI_WARN("arch {} is not supported, so the test is skipped", int(arch));
return;
}
ti::Runtime runtime(arch);
Expand Down Expand Up @@ -446,7 +446,7 @@ TEST_F(CapiTest, TestBehaviorDestroyAotModuleVulkan) {
const auto folder_dir = getenv("TAICHI_AOT_FOLDER_PATH");
const std::string module_path = folder_dir + std::string("/module.tcm");
if (!ti::is_arch_available(arch)) {
TI_WARN("arch {} is not supported, so the test is skipped", arch);
TI_WARN("arch {} is not supported, so the test is skipped", int(arch));
return;
}

Expand All @@ -463,7 +463,7 @@ TEST_F(CapiTest, TestBehaviorGetCgraphVulkan) {
const auto folder_dir = getenv("TAICHI_AOT_FOLDER_PATH");
const std::string module_path = folder_dir;
if (!ti::is_arch_available(arch)) {
TI_WARN("arch {} is not supported, so the test is skipped", arch);
TI_WARN("arch {} is not supported, so the test is skipped", int(arch));
return;
}

Expand Down
2 changes: 1 addition & 1 deletion external/backward_cpp
2 changes: 1 addition & 1 deletion external/spdlog
Submodule spdlog updated 185 files
2 changes: 1 addition & 1 deletion taichi/aot/graph_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ void CompiledGraph::init_runtime_context(
mat->length() * data_type_size(mat->dtype()));
ctx.set_arg_matrix(i, *mat);
} else {
TI_ERROR("Error in compiled graph: unknown tag {}", ival.tag);
TI_ERROR("Error in compiled graph: unknown tag {}", int(ival.tag));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion taichi/codegen/spirv/spirv_ir_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ Value IRBuilder::get_const(const SType &dtype,
}

TI_WARN_IF(dtype.flag != TypeKind::kPrimitive,
"Trying to get const with dtype.flag={} , .dt={}", dtype.flag,
"Trying to get const with dtype.flag={} , .dt={}", int(dtype.flag),
dtype.dt.to_string());
Value ret = new_value(dtype, ValueKind::kConstant);
if (dtype.dt->is_primitive(PrimitiveTypeID::u1)) {
Expand Down
2 changes: 1 addition & 1 deletion taichi/common/exceptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class TaichiWarning : public TaichiExceptionImpl {
using TaichiExceptionImpl::TaichiExceptionImpl;

protected:
static constexpr std::string_view name_;
static constexpr std::string_view name_ = "TaichiWarning";

public:
void emit() {
Expand Down
16 changes: 8 additions & 8 deletions taichi/common/serialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ inline std::vector<uint8_t> read_data_from_file(const std::string &fn) {
return zip::read(fn);
} else {
// Read uncompressed file, e.g. particles.tcb
assert(f != nullptr);
TI_ASSERT(f != nullptr);
std::size_t length = 0;
while (true) {
size_t limit = 1 << 8;
Expand All @@ -278,7 +278,7 @@ inline void write_data_to_file(const std::string &fn,
if (f == nullptr) {
TI_ERROR("Cannot open file [{}] for writing. (Does the directory exist?)",
fn);
assert(f != nullptr);
TI_ASSERT(f != nullptr);
}
if (ends_with(fn, ".tcb.zip")) {
std::fclose(f);
Expand Down Expand Up @@ -324,7 +324,7 @@ class BinarySerializer : public Serializer {
void write_to_file(const std::string &fn) {
void *ptr = c_data;
if (!ptr) {
assert(!data.empty());
TI_ASSERT(!data.empty());
ptr = &data[0];
}
write_data_to_file(fn, reinterpret_cast<uint8_t *>(ptr), head);
Expand All @@ -333,7 +333,7 @@ class BinarySerializer : public Serializer {
void write_to_stream(std::ostream &os) {
void *ptr = c_data;
if (!ptr) {
assert(!data.empty());
TI_ASSERT(!data.empty());
ptr = &data[0];
}
os.write(reinterpret_cast<const char *>(ptr), head);
Expand All @@ -349,7 +349,7 @@ class BinarySerializer : public Serializer {
TI_TRACE("preserved = {}", preserved_);
// Preserved mode
this->preserved = preserved_;
assert(c_data != nullptr);
TI_ASSERT(c_data != nullptr);
this->c_data = (uint8_t *)c_data;
} else {
// otherwise use a std::vector<uint8_t>
Expand All @@ -365,11 +365,11 @@ class BinarySerializer : public Serializer {
void *raw_data,
std::size_t preserved_ = std::size_t(0)) {
if (preserved_ != 0) {
assert(raw_data == nullptr);
TI_ASSERT(raw_data == nullptr);
data.resize(preserved_);
c_data = &data[0];
} else {
assert(raw_data != nullptr);
TI_ASSERT(raw_data != nullptr);
c_data = reinterpret_cast<uint8_t *>(raw_data);
}
head = sizeof(std::size_t);
Expand All @@ -389,7 +389,7 @@ class BinarySerializer : public Serializer {
*reinterpret_cast<std::size_t *>(&data[0]) = head;
}
} else {
assert(head == retrieve_length());
TI_ASSERT(head == retrieve_length());
}
}

Expand Down
6 changes: 4 additions & 2 deletions taichi/python/export_lang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,8 @@ void export_lang(py::module &m) {
#include "taichi/inc/data_type_with_c_type.inc.h"
#undef PER_C_TYPE
default:
TI_ERROR("Unsupported scalar type {}", type_id);
TI_ERROR("Unsupported scalar type {}",
expected_dtype->to_string());
}
};

Expand Down Expand Up @@ -744,7 +745,8 @@ void export_lang(py::module &m) {
#include "taichi/inc/data_type_with_c_type.inc.h"
#undef PER_C_TYPE
default:
TI_ERROR("Unsupported scalar type {}", type_id);
TI_ERROR("Unsupported scalar type {}",
arg.dtype()->to_string());
}
} else {
TI_NOT_IMPLEMENTED;
Expand Down
2 changes: 1 addition & 1 deletion taichi/rhi/cuda/cuda_profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ProfilingToolkit get_toolkit_enum(std::string toolkit_name) {
bool KernelProfilerCUDA::set_profiler_toolkit(std::string toolkit_name) {
sync();
ProfilingToolkit set_toolkit = get_toolkit_enum(toolkit_name);
TI_TRACE("profiler toolkit enum = {} >>> {}", tool_, set_toolkit);
TI_TRACE("profiler toolkit enum = {} >>> {}", int(tool_), int(set_toolkit));
if (set_toolkit == tool_)
return true;

Expand Down
17 changes: 17 additions & 0 deletions taichi/rhi/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@

namespace taichi::lang {

const std::string rhi_result_to_string(RhiResult result) {
switch (result) {
case RhiResult::success:
return "success";
case RhiResult::error:
return "error";
case RhiResult::invalid_usage:
return "invalid_usage";
case RhiResult::not_supported:
return "not_supported";
case RhiResult::out_of_memory:
return "out_of_memory";
default:
return "unknown";
}
}

DeviceAllocationGuard::~DeviceAllocationGuard() {
device->dealloc_memory(*this);
}
Expand Down
4 changes: 2 additions & 2 deletions taichi/rhi/dx/dx_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,8 @@ HRESULT create_compute_device(ID3D11Device **out_device,
#endif

if (FAILED(hr) || device == nullptr) {
TI_WARN("Failed to create D3D11 device with type {}: {}\n", driver_type,
driver_type_names[attempt_idx]);
TI_WARN("Failed to create D3D11 device with type {}: {}\n",
int(driver_type), driver_type_names[attempt_idx]);
continue;
}

Expand Down
15 changes: 15 additions & 0 deletions taichi/rhi/public_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ enum class RhiResult {
out_of_memory = -4,
};

const std::string rhi_result_to_string(RhiResult result);

constexpr size_t kBufferSizeEntireSize = std::numeric_limits<size_t>::max();

#define MAKE_ENUM_FLAGS(name) \
Expand Down Expand Up @@ -1012,3 +1014,16 @@ class RHI_DLL_EXPORT GraphicsDevice : public Device {
};

} // namespace taichi::lang

template <>
class fmt::formatter<taichi::lang::RhiResult> {
public:
constexpr auto parse(format_parse_context &ctx) {
return ctx.begin();
}
template <typename Context>
constexpr auto format(taichi::lang::RhiResult const &res,
Context &ctx) const {
return format_to(ctx.out(), taichi::lang::rhi_result_to_string(res));
}
};
2 changes: 1 addition & 1 deletion taichi/runtime/llvm/llvm_offline_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ std::unique_ptr<llvm::Module> LlvmOfflineCacheFileReader::load_module(
}
return ret;
}
TI_ERROR("Unknown LLVM format={}", format_);
TI_ERROR("Unknown LLVM format={}", int(format_));
return nullptr;
}

Expand Down
4 changes: 3 additions & 1 deletion taichi/transforms/ir_printer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ class IRPrinter : public IRVisitor {
}

void visit(FrontendExprStmt *stmt) override {
print("{}", (stmt->val));
if (stmt->val) {
stmt->val->accept(expr_printer_);
}
dbg_info_printer_(stmt);
}

Expand Down
2 changes: 1 addition & 1 deletion taichi/transforms/make_mesh_block_local.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ MakeMeshBlockLocal::MakeMeshBlockLocal(OffloadedStmt *offload,
break; // not enough space to ensure occupacy
}
TI_TRACE("available = {}, x = {}, loop_index = {}, unique_access = {}",
available_bytes, cache.total_flags, int(cache.loop_index),
available_bytes, int(cache.total_flags), int(cache.loop_index),
cache.unique_accessed);
caches->caches.insert(std::make_pair(cache.snode, cache));
}
Expand Down
2 changes: 1 addition & 1 deletion taichi/ui/ggui/app_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void AppContext::init_with_vulkan(Program *prog,
VkResult result = VK_SUCCESS;
if ((result = glfwCreateWindowSurface(instance, window, nullptr,
&surface)) != VK_SUCCESS) {
TI_WARN("Failed to create window: error {}", result);
TI_WARN("Failed to create window: error {}", int(result));
return nullptr;
}
#endif
Expand Down
Loading