Skip to content

Commit 730fd31

Browse files
authored
[bug] Fixed misuse of std::forward (#5237)
* [bug] Fixed misuse of std::forward * Fixed minor issue
1 parent 8314d01 commit 730fd31

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

c_api/src/taichi_core_impl.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ VulkanRuntime *Runtime::as_vk() {
1818

1919
AotModule::AotModule(Runtime &runtime,
2020
std::unique_ptr<taichi::lang::aot::Module> &&aot_module)
21-
: runtime_(&runtime),
22-
aot_module_(std::forward<std::unique_ptr<taichi::lang::aot::Module>>(
23-
aot_module)) {
21+
: runtime_(&runtime), aot_module_(std::move(aot_module)) {
2422
}
23+
2524
taichi::lang::aot::CompiledGraph &AotModule::get_cgraph(
2625
const std::string &name) {
2726
auto it = loaded_cgraphs_.find(name);

taichi/llvm/llvm_program.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ class LlvmProgramImpl : public ProgramImpl {
167167
}
168168

169169
template <typename T, typename... Args>
170-
T runtime_query(const std::string &key, uint64 *result_buffer, Args... args) {
170+
T runtime_query(const std::string &key,
171+
uint64 *result_buffer,
172+
Args &&...args) {
171173
return runtime_exec_->runtime_query<T>(key, result_buffer,
172174
std::forward<Args>(args)...);
173175
}

taichi/llvm/llvm_runtime_executor.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ class LlvmRuntimeExecutor {
8080
void prepare_runtime_context(RuntimeContext *ctx);
8181

8282
template <typename T, typename... Args>
83-
T runtime_query(const std::string &key, uint64 *result_buffer, Args... args) {
83+
T runtime_query(const std::string &key,
84+
uint64 *result_buffer,
85+
Args &&...args) {
8486
TI_ASSERT(arch_uses_llvm(config_->arch));
8587

8688
TaichiLLVMContext *tlctx = nullptr;
@@ -91,8 +93,8 @@ class LlvmRuntimeExecutor {
9193
}
9294

9395
auto runtime = tlctx->runtime_jit_module;
94-
runtime->call<void *, Args...>("runtime_" + key, llvm_runtime_,
95-
std::forward<Args>(args)...);
96+
runtime->call<void *>("runtime_" + key, llvm_runtime_,
97+
std::forward<Args>(args)...);
9698
return taichi_union_cast_with_different_sizes<T>(fetch_result_uint64(
9799
taichi_result_buffer_runtime_query_id, result_buffer));
98100
}

0 commit comments

Comments
 (0)