Skip to content

Commit

Permalink
rename vprintf_host -> printf_host
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanming-hu committed Feb 19, 2020
1 parent 9ea8345 commit 46490e7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion taichi/backends/codegen_llvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ class CodeGenLLVM : public IRVisitor, public ModuleBuilder {
} else {
TI_NOT_IMPLEMENTED
}
auto runtime_printf = call("Runtime_get_vprintf_host", get_runtime());
auto runtime_printf = call("Runtime_get_printf_host", get_runtime());
args.push_back(builder->CreateGlobalStringPtr(
("[debug] " + stmt->str + " = " + format + "\n").c_str(),
"format_string"));
Expand Down
6 changes: 3 additions & 3 deletions taichi/backends/struct_llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ void StructCompilerLLVM::run(SNode &root, bool host) {
auto set_assert_failed = tlctx->lookup_function<void(void *, void *)>(
"Runtime_set_assert_failed");

auto set_vprintf_host =
auto set_printf_host =
tlctx->lookup_function<void(void *, void *)>(
"Runtime_set_vprintf_host");
"Runtime_set_printf_host");

auto allocate_ambient =
tlctx->lookup_function<void(void *, int)>("Runtime_allocate_ambient");
Expand Down Expand Up @@ -328,7 +328,7 @@ void StructCompilerLLVM::run(SNode &root, bool host) {
runtime_initialize_thread_pool(prog->llvm_runtime, &prog->thread_pool,
(void *)ThreadPool::static_run);
set_assert_failed(prog->llvm_runtime, (void *)assert_failed_host);
set_vprintf_host(prog->llvm_runtime, (void *)std::printf);
set_printf_host(prog->llvm_runtime, (void *)std::printf);

runtime_set_root(prog->llvm_runtime, root);

Expand Down
8 changes: 4 additions & 4 deletions taichi/runtime/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "../arithmetic.h"

using assert_failed_type = void (*)(const char *);
using vprintf_host_type = void (*)(const char *, ...);
using printf_host_type = void (*)(const char *, ...);

#if defined(__linux__) && !ARCH_cuda && defined(TI_ARCH_x86_64)
__asm__(".symver logf,logf@GLIBC_2.2.5");
Expand Down Expand Up @@ -465,7 +465,7 @@ struct NodeManager;
struct Runtime {
vm_allocator_type vm_allocator;
assert_failed_type assert_failed;
vprintf_host_type vprintf_host;
printf_host_type printf_host;
Ptr prog;
Ptr root;
size_t root_mem_size;
Expand Down Expand Up @@ -498,7 +498,7 @@ STRUCT_FIELD(Runtime, root);
STRUCT_FIELD(Runtime, root_mem_size);
STRUCT_FIELD(Runtime, temporaries);
STRUCT_FIELD(Runtime, assert_failed);
STRUCT_FIELD(Runtime, vprintf_host);
STRUCT_FIELD(Runtime, printf_host);
STRUCT_FIELD(Runtime, mem_req_queue);
STRUCT_FIELD(Runtime, profiler);
STRUCT_FIELD(Runtime, profiler_start);
Expand Down Expand Up @@ -1167,7 +1167,7 @@ void taichi_printf(Runtime *runtime, const char *format, Args &&... args) {
helper.push_back(std::forward<Args>(args)...);
vprintf((Ptr)format, helper.ptr());
#else
runtime->vprintf_host(format, args...);
runtime->printf_host(format, args...);
#endif
}

Expand Down

0 comments on commit 46490e7

Please sign in to comment.