Skip to content

Commit 4682fe0

Browse files
[misc] Rename taichi::lang::llvm to taichi::lang::LLVM (#7659)
Rename this namespace because it may introduce conflicts with `::llvm`. See taichi-dev/taichi#7584 (comment) --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent c27c0ee commit 4682fe0

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

taichi/codegen/llvm/compiled_kernel_data.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
namespace taichi::lang {
77

88
static std::unique_ptr<CompiledKernelData> new_llvm_compiled_kernel_data() {
9-
return std::make_unique<llvm::CompiledKernelData>();
9+
return std::make_unique<LLVM::CompiledKernelData>();
1010
}
1111

1212
CompiledKernelData::Creator *const CompiledKernelData::llvm_creator =
1313
new_llvm_compiled_kernel_data;
1414

15-
namespace llvm {
15+
namespace LLVM {
1616

1717
CompiledKernelData::CompiledKernelData(Arch arch, InternalData data)
1818
: arch_(arch), data_(std::move(data)) {
@@ -37,8 +37,8 @@ CompiledKernelData::Err CompiledKernelData::load_impl(
3737
} catch (const liong::json::JsonException &) {
3838
return Err::kParseMetadataFailed;
3939
}
40-
::llvm::SMDiagnostic err;
41-
auto ret = ::llvm::parseAssemblyString(file.src_code(), err, llvm_ctx_);
40+
llvm::SMDiagnostic err;
41+
auto ret = llvm::parseAssemblyString(file.src_code(), err, llvm_ctx_);
4242
if (!ret) { // File not found or Parse failed
4343
TI_DEBUG("Fail to parse llvm::Module from string: {}",
4444
err.getMessage().str());
@@ -57,11 +57,11 @@ CompiledKernelData::Err CompiledKernelData::dump_impl(
5757
return Err::kSerMetadataFailed;
5858
}
5959
std::string str;
60-
::llvm::raw_string_ostream oss(str);
60+
llvm::raw_string_ostream oss(str);
6161
data_.compiled_data.module->print(oss, /*AAW=*/nullptr);
6262
file.set_src_code(std::move(str));
6363
return Err::kNoError;
6464
}
6565

66-
} // namespace llvm
66+
} // namespace LLVM
6767
} // namespace taichi::lang

taichi/codegen/llvm/compiled_kernel_data.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace taichi::lang {
1010

11-
namespace llvm {
11+
namespace LLVM {
1212

1313
class CompiledKernelData : public lang::CompiledKernelData {
1414
public:
@@ -61,11 +61,11 @@ class CompiledKernelData : public lang::CompiledKernelData {
6161
Err dump_impl(CompiledKernelDataFile &file) const override;
6262

6363
private:
64-
::llvm::LLVMContext llvm_ctx_;
64+
llvm::LLVMContext llvm_ctx_;
6565
Arch arch_;
6666
InternalData data_;
6767
};
6868

69-
} // namespace llvm
69+
} // namespace LLVM
7070

7171
} // namespace taichi::lang

taichi/codegen/llvm/kernel_compiler.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "taichi/codegen/llvm/compiled_kernel_data.h"
77

88
namespace taichi::lang {
9-
namespace llvm {
9+
namespace LLVM {
1010

1111
KernelCompiler::KernelCompiler(Config config) : config_(std::move(config)) {
1212
}
@@ -33,7 +33,7 @@ KernelCompiler::CKDPtr KernelCompiler::compile(
3333
const DeviceCapabilityConfig &device_caps,
3434
const Kernel &kernel_def,
3535
IRNode &chi_ir) const {
36-
llvm::CompiledKernelData::InternalData data;
36+
LLVM::CompiledKernelData::InternalData data;
3737
auto codegen = KernelCodeGen::create(compile_config, &kernel_def, &chi_ir,
3838
*config_.tlctx);
3939
data.compiled_data = codegen->compile_kernel_to_module();
@@ -43,8 +43,8 @@ KernelCompiler::CKDPtr KernelCompiler::compile(
4343
data.args_size = kernel_def.args_size;
4444
data.ret_type = kernel_def.ret_type;
4545
data.ret_size = kernel_def.ret_size;
46-
return std::make_unique<llvm::CompiledKernelData>(compile_config.arch, data);
46+
return std::make_unique<LLVM::CompiledKernelData>(compile_config.arch, data);
4747
}
4848

49-
} // namespace llvm
49+
} // namespace LLVM
5050
} // namespace taichi::lang

taichi/codegen/llvm/kernel_compiler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "taichi/runtime/llvm/llvm_context.h"
66

77
namespace taichi::lang {
8-
namespace llvm {
8+
namespace LLVM {
99

1010
class KernelCompiler : public lang::KernelCompiler {
1111
public:
@@ -27,5 +27,5 @@ class KernelCompiler : public lang::KernelCompiler {
2727
Config config_;
2828
};
2929

30-
} // namespace llvm
30+
} // namespace LLVM
3131
} // namespace taichi::lang

taichi/codegen/llvm/llvm_codegen_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ class RuntimeObject {
210210
template <typename... Args>
211211
llvm::Value *call(const std::string &func_name, Args &&...args) {
212212
auto func = get_func(func_name);
213-
auto arglist = std::vector<::llvm::Value *>({ptr, args...});
213+
auto arglist = std::vector<llvm::Value *>({ptr, args...});
214214
check_func_call_signature(func->getFunctionType(), func->getName(), arglist,
215215
builder);
216216
return builder->CreateCall(func, std::move(arglist));

taichi/runtime/program_impls/llvm/llvm_program.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ FunctionType LlvmProgramImpl::compile(const CompileConfig &compile_config,
8080
// TODO(PGZXB): Final solution: compile -> load_or_compile + launch_kernel
8181
auto &mgr = get_kernel_compilation_manager();
8282
const auto &compiled = mgr.load_or_compile(compile_config, {}, *kernel);
83-
auto &llvm_data = dynamic_cast<const llvm::CompiledKernelData &>(compiled);
83+
auto &llvm_data = dynamic_cast<const LLVM::CompiledKernelData &>(compiled);
8484
return llvm_compiled_kernel_to_executable(
8585
compile_config.arch, runtime_exec_->get_llvm_context(),
8686
runtime_exec_.get(), kernel,
@@ -173,9 +173,9 @@ void LlvmProgramImpl::cache_field(int snode_tree_id,
173173
}
174174

175175
std::unique_ptr<KernelCompiler> LlvmProgramImpl::make_kernel_compiler() {
176-
lang::llvm::KernelCompiler::Config cfg;
176+
lang::LLVM::KernelCompiler::Config cfg;
177177
cfg.tlctx = runtime_exec_->get_llvm_context();
178-
return std::make_unique<lang::llvm::KernelCompiler>(std::move(cfg));
178+
return std::make_unique<lang::LLVM::KernelCompiler>(std::move(cfg));
179179
}
180180

181181
LlvmProgramImpl *get_llvm_program(Program *prog) {

0 commit comments

Comments
 (0)