From 41896653e900d79d331a8591d408a29e23621080 Mon Sep 17 00:00:00 2001 From: lin-hitonami Date: Fri, 23 Sep 2022 17:45:40 +0800 Subject: [PATCH 1/4] remove tlang --- taichi/analysis/alias_analysis.cpp | 4 ++-- taichi/analysis/check_fields_registered.cpp | 4 ++-- taichi/analysis/clone.cpp | 4 ++-- taichi/analysis/constexpr_propagation.cpp | 4 ++-- taichi/analysis/count_statements.cpp | 4 ++-- taichi/analysis/data_source_analysis.cpp | 4 ++-- taichi/analysis/detect_fors_with_break.cpp | 4 ++-- taichi/analysis/gather_deactivations.cpp | 4 ++-- taichi/analysis/gather_mesh_thread_local.cpp | 4 ++-- taichi/analysis/gather_meshfor_relation_types.cpp | 4 ++-- taichi/analysis/gather_snode_read_writes.cpp | 4 ++-- taichi/analysis/gather_statements.cpp | 4 ++-- taichi/analysis/gather_uniquely_accessed_pointers.cpp | 4 ++-- taichi/analysis/gather_used_atomics.cpp | 4 ++-- taichi/analysis/has_store_or_atomic.cpp | 4 ++-- taichi/analysis/last_store_or_atomic.cpp | 4 ++-- taichi/analysis/same_statements.cpp | 4 ++-- taichi/analysis/verify.cpp | 4 ++-- taichi/codegen/cc/cc_kernel.h | 4 ++-- taichi/codegen/cc/cc_layout.h | 4 ++-- taichi/codegen/cc/cc_program.cpp | 4 ++-- taichi/codegen/cc/cc_program.h | 4 ++-- taichi/codegen/cc/cc_runtime.h | 4 ++-- taichi/codegen/cc/cc_utils.h | 4 ++-- taichi/codegen/cc/codegen_cc.cpp | 4 ++-- taichi/codegen/cc/codegen_cc.h | 4 ++-- taichi/codegen/cc/context.h | 4 ++-- taichi/codegen/cc/struct_cc.cpp | 4 ++-- taichi/codegen/cc/struct_cc.h | 4 ++-- taichi/codegen/codegen.cpp | 4 ++-- taichi/codegen/codegen.h | 4 ++-- taichi/codegen/cpu/codegen_cpu.cpp | 4 ++-- taichi/codegen/cpu/codegen_cpu.h | 4 ++-- taichi/codegen/cuda/codegen_cuda.cpp | 4 ++-- taichi/codegen/cuda/codegen_cuda.h | 4 ++-- taichi/codegen/dx12/codegen_dx12.cpp | 4 ++-- taichi/codegen/dx12/codegen_dx12.h | 4 ++-- taichi/codegen/llvm/codegen_llvm.cpp | 4 ++-- taichi/codegen/llvm/codegen_llvm_quant.cpp | 4 ++-- taichi/codegen/metal/env_config.cpp | 4 ++-- taichi/codegen/metal/env_config.h | 4 ++-- taichi/common/core.h | 8 -------- taichi/ir/basic_stmt_visitor.cpp | 4 ++-- taichi/ir/expr.cpp | 4 ++-- taichi/ir/expr.h | 4 ++-- taichi/ir/expression.h | 4 ++-- taichi/ir/frontend_ir.cpp | 4 ++-- taichi/ir/frontend_ir.h | 4 ++-- taichi/ir/ir_builder.cpp | 4 ++-- taichi/ir/ir_builder.h | 4 ++-- taichi/ir/offloaded_task_type.cpp | 4 ++-- taichi/ir/scratch_pad.cpp | 4 ++-- taichi/ir/scratch_pad.h | 4 ++-- taichi/ir/snode.cpp | 4 ++-- taichi/ir/statements.cpp | 4 ++-- taichi/ir/transforms.h | 4 ++-- taichi/ir/type.cpp | 4 ++-- taichi/ir/type.h | 4 ++-- taichi/ir/type_factory.cpp | 4 ++-- taichi/ir/type_factory.h | 4 ++-- taichi/ir/visitors.h | 4 ++-- taichi/jit/jit_module.h | 4 ++-- taichi/jit/jit_session.cpp | 4 ++-- taichi/jit/jit_session.h | 4 ++-- taichi/math/svd.h | 4 ++-- taichi/program/compile_config.cpp | 4 ++-- taichi/program/compile_config.h | 5 ++--- taichi/program/extension.cpp | 4 ++-- taichi/program/kernel.cpp | 4 ++-- taichi/program/kernel.h | 4 ++-- taichi/program/kernel_profiler.cpp | 4 ++-- taichi/program/kernel_profiler.h | 4 ++-- taichi/program/parallel_executor.cpp | 4 ++-- taichi/program/parallel_executor.h | 4 ++-- taichi/python/export_lang.cpp | 4 ++-- taichi/rhi/cuda/cuda_context.cpp | 4 ++-- taichi/rhi/cuda/cuda_context.h | 4 ++-- taichi/rhi/cuda/cuda_driver.cpp | 4 ++-- taichi/rhi/cuda/cuda_driver.h | 4 ++-- taichi/rhi/cuda/cuda_profiler.cpp | 4 ++-- taichi/rhi/cuda/cuda_profiler.h | 4 ++-- taichi/rhi/cuda/cupti_toolkit.cpp | 4 ++-- taichi/rhi/cuda/cupti_toolkit.h | 4 ++-- taichi/runtime/cpu/jit_cpu.cpp | 4 ++-- taichi/runtime/cuda/jit_cuda.cpp | 4 ++-- taichi/runtime/cuda/jit_cuda.h | 4 ++-- taichi/runtime/cuda/runtime.cpp | 4 ++-- taichi/runtime/llvm/snode_tree_buffer_manager.cpp | 4 ++-- taichi/runtime/llvm/snode_tree_buffer_manager.h | 4 ++-- taichi/runtime/metal/data_types.cpp | 4 ++-- taichi/runtime/metal/data_types.h | 4 ++-- taichi/runtime/metal/features.h | 4 ++-- taichi/runtime/runtime.cpp | 4 ++-- taichi/runtime/runtime.h | 4 ++-- taichi/system/unified_allocator.cpp | 4 ++-- taichi/system/unified_allocator.h | 4 ++-- taichi/transforms/alg_simp.cpp | 4 ++-- taichi/transforms/auto_diff.cpp | 4 ++-- taichi/transforms/binary_op_simplify.cpp | 4 ++-- taichi/transforms/bit_loop_vectorize.cpp | 4 ++-- taichi/transforms/cfg_optimization.cpp | 4 ++-- taichi/transforms/check_out_of_bound.cpp | 4 ++-- taichi/transforms/compile_to_offloads.cpp | 4 ++-- taichi/transforms/constant_fold.cpp | 4 ++-- taichi/transforms/demote_atomics.cpp | 4 ++-- taichi/transforms/demote_dense_struct_fors.cpp | 4 ++-- taichi/transforms/demote_no_access_mesh_fors.cpp | 4 ++-- taichi/transforms/demote_operations.cpp | 4 ++-- taichi/transforms/detect_read_only.cpp | 4 ++-- taichi/transforms/die.cpp | 4 ++-- taichi/transforms/extract_constant.cpp | 4 ++-- taichi/transforms/flag_access.cpp | 4 ++-- taichi/transforms/insert_scratch_pad.cpp | 4 ++-- taichi/transforms/ir_printer.cpp | 4 ++-- taichi/transforms/loop_invariant_code_motion.cpp | 4 ++-- taichi/transforms/lower_ast.cpp | 4 ++-- taichi/transforms/lower_matrix_ptr.cpp | 4 ++-- taichi/transforms/make_block_local.cpp | 4 ++-- taichi/transforms/make_thread_local.cpp | 4 ++-- taichi/transforms/offload.cpp | 4 ++-- taichi/transforms/optimize_bit_struct_stores.cpp | 4 ++-- taichi/transforms/re_id.cpp | 4 ++-- taichi/transforms/remove_assume_in_range.cpp | 4 ++-- taichi/transforms/remove_loop_unique.cpp | 4 ++-- taichi/transforms/replace_statements.cpp | 4 ++-- taichi/transforms/reverse_segments.cpp | 4 ++-- taichi/transforms/scalarize.cpp | 4 ++-- taichi/transforms/simplify.cpp | 4 ++-- taichi/transforms/statement_usage_replace.cpp | 4 ++-- taichi/transforms/transform_statements.cpp | 4 ++-- taichi/transforms/type_check.cpp | 4 ++-- taichi/transforms/unreachable_code_elimination.cpp | 4 ++-- taichi/transforms/whole_kernel_cse.cpp | 4 ++-- taichi/util/environ_config.h | 4 ++-- taichi/util/lang_util.h | 4 ++-- taichi/util/str.cpp | 4 ++-- taichi/util/str.h | 4 ++-- tests/cpp/task/test_exception_handling.cpp | 4 ++-- 138 files changed, 274 insertions(+), 283 deletions(-) diff --git a/taichi/analysis/alias_analysis.cpp b/taichi/analysis/alias_analysis.cpp index 517a39167d5ab..f81cd1ed21fad 100644 --- a/taichi/analysis/alias_analysis.cpp +++ b/taichi/analysis/alias_analysis.cpp @@ -2,7 +2,7 @@ #include "taichi/ir/analysis.h" #include "taichi/ir/statements.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace irpass::analysis { @@ -168,4 +168,4 @@ bool maybe_same_address(Stmt *var1, Stmt *var2) { } // namespace irpass::analysis -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/analysis/check_fields_registered.cpp b/taichi/analysis/check_fields_registered.cpp index 6b417b0475eac..9d0d4d8a2e371 100644 --- a/taichi/analysis/check_fields_registered.cpp +++ b/taichi/analysis/check_fields_registered.cpp @@ -2,7 +2,7 @@ #include "taichi/ir/analysis.h" #include "taichi/ir/visitors.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class FieldsRegisteredChecker : public BasicStmtVisitor { public: @@ -33,4 +33,4 @@ void check_fields_registered(IRNode *root) { } } // namespace irpass::analysis -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/analysis/clone.cpp b/taichi/analysis/clone.cpp index e4c2476008da4..5bbac4bda41e9 100644 --- a/taichi/analysis/clone.cpp +++ b/taichi/analysis/clone.cpp @@ -7,7 +7,7 @@ #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class IRCloner : public IRVisitor { private: @@ -139,4 +139,4 @@ std::unique_ptr clone(IRNode *root, Kernel *kernel) { } } // namespace irpass::analysis -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/analysis/constexpr_propagation.cpp b/taichi/analysis/constexpr_propagation.cpp index 88db1f84f9d43..dacfc0ba9f374 100644 --- a/taichi/analysis/constexpr_propagation.cpp +++ b/taichi/analysis/constexpr_propagation.cpp @@ -4,7 +4,7 @@ #include #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace { @@ -106,4 +106,4 @@ std::unordered_set constexpr_prop( } } // namespace irpass::analysis -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/analysis/count_statements.cpp b/taichi/analysis/count_statements.cpp index 78733878b0a3e..3e16f0c361188 100644 --- a/taichi/analysis/count_statements.cpp +++ b/taichi/analysis/count_statements.cpp @@ -2,7 +2,7 @@ #include "taichi/ir/analysis.h" #include "taichi/ir/visitors.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // Count all statements (including containers) class StmtCounter : public BasicStmtVisitor { @@ -41,4 +41,4 @@ int count_statements(IRNode *root) { } } // namespace irpass::analysis -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/analysis/data_source_analysis.cpp b/taichi/analysis/data_source_analysis.cpp index 7c6721800f695..8709d06948077 100644 --- a/taichi/analysis/data_source_analysis.cpp +++ b/taichi/analysis/data_source_analysis.cpp @@ -2,7 +2,7 @@ #include "taichi/ir/analysis.h" #include "taichi/ir/statements.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace irpass::analysis { @@ -77,4 +77,4 @@ std::vector get_store_destination(Stmt *store_stmt) { } // namespace irpass::analysis -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/analysis/detect_fors_with_break.cpp b/taichi/analysis/detect_fors_with_break.cpp index 7deefe34aff81..71acb1e8dc75a 100644 --- a/taichi/analysis/detect_fors_with_break.cpp +++ b/taichi/analysis/detect_fors_with_break.cpp @@ -5,7 +5,7 @@ #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class DetectForsWithBreak : public BasicStmtVisitor { public: @@ -50,4 +50,4 @@ std::unordered_set detect_fors_with_break(IRNode *root) { } } // namespace irpass::analysis -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/analysis/gather_deactivations.cpp b/taichi/analysis/gather_deactivations.cpp index d8979df79123f..76ad81534fc1e 100644 --- a/taichi/analysis/gather_deactivations.cpp +++ b/taichi/analysis/gather_deactivations.cpp @@ -3,7 +3,7 @@ #include "taichi/ir/statements.h" #include "taichi/ir/visitors.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class GatherDeactivations : public BasicStmtVisitor { public: @@ -36,4 +36,4 @@ std::unordered_set gather_deactivations(IRNode *root) { } } // namespace irpass::analysis -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/analysis/gather_mesh_thread_local.cpp b/taichi/analysis/gather_mesh_thread_local.cpp index 41bc86a8aa953..ec7eee13c1caf 100644 --- a/taichi/analysis/gather_mesh_thread_local.cpp +++ b/taichi/analysis/gather_mesh_thread_local.cpp @@ -5,7 +5,7 @@ #include "taichi/ir/analysis.h" #include "taichi/ir/statements.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { using MeshElementTypeSet = std::unordered_set; @@ -79,4 +79,4 @@ gather_mesh_thread_local(OffloadedStmt *offload, const CompileConfig &config) { } // namespace irpass::analysis -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/analysis/gather_meshfor_relation_types.cpp b/taichi/analysis/gather_meshfor_relation_types.cpp index 21ce9ef60f328..61d58cf15c493 100644 --- a/taichi/analysis/gather_meshfor_relation_types.cpp +++ b/taichi/analysis/gather_meshfor_relation_types.cpp @@ -5,7 +5,7 @@ #include "taichi/ir/analysis.h" #include "taichi/ir/statements.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace irpass::analysis { @@ -62,4 +62,4 @@ void gather_meshfor_relation_types(IRNode *node) { } // namespace irpass::analysis -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/analysis/gather_snode_read_writes.cpp b/taichi/analysis/gather_snode_read_writes.cpp index 270b6a88d074d..b9240ada2e7b3 100644 --- a/taichi/analysis/gather_snode_read_writes.cpp +++ b/taichi/analysis/gather_snode_read_writes.cpp @@ -4,7 +4,7 @@ #include "taichi/ir/analysis.h" #include "taichi/ir/statements.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace irpass::analysis { @@ -40,4 +40,4 @@ gather_snode_read_writes(IRNode *root) { } } // namespace irpass::analysis -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/analysis/gather_statements.cpp b/taichi/analysis/gather_statements.cpp index 785afd0b767df..56bc26fd7b850 100644 --- a/taichi/analysis/gather_statements.cpp +++ b/taichi/analysis/gather_statements.cpp @@ -2,7 +2,7 @@ #include "taichi/ir/analysis.h" #include "taichi/ir/visitors.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class StmtSearcher : public BasicStmtVisitor { private: @@ -37,4 +37,4 @@ std::vector gather_statements(IRNode *root, } } // namespace irpass::analysis -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/analysis/gather_uniquely_accessed_pointers.cpp b/taichi/analysis/gather_uniquely_accessed_pointers.cpp index e2cfd21af6f30..452def7143638 100644 --- a/taichi/analysis/gather_uniquely_accessed_pointers.cpp +++ b/taichi/analysis/gather_uniquely_accessed_pointers.cpp @@ -5,7 +5,7 @@ #include "taichi/ir/visitors.h" #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class LoopUniqueStmtSearcher : public BasicStmtVisitor { private: @@ -385,4 +385,4 @@ void gather_uniquely_accessed_bit_structs(IRNode *root, AnalysisManager *amgr) { } } // namespace irpass::analysis -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/analysis/gather_used_atomics.cpp b/taichi/analysis/gather_used_atomics.cpp index cb1d8d32150ba..268d7908fee87 100644 --- a/taichi/analysis/gather_used_atomics.cpp +++ b/taichi/analysis/gather_used_atomics.cpp @@ -4,7 +4,7 @@ #include "taichi/ir/visitors.h" #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class UsedAtomicsSearcher : public BasicStmtVisitor { private: @@ -49,4 +49,4 @@ std::unique_ptr> gather_used_atomics( } } // namespace irpass::analysis -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/analysis/has_store_or_atomic.cpp b/taichi/analysis/has_store_or_atomic.cpp index 391ee99fbba5a..3ba5fb5fdbb62 100644 --- a/taichi/analysis/has_store_or_atomic.cpp +++ b/taichi/analysis/has_store_or_atomic.cpp @@ -3,7 +3,7 @@ #include "taichi/ir/statements.h" #include "taichi/ir/visitors.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // Find if there is a store (or AtomicOpStmt). class LocalStoreSearcher : public BasicStmtVisitor { @@ -54,4 +54,4 @@ bool has_store_or_atomic(IRNode *root, const std::vector &vars) { } } // namespace irpass::analysis -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/analysis/last_store_or_atomic.cpp b/taichi/analysis/last_store_or_atomic.cpp index 4c90a094a11b1..fdff536b380f7 100644 --- a/taichi/analysis/last_store_or_atomic.cpp +++ b/taichi/analysis/last_store_or_atomic.cpp @@ -3,7 +3,7 @@ #include "taichi/ir/statements.h" #include "taichi/ir/visitors.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // Find the **last** store, or return invalid if there is an AtomicOpStmt // after the last store. @@ -121,4 +121,4 @@ std::pair last_store_or_atomic(IRNode *root, Stmt *var) { } } // namespace irpass::analysis -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/analysis/same_statements.cpp b/taichi/analysis/same_statements.cpp index 9022e4cb9fd46..fcf29d49649ce 100644 --- a/taichi/analysis/same_statements.cpp +++ b/taichi/analysis/same_statements.cpp @@ -5,7 +5,7 @@ #include #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // Compare if two IRNodes are equivalent. class IRNodeComparator : public IRVisitor { @@ -333,4 +333,4 @@ bool same_value(Stmt *stmt1, } } // namespace irpass::analysis -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/analysis/verify.cpp b/taichi/analysis/verify.cpp index fd7c44c208cbf..d28f9965d782e 100644 --- a/taichi/analysis/verify.cpp +++ b/taichi/analysis/verify.cpp @@ -8,7 +8,7 @@ #include "taichi/ir/transforms.h" #include "taichi/system/profiler.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class IRVerifier : public BasicStmtVisitor { private: @@ -150,4 +150,4 @@ void verify(IRNode *root) { } } // namespace irpass::analysis -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/codegen/cc/cc_kernel.h b/taichi/codegen/cc/cc_kernel.h index 6ad9e70c8def5..b683195a7da06 100644 --- a/taichi/codegen/cc/cc_kernel.h +++ b/taichi/codegen/cc/cc_kernel.h @@ -3,7 +3,7 @@ #include "taichi/util/lang_util.h" #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class Kernel; @@ -41,4 +41,4 @@ class CCKernel { }; } // namespace cccp -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/codegen/cc/cc_layout.h b/taichi/codegen/cc/cc_layout.h index 0a2f08cecb15b..c0494179daba8 100644 --- a/taichi/codegen/cc/cc_layout.h +++ b/taichi/codegen/cc/cc_layout.h @@ -4,7 +4,7 @@ class CCProgramImpl; -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace cccp { class CCLayout { @@ -28,4 +28,4 @@ class CCLayout { }; } // namespace cccp -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/codegen/cc/cc_program.cpp b/taichi/codegen/cc/cc_program.cpp index 42e579ddf0529..e34f2d29f4cd6 100644 --- a/taichi/codegen/cc/cc_program.cpp +++ b/taichi/codegen/cc/cc_program.cpp @@ -2,7 +2,7 @@ using namespace taichi::lang::cccp; -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { CCProgramImpl::CCProgramImpl(CompileConfig &config) : ProgramImpl(config) { this->config = &config; @@ -197,4 +197,4 @@ bool is_c_backend_available() { } }; // namespace cccp -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/codegen/cc/cc_program.h b/taichi/codegen/cc/cc_program.h index 53a19320a0b06..64ad32ae2ef15 100644 --- a/taichi/codegen/cc/cc_program.h +++ b/taichi/codegen/cc/cc_program.h @@ -20,7 +20,7 @@ TI_NAMESPACE_BEGIN class DynamicLoader; TI_NAMESPACE_END -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { using namespace taichi::lang::cccp; using CCFuncEntryType = void(cccp::CCContext *); @@ -88,4 +88,4 @@ class CCProgramImpl : public ProgramImpl { uint64 *result_buffer_{nullptr}; bool need_relink_{true}; }; -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/codegen/cc/cc_runtime.h b/taichi/codegen/cc/cc_runtime.h index 6d715dca135b6..ab4a88155ecfe 100644 --- a/taichi/codegen/cc/cc_runtime.h +++ b/taichi/codegen/cc/cc_runtime.h @@ -2,7 +2,7 @@ #include "taichi/util/lang_util.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class CCProgramImpl; namespace cccp { @@ -31,4 +31,4 @@ class CCRuntime { }; } // namespace cccp -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/codegen/cc/cc_utils.h b/taichi/codegen/cc/cc_utils.h index 7c0691b8c4018..e5ed5f9755be9 100644 --- a/taichi/codegen/cc/cc_utils.h +++ b/taichi/codegen/cc/cc_utils.h @@ -7,7 +7,7 @@ #include #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace cccp { inline std::string cc_data_type_name(DataType dt) { @@ -82,4 +82,4 @@ inline int execute(std::string fmt, Args &&...args) { } } // namespace cccp -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/codegen/cc/codegen_cc.cpp b/taichi/codegen/cc/codegen_cc.cpp index a271ec71cb7f0..5f76cb103f698 100644 --- a/taichi/codegen/cc/codegen_cc.cpp +++ b/taichi/codegen/cc/codegen_cc.cpp @@ -11,7 +11,7 @@ #define C90_COMPAT 0 -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace cccp { // Codegen for C Compiler Processor namespace { @@ -605,4 +605,4 @@ std::unique_ptr CCKernelGen::compile() { } } // namespace cccp -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/codegen/cc/codegen_cc.h b/taichi/codegen/cc/codegen_cc.h index 9b65f5b715357..c10654c223be8 100644 --- a/taichi/codegen/cc/codegen_cc.h +++ b/taichi/codegen/cc/codegen_cc.h @@ -3,7 +3,7 @@ #include "taichi/util/lang_util.h" #include "taichi/codegen/codegen.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class CCProgramImpl; @@ -28,4 +28,4 @@ class CCKernelGen { FunctionType compile_kernel(Kernel *kernel); } // namespace cccp -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/codegen/cc/context.h b/taichi/codegen/cc/context.h index 47207d0553a9a..1bcdf7a863d71 100644 --- a/taichi/codegen/cc/context.h +++ b/taichi/codegen/cc/context.h @@ -42,7 +42,7 @@ struct Ti_Context { #include "cc_program.h" #include "taichi/util/lang_util.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace cccp { @@ -56,6 +56,6 @@ struct CCContext { }; // namespace cccp -TLANG_NAMESPACE_END +} // namespace taichi::lang #endif // _CC_INSIDE_KERNEL diff --git a/taichi/codegen/cc/struct_cc.cpp b/taichi/codegen/cc/struct_cc.cpp index ecb174fe37be8..22e4b223732a7 100644 --- a/taichi/codegen/cc/struct_cc.cpp +++ b/taichi/codegen/cc/struct_cc.cpp @@ -2,7 +2,7 @@ #include "cc_layout.h" #include "cc_utils.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace cccp { void CCLayoutGen::generate_children(SNode *snode) { @@ -47,4 +47,4 @@ std::unique_ptr CCLayoutGen::compile() { } } // namespace cccp -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/codegen/cc/struct_cc.h b/taichi/codegen/cc/struct_cc.h index d8d6de175546d..b92e331baf8fa 100644 --- a/taichi/codegen/cc/struct_cc.h +++ b/taichi/codegen/cc/struct_cc.h @@ -4,7 +4,7 @@ #include "taichi/util/line_appender.h" #include "taichi/ir/snode.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class CCProgramImpl; namespace cccp { @@ -36,4 +36,4 @@ class CCLayoutGen { }; } // namespace cccp -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/codegen/codegen.cpp b/taichi/codegen/codegen.cpp index b4e531a109c68..d94cbc9c65fed 100644 --- a/taichi/codegen/codegen.cpp +++ b/taichi/codegen/codegen.cpp @@ -17,7 +17,7 @@ #include "taichi/ir/transforms.h" #include "taichi/analysis/offline_cache_util.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { KernelCodeGen::KernelCodeGen(Kernel *kernel, IRNode *ir) : prog(kernel->program), kernel(kernel), ir(ir) { @@ -152,4 +152,4 @@ FunctionType ModuleToFunctionConverter::convert(const Kernel *kernel, } #endif -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/codegen/codegen.h b/taichi/codegen/codegen.h index aafe0e04aa82d..704b6fd8a5747 100644 --- a/taichi/codegen/codegen.h +++ b/taichi/codegen/codegen.h @@ -10,7 +10,7 @@ #include "taichi/runtime/llvm/launch_arg_info.h" #include "taichi/codegen/llvm/llvm_codegen_utils.h" #endif -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class KernelCodeGen { protected: @@ -68,4 +68,4 @@ class ModuleToFunctionConverter { }; #endif -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/codegen/cpu/codegen_cpu.cpp b/taichi/codegen/cpu/codegen_cpu.cpp index a60337f7d1647..ae4f1d2139694 100644 --- a/taichi/codegen/cpu/codegen_cpu.cpp +++ b/taichi/codegen/cpu/codegen_cpu.cpp @@ -11,7 +11,7 @@ #include "taichi/ir/transforms.h" #include "taichi/ir/analysis.h" #include "taichi/analysis/offline_cache_util.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace { @@ -290,4 +290,4 @@ FunctionType KernelCodeGenCPU::compile_to_function() { tlctx, get_llvm_program(prog)->get_runtime_executor()); return converter.convert(kernel, compile_kernel_to_module()); } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/codegen/cpu/codegen_cpu.h b/taichi/codegen/cpu/codegen_cpu.h index 773a19a2f9dd8..34b8e84687363 100644 --- a/taichi/codegen/cpu/codegen_cpu.h +++ b/taichi/codegen/cpu/codegen_cpu.h @@ -7,7 +7,7 @@ #include "taichi/codegen/codegen.h" #include "taichi/codegen/llvm/codegen_llvm.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class KernelCodeGenCPU : public KernelCodeGen { public: @@ -50,4 +50,4 @@ class CPUModuleToFunctionConverter : public ModuleToFunctionConverter { #endif -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/codegen/cuda/codegen_cuda.cpp b/taichi/codegen/cuda/codegen_cuda.cpp index a1f7f181bda5a..bfad0612d001d 100644 --- a/taichi/codegen/cuda/codegen_cuda.cpp +++ b/taichi/codegen/cuda/codegen_cuda.cpp @@ -19,7 +19,7 @@ #include "taichi/ir/analysis.h" #include "taichi/ir/transforms.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { using namespace llvm; @@ -841,4 +841,4 @@ FunctionType CUDAModuleToFunctionConverter::convert( #endif // TI_WITH_CUDA } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/codegen/cuda/codegen_cuda.h b/taichi/codegen/cuda/codegen_cuda.h index 8fe6e1beb2b0b..50a578172cedf 100644 --- a/taichi/codegen/cuda/codegen_cuda.h +++ b/taichi/codegen/cuda/codegen_cuda.h @@ -5,7 +5,7 @@ #include "taichi/codegen/codegen.h" #include "taichi/codegen/llvm/codegen_llvm.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class KernelCodeGenCUDA : public KernelCodeGen { public: @@ -42,4 +42,4 @@ class CUDAModuleToFunctionConverter : public ModuleToFunctionConverter { LLVMCompiledKernel data) const override; }; -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/codegen/dx12/codegen_dx12.cpp b/taichi/codegen/dx12/codegen_dx12.cpp index 956f1873dc04b..5a2145228f705 100644 --- a/taichi/codegen/dx12/codegen_dx12.cpp +++ b/taichi/codegen/dx12/codegen_dx12.cpp @@ -14,7 +14,7 @@ #include "taichi/ir/transforms.h" #include "taichi/ir/analysis.h" #include "taichi/analysis/offline_cache_util.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace { @@ -283,4 +283,4 @@ FunctionType KernelCodeGenDX12::compile_to_function() { // FIXME: implement compile_to_function. return [](RuntimeContext &ctx) {}; } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/codegen/dx12/codegen_dx12.h b/taichi/codegen/dx12/codegen_dx12.h index 5d352231a1e6b..52ae749a92c80 100644 --- a/taichi/codegen/dx12/codegen_dx12.h +++ b/taichi/codegen/dx12/codegen_dx12.h @@ -8,7 +8,7 @@ #include "taichi/codegen/llvm/codegen_llvm.h" #include "taichi/aot/module_data.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class KernelCodeGenDX12 : public KernelCodeGen { public: @@ -29,4 +29,4 @@ class KernelCodeGenDX12 : public KernelCodeGen { FunctionType compile_to_function() override; }; -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/codegen/llvm/codegen_llvm.cpp b/taichi/codegen/llvm/codegen_llvm.cpp index 3a7a5daa113ac..65a27b0db63ea 100644 --- a/taichi/codegen/llvm/codegen_llvm.cpp +++ b/taichi/codegen/llvm/codegen_llvm.cpp @@ -14,7 +14,7 @@ #include "taichi/codegen/llvm/struct_llvm.h" #include "taichi/util/file_sequence_writer.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // TODO: sort function definitions to match declaration order in header @@ -2750,6 +2750,6 @@ LLVMCompiledKernel LLVMCompiledKernel::clone() const { return {tasks, llvm::CloneModule(*module)}; } -TLANG_NAMESPACE_END +} // namespace taichi::lang #endif // #ifdef TI_WITH_LLVM diff --git a/taichi/codegen/llvm/codegen_llvm_quant.cpp b/taichi/codegen/llvm/codegen_llvm_quant.cpp index 23bcad019e07b..ace26c8bf1a11 100644 --- a/taichi/codegen/llvm/codegen_llvm_quant.cpp +++ b/taichi/codegen/llvm/codegen_llvm_quant.cpp @@ -2,7 +2,7 @@ #include "taichi/codegen/llvm/codegen_llvm.h" #include "taichi/ir/statements.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace { @@ -591,6 +591,6 @@ llvm::Value *TaskCodeGenLLVM::reconstruct_quant_float( } } -TLANG_NAMESPACE_END +} // namespace taichi::lang #endif // #ifdef TI_WITH_LLVM diff --git a/taichi/codegen/metal/env_config.cpp b/taichi/codegen/metal/env_config.cpp index 06b6f6bf38133..62b95cad778d2 100644 --- a/taichi/codegen/metal/env_config.cpp +++ b/taichi/codegen/metal/env_config.cpp @@ -3,7 +3,7 @@ #include "taichi/util/lang_util.h" #include "taichi/util/environ_config.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace metal { EnvConfig::EnvConfig() { @@ -18,4 +18,4 @@ const EnvConfig &EnvConfig::instance() { } // namespace metal -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/codegen/metal/env_config.h b/taichi/codegen/metal/env_config.h index 336facc2c40ee..6a1b5ff1640ed 100644 --- a/taichi/codegen/metal/env_config.h +++ b/taichi/codegen/metal/env_config.h @@ -2,7 +2,7 @@ #include "taichi/util/lang_util.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace metal { // Metal specific config inferred from the environment. @@ -27,4 +27,4 @@ class EnvConfig { } // namespace metal -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/common/core.h b/taichi/common/core.h index a66b50f18568f..7a13b330f279b 100644 --- a/taichi/common/core.h +++ b/taichi/common/core.h @@ -108,14 +108,6 @@ static_assert(__cplusplus >= 201402L, "C++14 required."); #define TI_NAMESPACE_BEGIN namespace taichi { #define TI_NAMESPACE_END } -#define TLANG_NAMESPACE_BEGIN \ - namespace taichi { \ - namespace lang { - -#define TLANG_NAMESPACE_END \ - } \ - } - void taichi_raise_assertion_failure_in_python(const char *msg); TI_NAMESPACE_BEGIN diff --git a/taichi/ir/basic_stmt_visitor.cpp b/taichi/ir/basic_stmt_visitor.cpp index 989c71f35af46..7fe6e653b906a 100644 --- a/taichi/ir/basic_stmt_visitor.cpp +++ b/taichi/ir/basic_stmt_visitor.cpp @@ -2,7 +2,7 @@ #include "taichi/ir/statements.h" #include "taichi/ir/visitors.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { BasicStmtVisitor::BasicStmtVisitor() { allow_undefined_visitor = true; @@ -68,4 +68,4 @@ void BasicStmtVisitor::visit(FrontendIfStmt *stmt) { stmt->false_statements->accept(this); } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/ir/expr.cpp b/taichi/ir/expr.cpp index 67c6566a4dad7..1a3fd869cf071 100644 --- a/taichi/ir/expr.cpp +++ b/taichi/ir/expr.cpp @@ -4,7 +4,7 @@ #include "taichi/ir/ir.h" #include "taichi/program/program.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { void Expr::set_tb(const std::string &tb) { expr->tb = tb; @@ -120,4 +120,4 @@ Expr expr_matrix_field(const std::vector &fields, return Expr::make(fields, element_shape); } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/ir/expr.h b/taichi/ir/expr.h index ba84faecd09a9..43548064d7d26 100644 --- a/taichi/ir/expr.h +++ b/taichi/ir/expr.h @@ -3,7 +3,7 @@ #include "taichi/util/str.h" #include "taichi/ir/type_utils.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { struct CompileConfig; class Expression; @@ -149,4 +149,4 @@ Expr expr_field(Expr id_expr, DataType dt); Expr expr_matrix_field(const std::vector &fields, const std::vector &element_shape); -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/ir/expression.h b/taichi/ir/expression.h index 1f400e5b24374..13fb9d4fea823 100644 --- a/taichi/ir/expression.h +++ b/taichi/ir/expression.h @@ -5,7 +5,7 @@ #include "taichi/ir/ir.h" #include "taichi/ir/expr.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class ExpressionVisitor; @@ -162,4 +162,4 @@ class ExpressionVisitor { visitor->visit(this); \ } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/ir/frontend_ir.cpp b/taichi/ir/frontend_ir.cpp index 4b9503ebe04b8..2b95e76e410ae 100644 --- a/taichi/ir/frontend_ir.cpp +++ b/taichi/ir/frontend_ir.cpp @@ -5,7 +5,7 @@ #include "taichi/program/program.h" #include "taichi/common/exceptions.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { #define TI_ASSERT_TYPE_CHECKED(x) \ TI_ASSERT_INFO(x->ret_type != PrimitiveType::unknown, \ @@ -1308,4 +1308,4 @@ void flatten_rvalue(Expr ptr, Expression::FlattenContext *ctx) { } } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/ir/frontend_ir.h b/taichi/ir/frontend_ir.h index 98e6c549f4b33..d362f6e8a963c 100644 --- a/taichi/ir/frontend_ir.h +++ b/taichi/ir/frontend_ir.h @@ -11,7 +11,7 @@ #include "taichi/program/function.h" #include "taichi/ir/mesh.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { struct ForLoopConfig { bool is_bit_vectorized{false}; @@ -1041,4 +1041,4 @@ void flatten_lvalue(Expr expr, Expression::FlattenContext *ctx); void flatten_rvalue(Expr expr, Expression::FlattenContext *ctx); -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/ir/ir_builder.cpp b/taichi/ir/ir_builder.cpp index 9285713e89fd2..de40919d99d20 100644 --- a/taichi/ir/ir_builder.cpp +++ b/taichi/ir/ir_builder.cpp @@ -2,7 +2,7 @@ #include "taichi/ir/statements.h" #include "taichi/common/logging.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace { @@ -484,4 +484,4 @@ MeshPatchIndexStmt *IRBuilder::get_patch_index() { return insert(Stmt::make_typed()); } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/ir/ir_builder.h b/taichi/ir/ir_builder.h index 0c0b2bf15e85d..01eceb685b341 100644 --- a/taichi/ir/ir_builder.h +++ b/taichi/ir/ir_builder.h @@ -3,7 +3,7 @@ #include "taichi/ir/ir.h" #include "taichi/ir/mesh.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class Function; @@ -286,4 +286,4 @@ class IRBuilder { InsertPoint insert_point_; }; -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/ir/offloaded_task_type.cpp b/taichi/ir/offloaded_task_type.cpp index 3203c53796aba..22fcd6afd7c01 100644 --- a/taichi/ir/offloaded_task_type.cpp +++ b/taichi/ir/offloaded_task_type.cpp @@ -1,6 +1,6 @@ #include "taichi/ir/offloaded_task_type.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { std::string offloaded_task_type_name(OffloadedTaskType tt) { if (false) { @@ -12,4 +12,4 @@ std::string offloaded_task_type_name(OffloadedTaskType tt) { TI_NOT_IMPLEMENTED } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/ir/scratch_pad.cpp b/taichi/ir/scratch_pad.cpp index 6d6a086d6325d..ace3ffee6e953 100644 --- a/taichi/ir/scratch_pad.cpp +++ b/taichi/ir/scratch_pad.cpp @@ -2,7 +2,7 @@ #include "taichi/ir/statements.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { std::string ScratchPad::global_to_linearized_local( const std::vector &loop_vars, @@ -19,4 +19,4 @@ std::string ScratchPad::global_to_linearized_local( return ret; } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/ir/scratch_pad.h b/taichi/ir/scratch_pad.h index 7df97db99a171..4d3e3ab215e9f 100644 --- a/taichi/ir/scratch_pad.h +++ b/taichi/ir/scratch_pad.h @@ -2,7 +2,7 @@ #include "taichi/ir/snode.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class Stmt; @@ -258,4 +258,4 @@ class ScratchPads { } }; -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/ir/snode.cpp b/taichi/ir/snode.cpp index 751b5d753449b..09e18e9a00a61 100644 --- a/taichi/ir/snode.cpp +++ b/taichi/ir/snode.cpp @@ -7,7 +7,7 @@ #include "taichi/program/program.h" #include "taichi/program/snode_rw_accessors_bank.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { std::atomic SNode::counter{0}; @@ -361,4 +361,4 @@ int SNode::get_snode_tree_id() const { return snode_tree_id_; } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/ir/statements.cpp b/taichi/ir/statements.cpp index 26b6c205fe098..7f013f0c621dd 100644 --- a/taichi/ir/statements.cpp +++ b/taichi/ir/statements.cpp @@ -2,7 +2,7 @@ #include "taichi/ir/statements.h" #include "taichi/util/bit.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { UnaryOpStmt::UnaryOpStmt(UnaryOpType op_type, Stmt *operand) : op_type(op_type), operand(operand) { @@ -412,4 +412,4 @@ BitStructType *BitStructStoreStmt::get_bit_struct() const { return ptr->as()->snode->dt->as(); } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/ir/transforms.h b/taichi/ir/transforms.h index 77ca33f2450cd..22254fcc5e4ac 100644 --- a/taichi/ir/transforms.h +++ b/taichi/ir/transforms.h @@ -18,7 +18,7 @@ #include "taichi/transforms/simplify.h" #include "taichi/common/trait.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class ScratchPads; @@ -196,4 +196,4 @@ void compile_function(IRNode *ir, bool start_from_ast); } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/ir/type.cpp b/taichi/ir/type.cpp index 5e7758086de37..592b6ab2da92a 100644 --- a/taichi/ir/type.cpp +++ b/taichi/ir/type.cpp @@ -3,7 +3,7 @@ #include "taichi/ir/type_factory.h" #include "taichi/ir/type_utils.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // Note: these primitive types should never be freed. They are supposed to live // together with the process. This is a temporary solution. Later we should @@ -418,4 +418,4 @@ float64 TypedConstant::val_cast_to_float64() const { } } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/ir/type.h b/taichi/ir/type.h index 064a7fb0e8462..25865af0f3bdb 100644 --- a/taichi/ir/type.h +++ b/taichi/ir/type.h @@ -3,7 +3,7 @@ #include "taichi/common/core.h" #include "taichi/util/bit.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class TensorType; @@ -479,4 +479,4 @@ class TypedConstant { float64 val_cast_to_float64() const; }; -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/ir/type_factory.cpp b/taichi/ir/type_factory.cpp index 3ff41a59479e3..f5a0286aa2900 100644 --- a/taichi/ir/type_factory.cpp +++ b/taichi/ir/type_factory.cpp @@ -2,7 +2,7 @@ #include "taichi/ir/type_utils.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { TypeFactory &TypeFactory::get_instance() { static TypeFactory *type_factory = new TypeFactory; @@ -188,4 +188,4 @@ DataType promoted_type(DataType x, DataType y) { return y; } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/ir/type_factory.h b/taichi/ir/type_factory.h index 3fa4ef3fb7aac..3ba0d9af8066f 100644 --- a/taichi/ir/type_factory.h +++ b/taichi/ir/type_factory.h @@ -4,7 +4,7 @@ #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class TypeFactory { public: @@ -83,4 +83,4 @@ class TypeFactory { DataType promoted_type(DataType a, DataType b); -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/ir/visitors.h b/taichi/ir/visitors.h index 1b1642054d889..36aefc04d5769 100644 --- a/taichi/ir/visitors.h +++ b/taichi/ir/visitors.h @@ -1,7 +1,7 @@ #pragma once #include "taichi/ir/ir.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // Visits all non-containing statements class BasicStmtVisitor : public IRVisitor { @@ -32,4 +32,4 @@ class BasicStmtVisitor : public IRVisitor { void visit(FrontendIfStmt *stmt) override; }; -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/jit/jit_module.h b/taichi/jit/jit_module.h index 32fec986fb6e4..162fc4b5e8e56 100644 --- a/taichi/jit/jit_module.h +++ b/taichi/jit/jit_module.h @@ -7,7 +7,7 @@ #include "taichi/util/lang_util.h" #include "taichi/program/kernel_profiler.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // A architecture-specific JIT module that initializes with an **LLVM** module // and allows the user to call its functions @@ -90,4 +90,4 @@ class JITModule { } }; -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/jit/jit_session.cpp b/taichi/jit/jit_session.cpp index aa7890ad63256..310790e113b0e 100644 --- a/taichi/jit/jit_session.cpp +++ b/taichi/jit/jit_session.cpp @@ -4,7 +4,7 @@ #include "llvm/IR/DataLayout.h" #endif -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { #ifdef TI_WITH_LLVM std::unique_ptr create_llvm_jit_session_cpu( @@ -41,4 +41,4 @@ std::unique_ptr JITSession::create(TaichiLLVMContext *tlctx, return nullptr; } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/jit/jit_session.h b/taichi/jit/jit_session.h index 898e1a0bb3614..6322d73ce0878 100644 --- a/taichi/jit/jit_session.h +++ b/taichi/jit/jit_session.h @@ -7,7 +7,7 @@ #include "taichi/util/lang_util.h" #include "taichi/jit/jit_module.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // Backend JIT compiler for all archs @@ -45,4 +45,4 @@ class JITSession { virtual ~JITSession() = default; }; -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/math/svd.h b/taichi/math/svd.h index f57e081a1f0f8..6a21ef0b86c75 100644 --- a/taichi/math/svd.h +++ b/taichi/math/svd.h @@ -3,7 +3,7 @@ #include "taichi/ir/ir.h" #include "taichi/ir/expression_ops.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { template Expr svd_bitwise_or(const Expr &a, const Expr &b) { @@ -903,4 +903,4 @@ sifakis_svd_export(ASTBuilder *ast_builder, Sa11, Sa22, Sa33); } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/program/compile_config.cpp b/taichi/program/compile_config.cpp index a3e022e47bd93..24db7fc6b49b3 100644 --- a/taichi/program/compile_config.cpp +++ b/taichi/program/compile_config.cpp @@ -2,7 +2,7 @@ #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { CompileConfig::CompileConfig() { arch = host_arch(); @@ -71,4 +71,4 @@ CompileConfig::CompileConfig() { cc_link_cmd = "gcc -shared -fPIC -o '{}' '{}'"; } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/program/compile_config.h b/taichi/program/compile_config.h index 8868f7a642700..a7d22c58a301a 100644 --- a/taichi/program/compile_config.h +++ b/taichi/program/compile_config.h @@ -3,8 +3,7 @@ #include "taichi/rhi/arch.h" #include "taichi/util/lang_util.h" -namespace taichi { -namespace lang { +namespace taichi::lang { struct CompileConfig { Arch arch; @@ -114,4 +113,4 @@ struct CompileConfig { extern TI_DLL_EXPORT CompileConfig default_compile_config; -TLANG_NAMESPACE_END +} //namespace taichi::lang \ No newline at end of file diff --git a/taichi/program/extension.cpp b/taichi/program/extension.cpp index 27a5a782c90cc..08b61ab356891 100644 --- a/taichi/program/extension.cpp +++ b/taichi/program/extension.cpp @@ -3,7 +3,7 @@ #include #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { bool is_extension_supported(Arch arch, Extension ext) { static std::unordered_map> arch2ext = { @@ -33,4 +33,4 @@ bool is_extension_supported(Arch arch, Extension ext) { return exts.find(ext) != exts.end(); } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/program/kernel.cpp b/taichi/program/kernel.cpp index e66261015cd16..31339893d88d4 100644 --- a/taichi/program/kernel.cpp +++ b/taichi/program/kernel.cpp @@ -15,7 +15,7 @@ #include "taichi/runtime/program_impls/llvm/llvm_program.h" #endif -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class Function; @@ -442,4 +442,4 @@ void Kernel::offload_to_executable(IRNode *stmt) { is_extension_supported(config.arch, Extension::bls) && config.make_block_local); } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/program/kernel.h b/taichi/program/kernel.h index 5c74e4ae15e29..46c75c01176a0 100644 --- a/taichi/program/kernel.h +++ b/taichi/program/kernel.h @@ -9,7 +9,7 @@ #include "taichi/program/texture.h" #include "taichi/aot/graph_data.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class Program; @@ -168,4 +168,4 @@ class TI_DLL_EXPORT Kernel : public Callable { bool from_cache_{false}; }; -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/program/kernel_profiler.cpp b/taichi/program/kernel_profiler.cpp index 40978f6a802b0..e2f4de95fdce0 100644 --- a/taichi/program/kernel_profiler.cpp +++ b/taichi/program/kernel_profiler.cpp @@ -5,7 +5,7 @@ #include "taichi/rhi/cuda/cuda_profiler.h" #include "taichi/system/timeline.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { void KernelProfileStatisticalResult::insert_record(double t) { if (counter == 0) { @@ -130,4 +130,4 @@ std::unique_ptr make_profiler(Arch arch, bool enable) { } } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/program/kernel_profiler.h b/taichi/program/kernel_profiler.h index 660935a0fd888..27d94716f77f8 100644 --- a/taichi/program/kernel_profiler.h +++ b/taichi/program/kernel_profiler.h @@ -10,7 +10,7 @@ #include #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { struct KernelProfileTracedRecord { // kernel attributes @@ -105,4 +105,4 @@ class KernelProfilerBase { std::unique_ptr make_profiler(Arch arch, bool enable); -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/program/parallel_executor.cpp b/taichi/program/parallel_executor.cpp index 71b1fcb6bf1ef..6983c4ee70e2c 100644 --- a/taichi/program/parallel_executor.cpp +++ b/taichi/program/parallel_executor.cpp @@ -1,7 +1,7 @@ #include #include "taichi/program/parallel_executor.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { ParallelExecutor::ParallelExecutor(const std::string &name, int num_threads) : name_(name), @@ -116,4 +116,4 @@ void ParallelExecutor::worker_loop() { } } } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/program/parallel_executor.h b/taichi/program/parallel_executor.h index 468253417fa51..520f0183fd8cc 100644 --- a/taichi/program/parallel_executor.h +++ b/taichi/program/parallel_executor.h @@ -10,7 +10,7 @@ #include #include "taichi/common/core.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class ParallelExecutor { public: using TaskType = std::function; @@ -62,4 +62,4 @@ class ParallelExecutor { // callback to be executed? std::condition_variable flush_cv_; }; -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/python/export_lang.cpp b/taichi/python/export_lang.cpp index 0c70a7170b1e8..1dda75f16ec0d 100644 --- a/taichi/python/export_lang.cpp +++ b/taichi/python/export_lang.cpp @@ -41,7 +41,7 @@ bool test_threading(); TI_NAMESPACE_END -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { Expr expr_index(const Expr &expr, const Expr &index) { return expr[index]; @@ -49,7 +49,7 @@ Expr expr_index(const Expr &expr, const Expr &index) { std::string libdevice_path(); -TLANG_NAMESPACE_END +} // namespace taichi::lang TI_NAMESPACE_BEGIN void export_lang(py::module &m) { diff --git a/taichi/rhi/cuda/cuda_context.cpp b/taichi/rhi/cuda/cuda_context.cpp index a7dcb5a9e883c..3fa2b0cdf3f5e 100644 --- a/taichi/rhi/cuda/cuda_context.cpp +++ b/taichi/rhi/cuda/cuda_context.cpp @@ -11,7 +11,7 @@ #include "taichi/rhi/cuda/cuda_profiler.h" #include "taichi/analysis/offline_cache_util.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { CUDAContext::CUDAContext() : profiler_(nullptr), driver_(CUDADriver::get_instance_without_context()) { @@ -141,4 +141,4 @@ CUDAContext &CUDAContext::get_instance() { return *context; } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/rhi/cuda/cuda_context.h b/taichi/rhi/cuda/cuda_context.h index d63d81f10ca66..9fc5e01ebd537 100644 --- a/taichi/rhi/cuda/cuda_context.h +++ b/taichi/rhi/cuda/cuda_context.h @@ -7,7 +7,7 @@ #include "taichi/program/kernel_profiler.h" #include "taichi/rhi/cuda/cuda_driver.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // Note: // It would be ideal to create a CUDA context per Taichi program, yet CUDA @@ -103,4 +103,4 @@ class CUDAContext { static CUDAContext &get_instance(); }; -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/rhi/cuda/cuda_driver.cpp b/taichi/rhi/cuda/cuda_driver.cpp index f266801d00a9b..6749044ae8187 100644 --- a/taichi/rhi/cuda/cuda_driver.cpp +++ b/taichi/rhi/cuda/cuda_driver.cpp @@ -4,7 +4,7 @@ #include "taichi/rhi/cuda/cuda_context.h" #include "taichi/util/environ_config.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { std::string get_cuda_error_message(uint32 err) { const char *err_name_ptr; @@ -132,4 +132,4 @@ bool CUSOLVERDriver::load_cusolver() { #undef PER_CUSOLVER_FUNCTION return cusolver_loaded_; } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/rhi/cuda/cuda_driver.h b/taichi/rhi/cuda/cuda_driver.h index 13fdf03480e50..1852b62ff6033 100644 --- a/taichi/rhi/cuda/cuda_driver.h +++ b/taichi/rhi/cuda/cuda_driver.h @@ -20,7 +20,7 @@ static_assert(sizeof(CUjit_option) == sizeof(uint32)); } // namespace taichi #endif -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // Driver constants from cuda.h @@ -178,4 +178,4 @@ class CUSOLVERDriver : protected CUDADriverBase { bool cusolver_loaded_{false}; }; -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/rhi/cuda/cuda_profiler.cpp b/taichi/rhi/cuda/cuda_profiler.cpp index 050d0eb8170e4..a94b7b74ef811 100644 --- a/taichi/rhi/cuda/cuda_profiler.cpp +++ b/taichi/rhi/cuda/cuda_profiler.cpp @@ -3,7 +3,7 @@ #include "taichi/rhi/cuda/cuda_driver.h" #include "taichi/rhi/cuda/cuda_context.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { #if defined(TI_WITH_CUDA) @@ -369,4 +369,4 @@ void EventToolkit::update_timeline( } #endif -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/rhi/cuda/cuda_profiler.h b/taichi/rhi/cuda/cuda_profiler.h index 883a99cf9a50d..1400431f1fc01 100644 --- a/taichi/rhi/cuda/cuda_profiler.h +++ b/taichi/rhi/cuda/cuda_profiler.h @@ -9,7 +9,7 @@ #include #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { enum class ProfilingToolkit : int { undef, @@ -95,4 +95,4 @@ class EventToolkit { } }; -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/rhi/cuda/cupti_toolkit.cpp b/taichi/rhi/cuda/cupti_toolkit.cpp index e5ba1a3c358be..6d787976b537e 100644 --- a/taichi/rhi/cuda/cupti_toolkit.cpp +++ b/taichi/rhi/cuda/cupti_toolkit.cpp @@ -12,7 +12,7 @@ #include #endif -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // Make sure these metrics can be captured in one pass (no kernel replay) // Metrics for calculating the kernel elapsed time are collected by default. @@ -1130,4 +1130,4 @@ bool CuptiToolkit::update_record( } #endif -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/rhi/cuda/cupti_toolkit.h b/taichi/rhi/cuda/cupti_toolkit.h index 98a5c3309730f..098c0607f98b9 100644 --- a/taichi/rhi/cuda/cupti_toolkit.h +++ b/taichi/rhi/cuda/cupti_toolkit.h @@ -2,7 +2,7 @@ #include "taichi/program/kernel_profiler.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { struct CuptiConfig { #if defined(TI_WITH_CUDA_TOOLKIT) @@ -43,4 +43,4 @@ class CuptiToolkit { CuptiImage cupti_image_; }; -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/runtime/cpu/jit_cpu.cpp b/taichi/runtime/cpu/jit_cpu.cpp index b41c9041cb563..415f99ea95a96 100644 --- a/taichi/runtime/cpu/jit_cpu.cpp +++ b/taichi/runtime/cpu/jit_cpu.cpp @@ -49,7 +49,7 @@ #include "taichi/util/file_sequence_writer.h" #include "taichi/runtime/llvm/llvm_context.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { #ifdef TI_WITH_LLVM using namespace llvm; @@ -361,4 +361,4 @@ std::unique_ptr create_llvm_jit_session_cpu( #endif } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/runtime/cuda/jit_cuda.cpp b/taichi/runtime/cuda/jit_cuda.cpp index 7f84619a979c5..248076a5ea5d1 100644 --- a/taichi/runtime/cuda/jit_cuda.cpp +++ b/taichi/runtime/cuda/jit_cuda.cpp @@ -1,7 +1,7 @@ #include "taichi/runtime/cuda/jit_cuda.h" #include "taichi/runtime/llvm/llvm_context.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { #if defined(TI_WITH_CUDA) @@ -258,4 +258,4 @@ std::unique_ptr create_llvm_jit_session_cuda( } #endif -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/runtime/cuda/jit_cuda.h b/taichi/runtime/cuda/jit_cuda.h index a207f4b58110a..79155991704ab 100644 --- a/taichi/runtime/cuda/jit_cuda.h +++ b/taichi/runtime/cuda/jit_cuda.h @@ -35,7 +35,7 @@ #include "taichi/program/context.h" #undef TI_RUNTIME_HOST -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { #if defined(TI_WITH_CUDA) class JITModuleCUDA : public JITModule { @@ -110,4 +110,4 @@ std::unique_ptr create_llvm_jit_session_cuda( CompileConfig *config, Arch arch); -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/runtime/cuda/runtime.cpp b/taichi/runtime/cuda/runtime.cpp index 70497202e2417..56ed658157bb1 100644 --- a/taichi/runtime/cuda/runtime.cpp +++ b/taichi/runtime/cuda/runtime.cpp @@ -1,7 +1,7 @@ #include "taichi/runtime/runtime.h" #include "taichi/rhi/cuda/cuda_context.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { #if !defined(TI_WITH_CUDA) static_assert( @@ -37,4 +37,4 @@ static class RuntimeCUDAInjector { } } injector; -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/runtime/llvm/snode_tree_buffer_manager.cpp b/taichi/runtime/llvm/snode_tree_buffer_manager.cpp index d0965b4681400..e72b48aefc8ad 100644 --- a/taichi/runtime/llvm/snode_tree_buffer_manager.cpp +++ b/taichi/runtime/llvm/snode_tree_buffer_manager.cpp @@ -1,7 +1,7 @@ #include "snode_tree_buffer_manager.h" #include "taichi/runtime/llvm/llvm_runtime_executor.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { SNodeTreeBufferManager::SNodeTreeBufferManager( LlvmRuntimeExecutor *runtime_exec) @@ -79,4 +79,4 @@ void SNodeTreeBufferManager::destroy(SNodeTree *snode_tree) { TI_DEBUG("SNode tree {} destroyed.", snode_tree_id); } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/runtime/llvm/snode_tree_buffer_manager.h b/taichi/runtime/llvm/snode_tree_buffer_manager.h index 872d4cc0a8828..17101268a6573 100644 --- a/taichi/runtime/llvm/snode_tree_buffer_manager.h +++ b/taichi/runtime/llvm/snode_tree_buffer_manager.h @@ -7,7 +7,7 @@ using Ptr = uint8_t *; -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class JITModule; class LlvmRuntimeExecutor; @@ -35,4 +35,4 @@ class SNodeTreeBufferManager { std::size_t sizes_[kMaxNumSnodeTreesLlvm]; }; -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/runtime/metal/data_types.cpp b/taichi/runtime/metal/data_types.cpp index 5130f21c86a98..82800487d05cc 100644 --- a/taichi/runtime/metal/data_types.cpp +++ b/taichi/runtime/metal/data_types.cpp @@ -1,6 +1,6 @@ #include "taichi/runtime/metal/data_types.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace metal { MetalDataType to_metal_type(DataType dt) { @@ -135,4 +135,4 @@ std::string metal_unary_op_type_symbol(UnaryOpType type) { } } // namespace metal -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/runtime/metal/data_types.h b/taichi/runtime/metal/data_types.h index d794058014067..d70eef11a14c0 100644 --- a/taichi/runtime/metal/data_types.h +++ b/taichi/runtime/metal/data_types.h @@ -4,7 +4,7 @@ #include "taichi/util/lang_util.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace metal { enum class MetalDataType : int { @@ -46,4 +46,4 @@ inline bool is_metal_binary_op_infix(BinaryOpType type) { } // namespace metal -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/runtime/metal/features.h b/taichi/runtime/metal/features.h index 475573e116ffb..903f4da0a0de4 100644 --- a/taichi/runtime/metal/features.h +++ b/taichi/runtime/metal/features.h @@ -4,7 +4,7 @@ #include "taichi/util/lang_util.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace metal { inline bool is_supported_sparse_type(SNodeType t) { @@ -14,4 +14,4 @@ inline bool is_supported_sparse_type(SNodeType t) { } // namespace metal -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/runtime/runtime.cpp b/taichi/runtime/runtime.cpp index 51b055279d065..ed5259da9bc45 100644 --- a/taichi/runtime/runtime.cpp +++ b/taichi/runtime/runtime.cpp @@ -1,6 +1,6 @@ #include "taichi/runtime/runtime.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { std::unique_ptr Runtime::create(Arch arch) { auto &factories = get_factories(); @@ -11,4 +11,4 @@ std::unique_ptr Runtime::create(Arch arch) { } } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/runtime/runtime.h b/taichi/runtime/runtime.h index 726fe1114ee92..815a26374c897 100644 --- a/taichi/runtime/runtime.h +++ b/taichi/runtime/runtime.h @@ -8,7 +8,7 @@ #include #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class Runtime { protected: @@ -52,4 +52,4 @@ void Runtime::register_impl(Arch arch) { factories[arch] = [] { return std::make_unique(); }; } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/system/unified_allocator.cpp b/taichi/system/unified_allocator.cpp index a7ad7fdcebcee..9269671d16068 100644 --- a/taichi/system/unified_allocator.cpp +++ b/taichi/system/unified_allocator.cpp @@ -13,7 +13,7 @@ #include "taichi/rhi/cpu/cpu_device.h" #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { UnifiedAllocator::UnifiedAllocator(std::size_t size, Arch arch, Device *device) : size_(size), arch_(arch), device_(device) { @@ -59,4 +59,4 @@ void taichi::lang::UnifiedAllocator::memset(unsigned char val) { std::memset(data, val, size_); } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/system/unified_allocator.h b/taichi/system/unified_allocator.h index 47a59c53f4e2f..577b0d9213dd2 100644 --- a/taichi/system/unified_allocator.h +++ b/taichi/system/unified_allocator.h @@ -10,7 +10,7 @@ namespace taichi { class VirtualMemoryAllocator; } -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // This class can only have one instance class UnifiedAllocator { @@ -60,4 +60,4 @@ class UnifiedAllocator { Device *device_{nullptr}; }; -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/alg_simp.cpp b/taichi/transforms/alg_simp.cpp index 8b84e55ea7ea9..5108471a3e88a 100644 --- a/taichi/transforms/alg_simp.cpp +++ b/taichi/transforms/alg_simp.cpp @@ -6,7 +6,7 @@ #include "taichi/program/program.h" #include "taichi/util/bit.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // Algebraic Simplification and Strength Reduction class AlgSimp : public BasicStmtVisitor { @@ -445,4 +445,4 @@ bool alg_simp(IRNode *root, const CompileConfig &config) { } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/auto_diff.cpp b/taichi/transforms/auto_diff.cpp index 3a3dc6e4f4560..80e95083d9fba 100644 --- a/taichi/transforms/auto_diff.cpp +++ b/taichi/transforms/auto_diff.cpp @@ -8,7 +8,7 @@ #include #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class IndependentBlocksJudger : public BasicStmtVisitor { public: using BasicStmtVisitor::visit; @@ -1612,4 +1612,4 @@ void differentiation_validation_check(IRNode *root, } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/binary_op_simplify.cpp b/taichi/transforms/binary_op_simplify.cpp index 129e4f66258c7..4051872c7621a 100644 --- a/taichi/transforms/binary_op_simplify.cpp +++ b/taichi/transforms/binary_op_simplify.cpp @@ -4,7 +4,7 @@ #include "taichi/ir/transforms.h" #include "taichi/ir/visitors.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class BinaryOpSimp : public BasicStmtVisitor { public: @@ -192,4 +192,4 @@ bool binary_op_simplify(IRNode *root, const CompileConfig &config) { } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/bit_loop_vectorize.cpp b/taichi/transforms/bit_loop_vectorize.cpp index a269b05144b35..ace0dc9a6780d 100644 --- a/taichi/transforms/bit_loop_vectorize.cpp +++ b/taichi/transforms/bit_loop_vectorize.cpp @@ -8,7 +8,7 @@ #include "taichi/ir/visitors.h" #include "taichi/ir/analysis.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class BitLoopVectorize : public IRVisitor { public: @@ -335,4 +335,4 @@ void bit_loop_vectorize(IRNode *root) { } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/cfg_optimization.cpp b/taichi/transforms/cfg_optimization.cpp index 9366300f06ec1..1615389f92686 100644 --- a/taichi/transforms/cfg_optimization.cpp +++ b/taichi/transforms/cfg_optimization.cpp @@ -4,7 +4,7 @@ #include "taichi/ir/analysis.h" #include "taichi/system/profiler.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace irpass { bool cfg_optimization( @@ -35,4 +35,4 @@ bool cfg_optimization( } } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/check_out_of_bound.cpp b/taichi/transforms/check_out_of_bound.cpp index ca025ffbad3b3..0d68447a0fb8d 100644 --- a/taichi/transforms/check_out_of_bound.cpp +++ b/taichi/transforms/check_out_of_bound.cpp @@ -6,7 +6,7 @@ #include "taichi/transforms/utils.h" #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // TODO: also check RangeAssumptionStmt @@ -160,4 +160,4 @@ bool check_out_of_bound(IRNode *root, } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/compile_to_offloads.cpp b/taichi/transforms/compile_to_offloads.cpp index 58d00e0c2332f..c8e4fd080dfc4 100644 --- a/taichi/transforms/compile_to_offloads.cpp +++ b/taichi/transforms/compile_to_offloads.cpp @@ -8,7 +8,7 @@ #include "taichi/program/function.h" #include "taichi/program/kernel.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace irpass { namespace { @@ -359,4 +359,4 @@ void compile_function(IRNode *ir, } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/constant_fold.cpp b/taichi/transforms/constant_fold.cpp index 0596256ad664f..54c70475086cd 100644 --- a/taichi/transforms/constant_fold.cpp +++ b/taichi/transforms/constant_fold.cpp @@ -11,7 +11,7 @@ #include "taichi/transforms/constant_fold.h" #include "taichi/program/program.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class ConstantFold : public BasicStmtVisitor { public: @@ -266,4 +266,4 @@ bool constant_fold(IRNode *root, } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/demote_atomics.cpp b/taichi/transforms/demote_atomics.cpp index 1db0483589703..4d54a56258acb 100644 --- a/taichi/transforms/demote_atomics.cpp +++ b/taichi/transforms/demote_atomics.cpp @@ -8,7 +8,7 @@ #include #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class DemoteAtomics : public BasicStmtVisitor { private: @@ -195,4 +195,4 @@ bool demote_atomics(IRNode *root, const CompileConfig &config) { } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/demote_dense_struct_fors.cpp b/taichi/transforms/demote_dense_struct_fors.cpp index c7ef6d25293a2..0c2d4e59a27cd 100644 --- a/taichi/transforms/demote_dense_struct_fors.cpp +++ b/taichi/transforms/demote_dense_struct_fors.cpp @@ -4,7 +4,7 @@ #include "taichi/ir/visitors.h" #include "taichi/transforms/utils.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace { @@ -193,4 +193,4 @@ void demote_dense_struct_fors(IRNode *root, bool packed) { } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/demote_no_access_mesh_fors.cpp b/taichi/transforms/demote_no_access_mesh_fors.cpp index 0f2fc28c4efdd..3f37a15f5fd01 100644 --- a/taichi/transforms/demote_no_access_mesh_fors.cpp +++ b/taichi/transforms/demote_no_access_mesh_fors.cpp @@ -5,7 +5,7 @@ #include "taichi/ir/visitors.h" #include "taichi/transforms/utils.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace { @@ -69,4 +69,4 @@ void demote_no_access_mesh_fors(IRNode *root) { } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/demote_operations.cpp b/taichi/transforms/demote_operations.cpp index cc3a65ab2e345..136ee2c3dc191 100644 --- a/taichi/transforms/demote_operations.cpp +++ b/taichi/transforms/demote_operations.cpp @@ -5,7 +5,7 @@ #include "taichi/ir/visitors.h" #include "taichi/program/program.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // Demote Operations into pieces for backends to deal easier class DemoteOperations : public BasicStmtVisitor { @@ -229,4 +229,4 @@ bool demote_operations(IRNode *root, const CompileConfig &config) { } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/detect_read_only.cpp b/taichi/transforms/detect_read_only.cpp index c0e2825d4b36a..83023e165bb48 100644 --- a/taichi/transforms/detect_read_only.cpp +++ b/taichi/transforms/detect_read_only.cpp @@ -6,7 +6,7 @@ #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace irpass { @@ -92,4 +92,4 @@ std::unordered_map detect_external_ptr_access_in_task( } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/die.cpp b/taichi/transforms/die.cpp index f6d696c4da498..cf7f705634e21 100644 --- a/taichi/transforms/die.cpp +++ b/taichi/transforms/die.cpp @@ -8,7 +8,7 @@ #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // Dead Instruction Elimination class DIE : public IRVisitor { @@ -127,4 +127,4 @@ bool die(IRNode *root) { } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/extract_constant.cpp b/taichi/transforms/extract_constant.cpp index d7db7c76e01ea..a59fadbbdadb1 100644 --- a/taichi/transforms/extract_constant.cpp +++ b/taichi/transforms/extract_constant.cpp @@ -4,7 +4,7 @@ #include "taichi/ir/visitors.h" #include "taichi/program/compile_config.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class ExtractConstant : public BasicStmtVisitor { private: @@ -61,4 +61,4 @@ bool extract_constant(IRNode *root, const CompileConfig &config) { } } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/flag_access.cpp b/taichi/transforms/flag_access.cpp index bf754b518dc1e..5ee49c92adf85 100644 --- a/taichi/transforms/flag_access.cpp +++ b/taichi/transforms/flag_access.cpp @@ -4,7 +4,7 @@ #include "taichi/ir/visitors.h" #include "taichi/system/profiler.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // Flag accesses to be either weak (non-activating) or strong (activating) class FlagAccess : public IRVisitor { @@ -176,4 +176,4 @@ void flag_access(IRNode *root) { } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/insert_scratch_pad.cpp b/taichi/transforms/insert_scratch_pad.cpp index 38f6e59c4cce0..9213803e8cd80 100644 --- a/taichi/transforms/insert_scratch_pad.cpp +++ b/taichi/transforms/insert_scratch_pad.cpp @@ -6,7 +6,7 @@ #include "taichi/ir/scratch_pad.h" #include "taichi/system/profiler.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // TODO: rename scratch_pad to block_local_cache? Need to get rid of the // scratch_pad term @@ -33,4 +33,4 @@ std::unique_ptr initialize_scratch_pad(OffloadedStmt *offload) { } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/ir_printer.cpp b/taichi/transforms/ir_printer.cpp index 599c0e1661357..df8ae0d0de93b 100644 --- a/taichi/transforms/ir_printer.cpp +++ b/taichi/transforms/ir_printer.cpp @@ -8,7 +8,7 @@ #include "taichi/ir/frontend_ir.h" #include "taichi/util/str.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace { @@ -836,4 +836,4 @@ void print(IRNode *root, std::string *output) { } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/loop_invariant_code_motion.cpp b/taichi/transforms/loop_invariant_code_motion.cpp index 8e9fc4c4f9a11..b2c1d0141ef00 100644 --- a/taichi/transforms/loop_invariant_code_motion.cpp +++ b/taichi/transforms/loop_invariant_code_motion.cpp @@ -1,6 +1,6 @@ #include "taichi/transforms/loop_invariant_detector.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class LoopInvariantCodeMotion : public LoopInvariantDetector { public: @@ -88,4 +88,4 @@ bool loop_invariant_code_motion(IRNode *root, const CompileConfig &config) { } } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/lower_ast.cpp b/taichi/transforms/lower_ast.cpp index 462c3ddc1862f..557e97425bed7 100644 --- a/taichi/transforms/lower_ast.cpp +++ b/taichi/transforms/lower_ast.cpp @@ -8,7 +8,7 @@ #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace { @@ -522,4 +522,4 @@ void lower_ast(IRNode *root) { } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/lower_matrix_ptr.cpp b/taichi/transforms/lower_matrix_ptr.cpp index 3626337f37679..36634e68bb700 100644 --- a/taichi/transforms/lower_matrix_ptr.cpp +++ b/taichi/transforms/lower_matrix_ptr.cpp @@ -4,7 +4,7 @@ #include "taichi/ir/visitors.h" #include "taichi/system/profiler.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class LowerMatrixPtr : public BasicStmtVisitor { public: @@ -57,4 +57,4 @@ void lower_matrix_ptr(IRNode *root) { } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/make_block_local.cpp b/taichi/transforms/make_block_local.cpp index e8af196a3f989..ced0febcea252 100644 --- a/taichi/transforms/make_block_local.cpp +++ b/taichi/transforms/make_block_local.cpp @@ -5,7 +5,7 @@ #include "taichi/ir/scratch_pad.h" #include "taichi/transforms/make_block_local.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace { @@ -358,4 +358,4 @@ void make_block_local(IRNode *root, } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/make_thread_local.cpp b/taichi/transforms/make_thread_local.cpp index dc58270f13d27..a7a1ec6dd8a95 100644 --- a/taichi/transforms/make_thread_local.cpp +++ b/taichi/transforms/make_thread_local.cpp @@ -10,7 +10,7 @@ #include "taichi/ir/visitors.h" #include "taichi/system/profiler.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace { @@ -207,4 +207,4 @@ void make_thread_local(IRNode *root, const CompileConfig &config) { } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/offload.cpp b/taichi/transforms/offload.cpp index 822e7a09b3283..5492b10c5ffa8 100644 --- a/taichi/transforms/offload.cpp +++ b/taichi/transforms/offload.cpp @@ -9,7 +9,7 @@ #include #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace irpass { namespace { @@ -789,4 +789,4 @@ void offload(IRNode *root, const CompileConfig &config) { } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/optimize_bit_struct_stores.cpp b/taichi/transforms/optimize_bit_struct_stores.cpp index e6302e05ae5f6..4ed1301247937 100644 --- a/taichi/transforms/optimize_bit_struct_stores.cpp +++ b/taichi/transforms/optimize_bit_struct_stores.cpp @@ -192,7 +192,7 @@ class DemoteAtomicBitStructStores : public BasicStmtVisitor { } // namespace -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace irpass { void optimize_bit_struct_stores(IRNode *root, @@ -216,4 +216,4 @@ void optimize_bit_struct_stores(IRNode *root, } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/re_id.cpp b/taichi/transforms/re_id.cpp index b0e34abe873e7..8d8ccb7f2b91f 100644 --- a/taichi/transforms/re_id.cpp +++ b/taichi/transforms/re_id.cpp @@ -2,7 +2,7 @@ #include "taichi/ir/transforms.h" #include "taichi/ir/visitors.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // This pass manipulates the id of statements so that they are successive values // starting from 0 @@ -41,4 +41,4 @@ void re_id(IRNode *root) { } } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/remove_assume_in_range.cpp b/taichi/transforms/remove_assume_in_range.cpp index 79e3ffe9d5409..dc3edd008ed5a 100644 --- a/taichi/transforms/remove_assume_in_range.cpp +++ b/taichi/transforms/remove_assume_in_range.cpp @@ -4,7 +4,7 @@ #include "taichi/ir/visitors.h" #include "taichi/system/profiler.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace { @@ -40,4 +40,4 @@ bool remove_range_assumption(IRNode *root) { } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/remove_loop_unique.cpp b/taichi/transforms/remove_loop_unique.cpp index d6ae1ceb71898..bf6e35b5cfcaf 100644 --- a/taichi/transforms/remove_loop_unique.cpp +++ b/taichi/transforms/remove_loop_unique.cpp @@ -4,7 +4,7 @@ #include "taichi/ir/visitors.h" #include "taichi/system/profiler.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace { @@ -38,4 +38,4 @@ bool remove_loop_unique(IRNode *root) { } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/replace_statements.cpp b/taichi/transforms/replace_statements.cpp index 08923dd5628b9..7d5140234cea8 100644 --- a/taichi/transforms/replace_statements.cpp +++ b/taichi/transforms/replace_statements.cpp @@ -1,6 +1,6 @@ #include "taichi/ir/transforms.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace irpass { @@ -27,4 +27,4 @@ bool replace_statements(IRNode *root, } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/reverse_segments.cpp b/taichi/transforms/reverse_segments.cpp index 4065b0278af96..2376f4a3aab1b 100644 --- a/taichi/transforms/reverse_segments.cpp +++ b/taichi/transforms/reverse_segments.cpp @@ -6,7 +6,7 @@ #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { namespace irpass { @@ -82,4 +82,4 @@ void reverse_segments(IRNode *root) { } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/scalarize.cpp b/taichi/transforms/scalarize.cpp index 8f6afbac0d630..6f67e9c3c3135 100644 --- a/taichi/transforms/scalarize.cpp +++ b/taichi/transforms/scalarize.cpp @@ -4,7 +4,7 @@ #include "taichi/ir/visitors.h" #include "taichi/system/profiler.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { class Scalarize : public IRVisitor { public: @@ -243,4 +243,4 @@ void scalarize(IRNode *root) { } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/simplify.cpp b/taichi/transforms/simplify.cpp index 6c18c88a9194d..8b9b48f9d4ec0 100644 --- a/taichi/transforms/simplify.cpp +++ b/taichi/transforms/simplify.cpp @@ -11,7 +11,7 @@ #include #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // Common subexpression elimination, store forwarding, useless local store // elimination; Simplify if statements into conditional stores. @@ -655,4 +655,4 @@ void full_simplify(IRNode *root, } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/statement_usage_replace.cpp b/taichi/transforms/statement_usage_replace.cpp index a46d104c01aa6..71d17e2dbb1df 100644 --- a/taichi/transforms/statement_usage_replace.cpp +++ b/taichi/transforms/statement_usage_replace.cpp @@ -4,7 +4,7 @@ #include "taichi/ir/visitors.h" #include "taichi/system/profiler.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // Replace all usages statement A with a new statement B. // Note that the original statement A is NOT replaced. @@ -93,4 +93,4 @@ void replace_all_usages_with(IRNode *root, Stmt *old_stmt, Stmt *new_stmt) { } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/transform_statements.cpp b/taichi/transforms/transform_statements.cpp index eaae474fafdd9..453ce551e35de 100644 --- a/taichi/transforms/transform_statements.cpp +++ b/taichi/transforms/transform_statements.cpp @@ -3,7 +3,7 @@ #include "taichi/ir/transforms.h" #include "taichi/ir/visitors.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // Transform each filtered statement class StatementsTransformer : public BasicStmtVisitor { @@ -58,4 +58,4 @@ bool transform_statements( } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/type_check.cpp b/taichi/transforms/type_check.cpp index 080ac7d78a89b..2fc22056a55aa 100644 --- a/taichi/transforms/type_check.cpp +++ b/taichi/transforms/type_check.cpp @@ -7,7 +7,7 @@ #include "taichi/ir/frontend_ir.h" #include "taichi/transforms/utils.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { static_assert( sizeof(real) == sizeof(float32), @@ -568,4 +568,4 @@ void type_check(IRNode *root, const CompileConfig &config) { } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/unreachable_code_elimination.cpp b/taichi/transforms/unreachable_code_elimination.cpp index d22bcdd8e5dbd..e01b8b820c5e3 100644 --- a/taichi/transforms/unreachable_code_elimination.cpp +++ b/taichi/transforms/unreachable_code_elimination.cpp @@ -4,7 +4,7 @@ #include "taichi/ir/visitors.h" #include "taichi/system/profiler.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // Unconditionally eliminate ContinueStmt's at **ends** of loops class UselessContinueEliminator : public IRVisitor { @@ -156,4 +156,4 @@ bool unreachable_code_elimination(IRNode *root) { } } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/transforms/whole_kernel_cse.cpp b/taichi/transforms/whole_kernel_cse.cpp index 1ecb6c1954032..797c60a190472 100644 --- a/taichi/transforms/whole_kernel_cse.cpp +++ b/taichi/transforms/whole_kernel_cse.cpp @@ -7,7 +7,7 @@ #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // A helper class to maintain WholeKernelCSE::visited class MarkUndone : public BasicStmtVisitor { @@ -219,4 +219,4 @@ bool whole_kernel_cse(IRNode *root) { } } // namespace irpass -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/util/environ_config.h b/taichi/util/environ_config.h index 9a4aae477eab4..716f09c664802 100644 --- a/taichi/util/environ_config.h +++ b/taichi/util/environ_config.h @@ -5,7 +5,7 @@ #include #include -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { static inline int get_environ_config(const std::string &name, int default_value = 0) { @@ -15,4 +15,4 @@ static inline int get_environ_config(const std::string &name, return std::stoi(res); } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/util/lang_util.h b/taichi/util/lang_util.h index 020f5fa8eb0be..d83a5b86fc61c 100644 --- a/taichi/util/lang_util.h +++ b/taichi/util/lang_util.h @@ -10,7 +10,7 @@ #include "taichi/ir/type_utils.h" #include "taichi/ir/type_factory.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { real get_cpu_frequency(); @@ -65,7 +65,7 @@ std::string runtime_lib_dir(); bool command_exist(const std::string &command); -TLANG_NAMESPACE_END +} // namespace taichi::lang TI_NAMESPACE_BEGIN void initialize_benchmark(); diff --git a/taichi/util/str.cpp b/taichi/util/str.cpp index 469bcf255dadd..8bcf953da138d 100644 --- a/taichi/util/str.cpp +++ b/taichi/util/str.cpp @@ -4,7 +4,7 @@ #include "taichi/inc/constants.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { std::string c_quoted(std::string const &str) { // https://zh.cppreference.com/w/cpp/language/escape @@ -60,4 +60,4 @@ std::string format_error_message(const std::string &error_message_template, return error_message_formatted; } -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/taichi/util/str.h b/taichi/util/str.h index d703a94a92f0e..330b05c4e28df 100644 --- a/taichi/util/str.h +++ b/taichi/util/str.h @@ -7,7 +7,7 @@ #include "taichi/util/lang_util.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // Quote |str| with a pair of ". Escape special characters like \n, \t etc. std::string c_quoted(std::string const &str); @@ -15,4 +15,4 @@ std::string c_quoted(std::string const &str); std::string format_error_message(const std::string &error_message_template, const std::function &fetcher); -TLANG_NAMESPACE_END +} // namespace taichi::lang diff --git a/tests/cpp/task/test_exception_handling.cpp b/tests/cpp/task/test_exception_handling.cpp index bc185429628e7..a6a50a9fc3cb9 100644 --- a/tests/cpp/task/test_exception_handling.cpp +++ b/tests/cpp/task/test_exception_handling.cpp @@ -2,7 +2,7 @@ #include "taichi/ir/ir.h" #include "taichi/ir/statements.h" -TLANG_NAMESPACE_BEGIN +namespace taichi::lang { // Simulate the AST transforms on the Google Colab Ubuntu kernels to see why it // crashes @@ -99,4 +99,4 @@ auto test_exception_handling_auto = []() { TI_REGISTER_TASK(test_exception_handling); TI_REGISTER_TASK(test_exception_handling_auto); -TLANG_NAMESPACE_END +} // namespace taichi::lang From 9ff9455de4ec9e7727fd25322b5e4e7c55f70186 Mon Sep 17 00:00:00 2001 From: lin-hitonami Date: Fri, 23 Sep 2022 17:57:28 +0800 Subject: [PATCH 2/4] remove ti --- .../articles/contribution/contributor_guide.md | 1 - taichi/codegen/cc/cc_program.h | 4 ++-- taichi/common/core.cpp | 4 ++-- taichi/common/core.h | 14 ++++++-------- taichi/common/dict.h | 4 ++-- taichi/common/interface.h | 4 ++-- taichi/common/serialization.h | 8 ++++---- taichi/common/task.h | 4 ++-- taichi/math/array.h | 4 ++-- taichi/math/array_2d.h | 4 ++-- taichi/math/array_fwd.h | 4 ++-- taichi/math/geometry_util.h | 4 ++-- taichi/math/linalg.h | 4 ++-- taichi/math/math.h | 4 ++-- taichi/math/scalar.h | 4 ++-- taichi/python/exception.cpp | 4 ++-- taichi/python/exception.h | 4 ++-- taichi/python/export.cpp | 4 ++-- taichi/python/export.h | 4 ++-- taichi/python/export_ggui.cpp | 8 ++++---- taichi/python/export_lang.cpp | 8 ++++---- taichi/python/export_math.cpp | 4 ++-- taichi/python/export_visual.cpp | 4 ++-- taichi/python/memory_usage_monitor.cpp | 4 ++-- taichi/python/memory_usage_monitor.h | 4 ++-- taichi/system/benchmark.h | 4 ++-- taichi/system/demangling.cpp | 4 ++-- taichi/system/dynamic_loader.cpp | 4 ++-- taichi/system/dynamic_loader.h | 4 ++-- taichi/system/profiler.cpp | 4 ++-- taichi/system/profiler.h | 4 ++-- taichi/system/run_tests.cpp | 4 ++-- taichi/system/threading.cpp | 4 ++-- taichi/system/threading.h | 4 ++-- taichi/system/timeline.cpp | 4 ++-- taichi/system/timeline.h | 4 ++-- taichi/system/timer.cpp | 4 ++-- taichi/system/timer.h | 4 ++-- taichi/system/traceback.cpp | 4 ++-- taichi/system/virtual_memory.h | 4 ++-- taichi/ui/gui/android.cpp | 4 ++-- taichi/ui/gui/cocoa.cpp | 4 ++-- taichi/ui/gui/gui.cpp | 4 ++-- taichi/ui/gui/gui.h | 4 ++-- taichi/ui/gui/win32.cpp | 4 ++-- taichi/ui/gui/x11.cpp | 4 ++-- taichi/util/action_recorder.cpp | 4 ++-- taichi/util/base64.h | 4 ++-- taichi/util/bit.cpp | 4 ++-- taichi/util/image_buffer.cpp | 4 ++-- taichi/util/io.h | 4 ++-- taichi/util/lang_util.cpp | 10 ++++------ taichi/util/lang_util.h | 4 ++-- taichi/util/line_appender.h | 4 ++-- taichi/util/short_name.cpp | 4 ++-- taichi/util/short_name.h | 4 ++-- taichi/util/statistics.cpp | 4 ++-- taichi/util/zip.cpp | 4 ++-- tests/cpp/codegen/refine_coordinates_test.cpp | 7 ++----- tests/cpp/task/test_gui.cpp | 4 ++-- 60 files changed, 130 insertions(+), 138 deletions(-) diff --git a/docs/lang/articles/contribution/contributor_guide.md b/docs/lang/articles/contribution/contributor_guide.md index b57835f55a23b..9a00d354d552d 100644 --- a/docs/lang/articles/contribution/contributor_guide.md +++ b/docs/lang/articles/contribution/contributor_guide.md @@ -313,7 +313,6 @@ Below we highlight some of the most widely used styles. - Constant names should use the camel case, with a prefix `k`, for example, `constexpr int kTaichiMaxNumArgs = 64;`. - Macros should start with `TI_`, for example, `TI_NOT_IMPLEMENTED`. - In general, avoid using macros as much as possible. - - Avoid using `TI_NAMESPACE_BEGIN/END` in the new code. ### Rule of thumbs diff --git a/taichi/codegen/cc/cc_program.h b/taichi/codegen/cc/cc_program.h index 64ad32ae2ef15..4ca662ef1eb9d 100644 --- a/taichi/codegen/cc/cc_program.h +++ b/taichi/codegen/cc/cc_program.h @@ -16,9 +16,9 @@ #include #include -TI_NAMESPACE_BEGIN +namespace taichi { class DynamicLoader; -TI_NAMESPACE_END +} // namespace taichi namespace taichi::lang { diff --git a/taichi/common/core.cpp b/taichi/common/core.cpp index 842a875300759..3a11c407029cf 100644 --- a/taichi/common/core.cpp +++ b/taichi/common/core.cpp @@ -18,7 +18,7 @@ #include #endif -TI_NAMESPACE_BEGIN +namespace taichi { std::string python_package_dir; @@ -105,4 +105,4 @@ int PID::get_parent_pid() { #endif } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/common/core.h b/taichi/common/core.h index 7a13b330f279b..77bd2b44c580d 100644 --- a/taichi/common/core.h +++ b/taichi/common/core.h @@ -105,12 +105,10 @@ static_assert(__cplusplus >= 201402L, "C++14 required."); #define TI_STATIC_ASSERT(x) static_assert((x), #x) -#define TI_NAMESPACE_BEGIN namespace taichi { -#define TI_NAMESPACE_END } void taichi_raise_assertion_failure_in_python(const char *msg); -TI_NAMESPACE_BEGIN +namespace taichi { //****************************************************************************** // System State @@ -203,7 +201,7 @@ float64 constexpr operator"" _fd(unsigned long long v) { return float64(v); } -TI_NAMESPACE_END +} // namespace taichi //****************************************************************************** // Meta-programming //****************************************************************************** @@ -212,7 +210,7 @@ TI_NAMESPACE_END #include "taichi/common/logging.h" -TI_NAMESPACE_BEGIN +namespace taichi { namespace zip { @@ -268,7 +266,7 @@ inline bool starts_with(std::string const &str, std::string const &ending) { return std::equal(ending.begin(), ending.end(), str.begin()); } -TI_NAMESPACE_END +} // namespace taichi //****************************************************************************** // Serialization @@ -280,7 +278,7 @@ TI_NAMESPACE_END // Misc. //****************************************************************************** -TI_NAMESPACE_BEGIN +namespace taichi { extern int __trash__; template @@ -334,4 +332,4 @@ class PID { static int get_parent_pid(); }; -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/common/dict.h b/taichi/common/dict.h index c10818059e3e1..0d94e543874f5 100644 --- a/taichi/common/dict.h +++ b/taichi/common/dict.h @@ -17,7 +17,7 @@ #include "taichi/common/core.h" #include "taichi/math/math.h" -TI_NAMESPACE_BEGIN +namespace taichi { // Declare and then load // Load to `this` @@ -354,4 +354,4 @@ inline bool Dict::get(std::string key) const { using Config = Dict; -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/common/interface.h b/taichi/common/interface.h index d9ef18ae8ba04..3e4c793b2598f 100644 --- a/taichi/common/interface.h +++ b/taichi/common/interface.h @@ -14,7 +14,7 @@ #include #include -TI_NAMESPACE_BEGIN +namespace taichi { template std::shared_ptr create_instance(const std::string &alias); @@ -333,4 +333,4 @@ class InterfaceHolder { return alias; \ } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/common/serialization.h b/taichi/common/serialization.h index 8458c1b7514d1..1253bcc60592d 100644 --- a/taichi/common/serialization.h +++ b/taichi/common/serialization.h @@ -20,10 +20,8 @@ #include #ifdef TI_INCLUDED -TI_NAMESPACE_BEGIN +namespace taichi { #else -#define TI_NAMESPACE_BEGIN -#define TI_NAMESPACE_END #define TI_TRACE #define TI_CRITICAL #define TI_ASSERT assert @@ -933,4 +931,6 @@ static_assert( std::vector> &>(), ""); -TI_NAMESPACE_END +#ifdef TI_INCLUDED +} // namespace taichi +#endif \ No newline at end of file diff --git a/taichi/common/task.h b/taichi/common/task.h index d470c833edd7a..f809a9ea7af76 100644 --- a/taichi/common/task.h +++ b/taichi/common/task.h @@ -10,7 +10,7 @@ #include "taichi/common/interface.h" -TI_NAMESPACE_BEGIN +namespace taichi { class Task : public Unit { public: @@ -75,4 +75,4 @@ task_invoke(const T &func, const std::vector ¶ms) { }; \ TI_IMPLEMENTATION(Task, Task_##task, #task) -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/math/array.h b/taichi/math/array.h index 2b4e2e69903e6..13560f9ca27de 100644 --- a/taichi/math/array.h +++ b/taichi/math/array.h @@ -7,7 +7,7 @@ #include "array_2d.h" -TI_NAMESPACE_BEGIN +namespace taichi { template class IndexND; @@ -17,4 +17,4 @@ class RegionND; template class ArrayND; -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/math/array_2d.h b/taichi/math/array_2d.h index 04633581a6fb3..ef5780870c7ae 100644 --- a/taichi/math/array_2d.h +++ b/taichi/math/array_2d.h @@ -14,7 +14,7 @@ #include "array_fwd.h" #include "linalg.h" -TI_NAMESPACE_BEGIN +namespace taichi { template <> class IndexND<2> { @@ -794,4 +794,4 @@ inline void print(const Array2D &arr) { arr.print(""); } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/math/array_fwd.h b/taichi/math/array_fwd.h index 23c8831a6d946..75388c2617a4e 100644 --- a/taichi/math/array_fwd.h +++ b/taichi/math/array_fwd.h @@ -7,7 +7,7 @@ #include "taichi/common/core.h" -TI_NAMESPACE_BEGIN +namespace taichi { template class IndexND; @@ -27,4 +27,4 @@ class ArrayND; template using TArray = ArrayND; -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/math/geometry_util.h b/taichi/math/geometry_util.h index 3be56891a5de3..59efa3d4da793 100644 --- a/taichi/math/geometry_util.h +++ b/taichi/math/geometry_util.h @@ -10,7 +10,7 @@ #include "taichi/common/core.h" #include "linalg.h" -TI_NAMESPACE_BEGIN +namespace taichi { inline bool intersect(const Vector2 &a, const Vector2 &b, @@ -85,4 +85,4 @@ inline std::vector points_inside_sphere(std::vector x_range, return ret; } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/math/linalg.h b/taichi/math/linalg.h index a6c28d83eb859..7d77d2f20f4a3 100644 --- a/taichi/math/linalg.h +++ b/taichi/math/linalg.h @@ -13,7 +13,7 @@ #include "taichi/common/core.h" #include "scalar.h" #include "array_fwd.h" -TI_NAMESPACE_BEGIN +namespace taichi { // Instruction Set Extension @@ -1448,4 +1448,4 @@ template struct is_MatrixND> : public std::true_type {}; } // namespace type -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/math/math.h b/taichi/math/math.h index b8bace82b6d5f..91dcce44e14fa 100644 --- a/taichi/math/math.h +++ b/taichi/math/math.h @@ -10,7 +10,7 @@ #include "array.h" #include "linalg.h" -TI_NAMESPACE_BEGIN +namespace taichi { namespace math { template @@ -39,4 +39,4 @@ TI_FORCE_INLINE } // namespace math -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/math/scalar.h b/taichi/math/scalar.h index 1ce736428050a..eaf7c6f0dd699 100644 --- a/taichi/math/scalar.h +++ b/taichi/math/scalar.h @@ -8,7 +8,7 @@ #include #include "taichi/common/core.h" -TI_NAMESPACE_BEGIN +namespace taichi { using std::abs; using std::acos; @@ -170,4 +170,4 @@ inline int64 get_largest_pot(int64 a) noexcept { return a - (a >> 1); } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/python/exception.cpp b/taichi/python/exception.cpp index 2154ec0762428..865af462e65b1 100644 --- a/taichi/python/exception.cpp +++ b/taichi/python/exception.cpp @@ -5,13 +5,13 @@ #include "taichi/python/exception.h" -TI_NAMESPACE_BEGIN +namespace taichi { void raise_assertion_failure_in_python(const std::string &msg) { throw ExceptionForPython(msg); } -TI_NAMESPACE_END +} // namespace taichi void taichi_raise_assertion_failure_in_python(const char *msg) { taichi::raise_assertion_failure_in_python(std::string(msg)); diff --git a/taichi/python/exception.h b/taichi/python/exception.h index 1397f2070631c..c6f0766d86f20 100644 --- a/taichi/python/exception.h +++ b/taichi/python/exception.h @@ -9,7 +9,7 @@ #include -TI_NAMESPACE_BEGIN +namespace taichi { class ExceptionForPython : public std::exception { private: @@ -25,4 +25,4 @@ class ExceptionForPython : public std::exception { void raise_assertion_failure_in_python(const std::string &msg); -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/python/export.cpp b/taichi/python/export.cpp index 1cd8b7739f154..17ea394936f1f 100644 --- a/taichi/python/export.cpp +++ b/taichi/python/export.cpp @@ -7,7 +7,7 @@ #include "taichi/common/interface.h" #include "taichi/util/io.h" -TI_NAMESPACE_BEGIN +namespace taichi { PYBIND11_MODULE(taichi_python, m) { m.doc() = "taichi_python"; @@ -23,4 +23,4 @@ PYBIND11_MODULE(taichi_python, m) { export_ggui(m); } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/python/export.h b/taichi/python/export.h index 436d02ab9ade9..f4058b4720f3b 100644 --- a/taichi/python/export.h +++ b/taichi/python/export.h @@ -21,7 +21,7 @@ #include "taichi/common/core.h" -TI_NAMESPACE_BEGIN +namespace taichi { namespace py = pybind11; @@ -35,4 +35,4 @@ void export_visual(py::module &m); void export_ggui(py::module &m); -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/python/export_ggui.cpp b/taichi/python/export_ggui.cpp index b68e60f67a3d6..e8a7fa21a44f4 100644 --- a/taichi/python/export_ggui.cpp +++ b/taichi/python/export_ggui.cpp @@ -594,22 +594,22 @@ void export_ggui(py::module &m) { TI_UI_NAMESPACE_END -TI_NAMESPACE_BEGIN +namespace taichi { void export_ggui(py::module &m) { ui::export_ggui(m); } -TI_NAMESPACE_END +} // namespace taichi #else -TI_NAMESPACE_BEGIN +namespace taichi { void export_ggui(py::module &m) { m.attr("GGUI_AVAILABLE") = py::bool_(false); } -TI_NAMESPACE_END +} // namespace taichi #endif diff --git a/taichi/python/export_lang.cpp b/taichi/python/export_lang.cpp index 1dda75f16ec0d..6953d10a6778a 100644 --- a/taichi/python/export_lang.cpp +++ b/taichi/python/export_lang.cpp @@ -36,10 +36,10 @@ #include "taichi/rhi/cuda/cuda_context.h" #endif -TI_NAMESPACE_BEGIN +namespace taichi { bool test_threading(); -TI_NAMESPACE_END +} // namespace taichi namespace taichi::lang { @@ -51,7 +51,7 @@ std::string libdevice_path(); } // namespace taichi::lang -TI_NAMESPACE_BEGIN +namespace taichi { void export_lang(py::module &m) { using namespace taichi::lang; using namespace std::placeholders; @@ -1360,4 +1360,4 @@ void export_lang(py::module &m) { }); } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/python/export_math.cpp b/taichi/python/export_math.cpp index 79dcbd215acc1..97d825835512a 100644 --- a/taichi/python/export_math.cpp +++ b/taichi/python/export_math.cpp @@ -6,7 +6,7 @@ #include "taichi/python/export.h" #include "taichi/common/dict.h" -TI_NAMESPACE_BEGIN +namespace taichi { template constexpr std::string get_type_short_name(); @@ -161,4 +161,4 @@ void export_math(py::module &m) { VectorRegistration::run(m); } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/python/export_visual.cpp b/taichi/python/export_visual.cpp index 0c1534991c80b..1b6832d7308d0 100644 --- a/taichi/python/export_visual.cpp +++ b/taichi/python/export_visual.cpp @@ -7,7 +7,7 @@ #include "taichi/util/image_io.h" #include "taichi/ui/gui/gui.h" -TI_NAMESPACE_BEGIN +namespace taichi { void export_visual(py::module &m) { // GUI @@ -116,4 +116,4 @@ void export_visual(py::module &m) { }); } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/python/memory_usage_monitor.cpp b/taichi/python/memory_usage_monitor.cpp index c6d053d8ac194..d42d47da483e1 100644 --- a/taichi/python/memory_usage_monitor.cpp +++ b/taichi/python/memory_usage_monitor.cpp @@ -8,7 +8,7 @@ #include "taichi/system/threading.h" #include "taichi/system/timer.h" -TI_NAMESPACE_BEGIN +namespace taichi { namespace py = pybind11; using namespace py::literals; @@ -116,4 +116,4 @@ class MemoryTest2 : public Task { TI_IMPLEMENTATION(Task, MemoryTest, "mem_test"); TI_IMPLEMENTATION(Task, MemoryTest2, "mem_test2"); -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/python/memory_usage_monitor.h b/taichi/python/memory_usage_monitor.h index ac6cb5f2c2b73..30b8ec7de308d 100644 --- a/taichi/python/memory_usage_monitor.h +++ b/taichi/python/memory_usage_monitor.h @@ -2,7 +2,7 @@ #include "taichi/system/virtual_memory.h" -TI_NAMESPACE_BEGIN +namespace taichi { class MemoryMonitor { // avoid including py::dict @@ -21,4 +21,4 @@ void start_memory_monitoring(std::string output_fn, int pid = -1, real interval = 1); -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/system/benchmark.h b/taichi/system/benchmark.h index fd1ca6d24f8bb..6eb74361698ec 100644 --- a/taichi/system/benchmark.h +++ b/taichi/system/benchmark.h @@ -8,7 +8,7 @@ #include "taichi/common/interface.h" #include "taichi/system/timer.h" -TI_NAMESPACE_BEGIN +namespace taichi { class Benchmark : public Unit { protected: @@ -61,4 +61,4 @@ class Benchmark : public Unit { TI_INTERFACE(Benchmark) -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/system/demangling.cpp b/taichi/system/demangling.cpp index 5059905885fb8..1e605a6cdbc60 100644 --- a/taichi/system/demangling.cpp +++ b/taichi/system/demangling.cpp @@ -9,7 +9,7 @@ #include #endif -TI_NAMESPACE_BEGIN +namespace taichi { // From https://en.wikipedia.org/wiki/Name_mangling @@ -45,4 +45,4 @@ class Demangling : public Task { TI_IMPLEMENTATION(Task, Demangling, "demangle") -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/system/dynamic_loader.cpp b/taichi/system/dynamic_loader.cpp index e1a866d74d88e..d3ce23a19a91a 100644 --- a/taichi/system/dynamic_loader.cpp +++ b/taichi/system/dynamic_loader.cpp @@ -6,7 +6,7 @@ #include #endif -TI_NAMESPACE_BEGIN +namespace taichi { DynamicLoader::DynamicLoader(const std::string &dll_path) { load_dll(dll_path); @@ -52,4 +52,4 @@ bool DynamicLoader::loaded() const { return dll_ != nullptr; } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/system/dynamic_loader.h b/taichi/system/dynamic_loader.h index 3812f13555960..52e15160b838c 100644 --- a/taichi/system/dynamic_loader.h +++ b/taichi/system/dynamic_loader.h @@ -7,7 +7,7 @@ #include "taichi/common/core.h" -TI_NAMESPACE_BEGIN +namespace taichi { class DynamicLoader { private: @@ -33,4 +33,4 @@ class DynamicLoader { void *dll_ = nullptr; }; -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/system/profiler.cpp b/taichi/system/profiler.cpp index 7130d137520a2..44de5fd4ddbb7 100644 --- a/taichi/system/profiler.cpp +++ b/taichi/system/profiler.cpp @@ -1,7 +1,7 @@ #include "taichi/system/profiler.h" #include "spdlog/fmt/bundled/color.h" -TI_NAMESPACE_BEGIN +namespace taichi { // A profiler's records form a tree structure struct ProfilerRecordNode { @@ -278,4 +278,4 @@ void Profiling::clear_profile_info() { } } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/system/profiler.h b/taichi/system/profiler.h index 4a6bcf278348a..f4bf67f18166d 100644 --- a/taichi/system/profiler.h +++ b/taichi/system/profiler.h @@ -14,7 +14,7 @@ #include "taichi/common/core.h" #include "taichi/system/timer.h" -TI_NAMESPACE_BEGIN +namespace taichi { class ProfilerRecords; @@ -56,4 +56,4 @@ class Profiling { #define TI_AUTO_PROF TI_PROFILER(__FUNCTION__) -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/system/run_tests.cpp b/taichi/system/run_tests.cpp index 68628afd44f92..4cfb4c6d8525c 100644 --- a/taichi/system/run_tests.cpp +++ b/taichi/system/run_tests.cpp @@ -7,7 +7,7 @@ #include "taichi/common/task.h" #include "taichi/util/testing.h" -TI_NAMESPACE_BEGIN +namespace taichi { class RunTests : public Task { std::string run(const std::vector ¶meters) override { @@ -17,4 +17,4 @@ class RunTests : public Task { TI_IMPLEMENTATION(Task, RunTests, "test"); -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/system/threading.cpp b/taichi/system/threading.cpp index 06fcf7955ee63..f8dca2ead0a3a 100644 --- a/taichi/system/threading.cpp +++ b/taichi/system/threading.cpp @@ -10,7 +10,7 @@ #include #include -TI_NAMESPACE_BEGIN +namespace taichi { bool test_threading() { auto tp = ThreadPool(20); @@ -136,4 +136,4 @@ ThreadPool::~ThreadPool() { th.join(); } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/system/threading.h b/taichi/system/threading.h index aca157079013b..c82004e64278f 100644 --- a/taichi/system/threading.h +++ b/taichi/system/threading.h @@ -12,7 +12,7 @@ #include #include -TI_NAMESPACE_BEGIN +namespace taichi { using RangeForTaskFunc = void(void *, int thread_id, int i); using ParallelFor = void(int n, int num_threads, void *, RangeForTaskFunc func); @@ -59,4 +59,4 @@ class ThreadPool { ~ThreadPool(); }; -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/system/timeline.cpp b/taichi/system/timeline.cpp index 3c02cb8b0f3af..b1cb95f88b3cb 100644 --- a/taichi/system/timeline.cpp +++ b/taichi/system/timeline.cpp @@ -1,6 +1,6 @@ #include "taichi/system/timeline.h" -TI_NAMESPACE_BEGIN +namespace taichi { std::string TimelineEvent::to_json() { std::string json{"{"}; @@ -122,4 +122,4 @@ void Timelines::set_enabled(bool enabled) { enabled_ = enabled; } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/system/timeline.h b/taichi/system/timeline.h index cf303c0269d79..7bc6ab606842d 100644 --- a/taichi/system/timeline.h +++ b/taichi/system/timeline.h @@ -6,7 +6,7 @@ #include "taichi/common/core.h" #include "taichi/system/timer.h" -TI_NAMESPACE_BEGIN +namespace taichi { struct TimelineEvent { std::string name; @@ -88,4 +88,4 @@ class Timelines { #define TI_AUTO_TIMELINE TI_TIMELINE(__FUNCTION__) -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/system/timer.cpp b/taichi/system/timer.cpp index fb0d61472e231..0423dbdd73e50 100644 --- a/taichi/system/timer.cpp +++ b/taichi/system/timer.cpp @@ -11,7 +11,7 @@ #endif -TI_NAMESPACE_BEGIN +namespace taichi { using namespace std; @@ -232,4 +232,4 @@ uint64 Time::get_cycles() { #endif -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/system/timer.h b/taichi/system/timer.h index d9ccf2e19ea31..6b195bb3fe28d 100644 --- a/taichi/system/timer.h +++ b/taichi/system/timer.h @@ -18,7 +18,7 @@ #pragma warning(pop) #endif -TI_NAMESPACE_BEGIN +namespace taichi { #define TIME(x) \ { \ @@ -105,4 +105,4 @@ class TI_DLL_EXPORT Time { }; }; -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/system/traceback.cpp b/taichi/system/traceback.cpp index 46e2e660bdeef..24a6ac2be077f 100644 --- a/taichi/system/traceback.cpp +++ b/taichi/system/traceback.cpp @@ -195,7 +195,7 @@ inline std::vector stack_trace() { #include #endif -TI_NAMESPACE_BEGIN +namespace taichi { void print_traceback() { #ifdef __APPLE__ @@ -367,4 +367,4 @@ void print_traceback() { "https://docs.taichi-lang.org/docs/install\n"); } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/system/virtual_memory.h b/taichi/system/virtual_memory.h index 47ee75ee15a61..b24d9cdb535fd 100644 --- a/taichi/system/virtual_memory.h +++ b/taichi/system/virtual_memory.h @@ -8,7 +8,7 @@ #include "taichi/platform/windows/windows.h" #endif -TI_NAMESPACE_BEGIN +namespace taichi { // Cross-platform virtual memory allocator class VirtualMemoryAllocator { @@ -59,4 +59,4 @@ uint64 get_memory_usage(int pid = -1); #define TI_MEMORY_USAGE(name) \ TI_DEBUG("Memory Usage [{}] = {:.2f} GB", name, get_memory_usage_gb()); -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/ui/gui/android.cpp b/taichi/ui/gui/android.cpp index 2f1e144d44263..d6959c4f77e83 100644 --- a/taichi/ui/gui/android.cpp +++ b/taichi/ui/gui/android.cpp @@ -6,7 +6,7 @@ #if defined(TI_GUI_ANDROID) #include -TI_NAMESPACE_BEGIN +namespace taichi { void GUI::process_event() { TI_ERROR("GGUI not supported on Android"); @@ -27,6 +27,6 @@ void GUI::set_title(std::string title) { GUI::~GUI() { } -TI_NAMESPACE_END +} // namespace taichi #endif diff --git a/taichi/ui/gui/cocoa.cpp b/taichi/ui/gui/cocoa.cpp index 7cfb8b246f735..adfaabeb4a791 100644 --- a/taichi/ui/gui/cocoa.cpp +++ b/taichi/ui/gui/cocoa.cpp @@ -271,7 +271,7 @@ __attribute__((constructor)) static void initView() { objc_registerClassPair(AppDelClass); } -TI_NAMESPACE_BEGIN +namespace taichi { void GUI::create_window() { clscall("NSApplication", "sharedApplication"); @@ -431,6 +431,6 @@ GUI::~GUI() { } } -TI_NAMESPACE_END +} // namespace taichi #endif diff --git a/taichi/ui/gui/gui.cpp b/taichi/ui/gui/gui.cpp index fbdf0530be8b6..3e63d7d56182b 100644 --- a/taichi/ui/gui/gui.cpp +++ b/taichi/ui/gui/gui.cpp @@ -1,6 +1,6 @@ #include "taichi/ui/gui/gui.h" -TI_NAMESPACE_BEGIN +namespace taichi { Vector2 Canvas::Line::vertices[128]; @@ -132,4 +132,4 @@ void Canvas::triangle_single(real x0, triangle(a, b, c, color); } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/ui/gui/gui.h b/taichi/ui/gui/gui.h index 7178dbb53709f..cbe8e5ccb2110 100644 --- a/taichi/ui/gui/gui.h +++ b/taichi/ui/gui/gui.h @@ -27,7 +27,7 @@ #include #endif -TI_NAMESPACE_BEGIN +namespace taichi { TI_FORCE_INLINE Vector4 color_from_hex(uint32 c) { return Vector4(c / 65536, c / 256 % 256, c % 256, 255) * (1 / 255.0_f); @@ -945,4 +945,4 @@ class TI_DLL_EXPORT GUI : public GUIBase { ~GUI(); }; -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/ui/gui/win32.cpp b/taichi/ui/gui/win32.cpp index 2fdd1a896dd22..31b749b8341c6 100644 --- a/taichi/ui/gui/win32.cpp +++ b/taichi/ui/gui/win32.cpp @@ -147,7 +147,7 @@ LRESULT CALLBACK WindowProc(HWND hwnd, return DefWindowProc(hwnd, uMsg, wParam, lParam); } -TI_NAMESPACE_BEGIN +namespace taichi { void GUI::process_event() { MSG msg; @@ -330,6 +330,6 @@ GUI::~GUI() { } } -TI_NAMESPACE_END +} // namespace taichi #endif diff --git a/taichi/ui/gui/x11.cpp b/taichi/ui/gui/x11.cpp index 5ef4a0ec9429e..df7c652553bb4 100644 --- a/taichi/ui/gui/x11.cpp +++ b/taichi/ui/gui/x11.cpp @@ -14,7 +14,7 @@ #undef Success #endif -TI_NAMESPACE_BEGIN +namespace taichi { class CXImage { public: @@ -202,6 +202,6 @@ GUI::~GUI() { } } -TI_NAMESPACE_END +} // namespace taichi #endif diff --git a/taichi/util/action_recorder.cpp b/taichi/util/action_recorder.cpp index 8827d2fc719c9..456d6b41bd581 100644 --- a/taichi/util/action_recorder.cpp +++ b/taichi/util/action_recorder.cpp @@ -1,7 +1,7 @@ #include "taichi/util/action_recorder.h" #include "taichi/util/str.h" -TI_NAMESPACE_BEGIN +namespace taichi { void ActionArg::serialize(std::ostream &ss) const { ss << key << ": "; @@ -53,4 +53,4 @@ void ActionRecorder::record(const std::string &content, ofs_.flush(); } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/util/base64.h b/taichi/util/base64.h index 7403e681b0f5a..e8b72fd1e74c0 100644 --- a/taichi/util/base64.h +++ b/taichi/util/base64.h @@ -1,6 +1,6 @@ #include "taichi/common/core.h" -TI_NAMESPACE_BEGIN +namespace taichi { /* base64.cpp and base64.h @@ -129,4 +129,4 @@ inline std::string base64_decode(std::string const &encoded_string) { return ret; } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/util/bit.cpp b/taichi/util/bit.cpp index 026fcfe8f856b..d8b64bbc1bd60 100644 --- a/taichi/util/bit.cpp +++ b/taichi/util/bit.cpp @@ -6,7 +6,7 @@ #include "taichi/util/testing.h" #include "taichi/util/bit.h" -TI_NAMESPACE_BEGIN +namespace taichi { namespace bit { @@ -245,4 +245,4 @@ TI_TEST("bit") { // TI_P(std::get<1>(e)); // CHECK(t == compress(std::get<0>(e), std::get<1>(e))); } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/util/image_buffer.cpp b/taichi/util/image_buffer.cpp index 9d4dde18bef0b..c8bc53d6bd30b 100644 --- a/taichi/util/image_buffer.cpp +++ b/taichi/util/image_buffer.cpp @@ -15,7 +15,7 @@ #define STB_TRUETYPE_IMPLEMENTATION #include "stb_truetype.h" -TI_NAMESPACE_BEGIN +namespace taichi { template void Array2D::load_image(const std::string &filename, bool linearize) { @@ -213,4 +213,4 @@ void write_pgm(Array2D img, const std::string &fn) { } } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/util/io.h b/taichi/util/io.h index 6409dbf2cd2bf..170fba96d9a09 100644 --- a/taichi/util/io.h +++ b/taichi/util/io.h @@ -21,7 +21,7 @@ #include #endif -TI_NAMESPACE_BEGIN +namespace taichi { inline bool path_exists(const std::string &dir) { struct stat buffer; @@ -149,4 +149,4 @@ bool read_vector_from_disk(std::vector *p_vec, std::string fn) { return true; } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/util/lang_util.cpp b/taichi/util/lang_util.cpp index 22c38df2d61ec..cf346c41206d9 100644 --- a/taichi/util/lang_util.cpp +++ b/taichi/util/lang_util.cpp @@ -8,9 +8,7 @@ #include "taichi/program/compile_config.h" #include "taichi/system/timer.h" -TI_NAMESPACE_BEGIN - -namespace lang { +namespace taichi::lang { CompileConfig default_compile_config; std::string compiled_lib_dir; @@ -102,8 +100,8 @@ bool command_exist(const std::string &command) { #endif } -} // namespace lang - +} // namespace taichi::lang +namespace taichi { void initialize_benchmark() { // CoreState::set_trigger_gdb_when_crash(true); lang::get_cpu_frequency(); @@ -121,4 +119,4 @@ void initialize_benchmark() { #endif } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/util/lang_util.h b/taichi/util/lang_util.h index d83a5b86fc61c..923b0b7f864b3 100644 --- a/taichi/util/lang_util.h +++ b/taichi/util/lang_util.h @@ -67,7 +67,7 @@ bool command_exist(const std::string &command); } // namespace taichi::lang -TI_NAMESPACE_BEGIN +namespace taichi { void initialize_benchmark(); template @@ -84,4 +84,4 @@ template using function_pointer_type = decltype(function_pointer_helper(std::declval())); -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/util/line_appender.h b/taichi/util/line_appender.h index 026969a4df4a2..3e47174bef2df 100644 --- a/taichi/util/line_appender.h +++ b/taichi/util/line_appender.h @@ -5,7 +5,7 @@ #include "spdlog/spdlog.h" #include "taichi/common/core.h" -TI_NAMESPACE_BEGIN +namespace taichi { class LineAppender { public: @@ -74,4 +74,4 @@ class ScopedIndent { LineAppender &la_; }; -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/util/short_name.cpp b/taichi/util/short_name.cpp index 3a0a334732a0b..6c21f60667525 100644 --- a/taichi/util/short_name.cpp +++ b/taichi/util/short_name.cpp @@ -1,7 +1,7 @@ #include "short_name.h" #include "base64.h" -TI_NAMESPACE_BEGIN +namespace taichi { namespace { const std::string alphatable = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; // e.g. `if` is not a good var name, but `If` @@ -20,4 +20,4 @@ std::string make_short_name_by_id(int id) { std::reverse(res.begin(), res.end()); return res; } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/util/short_name.h b/taichi/util/short_name.h index 8b9b102403171..6f5768c31a79b 100644 --- a/taichi/util/short_name.h +++ b/taichi/util/short_name.h @@ -3,8 +3,8 @@ #include #include "taichi/common/core.h" -TI_NAMESPACE_BEGIN +namespace taichi { std::string make_short_name_by_id(int id); -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/util/statistics.cpp b/taichi/util/statistics.cpp index d50bbe40e21fa..712d443ee16fe 100644 --- a/taichi/util/statistics.cpp +++ b/taichi/util/statistics.cpp @@ -1,6 +1,6 @@ #include "statistics.h" -TI_NAMESPACE_BEGIN +namespace taichi { Statistics stat; @@ -30,4 +30,4 @@ void Statistics::clear() { counters_.clear(); } -TI_NAMESPACE_END +} // namespace taichi diff --git a/taichi/util/zip.cpp b/taichi/util/zip.cpp index f95312d6cc187..eda547fde9501 100644 --- a/taichi/util/zip.cpp +++ b/taichi/util/zip.cpp @@ -13,7 +13,7 @@ #include "miniz.h" -TI_NAMESPACE_BEGIN +namespace taichi { namespace zip { @@ -112,4 +112,4 @@ std::vector read(const std::string fn, bool verbose) { } // namespace zip -TI_NAMESPACE_END +} // namespace taichi diff --git a/tests/cpp/codegen/refine_coordinates_test.cpp b/tests/cpp/codegen/refine_coordinates_test.cpp index 8812ec64a6e4f..f776f444fb819 100644 --- a/tests/cpp/codegen/refine_coordinates_test.cpp +++ b/tests/cpp/codegen/refine_coordinates_test.cpp @@ -16,9 +16,7 @@ #include "taichi/runtime/program_impls/llvm/llvm_program.h" #include "taichi/codegen/llvm/struct_llvm.h" -namespace taichi { - -namespace lang { +namespace taichi::lang { namespace { constexpr char kFuncName[] = "run_refine_coords"; @@ -183,6 +181,5 @@ TEST_F(RefineCoordinatesTest, Basic) { } } // namespace -} // namespace lang -} // namespace taichi +} // namespace taichi::lang #endif // #ifdef TI_WITH_LLVM diff --git a/tests/cpp/task/test_gui.cpp b/tests/cpp/task/test_gui.cpp index 4b68cc31d6196..297ef83252a5a 100644 --- a/tests/cpp/task/test_gui.cpp +++ b/tests/cpp/task/test_gui.cpp @@ -3,7 +3,7 @@ #include "taichi/gui/gui.h" #include "taichi/common/task.h" -TI_NAMESPACE_BEGIN +namespace taichi { auto test_gui = []() { // GUI gui("GUI Test", 1000, 400, false); @@ -47,4 +47,4 @@ auto test_gui = []() { TI_REGISTER_TASK(test_gui); -TI_NAMESPACE_END +} // namespace taichi From 33b724d97894320c49b1ea18cb31c0e99cc1df44 Mon Sep 17 00:00:00 2001 From: lin-hitonami Date: Fri, 23 Sep 2022 18:11:54 +0800 Subject: [PATCH 3/4] remove tilang --- c_api/src/taichi_llvm_impl.h | 6 ++---- taichi/analysis/alias_analysis.cpp | 2 +- taichi/analysis/arithmetic_interpretor.cpp | 6 ++---- taichi/analysis/arithmetic_interpretor.h | 6 ++---- taichi/analysis/bls_analyzer.cpp | 6 ++---- taichi/analysis/bls_analyzer.h | 6 ++---- taichi/analysis/build_cfg.cpp | 12 ++++-------- taichi/analysis/check_fields_registered.cpp | 2 +- taichi/analysis/clone.cpp | 2 +- taichi/analysis/constexpr_propagation.cpp | 2 +- taichi/analysis/count_statements.cpp | 2 +- taichi/analysis/data_source_analysis.cpp | 2 +- taichi/analysis/detect_fors_with_break.cpp | 2 +- taichi/analysis/gather_deactivations.cpp | 2 +- taichi/analysis/gather_mesh_thread_local.cpp | 2 +- taichi/analysis/gather_meshfor_relation_types.cpp | 2 +- taichi/analysis/gather_snode_read_writes.cpp | 2 +- taichi/analysis/gather_statements.cpp | 2 +- .../analysis/gather_uniquely_accessed_pointers.cpp | 2 +- taichi/analysis/gather_uniquely_accessed_pointers.h | 6 ++---- taichi/analysis/gather_used_atomics.cpp | 2 +- taichi/analysis/gen_offline_cache_key.cpp | 6 ++---- taichi/analysis/has_store_or_atomic.cpp | 2 +- taichi/analysis/last_store_or_atomic.cpp | 2 +- taichi/analysis/mesh_bls_analyzer.cpp | 6 ++---- taichi/analysis/mesh_bls_analyzer.h | 6 ++---- taichi/analysis/offline_cache_util.cpp | 6 ++---- taichi/analysis/offline_cache_util.h | 6 ++---- taichi/analysis/same_statements.cpp | 2 +- taichi/analysis/value_diff.cpp | 6 ++---- taichi/analysis/verify.cpp | 2 +- taichi/aot/graph_data.cpp | 6 ++---- taichi/aot/graph_data.h | 6 ++---- taichi/aot/module_builder.cpp | 6 ++---- taichi/aot/module_builder.h | 6 ++---- taichi/aot/module_data.h | 6 ++---- taichi/aot/module_loader.cpp | 6 ++---- taichi/aot/module_loader.h | 6 ++---- taichi/cache/gfx/cache_manager.cpp | 6 ++---- taichi/cache/gfx/cache_manager.h | 6 ++---- taichi/codegen/cc/cc_kernel.h | 2 +- taichi/codegen/cc/cc_layout.h | 2 +- taichi/codegen/cc/cc_program.cpp | 2 +- taichi/codegen/cc/cc_program.h | 4 ++-- taichi/codegen/cc/cc_runtime.h | 2 +- taichi/codegen/cc/cc_utils.h | 2 +- taichi/codegen/cc/codegen_cc.cpp | 2 +- taichi/codegen/cc/codegen_cc.h | 2 +- taichi/codegen/cc/context.h | 2 +- taichi/codegen/cc/struct_cc.cpp | 2 +- taichi/codegen/cc/struct_cc.h | 2 +- taichi/codegen/codegen.cpp | 2 +- taichi/codegen/codegen.h | 2 +- taichi/codegen/cpu/codegen_cpu.cpp | 2 +- taichi/codegen/cpu/codegen_cpu.h | 2 +- taichi/codegen/cuda/codegen_cuda.cpp | 2 +- taichi/codegen/cuda/codegen_cuda.h | 2 +- taichi/codegen/dx12/codegen_dx12.cpp | 2 +- taichi/codegen/dx12/codegen_dx12.h | 2 +- taichi/codegen/dx12/dx12_global_optimize_module.cpp | 6 ++---- taichi/codegen/dx12/dx12_llvm_passes.h | 6 ++---- taichi/codegen/llvm/codegen_llvm.cpp | 2 +- taichi/codegen/llvm/codegen_llvm.h | 6 ++---- taichi/codegen/llvm/codegen_llvm_quant.cpp | 2 +- taichi/codegen/llvm/llvm_codegen_utils.cpp | 6 ++---- taichi/codegen/llvm/llvm_codegen_utils.h | 6 ++---- taichi/codegen/llvm/llvm_compiled_data.h | 6 ++---- taichi/codegen/llvm/struct_llvm.cpp | 6 ++---- taichi/codegen/llvm/struct_llvm.h | 6 ++---- taichi/codegen/metal/codegen_metal.cpp | 6 ++---- taichi/codegen/metal/codegen_metal.h | 6 ++---- taichi/codegen/metal/env_config.cpp | 2 +- taichi/codegen/metal/env_config.h | 2 +- taichi/codegen/metal/struct_metal.cpp | 6 ++---- taichi/codegen/metal/struct_metal.h | 6 ++---- taichi/codegen/spirv/kernel_utils.cpp | 6 ++---- taichi/codegen/spirv/kernel_utils.h | 6 ++---- taichi/codegen/spirv/snode_struct_compiler.cpp | 6 ++---- taichi/codegen/spirv/snode_struct_compiler.h | 6 ++---- taichi/codegen/spirv/spirv_codegen.cpp | 6 ++---- taichi/codegen/spirv/spirv_codegen.h | 6 ++---- taichi/codegen/spirv/spirv_ir_builder.cpp | 6 ++---- taichi/codegen/spirv/spirv_ir_builder.h | 6 ++---- taichi/codegen/spirv/spirv_types.cpp | 6 ++---- taichi/codegen/spirv/spirv_types.h | 6 ++---- taichi/codegen/wasm/codegen_wasm.cpp | 6 ++---- taichi/codegen/wasm/codegen_wasm.h | 6 ++---- taichi/common/core.cpp | 2 +- taichi/common/core.h | 6 +++--- taichi/common/dict.h | 2 +- taichi/common/exceptions.h | 6 ++---- taichi/common/interface.h | 2 +- taichi/common/serialization.h | 2 +- taichi/common/task.h | 2 +- taichi/ir/analysis.h | 6 ++---- taichi/ir/basic_stmt_visitor.cpp | 2 +- taichi/ir/control_flow_graph.cpp | 6 ++---- taichi/ir/control_flow_graph.h | 6 ++---- taichi/ir/expr.cpp | 2 +- taichi/ir/expr.h | 2 +- taichi/ir/expression.h | 2 +- taichi/ir/expression_ops.h | 6 ++---- taichi/ir/expression_printer.h | 6 ++---- taichi/ir/frontend_ir.cpp | 2 +- taichi/ir/frontend_ir.h | 2 +- taichi/ir/ir.cpp | 6 ++---- taichi/ir/ir.h | 6 ++---- taichi/ir/ir_builder.cpp | 2 +- taichi/ir/ir_builder.h | 2 +- taichi/ir/mesh.cpp | 6 ++---- taichi/ir/mesh.h | 6 ++---- taichi/ir/offloaded_task_type.cpp | 2 +- taichi/ir/offloaded_task_type.h | 6 ++---- taichi/ir/pass.cpp | 6 ++---- taichi/ir/pass.h | 6 ++---- taichi/ir/scratch_pad.cpp | 2 +- taichi/ir/scratch_pad.h | 2 +- taichi/ir/snode.cpp | 2 +- taichi/ir/snode.h | 6 ++---- taichi/ir/snode_types.cpp | 6 ++---- taichi/ir/snode_types.h | 6 ++---- taichi/ir/statements.cpp | 2 +- taichi/ir/statements.h | 6 ++---- taichi/ir/stmt_op_types.cpp | 6 ++---- taichi/ir/stmt_op_types.h | 6 ++---- taichi/ir/transforms.h | 2 +- taichi/ir/type.cpp | 2 +- taichi/ir/type.h | 2 +- taichi/ir/type_factory.cpp | 2 +- taichi/ir/type_factory.h | 2 +- taichi/ir/type_utils.cpp | 6 ++---- taichi/ir/type_utils.h | 6 ++---- taichi/ir/visitors.h | 2 +- taichi/jit/jit_module.h | 2 +- taichi/jit/jit_session.cpp | 2 +- taichi/jit/jit_session.h | 2 +- taichi/math/array.h | 2 +- taichi/math/array_2d.h | 2 +- taichi/math/array_fwd.h | 2 +- taichi/math/geometry_util.h | 2 +- taichi/math/linalg.h | 2 +- taichi/math/math.h | 2 +- taichi/math/scalar.h | 2 +- taichi/math/svd.h | 2 +- taichi/program/callable.cpp | 6 ++---- taichi/program/callable.h | 6 ++---- taichi/program/compile_config.cpp | 2 +- taichi/program/context.h | 6 ++---- taichi/program/extension.cpp | 2 +- taichi/program/extension.h | 6 ++---- taichi/program/function.cpp | 6 ++---- taichi/program/function.h | 6 ++---- taichi/program/function_key.cpp | 6 ++---- taichi/program/function_key.h | 6 ++---- taichi/program/graph_builder.cpp | 6 ++---- taichi/program/graph_builder.h | 6 ++---- taichi/program/ir_node_extended_impl.cpp | 6 ++---- taichi/program/kernel.cpp | 2 +- taichi/program/kernel.h | 2 +- taichi/program/kernel_profiler.cpp | 2 +- taichi/program/kernel_profiler.h | 2 +- taichi/program/ndarray.cpp | 6 ++---- taichi/program/ndarray.h | 6 ++---- taichi/program/parallel_executor.cpp | 2 +- taichi/program/parallel_executor.h | 2 +- taichi/program/program.cpp | 6 ++---- taichi/program/program.h | 12 ++++-------- taichi/program/program_impl.cpp | 6 ++---- taichi/program/program_impl.h | 6 ++---- taichi/program/snode_expr_utils.cpp | 6 ++---- taichi/program/snode_expr_utils.h | 6 ++---- taichi/program/snode_rw_accessors_bank.cpp | 6 ++---- taichi/program/snode_rw_accessors_bank.h | 6 ++---- taichi/program/sparse_matrix.cpp | 6 ++---- taichi/program/sparse_matrix.h | 6 ++---- taichi/program/sparse_solver.cpp | 6 ++---- taichi/program/sparse_solver.h | 6 ++---- taichi/program/texture.cpp | 6 ++---- taichi/program/texture.h | 6 ++---- taichi/python/exception.cpp | 2 +- taichi/python/exception.h | 2 +- taichi/python/export.cpp | 2 +- taichi/python/export.h | 2 +- taichi/python/export_ggui.cpp | 4 ++-- taichi/python/export_lang.cpp | 6 +++--- taichi/python/export_math.cpp | 2 +- taichi/python/export_visual.cpp | 2 +- taichi/python/memory_usage_monitor.cpp | 2 +- taichi/python/memory_usage_monitor.h | 2 +- taichi/python/snode_registry.cpp | 6 ++---- taichi/python/snode_registry.h | 6 ++---- taichi/rhi/cpu/cpu_device.cpp | 6 ++---- taichi/rhi/cpu/cpu_device.h | 7 ++----- taichi/rhi/cuda/cuda_caching_allocator.cpp | 6 ++---- taichi/rhi/cuda/cuda_caching_allocator.h | 6 ++---- taichi/rhi/cuda/cuda_context.cpp | 2 +- taichi/rhi/cuda/cuda_context.h | 2 +- taichi/rhi/cuda/cuda_device.cpp | 6 ++---- taichi/rhi/cuda/cuda_device.h | 7 ++----- taichi/rhi/cuda/cuda_driver.cpp | 2 +- taichi/rhi/cuda/cuda_driver.h | 2 +- taichi/rhi/cuda/cuda_profiler.cpp | 2 +- taichi/rhi/cuda/cuda_profiler.h | 2 +- taichi/rhi/cuda/cupti_toolkit.cpp | 2 +- taichi/rhi/cuda/cupti_toolkit.h | 2 +- taichi/rhi/device.cpp | 6 ++---- taichi/rhi/device.h | 6 ++---- taichi/rhi/dx/dx_api.cpp | 6 ++---- taichi/rhi/dx/dx_api.h | 6 ++---- taichi/rhi/dx/dx_device.cpp | 6 ++---- taichi/rhi/dx/dx_device.h | 6 ++---- taichi/rhi/dx/dx_info_queue.cpp | 6 ++---- taichi/rhi/dx/dx_info_queue.h | 6 ++---- taichi/rhi/dx12/dx12_api.cpp | 6 ++---- taichi/rhi/dx12/dx12_api.h | 6 ++---- taichi/rhi/interop/vulkan_cpu_interop.cpp | 6 ++---- taichi/rhi/interop/vulkan_cpu_interop.h | 6 ++---- taichi/rhi/interop/vulkan_cuda_interop.cpp | 6 ++---- taichi/rhi/interop/vulkan_cuda_interop.h | 6 ++---- taichi/rhi/llvm/llvm_device.cpp | 6 ++---- taichi/rhi/llvm/llvm_device.h | 6 ++---- taichi/rhi/metal/constants.h | 6 ++---- taichi/rhi/metal/device.cpp | 6 ++---- taichi/rhi/metal/device.h | 6 ++---- taichi/rhi/opengl/opengl_api.cpp | 6 ++---- taichi/rhi/opengl/opengl_api.h | 6 ++---- taichi/rhi/opengl/opengl_device.cpp | 6 ++---- taichi/rhi/opengl/opengl_device.h | 6 ++---- taichi/rhi/vulkan/vulkan_common.h | 6 ++---- taichi/rhi/vulkan/vulkan_device.cpp | 6 ++---- taichi/rhi/vulkan/vulkan_device.h | 6 ++---- taichi/rhi/vulkan/vulkan_device_creator.cpp | 6 ++---- taichi/rhi/vulkan/vulkan_device_creator.h | 6 ++---- taichi/rhi/vulkan/vulkan_loader.cpp | 6 ++---- taichi/rhi/vulkan/vulkan_loader.h | 6 ++---- taichi/rhi/vulkan/vulkan_utils.h | 6 ++---- taichi/runtime/cpu/aot_module_builder_impl.cpp | 6 ++---- taichi/runtime/cpu/aot_module_builder_impl.h | 6 ++---- taichi/runtime/cpu/aot_module_loader_impl.cpp | 6 ++---- taichi/runtime/cpu/aot_module_loader_impl.h | 6 ++---- taichi/runtime/cpu/jit_cpu.cpp | 2 +- taichi/runtime/cuda/aot_module_builder_impl.cpp | 6 ++---- taichi/runtime/cuda/aot_module_builder_impl.h | 6 ++---- taichi/runtime/cuda/aot_module_loader_impl.cpp | 6 ++---- taichi/runtime/cuda/aot_module_loader_impl.h | 6 ++---- taichi/runtime/cuda/jit_cuda.cpp | 2 +- taichi/runtime/cuda/jit_cuda.h | 2 +- taichi/runtime/cuda/runtime.cpp | 2 +- taichi/runtime/dx12/aot_module_builder_impl.cpp | 6 ++---- taichi/runtime/dx12/aot_module_builder_impl.h | 6 ++---- taichi/runtime/gfx/aot_graph_data.h | 6 ++---- taichi/runtime/gfx/aot_module_builder_impl.cpp | 6 ++---- taichi/runtime/gfx/aot_module_builder_impl.h | 6 ++---- taichi/runtime/gfx/aot_module_loader_impl.cpp | 6 ++---- taichi/runtime/gfx/aot_module_loader_impl.h | 6 ++---- taichi/runtime/gfx/aot_utils.h | 6 ++---- taichi/runtime/gfx/runtime.cpp | 6 ++---- taichi/runtime/gfx/runtime.h | 6 ++---- taichi/runtime/gfx/snode_tree_manager.cpp | 6 ++---- taichi/runtime/gfx/snode_tree_manager.h | 6 ++---- taichi/runtime/llvm/aot_graph_data.h | 6 ++---- taichi/runtime/llvm/launch_arg_info.cpp | 6 ++---- taichi/runtime/llvm/launch_arg_info.h | 6 ++---- taichi/runtime/llvm/llvm_aot_module_builder.cpp | 6 ++---- taichi/runtime/llvm/llvm_aot_module_builder.h | 6 ++---- taichi/runtime/llvm/llvm_aot_module_loader.cpp | 6 ++---- taichi/runtime/llvm/llvm_aot_module_loader.h | 6 ++---- taichi/runtime/llvm/llvm_context.cpp | 6 ++---- taichi/runtime/llvm/llvm_context.h | 6 ++---- taichi/runtime/llvm/llvm_offline_cache.cpp | 6 ++---- taichi/runtime/llvm/llvm_offline_cache.h | 6 ++---- taichi/runtime/llvm/llvm_runtime_executor.cpp | 6 ++---- taichi/runtime/llvm/llvm_runtime_executor.h | 6 ++---- taichi/runtime/llvm/runtime_module/mem_request.h | 6 ++---- taichi/runtime/llvm/snode_tree_buffer_manager.cpp | 2 +- taichi/runtime/llvm/snode_tree_buffer_manager.h | 2 +- taichi/runtime/metal/aot_module_builder_impl.cpp | 6 ++---- taichi/runtime/metal/aot_module_builder_impl.h | 6 ++---- taichi/runtime/metal/aot_module_loader_impl.cpp | 6 ++---- taichi/runtime/metal/aot_module_loader_impl.h | 6 ++---- taichi/runtime/metal/aot_utils.h | 6 ++---- taichi/runtime/metal/api.cpp | 6 ++---- taichi/runtime/metal/api.h | 6 ++---- taichi/runtime/metal/data_types.cpp | 2 +- taichi/runtime/metal/data_types.h | 2 +- taichi/runtime/metal/features.h | 2 +- taichi/runtime/metal/kernel_manager.cpp | 6 ++---- taichi/runtime/metal/kernel_manager.h | 6 ++---- taichi/runtime/metal/kernel_utils.cpp | 6 ++---- taichi/runtime/metal/kernel_utils.h | 6 ++---- taichi/runtime/metal/runtime_utils.cpp | 6 ++---- taichi/runtime/metal/runtime_utils.h | 6 ++---- taichi/runtime/program_impls/dx/dx_program.cpp | 6 ++---- taichi/runtime/program_impls/dx/dx_program.h | 6 ++---- taichi/runtime/program_impls/llvm/llvm_program.cpp | 6 ++---- taichi/runtime/program_impls/llvm/llvm_program.h | 6 ++---- taichi/runtime/program_impls/metal/metal_program.cpp | 6 ++---- taichi/runtime/program_impls/metal/metal_program.h | 6 ++---- .../runtime/program_impls/opengl/opengl_program.cpp | 6 ++---- taichi/runtime/program_impls/opengl/opengl_program.h | 6 ++---- .../runtime/program_impls/vulkan/vulkan_program.cpp | 6 ++---- taichi/runtime/program_impls/vulkan/vulkan_program.h | 6 ++---- taichi/runtime/runtime.cpp | 2 +- taichi/runtime/runtime.h | 2 +- taichi/runtime/wasm/aot_module_builder_impl.cpp | 6 ++---- taichi/runtime/wasm/aot_module_builder_impl.h | 6 ++---- taichi/struct/snode_tree.cpp | 6 ++---- taichi/struct/snode_tree.h | 6 ++---- taichi/struct/struct.cpp | 6 ++---- taichi/struct/struct.h | 6 ++---- taichi/system/benchmark.h | 2 +- taichi/system/demangling.cpp | 2 +- taichi/system/dynamic_loader.cpp | 2 +- taichi/system/dynamic_loader.h | 2 +- taichi/system/memory_pool.cpp | 6 ++---- taichi/system/memory_pool.h | 6 ++---- taichi/system/profiler.cpp | 2 +- taichi/system/profiler.h | 2 +- taichi/system/run_tests.cpp | 2 +- taichi/system/threading.cpp | 2 +- taichi/system/threading.h | 2 +- taichi/system/timeline.cpp | 2 +- taichi/system/timeline.h | 2 +- taichi/system/timer.cpp | 2 +- taichi/system/timer.h | 2 +- taichi/system/traceback.cpp | 2 +- taichi/system/unified_allocator.cpp | 2 +- taichi/system/unified_allocator.h | 2 +- taichi/system/virtual_memory.h | 2 +- taichi/transforms/alg_simp.cpp | 2 +- taichi/transforms/auto_diff.cpp | 2 +- taichi/transforms/binary_op_simplify.cpp | 2 +- taichi/transforms/bit_loop_vectorize.cpp | 2 +- taichi/transforms/cfg_optimization.cpp | 2 +- taichi/transforms/check_out_of_bound.cpp | 2 +- taichi/transforms/check_out_of_bound.h | 6 ++---- taichi/transforms/compile_to_offloads.cpp | 2 +- taichi/transforms/constant_fold.cpp | 2 +- taichi/transforms/constant_fold.h | 6 ++---- taichi/transforms/demote_atomics.cpp | 2 +- taichi/transforms/demote_dense_struct_fors.cpp | 2 +- taichi/transforms/demote_mesh_statements.cpp | 6 ++---- taichi/transforms/demote_mesh_statements.h | 6 ++---- taichi/transforms/demote_no_access_mesh_fors.cpp | 2 +- taichi/transforms/demote_operations.cpp | 2 +- taichi/transforms/detect_read_only.cpp | 2 +- taichi/transforms/determine_ad_stack_size.cpp | 6 ++---- taichi/transforms/die.cpp | 2 +- taichi/transforms/extract_constant.cpp | 2 +- taichi/transforms/flag_access.cpp | 2 +- taichi/transforms/frontend_type_check.cpp | 7 ++----- taichi/transforms/inlining.cpp | 6 ++---- taichi/transforms/inlining.h | 6 ++---- taichi/transforms/insert_scratch_pad.cpp | 2 +- taichi/transforms/ir_printer.cpp | 2 +- taichi/transforms/loop_invariant_code_motion.cpp | 2 +- taichi/transforms/lower_access.cpp | 6 ++---- taichi/transforms/lower_access.h | 6 ++---- taichi/transforms/lower_ast.cpp | 2 +- taichi/transforms/lower_matrix_ptr.cpp | 2 +- taichi/transforms/make_block_local.cpp | 2 +- taichi/transforms/make_block_local.h | 6 ++---- taichi/transforms/make_mesh_block_local.cpp | 6 ++---- taichi/transforms/make_mesh_block_local.h | 6 ++---- taichi/transforms/make_mesh_thread_local.cpp | 6 ++---- taichi/transforms/make_mesh_thread_local.h | 6 ++---- taichi/transforms/make_thread_local.cpp | 2 +- taichi/transforms/offload.cpp | 2 +- taichi/transforms/optimize_bit_struct_stores.cpp | 2 +- taichi/transforms/re_id.cpp | 2 +- taichi/transforms/remove_assume_in_range.cpp | 2 +- taichi/transforms/remove_loop_unique.cpp | 2 +- taichi/transforms/replace_statements.cpp | 2 +- taichi/transforms/reverse_segments.cpp | 2 +- taichi/transforms/scalar_pointer_lowerer.cpp | 6 ++---- taichi/transforms/scalar_pointer_lowerer.h | 6 ++---- taichi/transforms/scalarize.cpp | 2 +- taichi/transforms/simplify.cpp | 2 +- taichi/transforms/simplify.h | 6 ++---- taichi/transforms/statement_usage_replace.cpp | 2 +- taichi/transforms/transform_statements.cpp | 2 +- taichi/transforms/type_check.cpp | 2 +- taichi/transforms/unreachable_code_elimination.cpp | 2 +- taichi/transforms/utils.cpp | 6 ++---- taichi/transforms/utils.h | 6 ++---- taichi/transforms/whole_kernel_cse.cpp | 2 +- taichi/ui/backends/vulkan/app_context.h | 6 ++---- taichi/ui/backends/vulkan/renderer.h | 6 ++---- taichi/ui/backends/vulkan/window.h | 6 ++---- taichi/ui/common/canvas_base.h | 6 ++---- taichi/ui/gui/android.cpp | 2 +- taichi/ui/gui/cocoa.cpp | 2 +- taichi/ui/gui/gui.cpp | 2 +- taichi/ui/gui/gui.h | 2 +- taichi/ui/gui/win32.cpp | 2 +- taichi/ui/gui/x11.cpp | 2 +- taichi/util/action_recorder.cpp | 2 +- taichi/util/base64.h | 2 +- taichi/util/bit.cpp | 2 +- taichi/util/environ_config.h | 2 +- taichi/util/file_sequence_writer.h | 6 ++---- taichi/util/image_buffer.cpp | 2 +- taichi/util/io.h | 2 +- taichi/util/lang_util.cpp | 2 +- taichi/util/lang_util.h | 4 ++-- taichi/util/line_appender.h | 2 +- taichi/util/offline_cache.h | 6 ++---- taichi/util/short_name.cpp | 2 +- taichi/util/short_name.h | 2 +- taichi/util/statistics.cpp | 2 +- taichi/util/str.cpp | 2 +- taichi/util/str.h | 2 +- taichi/util/zip.cpp | 2 +- tests/cpp/analysis/alias_analysis_test.cpp | 6 ++---- tests/cpp/analysis/bls_analyzer_test.cpp | 6 ++---- tests/cpp/analysis/same_statements_test.cpp | 6 ++---- tests/cpp/analysis/value_diff_test.cpp | 6 ++---- tests/cpp/aot/gfx_utils.cpp | 6 ++---- tests/cpp/aot/gfx_utils.h | 6 ++---- tests/cpp/aot/llvm/bitmasked_aot_test.cpp | 6 ++---- tests/cpp/aot/llvm/dynamic_aot_test.cpp | 6 ++---- tests/cpp/aot/llvm/field_aot_test.cpp | 6 ++---- tests/cpp/aot/llvm/field_cgraph_test.cpp | 6 ++---- tests/cpp/aot/llvm/kernel_aot_test.cpp | 6 ++---- tests/cpp/backends/dx11_device_test.cpp | 6 ++---- tests/cpp/common/dict_test.cpp | 6 ++---- tests/cpp/common/serialization_test.cpp | 6 ++---- tests/cpp/ir/frontend_type_inference_test.cpp | 6 ++---- tests/cpp/ir/ir_builder_test.cpp | 6 ++---- tests/cpp/ir/ir_test.cpp | 6 ++---- tests/cpp/ir/ir_type_promotion_test.cpp | 6 ++---- tests/cpp/ir/ndarray_kernel.cpp | 6 ++---- tests/cpp/ir/ndarray_kernel.h | 6 ++---- tests/cpp/ir/stmt_field_manager_test.cpp | 6 ++---- tests/cpp/ir/type_test.cpp | 6 ++---- tests/cpp/llvm/llvm_offline_cache_test.cpp | 6 ++---- tests/cpp/offline_cache/load_metadata_test.cpp | 6 ++---- tests/cpp/program/test_program.cpp | 6 ++---- tests/cpp/program/test_program.h | 6 ++---- tests/cpp/struct/fake_struct_compiler.h | 6 ++---- tests/cpp/struct/snode_tree_test.cpp | 6 ++---- tests/cpp/task/test_exception_handling.cpp | 2 +- tests/cpp/task/test_gui.cpp | 2 +- tests/cpp/transforms/alg_simp_test.cpp | 6 ++---- tests/cpp/transforms/binary_op_simplify_test.cpp | 6 ++---- .../cpp/transforms/determine_ad_stack_size_test.cpp | 6 ++---- tests/cpp/transforms/extract_constant_test.cpp | 6 ++---- tests/cpp/transforms/inlining_test.cpp | 6 ++---- tests/cpp/transforms/make_block_local_test.cpp | 6 ++---- tests/cpp/transforms/scalar_pointer_lowerer_test.cpp | 6 ++---- tests/cpp/transforms/scalarize_test.cpp | 6 ++---- tests/cpp/transforms/simplify_test.cpp | 6 ++---- 452 files changed, 724 insertions(+), 1253 deletions(-) diff --git a/c_api/src/taichi_llvm_impl.h b/c_api/src/taichi_llvm_impl.h index 84b3a899f3e30..a0c47eb360ce5 100644 --- a/c_api/src/taichi_llvm_impl.h +++ b/c_api/src/taichi_llvm_impl.h @@ -2,13 +2,11 @@ #include "taichi_core_impl.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class LlvmRuntimeExecutor; class MemoryPool; struct CompileConfig; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang namespace capi { diff --git a/taichi/analysis/alias_analysis.cpp b/taichi/analysis/alias_analysis.cpp index f81cd1ed21fad..94f2b2f1369df 100644 --- a/taichi/analysis/alias_analysis.cpp +++ b/taichi/analysis/alias_analysis.cpp @@ -168,4 +168,4 @@ bool maybe_same_address(Stmt *var1, Stmt *var2) { } // namespace irpass::analysis -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/analysis/arithmetic_interpretor.cpp b/taichi/analysis/arithmetic_interpretor.cpp index 5b00f15f6c8e1..c4210ad6145dd 100644 --- a/taichi/analysis/arithmetic_interpretor.cpp +++ b/taichi/analysis/arithmetic_interpretor.cpp @@ -7,8 +7,7 @@ #include "taichi/ir/type_utils.h" #include "taichi/ir/visitors.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { using CodeRegion = ArithmeticInterpretor::CodeRegion; @@ -180,5 +179,4 @@ std::optional ArithmeticInterpretor::evaluate( return ev.run(region, init_ctx); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/analysis/arithmetic_interpretor.h b/taichi/analysis/arithmetic_interpretor.h index 3a40d14051419..4a1ea88f81c6f 100644 --- a/taichi/analysis/arithmetic_interpretor.h +++ b/taichi/analysis/arithmetic_interpretor.h @@ -7,8 +7,7 @@ #include "taichi/ir/statements.h" #include "taichi/ir/type.h" -namespace taichi { -namespace lang { +namespace taichi::lang { /** * Interprets a sequence of CHI IR statements within a block (acts like a @@ -96,5 +95,4 @@ class ArithmeticInterpretor { const EvalContext &init_ctx) const; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/analysis/bls_analyzer.cpp b/taichi/analysis/bls_analyzer.cpp index 2db07a0e7e0a1..6eb6ab54fe02d 100644 --- a/taichi/analysis/bls_analyzer.cpp +++ b/taichi/analysis/bls_analyzer.cpp @@ -3,8 +3,7 @@ #include "taichi/system/profiler.h" #include "taichi/ir/analysis.h" -namespace taichi { -namespace lang { +namespace taichi::lang { BLSAnalyzer::BLSAnalyzer(OffloadedStmt *for_stmt, ScratchPads *pads) : for_stmt_(for_stmt), pads_(pads) { @@ -106,5 +105,4 @@ bool BLSAnalyzer::run() { return analysis_ok_; } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/analysis/bls_analyzer.h b/taichi/analysis/bls_analyzer.h index 4986adff9572d..9bd0fcd66022a 100644 --- a/taichi/analysis/bls_analyzer.h +++ b/taichi/analysis/bls_analyzer.h @@ -4,8 +4,7 @@ #include "taichi/ir/statements.h" #include "taichi/ir/scratch_pad.h" -namespace taichi { -namespace lang { +namespace taichi::lang { // Figure out accessed SNodes, and their ranges in this for stmt class BLSAnalyzer : public BasicStmtVisitor { @@ -56,5 +55,4 @@ class BLSAnalyzer : public BasicStmtVisitor { bool analysis_ok_{true}; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/analysis/build_cfg.cpp b/taichi/analysis/build_cfg.cpp index 583303788a5b6..e23033f6fb285 100644 --- a/taichi/analysis/build_cfg.cpp +++ b/taichi/analysis/build_cfg.cpp @@ -3,8 +3,7 @@ #include "taichi/ir/statements.h" #include "taichi/program/function.h" -namespace taichi { -namespace lang { +namespace taichi::lang { struct CFGFuncKey { FunctionKey func_key{"", -1, -1}; @@ -16,8 +15,7 @@ struct CFGFuncKey { } }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang namespace std { template <> @@ -29,8 +27,7 @@ struct hash { }; } // namespace std -namespace taichi { -namespace lang { +namespace taichi::lang { /** * Build a control-flow graph. The resulting graph is guaranteed to have an @@ -460,5 +457,4 @@ std::unique_ptr build_cfg(IRNode *root) { } } // namespace irpass::analysis -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/analysis/check_fields_registered.cpp b/taichi/analysis/check_fields_registered.cpp index 9d0d4d8a2e371..183568dde8331 100644 --- a/taichi/analysis/check_fields_registered.cpp +++ b/taichi/analysis/check_fields_registered.cpp @@ -33,4 +33,4 @@ void check_fields_registered(IRNode *root) { } } // namespace irpass::analysis -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/analysis/clone.cpp b/taichi/analysis/clone.cpp index 5bbac4bda41e9..78d354369de8a 100644 --- a/taichi/analysis/clone.cpp +++ b/taichi/analysis/clone.cpp @@ -139,4 +139,4 @@ std::unique_ptr clone(IRNode *root, Kernel *kernel) { } } // namespace irpass::analysis -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/analysis/constexpr_propagation.cpp b/taichi/analysis/constexpr_propagation.cpp index dacfc0ba9f374..6c620ec4fd111 100644 --- a/taichi/analysis/constexpr_propagation.cpp +++ b/taichi/analysis/constexpr_propagation.cpp @@ -106,4 +106,4 @@ std::unordered_set constexpr_prop( } } // namespace irpass::analysis -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/analysis/count_statements.cpp b/taichi/analysis/count_statements.cpp index 3e16f0c361188..1f1a11828aa15 100644 --- a/taichi/analysis/count_statements.cpp +++ b/taichi/analysis/count_statements.cpp @@ -41,4 +41,4 @@ int count_statements(IRNode *root) { } } // namespace irpass::analysis -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/analysis/data_source_analysis.cpp b/taichi/analysis/data_source_analysis.cpp index 8709d06948077..a3b47c873e114 100644 --- a/taichi/analysis/data_source_analysis.cpp +++ b/taichi/analysis/data_source_analysis.cpp @@ -77,4 +77,4 @@ std::vector get_store_destination(Stmt *store_stmt) { } // namespace irpass::analysis -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/analysis/detect_fors_with_break.cpp b/taichi/analysis/detect_fors_with_break.cpp index 71acb1e8dc75a..2a89161ae10ac 100644 --- a/taichi/analysis/detect_fors_with_break.cpp +++ b/taichi/analysis/detect_fors_with_break.cpp @@ -50,4 +50,4 @@ std::unordered_set detect_fors_with_break(IRNode *root) { } } // namespace irpass::analysis -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/analysis/gather_deactivations.cpp b/taichi/analysis/gather_deactivations.cpp index 76ad81534fc1e..0aa09ca8662b2 100644 --- a/taichi/analysis/gather_deactivations.cpp +++ b/taichi/analysis/gather_deactivations.cpp @@ -36,4 +36,4 @@ std::unordered_set gather_deactivations(IRNode *root) { } } // namespace irpass::analysis -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/analysis/gather_mesh_thread_local.cpp b/taichi/analysis/gather_mesh_thread_local.cpp index ec7eee13c1caf..da29ea10b906b 100644 --- a/taichi/analysis/gather_mesh_thread_local.cpp +++ b/taichi/analysis/gather_mesh_thread_local.cpp @@ -79,4 +79,4 @@ gather_mesh_thread_local(OffloadedStmt *offload, const CompileConfig &config) { } // namespace irpass::analysis -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/analysis/gather_meshfor_relation_types.cpp b/taichi/analysis/gather_meshfor_relation_types.cpp index 61d58cf15c493..3168341944f06 100644 --- a/taichi/analysis/gather_meshfor_relation_types.cpp +++ b/taichi/analysis/gather_meshfor_relation_types.cpp @@ -62,4 +62,4 @@ void gather_meshfor_relation_types(IRNode *node) { } // namespace irpass::analysis -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/analysis/gather_snode_read_writes.cpp b/taichi/analysis/gather_snode_read_writes.cpp index b9240ada2e7b3..65743fdc1dda4 100644 --- a/taichi/analysis/gather_snode_read_writes.cpp +++ b/taichi/analysis/gather_snode_read_writes.cpp @@ -40,4 +40,4 @@ gather_snode_read_writes(IRNode *root) { } } // namespace irpass::analysis -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/analysis/gather_statements.cpp b/taichi/analysis/gather_statements.cpp index 56bc26fd7b850..ddaf8844c7817 100644 --- a/taichi/analysis/gather_statements.cpp +++ b/taichi/analysis/gather_statements.cpp @@ -37,4 +37,4 @@ std::vector gather_statements(IRNode *root, } } // namespace irpass::analysis -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/analysis/gather_uniquely_accessed_pointers.cpp b/taichi/analysis/gather_uniquely_accessed_pointers.cpp index 452def7143638..af258286c505f 100644 --- a/taichi/analysis/gather_uniquely_accessed_pointers.cpp +++ b/taichi/analysis/gather_uniquely_accessed_pointers.cpp @@ -385,4 +385,4 @@ void gather_uniquely_accessed_bit_structs(IRNode *root, AnalysisManager *amgr) { } } // namespace irpass::analysis -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/analysis/gather_uniquely_accessed_pointers.h b/taichi/analysis/gather_uniquely_accessed_pointers.h index 2314a5c5b8ede..489b5ac797f8e 100644 --- a/taichi/analysis/gather_uniquely_accessed_pointers.h +++ b/taichi/analysis/gather_uniquely_accessed_pointers.h @@ -2,8 +2,7 @@ #include "taichi/ir/pass.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class GatherUniquelyAccessedBitStructsPass : public Pass { public: @@ -16,5 +15,4 @@ class GatherUniquelyAccessedBitStructsPass : public Pass { }; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/analysis/gather_used_atomics.cpp b/taichi/analysis/gather_used_atomics.cpp index 268d7908fee87..a37ce4e2623e4 100644 --- a/taichi/analysis/gather_used_atomics.cpp +++ b/taichi/analysis/gather_used_atomics.cpp @@ -49,4 +49,4 @@ std::unique_ptr> gather_used_atomics( } } // namespace irpass::analysis -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/analysis/gen_offline_cache_key.cpp b/taichi/analysis/gen_offline_cache_key.cpp index 5c1dfbef622f6..915fce3850f78 100644 --- a/taichi/analysis/gen_offline_cache_key.cpp +++ b/taichi/analysis/gen_offline_cache_key.cpp @@ -8,8 +8,7 @@ #include "taichi/program/function.h" #include "taichi/program/program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { @@ -656,5 +655,4 @@ void gen_offline_cache_key(Program *prog, IRNode *ast, std::ostream *os) { ASTSerializer::run(prog, ast, os); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/analysis/has_store_or_atomic.cpp b/taichi/analysis/has_store_or_atomic.cpp index 3ba5fb5fdbb62..27cb4c282eb11 100644 --- a/taichi/analysis/has_store_or_atomic.cpp +++ b/taichi/analysis/has_store_or_atomic.cpp @@ -54,4 +54,4 @@ bool has_store_or_atomic(IRNode *root, const std::vector &vars) { } } // namespace irpass::analysis -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/analysis/last_store_or_atomic.cpp b/taichi/analysis/last_store_or_atomic.cpp index fdff536b380f7..63c444bf20c72 100644 --- a/taichi/analysis/last_store_or_atomic.cpp +++ b/taichi/analysis/last_store_or_atomic.cpp @@ -121,4 +121,4 @@ std::pair last_store_or_atomic(IRNode *root, Stmt *var) { } } // namespace irpass::analysis -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/analysis/mesh_bls_analyzer.cpp b/taichi/analysis/mesh_bls_analyzer.cpp index 91ebc35b48da1..e9e461ec35ef5 100644 --- a/taichi/analysis/mesh_bls_analyzer.cpp +++ b/taichi/analysis/mesh_bls_analyzer.cpp @@ -3,8 +3,7 @@ #include "taichi/system/profiler.h" #include "taichi/ir/analysis.h" -namespace taichi { -namespace lang { +namespace taichi::lang { MeshBLSAnalyzer::MeshBLSAnalyzer(OffloadedStmt *for_stmt, MeshBLSCaches *caches, @@ -113,5 +112,4 @@ std::unique_ptr initialize_mesh_local_attribute( } // namespace analysis } // namespace irpass -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/analysis/mesh_bls_analyzer.h b/taichi/analysis/mesh_bls_analyzer.h index f8db1c3d2b9ba..d77b29500f666 100644 --- a/taichi/analysis/mesh_bls_analyzer.h +++ b/taichi/analysis/mesh_bls_analyzer.h @@ -7,8 +7,7 @@ #include -namespace taichi { -namespace lang { +namespace taichi::lang { class MeshBLSCache { public: @@ -154,5 +153,4 @@ class MeshBLSAnalyzer : public BasicStmtVisitor { CompileConfig config_; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/analysis/offline_cache_util.cpp b/taichi/analysis/offline_cache_util.cpp index ee41a3973784d..a39d4238e208d 100644 --- a/taichi/analysis/offline_cache_util.cpp +++ b/taichi/analysis/offline_cache_util.cpp @@ -11,8 +11,7 @@ #include -namespace taichi { -namespace lang { +namespace taichi::lang { static std::vector get_offline_cache_key_of_compile_config( CompileConfig *config) { @@ -256,5 +255,4 @@ bool try_demangle_name(const std::string &mangled_name, } // namespace offline_cache -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/analysis/offline_cache_util.h b/taichi/analysis/offline_cache_util.h index 98a0c0d9f4f0a..1d13dd715261e 100644 --- a/taichi/analysis/offline_cache_util.h +++ b/taichi/analysis/offline_cache_util.h @@ -4,8 +4,7 @@ #include "taichi/rhi/arch.h" -namespace taichi { -namespace lang { +namespace taichi::lang { struct CompileConfig; class Program; @@ -28,5 +27,4 @@ bool try_demangle_name(const std::string &mangled_name, } // namespace offline_cache -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/analysis/same_statements.cpp b/taichi/analysis/same_statements.cpp index fcf29d49649ce..7fe6e1d557882 100644 --- a/taichi/analysis/same_statements.cpp +++ b/taichi/analysis/same_statements.cpp @@ -333,4 +333,4 @@ bool same_value(Stmt *stmt1, } } // namespace irpass::analysis -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/analysis/value_diff.cpp b/taichi/analysis/value_diff.cpp index c769895077a98..b8357cf69d2dc 100644 --- a/taichi/analysis/value_diff.cpp +++ b/taichi/analysis/value_diff.cpp @@ -5,8 +5,7 @@ #include "taichi/ir/statements.h" #include "taichi/ir/visitors.h" -namespace taichi { -namespace lang { +namespace taichi::lang { DiffRange operator+(const DiffRange &a, const DiffRange &b) { return DiffRange(a.related() && b.related(), a.coeff + b.coeff, a.low + b.low, @@ -202,5 +201,4 @@ DiffPtrResult value_diff_ptr_index(Stmt *val1, Stmt *val2) { } // namespace analysis } // namespace irpass -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/analysis/verify.cpp b/taichi/analysis/verify.cpp index d28f9965d782e..684710b678efd 100644 --- a/taichi/analysis/verify.cpp +++ b/taichi/analysis/verify.cpp @@ -150,4 +150,4 @@ void verify(IRNode *root) { } } // namespace irpass::analysis -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/aot/graph_data.cpp b/taichi/aot/graph_data.cpp index 47703f717c8e4..9d702bf08ad31 100644 --- a/taichi/aot/graph_data.cpp +++ b/taichi/aot/graph_data.cpp @@ -4,8 +4,7 @@ #include -namespace taichi { -namespace lang { +namespace taichi::lang { namespace aot { void CompiledGraph::run( @@ -81,5 +80,4 @@ void CompiledGraph::run( } } } // namespace aot -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/aot/graph_data.h b/taichi/aot/graph_data.h index 5f57a23ccc933..0ee1d18cd7028 100644 --- a/taichi/aot/graph_data.h +++ b/taichi/aot/graph_data.h @@ -11,8 +11,7 @@ template T taichi_union_cast_with_different_sizes(G g); -namespace taichi { -namespace lang { +namespace taichi::lang { class AotModuleBuilder; class Ndarray; class Texture; @@ -165,5 +164,4 @@ struct TI_DLL_EXPORT CompiledGraph { }; } // namespace aot -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/aot/module_builder.cpp b/taichi/aot/module_builder.cpp index 9c1a8a71fda0d..bdb5e53ef4b00 100644 --- a/taichi/aot/module_builder.cpp +++ b/taichi/aot/module_builder.cpp @@ -1,8 +1,7 @@ #include "taichi/aot/module_builder.h" #include "taichi/program/kernel.h" -namespace taichi { -namespace lang { +namespace taichi::lang { void AotModuleBuilder::add(const std::string &identifier, Kernel *kernel) { add_per_backend(identifier, kernel); @@ -62,5 +61,4 @@ void AotModuleBuilder::add_graph(const std::string &name, } graphs_[name] = graph; } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/aot/module_builder.h b/taichi/aot/module_builder.h index 6e44856444004..f9eb09ae7bd3e 100644 --- a/taichi/aot/module_builder.h +++ b/taichi/aot/module_builder.h @@ -9,8 +9,7 @@ #include "taichi/aot/module_data.h" #include "taichi/aot/graph_data.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class Kernel; class DataType; @@ -83,5 +82,4 @@ class AotModuleBuilder { std::unordered_map graphs_; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/aot/module_data.h b/taichi/aot/module_data.h index 824de73fe6283..af15d3a249ae1 100644 --- a/taichi/aot/module_data.h +++ b/taichi/aot/module_data.h @@ -7,8 +7,7 @@ #include "taichi/common/core.h" #include "taichi/common/serialization.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace aot { struct CompiledFieldData { @@ -135,5 +134,4 @@ struct ModuleData { }; } // namespace aot -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/aot/module_loader.cpp b/taichi/aot/module_loader.cpp index 7a611bd257eee..b321defffc39c 100644 --- a/taichi/aot/module_loader.cpp +++ b/taichi/aot/module_loader.cpp @@ -3,8 +3,7 @@ #include "taichi/runtime/gfx/aot_module_loader_impl.h" #include "taichi/runtime/metal/aot_module_loader_impl.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace aot { namespace { @@ -84,5 +83,4 @@ Field *Module::get_snode_tree(const std::string &name) { } } // namespace aot -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/aot/module_loader.h b/taichi/aot/module_loader.h index 3ffe0d1a41842..ec60f4cb63abe 100644 --- a/taichi/aot/module_loader.h +++ b/taichi/aot/module_loader.h @@ -12,8 +12,7 @@ #include "taichi/ir/snode.h" #include "taichi/aot/graph_data.h" -namespace taichi { -namespace lang { +namespace taichi::lang { struct RuntimeContext; class Graph; @@ -166,5 +165,4 @@ class TargetDevice : public Device { }; } // namespace aot -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/cache/gfx/cache_manager.cpp b/taichi/cache/gfx/cache_manager.cpp index f3284cee0f0c9..174798ee5ae26 100644 --- a/taichi/cache/gfx/cache_manager.cpp +++ b/taichi/cache/gfx/cache_manager.cpp @@ -9,8 +9,7 @@ #include "taichi/util/lock.h" #include "taichi/util/offline_cache.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { @@ -286,5 +285,4 @@ std::string CacheManager::make_kernel_key(CompileConfig *config, } } // namespace gfx -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/cache/gfx/cache_manager.h b/taichi/cache/gfx/cache_manager.h index b99e2f888e05c..bf81855ad88cd 100644 --- a/taichi/cache/gfx/cache_manager.h +++ b/taichi/cache/gfx/cache_manager.h @@ -5,8 +5,7 @@ #include "taichi/runtime/gfx/runtime.h" #include "taichi/util/offline_cache.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace gfx { class CacheManager { @@ -51,5 +50,4 @@ class CacheManager { }; } // namespace gfx -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/cc/cc_kernel.h b/taichi/codegen/cc/cc_kernel.h index b683195a7da06..e333e9451a50e 100644 --- a/taichi/codegen/cc/cc_kernel.h +++ b/taichi/codegen/cc/cc_kernel.h @@ -41,4 +41,4 @@ class CCKernel { }; } // namespace cccp -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/codegen/cc/cc_layout.h b/taichi/codegen/cc/cc_layout.h index c0494179daba8..37560e2f1b344 100644 --- a/taichi/codegen/cc/cc_layout.h +++ b/taichi/codegen/cc/cc_layout.h @@ -28,4 +28,4 @@ class CCLayout { }; } // namespace cccp -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/codegen/cc/cc_program.cpp b/taichi/codegen/cc/cc_program.cpp index e34f2d29f4cd6..9a923d0405788 100644 --- a/taichi/codegen/cc/cc_program.cpp +++ b/taichi/codegen/cc/cc_program.cpp @@ -197,4 +197,4 @@ bool is_c_backend_available() { } }; // namespace cccp -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/codegen/cc/cc_program.h b/taichi/codegen/cc/cc_program.h index 4ca662ef1eb9d..7c5e9c699836d 100644 --- a/taichi/codegen/cc/cc_program.h +++ b/taichi/codegen/cc/cc_program.h @@ -18,7 +18,7 @@ namespace taichi { class DynamicLoader; -} // namespace taichi +} // namespace taichi namespace taichi::lang { @@ -88,4 +88,4 @@ class CCProgramImpl : public ProgramImpl { uint64 *result_buffer_{nullptr}; bool need_relink_{true}; }; -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/codegen/cc/cc_runtime.h b/taichi/codegen/cc/cc_runtime.h index ab4a88155ecfe..bb75155ad432f 100644 --- a/taichi/codegen/cc/cc_runtime.h +++ b/taichi/codegen/cc/cc_runtime.h @@ -31,4 +31,4 @@ class CCRuntime { }; } // namespace cccp -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/codegen/cc/cc_utils.h b/taichi/codegen/cc/cc_utils.h index e5ed5f9755be9..9e8b15d4c0bf4 100644 --- a/taichi/codegen/cc/cc_utils.h +++ b/taichi/codegen/cc/cc_utils.h @@ -82,4 +82,4 @@ inline int execute(std::string fmt, Args &&...args) { } } // namespace cccp -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/codegen/cc/codegen_cc.cpp b/taichi/codegen/cc/codegen_cc.cpp index 5f76cb103f698..b86b3034473db 100644 --- a/taichi/codegen/cc/codegen_cc.cpp +++ b/taichi/codegen/cc/codegen_cc.cpp @@ -605,4 +605,4 @@ std::unique_ptr CCKernelGen::compile() { } } // namespace cccp -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/codegen/cc/codegen_cc.h b/taichi/codegen/cc/codegen_cc.h index c10654c223be8..d537e95e20215 100644 --- a/taichi/codegen/cc/codegen_cc.h +++ b/taichi/codegen/cc/codegen_cc.h @@ -28,4 +28,4 @@ class CCKernelGen { FunctionType compile_kernel(Kernel *kernel); } // namespace cccp -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/codegen/cc/context.h b/taichi/codegen/cc/context.h index 1bcdf7a863d71..0f44fa7c4ba3c 100644 --- a/taichi/codegen/cc/context.h +++ b/taichi/codegen/cc/context.h @@ -56,6 +56,6 @@ struct CCContext { }; // namespace cccp -} // namespace taichi::lang +} // namespace taichi::lang #endif // _CC_INSIDE_KERNEL diff --git a/taichi/codegen/cc/struct_cc.cpp b/taichi/codegen/cc/struct_cc.cpp index 22e4b223732a7..83e1ebea24487 100644 --- a/taichi/codegen/cc/struct_cc.cpp +++ b/taichi/codegen/cc/struct_cc.cpp @@ -47,4 +47,4 @@ std::unique_ptr CCLayoutGen::compile() { } } // namespace cccp -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/codegen/cc/struct_cc.h b/taichi/codegen/cc/struct_cc.h index b92e331baf8fa..2d0c59d6567e0 100644 --- a/taichi/codegen/cc/struct_cc.h +++ b/taichi/codegen/cc/struct_cc.h @@ -36,4 +36,4 @@ class CCLayoutGen { }; } // namespace cccp -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/codegen/codegen.cpp b/taichi/codegen/codegen.cpp index d94cbc9c65fed..674cdd18d21ad 100644 --- a/taichi/codegen/codegen.cpp +++ b/taichi/codegen/codegen.cpp @@ -152,4 +152,4 @@ FunctionType ModuleToFunctionConverter::convert(const Kernel *kernel, } #endif -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/codegen/codegen.h b/taichi/codegen/codegen.h index 704b6fd8a5747..9b72b1c99c5db 100644 --- a/taichi/codegen/codegen.h +++ b/taichi/codegen/codegen.h @@ -68,4 +68,4 @@ class ModuleToFunctionConverter { }; #endif -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/codegen/cpu/codegen_cpu.cpp b/taichi/codegen/cpu/codegen_cpu.cpp index ae4f1d2139694..d7eae9508a7a2 100644 --- a/taichi/codegen/cpu/codegen_cpu.cpp +++ b/taichi/codegen/cpu/codegen_cpu.cpp @@ -290,4 +290,4 @@ FunctionType KernelCodeGenCPU::compile_to_function() { tlctx, get_llvm_program(prog)->get_runtime_executor()); return converter.convert(kernel, compile_kernel_to_module()); } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/codegen/cpu/codegen_cpu.h b/taichi/codegen/cpu/codegen_cpu.h index 34b8e84687363..14706ec6d9960 100644 --- a/taichi/codegen/cpu/codegen_cpu.h +++ b/taichi/codegen/cpu/codegen_cpu.h @@ -50,4 +50,4 @@ class CPUModuleToFunctionConverter : public ModuleToFunctionConverter { #endif -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/codegen/cuda/codegen_cuda.cpp b/taichi/codegen/cuda/codegen_cuda.cpp index bfad0612d001d..5265479aa9e8a 100644 --- a/taichi/codegen/cuda/codegen_cuda.cpp +++ b/taichi/codegen/cuda/codegen_cuda.cpp @@ -841,4 +841,4 @@ FunctionType CUDAModuleToFunctionConverter::convert( #endif // TI_WITH_CUDA } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/codegen/cuda/codegen_cuda.h b/taichi/codegen/cuda/codegen_cuda.h index 50a578172cedf..c3dd73413cad4 100644 --- a/taichi/codegen/cuda/codegen_cuda.h +++ b/taichi/codegen/cuda/codegen_cuda.h @@ -42,4 +42,4 @@ class CUDAModuleToFunctionConverter : public ModuleToFunctionConverter { LLVMCompiledKernel data) const override; }; -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/codegen/dx12/codegen_dx12.cpp b/taichi/codegen/dx12/codegen_dx12.cpp index 5a2145228f705..be32c17c5c15f 100644 --- a/taichi/codegen/dx12/codegen_dx12.cpp +++ b/taichi/codegen/dx12/codegen_dx12.cpp @@ -283,4 +283,4 @@ FunctionType KernelCodeGenDX12::compile_to_function() { // FIXME: implement compile_to_function. return [](RuntimeContext &ctx) {}; } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/codegen/dx12/codegen_dx12.h b/taichi/codegen/dx12/codegen_dx12.h index 52ae749a92c80..740a55e13b9e0 100644 --- a/taichi/codegen/dx12/codegen_dx12.h +++ b/taichi/codegen/dx12/codegen_dx12.h @@ -29,4 +29,4 @@ class KernelCodeGenDX12 : public KernelCodeGen { FunctionType compile_to_function() override; }; -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/codegen/dx12/dx12_global_optimize_module.cpp b/taichi/codegen/dx12/dx12_global_optimize_module.cpp index 316a295d5aea6..ad45b2d3e5ae4 100644 --- a/taichi/codegen/dx12/dx12_global_optimize_module.cpp +++ b/taichi/codegen/dx12/dx12_global_optimize_module.cpp @@ -35,8 +35,7 @@ using namespace llvm; -namespace taichi { -namespace lang { +namespace taichi::lang { namespace directx12 { const char *NumWorkGroupsCBName = "num_work_groups.cbuf"; @@ -167,5 +166,4 @@ std::vector global_optimize_module(llvm::Module *module, } } // namespace directx12 -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/dx12/dx12_llvm_passes.h b/taichi/codegen/dx12/dx12_llvm_passes.h index 2821cead303d3..0da5b3e36a497 100644 --- a/taichi/codegen/dx12/dx12_llvm_passes.h +++ b/taichi/codegen/dx12/dx12_llvm_passes.h @@ -11,8 +11,7 @@ class Type; class GlobalVariable; } // namespace llvm -namespace taichi { -namespace lang { +namespace taichi::lang { struct CompileConfig; namespace directx12 { @@ -30,8 +29,7 @@ std::vector global_optimize_module(llvm::Module *module, extern const char *NumWorkGroupsCBName; } // namespace directx12 -} // namespace lang -} // namespace taichi +} // namespace taichi::lang namespace llvm { class ModulePass; diff --git a/taichi/codegen/llvm/codegen_llvm.cpp b/taichi/codegen/llvm/codegen_llvm.cpp index 65a27b0db63ea..421ddb9552449 100644 --- a/taichi/codegen/llvm/codegen_llvm.cpp +++ b/taichi/codegen/llvm/codegen_llvm.cpp @@ -2750,6 +2750,6 @@ LLVMCompiledKernel LLVMCompiledKernel::clone() const { return {tasks, llvm::CloneModule(*module)}; } -} // namespace taichi::lang +} // namespace taichi::lang #endif // #ifdef TI_WITH_LLVM diff --git a/taichi/codegen/llvm/codegen_llvm.h b/taichi/codegen/llvm/codegen_llvm.h index a02fcbb2c81e6..c783c8c58cbeb 100644 --- a/taichi/codegen/llvm/codegen_llvm.h +++ b/taichi/codegen/llvm/codegen_llvm.h @@ -12,8 +12,7 @@ #include "taichi/codegen/llvm/llvm_compiled_data.h" #include "taichi/program/program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class TaskCodeGenLLVM; @@ -396,7 +395,6 @@ class TaskCodeGenLLVM : public IRVisitor, public LLVMModuleBuilder { ~TaskCodeGenLLVM() override = default; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang #endif // #ifdef TI_WITH_LLVM diff --git a/taichi/codegen/llvm/codegen_llvm_quant.cpp b/taichi/codegen/llvm/codegen_llvm_quant.cpp index ace26c8bf1a11..a5c425ccaa950 100644 --- a/taichi/codegen/llvm/codegen_llvm_quant.cpp +++ b/taichi/codegen/llvm/codegen_llvm_quant.cpp @@ -591,6 +591,6 @@ llvm::Value *TaskCodeGenLLVM::reconstruct_quant_float( } } -} // namespace taichi::lang +} // namespace taichi::lang #endif // #ifdef TI_WITH_LLVM diff --git a/taichi/codegen/llvm/llvm_codegen_utils.cpp b/taichi/codegen/llvm/llvm_codegen_utils.cpp index 4ce6cff4a5b9f..99a06c403e61f 100644 --- a/taichi/codegen/llvm/llvm_codegen_utils.cpp +++ b/taichi/codegen/llvm/llvm_codegen_utils.cpp @@ -1,7 +1,6 @@ #include "llvm_codegen_utils.h" -namespace taichi { -namespace lang { +namespace taichi::lang { std::string type_name(llvm::Type *type) { std::string type_name_str; @@ -145,5 +144,4 @@ void check_func_call_signature(llvm::FunctionType *func_type, } } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/llvm/llvm_codegen_utils.h b/taichi/codegen/llvm/llvm_codegen_utils.h index 2c4cd6dfa2d8c..7a72b32d18131 100644 --- a/taichi/codegen/llvm/llvm_codegen_utils.h +++ b/taichi/codegen/llvm/llvm_codegen_utils.h @@ -36,8 +36,7 @@ #include "taichi/runtime/llvm/llvm_context.h" -namespace taichi { -namespace lang { +namespace taichi::lang { inline constexpr char kLLVMPhysicalCoordinatesName[] = "PhysicalCoordinates"; @@ -187,5 +186,4 @@ class RuntimeObject { } }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/llvm/llvm_compiled_data.h b/taichi/codegen/llvm/llvm_compiled_data.h index ccb3d66e5b8b8..93aaf5fe030a0 100644 --- a/taichi/codegen/llvm/llvm_compiled_data.h +++ b/taichi/codegen/llvm/llvm_compiled_data.h @@ -5,8 +5,7 @@ #include "llvm/IR/Module.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class OffloadedTask { public: @@ -56,5 +55,4 @@ struct LLVMCompiledKernel { TI_IO_DEF(tasks); }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/llvm/struct_llvm.cpp b/taichi/codegen/llvm/struct_llvm.cpp index 62b986541e060..5fc60420bf263 100644 --- a/taichi/codegen/llvm/struct_llvm.cpp +++ b/taichi/codegen/llvm/struct_llvm.cpp @@ -7,8 +7,7 @@ #include "taichi/struct/struct.h" #include "taichi/util/file_sequence_writer.h" -namespace taichi { -namespace lang { +namespace taichi::lang { StructCompilerLLVM::StructCompilerLLVM(Arch arch, const CompileConfig *config, @@ -340,5 +339,4 @@ llvm::Function *StructCompilerLLVM::create_function(llvm::FunctionType *ft, *module); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/llvm/struct_llvm.h b/taichi/codegen/llvm/struct_llvm.h index 5b418f8407bd4..381af3ead4173 100644 --- a/taichi/codegen/llvm/struct_llvm.h +++ b/taichi/codegen/llvm/struct_llvm.h @@ -5,8 +5,7 @@ #include "taichi/codegen/llvm/llvm_codegen_utils.h" #include "taichi/struct/struct.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class LlvmProgramImpl; class StructCompilerLLVM : public StructCompiler, public LLVMModuleBuilder { @@ -53,5 +52,4 @@ class StructCompilerLLVM : public StructCompiler, public LLVMModuleBuilder { int snode_tree_id_; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/metal/codegen_metal.cpp b/taichi/codegen/metal/codegen_metal.cpp index b3bab0357fa5d..b14cf49780aaa 100644 --- a/taichi/codegen/metal/codegen_metal.cpp +++ b/taichi/codegen/metal/codegen_metal.cpp @@ -14,8 +14,7 @@ #include "taichi/math/arithmetic.h" #include "taichi/util/line_appender.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace metal { namespace { @@ -1711,5 +1710,4 @@ FunctionType compile_to_metal_executable( } } // namespace metal -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/metal/codegen_metal.h b/taichi/codegen/metal/codegen_metal.h index 373428c26a801..30d5a26b913aa 100644 --- a/taichi/codegen/metal/codegen_metal.h +++ b/taichi/codegen/metal/codegen_metal.h @@ -13,8 +13,7 @@ #include "taichi/runtime/metal/kernel_utils.h" #include "taichi/codegen/metal/struct_metal.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace metal { CompiledKernelData run_codegen( @@ -35,5 +34,4 @@ FunctionType compile_to_metal_executable( OffloadedStmt *offloaded = nullptr); } // namespace metal -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/metal/env_config.cpp b/taichi/codegen/metal/env_config.cpp index 62b95cad778d2..12cd0a15669df 100644 --- a/taichi/codegen/metal/env_config.cpp +++ b/taichi/codegen/metal/env_config.cpp @@ -18,4 +18,4 @@ const EnvConfig &EnvConfig::instance() { } // namespace metal -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/codegen/metal/env_config.h b/taichi/codegen/metal/env_config.h index 6a1b5ff1640ed..ff726ddf0003b 100644 --- a/taichi/codegen/metal/env_config.h +++ b/taichi/codegen/metal/env_config.h @@ -27,4 +27,4 @@ class EnvConfig { } // namespace metal -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/codegen/metal/struct_metal.cpp b/taichi/codegen/metal/struct_metal.cpp index 56d6479e9964b..d583488da4c8d 100644 --- a/taichi/codegen/metal/struct_metal.cpp +++ b/taichi/codegen/metal/struct_metal.cpp @@ -14,8 +14,7 @@ #include "taichi/math/arithmetic.h" #include "taichi/util/line_appender.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace metal { namespace { namespace shaders { @@ -430,5 +429,4 @@ CompiledRuntimeModule compile_runtime_module() { } } // namespace metal -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/metal/struct_metal.h b/taichi/codegen/metal/struct_metal.h index 5d4e0e1bebc2e..06170e756eb17 100644 --- a/taichi/codegen/metal/struct_metal.h +++ b/taichi/codegen/metal/struct_metal.h @@ -5,8 +5,7 @@ #include "taichi/ir/snode.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace metal { struct SNodeDescriptor { @@ -93,5 +92,4 @@ struct CompiledRuntimeModule { CompiledRuntimeModule compile_runtime_module(); } // namespace metal -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/spirv/kernel_utils.cpp b/taichi/codegen/spirv/kernel_utils.cpp index e7ad964dd8836..4a8ca257de198 100644 --- a/taichi/codegen/spirv/kernel_utils.cpp +++ b/taichi/codegen/spirv/kernel_utils.cpp @@ -7,8 +7,7 @@ #include "taichi/program/context.h" #undef TI_RUNTIME_HOST -namespace taichi { -namespace lang { +namespace taichi::lang { namespace spirv { // static @@ -127,5 +126,4 @@ KernelContextAttributes::KernelContextAttributes(const Kernel &kernel, } } // namespace spirv -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/spirv/kernel_utils.h b/taichi/codegen/spirv/kernel_utils.h index 3dd005c8b17a5..99cda22a3cd61 100644 --- a/taichi/codegen/spirv/kernel_utils.h +++ b/taichi/codegen/spirv/kernel_utils.h @@ -9,8 +9,7 @@ #include "taichi/ir/transforms.h" #include "taichi/rhi/device.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class Kernel; class SNode; @@ -274,5 +273,4 @@ struct TaichiKernelAttributes { }; } // namespace spirv -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/spirv/snode_struct_compiler.cpp b/taichi/codegen/spirv/snode_struct_compiler.cpp index 59b889331c5ff..498b76482364e 100644 --- a/taichi/codegen/spirv/snode_struct_compiler.cpp +++ b/taichi/codegen/spirv/snode_struct_compiler.cpp @@ -1,7 +1,6 @@ #include "taichi/codegen/spirv/snode_struct_compiler.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace spirv { namespace { @@ -174,5 +173,4 @@ CompiledSNodeStructs compile_snode_structs(SNode &root) { } } // namespace spirv -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/spirv/snode_struct_compiler.h b/taichi/codegen/spirv/snode_struct_compiler.h index 2109ff5af7052..d2810d2110ed2 100644 --- a/taichi/codegen/spirv/snode_struct_compiler.h +++ b/taichi/codegen/spirv/snode_struct_compiler.h @@ -7,8 +7,7 @@ #include "spirv_types.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace spirv { struct SNodeDescriptor { @@ -60,5 +59,4 @@ struct CompiledSNodeStructs { CompiledSNodeStructs compile_snode_structs(SNode &root); } // namespace spirv -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/spirv/spirv_codegen.cpp b/taichi/codegen/spirv/spirv_codegen.cpp index 2f549e86e943a..08f3cce1459da 100644 --- a/taichi/codegen/spirv/spirv_codegen.cpp +++ b/taichi/codegen/spirv/spirv_codegen.cpp @@ -17,8 +17,7 @@ #include #include -namespace taichi { -namespace lang { +namespace taichi::lang { namespace spirv { namespace { @@ -2365,5 +2364,4 @@ void lower(Kernel *kernel) { } } // namespace spirv -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/spirv/spirv_codegen.h b/taichi/codegen/spirv/spirv_codegen.h index 7a0e42cd8a666..3706918df55f8 100644 --- a/taichi/codegen/spirv/spirv_codegen.h +++ b/taichi/codegen/spirv/spirv_codegen.h @@ -8,8 +8,7 @@ #include #include -namespace taichi { -namespace lang { +namespace taichi::lang { class Kernel; @@ -42,5 +41,4 @@ class KernelCodegen { }; } // namespace spirv -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/spirv/spirv_ir_builder.cpp b/taichi/codegen/spirv/spirv_ir_builder.cpp index 5e0727144c1db..2fa13b459c6b3 100644 --- a/taichi/codegen/spirv/spirv_ir_builder.cpp +++ b/taichi/codegen/spirv/spirv_ir_builder.cpp @@ -1,8 +1,7 @@ #include "taichi/codegen/spirv/spirv_ir_builder.h" #include "taichi/rhi/dx/dx_device.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace spirv { @@ -1556,5 +1555,4 @@ void IRBuilder::init_random_function(Value global_tmp_) { } } // namespace spirv -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/spirv/spirv_ir_builder.h b/taichi/codegen/spirv/spirv_ir_builder.h index 337985bad360b..3f5c280037cf3 100644 --- a/taichi/codegen/spirv/spirv_ir_builder.h +++ b/taichi/codegen/spirv/spirv_ir_builder.h @@ -10,8 +10,7 @@ #include "taichi/rhi/device.h" #include "taichi/ir/statements.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace spirv { template @@ -641,5 +640,4 @@ class IRBuilder { std::vector function_; }; } // namespace spirv -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/spirv/spirv_types.cpp b/taichi/codegen/spirv/spirv_types.cpp index d3830ff720778..cb964d4926d7e 100644 --- a/taichi/codegen/spirv/spirv_types.cpp +++ b/taichi/codegen/spirv/spirv_types.cpp @@ -1,8 +1,7 @@ #include "spirv_types.h" #include "spirv_ir_builder.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace spirv { size_t StructType::memory_size(tinyir::LayoutContext &ctx) const { @@ -473,5 +472,4 @@ std::unordered_map ir_translate_to_spirv( } } // namespace spirv -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/spirv/spirv_types.h b/taichi/codegen/spirv/spirv_types.h index 8870d697f6a55..880eb19555c29 100644 --- a/taichi/codegen/spirv/spirv_types.h +++ b/taichi/codegen/spirv/spirv_types.h @@ -3,8 +3,7 @@ #include "lib_tiny_ir.h" #include "taichi/ir/type.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace spirv { class STD140LayoutContext : public tinyir::LayoutContext {}; @@ -241,5 +240,4 @@ std::unordered_map ir_translate_to_spirv( IRBuilder *spir_builder); } // namespace spirv -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/wasm/codegen_wasm.cpp b/taichi/codegen/wasm/codegen_wasm.cpp index e9bce4571641c..f1474f82c1a63 100644 --- a/taichi/codegen/wasm/codegen_wasm.cpp +++ b/taichi/codegen/wasm/codegen_wasm.cpp @@ -11,8 +11,7 @@ #include "taichi/util/file_sequence_writer.h" #include "taichi/runtime/program_impls/llvm/llvm_program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { constexpr std::array kPreloadedFuncNames = { @@ -292,5 +291,4 @@ LLVMCompiledKernel KernelCodeGenWASM::compile_kernel_to_module() { return tlctx->link_compiled_tasks(std::move(data)); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/codegen/wasm/codegen_wasm.h b/taichi/codegen/wasm/codegen_wasm.h index f5e076dca5da2..31d195fc89753 100644 --- a/taichi/codegen/wasm/codegen_wasm.h +++ b/taichi/codegen/wasm/codegen_wasm.h @@ -8,8 +8,7 @@ #include "llvm/IR/Module.h" #endif -namespace taichi { -namespace lang { +namespace taichi::lang { class KernelCodeGenWASM : public KernelCodeGen { public: @@ -28,5 +27,4 @@ class KernelCodeGenWASM : public KernelCodeGen { #endif }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/common/core.cpp b/taichi/common/core.cpp index 3a11c407029cf..2f18f5a8309bd 100644 --- a/taichi/common/core.cpp +++ b/taichi/common/core.cpp @@ -105,4 +105,4 @@ int PID::get_parent_pid() { #endif } -} // namespace taichi +} // namespace taichi diff --git a/taichi/common/core.h b/taichi/common/core.h index 77bd2b44c580d..93d806b1d4ea2 100644 --- a/taichi/common/core.h +++ b/taichi/common/core.h @@ -201,7 +201,7 @@ float64 constexpr operator"" _fd(unsigned long long v) { return float64(v); } -} // namespace taichi +} // namespace taichi //****************************************************************************** // Meta-programming //****************************************************************************** @@ -266,7 +266,7 @@ inline bool starts_with(std::string const &str, std::string const &ending) { return std::equal(ending.begin(), ending.end(), str.begin()); } -} // namespace taichi +} // namespace taichi //****************************************************************************** // Serialization @@ -332,4 +332,4 @@ class PID { static int get_parent_pid(); }; -} // namespace taichi +} // namespace taichi diff --git a/taichi/common/dict.h b/taichi/common/dict.h index 0d94e543874f5..1cf63d376224b 100644 --- a/taichi/common/dict.h +++ b/taichi/common/dict.h @@ -354,4 +354,4 @@ inline bool Dict::get(std::string key) const { using Config = Dict; -} // namespace taichi +} // namespace taichi diff --git a/taichi/common/exceptions.h b/taichi/common/exceptions.h index ec7f65c3368ce..ace90e9b075cc 100644 --- a/taichi/common/exceptions.h +++ b/taichi/common/exceptions.h @@ -1,7 +1,6 @@ #pragma once -namespace taichi { -namespace lang { +namespace taichi::lang { class IRModified {}; @@ -32,5 +31,4 @@ class TaichiAssertionError : public TaichiExceptionImpl { using TaichiExceptionImpl::TaichiExceptionImpl; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/common/interface.h b/taichi/common/interface.h index 3e4c793b2598f..098863c79fe7c 100644 --- a/taichi/common/interface.h +++ b/taichi/common/interface.h @@ -333,4 +333,4 @@ class InterfaceHolder { return alias; \ } -} // namespace taichi +} // namespace taichi diff --git a/taichi/common/serialization.h b/taichi/common/serialization.h index 1253bcc60592d..86d043a04b311 100644 --- a/taichi/common/serialization.h +++ b/taichi/common/serialization.h @@ -932,5 +932,5 @@ static_assert( ""); #ifdef TI_INCLUDED -} // namespace taichi +} // namespace taichi #endif \ No newline at end of file diff --git a/taichi/common/task.h b/taichi/common/task.h index f809a9ea7af76..9ddd9d1655956 100644 --- a/taichi/common/task.h +++ b/taichi/common/task.h @@ -75,4 +75,4 @@ task_invoke(const T &func, const std::vector ¶ms) { }; \ TI_IMPLEMENTATION(Task, Task_##task, #task) -} // namespace taichi +} // namespace taichi diff --git a/taichi/ir/analysis.h b/taichi/ir/analysis.h index 0b4ea3df62639..fcb3a9038ca7d 100644 --- a/taichi/ir/analysis.h +++ b/taichi/ir/analysis.h @@ -10,8 +10,7 @@ #include #include -namespace taichi { -namespace lang { +namespace taichi::lang { class DiffRange { private: @@ -211,5 +210,4 @@ std::unique_ptr initialize_mesh_local_attribute( } // namespace analysis } // namespace irpass -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/ir/basic_stmt_visitor.cpp b/taichi/ir/basic_stmt_visitor.cpp index 7fe6e653b906a..71a33b051bfef 100644 --- a/taichi/ir/basic_stmt_visitor.cpp +++ b/taichi/ir/basic_stmt_visitor.cpp @@ -68,4 +68,4 @@ void BasicStmtVisitor::visit(FrontendIfStmt *stmt) { stmt->false_statements->accept(this); } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/ir/control_flow_graph.cpp b/taichi/ir/control_flow_graph.cpp index 74f6e4311641f..ec15a17d6bf54 100644 --- a/taichi/ir/control_flow_graph.cpp +++ b/taichi/ir/control_flow_graph.cpp @@ -7,8 +7,7 @@ #include "taichi/ir/statements.h" #include "taichi/system/profiler.h" -namespace taichi { -namespace lang { +namespace taichi::lang { CFGNode::CFGNode(Block *block, int begin_location, @@ -1026,5 +1025,4 @@ void ControlFlowGraph::determine_ad_stack_size(int default_ad_stack_size) { } } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/ir/control_flow_graph.h b/taichi/ir/control_flow_graph.h index 1776a57ea4eea..d02f682b36e3c 100644 --- a/taichi/ir/control_flow_graph.h +++ b/taichi/ir/control_flow_graph.h @@ -5,8 +5,7 @@ #include "taichi/ir/ir.h" -namespace taichi { -namespace lang { +namespace taichi::lang { /** * A basic block in control-flow graph. @@ -168,5 +167,4 @@ class ControlFlowGraph { void determine_ad_stack_size(int default_ad_stack_size); }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/ir/expr.cpp b/taichi/ir/expr.cpp index 1a3fd869cf071..74e7c6f1d69ac 100644 --- a/taichi/ir/expr.cpp +++ b/taichi/ir/expr.cpp @@ -120,4 +120,4 @@ Expr expr_matrix_field(const std::vector &fields, return Expr::make(fields, element_shape); } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/ir/expr.h b/taichi/ir/expr.h index 43548064d7d26..c692e634c832d 100644 --- a/taichi/ir/expr.h +++ b/taichi/ir/expr.h @@ -149,4 +149,4 @@ Expr expr_field(Expr id_expr, DataType dt); Expr expr_matrix_field(const std::vector &fields, const std::vector &element_shape); -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/ir/expression.h b/taichi/ir/expression.h index 13fb9d4fea823..821ec3adfa6b3 100644 --- a/taichi/ir/expression.h +++ b/taichi/ir/expression.h @@ -162,4 +162,4 @@ class ExpressionVisitor { visitor->visit(this); \ } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/ir/expression_ops.h b/taichi/ir/expression_ops.h index c939a520ac972..845c86cb6b0a7 100644 --- a/taichi/ir/expression_ops.h +++ b/taichi/ir/expression_ops.h @@ -73,8 +73,7 @@ #endif -namespace taichi { -namespace lang { +namespace taichi::lang { DEFINE_EXPRESSION_FUNC_UNARY(sqrt) DEFINE_EXPRESSION_FUNC_UNARY(round) @@ -126,8 +125,7 @@ DEFINE_EXPRESSION_FUNC_BINARY(bit_shr) DEFINE_EXPRESSION_FUNC_TERNARY(select) DEFINE_EXPRESSION_FUNC_TERNARY(ifte) -} // namespace lang -} // namespace taichi +} // namespace taichi::lang #undef DEFINE_EXPRESSION_OP_UNARY #undef DEFINE_EXPRESSION_OP_BINARY diff --git a/taichi/ir/expression_printer.h b/taichi/ir/expression_printer.h index c0f595efc0f95..93cec54c6f882 100644 --- a/taichi/ir/expression_printer.h +++ b/taichi/ir/expression_printer.h @@ -6,8 +6,7 @@ #include "taichi/program/program.h" #include "taichi/analysis/offline_cache_util.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class ExpressionPrinter : public ExpressionVisitor { public: @@ -286,5 +285,4 @@ class ExpressionHumanFriendlyPrinter : public ExpressionPrinter { } }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/ir/frontend_ir.cpp b/taichi/ir/frontend_ir.cpp index 2b95e76e410ae..55800d2b2d8b0 100644 --- a/taichi/ir/frontend_ir.cpp +++ b/taichi/ir/frontend_ir.cpp @@ -1308,4 +1308,4 @@ void flatten_rvalue(Expr ptr, Expression::FlattenContext *ctx) { } } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/ir/frontend_ir.h b/taichi/ir/frontend_ir.h index d362f6e8a963c..e61f29c255135 100644 --- a/taichi/ir/frontend_ir.h +++ b/taichi/ir/frontend_ir.h @@ -1041,4 +1041,4 @@ void flatten_lvalue(Expr expr, Expression::FlattenContext *ctx); void flatten_rvalue(Expr expr, Expression::FlattenContext *ctx); -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/ir/ir.cpp b/taichi/ir/ir.cpp index 73c546000593c..089e29b94d307 100644 --- a/taichi/ir/ir.cpp +++ b/taichi/ir/ir.cpp @@ -8,8 +8,7 @@ #include "taichi/ir/statements.h" #include "taichi/ir/transforms.h" -namespace taichi { -namespace lang { +namespace taichi::lang { std::string snode_access_flag_name(SNodeAccessFlag type) { if (type == SNodeAccessFlag::block_local) { @@ -496,5 +495,4 @@ void DelayedIRModifier::mark_as_modified() { modified_ = true; } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/ir/ir.h b/taichi/ir/ir.h index f52ed955d5193..6de386155be8c 100644 --- a/taichi/ir/ir.h +++ b/taichi/ir/ir.h @@ -20,8 +20,7 @@ #include "llvm/ADT/MapVector.h" #endif -namespace taichi { -namespace lang { +namespace taichi::lang { class IRNode; class Block; @@ -605,5 +604,4 @@ inline void StmtFieldManager::operator()(const char *key, T &&value) { } } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/ir/ir_builder.cpp b/taichi/ir/ir_builder.cpp index de40919d99d20..59a66838dd663 100644 --- a/taichi/ir/ir_builder.cpp +++ b/taichi/ir/ir_builder.cpp @@ -484,4 +484,4 @@ MeshPatchIndexStmt *IRBuilder::get_patch_index() { return insert(Stmt::make_typed()); } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/ir/ir_builder.h b/taichi/ir/ir_builder.h index 01eceb685b341..41a52a285ff41 100644 --- a/taichi/ir/ir_builder.h +++ b/taichi/ir/ir_builder.h @@ -286,4 +286,4 @@ class IRBuilder { InsertPoint insert_point_; }; -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/ir/mesh.cpp b/taichi/ir/mesh.cpp index 9219c84c4da4a..4e14011f1362e 100644 --- a/taichi/ir/mesh.cpp +++ b/taichi/ir/mesh.cpp @@ -1,7 +1,6 @@ #include "taichi/ir/mesh.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace mesh { std::string element_type_name(MeshElementType type) { @@ -57,5 +56,4 @@ MeshRelationType inverse_relation(MeshRelationType rel) { } } // namespace mesh -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/ir/mesh.h b/taichi/ir/mesh.h index cbae90c7d94cf..2393c6d941225 100644 --- a/taichi/ir/mesh.h +++ b/taichi/ir/mesh.h @@ -8,8 +8,7 @@ #include -namespace taichi { -namespace lang { +namespace taichi::lang { class Stmt; @@ -93,5 +92,4 @@ struct MeshPtr { // Mesh wrapper in python }; } // namespace mesh -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/ir/offloaded_task_type.cpp b/taichi/ir/offloaded_task_type.cpp index 22fcd6afd7c01..164f7f0a07a76 100644 --- a/taichi/ir/offloaded_task_type.cpp +++ b/taichi/ir/offloaded_task_type.cpp @@ -12,4 +12,4 @@ std::string offloaded_task_type_name(OffloadedTaskType tt) { TI_NOT_IMPLEMENTED } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/ir/offloaded_task_type.h b/taichi/ir/offloaded_task_type.h index 673a8164c2087..b79716e174320 100644 --- a/taichi/ir/offloaded_task_type.h +++ b/taichi/ir/offloaded_task_type.h @@ -4,8 +4,7 @@ #include -namespace taichi { -namespace lang { +namespace taichi::lang { enum class OffloadedTaskType : int { #define PER_TASK_TYPE(x) x, @@ -15,5 +14,4 @@ enum class OffloadedTaskType : int { std::string offloaded_task_type_name(OffloadedTaskType tt); -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/ir/pass.cpp b/taichi/ir/pass.cpp index 7f01501fe5d7f..55e2844085d6c 100644 --- a/taichi/ir/pass.cpp +++ b/taichi/ir/pass.cpp @@ -1,9 +1,7 @@ #include "taichi/ir/pass.h" -namespace taichi { -namespace lang { +namespace taichi::lang { const PassID Pass::id = "undefined"; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/ir/pass.h b/taichi/ir/pass.h index 734de1e321870..e9f3e0902e0bb 100644 --- a/taichi/ir/pass.h +++ b/taichi/ir/pass.h @@ -7,8 +7,7 @@ #include #include -namespace taichi { -namespace lang { +namespace taichi::lang { using PassID = std::string; @@ -85,5 +84,4 @@ class AnalysisManager { std::unordered_map> result_; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/ir/scratch_pad.cpp b/taichi/ir/scratch_pad.cpp index ace3ffee6e953..9484671cb4a47 100644 --- a/taichi/ir/scratch_pad.cpp +++ b/taichi/ir/scratch_pad.cpp @@ -19,4 +19,4 @@ std::string ScratchPad::global_to_linearized_local( return ret; } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/ir/scratch_pad.h b/taichi/ir/scratch_pad.h index 4d3e3ab215e9f..09a9c13282e10 100644 --- a/taichi/ir/scratch_pad.h +++ b/taichi/ir/scratch_pad.h @@ -258,4 +258,4 @@ class ScratchPads { } }; -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/ir/snode.cpp b/taichi/ir/snode.cpp index 09e18e9a00a61..6a4fe1f3890f0 100644 --- a/taichi/ir/snode.cpp +++ b/taichi/ir/snode.cpp @@ -361,4 +361,4 @@ int SNode::get_snode_tree_id() const { return snode_tree_id_; } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/ir/snode.h b/taichi/ir/snode.h index 1c646802b1be2..4c9ba69f53730 100644 --- a/taichi/ir/snode.h +++ b/taichi/ir/snode.h @@ -8,8 +8,7 @@ #include "taichi/ir/type.h" #include "taichi/program/snode_expr_utils.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class Program; class SNodeRwAccessorsBank; @@ -364,5 +363,4 @@ class SNode { SNodeRwAccessorsBank *snode_rw_accessors_bank_{nullptr}; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/ir/snode_types.cpp b/taichi/ir/snode_types.cpp index 974c81df55dc5..829d6dc7a5caf 100644 --- a/taichi/ir/snode_types.cpp +++ b/taichi/ir/snode_types.cpp @@ -2,8 +2,7 @@ #include "taichi/common/logging.h" -namespace taichi { -namespace lang { +namespace taichi::lang { std::string snode_type_name(SNodeType t) { switch (t) { @@ -23,5 +22,4 @@ bool is_gc_able(SNodeType t) { return (t == SNodeType::pointer || t == SNodeType::dynamic); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/ir/snode_types.h b/taichi/ir/snode_types.h index 7a1a27c5af4af..8dbe7623e6aa8 100644 --- a/taichi/ir/snode_types.h +++ b/taichi/ir/snode_types.h @@ -2,8 +2,7 @@ #include -namespace taichi { -namespace lang { +namespace taichi::lang { enum class SNodeType { #define PER_SNODE(x) x, @@ -15,5 +14,4 @@ std::string snode_type_name(SNodeType t); bool is_gc_able(SNodeType t); -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/ir/statements.cpp b/taichi/ir/statements.cpp index 7f013f0c621dd..4bdce35584169 100644 --- a/taichi/ir/statements.cpp +++ b/taichi/ir/statements.cpp @@ -412,4 +412,4 @@ BitStructType *BitStructStoreStmt::get_bit_struct() const { return ptr->as()->snode->dt->as(); } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/ir/statements.h b/taichi/ir/statements.h index 89ec00a558167..71f4bf2222347 100644 --- a/taichi/ir/statements.h +++ b/taichi/ir/statements.h @@ -8,8 +8,7 @@ #include -namespace taichi { -namespace lang { +namespace taichi::lang { class Function; @@ -1841,5 +1840,4 @@ class MatrixInitStmt : public Stmt { TI_DEFINE_ACCEPT_AND_CLONE }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/ir/stmt_op_types.cpp b/taichi/ir/stmt_op_types.cpp index 9130797ce128d..64769b56bf55e 100644 --- a/taichi/ir/stmt_op_types.cpp +++ b/taichi/ir/stmt_op_types.cpp @@ -2,8 +2,7 @@ #include "taichi/common/logging.h" -namespace taichi { -namespace lang { +namespace taichi::lang { std::string unary_op_type_name(UnaryOpType type) { switch (type) { #define PER_UNARY_OP(i) \ @@ -164,5 +163,4 @@ std::string texture_op_type_name(TextureOpType type) { } } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/ir/stmt_op_types.h b/taichi/ir/stmt_op_types.h index f2c9ee681b6c2..30aa7a6425b92 100644 --- a/taichi/ir/stmt_op_types.h +++ b/taichi/ir/stmt_op_types.h @@ -4,8 +4,7 @@ #include "taichi/common/core.h" -namespace taichi { -namespace lang { +namespace taichi::lang { enum class UnaryOpType : int { #define PER_UNARY_OP(x) x, @@ -94,5 +93,4 @@ enum class TextureOpType : int { std::string texture_op_type_name(TextureOpType type); -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/ir/transforms.h b/taichi/ir/transforms.h index 22254fcc5e4ac..b46f94767b0eb 100644 --- a/taichi/ir/transforms.h +++ b/taichi/ir/transforms.h @@ -196,4 +196,4 @@ void compile_function(IRNode *ir, bool start_from_ast); } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/ir/type.cpp b/taichi/ir/type.cpp index 592b6ab2da92a..df1d32b818a30 100644 --- a/taichi/ir/type.cpp +++ b/taichi/ir/type.cpp @@ -418,4 +418,4 @@ float64 TypedConstant::val_cast_to_float64() const { } } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/ir/type.h b/taichi/ir/type.h index 25865af0f3bdb..80171bed51b8c 100644 --- a/taichi/ir/type.h +++ b/taichi/ir/type.h @@ -479,4 +479,4 @@ class TypedConstant { float64 val_cast_to_float64() const; }; -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/ir/type_factory.cpp b/taichi/ir/type_factory.cpp index f5a0286aa2900..39bf6e1049189 100644 --- a/taichi/ir/type_factory.cpp +++ b/taichi/ir/type_factory.cpp @@ -188,4 +188,4 @@ DataType promoted_type(DataType x, DataType y) { return y; } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/ir/type_factory.h b/taichi/ir/type_factory.h index 3ba0d9af8066f..a273091579ea9 100644 --- a/taichi/ir/type_factory.h +++ b/taichi/ir/type_factory.h @@ -83,4 +83,4 @@ class TypeFactory { DataType promoted_type(DataType a, DataType b); -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/ir/type_utils.cpp b/taichi/ir/type_utils.cpp index a86d8753a4441..b9ae8a0ab2a0f 100644 --- a/taichi/ir/type_utils.cpp +++ b/taichi/ir/type_utils.cpp @@ -1,7 +1,6 @@ #include "taichi/ir/type_utils.h" -namespace taichi { -namespace lang { +namespace taichi::lang { std::string data_type_name(DataType t) { if (!t->is()) { @@ -138,5 +137,4 @@ std::string data_type_format(DataType dt) { } } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/ir/type_utils.h b/taichi/ir/type_utils.h index bb3b56f23e614..a674a9b136607 100644 --- a/taichi/ir/type_utils.h +++ b/taichi/ir/type_utils.h @@ -3,8 +3,7 @@ #include "taichi/ir/type.h" #include "taichi/ir/type_factory.h" -namespace taichi { -namespace lang { +namespace taichi::lang { std::vector data_type_shape(DataType t); @@ -270,5 +269,4 @@ class BitStructTypeBuilder { int current_shared_exponent_{-1}; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/ir/visitors.h b/taichi/ir/visitors.h index 36aefc04d5769..20138e5f30450 100644 --- a/taichi/ir/visitors.h +++ b/taichi/ir/visitors.h @@ -32,4 +32,4 @@ class BasicStmtVisitor : public IRVisitor { void visit(FrontendIfStmt *stmt) override; }; -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/jit/jit_module.h b/taichi/jit/jit_module.h index 162fc4b5e8e56..ca2e51b930629 100644 --- a/taichi/jit/jit_module.h +++ b/taichi/jit/jit_module.h @@ -90,4 +90,4 @@ class JITModule { } }; -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/jit/jit_session.cpp b/taichi/jit/jit_session.cpp index 310790e113b0e..3e3e514e714cd 100644 --- a/taichi/jit/jit_session.cpp +++ b/taichi/jit/jit_session.cpp @@ -41,4 +41,4 @@ std::unique_ptr JITSession::create(TaichiLLVMContext *tlctx, return nullptr; } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/jit/jit_session.h b/taichi/jit/jit_session.h index 6322d73ce0878..4d5d8775b59bc 100644 --- a/taichi/jit/jit_session.h +++ b/taichi/jit/jit_session.h @@ -45,4 +45,4 @@ class JITSession { virtual ~JITSession() = default; }; -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/math/array.h b/taichi/math/array.h index 13560f9ca27de..6c8e66ba09c5b 100644 --- a/taichi/math/array.h +++ b/taichi/math/array.h @@ -17,4 +17,4 @@ class RegionND; template class ArrayND; -} // namespace taichi +} // namespace taichi diff --git a/taichi/math/array_2d.h b/taichi/math/array_2d.h index ef5780870c7ae..97d3400104caa 100644 --- a/taichi/math/array_2d.h +++ b/taichi/math/array_2d.h @@ -794,4 +794,4 @@ inline void print(const Array2D &arr) { arr.print(""); } -} // namespace taichi +} // namespace taichi diff --git a/taichi/math/array_fwd.h b/taichi/math/array_fwd.h index 75388c2617a4e..bfd2097d8d4ea 100644 --- a/taichi/math/array_fwd.h +++ b/taichi/math/array_fwd.h @@ -27,4 +27,4 @@ class ArrayND; template using TArray = ArrayND; -} // namespace taichi +} // namespace taichi diff --git a/taichi/math/geometry_util.h b/taichi/math/geometry_util.h index 59efa3d4da793..2238344721d99 100644 --- a/taichi/math/geometry_util.h +++ b/taichi/math/geometry_util.h @@ -85,4 +85,4 @@ inline std::vector points_inside_sphere(std::vector x_range, return ret; } -} // namespace taichi +} // namespace taichi diff --git a/taichi/math/linalg.h b/taichi/math/linalg.h index 7d77d2f20f4a3..809d0a70881a5 100644 --- a/taichi/math/linalg.h +++ b/taichi/math/linalg.h @@ -1448,4 +1448,4 @@ template struct is_MatrixND> : public std::true_type {}; } // namespace type -} // namespace taichi +} // namespace taichi diff --git a/taichi/math/math.h b/taichi/math/math.h index 91dcce44e14fa..cc95add8af82b 100644 --- a/taichi/math/math.h +++ b/taichi/math/math.h @@ -39,4 +39,4 @@ TI_FORCE_INLINE } // namespace math -} // namespace taichi +} // namespace taichi diff --git a/taichi/math/scalar.h b/taichi/math/scalar.h index eaf7c6f0dd699..33ca3f90b686c 100644 --- a/taichi/math/scalar.h +++ b/taichi/math/scalar.h @@ -170,4 +170,4 @@ inline int64 get_largest_pot(int64 a) noexcept { return a - (a >> 1); } -} // namespace taichi +} // namespace taichi diff --git a/taichi/math/svd.h b/taichi/math/svd.h index 6a21ef0b86c75..e7d8e71334951 100644 --- a/taichi/math/svd.h +++ b/taichi/math/svd.h @@ -903,4 +903,4 @@ sifakis_svd_export(ASTBuilder *ast_builder, Sa11, Sa22, Sa33); } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/program/callable.cpp b/taichi/program/callable.cpp index 0c8a1b1b148ee..d592400869dd1 100644 --- a/taichi/program/callable.cpp +++ b/taichi/program/callable.cpp @@ -1,8 +1,7 @@ #include "taichi/program/callable.h" #include "taichi/program/program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { Callable::Callable() = default; @@ -43,5 +42,4 @@ Callable::CurrentCallableGuard::~CurrentCallableGuard() { program_->current_callable = old_callable_; } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/callable.h b/taichi/program/callable.h index bfdc6ea3c6f60..658722cf1c2f3 100644 --- a/taichi/program/callable.h +++ b/taichi/program/callable.h @@ -2,8 +2,7 @@ #include "taichi/util/lang_util.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class Program; class IRNode; @@ -105,5 +104,4 @@ class TI_DLL_EXPORT Callable { }; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/compile_config.cpp b/taichi/program/compile_config.cpp index 24db7fc6b49b3..e28f80cda19e5 100644 --- a/taichi/program/compile_config.cpp +++ b/taichi/program/compile_config.cpp @@ -71,4 +71,4 @@ CompileConfig::CompileConfig() { cc_link_cmd = "gcc -shared -fPIC -o '{}' '{}'"; } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/program/context.h b/taichi/program/context.h index ea2ecdb7c9f6a..6f44d1a27d9a3 100644 --- a/taichi/program/context.h +++ b/taichi/program/context.h @@ -4,8 +4,7 @@ #include "taichi/inc/constants.h" #if defined(TI_RUNTIME_HOST) -namespace taichi { -namespace lang { +namespace taichi::lang { #endif struct LLVMRuntime; @@ -118,6 +117,5 @@ struct RuntimeContext { }; #if defined(TI_RUNTIME_HOST) -} // namespace lang -} // namespace taichi +} // namespace taichi::lang #endif diff --git a/taichi/program/extension.cpp b/taichi/program/extension.cpp index 08b61ab356891..08ac31f64f847 100644 --- a/taichi/program/extension.cpp +++ b/taichi/program/extension.cpp @@ -33,4 +33,4 @@ bool is_extension_supported(Arch arch, Extension ext) { return exts.find(ext) != exts.end(); } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/program/extension.h b/taichi/program/extension.h index 5cb81249c15ad..e842244752467 100644 --- a/taichi/program/extension.h +++ b/taichi/program/extension.h @@ -4,8 +4,7 @@ #include -namespace taichi { -namespace lang { +namespace taichi::lang { // The Taichi core feature set (dense SNode) should probably be supported by all // the backends. In addition, each backend can optionally support features in @@ -24,5 +23,4 @@ enum class Extension { bool is_extension_supported(Arch arch, Extension ext); -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/function.cpp b/taichi/program/function.cpp index 4513b28291a57..7241e7753e2de 100644 --- a/taichi/program/function.cpp +++ b/taichi/program/function.cpp @@ -3,8 +3,7 @@ #include "taichi/ir/transforms.h" #include "taichi/analysis/offline_cache_util.h" -namespace taichi { -namespace lang { +namespace taichi::lang { Function::Function(Program *program, const FunctionKey &func_key) : func_key(func_key) { @@ -43,5 +42,4 @@ std::string Function::get_name() const { return func_key.get_full_name(); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/function.h b/taichi/program/function.h index 4ebb6d2b964f5..2da23219d6c0c 100644 --- a/taichi/program/function.h +++ b/taichi/program/function.h @@ -3,8 +3,7 @@ #include "taichi/program/callable.h" #include "taichi/program/function_key.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class Program; @@ -31,5 +30,4 @@ class Function : public Callable { std::optional ast_serialization_data_; // For generating AST-Key }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/function_key.cpp b/taichi/program/function_key.cpp index c93f67d7b28cf..a102c83941f3f 100644 --- a/taichi/program/function_key.cpp +++ b/taichi/program/function_key.cpp @@ -1,7 +1,6 @@ #include "taichi/program/function_key.h" -namespace taichi { -namespace lang { +namespace taichi::lang { FunctionKey::FunctionKey(const std::string &func_name, int func_id, @@ -18,5 +17,4 @@ std::string FunctionKey::get_full_name() const { std::to_string(instance_id); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/function_key.h b/taichi/program/function_key.h index 2e8d7390aa5ca..eaa616e50f8a1 100644 --- a/taichi/program/function_key.h +++ b/taichi/program/function_key.h @@ -3,8 +3,7 @@ #include #include -namespace taichi { -namespace lang { +namespace taichi::lang { /** * A unique key of a function. @@ -27,8 +26,7 @@ class FunctionKey { [[nodiscard]] std::string get_full_name() const; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang namespace std { template <> diff --git a/taichi/program/graph_builder.cpp b/taichi/program/graph_builder.cpp index 0dbaf0d588841..7cde479a831d9 100644 --- a/taichi/program/graph_builder.cpp +++ b/taichi/program/graph_builder.cpp @@ -2,8 +2,7 @@ #include "taichi/program/ndarray.h" #include "taichi/program/program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { void Dispatch::compile( std::vector &compiled_dispatches) { if (kernel_->compiled_aot_kernel() == nullptr) { @@ -69,5 +68,4 @@ void GraphBuilder::dispatch(Kernel *kernel, const std::vector &args) { seq()->dispatch(kernel, args); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/graph_builder.h b/taichi/program/graph_builder.h index d2dc64660a416..cc678d9bb682c 100644 --- a/taichi/program/graph_builder.h +++ b/taichi/program/graph_builder.h @@ -6,8 +6,7 @@ #include "taichi/ir/type.h" #include "taichi/aot/graph_data.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class Kernel; class GraphBuilder; @@ -77,5 +76,4 @@ class GraphBuilder { std::vector> all_nodes_; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/ir_node_extended_impl.cpp b/taichi/program/ir_node_extended_impl.cpp index c004c6bca75aa..d91b25d9fb1fa 100644 --- a/taichi/program/ir_node_extended_impl.cpp +++ b/taichi/program/ir_node_extended_impl.cpp @@ -7,8 +7,7 @@ // order to use files under "taichi/program". Ideally, we should: // 1. Have a dedicated IR compile config that lives under "taichi/ir" // 2. Just don't hook IRNode with a Kernel -namespace taichi { -namespace lang { +namespace taichi::lang { Kernel *IRNode::get_kernel() const { return const_cast(this)->get_ir_root()->kernel; @@ -18,5 +17,4 @@ CompileConfig &IRNode::get_config() const { return get_kernel()->program->this_thread_config(); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/kernel.cpp b/taichi/program/kernel.cpp index 31339893d88d4..abedf47778423 100644 --- a/taichi/program/kernel.cpp +++ b/taichi/program/kernel.cpp @@ -442,4 +442,4 @@ void Kernel::offload_to_executable(IRNode *stmt) { is_extension_supported(config.arch, Extension::bls) && config.make_block_local); } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/program/kernel.h b/taichi/program/kernel.h index 46c75c01176a0..4c7bca71030a6 100644 --- a/taichi/program/kernel.h +++ b/taichi/program/kernel.h @@ -168,4 +168,4 @@ class TI_DLL_EXPORT Kernel : public Callable { bool from_cache_{false}; }; -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/program/kernel_profiler.cpp b/taichi/program/kernel_profiler.cpp index e2f4de95fdce0..aecc0f36b8f54 100644 --- a/taichi/program/kernel_profiler.cpp +++ b/taichi/program/kernel_profiler.cpp @@ -130,4 +130,4 @@ std::unique_ptr make_profiler(Arch arch, bool enable) { } } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/program/kernel_profiler.h b/taichi/program/kernel_profiler.h index 27d94716f77f8..b116856a8dd38 100644 --- a/taichi/program/kernel_profiler.h +++ b/taichi/program/kernel_profiler.h @@ -105,4 +105,4 @@ class KernelProfilerBase { std::unique_ptr make_profiler(Arch arch, bool enable); -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/program/ndarray.cpp b/taichi/program/ndarray.cpp index 15121a3fe231a..67d4ee2eaf86e 100644 --- a/taichi/program/ndarray.cpp +++ b/taichi/program/ndarray.cpp @@ -8,8 +8,7 @@ #include "taichi/runtime/program_impls/llvm/llvm_program.h" #endif -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { @@ -204,5 +203,4 @@ void Ndarray::write_float(const std::vector &i, float64 val) { write(i, val); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/ndarray.h b/taichi/program/ndarray.h index 46bd41c1cb72c..aeac269bbd44d 100644 --- a/taichi/program/ndarray.h +++ b/taichi/program/ndarray.h @@ -7,8 +7,7 @@ #include "taichi/ir/type_utils.h" #include "taichi/rhi/device.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class Program; class NdarrayRwAccessorsBank; @@ -81,5 +80,4 @@ class TI_DLL_EXPORT Ndarray { Program *prog_{nullptr}; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/parallel_executor.cpp b/taichi/program/parallel_executor.cpp index 6983c4ee70e2c..84c804e6bb590 100644 --- a/taichi/program/parallel_executor.cpp +++ b/taichi/program/parallel_executor.cpp @@ -116,4 +116,4 @@ void ParallelExecutor::worker_loop() { } } } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/program/parallel_executor.h b/taichi/program/parallel_executor.h index 520f0183fd8cc..d3b4473363cdf 100644 --- a/taichi/program/parallel_executor.h +++ b/taichi/program/parallel_executor.h @@ -62,4 +62,4 @@ class ParallelExecutor { // callback to be executed? std::condition_variable flush_cv_; }; -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/program/program.cpp b/taichi/program/program.cpp index 41bc7dffd7334..c99a15528bd99 100644 --- a/taichi/program/program.cpp +++ b/taichi/program/program.cpp @@ -45,8 +45,7 @@ #include #endif // defined(_M_X64) || defined(__x86_64) -namespace taichi { -namespace lang { +namespace taichi::lang { std::atomic Program::num_instances_; Program::Program(Arch desired_arch) : snode_rw_accessors_bank_(this) { @@ -558,5 +557,4 @@ void Program::enqueue_compute_op_lambda( program_impl_->enqueue_compute_op_lambda(op, image_refs); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/program.h b/taichi/program/program.h index 568567a7a628c..f34fef2029948 100644 --- a/taichi/program/program.h +++ b/taichi/program/program.h @@ -30,8 +30,7 @@ #include "taichi/program/sparse_matrix.h" #include "taichi/ir/mesh.h" -namespace taichi { -namespace lang { +namespace taichi::lang { struct JITEvaluatorId { std::thread::id thread_id; @@ -57,8 +56,7 @@ struct JITEvaluatorId { } }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang namespace std { template <> @@ -72,8 +70,7 @@ struct hash { }; } // namespace std -namespace taichi { -namespace lang { +namespace taichi::lang { class StructCompiler; @@ -400,5 +397,4 @@ class TI_DLL_EXPORT Program { std::vector> textures_; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/program_impl.cpp b/taichi/program/program_impl.cpp index 2838c3c2f152e..144f3b21b161a 100644 --- a/taichi/program/program_impl.cpp +++ b/taichi/program/program_impl.cpp @@ -1,7 +1,6 @@ #include "program_impl.h" -namespace taichi { -namespace lang { +namespace taichi::lang { ProgramImpl::ProgramImpl(CompileConfig &config_) : config(&config_) { } @@ -11,5 +10,4 @@ void ProgramImpl::compile_snode_tree_types(SNodeTree *tree) { TI_NOT_IMPLEMENTED; } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/program_impl.h b/taichi/program/program_impl.h index 4f2a5d5a47381..760c4309fae86 100644 --- a/taichi/program/program_impl.h +++ b/taichi/program/program_impl.h @@ -10,8 +10,7 @@ #include "taichi/rhi/device.h" #include "taichi/aot/graph_data.h" -namespace taichi { -namespace lang { +namespace taichi::lang { // Represents an image resource reference for a compute/render Op struct ComputeOpImageRef { @@ -164,5 +163,4 @@ class ProgramImpl { private: }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/snode_expr_utils.cpp b/taichi/program/snode_expr_utils.cpp index e781ef477c969..bd73f820a86a8 100644 --- a/taichi/program/snode_expr_utils.cpp +++ b/taichi/program/snode_expr_utils.cpp @@ -2,8 +2,7 @@ #include "taichi/ir/snode.h" #include "taichi/ir/frontend_ir.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { @@ -101,5 +100,4 @@ void make_lazy_place(SNode *snode, } } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/snode_expr_utils.h b/taichi/program/snode_expr_utils.h index 6e933dd40a7d7..c0de9474cb496 100644 --- a/taichi/program/snode_expr_utils.h +++ b/taichi/program/snode_expr_utils.h @@ -9,8 +9,7 @@ // given SNode. Expr is part of the frontend, which somehow depends on the // files inside "taichi/program". To make SNode fairly low-level and depend // on less, we thus move SNode-Expr related utils away from SNode itself. -namespace taichi { -namespace lang { +namespace taichi::lang { class Expr; class SNode; class FieldExpression; @@ -29,5 +28,4 @@ void make_lazy_place(SNode *snode, const std::function &, std::vector &)> &collect); -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/snode_rw_accessors_bank.cpp b/taichi/program/snode_rw_accessors_bank.cpp index 97336b84a59b7..b5ccd0c4822d7 100644 --- a/taichi/program/snode_rw_accessors_bank.cpp +++ b/taichi/program/snode_rw_accessors_bank.cpp @@ -2,8 +2,7 @@ #include "taichi/program/program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { void set_kernel_args(const std::vector &I, @@ -79,5 +78,4 @@ uint64 SNodeRwAccessorsBank::Accessors::read_uint(const std::vector &I) { return (uint64)read_int(I); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/snode_rw_accessors_bank.h b/taichi/program/snode_rw_accessors_bank.h index c26ae6b630493..9a424c86a1fe4 100644 --- a/taichi/program/snode_rw_accessors_bank.h +++ b/taichi/program/snode_rw_accessors_bank.h @@ -5,8 +5,7 @@ #include "taichi/program/kernel.h" #include "taichi/ir/snode.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class Program; @@ -56,5 +55,4 @@ class SNodeRwAccessorsBank { std::unordered_map snode_to_kernels_; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/sparse_matrix.cpp b/taichi/program/sparse_matrix.cpp index af11862dafe06..23ca3371057e4 100644 --- a/taichi/program/sparse_matrix.cpp +++ b/taichi/program/sparse_matrix.cpp @@ -57,8 +57,7 @@ void print_triplet_from_csr(int64_t n_rows, } // namespace -namespace taichi { -namespace lang { +namespace taichi::lang { SparseMatrixBuilder::SparseMatrixBuilder(int rows, int cols, @@ -647,5 +646,4 @@ const std::string CuSparseMatrix::to_string() const { return ostr.str(); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/sparse_matrix.h b/taichi/program/sparse_matrix.h index 2065703bdb252..90f4a49d1dad9 100644 --- a/taichi/program/sparse_matrix.h +++ b/taichi/program/sparse_matrix.h @@ -9,8 +9,7 @@ #include "Eigen/Sparse" -namespace taichi { -namespace lang { +namespace taichi::lang { class SparseMatrix; @@ -296,5 +295,4 @@ void make_sparse_matrix_from_ndarray_cusparse(Program *prog, const Ndarray &row_indices, const Ndarray &col_indices, const Ndarray &values); -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/sparse_solver.cpp b/taichi/program/sparse_solver.cpp index bb4ea6c784e57..06d29f26ea0ba 100644 --- a/taichi/program/sparse_solver.cpp +++ b/taichi/program/sparse_solver.cpp @@ -26,8 +26,7 @@ struct key_hash { }; } // namespace -namespace taichi { -namespace lang { +namespace taichi::lang { #define GET_EM(sm) \ const EigenMatrix *mat = (const EigenMatrix *)(sm.get_matrix()); @@ -284,5 +283,4 @@ std::unique_ptr make_cusparse_solver( const std::string &ordering) { return std::make_unique(); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/sparse_solver.h b/taichi/program/sparse_solver.h index 460bdce0a6cea..96e19a2e896c3 100644 --- a/taichi/program/sparse_solver.h +++ b/taichi/program/sparse_solver.h @@ -6,8 +6,7 @@ #include "sparse_matrix.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class SparseSolver { public: @@ -75,5 +74,4 @@ std::unique_ptr make_cusparse_solver( DataType dt, const std::string &solver_type, const std::string &ordering); -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/texture.cpp b/taichi/program/texture.cpp index 00c4b30276f1f..d1648d0c8c083 100644 --- a/taichi/program/texture.cpp +++ b/taichi/program/texture.cpp @@ -4,8 +4,7 @@ #include "taichi/rhi/device.h" #include "taichi/ir/snode.h" -namespace taichi { -namespace lang { +namespace taichi::lang { Texture::Texture(Program *prog, BufferFormat format, @@ -134,5 +133,4 @@ Texture::~Texture() { } } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/program/texture.h b/taichi/program/texture.h index 7b439a79eac40..5d6539e4a810c 100644 --- a/taichi/program/texture.h +++ b/taichi/program/texture.h @@ -7,8 +7,7 @@ #include "taichi/ir/type_utils.h" #include "taichi/rhi/device.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class Program; class Ndarray; @@ -66,5 +65,4 @@ class TI_DLL_EXPORT Texture { Program *prog_{nullptr}; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/python/exception.cpp b/taichi/python/exception.cpp index 865af462e65b1..b87ec76062f00 100644 --- a/taichi/python/exception.cpp +++ b/taichi/python/exception.cpp @@ -11,7 +11,7 @@ void raise_assertion_failure_in_python(const std::string &msg) { throw ExceptionForPython(msg); } -} // namespace taichi +} // namespace taichi void taichi_raise_assertion_failure_in_python(const char *msg) { taichi::raise_assertion_failure_in_python(std::string(msg)); diff --git a/taichi/python/exception.h b/taichi/python/exception.h index c6f0766d86f20..6df68d2860762 100644 --- a/taichi/python/exception.h +++ b/taichi/python/exception.h @@ -25,4 +25,4 @@ class ExceptionForPython : public std::exception { void raise_assertion_failure_in_python(const std::string &msg); -} // namespace taichi +} // namespace taichi diff --git a/taichi/python/export.cpp b/taichi/python/export.cpp index 17ea394936f1f..2cf3183a1f08d 100644 --- a/taichi/python/export.cpp +++ b/taichi/python/export.cpp @@ -23,4 +23,4 @@ PYBIND11_MODULE(taichi_python, m) { export_ggui(m); } -} // namespace taichi +} // namespace taichi diff --git a/taichi/python/export.h b/taichi/python/export.h index f4058b4720f3b..2cf4c06eab413 100644 --- a/taichi/python/export.h +++ b/taichi/python/export.h @@ -35,4 +35,4 @@ void export_visual(py::module &m); void export_ggui(py::module &m); -} // namespace taichi +} // namespace taichi diff --git a/taichi/python/export_ggui.cpp b/taichi/python/export_ggui.cpp index e8a7fa21a44f4..3ac90201700d0 100644 --- a/taichi/python/export_ggui.cpp +++ b/taichi/python/export_ggui.cpp @@ -600,7 +600,7 @@ void export_ggui(py::module &m) { ui::export_ggui(m); } -} // namespace taichi +} // namespace taichi #else @@ -610,6 +610,6 @@ void export_ggui(py::module &m) { m.attr("GGUI_AVAILABLE") = py::bool_(false); } -} // namespace taichi +} // namespace taichi #endif diff --git a/taichi/python/export_lang.cpp b/taichi/python/export_lang.cpp index 6953d10a6778a..ec2469cc0ed78 100644 --- a/taichi/python/export_lang.cpp +++ b/taichi/python/export_lang.cpp @@ -39,7 +39,7 @@ namespace taichi { bool test_threading(); -} // namespace taichi +} // namespace taichi namespace taichi::lang { @@ -49,7 +49,7 @@ Expr expr_index(const Expr &expr, const Expr &index) { std::string libdevice_path(); -} // namespace taichi::lang +} // namespace taichi::lang namespace taichi { void export_lang(py::module &m) { @@ -1360,4 +1360,4 @@ void export_lang(py::module &m) { }); } -} // namespace taichi +} // namespace taichi diff --git a/taichi/python/export_math.cpp b/taichi/python/export_math.cpp index 97d825835512a..dc7905f2843f7 100644 --- a/taichi/python/export_math.cpp +++ b/taichi/python/export_math.cpp @@ -161,4 +161,4 @@ void export_math(py::module &m) { VectorRegistration::run(m); } -} // namespace taichi +} // namespace taichi diff --git a/taichi/python/export_visual.cpp b/taichi/python/export_visual.cpp index 1b6832d7308d0..4fa515b3431f0 100644 --- a/taichi/python/export_visual.cpp +++ b/taichi/python/export_visual.cpp @@ -116,4 +116,4 @@ void export_visual(py::module &m) { }); } -} // namespace taichi +} // namespace taichi diff --git a/taichi/python/memory_usage_monitor.cpp b/taichi/python/memory_usage_monitor.cpp index d42d47da483e1..e3eee9397894b 100644 --- a/taichi/python/memory_usage_monitor.cpp +++ b/taichi/python/memory_usage_monitor.cpp @@ -116,4 +116,4 @@ class MemoryTest2 : public Task { TI_IMPLEMENTATION(Task, MemoryTest, "mem_test"); TI_IMPLEMENTATION(Task, MemoryTest2, "mem_test2"); -} // namespace taichi +} // namespace taichi diff --git a/taichi/python/memory_usage_monitor.h b/taichi/python/memory_usage_monitor.h index 30b8ec7de308d..254bc918211d2 100644 --- a/taichi/python/memory_usage_monitor.h +++ b/taichi/python/memory_usage_monitor.h @@ -21,4 +21,4 @@ void start_memory_monitoring(std::string output_fn, int pid = -1, real interval = 1); -} // namespace taichi +} // namespace taichi diff --git a/taichi/python/snode_registry.cpp b/taichi/python/snode_registry.cpp index a71eb92c4852b..7d1d2e605823f 100644 --- a/taichi/python/snode_registry.cpp +++ b/taichi/python/snode_registry.cpp @@ -4,8 +4,7 @@ #include "taichi/ir/snode.h" #include "taichi/program/program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { SNode *SNodeRegistry::create_root(Program *prog) { TI_ASSERT(prog != nullptr); @@ -28,5 +27,4 @@ std::unique_ptr SNodeRegistry::finalize(const SNode *snode) { return nullptr; } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/python/snode_registry.h b/taichi/python/snode_registry.h index 869e146899c27..dd31638d651e0 100644 --- a/taichi/python/snode_registry.h +++ b/taichi/python/snode_registry.h @@ -3,8 +3,7 @@ #include #include -namespace taichi { -namespace lang { +namespace taichi::lang { class SNode; class Program; @@ -40,5 +39,4 @@ class SNodeRegistry { std::vector> snodes_; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/cpu/cpu_device.cpp b/taichi/rhi/cpu/cpu_device.cpp index c70229fcaeae6..c7ee01aef9f4d 100644 --- a/taichi/rhi/cpu/cpu_device.cpp +++ b/taichi/rhi/cpu/cpu_device.cpp @@ -1,7 +1,6 @@ #include "taichi/rhi/cpu/cpu_device.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace cpu { @@ -91,5 +90,4 @@ uint64 CpuDevice::fetch_result_uint64(int i, uint64 *result_buffer) { } } // namespace cpu -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/cpu/cpu_device.h b/taichi/rhi/cpu/cpu_device.h index f39fb1afea3fd..cb2aed624c1c3 100644 --- a/taichi/rhi/cpu/cpu_device.h +++ b/taichi/rhi/cpu/cpu_device.h @@ -8,8 +8,7 @@ #include "taichi/rhi/llvm/llvm_device.h" #include "taichi/system/virtual_memory.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace cpu { class CpuResourceBinder : public ResourceBinder { @@ -131,6 +130,4 @@ class CpuDevice : public LlvmDevice { } // namespace cpu -} // namespace lang - -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/cuda/cuda_caching_allocator.cpp b/taichi/rhi/cuda/cuda_caching_allocator.cpp index 1d4eeb174a577..7f1fab4384edb 100644 --- a/taichi/rhi/cuda/cuda_caching_allocator.cpp +++ b/taichi/rhi/cuda/cuda_caching_allocator.cpp @@ -1,7 +1,6 @@ #include "taichi/rhi/cuda/cuda_caching_allocator.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace cuda { CudaCachingAllocator::CudaCachingAllocator(LlvmDevice *device) @@ -36,5 +35,4 @@ void CudaCachingAllocator::release(size_t sz, uint64_t *ptr) { } } // namespace cuda -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/cuda/cuda_caching_allocator.h b/taichi/rhi/cuda/cuda_caching_allocator.h index 1235d49ab90ec..906b9b904235e 100644 --- a/taichi/rhi/cuda/cuda_caching_allocator.h +++ b/taichi/rhi/cuda/cuda_caching_allocator.h @@ -6,8 +6,7 @@ #include #include -namespace taichi { -namespace lang { +namespace taichi::lang { namespace cuda { class CudaCachingAllocator { @@ -23,5 +22,4 @@ class CudaCachingAllocator { }; } // namespace cuda -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/cuda/cuda_context.cpp b/taichi/rhi/cuda/cuda_context.cpp index 3fa2b0cdf3f5e..aee2c1aea0a19 100644 --- a/taichi/rhi/cuda/cuda_context.cpp +++ b/taichi/rhi/cuda/cuda_context.cpp @@ -141,4 +141,4 @@ CUDAContext &CUDAContext::get_instance() { return *context; } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/rhi/cuda/cuda_context.h b/taichi/rhi/cuda/cuda_context.h index 9fc5e01ebd537..239bbec5cc5a7 100644 --- a/taichi/rhi/cuda/cuda_context.h +++ b/taichi/rhi/cuda/cuda_context.h @@ -103,4 +103,4 @@ class CUDAContext { static CUDAContext &get_instance(); }; -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/rhi/cuda/cuda_device.cpp b/taichi/rhi/cuda/cuda_device.cpp index ac0d2917d9d1b..2dfc97562297a 100644 --- a/taichi/rhi/cuda/cuda_device.cpp +++ b/taichi/rhi/cuda/cuda_device.cpp @@ -1,7 +1,6 @@ #include "taichi/rhi/cuda/cuda_device.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace cuda { @@ -124,5 +123,4 @@ uint64 CudaDevice::fetch_result_uint64(int i, uint64 *result_buffer) { return ret; } } // namespace cuda -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/cuda/cuda_device.h b/taichi/rhi/cuda/cuda_device.h index d691cf4635d84..4b768db88357c 100644 --- a/taichi/rhi/cuda/cuda_device.h +++ b/taichi/rhi/cuda/cuda_device.h @@ -8,8 +8,7 @@ #include "taichi/rhi/cuda/cuda_context.h" #include "taichi/rhi/llvm/llvm_device.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace cuda { class CudaResourceBinder : public ResourceBinder { @@ -142,6 +141,4 @@ class CudaDevice : public LlvmDevice { } // namespace cuda -} // namespace lang - -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/cuda/cuda_driver.cpp b/taichi/rhi/cuda/cuda_driver.cpp index 6749044ae8187..1a3e59df25a37 100644 --- a/taichi/rhi/cuda/cuda_driver.cpp +++ b/taichi/rhi/cuda/cuda_driver.cpp @@ -132,4 +132,4 @@ bool CUSOLVERDriver::load_cusolver() { #undef PER_CUSOLVER_FUNCTION return cusolver_loaded_; } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/rhi/cuda/cuda_driver.h b/taichi/rhi/cuda/cuda_driver.h index 1852b62ff6033..77e725bf8ad5a 100644 --- a/taichi/rhi/cuda/cuda_driver.h +++ b/taichi/rhi/cuda/cuda_driver.h @@ -178,4 +178,4 @@ class CUSOLVERDriver : protected CUDADriverBase { bool cusolver_loaded_{false}; }; -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/rhi/cuda/cuda_profiler.cpp b/taichi/rhi/cuda/cuda_profiler.cpp index a94b7b74ef811..5bd11c2e0762f 100644 --- a/taichi/rhi/cuda/cuda_profiler.cpp +++ b/taichi/rhi/cuda/cuda_profiler.cpp @@ -369,4 +369,4 @@ void EventToolkit::update_timeline( } #endif -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/rhi/cuda/cuda_profiler.h b/taichi/rhi/cuda/cuda_profiler.h index 1400431f1fc01..9c385664d62cc 100644 --- a/taichi/rhi/cuda/cuda_profiler.h +++ b/taichi/rhi/cuda/cuda_profiler.h @@ -95,4 +95,4 @@ class EventToolkit { } }; -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/rhi/cuda/cupti_toolkit.cpp b/taichi/rhi/cuda/cupti_toolkit.cpp index 6d787976b537e..e144772c6640f 100644 --- a/taichi/rhi/cuda/cupti_toolkit.cpp +++ b/taichi/rhi/cuda/cupti_toolkit.cpp @@ -1130,4 +1130,4 @@ bool CuptiToolkit::update_record( } #endif -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/rhi/cuda/cupti_toolkit.h b/taichi/rhi/cuda/cupti_toolkit.h index 098c0607f98b9..e62d9f4b97399 100644 --- a/taichi/rhi/cuda/cupti_toolkit.h +++ b/taichi/rhi/cuda/cupti_toolkit.h @@ -43,4 +43,4 @@ class CuptiToolkit { CuptiImage cupti_image_; }; -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/rhi/device.cpp b/taichi/rhi/device.cpp index 1d3af12cd8022..334364ad48de3 100644 --- a/taichi/rhi/device.cpp +++ b/taichi/rhi/device.cpp @@ -12,8 +12,7 @@ #endif // TI_WITH_CUDA #endif // TI_WITH_VULKAN -namespace taichi { -namespace lang { +namespace taichi::lang { // FIXME: (penguinliong) We might have to differentiate buffer formats and // texture formats at some point because formats like `rgb10a2` are not easily @@ -337,5 +336,4 @@ void GraphicsDevice::image_to_buffer(DevicePtr dst_buf, stream->submit_synced(cmd_list.get()); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/device.h b/taichi/rhi/device.h index 46576da09f2aa..727ab1fa433e2 100644 --- a/taichi/rhi/device.h +++ b/taichi/rhi/device.h @@ -6,8 +6,7 @@ #include #include -namespace taichi { -namespace lang { +namespace taichi::lang { constexpr size_t kBufferSizeEntireSize = size_t(-1); @@ -626,5 +625,4 @@ class TI_DLL_EXPORT GraphicsDevice : public Device { const BufferImageCopyParams ¶ms); }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/dx/dx_api.cpp b/taichi/rhi/dx/dx_api.cpp index c9fe4be3a494a..3685639b9962b 100644 --- a/taichi/rhi/dx/dx_api.cpp +++ b/taichi/rhi/dx/dx_api.cpp @@ -1,8 +1,7 @@ #include "taichi/rhi/dx/dx_api.h" #include "taichi/rhi/dx/dx_device.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace directx11 { bool is_dx_api_available() { @@ -18,5 +17,4 @@ std::shared_ptr make_dx11_device() { } } // namespace directx11 -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/dx/dx_api.h b/taichi/rhi/dx/dx_api.h index fea81c475fe10..e4b4e2e7f56a2 100644 --- a/taichi/rhi/dx/dx_api.h +++ b/taichi/rhi/dx/dx_api.h @@ -9,8 +9,7 @@ #include #endif -namespace taichi { -namespace lang { +namespace taichi::lang { namespace directx11 { bool is_dx_api_available(); @@ -18,5 +17,4 @@ bool is_dx_api_available(); std::shared_ptr make_dx11_device(); } // namespace directx11 -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/dx/dx_device.cpp b/taichi/rhi/dx/dx_device.cpp index a69e503d551da..895b486b2d633 100644 --- a/taichi/rhi/dx/dx_device.cpp +++ b/taichi/rhi/dx/dx_device.cpp @@ -5,8 +5,7 @@ #include "spirv_hlsl.hpp" #include -namespace taichi { -namespace lang { +namespace taichi::lang { namespace directx11 { #ifdef TAICHI_DX11_DEBUG_WINDOW @@ -952,7 +951,6 @@ ResourceBinder *Dx11Pipeline::resource_binder() { } } // namespace directx11 -} // namespace lang -} // namespace taichi +} // namespace taichi::lang #endif diff --git a/taichi/rhi/dx/dx_device.h b/taichi/rhi/dx/dx_device.h index b0d1f863a6c41..ea8ccbf14df3a 100644 --- a/taichi/rhi/dx/dx_device.h +++ b/taichi/rhi/dx/dx_device.h @@ -6,8 +6,7 @@ #include "taichi/rhi/dx/dx_info_queue.h" #include -namespace taichi { -namespace lang { +namespace taichi::lang { namespace directx11 { // Only enable debug layer when the corresponding testing facility is enabled @@ -297,7 +296,6 @@ class Dx11Device : public GraphicsDevice { }; } // namespace directx11 -} // namespace lang -} // namespace taichi +} // namespace taichi::lang #endif diff --git a/taichi/rhi/dx/dx_info_queue.cpp b/taichi/rhi/dx/dx_info_queue.cpp index f852e44de15c8..ab8deb42f5027 100644 --- a/taichi/rhi/dx/dx_info_queue.cpp +++ b/taichi/rhi/dx/dx_info_queue.cpp @@ -2,8 +2,7 @@ #include "taichi/rhi/dx/dx_info_queue.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace directx11 { void check_dx_error(HRESULT hr, const char *msg); @@ -138,7 +137,6 @@ int Dx11InfoQueue::live_object_count() { } } // namespace directx11 -} // namespace lang -} // namespace taichi +} // namespace taichi::lang #endif diff --git a/taichi/rhi/dx/dx_info_queue.h b/taichi/rhi/dx/dx_info_queue.h index a98e8a6d958a5..0d74152d286de 100644 --- a/taichi/rhi/dx/dx_info_queue.h +++ b/taichi/rhi/dx/dx_info_queue.h @@ -5,8 +5,7 @@ #include "taichi/rhi/device.h" #include -namespace taichi { -namespace lang { +namespace taichi::lang { namespace directx11 { class Dx11InfoQueue { @@ -34,7 +33,6 @@ class Dx11InfoQueue { }; } // namespace directx11 -} // namespace lang -} // namespace taichi +} // namespace taichi::lang #endif diff --git a/taichi/rhi/dx12/dx12_api.cpp b/taichi/rhi/dx12/dx12_api.cpp index fbff2c4d18a6e..97e3ba958ccd8 100644 --- a/taichi/rhi/dx12/dx12_api.cpp +++ b/taichi/rhi/dx12/dx12_api.cpp @@ -1,7 +1,6 @@ #include "taichi/rhi/dx12/dx12_api.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace directx12 { bool is_dx12_api_available() { @@ -24,5 +23,4 @@ std::vector validate_and_sign( } } // namespace directx12 -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/dx12/dx12_api.h b/taichi/rhi/dx12/dx12_api.h index 485ddacb087f7..1bc0f43265acb 100644 --- a/taichi/rhi/dx12/dx12_api.h +++ b/taichi/rhi/dx12/dx12_api.h @@ -6,8 +6,7 @@ #endif -namespace taichi { -namespace lang { +namespace taichi::lang { namespace directx12 { bool is_dx12_api_available(); @@ -18,5 +17,4 @@ std::vector validate_and_sign( std::vector &input_dxil_container); } // namespace directx12 -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/interop/vulkan_cpu_interop.cpp b/taichi/rhi/interop/vulkan_cpu_interop.cpp index 598e833977eee..f92c837c69118 100644 --- a/taichi/rhi/interop/vulkan_cpu_interop.cpp +++ b/taichi/rhi/interop/vulkan_cpu_interop.cpp @@ -7,8 +7,7 @@ #include -namespace taichi { -namespace lang { +namespace taichi::lang { #if TI_WITH_VULKAN && defined(TI_WITH_LLVM) @@ -67,5 +66,4 @@ void memcpy_cpu_to_vulkan_via_staging(DevicePtr dst, } #endif // TI_WITH_VULKAN -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/interop/vulkan_cpu_interop.h b/taichi/rhi/interop/vulkan_cpu_interop.h index 4042ceca80be9..a975fad78092a 100644 --- a/taichi/rhi/interop/vulkan_cpu_interop.h +++ b/taichi/rhi/interop/vulkan_cpu_interop.h @@ -2,8 +2,7 @@ #include "taichi/rhi/device.h" -namespace taichi { -namespace lang { +namespace taichi::lang { void memcpy_cpu_to_vulkan(DevicePtr dst, DevicePtr src, uint64_t size); @@ -12,5 +11,4 @@ void memcpy_cpu_to_vulkan_via_staging(DevicePtr dst, DevicePtr src, uint64_t size); -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/interop/vulkan_cuda_interop.cpp b/taichi/rhi/interop/vulkan_cuda_interop.cpp index bfa40da4a37a4..8e015fb516c24 100644 --- a/taichi/rhi/interop/vulkan_cuda_interop.cpp +++ b/taichi/rhi/interop/vulkan_cuda_interop.cpp @@ -9,8 +9,7 @@ #include -namespace taichi { -namespace lang { +namespace taichi::lang { #if TI_WITH_VULKAN && TI_WITH_CUDA @@ -228,5 +227,4 @@ void memcpy_vulkan_to_cuda(DevicePtr dst, DevicePtr src, uint64_t size) { } #endif // TI_WITH_VULKAN && TI_WITH_CUDA -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/interop/vulkan_cuda_interop.h b/taichi/rhi/interop/vulkan_cuda_interop.h index 22bc32b68a401..dac441644572e 100644 --- a/taichi/rhi/interop/vulkan_cuda_interop.h +++ b/taichi/rhi/interop/vulkan_cuda_interop.h @@ -2,12 +2,10 @@ #include "taichi/rhi/device.h" -namespace taichi { -namespace lang { +namespace taichi::lang { void memcpy_cuda_to_vulkan(DevicePtr dst, DevicePtr src, uint64_t size); void memcpy_vulkan_to_cuda(DevicePtr dst, DevicePtr src, uint64_t size); -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/llvm/llvm_device.cpp b/taichi/rhi/llvm/llvm_device.cpp index 21b122b4b0a8c..a115f42e9c77e 100644 --- a/taichi/rhi/llvm/llvm_device.cpp +++ b/taichi/rhi/llvm/llvm_device.cpp @@ -1,7 +1,6 @@ #include "taichi/rhi/llvm/llvm_device.h" -namespace taichi { -namespace lang { +namespace taichi::lang { uint64_t *LlvmDevice::allocate_llvm_runtime_memory_jit( const LlvmRuntimeAllocParams ¶ms) { @@ -12,5 +11,4 @@ uint64_t *LlvmDevice::allocate_llvm_runtime_memory_jit( taichi_result_buffer_runtime_query_id, params.result_buffer)); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/llvm/llvm_device.h b/taichi/rhi/llvm/llvm_device.h index c8ea58ed2a001..1b27b660f71a9 100644 --- a/taichi/rhi/llvm/llvm_device.h +++ b/taichi/rhi/llvm/llvm_device.h @@ -2,8 +2,7 @@ #include "taichi/rhi/device.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class LlvmDevice : public Device { public: @@ -23,5 +22,4 @@ class LlvmDevice : public Device { const LlvmRuntimeAllocParams ¶ms); }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/metal/constants.h b/taichi/rhi/metal/constants.h index 9894a3c2b8196..72ac15e5385d0 100644 --- a/taichi/rhi/metal/constants.h +++ b/taichi/rhi/metal/constants.h @@ -4,8 +4,7 @@ #include "taichi/inc/constants.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace metal { inline constexpr int kMaxNumThreadsGridStrideLoop = 64 * 1024; @@ -14,5 +13,4 @@ inline constexpr int kMslVersionNone = 0; inline constexpr int kMaxNumSNodes = taichi_max_num_snodes; } // namespace metal -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/metal/device.cpp b/taichi/rhi/metal/device.cpp index d683648cc1f08..a201c1ae21b93 100644 --- a/taichi/rhi/metal/device.cpp +++ b/taichi/rhi/metal/device.cpp @@ -5,8 +5,7 @@ #include "taichi/rhi/metal/constants.h" #include "taichi/runtime/metal/runtime_utils.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace metal { #ifdef TI_PLATFORM_OSX @@ -422,5 +421,4 @@ MakeDeviceResult make_compute_device(const ComputeDeviceParams ¶ms) { #endif // TI_PLATFORM_OSX } // namespace metal -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/metal/device.h b/taichi/rhi/metal/device.h index 5685c141393c9..4c572e9403bcd 100644 --- a/taichi/rhi/metal/device.h +++ b/taichi/rhi/metal/device.h @@ -6,8 +6,7 @@ #include "taichi/runtime/metal/api.h" #include "taichi/runtime/metal/runtime_utils.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class MemoryPool; @@ -48,5 +47,4 @@ struct MakeDeviceResult { MakeDeviceResult make_compute_device(const ComputeDeviceParams ¶ms); } // namespace metal -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/opengl/opengl_api.cpp b/taichi/rhi/opengl/opengl_api.cpp index 4b82d6c368e08..326e5e81e0208 100644 --- a/taichi/rhi/opengl/opengl_api.cpp +++ b/taichi/rhi/opengl/opengl_api.cpp @@ -7,8 +7,7 @@ #include "GLFW/glfw3.h" #include "taichi/rhi/opengl/opengl_device.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace opengl { #define PER_OPENGL_EXTENSION(x) bool opengl_extension_##x; @@ -218,5 +217,4 @@ std::shared_ptr make_opengl_device() { } } // namespace opengl -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/opengl/opengl_api.h b/taichi/rhi/opengl/opengl_api.h index 5dda638ac87a1..e13919343f3e6 100644 --- a/taichi/rhi/opengl/opengl_api.h +++ b/taichi/rhi/opengl/opengl_api.h @@ -3,8 +3,7 @@ #include "taichi/common/core.h" #include "taichi/rhi/device.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace opengl { bool initialize_opengl(bool use_gles = false, bool error_tolerance = false); @@ -18,5 +17,4 @@ std::shared_ptr make_opengl_device(); #undef PER_OPENGL_EXTENSION } // namespace opengl -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/opengl/opengl_device.cpp b/taichi/rhi/opengl/opengl_device.cpp index 6f47ef2b01a94..9c78bf96110b9 100644 --- a/taichi/rhi/opengl/opengl_device.cpp +++ b/taichi/rhi/opengl/opengl_device.cpp @@ -3,8 +3,7 @@ #include "spirv_glsl.hpp" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace opengl { namespace { @@ -886,5 +885,4 @@ void GLCommandList::CmdImageToBuffer::execute() { } } // namespace opengl -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/opengl/opengl_device.h b/taichi/rhi/opengl/opengl_device.h index 54b9e6bf8ae83..4d1ae1a1698b0 100644 --- a/taichi/rhi/opengl/opengl_device.h +++ b/taichi/rhi/opengl/opengl_device.h @@ -5,8 +5,7 @@ #include "glad/gl.h" #include "GLFW/glfw3.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace opengl { class GLDevice; @@ -320,5 +319,4 @@ class GLSurface : public Surface { }; } // namespace opengl -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/vulkan/vulkan_common.h b/taichi/rhi/vulkan/vulkan_common.h index 5ddf593bc8659..90cc6f393ef24 100644 --- a/taichi/rhi/vulkan/vulkan_common.h +++ b/taichi/rhi/vulkan/vulkan_common.h @@ -16,8 +16,7 @@ #include -namespace taichi { -namespace lang { +namespace taichi::lang { namespace vulkan { #define BAIL_ON_VK_BAD_RESULT(result, msg) \ @@ -30,5 +29,4 @@ namespace vulkan { inline constexpr VkAllocationCallbacks *kNoVkAllocCallbacks = nullptr; } // namespace vulkan -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/vulkan/vulkan_device.cpp b/taichi/rhi/vulkan/vulkan_device.cpp index a110bac8d2a6e..efe78cb4d433d 100644 --- a/taichi/rhi/vulkan/vulkan_device.cpp +++ b/taichi/rhi/vulkan/vulkan_device.cpp @@ -17,8 +17,7 @@ #include "spirv_reflect.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace vulkan { const std::unordered_map buffer_format_ti_2_vk = { @@ -2670,5 +2669,4 @@ VulkanStream::~VulkanStream() { } } // namespace vulkan -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/vulkan/vulkan_device.h b/taichi/rhi/vulkan/vulkan_device.h index 3c760075589e6..cd59877dfb23a 100644 --- a/taichi/rhi/vulkan/vulkan_device.h +++ b/taichi/rhi/vulkan/vulkan_device.h @@ -17,8 +17,7 @@ #include #include -namespace taichi { -namespace lang { +namespace taichi::lang { namespace vulkan { using std::unordered_map; @@ -740,5 +739,4 @@ VkFormat buffer_format_ti_to_vk(BufferFormat f); BufferFormat buffer_format_vk_to_ti(VkFormat f); } // namespace vulkan -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/vulkan/vulkan_device_creator.cpp b/taichi/rhi/vulkan/vulkan_device_creator.cpp index 6f476b1a24ea7..081be938d9d79 100644 --- a/taichi/rhi/vulkan/vulkan_device_creator.cpp +++ b/taichi/rhi/vulkan/vulkan_device_creator.cpp @@ -11,8 +11,7 @@ #include "taichi/rhi/vulkan/vulkan_device.h" #include "taichi/common/logging.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace vulkan { namespace { @@ -776,5 +775,4 @@ void VulkanDeviceCreator::create_logical_device(bool manual_create) { } } // namespace vulkan -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/vulkan/vulkan_device_creator.h b/taichi/rhi/vulkan/vulkan_device_creator.h index 1574a35875562..6f744d8cb6cff 100644 --- a/taichi/rhi/vulkan/vulkan_device_creator.h +++ b/taichi/rhi/vulkan/vulkan_device_creator.h @@ -14,8 +14,7 @@ #include #include -namespace taichi { -namespace lang { +namespace taichi::lang { namespace vulkan { class VulkanDevice; @@ -99,5 +98,4 @@ class TI_DLL_EXPORT VulkanDeviceCreator { }; } // namespace vulkan -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/vulkan/vulkan_loader.cpp b/taichi/rhi/vulkan/vulkan_loader.cpp index 220a04e16081c..e7a810d64af30 100644 --- a/taichi/rhi/vulkan/vulkan_loader.cpp +++ b/taichi/rhi/vulkan/vulkan_loader.cpp @@ -8,8 +8,7 @@ #include "GLFW/glfw3.h" #endif -namespace taichi { -namespace lang { +namespace taichi::lang { namespace vulkan { VulkanLoader::VulkanLoader() { @@ -142,5 +141,4 @@ void set_vulkan_visible_device(std::string id) { } } // namespace vulkan -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/vulkan/vulkan_loader.h b/taichi/rhi/vulkan/vulkan_loader.h index 32467912bc9ca..f5589dd679f3a 100644 --- a/taichi/rhi/vulkan/vulkan_loader.h +++ b/taichi/rhi/vulkan/vulkan_loader.h @@ -6,8 +6,7 @@ #include "taichi/rhi/vulkan/vulkan_common.h" #include "taichi/system/dynamic_loader.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace vulkan { class TI_DLL_EXPORT VulkanLoader { @@ -51,5 +50,4 @@ TI_DLL_EXPORT bool is_vulkan_api_available(); TI_DLL_EXPORT void set_vulkan_visible_device(std::string id); } // namespace vulkan -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/rhi/vulkan/vulkan_utils.h b/taichi/rhi/vulkan/vulkan_utils.h index 6c40fad48722d..721cad84630e1 100644 --- a/taichi/rhi/vulkan/vulkan_utils.h +++ b/taichi/rhi/vulkan/vulkan_utils.h @@ -15,8 +15,7 @@ #include #include -namespace taichi { -namespace lang { +namespace taichi::lang { namespace vulkan { class VulkanEnvSettings { @@ -101,5 +100,4 @@ inline WindowsSecurityAttributes::~WindowsSecurityAttributes() { #endif //_WIN64 } // namespace vulkan -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/cpu/aot_module_builder_impl.cpp b/taichi/runtime/cpu/aot_module_builder_impl.cpp index b2c81c71792a5..18ddf76575538 100644 --- a/taichi/runtime/cpu/aot_module_builder_impl.cpp +++ b/taichi/runtime/cpu/aot_module_builder_impl.cpp @@ -5,8 +5,7 @@ #include "taichi/codegen/cpu/codegen_cpu.h" #include "taichi/runtime/llvm/launch_arg_info.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace cpu { LLVMCompiledKernel AotModuleBuilderImpl::compile_kernel(Kernel *kernel) { @@ -15,5 +14,4 @@ LLVMCompiledKernel AotModuleBuilderImpl::compile_kernel(Kernel *kernel) { } } // namespace cpu -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/cpu/aot_module_builder_impl.h b/taichi/runtime/cpu/aot_module_builder_impl.h index 9bf2d3a30136b..c324a3a714914 100644 --- a/taichi/runtime/cpu/aot_module_builder_impl.h +++ b/taichi/runtime/cpu/aot_module_builder_impl.h @@ -4,8 +4,7 @@ #include "taichi/runtime/llvm/llvm_offline_cache.h" #include "taichi/runtime/llvm/llvm_aot_module_builder.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace cpu { class AotModuleBuilderImpl : public LlvmAotModuleBuilder { @@ -19,5 +18,4 @@ class AotModuleBuilderImpl : public LlvmAotModuleBuilder { }; } // namespace cpu -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/cpu/aot_module_loader_impl.cpp b/taichi/runtime/cpu/aot_module_loader_impl.cpp index bfe63e4370fa8..f802b3d64eb3a 100644 --- a/taichi/runtime/cpu/aot_module_loader_impl.cpp +++ b/taichi/runtime/cpu/aot_module_loader_impl.cpp @@ -5,8 +5,7 @@ #include "taichi/runtime/llvm/llvm_runtime_executor.h" #include "taichi/codegen/cpu/codegen_cpu.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { class AotModuleImpl : public LlvmAotModule { @@ -46,5 +45,4 @@ std::unique_ptr make_aot_module(std::any mod_params) { } } // namespace cpu -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/cpu/aot_module_loader_impl.h b/taichi/runtime/cpu/aot_module_loader_impl.h index f27fc7cf9d26a..45378c37edc61 100644 --- a/taichi/runtime/cpu/aot_module_loader_impl.h +++ b/taichi/runtime/cpu/aot_module_loader_impl.h @@ -2,8 +2,7 @@ #include "taichi/aot/module_loader.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class LlvmRuntimeExecutor; @@ -17,5 +16,4 @@ struct TI_DLL_EXPORT AotModuleParams { TI_DLL_EXPORT std::unique_ptr make_aot_module(std::any mod_params); } // namespace cpu -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/cpu/jit_cpu.cpp b/taichi/runtime/cpu/jit_cpu.cpp index 415f99ea95a96..578d50c620283 100644 --- a/taichi/runtime/cpu/jit_cpu.cpp +++ b/taichi/runtime/cpu/jit_cpu.cpp @@ -361,4 +361,4 @@ std::unique_ptr create_llvm_jit_session_cpu( #endif } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/runtime/cuda/aot_module_builder_impl.cpp b/taichi/runtime/cuda/aot_module_builder_impl.cpp index 6669f899745be..e9a8072bfb1b8 100644 --- a/taichi/runtime/cuda/aot_module_builder_impl.cpp +++ b/taichi/runtime/cuda/aot_module_builder_impl.cpp @@ -5,8 +5,7 @@ #include "taichi/codegen/cuda/codegen_cuda.h" #include "taichi/runtime/llvm/launch_arg_info.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace cuda { LLVMCompiledKernel AotModuleBuilderImpl::compile_kernel(Kernel *kernel) { @@ -15,5 +14,4 @@ LLVMCompiledKernel AotModuleBuilderImpl::compile_kernel(Kernel *kernel) { } } // namespace cuda -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/cuda/aot_module_builder_impl.h b/taichi/runtime/cuda/aot_module_builder_impl.h index 278c403b0d7d5..9a449176bebb6 100644 --- a/taichi/runtime/cuda/aot_module_builder_impl.h +++ b/taichi/runtime/cuda/aot_module_builder_impl.h @@ -4,8 +4,7 @@ #include "taichi/runtime/llvm/llvm_offline_cache.h" #include "taichi/runtime/llvm/llvm_aot_module_builder.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace cuda { class AotModuleBuilderImpl : public LlvmAotModuleBuilder { @@ -19,5 +18,4 @@ class AotModuleBuilderImpl : public LlvmAotModuleBuilder { }; } // namespace cuda -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/cuda/aot_module_loader_impl.cpp b/taichi/runtime/cuda/aot_module_loader_impl.cpp index 1c0a9285cf762..1b13d21e6d8e9 100644 --- a/taichi/runtime/cuda/aot_module_loader_impl.cpp +++ b/taichi/runtime/cuda/aot_module_loader_impl.cpp @@ -5,8 +5,7 @@ #include "taichi/runtime/llvm/llvm_runtime_executor.h" #include "taichi/codegen/cuda/codegen_cuda.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { class AotModuleImpl : public LlvmAotModule { @@ -46,5 +45,4 @@ std::unique_ptr make_aot_module(std::any mod_params) { } } // namespace cuda -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/cuda/aot_module_loader_impl.h b/taichi/runtime/cuda/aot_module_loader_impl.h index 3bd0040d5ebc9..e2d9bc79a0a5e 100644 --- a/taichi/runtime/cuda/aot_module_loader_impl.h +++ b/taichi/runtime/cuda/aot_module_loader_impl.h @@ -2,8 +2,7 @@ #include "taichi/aot/module_loader.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class LlvmRuntimeExecutor; @@ -17,5 +16,4 @@ struct TI_DLL_EXPORT AotModuleParams { TI_DLL_EXPORT std::unique_ptr make_aot_module(std::any mod_params); } // namespace cuda -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/cuda/jit_cuda.cpp b/taichi/runtime/cuda/jit_cuda.cpp index 248076a5ea5d1..46f47695a7f93 100644 --- a/taichi/runtime/cuda/jit_cuda.cpp +++ b/taichi/runtime/cuda/jit_cuda.cpp @@ -258,4 +258,4 @@ std::unique_ptr create_llvm_jit_session_cuda( } #endif -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/runtime/cuda/jit_cuda.h b/taichi/runtime/cuda/jit_cuda.h index 79155991704ab..183eb4d3f69ab 100644 --- a/taichi/runtime/cuda/jit_cuda.h +++ b/taichi/runtime/cuda/jit_cuda.h @@ -110,4 +110,4 @@ std::unique_ptr create_llvm_jit_session_cuda( CompileConfig *config, Arch arch); -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/runtime/cuda/runtime.cpp b/taichi/runtime/cuda/runtime.cpp index 56ed658157bb1..47365cf6a0374 100644 --- a/taichi/runtime/cuda/runtime.cpp +++ b/taichi/runtime/cuda/runtime.cpp @@ -37,4 +37,4 @@ static class RuntimeCUDAInjector { } } injector; -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/runtime/dx12/aot_module_builder_impl.cpp b/taichi/runtime/dx12/aot_module_builder_impl.cpp index 95f4ab97103b1..818df6ee354ba 100644 --- a/taichi/runtime/dx12/aot_module_builder_impl.cpp +++ b/taichi/runtime/dx12/aot_module_builder_impl.cpp @@ -6,8 +6,7 @@ #include "taichi/runtime/llvm/launch_arg_info.h" #include "taichi/runtime/program_impls/llvm/llvm_program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace directx12 { AotModuleBuilderImpl::AotModuleBuilderImpl(LlvmProgramImpl *prog) : prog(prog) { @@ -47,5 +46,4 @@ void AotModuleBuilderImpl::dump(const std::string &output_dir, } } // namespace directx12 -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/dx12/aot_module_builder_impl.h b/taichi/runtime/dx12/aot_module_builder_impl.h index e7993cd2c3c0a..6c903ad57da51 100644 --- a/taichi/runtime/dx12/aot_module_builder_impl.h +++ b/taichi/runtime/dx12/aot_module_builder_impl.h @@ -5,8 +5,7 @@ #include "taichi/runtime/llvm/llvm_aot_module_builder.h" #include "taichi/aot/module_data.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace directx12 { struct ModuleDataDX12 : public aot::ModuleData { @@ -42,5 +41,4 @@ class AotModuleBuilderImpl : public AotModuleBuilder { }; } // namespace directx12 -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/gfx/aot_graph_data.h b/taichi/runtime/gfx/aot_graph_data.h index b9d8b4315ab65..10372f996120c 100644 --- a/taichi/runtime/gfx/aot_graph_data.h +++ b/taichi/runtime/gfx/aot_graph_data.h @@ -1,8 +1,7 @@ #pragma once #include "taichi/runtime/gfx/runtime.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace gfx { class KernelImpl : public aot::Kernel { public: @@ -25,5 +24,4 @@ class KernelImpl : public aot::Kernel { const GfxRuntime::RegisterParams params_; }; } // namespace gfx -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/gfx/aot_module_builder_impl.cpp b/taichi/runtime/gfx/aot_module_builder_impl.cpp index 364a1657dfb91..d2bf803778a75 100644 --- a/taichi/runtime/gfx/aot_module_builder_impl.cpp +++ b/taichi/runtime/gfx/aot_module_builder_impl.cpp @@ -7,8 +7,7 @@ #include "taichi/codegen/spirv/spirv_codegen.h" #include "taichi/runtime/gfx/aot_graph_data.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace gfx { namespace { @@ -256,5 +255,4 @@ void AotModuleBuilderImpl::add_per_backend_tmpl(const std::string &identifier, } } // namespace gfx -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/gfx/aot_module_builder_impl.h b/taichi/runtime/gfx/aot_module_builder_impl.h index 290bc72b6d9b1..86cc9340ba290 100644 --- a/taichi/runtime/gfx/aot_module_builder_impl.h +++ b/taichi/runtime/gfx/aot_module_builder_impl.h @@ -9,8 +9,7 @@ #include "taichi/codegen/spirv/snode_struct_compiler.h" #include "taichi/codegen/spirv/kernel_utils.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace gfx { class AotModuleBuilderImpl : public AotModuleBuilder { @@ -57,5 +56,4 @@ class AotModuleBuilderImpl : public AotModuleBuilder { }; } // namespace gfx -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/gfx/aot_module_loader_impl.cpp b/taichi/runtime/gfx/aot_module_loader_impl.cpp index 4ec285e69f055..689db753966ce 100644 --- a/taichi/runtime/gfx/aot_module_loader_impl.cpp +++ b/taichi/runtime/gfx/aot_module_loader_impl.cpp @@ -6,8 +6,7 @@ #include "taichi/runtime/gfx/runtime.h" #include "taichi/aot/graph_data.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace gfx { namespace { class FieldImpl : public aot::Field { @@ -195,5 +194,4 @@ std::unique_ptr make_aot_module(std::any mod_params, } } // namespace gfx -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/gfx/aot_module_loader_impl.h b/taichi/runtime/gfx/aot_module_loader_impl.h index 2a211a171b2de..2557d07a59913 100644 --- a/taichi/runtime/gfx/aot_module_loader_impl.h +++ b/taichi/runtime/gfx/aot_module_loader_impl.h @@ -12,8 +12,7 @@ #include "taichi/aot/module_builder.h" #include "taichi/aot/module_loader.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace gfx { struct TI_DLL_EXPORT AotModuleParams { @@ -33,5 +32,4 @@ TI_DLL_EXPORT std::unique_ptr make_aot_module( Arch device_api_backend); } // namespace gfx -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/gfx/aot_utils.h b/taichi/runtime/gfx/aot_utils.h index 2bfdc367f57f1..308f8de86e7ce 100644 --- a/taichi/runtime/gfx/aot_utils.h +++ b/taichi/runtime/gfx/aot_utils.h @@ -6,8 +6,7 @@ #include "taichi/codegen/spirv/kernel_utils.h" #include "taichi/aot/module_loader.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace gfx { /** @@ -25,5 +24,4 @@ struct TaichiAotData { }; } // namespace gfx -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/gfx/runtime.cpp b/taichi/runtime/gfx/runtime.cpp index f095ec3b21271..a7305214725fa 100644 --- a/taichi/runtime/gfx/runtime.cpp +++ b/taichi/runtime/gfx/runtime.cpp @@ -16,8 +16,7 @@ #include "taichi/program/context.h" #undef TI_RUNTIME_HOST -namespace taichi { -namespace lang { +namespace taichi::lang { namespace gfx { namespace { @@ -741,5 +740,4 @@ GfxRuntime::RegisterParams run_codegen( } } // namespace gfx -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/gfx/runtime.h b/taichi/runtime/gfx/runtime.h index 9e9116fbc78b2..7afa88a3e3dfb 100644 --- a/taichi/runtime/gfx/runtime.h +++ b/taichi/runtime/gfx/runtime.h @@ -13,8 +13,7 @@ #include "taichi/program/snode_expr_utils.h" #include "taichi/program/program_impl.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace gfx { using namespace taichi::lang::spirv; @@ -162,5 +161,4 @@ GfxRuntime::RegisterParams run_codegen( const std::vector &compiled_structs); } // namespace gfx -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/gfx/snode_tree_manager.cpp b/taichi/runtime/gfx/snode_tree_manager.cpp index 9c5697c18dcc9..e3f88de6818dc 100644 --- a/taichi/runtime/gfx/snode_tree_manager.cpp +++ b/taichi/runtime/gfx/snode_tree_manager.cpp @@ -2,8 +2,7 @@ #include "taichi/runtime/gfx/runtime.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace gfx { SNodeTreeManager::SNodeTreeManager(GfxRuntime *rtm) : runtime_(rtm) { @@ -52,5 +51,4 @@ DevicePtr SNodeTreeManager::get_snode_tree_device_ptr(int tree_id) { } } // namespace gfx -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/gfx/snode_tree_manager.h b/taichi/runtime/gfx/snode_tree_manager.h index 99adefc2a8b85..43206a5f11210 100644 --- a/taichi/runtime/gfx/snode_tree_manager.h +++ b/taichi/runtime/gfx/snode_tree_manager.h @@ -6,8 +6,7 @@ #include "taichi/codegen/spirv/snode_struct_compiler.h" #include "taichi/struct/snode_tree.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace gfx { class GfxRuntime; @@ -41,5 +40,4 @@ class SNodeTreeManager { }; } // namespace gfx -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/llvm/aot_graph_data.h b/taichi/runtime/llvm/aot_graph_data.h index b772adfed1ee0..007e05acde64b 100644 --- a/taichi/runtime/llvm/aot_graph_data.h +++ b/taichi/runtime/llvm/aot_graph_data.h @@ -3,8 +3,7 @@ #include "taichi/aot/graph_data.h" #include "taichi/aot/module_loader.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace llvm_aot { class KernelImpl : public aot::Kernel { @@ -47,5 +46,4 @@ class FieldImpl : public aot::Field { }; } // namespace llvm_aot -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/llvm/launch_arg_info.cpp b/taichi/runtime/llvm/launch_arg_info.cpp index b44b4c4e4792d..1037d51ac9610 100644 --- a/taichi/runtime/llvm/launch_arg_info.cpp +++ b/taichi/runtime/llvm/launch_arg_info.cpp @@ -2,8 +2,7 @@ #include "taichi/program/kernel.h" -namespace taichi { -namespace lang { +namespace taichi::lang { bool LlvmLaunchArgInfo::operator==(const LlvmLaunchArgInfo &other) const { return is_array == other.is_array; @@ -18,5 +17,4 @@ std::vector infer_launch_args(const Kernel *kernel) { return res; } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/llvm/launch_arg_info.h b/taichi/runtime/llvm/launch_arg_info.h index 1227c8b8f4911..b0d0130850770 100644 --- a/taichi/runtime/llvm/launch_arg_info.h +++ b/taichi/runtime/llvm/launch_arg_info.h @@ -5,8 +5,7 @@ #include "taichi/common/core.h" #include "taichi/common/serialization.h" -namespace taichi { -namespace lang { +namespace taichi::lang { // TODO: It would be better if this can be unified with Callable::Arg. However, // Callable::Arg is not easily serializable. @@ -25,5 +24,4 @@ class Kernel; std::vector infer_launch_args(const Kernel *kernel); -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/llvm/llvm_aot_module_builder.cpp b/taichi/runtime/llvm/llvm_aot_module_builder.cpp index c8e61c4484325..1eb9f4411edda 100644 --- a/taichi/runtime/llvm/llvm_aot_module_builder.cpp +++ b/taichi/runtime/llvm/llvm_aot_module_builder.cpp @@ -5,8 +5,7 @@ #include "taichi/runtime/program_impls/llvm/llvm_program.h" #include "taichi/runtime/llvm/aot_graph_data.h" -namespace taichi { -namespace lang { +namespace taichi::lang { void LlvmAotModuleBuilder::dump(const std::string &output_dir, const std::string &filename) const { @@ -74,5 +73,4 @@ void LlvmAotModuleBuilder::add_compiled_kernel(aot::Kernel *kernel) { } } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/llvm/llvm_aot_module_builder.h b/taichi/runtime/llvm/llvm_aot_module_builder.h index 2efa9b496b88f..6e6b313ce80c5 100644 --- a/taichi/runtime/llvm/llvm_aot_module_builder.h +++ b/taichi/runtime/llvm/llvm_aot_module_builder.h @@ -4,8 +4,7 @@ #include "taichi/runtime/llvm/llvm_offline_cache.h" #include "taichi/codegen/llvm/codegen_llvm.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class LlvmAotModuleBuilder : public AotModuleBuilder { public: @@ -38,5 +37,4 @@ class LlvmAotModuleBuilder : public AotModuleBuilder { LlvmProgramImpl *prog_ = nullptr; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/llvm/llvm_aot_module_loader.cpp b/taichi/runtime/llvm/llvm_aot_module_loader.cpp index 028483c96e780..45cf8baf8922d 100644 --- a/taichi/runtime/llvm/llvm_aot_module_loader.cpp +++ b/taichi/runtime/llvm/llvm_aot_module_loader.cpp @@ -1,8 +1,7 @@ #include "taichi/runtime/llvm/llvm_aot_module_loader.h" #include "taichi/runtime/llvm/aot_graph_data.h" -namespace taichi { -namespace lang { +namespace taichi::lang { LlvmOfflineCache::KernelCacheData LlvmAotModule::load_kernel_from_cache( const std::string &name) { @@ -80,5 +79,4 @@ void allocate_aot_snode_tree_type(aot::Module *aot_module, } } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/llvm/llvm_aot_module_loader.h b/taichi/runtime/llvm/llvm_aot_module_loader.h index cbb1f0f1d40e6..ce8e36cda113c 100644 --- a/taichi/runtime/llvm/llvm_aot_module_loader.h +++ b/taichi/runtime/llvm/llvm_aot_module_loader.h @@ -3,8 +3,7 @@ #include "taichi/aot/module_loader.h" #include "taichi/runtime/llvm/llvm_runtime_executor.h" -namespace taichi { -namespace lang { +namespace taichi::lang { /* TODO(zhanlue) refactor this interface once SNodeTreeType is available The "aot::Field" created by "make_new_field()" is a SNodeTree in essense. @@ -82,5 +81,4 @@ class LlvmAotModule : public aot::Module { std::unordered_set initialized_snode_tree_ids; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/llvm/llvm_context.cpp b/taichi/runtime/llvm/llvm_context.cpp index 5689ff71ba513..0fda8cf179ce2 100644 --- a/taichi/runtime/llvm/llvm_context.cpp +++ b/taichi/runtime/llvm/llvm_context.cpp @@ -58,8 +58,7 @@ #include "taichi/rhi/cuda/cuda_context.h" #endif -namespace taichi { -namespace lang { +namespace taichi::lang { using namespace llvm; @@ -1000,5 +999,4 @@ std::string TaichiLLVMContext::get_struct_for_func_name(int tls_size) { TI_REGISTER_TASK(make_slim_libdevice); -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/llvm/llvm_context.h b/taichi/runtime/llvm/llvm_context.h index 9735a18acf503..9ca2ddf4408e6 100644 --- a/taichi/runtime/llvm/llvm_context.h +++ b/taichi/runtime/llvm/llvm_context.h @@ -15,8 +15,7 @@ #include "taichi/jit/jit_session.h" #include "taichi/codegen/llvm/llvm_compiled_data.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class JITSessionCPU; class LlvmProgramImpl; @@ -205,5 +204,4 @@ std::unique_ptr module_from_bitcode_file( const std::string &bitcode_path, llvm::LLVMContext *ctx); -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/llvm/llvm_offline_cache.cpp b/taichi/runtime/llvm/llvm_offline_cache.cpp index 70d6bf853889f..f91a9567735ca 100644 --- a/taichi/runtime/llvm/llvm_offline_cache.cpp +++ b/taichi/runtime/llvm/llvm_offline_cache.cpp @@ -19,8 +19,7 @@ #include "taichi/util/lock.h" #include "taichi/util/offline_cache.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { using Format = LlvmOfflineCache::Format; @@ -400,5 +399,4 @@ LlvmOfflineCache::KernelCacheData LlvmOfflineCache::KernelCacheData::clone() const { return {kernel_key, args, compiled_data.clone()}; } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/llvm/llvm_offline_cache.h b/taichi/runtime/llvm/llvm_offline_cache.h index 5142da03bb4a1..f99643a0052ef 100644 --- a/taichi/runtime/llvm/llvm_offline_cache.h +++ b/taichi/runtime/llvm/llvm_offline_cache.h @@ -11,8 +11,7 @@ #include "taichi/util/offline_cache.h" #include "taichi/codegen/llvm/llvm_compiled_data.h" -namespace taichi { -namespace lang { +namespace taichi::lang { struct LlvmOfflineCache { using Version = uint16[3]; // {MAJOR, MINOR, PATCH} @@ -178,6 +177,5 @@ class LlvmOfflineCacheFileWriter { bool mangled_{false}; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang #endif // TI_WITH_LLVM diff --git a/taichi/runtime/llvm/llvm_runtime_executor.cpp b/taichi/runtime/llvm/llvm_runtime_executor.cpp index 576b31ea21646..447ccb4270317 100644 --- a/taichi/runtime/llvm/llvm_runtime_executor.cpp +++ b/taichi/runtime/llvm/llvm_runtime_executor.cpp @@ -11,8 +11,7 @@ #include "taichi/rhi/cuda/cuda_context.h" #endif -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { void assert_failed_host(const char *msg) { TI_ERROR("Assertion failure: {}", msg); @@ -629,5 +628,4 @@ void LlvmRuntimeExecutor::prepare_runtime_context(RuntimeContext *ctx) { ctx->runtime = get_llvm_runtime(); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/llvm/llvm_runtime_executor.h b/taichi/runtime/llvm/llvm_runtime_executor.h index 901f2b27154cf..85cc3def851e0 100644 --- a/taichi/runtime/llvm/llvm_runtime_executor.h +++ b/taichi/runtime/llvm/llvm_runtime_executor.h @@ -20,8 +20,7 @@ #include "taichi/program/context.h" #undef TI_RUNTIME_HOST -namespace taichi { -namespace lang { +namespace taichi::lang { namespace cuda { class CudaDevice; @@ -162,7 +161,6 @@ class LlvmRuntimeExecutor { friend SNodeTreeBufferManager; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang #endif // TI_WITH_LLVM diff --git a/taichi/runtime/llvm/runtime_module/mem_request.h b/taichi/runtime/llvm/runtime_module/mem_request.h index 0bfe567e4036b..9ebdce7c95f31 100644 --- a/taichi/runtime/llvm/runtime_module/mem_request.h +++ b/taichi/runtime/llvm/runtime_module/mem_request.h @@ -4,8 +4,7 @@ #include "taichi/inc/constants.h" #if defined(TI_RUNTIME_HOST) -namespace taichi { -namespace lang { +namespace taichi::lang { #endif struct MemRequest { @@ -24,6 +23,5 @@ struct MemRequestQueue { }; #if defined(TI_RUNTIME_HOST) -} // namespace lang -} // namespace taichi +} // namespace taichi::lang #endif diff --git a/taichi/runtime/llvm/snode_tree_buffer_manager.cpp b/taichi/runtime/llvm/snode_tree_buffer_manager.cpp index e72b48aefc8ad..7b8a81e9ee266 100644 --- a/taichi/runtime/llvm/snode_tree_buffer_manager.cpp +++ b/taichi/runtime/llvm/snode_tree_buffer_manager.cpp @@ -79,4 +79,4 @@ void SNodeTreeBufferManager::destroy(SNodeTree *snode_tree) { TI_DEBUG("SNode tree {} destroyed.", snode_tree_id); } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/runtime/llvm/snode_tree_buffer_manager.h b/taichi/runtime/llvm/snode_tree_buffer_manager.h index 17101268a6573..b5a6edb644349 100644 --- a/taichi/runtime/llvm/snode_tree_buffer_manager.h +++ b/taichi/runtime/llvm/snode_tree_buffer_manager.h @@ -35,4 +35,4 @@ class SNodeTreeBufferManager { std::size_t sizes_[kMaxNumSnodeTreesLlvm]; }; -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/runtime/metal/aot_module_builder_impl.cpp b/taichi/runtime/metal/aot_module_builder_impl.cpp index 4abedfdcc5639..ffdcba25a3b44 100644 --- a/taichi/runtime/metal/aot_module_builder_impl.cpp +++ b/taichi/runtime/metal/aot_module_builder_impl.cpp @@ -4,8 +4,7 @@ #include "taichi/codegen/metal/codegen_metal.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace metal { AotModuleBuilderImpl::AotModuleBuilderImpl( @@ -104,5 +103,4 @@ void AotModuleBuilderImpl::add_per_backend_tmpl(const std::string &identifier, } } // namespace metal -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/metal/aot_module_builder_impl.h b/taichi/runtime/metal/aot_module_builder_impl.h index c62580edf176a..04846a0d3f211 100644 --- a/taichi/runtime/metal/aot_module_builder_impl.h +++ b/taichi/runtime/metal/aot_module_builder_impl.h @@ -8,8 +8,7 @@ #include "taichi/runtime/metal/aot_utils.h" #include "taichi/codegen/metal/struct_metal.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace metal { class AotModuleBuilderImpl : public AotModuleBuilder { @@ -50,5 +49,4 @@ class AotModuleBuilderImpl : public AotModuleBuilder { }; } // namespace metal -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/metal/aot_module_loader_impl.cpp b/taichi/runtime/metal/aot_module_loader_impl.cpp index 540cddfecf4b2..4008f62399c52 100644 --- a/taichi/runtime/metal/aot_module_loader_impl.cpp +++ b/taichi/runtime/metal/aot_module_loader_impl.cpp @@ -3,8 +3,7 @@ #include "taichi/runtime/metal/aot_utils.h" #include "taichi/runtime/metal/kernel_manager.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace metal { namespace { @@ -107,5 +106,4 @@ std::unique_ptr make_aot_module(std::any mod_params) { } } // namespace metal -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/metal/aot_module_loader_impl.h b/taichi/runtime/metal/aot_module_loader_impl.h index 04cc71f494f78..43ed12451c3f4 100644 --- a/taichi/runtime/metal/aot_module_loader_impl.h +++ b/taichi/runtime/metal/aot_module_loader_impl.h @@ -6,8 +6,7 @@ #include "taichi/aot/module_loader.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace metal { class KernelManager; @@ -19,5 +18,4 @@ struct AotModuleParams { std::unique_ptr make_aot_module(std::any mod_params); } // namespace metal -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/metal/aot_utils.h b/taichi/runtime/metal/aot_utils.h index fdac85474aaa1..9ff52b6431f96 100644 --- a/taichi/runtime/metal/aot_utils.h +++ b/taichi/runtime/metal/aot_utils.h @@ -4,8 +4,7 @@ #include "taichi/runtime/metal/kernel_utils.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace metal { /** @@ -21,5 +20,4 @@ struct TaichiAotData { }; } // namespace metal -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/metal/api.cpp b/taichi/runtime/metal/api.cpp index 3a21192cb0562..92236bfd0933d 100644 --- a/taichi/runtime/metal/api.cpp +++ b/taichi/runtime/metal/api.cpp @@ -3,8 +3,7 @@ #include "taichi/rhi/metal/constants.h" #include "taichi/util/environ_config.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace metal { #ifdef TI_PLATFORM_OSX @@ -195,5 +194,4 @@ bool is_metal_api_available() { } } // namespace metal -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/metal/api.h b/taichi/runtime/metal/api.h index 07e5c7f483d5c..a11af1cb4e36d 100644 --- a/taichi/runtime/metal/api.h +++ b/taichi/runtime/metal/api.h @@ -9,8 +9,7 @@ #include "taichi/util/lang_util.h" #include "taichi/platform/mac/objc_api.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace metal { // Expose these incomplete structs so that other modules (e.g. MetalRuntime) @@ -169,5 +168,4 @@ size_t get_max_total_threads_per_threadgroup( bool is_metal_api_available(); } // namespace metal -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/metal/data_types.cpp b/taichi/runtime/metal/data_types.cpp index 82800487d05cc..4f0c2f7201b5b 100644 --- a/taichi/runtime/metal/data_types.cpp +++ b/taichi/runtime/metal/data_types.cpp @@ -135,4 +135,4 @@ std::string metal_unary_op_type_symbol(UnaryOpType type) { } } // namespace metal -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/runtime/metal/data_types.h b/taichi/runtime/metal/data_types.h index d70eef11a14c0..da109fe0c4fa9 100644 --- a/taichi/runtime/metal/data_types.h +++ b/taichi/runtime/metal/data_types.h @@ -46,4 +46,4 @@ inline bool is_metal_binary_op_infix(BinaryOpType type) { } // namespace metal -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/runtime/metal/features.h b/taichi/runtime/metal/features.h index 903f4da0a0de4..81a8d13f549d4 100644 --- a/taichi/runtime/metal/features.h +++ b/taichi/runtime/metal/features.h @@ -14,4 +14,4 @@ inline bool is_supported_sparse_type(SNodeType t) { } // namespace metal -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/runtime/metal/kernel_manager.cpp b/taichi/runtime/metal/kernel_manager.cpp index 3b4cfa977308e..0ed8977afc806 100644 --- a/taichi/runtime/metal/kernel_manager.cpp +++ b/taichi/runtime/metal/kernel_manager.cpp @@ -31,8 +31,7 @@ #include "taichi/program/program.h" #endif // TI_PLATFORM_OSX -namespace taichi { -namespace lang { +namespace taichi::lang { namespace metal { #ifdef TI_PLATFORM_OSX @@ -1389,5 +1388,4 @@ DeviceAllocation KernelManager::allocate_memory( } } // namespace metal -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/metal/kernel_manager.h b/taichi/runtime/metal/kernel_manager.h index 376b3a09d59c4..cde2c34befd87 100644 --- a/taichi/runtime/metal/kernel_manager.h +++ b/taichi/runtime/metal/kernel_manager.h @@ -13,8 +13,7 @@ #include "taichi/program/kernel_profiler.h" #include "taichi/system/memory_pool.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class Kernel; struct RuntimeContext; @@ -83,5 +82,4 @@ class KernelManager { }; } // namespace metal -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/metal/kernel_utils.cpp b/taichi/runtime/metal/kernel_utils.cpp index 5f06725ca8858..6ee2ffc7c520c 100644 --- a/taichi/runtime/metal/kernel_utils.cpp +++ b/taichi/runtime/metal/kernel_utils.cpp @@ -7,8 +7,7 @@ #include "taichi/program/context.h" #undef TI_RUNTIME_HOST -namespace taichi { -namespace lang { +namespace taichi::lang { namespace metal { @@ -164,5 +163,4 @@ KernelContextAttributes::KernelContextAttributes(const Kernel &kernel) } // namespace metal -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/metal/kernel_utils.h b/taichi/runtime/metal/kernel_utils.h index db565bf2bd84e..edb7f9c41ada4 100644 --- a/taichi/runtime/metal/kernel_utils.h +++ b/taichi/runtime/metal/kernel_utils.h @@ -16,8 +16,7 @@ // compiled to more than one Metal compute kernels. Concretely, each offloaded // task in the Taichi kernel maps to a Metal kernel. -namespace taichi { -namespace lang { +namespace taichi::lang { class Kernel; class SNode; @@ -322,5 +321,4 @@ struct BufferMetaData { }; } // namespace metal -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/metal/runtime_utils.cpp b/taichi/runtime/metal/runtime_utils.cpp index be6c494478cfd..e92fd890a85cc 100644 --- a/taichi/runtime/metal/runtime_utils.cpp +++ b/taichi/runtime/metal/runtime_utils.cpp @@ -6,8 +6,7 @@ #include "taichi/math/arithmetic.h" #include "taichi/system/memory_pool.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace metal { BufferMemoryView::BufferMemoryView(std::size_t size, MemoryPool *mem_pool) { @@ -19,5 +18,4 @@ BufferMemoryView::BufferMemoryView(std::size_t size, MemoryPool *mem_pool) { } } // namespace metal -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/metal/runtime_utils.h b/taichi/runtime/metal/runtime_utils.h index ad5121b16b044..73606ce297c71 100644 --- a/taichi/runtime/metal/runtime_utils.h +++ b/taichi/runtime/metal/runtime_utils.h @@ -2,8 +2,7 @@ #include -namespace taichi { -namespace lang { +namespace taichi::lang { class MemoryPool; @@ -34,5 +33,4 @@ class BufferMemoryView { }; } // namespace metal -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/program_impls/dx/dx_program.cpp b/taichi/runtime/program_impls/dx/dx_program.cpp index 670735a2823f5..7e059f0145cd7 100644 --- a/taichi/runtime/program_impls/dx/dx_program.cpp +++ b/taichi/runtime/program_impls/dx/dx_program.cpp @@ -7,8 +7,7 @@ #include "taichi/runtime/gfx/snode_tree_manager.h" #include "taichi/runtime/gfx/aot_module_loader_impl.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace directx11 { FunctionType compile_to_executable(Kernel *kernel, @@ -90,7 +89,6 @@ std::unique_ptr Dx11ProgramImpl::make_aot_kernel(Kernel &kernel) { return std::make_unique(runtime_.get(), std::move(kparams)); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang #endif diff --git a/taichi/runtime/program_impls/dx/dx_program.h b/taichi/runtime/program_impls/dx/dx_program.h index 87f39fa7675ce..372fcc1e8a8d3 100644 --- a/taichi/runtime/program_impls/dx/dx_program.h +++ b/taichi/runtime/program_impls/dx/dx_program.h @@ -6,8 +6,7 @@ #include "taichi/runtime/gfx/snode_tree_manager.h" #include "taichi/program/program_impl.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class Dx11ProgramImpl : public ProgramImpl { public: @@ -71,7 +70,6 @@ class Dx11ProgramImpl : public ProgramImpl { std::vector aot_compiled_snode_structs_; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang #endif diff --git a/taichi/runtime/program_impls/llvm/llvm_program.cpp b/taichi/runtime/program_impls/llvm/llvm_program.cpp index 9aea9a0801ea2..27bc757908fb3 100644 --- a/taichi/runtime/program_impls/llvm/llvm_program.cpp +++ b/taichi/runtime/program_impls/llvm/llvm_program.cpp @@ -20,8 +20,7 @@ #include "taichi/codegen/dx12/codegen_dx12.h" #endif -namespace taichi { -namespace lang { +namespace taichi::lang { LlvmProgramImpl::LlvmProgramImpl(CompileConfig &config_, KernelProfilerBase *profiler) @@ -193,5 +192,4 @@ LlvmProgramImpl *get_llvm_program(Program *prog) { return llvm_prog; } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/program_impls/llvm/llvm_program.h b/taichi/runtime/program_impls/llvm/llvm_program.h index 2c5ab68e07faf..dad6f995ad81f 100644 --- a/taichi/runtime/program_impls/llvm/llvm_program.h +++ b/taichi/runtime/program_impls/llvm/llvm_program.h @@ -17,8 +17,7 @@ namespace llvm { class Module; } // namespace llvm -namespace taichi { -namespace lang { +namespace taichi::lang { class StructCompiler; class Program; @@ -299,5 +298,4 @@ class LlvmProgramImpl : public ProgramImpl { LlvmProgramImpl *get_llvm_program(Program *prog); -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/program_impls/metal/metal_program.cpp b/taichi/runtime/program_impls/metal/metal_program.cpp index 8f1a6919c8f5a..482acde54832c 100644 --- a/taichi/runtime/program_impls/metal/metal_program.cpp +++ b/taichi/runtime/program_impls/metal/metal_program.cpp @@ -4,8 +4,7 @@ #include "taichi/codegen/metal/codegen_metal.h" #include "taichi/codegen/metal/struct_metal.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { std::unordered_set find_all_dense_snodes( @@ -123,5 +122,4 @@ DeviceAllocation MetalProgramImpl::allocate_memory_ndarray( return metal_kernel_mgr_->allocate_memory(params); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/program_impls/metal/metal_program.h b/taichi/runtime/program_impls/metal/metal_program.h index 55ba519f26756..81fd03c65bcfd 100644 --- a/taichi/runtime/program_impls/metal/metal_program.h +++ b/taichi/runtime/program_impls/metal/metal_program.h @@ -13,8 +13,7 @@ #include "taichi/codegen/metal/struct_metal.h" #include "taichi/program/program_impl.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class MetalProgramImpl : public ProgramImpl { public: @@ -56,5 +55,4 @@ class MetalProgramImpl : public ProgramImpl { std::unique_ptr metal_kernel_mgr_{nullptr}; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/program_impls/opengl/opengl_program.cpp b/taichi/runtime/program_impls/opengl/opengl_program.cpp index 4df1cad1db3ad..bf219a24acb3a 100644 --- a/taichi/runtime/program_impls/opengl/opengl_program.cpp +++ b/taichi/runtime/program_impls/opengl/opengl_program.cpp @@ -5,8 +5,7 @@ #include "taichi/runtime/gfx/aot_module_builder_impl.h" #include "taichi/runtime/gfx/aot_module_loader_impl.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { @@ -120,5 +119,4 @@ const std::unique_ptr return cache_manager_; } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/program_impls/opengl/opengl_program.h b/taichi/runtime/program_impls/opengl/opengl_program.h index 7965c9221b22a..9c901d02ad17f 100644 --- a/taichi/runtime/program_impls/opengl/opengl_program.h +++ b/taichi/runtime/program_impls/opengl/opengl_program.h @@ -5,8 +5,7 @@ #include "taichi/runtime/gfx/snode_tree_manager.h" #include "taichi/program/program_impl.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class OpenglProgramImpl : public ProgramImpl { public: @@ -76,5 +75,4 @@ class OpenglProgramImpl : public ProgramImpl { std::unique_ptr cache_manager_{nullptr}; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/program_impls/vulkan/vulkan_program.cpp b/taichi/runtime/program_impls/vulkan/vulkan_program.cpp index 9d1ac33268ce7..3e5990aa15935 100644 --- a/taichi/runtime/program_impls/vulkan/vulkan_program.cpp +++ b/taichi/runtime/program_impls/vulkan/vulkan_program.cpp @@ -13,8 +13,7 @@ using namespace taichi::lang::vulkan; -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { std::vector get_required_instance_extensions() { @@ -255,5 +254,4 @@ VulkanProgramImpl::~VulkanProgramImpl() { embedded_device_.reset(); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/program_impls/vulkan/vulkan_program.h b/taichi/runtime/program_impls/vulkan/vulkan_program.h index 9a8edd8b2232a..23ec65be117aa 100644 --- a/taichi/runtime/program_impls/vulkan/vulkan_program.h +++ b/taichi/runtime/program_impls/vulkan/vulkan_program.h @@ -22,8 +22,7 @@ #include -namespace taichi { -namespace lang { +namespace taichi::lang { namespace vulkan { class VulkanDeviceCreator; @@ -110,5 +109,4 @@ class VulkanProgramImpl : public ProgramImpl { std::vector aot_compiled_snode_structs_; std::unique_ptr cache_manager_{nullptr}; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/runtime.cpp b/taichi/runtime/runtime.cpp index ed5259da9bc45..3e472bb69e43e 100644 --- a/taichi/runtime/runtime.cpp +++ b/taichi/runtime/runtime.cpp @@ -11,4 +11,4 @@ std::unique_ptr Runtime::create(Arch arch) { } } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/runtime/runtime.h b/taichi/runtime/runtime.h index 815a26374c897..a91230905334c 100644 --- a/taichi/runtime/runtime.h +++ b/taichi/runtime/runtime.h @@ -52,4 +52,4 @@ void Runtime::register_impl(Arch arch) { factories[arch] = [] { return std::make_unique(); }; } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/runtime/wasm/aot_module_builder_impl.cpp b/taichi/runtime/wasm/aot_module_builder_impl.cpp index 5fb07369ee5fc..d50e881c63d19 100644 --- a/taichi/runtime/wasm/aot_module_builder_impl.cpp +++ b/taichi/runtime/wasm/aot_module_builder_impl.cpp @@ -6,8 +6,7 @@ #include "taichi/util/file_sequence_writer.h" #include "llvm/Linker/Linker.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace wasm { AotModuleBuilderImpl::AotModuleBuilderImpl() : module_(nullptr) { @@ -61,5 +60,4 @@ void AotModuleBuilderImpl::add_per_backend_tmpl(const std::string &identifier, } } // namespace wasm -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/runtime/wasm/aot_module_builder_impl.h b/taichi/runtime/wasm/aot_module_builder_impl.h index d9d243e9f8b04..8be7db8774834 100644 --- a/taichi/runtime/wasm/aot_module_builder_impl.h +++ b/taichi/runtime/wasm/aot_module_builder_impl.h @@ -9,8 +9,7 @@ #include "taichi/codegen/wasm/codegen_wasm.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace wasm { class AotModuleBuilderImpl : public AotModuleBuilder { @@ -40,5 +39,4 @@ class AotModuleBuilderImpl : public AotModuleBuilder { }; } // namespace wasm -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/struct/snode_tree.cpp b/taichi/struct/snode_tree.cpp index 0f1ec96beae63..c484b827c8ea5 100644 --- a/taichi/struct/snode_tree.cpp +++ b/taichi/struct/snode_tree.cpp @@ -1,7 +1,6 @@ #include "taichi/struct/snode_tree.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { void get_snodes_to_root_id_impl(const SNode &node, @@ -39,5 +38,4 @@ std::unordered_map get_snodes_to_root_id(const SNode &root) { return res; } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/struct/snode_tree.h b/taichi/struct/snode_tree.h index a22b7691392f1..f6c84b1b2afdf 100644 --- a/taichi/struct/snode_tree.h +++ b/taichi/struct/snode_tree.h @@ -5,8 +5,7 @@ #include "taichi/ir/snode.h" -namespace taichi { -namespace lang { +namespace taichi::lang { /** * Represents a tree of SNodes. @@ -52,5 +51,4 @@ class SNodeTree { */ std::unordered_map get_snodes_to_root_id(const SNode &root); -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/struct/struct.cpp b/taichi/struct/struct.cpp index 165609f48e92b..4cd4a26c6869d 100644 --- a/taichi/struct/struct.cpp +++ b/taichi/struct/struct.cpp @@ -2,8 +2,7 @@ #include "struct.h" -namespace taichi { -namespace lang { +namespace taichi::lang { void StructCompiler::collect_snodes(SNode &snode) { snodes.push_back(&snode); @@ -13,5 +12,4 @@ void StructCompiler::collect_snodes(SNode &snode) { } } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/struct/struct.h b/taichi/struct/struct.h index a2b7282834aa3..52061acf9f048 100644 --- a/taichi/struct/struct.h +++ b/taichi/struct/struct.h @@ -3,8 +3,7 @@ #include "taichi/ir/snode.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class StructCompiler { public: @@ -24,5 +23,4 @@ class StructCompiler { virtual void run(SNode &node) = 0; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/system/benchmark.h b/taichi/system/benchmark.h index 6eb74361698ec..058df3657f182 100644 --- a/taichi/system/benchmark.h +++ b/taichi/system/benchmark.h @@ -61,4 +61,4 @@ class Benchmark : public Unit { TI_INTERFACE(Benchmark) -} // namespace taichi +} // namespace taichi diff --git a/taichi/system/demangling.cpp b/taichi/system/demangling.cpp index 1e605a6cdbc60..23938c11d6721 100644 --- a/taichi/system/demangling.cpp +++ b/taichi/system/demangling.cpp @@ -45,4 +45,4 @@ class Demangling : public Task { TI_IMPLEMENTATION(Task, Demangling, "demangle") -} // namespace taichi +} // namespace taichi diff --git a/taichi/system/dynamic_loader.cpp b/taichi/system/dynamic_loader.cpp index d3ce23a19a91a..1bef078f664e8 100644 --- a/taichi/system/dynamic_loader.cpp +++ b/taichi/system/dynamic_loader.cpp @@ -52,4 +52,4 @@ bool DynamicLoader::loaded() const { return dll_ != nullptr; } -} // namespace taichi +} // namespace taichi diff --git a/taichi/system/dynamic_loader.h b/taichi/system/dynamic_loader.h index 52e15160b838c..8e544c2b592f9 100644 --- a/taichi/system/dynamic_loader.h +++ b/taichi/system/dynamic_loader.h @@ -33,4 +33,4 @@ class DynamicLoader { void *dll_ = nullptr; }; -} // namespace taichi +} // namespace taichi diff --git a/taichi/system/memory_pool.cpp b/taichi/system/memory_pool.cpp index c98a908a90cfd..45f6c2ec111f2 100644 --- a/taichi/system/memory_pool.cpp +++ b/taichi/system/memory_pool.cpp @@ -3,8 +3,7 @@ #include "taichi/rhi/cuda/cuda_driver.h" #include "taichi/rhi/cuda/cuda_device.h" -namespace taichi { -namespace lang { +namespace taichi::lang { // In the future we wish to move the MemoryPool inside each Device // so that the memory allocated from each Device can be used as-is. @@ -137,5 +136,4 @@ MemoryPool::~MemoryPool() { } } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/system/memory_pool.h b/taichi/system/memory_pool.h index 25da2e840ddf0..06dce540d3ad5 100644 --- a/taichi/system/memory_pool.h +++ b/taichi/system/memory_pool.h @@ -10,8 +10,7 @@ #include #include -namespace taichi { -namespace lang { +namespace taichi::lang { // A memory pool that runs on the host @@ -55,5 +54,4 @@ class TI_DLL_EXPORT MemoryPool { Device *device_; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/system/profiler.cpp b/taichi/system/profiler.cpp index 44de5fd4ddbb7..1ffa86ae3e258 100644 --- a/taichi/system/profiler.cpp +++ b/taichi/system/profiler.cpp @@ -278,4 +278,4 @@ void Profiling::clear_profile_info() { } } -} // namespace taichi +} // namespace taichi diff --git a/taichi/system/profiler.h b/taichi/system/profiler.h index f4bf67f18166d..c71c39b131ced 100644 --- a/taichi/system/profiler.h +++ b/taichi/system/profiler.h @@ -56,4 +56,4 @@ class Profiling { #define TI_AUTO_PROF TI_PROFILER(__FUNCTION__) -} // namespace taichi +} // namespace taichi diff --git a/taichi/system/run_tests.cpp b/taichi/system/run_tests.cpp index 4cfb4c6d8525c..03c8eaed6dc29 100644 --- a/taichi/system/run_tests.cpp +++ b/taichi/system/run_tests.cpp @@ -17,4 +17,4 @@ class RunTests : public Task { TI_IMPLEMENTATION(Task, RunTests, "test"); -} // namespace taichi +} // namespace taichi diff --git a/taichi/system/threading.cpp b/taichi/system/threading.cpp index f8dca2ead0a3a..f85caf9ffd2e3 100644 --- a/taichi/system/threading.cpp +++ b/taichi/system/threading.cpp @@ -136,4 +136,4 @@ ThreadPool::~ThreadPool() { th.join(); } -} // namespace taichi +} // namespace taichi diff --git a/taichi/system/threading.h b/taichi/system/threading.h index c82004e64278f..002e972b28336 100644 --- a/taichi/system/threading.h +++ b/taichi/system/threading.h @@ -59,4 +59,4 @@ class ThreadPool { ~ThreadPool(); }; -} // namespace taichi +} // namespace taichi diff --git a/taichi/system/timeline.cpp b/taichi/system/timeline.cpp index b1cb95f88b3cb..a6fd28026eeda 100644 --- a/taichi/system/timeline.cpp +++ b/taichi/system/timeline.cpp @@ -122,4 +122,4 @@ void Timelines::set_enabled(bool enabled) { enabled_ = enabled; } -} // namespace taichi +} // namespace taichi diff --git a/taichi/system/timeline.h b/taichi/system/timeline.h index 7bc6ab606842d..3fb289f8d5808 100644 --- a/taichi/system/timeline.h +++ b/taichi/system/timeline.h @@ -88,4 +88,4 @@ class Timelines { #define TI_AUTO_TIMELINE TI_TIMELINE(__FUNCTION__) -} // namespace taichi +} // namespace taichi diff --git a/taichi/system/timer.cpp b/taichi/system/timer.cpp index 0423dbdd73e50..c943e0eeebc43 100644 --- a/taichi/system/timer.cpp +++ b/taichi/system/timer.cpp @@ -232,4 +232,4 @@ uint64 Time::get_cycles() { #endif -} // namespace taichi +} // namespace taichi diff --git a/taichi/system/timer.h b/taichi/system/timer.h index 6b195bb3fe28d..e770ad6147b6a 100644 --- a/taichi/system/timer.h +++ b/taichi/system/timer.h @@ -105,4 +105,4 @@ class TI_DLL_EXPORT Time { }; }; -} // namespace taichi +} // namespace taichi diff --git a/taichi/system/traceback.cpp b/taichi/system/traceback.cpp index 24a6ac2be077f..ee9054050b2e8 100644 --- a/taichi/system/traceback.cpp +++ b/taichi/system/traceback.cpp @@ -367,4 +367,4 @@ void print_traceback() { "https://docs.taichi-lang.org/docs/install\n"); } -} // namespace taichi +} // namespace taichi diff --git a/taichi/system/unified_allocator.cpp b/taichi/system/unified_allocator.cpp index 9269671d16068..229587e45af83 100644 --- a/taichi/system/unified_allocator.cpp +++ b/taichi/system/unified_allocator.cpp @@ -59,4 +59,4 @@ void taichi::lang::UnifiedAllocator::memset(unsigned char val) { std::memset(data, val, size_); } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/system/unified_allocator.h b/taichi/system/unified_allocator.h index 577b0d9213dd2..b781391c9226d 100644 --- a/taichi/system/unified_allocator.h +++ b/taichi/system/unified_allocator.h @@ -60,4 +60,4 @@ class UnifiedAllocator { Device *device_{nullptr}; }; -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/system/virtual_memory.h b/taichi/system/virtual_memory.h index b24d9cdb535fd..b8629f0b71017 100644 --- a/taichi/system/virtual_memory.h +++ b/taichi/system/virtual_memory.h @@ -59,4 +59,4 @@ uint64 get_memory_usage(int pid = -1); #define TI_MEMORY_USAGE(name) \ TI_DEBUG("Memory Usage [{}] = {:.2f} GB", name, get_memory_usage_gb()); -} // namespace taichi +} // namespace taichi diff --git a/taichi/transforms/alg_simp.cpp b/taichi/transforms/alg_simp.cpp index 5108471a3e88a..07dc81f8ef738 100644 --- a/taichi/transforms/alg_simp.cpp +++ b/taichi/transforms/alg_simp.cpp @@ -445,4 +445,4 @@ bool alg_simp(IRNode *root, const CompileConfig &config) { } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/auto_diff.cpp b/taichi/transforms/auto_diff.cpp index 80e95083d9fba..9e6cdcf84421c 100644 --- a/taichi/transforms/auto_diff.cpp +++ b/taichi/transforms/auto_diff.cpp @@ -1612,4 +1612,4 @@ void differentiation_validation_check(IRNode *root, } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/binary_op_simplify.cpp b/taichi/transforms/binary_op_simplify.cpp index 4051872c7621a..7ad2b4ff3e73a 100644 --- a/taichi/transforms/binary_op_simplify.cpp +++ b/taichi/transforms/binary_op_simplify.cpp @@ -192,4 +192,4 @@ bool binary_op_simplify(IRNode *root, const CompileConfig &config) { } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/bit_loop_vectorize.cpp b/taichi/transforms/bit_loop_vectorize.cpp index ace0dc9a6780d..298521da03558 100644 --- a/taichi/transforms/bit_loop_vectorize.cpp +++ b/taichi/transforms/bit_loop_vectorize.cpp @@ -335,4 +335,4 @@ void bit_loop_vectorize(IRNode *root) { } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/cfg_optimization.cpp b/taichi/transforms/cfg_optimization.cpp index 1615389f92686..24a5dd96bd17a 100644 --- a/taichi/transforms/cfg_optimization.cpp +++ b/taichi/transforms/cfg_optimization.cpp @@ -35,4 +35,4 @@ bool cfg_optimization( } } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/check_out_of_bound.cpp b/taichi/transforms/check_out_of_bound.cpp index 0d68447a0fb8d..d09b2f12bc8c2 100644 --- a/taichi/transforms/check_out_of_bound.cpp +++ b/taichi/transforms/check_out_of_bound.cpp @@ -160,4 +160,4 @@ bool check_out_of_bound(IRNode *root, } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/check_out_of_bound.h b/taichi/transforms/check_out_of_bound.h index a1d09831c9a0e..c9a54c2d2e2c6 100644 --- a/taichi/transforms/check_out_of_bound.h +++ b/taichi/transforms/check_out_of_bound.h @@ -2,8 +2,7 @@ #include "taichi/ir/pass.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class CheckOutOfBoundPass : public Pass { public: @@ -14,5 +13,4 @@ class CheckOutOfBoundPass : public Pass { }; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/transforms/compile_to_offloads.cpp b/taichi/transforms/compile_to_offloads.cpp index c8e4fd080dfc4..f321f99cb423f 100644 --- a/taichi/transforms/compile_to_offloads.cpp +++ b/taichi/transforms/compile_to_offloads.cpp @@ -359,4 +359,4 @@ void compile_function(IRNode *ir, } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/constant_fold.cpp b/taichi/transforms/constant_fold.cpp index 54c70475086cd..3d87a9f6fe0c4 100644 --- a/taichi/transforms/constant_fold.cpp +++ b/taichi/transforms/constant_fold.cpp @@ -266,4 +266,4 @@ bool constant_fold(IRNode *root, } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/constant_fold.h b/taichi/transforms/constant_fold.h index c7ffbbcfde9a6..69581c7489715 100644 --- a/taichi/transforms/constant_fold.h +++ b/taichi/transforms/constant_fold.h @@ -2,8 +2,7 @@ #include "taichi/ir/pass.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class ConstantFoldPass : public Pass { public: @@ -14,5 +13,4 @@ class ConstantFoldPass : public Pass { }; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/transforms/demote_atomics.cpp b/taichi/transforms/demote_atomics.cpp index 4d54a56258acb..e2de05d4958ae 100644 --- a/taichi/transforms/demote_atomics.cpp +++ b/taichi/transforms/demote_atomics.cpp @@ -195,4 +195,4 @@ bool demote_atomics(IRNode *root, const CompileConfig &config) { } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/demote_dense_struct_fors.cpp b/taichi/transforms/demote_dense_struct_fors.cpp index 0c2d4e59a27cd..55ba8c780c7f7 100644 --- a/taichi/transforms/demote_dense_struct_fors.cpp +++ b/taichi/transforms/demote_dense_struct_fors.cpp @@ -193,4 +193,4 @@ void demote_dense_struct_fors(IRNode *root, bool packed) { } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/demote_mesh_statements.cpp b/taichi/transforms/demote_mesh_statements.cpp index d7572f1efa826..87dfaae65a15e 100644 --- a/taichi/transforms/demote_mesh_statements.cpp +++ b/taichi/transforms/demote_mesh_statements.cpp @@ -5,8 +5,7 @@ #include "taichi/transforms/demote_mesh_statements.h" #include "taichi/ir/visitors.h" -namespace taichi { -namespace lang { +namespace taichi::lang { const PassID DemoteMeshStatements::id = "DemoteMeshStatements"; @@ -153,5 +152,4 @@ void demote_mesh_statements(IRNode *root, } } // namespace irpass -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/transforms/demote_mesh_statements.h b/taichi/transforms/demote_mesh_statements.h index dad295315d7fb..4652a4f0367fe 100644 --- a/taichi/transforms/demote_mesh_statements.h +++ b/taichi/transforms/demote_mesh_statements.h @@ -2,8 +2,7 @@ #include "taichi/ir/pass.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class DemoteMeshStatements : public Pass { public: @@ -14,5 +13,4 @@ class DemoteMeshStatements : public Pass { }; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/transforms/demote_no_access_mesh_fors.cpp b/taichi/transforms/demote_no_access_mesh_fors.cpp index 3f37a15f5fd01..3688f6c923239 100644 --- a/taichi/transforms/demote_no_access_mesh_fors.cpp +++ b/taichi/transforms/demote_no_access_mesh_fors.cpp @@ -69,4 +69,4 @@ void demote_no_access_mesh_fors(IRNode *root) { } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/demote_operations.cpp b/taichi/transforms/demote_operations.cpp index 136ee2c3dc191..56b191d8b0f3d 100644 --- a/taichi/transforms/demote_operations.cpp +++ b/taichi/transforms/demote_operations.cpp @@ -229,4 +229,4 @@ bool demote_operations(IRNode *root, const CompileConfig &config) { } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/detect_read_only.cpp b/taichi/transforms/detect_read_only.cpp index 83023e165bb48..e3f5a72077c54 100644 --- a/taichi/transforms/detect_read_only.cpp +++ b/taichi/transforms/detect_read_only.cpp @@ -92,4 +92,4 @@ std::unordered_map detect_external_ptr_access_in_task( } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/determine_ad_stack_size.cpp b/taichi/transforms/determine_ad_stack_size.cpp index 8083303e0be8b..090e755c38a71 100644 --- a/taichi/transforms/determine_ad_stack_size.cpp +++ b/taichi/transforms/determine_ad_stack_size.cpp @@ -7,8 +7,7 @@ #include #include -namespace taichi { -namespace lang { +namespace taichi::lang { namespace irpass { @@ -29,5 +28,4 @@ bool determine_ad_stack_size(IRNode *root, const CompileConfig &config) { } // namespace irpass -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/transforms/die.cpp b/taichi/transforms/die.cpp index cf7f705634e21..7a83e8faf3fe3 100644 --- a/taichi/transforms/die.cpp +++ b/taichi/transforms/die.cpp @@ -127,4 +127,4 @@ bool die(IRNode *root) { } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/extract_constant.cpp b/taichi/transforms/extract_constant.cpp index a59fadbbdadb1..a67bf86f38592 100644 --- a/taichi/transforms/extract_constant.cpp +++ b/taichi/transforms/extract_constant.cpp @@ -61,4 +61,4 @@ bool extract_constant(IRNode *root, const CompileConfig &config) { } } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/flag_access.cpp b/taichi/transforms/flag_access.cpp index 5ee49c92adf85..2005aa464aea4 100644 --- a/taichi/transforms/flag_access.cpp +++ b/taichi/transforms/flag_access.cpp @@ -176,4 +176,4 @@ void flag_access(IRNode *root) { } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/frontend_type_check.cpp b/taichi/transforms/frontend_type_check.cpp index 49bcbdb194e1d..01b97c9d5a47d 100644 --- a/taichi/transforms/frontend_type_check.cpp +++ b/taichi/transforms/frontend_type_check.cpp @@ -2,8 +2,7 @@ #include "taichi/ir/frontend_ir.h" #include "taichi/ir/statements.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class FrontendTypeCheck : public IRVisitor { void check_cond_type(const Expr &cond, std::string stmt_name) { @@ -102,6 +101,4 @@ void frontend_type_check(IRNode *root) { } // namespace irpass -} // namespace lang - -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/transforms/inlining.cpp b/taichi/transforms/inlining.cpp index 60a317ca1ab87..6c2ff42597e87 100644 --- a/taichi/transforms/inlining.cpp +++ b/taichi/transforms/inlining.cpp @@ -6,8 +6,7 @@ #include "taichi/ir/visitors.h" #include "taichi/program/program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { // Inline all functions. class Inliner : public BasicStmtVisitor { @@ -92,5 +91,4 @@ bool inlining(IRNode *root, } // namespace irpass -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/transforms/inlining.h b/taichi/transforms/inlining.h index 71191b42d0058..ee771101f2d66 100644 --- a/taichi/transforms/inlining.h +++ b/taichi/transforms/inlining.h @@ -2,8 +2,7 @@ #include "taichi/ir/pass.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class InliningPass : public Pass { public: @@ -12,5 +11,4 @@ class InliningPass : public Pass { struct Args {}; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/transforms/insert_scratch_pad.cpp b/taichi/transforms/insert_scratch_pad.cpp index 9213803e8cd80..4624506ee2912 100644 --- a/taichi/transforms/insert_scratch_pad.cpp +++ b/taichi/transforms/insert_scratch_pad.cpp @@ -33,4 +33,4 @@ std::unique_ptr initialize_scratch_pad(OffloadedStmt *offload) { } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/ir_printer.cpp b/taichi/transforms/ir_printer.cpp index df8ae0d0de93b..0bf6a641814cf 100644 --- a/taichi/transforms/ir_printer.cpp +++ b/taichi/transforms/ir_printer.cpp @@ -836,4 +836,4 @@ void print(IRNode *root, std::string *output) { } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/loop_invariant_code_motion.cpp b/taichi/transforms/loop_invariant_code_motion.cpp index b2c1d0141ef00..6ab20e0fc43b7 100644 --- a/taichi/transforms/loop_invariant_code_motion.cpp +++ b/taichi/transforms/loop_invariant_code_motion.cpp @@ -88,4 +88,4 @@ bool loop_invariant_code_motion(IRNode *root, const CompileConfig &config) { } } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/lower_access.cpp b/taichi/transforms/lower_access.cpp index 1597fb68157b5..9cbd90c226d6a 100644 --- a/taichi/transforms/lower_access.cpp +++ b/taichi/transforms/lower_access.cpp @@ -11,8 +11,7 @@ #include #include -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { class LowerAccess; @@ -297,5 +296,4 @@ bool lower_access(IRNode *root, } } // namespace irpass -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/transforms/lower_access.h b/taichi/transforms/lower_access.h index 858af5a215414..68f764fbddd1c 100644 --- a/taichi/transforms/lower_access.h +++ b/taichi/transforms/lower_access.h @@ -2,8 +2,7 @@ #include "taichi/ir/pass.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class LowerAccessPass : public Pass { public: @@ -15,5 +14,4 @@ class LowerAccessPass : public Pass { }; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/transforms/lower_ast.cpp b/taichi/transforms/lower_ast.cpp index 557e97425bed7..d3703e102dfee 100644 --- a/taichi/transforms/lower_ast.cpp +++ b/taichi/transforms/lower_ast.cpp @@ -522,4 +522,4 @@ void lower_ast(IRNode *root) { } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/lower_matrix_ptr.cpp b/taichi/transforms/lower_matrix_ptr.cpp index 36634e68bb700..658e0a976378c 100644 --- a/taichi/transforms/lower_matrix_ptr.cpp +++ b/taichi/transforms/lower_matrix_ptr.cpp @@ -57,4 +57,4 @@ void lower_matrix_ptr(IRNode *root) { } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/make_block_local.cpp b/taichi/transforms/make_block_local.cpp index ced0febcea252..749a62bd5a863 100644 --- a/taichi/transforms/make_block_local.cpp +++ b/taichi/transforms/make_block_local.cpp @@ -358,4 +358,4 @@ void make_block_local(IRNode *root, } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/make_block_local.h b/taichi/transforms/make_block_local.h index fc0ed3f7a1ca1..1fa35741aba64 100644 --- a/taichi/transforms/make_block_local.h +++ b/taichi/transforms/make_block_local.h @@ -2,8 +2,7 @@ #include "taichi/ir/pass.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class MakeBlockLocalPass : public Pass { public: @@ -14,5 +13,4 @@ class MakeBlockLocalPass : public Pass { }; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/transforms/make_mesh_block_local.cpp b/taichi/transforms/make_mesh_block_local.cpp index c098e9db63398..a9c85766aabff 100644 --- a/taichi/transforms/make_mesh_block_local.cpp +++ b/taichi/transforms/make_mesh_block_local.cpp @@ -4,8 +4,7 @@ #include "taichi/ir/analysis.h" #include "taichi/transforms/make_mesh_block_local.h" -namespace taichi { -namespace lang { +namespace taichi::lang { const PassID MakeMeshBlockLocal::id = "MakeMeshBlockLocal"; @@ -673,5 +672,4 @@ void make_mesh_block_local(IRNode *root, } } // namespace irpass -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/transforms/make_mesh_block_local.h b/taichi/transforms/make_mesh_block_local.h index 04d8ce04479b0..9b8b6f354544f 100644 --- a/taichi/transforms/make_mesh_block_local.h +++ b/taichi/transforms/make_mesh_block_local.h @@ -6,8 +6,7 @@ #include -namespace taichi { -namespace lang { +namespace taichi::lang { class MakeMeshBlockLocal : public Pass { public: @@ -70,5 +69,4 @@ class MakeMeshBlockLocal : public Pass { int mapping_dtype_size_{0}; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/transforms/make_mesh_thread_local.cpp b/taichi/transforms/make_mesh_thread_local.cpp index ee85ce5dd2ae7..f7209fef73510 100644 --- a/taichi/transforms/make_mesh_thread_local.cpp +++ b/taichi/transforms/make_mesh_thread_local.cpp @@ -4,8 +4,7 @@ #include "taichi/ir/analysis.h" #include "taichi/transforms/make_mesh_thread_local.h" -namespace taichi { -namespace lang { +namespace taichi::lang { const PassID MakeMeshThreadLocal::id = "MakeMeshThreadLocal"; @@ -161,5 +160,4 @@ void make_mesh_thread_local(IRNode *root, } } // namespace irpass -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/transforms/make_mesh_thread_local.h b/taichi/transforms/make_mesh_thread_local.h index aa054a1548456..e383895b645df 100644 --- a/taichi/transforms/make_mesh_thread_local.h +++ b/taichi/transforms/make_mesh_thread_local.h @@ -2,8 +2,7 @@ #include "taichi/ir/pass.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class MakeMeshThreadLocal : public Pass { public: @@ -14,5 +13,4 @@ class MakeMeshThreadLocal : public Pass { }; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/transforms/make_thread_local.cpp b/taichi/transforms/make_thread_local.cpp index a7a1ec6dd8a95..d88e8fcd946af 100644 --- a/taichi/transforms/make_thread_local.cpp +++ b/taichi/transforms/make_thread_local.cpp @@ -207,4 +207,4 @@ void make_thread_local(IRNode *root, const CompileConfig &config) { } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/offload.cpp b/taichi/transforms/offload.cpp index 5492b10c5ffa8..4862c35b6ec6f 100644 --- a/taichi/transforms/offload.cpp +++ b/taichi/transforms/offload.cpp @@ -789,4 +789,4 @@ void offload(IRNode *root, const CompileConfig &config) { } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/optimize_bit_struct_stores.cpp b/taichi/transforms/optimize_bit_struct_stores.cpp index 4ed1301247937..187f644846d7e 100644 --- a/taichi/transforms/optimize_bit_struct_stores.cpp +++ b/taichi/transforms/optimize_bit_struct_stores.cpp @@ -216,4 +216,4 @@ void optimize_bit_struct_stores(IRNode *root, } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/re_id.cpp b/taichi/transforms/re_id.cpp index 8d8ccb7f2b91f..61831cce9e29b 100644 --- a/taichi/transforms/re_id.cpp +++ b/taichi/transforms/re_id.cpp @@ -41,4 +41,4 @@ void re_id(IRNode *root) { } } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/remove_assume_in_range.cpp b/taichi/transforms/remove_assume_in_range.cpp index dc3edd008ed5a..8011e2a4b240b 100644 --- a/taichi/transforms/remove_assume_in_range.cpp +++ b/taichi/transforms/remove_assume_in_range.cpp @@ -40,4 +40,4 @@ bool remove_range_assumption(IRNode *root) { } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/remove_loop_unique.cpp b/taichi/transforms/remove_loop_unique.cpp index bf6e35b5cfcaf..51d9ea9d33697 100644 --- a/taichi/transforms/remove_loop_unique.cpp +++ b/taichi/transforms/remove_loop_unique.cpp @@ -38,4 +38,4 @@ bool remove_loop_unique(IRNode *root) { } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/replace_statements.cpp b/taichi/transforms/replace_statements.cpp index 7d5140234cea8..39ed4bceca81e 100644 --- a/taichi/transforms/replace_statements.cpp +++ b/taichi/transforms/replace_statements.cpp @@ -27,4 +27,4 @@ bool replace_statements(IRNode *root, } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/reverse_segments.cpp b/taichi/transforms/reverse_segments.cpp index 2376f4a3aab1b..206e9a9ad3e77 100644 --- a/taichi/transforms/reverse_segments.cpp +++ b/taichi/transforms/reverse_segments.cpp @@ -82,4 +82,4 @@ void reverse_segments(IRNode *root) { } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/scalar_pointer_lowerer.cpp b/taichi/transforms/scalar_pointer_lowerer.cpp index 495506cb39cd6..f4e41bd787df6 100644 --- a/taichi/transforms/scalar_pointer_lowerer.cpp +++ b/taichi/transforms/scalar_pointer_lowerer.cpp @@ -8,8 +8,7 @@ #include "taichi/transforms/scalar_pointer_lowerer.h" #include "taichi/transforms/utils.h" -namespace taichi { -namespace lang { +namespace taichi::lang { ScalarPointerLowerer::ScalarPointerLowerer(SNode *leaf_snode, const std::vector &indices, @@ -100,5 +99,4 @@ void ScalarPointerLowerer::run() { } } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/transforms/scalar_pointer_lowerer.h b/taichi/transforms/scalar_pointer_lowerer.h index a763ad3a6b2c6..16aa4e1bd1c82 100644 --- a/taichi/transforms/scalar_pointer_lowerer.h +++ b/taichi/transforms/scalar_pointer_lowerer.h @@ -4,8 +4,7 @@ #include "taichi/ir/stmt_op_types.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class LinearizeStmt; class SNode; @@ -75,5 +74,4 @@ class ScalarPointerLowerer { int path_length_{0}; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/transforms/scalarize.cpp b/taichi/transforms/scalarize.cpp index 6f67e9c3c3135..a8e452a005398 100644 --- a/taichi/transforms/scalarize.cpp +++ b/taichi/transforms/scalarize.cpp @@ -243,4 +243,4 @@ void scalarize(IRNode *root) { } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/simplify.cpp b/taichi/transforms/simplify.cpp index 8b9b48f9d4ec0..d1cf6821e3584 100644 --- a/taichi/transforms/simplify.cpp +++ b/taichi/transforms/simplify.cpp @@ -655,4 +655,4 @@ void full_simplify(IRNode *root, } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/simplify.h b/taichi/transforms/simplify.h index ada1cec40bd46..9a4c66e45e2ef 100644 --- a/taichi/transforms/simplify.h +++ b/taichi/transforms/simplify.h @@ -2,8 +2,7 @@ #include "taichi/ir/pass.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class FullSimplifyPass : public Pass { public: @@ -18,5 +17,4 @@ class FullSimplifyPass : public Pass { }; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/transforms/statement_usage_replace.cpp b/taichi/transforms/statement_usage_replace.cpp index 71d17e2dbb1df..04da24f46e648 100644 --- a/taichi/transforms/statement_usage_replace.cpp +++ b/taichi/transforms/statement_usage_replace.cpp @@ -93,4 +93,4 @@ void replace_all_usages_with(IRNode *root, Stmt *old_stmt, Stmt *new_stmt) { } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/transform_statements.cpp b/taichi/transforms/transform_statements.cpp index 453ce551e35de..a6d0d136c6ef2 100644 --- a/taichi/transforms/transform_statements.cpp +++ b/taichi/transforms/transform_statements.cpp @@ -58,4 +58,4 @@ bool transform_statements( } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/type_check.cpp b/taichi/transforms/type_check.cpp index 2fc22056a55aa..709d11af5141f 100644 --- a/taichi/transforms/type_check.cpp +++ b/taichi/transforms/type_check.cpp @@ -568,4 +568,4 @@ void type_check(IRNode *root, const CompileConfig &config) { } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/unreachable_code_elimination.cpp b/taichi/transforms/unreachable_code_elimination.cpp index e01b8b820c5e3..ea90f015c5506 100644 --- a/taichi/transforms/unreachable_code_elimination.cpp +++ b/taichi/transforms/unreachable_code_elimination.cpp @@ -156,4 +156,4 @@ bool unreachable_code_elimination(IRNode *root) { } } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/transforms/utils.cpp b/taichi/transforms/utils.cpp index d3dd28bccf3c2..85cc9ba9142ee 100644 --- a/taichi/transforms/utils.cpp +++ b/taichi/transforms/utils.cpp @@ -1,7 +1,6 @@ #include "taichi/ir/statements.h" -namespace taichi { -namespace lang { +namespace taichi::lang { Stmt *generate_mod_x_div_y(VecStatement *stmts, Stmt *num, int x, int y) { auto const_x = stmts->push_back(TypedConstant(x)); @@ -10,5 +9,4 @@ Stmt *generate_mod_x_div_y(VecStatement *stmts, Stmt *num, int x, int y) { return stmts->push_back(BinaryOpType::div, mod_x, const_y); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/transforms/utils.h b/taichi/transforms/utils.h index 3440be0314b99..7ae4535b58c2e 100644 --- a/taichi/transforms/utils.h +++ b/taichi/transforms/utils.h @@ -1,9 +1,7 @@ #pragma once -namespace taichi { -namespace lang { +namespace taichi::lang { Stmt *generate_mod_x_div_y(VecStatement *stmts, Stmt *num, int x, int y); -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/transforms/whole_kernel_cse.cpp b/taichi/transforms/whole_kernel_cse.cpp index 797c60a190472..4391fdd4d4d86 100644 --- a/taichi/transforms/whole_kernel_cse.cpp +++ b/taichi/transforms/whole_kernel_cse.cpp @@ -219,4 +219,4 @@ bool whole_kernel_cse(IRNode *root) { } } // namespace irpass -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/ui/backends/vulkan/app_context.h b/taichi/ui/backends/vulkan/app_context.h index 7afebbff987cd..a6dd0b1576b21 100644 --- a/taichi/ui/backends/vulkan/app_context.h +++ b/taichi/ui/backends/vulkan/app_context.h @@ -9,11 +9,9 @@ #include #endif -namespace taichi { -namespace lang { +namespace taichi::lang { class Program; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang TI_UI_NAMESPACE_BEGIN diff --git a/taichi/ui/backends/vulkan/renderer.h b/taichi/ui/backends/vulkan/renderer.h index dd9bdc664a83b..0badfe2348b13 100644 --- a/taichi/ui/backends/vulkan/renderer.h +++ b/taichi/ui/backends/vulkan/renderer.h @@ -32,11 +32,9 @@ #include "renderables/lines.h" #include "renderables/scene_lines.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class Program; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang TI_UI_NAMESPACE_BEGIN diff --git a/taichi/ui/backends/vulkan/window.h b/taichi/ui/backends/vulkan/window.h index d0ebe3a371a1b..e99fa25df8471 100644 --- a/taichi/ui/backends/vulkan/window.h +++ b/taichi/ui/backends/vulkan/window.h @@ -23,11 +23,9 @@ #include "taichi/ui/backends/vulkan/gui.h" #include "taichi/program/ndarray.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class Program; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang TI_UI_NAMESPACE_BEGIN diff --git a/taichi/ui/common/canvas_base.h b/taichi/ui/common/canvas_base.h index 98af1523b177c..ecfc564dcfee4 100644 --- a/taichi/ui/common/canvas_base.h +++ b/taichi/ui/common/canvas_base.h @@ -5,13 +5,11 @@ #include "taichi/ui/common/renderable_info.h" #include "taichi/ui/utils/utils.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class Texture; -} -} // namespace taichi +} // namespace taichi::lang TI_UI_NAMESPACE_BEGIN diff --git a/taichi/ui/gui/android.cpp b/taichi/ui/gui/android.cpp index d6959c4f77e83..ef3f2d95dc534 100644 --- a/taichi/ui/gui/android.cpp +++ b/taichi/ui/gui/android.cpp @@ -27,6 +27,6 @@ void GUI::set_title(std::string title) { GUI::~GUI() { } -} // namespace taichi +} // namespace taichi #endif diff --git a/taichi/ui/gui/cocoa.cpp b/taichi/ui/gui/cocoa.cpp index adfaabeb4a791..955fafb123863 100644 --- a/taichi/ui/gui/cocoa.cpp +++ b/taichi/ui/gui/cocoa.cpp @@ -431,6 +431,6 @@ GUI::~GUI() { } } -} // namespace taichi +} // namespace taichi #endif diff --git a/taichi/ui/gui/gui.cpp b/taichi/ui/gui/gui.cpp index 3e63d7d56182b..eebf3674eb312 100644 --- a/taichi/ui/gui/gui.cpp +++ b/taichi/ui/gui/gui.cpp @@ -132,4 +132,4 @@ void Canvas::triangle_single(real x0, triangle(a, b, c, color); } -} // namespace taichi +} // namespace taichi diff --git a/taichi/ui/gui/gui.h b/taichi/ui/gui/gui.h index cbe8e5ccb2110..5d656bb5df4cf 100644 --- a/taichi/ui/gui/gui.h +++ b/taichi/ui/gui/gui.h @@ -945,4 +945,4 @@ class TI_DLL_EXPORT GUI : public GUIBase { ~GUI(); }; -} // namespace taichi +} // namespace taichi diff --git a/taichi/ui/gui/win32.cpp b/taichi/ui/gui/win32.cpp index 31b749b8341c6..2d4b3e4b47c2b 100644 --- a/taichi/ui/gui/win32.cpp +++ b/taichi/ui/gui/win32.cpp @@ -330,6 +330,6 @@ GUI::~GUI() { } } -} // namespace taichi +} // namespace taichi #endif diff --git a/taichi/ui/gui/x11.cpp b/taichi/ui/gui/x11.cpp index df7c652553bb4..458f893fe3c9e 100644 --- a/taichi/ui/gui/x11.cpp +++ b/taichi/ui/gui/x11.cpp @@ -202,6 +202,6 @@ GUI::~GUI() { } } -} // namespace taichi +} // namespace taichi #endif diff --git a/taichi/util/action_recorder.cpp b/taichi/util/action_recorder.cpp index 456d6b41bd581..4e78bd948a42b 100644 --- a/taichi/util/action_recorder.cpp +++ b/taichi/util/action_recorder.cpp @@ -53,4 +53,4 @@ void ActionRecorder::record(const std::string &content, ofs_.flush(); } -} // namespace taichi +} // namespace taichi diff --git a/taichi/util/base64.h b/taichi/util/base64.h index e8b72fd1e74c0..31869d4f2ddb9 100644 --- a/taichi/util/base64.h +++ b/taichi/util/base64.h @@ -129,4 +129,4 @@ inline std::string base64_decode(std::string const &encoded_string) { return ret; } -} // namespace taichi +} // namespace taichi diff --git a/taichi/util/bit.cpp b/taichi/util/bit.cpp index d8b64bbc1bd60..2d183b4c32b24 100644 --- a/taichi/util/bit.cpp +++ b/taichi/util/bit.cpp @@ -245,4 +245,4 @@ TI_TEST("bit") { // TI_P(std::get<1>(e)); // CHECK(t == compress(std::get<0>(e), std::get<1>(e))); } -} // namespace taichi +} // namespace taichi diff --git a/taichi/util/environ_config.h b/taichi/util/environ_config.h index 716f09c664802..6a349aa616ce6 100644 --- a/taichi/util/environ_config.h +++ b/taichi/util/environ_config.h @@ -15,4 +15,4 @@ static inline int get_environ_config(const std::string &name, return std::stoi(res); } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/util/file_sequence_writer.h b/taichi/util/file_sequence_writer.h index 2c66cb9771479..63ebd982720fb 100644 --- a/taichi/util/file_sequence_writer.h +++ b/taichi/util/file_sequence_writer.h @@ -5,11 +5,9 @@ #include "taichi/runtime/llvm/llvm_fwd.h" #endif -namespace taichi { -namespace lang { +namespace taichi::lang { class IRNode; -} -} // namespace taichi +} // namespace taichi::lang namespace taichi { diff --git a/taichi/util/image_buffer.cpp b/taichi/util/image_buffer.cpp index c8bc53d6bd30b..b76a8c2d4d777 100644 --- a/taichi/util/image_buffer.cpp +++ b/taichi/util/image_buffer.cpp @@ -213,4 +213,4 @@ void write_pgm(Array2D img, const std::string &fn) { } } -} // namespace taichi +} // namespace taichi diff --git a/taichi/util/io.h b/taichi/util/io.h index 170fba96d9a09..333865fa7170e 100644 --- a/taichi/util/io.h +++ b/taichi/util/io.h @@ -149,4 +149,4 @@ bool read_vector_from_disk(std::vector *p_vec, std::string fn) { return true; } -} // namespace taichi +} // namespace taichi diff --git a/taichi/util/lang_util.cpp b/taichi/util/lang_util.cpp index cf346c41206d9..038e65f58d144 100644 --- a/taichi/util/lang_util.cpp +++ b/taichi/util/lang_util.cpp @@ -119,4 +119,4 @@ void initialize_benchmark() { #endif } -} // namespace taichi +} // namespace taichi diff --git a/taichi/util/lang_util.h b/taichi/util/lang_util.h index 923b0b7f864b3..4a361d19d39d8 100644 --- a/taichi/util/lang_util.h +++ b/taichi/util/lang_util.h @@ -65,7 +65,7 @@ std::string runtime_lib_dir(); bool command_exist(const std::string &command); -} // namespace taichi::lang +} // namespace taichi::lang namespace taichi { void initialize_benchmark(); @@ -84,4 +84,4 @@ template using function_pointer_type = decltype(function_pointer_helper(std::declval())); -} // namespace taichi +} // namespace taichi diff --git a/taichi/util/line_appender.h b/taichi/util/line_appender.h index 3e47174bef2df..6318481ee8a5d 100644 --- a/taichi/util/line_appender.h +++ b/taichi/util/line_appender.h @@ -74,4 +74,4 @@ class ScopedIndent { LineAppender &la_; }; -} // namespace taichi +} // namespace taichi diff --git a/taichi/util/offline_cache.h b/taichi/util/offline_cache.h index ff760de1996a9..80112794eebbd 100644 --- a/taichi/util/offline_cache.h +++ b/taichi/util/offline_cache.h @@ -13,8 +13,7 @@ #include "taichi/util/io.h" #include "taichi/util/lock.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace offline_cache { using Version = std::uint16_t[3]; // {MAJOR, MINOR, PATCH} @@ -287,5 +286,4 @@ class CacheCleaner { }; } // namespace offline_cache -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/taichi/util/short_name.cpp b/taichi/util/short_name.cpp index 6c21f60667525..96ddc8d7825b6 100644 --- a/taichi/util/short_name.cpp +++ b/taichi/util/short_name.cpp @@ -20,4 +20,4 @@ std::string make_short_name_by_id(int id) { std::reverse(res.begin(), res.end()); return res; } -} // namespace taichi +} // namespace taichi diff --git a/taichi/util/short_name.h b/taichi/util/short_name.h index 6f5768c31a79b..dbe57ee05aa3d 100644 --- a/taichi/util/short_name.h +++ b/taichi/util/short_name.h @@ -7,4 +7,4 @@ namespace taichi { std::string make_short_name_by_id(int id); -} // namespace taichi +} // namespace taichi diff --git a/taichi/util/statistics.cpp b/taichi/util/statistics.cpp index 712d443ee16fe..d418024fa6adc 100644 --- a/taichi/util/statistics.cpp +++ b/taichi/util/statistics.cpp @@ -30,4 +30,4 @@ void Statistics::clear() { counters_.clear(); } -} // namespace taichi +} // namespace taichi diff --git a/taichi/util/str.cpp b/taichi/util/str.cpp index 8bcf953da138d..7dc822c6f7627 100644 --- a/taichi/util/str.cpp +++ b/taichi/util/str.cpp @@ -60,4 +60,4 @@ std::string format_error_message(const std::string &error_message_template, return error_message_formatted; } -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/util/str.h b/taichi/util/str.h index 330b05c4e28df..3db6172996a42 100644 --- a/taichi/util/str.h +++ b/taichi/util/str.h @@ -15,4 +15,4 @@ std::string c_quoted(std::string const &str); std::string format_error_message(const std::string &error_message_template, const std::function &fetcher); -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/taichi/util/zip.cpp b/taichi/util/zip.cpp index eda547fde9501..b6e3fd5a688e6 100644 --- a/taichi/util/zip.cpp +++ b/taichi/util/zip.cpp @@ -112,4 +112,4 @@ std::vector read(const std::string fn, bool verbose) { } // namespace zip -} // namespace taichi +} // namespace taichi diff --git a/tests/cpp/analysis/alias_analysis_test.cpp b/tests/cpp/analysis/alias_analysis_test.cpp index ac6dfd4492b90..c4c2bfb6b1930 100644 --- a/tests/cpp/analysis/alias_analysis_test.cpp +++ b/tests/cpp/analysis/alias_analysis_test.cpp @@ -8,8 +8,7 @@ #include "taichi/ir/snode.h" #include "taichi/ir/statements.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace irpass { namespace analysis { namespace { @@ -148,5 +147,4 @@ TEST(AliasAnalysis, ExternalPtr_DiffPtr) { } // namespace analysis } // namespace irpass -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/analysis/bls_analyzer_test.cpp b/tests/cpp/analysis/bls_analyzer_test.cpp index 4ebc601116f0c..205617df3b97e 100644 --- a/tests/cpp/analysis/bls_analyzer_test.cpp +++ b/tests/cpp/analysis/bls_analyzer_test.cpp @@ -10,8 +10,7 @@ #include "taichi/struct/struct.h" #include "tests/cpp/struct/fake_struct_compiler.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { constexpr int kBlockSize = 8; @@ -144,5 +143,4 @@ TEST_F(BLSAnalyzerTest, Shl) { } } // namespace -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/analysis/same_statements_test.cpp b/tests/cpp/analysis/same_statements_test.cpp index 41fba37561f36..9796e51eb46c2 100644 --- a/tests/cpp/analysis/same_statements_test.cpp +++ b/tests/cpp/analysis/same_statements_test.cpp @@ -4,8 +4,7 @@ #include "taichi/ir/analysis.h" #include "taichi/ir/statements.h" -namespace taichi { -namespace lang { +namespace taichi::lang { TEST(SameStatements, TestSameBlock) { auto block = std::make_unique(); @@ -168,5 +167,4 @@ TEST(SameStatements, TestSameLoopIndex) { EXPECT_TRUE(irpass::analysis::same_value(loop_index_a, loop_index_b)); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/analysis/value_diff_test.cpp b/tests/cpp/analysis/value_diff_test.cpp index 5962ec0012556..8a2f92ce9d54b 100644 --- a/tests/cpp/analysis/value_diff_test.cpp +++ b/tests/cpp/analysis/value_diff_test.cpp @@ -4,8 +4,7 @@ #include "taichi/ir/ir_builder.h" #include "taichi/ir/statements.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace irpass { namespace analysis { @@ -132,5 +131,4 @@ TEST(DiffRangeTest, Shl) { } // namespace analysis } // namespace irpass -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/aot/gfx_utils.cpp b/tests/cpp/aot/gfx_utils.cpp index 301c81879b8b5..1c68f3f55be8f 100644 --- a/tests/cpp/aot/gfx_utils.cpp +++ b/tests/cpp/aot/gfx_utils.cpp @@ -2,8 +2,7 @@ #include "taichi/runtime/gfx/aot_module_loader_impl.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace aot_test_utils { static void write_devalloc(taichi::lang::DeviceAllocation &alloc, const void *data, @@ -475,5 +474,4 @@ void run_mpm88_graph(Arch arch, taichi::lang::Device *device_) { device_->dealloc_memory(devalloc_pos); } } // namespace aot_test_utils -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/aot/gfx_utils.h b/tests/cpp/aot/gfx_utils.h index 1a6e90c75abe4..02bcc1abf0726 100644 --- a/tests/cpp/aot/gfx_utils.h +++ b/tests/cpp/aot/gfx_utils.h @@ -6,8 +6,7 @@ #include "taichi/program/graph_builder.h" #include "taichi/program/program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace aot_test_utils { [[maybe_unused]] static void write_devalloc( taichi::lang::DeviceAllocation &alloc, @@ -32,5 +31,4 @@ void view_devalloc_as_ndarray(Device *device_); [[maybe_unused]] void run_mpm88_graph(Arch arch, taichi::lang::Device *device_); } // namespace aot_test_utils -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/aot/llvm/bitmasked_aot_test.cpp b/tests/cpp/aot/llvm/bitmasked_aot_test.cpp index 6041f5d1cff82..64252c4706d63 100644 --- a/tests/cpp/aot/llvm/bitmasked_aot_test.cpp +++ b/tests/cpp/aot/llvm/bitmasked_aot_test.cpp @@ -13,8 +13,7 @@ #include "taichi/program/context.h" #undef TI_RUNTIME_HOST -namespace taichi { -namespace lang { +namespace taichi::lang { static void run_bitmasked_tests(aot::Module *mod, LlvmRuntimeExecutor *exec, @@ -111,5 +110,4 @@ TEST(LlvmAotTest, CudaBitmasked) { } } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/aot/llvm/dynamic_aot_test.cpp b/tests/cpp/aot/llvm/dynamic_aot_test.cpp index f047eb75aa6af..92f6a24927934 100644 --- a/tests/cpp/aot/llvm/dynamic_aot_test.cpp +++ b/tests/cpp/aot/llvm/dynamic_aot_test.cpp @@ -13,8 +13,7 @@ #include "taichi/program/context.h" #undef TI_RUNTIME_HOST -namespace taichi { -namespace lang { +namespace taichi::lang { static void run_dynamic_tests(aot::Module *mod, LlvmRuntimeExecutor *exec, @@ -111,5 +110,4 @@ TEST(LlvmAotTest, CudaDynamic) { } } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/aot/llvm/field_aot_test.cpp b/tests/cpp/aot/llvm/field_aot_test.cpp index 34a801e786a22..5a93b23d82e71 100644 --- a/tests/cpp/aot/llvm/field_aot_test.cpp +++ b/tests/cpp/aot/llvm/field_aot_test.cpp @@ -13,8 +13,7 @@ #include "taichi/program/context.h" #undef TI_RUNTIME_HOST -namespace taichi { -namespace lang { +namespace taichi::lang { static void run_field_tests(aot::Module *mod, LlvmRuntimeExecutor *exec, @@ -143,5 +142,4 @@ TEST(LlvmAotTest, CudaField) { } } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/aot/llvm/field_cgraph_test.cpp b/tests/cpp/aot/llvm/field_cgraph_test.cpp index d11ce02055b72..71f103b881c9a 100644 --- a/tests/cpp/aot/llvm/field_cgraph_test.cpp +++ b/tests/cpp/aot/llvm/field_cgraph_test.cpp @@ -13,8 +13,7 @@ #include "taichi/program/context.h" #undef TI_RUNTIME_HOST -namespace taichi { -namespace lang { +namespace taichi::lang { void run_graph_tests(aot::Module *mod, LlvmRuntimeExecutor *exec, @@ -89,5 +88,4 @@ TEST(LlvmCGraph, CudaField) { } } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/aot/llvm/kernel_aot_test.cpp b/tests/cpp/aot/llvm/kernel_aot_test.cpp index d0783938f98ab..bb177dfd37aa9 100644 --- a/tests/cpp/aot/llvm/kernel_aot_test.cpp +++ b/tests/cpp/aot/llvm/kernel_aot_test.cpp @@ -12,8 +12,7 @@ #include "taichi/program/context.h" #undef TI_RUNTIME_HOST -namespace taichi { -namespace lang { +namespace taichi::lang { TEST(LlvmAotTest, CpuKernel) { CompileConfig cfg; @@ -102,5 +101,4 @@ TEST(LlvmAotTest, CudaKernel) { } } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/backends/dx11_device_test.cpp b/tests/cpp/backends/dx11_device_test.cpp index f1c878030aabf..3d97c0d5d6952 100644 --- a/tests/cpp/backends/dx11_device_test.cpp +++ b/tests/cpp/backends/dx11_device_test.cpp @@ -9,8 +9,7 @@ #include "taichi/system/memory_pool.h" #include "tests/cpp/program/test_program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace directx11 { TEST(Dx11DeviceCreationTest, CreateDeviceAndAllocateMemory) { @@ -153,7 +152,6 @@ TEST(Dx11ProgramTest, MaterializeRuntimeTest) { } } // namespace directx11 -} // namespace lang -} // namespace taichi +} // namespace taichi::lang #endif diff --git a/tests/cpp/common/dict_test.cpp b/tests/cpp/common/dict_test.cpp index 94d4e8e7d4003..0bd167be5d937 100644 --- a/tests/cpp/common/dict_test.cpp +++ b/tests/cpp/common/dict_test.cpp @@ -7,8 +7,7 @@ #include "taichi/common/dict.h" #include "taichi/util/testing.h" -namespace taichi { -namespace lang { +namespace taichi::lang { TEST(Dict, Config) { Dict dict; @@ -32,5 +31,4 @@ TEST(Dict, Config) { EXPECT_EQ(dict.get("str"), "Hello"); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/common/serialization_test.cpp b/tests/cpp/common/serialization_test.cpp index 5e049ee42cbab..373bb7420ec17 100644 --- a/tests/cpp/common/serialization_test.cpp +++ b/tests/cpp/common/serialization_test.cpp @@ -5,8 +5,7 @@ #include "gtest/gtest.h" #include "taichi/common/core.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { class BinIoPair { @@ -146,5 +145,4 @@ TEST(Serialization, MoveOnly) { } } // namespace -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/ir/frontend_type_inference_test.cpp b/tests/cpp/ir/frontend_type_inference_test.cpp index 3798bd7345428..19c87dbc8877d 100644 --- a/tests/cpp/ir/frontend_type_inference_test.cpp +++ b/tests/cpp/ir/frontend_type_inference_test.cpp @@ -5,8 +5,7 @@ #include "taichi/ir/expression_ops.h" #include "taichi/program/compile_config.h" -namespace taichi { -namespace lang { +namespace taichi::lang { TEST(FrontendTypeInference, Const) { auto const_i64 = value(1LL << 63); @@ -183,5 +182,4 @@ TEST(FrontendTypeInference, InternalFuncCall) { EXPECT_EQ(internal_func_call->ret_type, PrimitiveType::i32); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/ir/ir_builder_test.cpp b/tests/cpp/ir/ir_builder_test.cpp index cf681a3c99eb9..4edf8a446b7e3 100644 --- a/tests/cpp/ir/ir_builder_test.cpp +++ b/tests/cpp/ir/ir_builder_test.cpp @@ -8,8 +8,7 @@ #include "taichi/rhi/vulkan/vulkan_loader.h" #endif -namespace taichi { -namespace lang { +namespace taichi::lang { TEST(IRBuilder, Basic) { IRBuilder builder; @@ -154,5 +153,4 @@ TEST(IRBuilder, Ndarray) { EXPECT_EQ(array.read_int({1}), 3); EXPECT_EQ(array.read_int({2}), 42); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/ir/ir_test.cpp b/tests/cpp/ir/ir_test.cpp index 09f5bb6305ce0..7961d07538dda 100644 --- a/tests/cpp/ir/ir_test.cpp +++ b/tests/cpp/ir/ir_test.cpp @@ -3,8 +3,7 @@ #include "taichi/ir/ir.h" #include "taichi/ir/statements.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { std::unique_ptr make_const_i32(int32_t value) { @@ -43,5 +42,4 @@ TEST(Block, EraseRange) { } } // namespace -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/ir/ir_type_promotion_test.cpp b/tests/cpp/ir/ir_type_promotion_test.cpp index b4b71b5044092..afb51b9c43a81 100644 --- a/tests/cpp/ir/ir_type_promotion_test.cpp +++ b/tests/cpp/ir/ir_type_promotion_test.cpp @@ -5,8 +5,7 @@ #include "taichi/ir/transforms.h" #include "tests/cpp/program/test_program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { TEST(IRTypePromotionTest, ShiftOp) { IRBuilder builder; @@ -27,5 +26,4 @@ TEST(IRTypePromotionTest, ShiftOp) { EXPECT_TRUE(ret_type->is_primitive(PrimitiveTypeID::u8)); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/ir/ndarray_kernel.cpp b/tests/cpp/ir/ndarray_kernel.cpp index 080d097b1fd27..e4148d94fb278 100644 --- a/tests/cpp/ir/ndarray_kernel.cpp +++ b/tests/cpp/ir/ndarray_kernel.cpp @@ -1,7 +1,6 @@ #include "tests/cpp/ir/ndarray_kernel.h" -namespace taichi { -namespace lang { +namespace taichi::lang { std::unique_ptr setup_kernel1(Program *prog) { IRBuilder builder1; @@ -44,5 +43,4 @@ std::unique_ptr setup_kernel2(Program *prog) { ker2->insert_scalar_arg(get_data_type()); return ker2; } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/ir/ndarray_kernel.h b/tests/cpp/ir/ndarray_kernel.h index 9ee8d32159615..69b25c59027b2 100644 --- a/tests/cpp/ir/ndarray_kernel.h +++ b/tests/cpp/ir/ndarray_kernel.h @@ -4,11 +4,9 @@ #include "taichi/inc/constants.h" #include "taichi/program/program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { std::unique_ptr setup_kernel1(Program *prog); std::unique_ptr setup_kernel2(Program *prog); -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/ir/stmt_field_manager_test.cpp b/tests/cpp/ir/stmt_field_manager_test.cpp index 0384beb02c740..6bce1ccf8a155 100644 --- a/tests/cpp/ir/stmt_field_manager_test.cpp +++ b/tests/cpp/ir/stmt_field_manager_test.cpp @@ -4,8 +4,7 @@ #include "taichi/ir/statements.h" #include "taichi/util/testing.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { class TestStmt : public Stmt { @@ -74,5 +73,4 @@ TEST(StmtFieldManager, TestStmtFieldManagerWithVector) { EXPECT_EQ(a->field_manager.equal(c->field_manager), false); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/ir/type_test.cpp b/tests/cpp/ir/type_test.cpp index f14aaacd7f524..aec036384a54d 100644 --- a/tests/cpp/ir/type_test.cpp +++ b/tests/cpp/ir/type_test.cpp @@ -2,8 +2,7 @@ #include "taichi/ir/type_factory.h" -namespace taichi { -namespace lang { +namespace taichi::lang { TEST(Type, TypeToString) { auto f16 = TypeFactory::get_instance().get_primitive_real_type(16); @@ -45,5 +44,4 @@ TEST(Type, TypeToString) { EXPECT_EQ(qa->to_string(), "qa(qi1x32)"); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/llvm/llvm_offline_cache_test.cpp b/tests/cpp/llvm/llvm_offline_cache_test.cpp index 8572ea4dd13f9..7b1cf34f4468c 100644 --- a/tests/cpp/llvm/llvm_offline_cache_test.cpp +++ b/tests/cpp/llvm/llvm_offline_cache_test.cpp @@ -28,8 +28,7 @@ namespace fs = std::experimental::filesystem; #include "taichi/program/compile_config.h" #include "taichi/program/program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { constexpr char kKernelName[] = "foo"; @@ -148,8 +147,7 @@ INSTANTIATE_TEST_SUITE_P(Format, testing::Values(Format::LL, Format::BC)); } // namespace -} // namespace lang -} // namespace taichi +} // namespace taichi::lang #endif // #if defined(TI_PLATFORM_LINUX) || defined(TI_PLATFORM_WINDOWS) #endif // #ifdef TI_WITH_LLVM diff --git a/tests/cpp/offline_cache/load_metadata_test.cpp b/tests/cpp/offline_cache/load_metadata_test.cpp index 9db7d7de92d9a..406b3ae8c9eb3 100644 --- a/tests/cpp/offline_cache/load_metadata_test.cpp +++ b/tests/cpp/offline_cache/load_metadata_test.cpp @@ -6,8 +6,7 @@ #include "taichi/runtime/llvm/llvm_offline_cache.h" #endif // TI_WITH_LLVM -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { @@ -108,5 +107,4 @@ TEST(OfflineCache, LoadMetadata) { load_metadata_test(); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/program/test_program.cpp b/tests/cpp/program/test_program.cpp index c08eb254ee02a..96e1723be780a 100644 --- a/tests/cpp/program/test_program.cpp +++ b/tests/cpp/program/test_program.cpp @@ -1,7 +1,6 @@ #include "tests/cpp/program/test_program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { void TestProgram::setup(Arch arch) { prog_ = std::make_unique(arch); @@ -10,5 +9,4 @@ void TestProgram::setup(Arch arch) { /*compile_only=*/false); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/program/test_program.h b/tests/cpp/program/test_program.h index d9c2237f6b988..26df5001e25aa 100644 --- a/tests/cpp/program/test_program.h +++ b/tests/cpp/program/test_program.h @@ -4,8 +4,7 @@ #include "taichi/program/program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class TestProgram { public: @@ -19,5 +18,4 @@ class TestProgram { std::unique_ptr prog_{nullptr}; }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/struct/fake_struct_compiler.h b/tests/cpp/struct/fake_struct_compiler.h index dd632c0ef576a..c4e9f9ea52d55 100644 --- a/tests/cpp/struct/fake_struct_compiler.h +++ b/tests/cpp/struct/fake_struct_compiler.h @@ -1,7 +1,6 @@ #include "taichi/struct/struct.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class FakeStructCompiler : public StructCompiler { public: @@ -15,5 +14,4 @@ class FakeStructCompiler : public StructCompiler { } }; -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/struct/snode_tree_test.cpp b/tests/cpp/struct/snode_tree_test.cpp index 5414dbde56fe3..ceec825bd5c32 100644 --- a/tests/cpp/struct/snode_tree_test.cpp +++ b/tests/cpp/struct/snode_tree_test.cpp @@ -2,8 +2,7 @@ #include "taichi/struct/snode_tree.h" -namespace taichi { -namespace lang { +namespace taichi::lang { TEST(SNodeTree, GetSNodeToRootMapping) { constexpr int kSNodeSize = 16; @@ -27,5 +26,4 @@ TEST(SNodeTree, GetSNodeToRootMapping) { } } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/task/test_exception_handling.cpp b/tests/cpp/task/test_exception_handling.cpp index a6a50a9fc3cb9..c5226313119f8 100644 --- a/tests/cpp/task/test_exception_handling.cpp +++ b/tests/cpp/task/test_exception_handling.cpp @@ -99,4 +99,4 @@ auto test_exception_handling_auto = []() { TI_REGISTER_TASK(test_exception_handling); TI_REGISTER_TASK(test_exception_handling_auto); -} // namespace taichi::lang +} // namespace taichi::lang diff --git a/tests/cpp/task/test_gui.cpp b/tests/cpp/task/test_gui.cpp index 297ef83252a5a..332f43b8c89f5 100644 --- a/tests/cpp/task/test_gui.cpp +++ b/tests/cpp/task/test_gui.cpp @@ -47,4 +47,4 @@ auto test_gui = []() { TI_REGISTER_TASK(test_gui); -} // namespace taichi +} // namespace taichi diff --git a/tests/cpp/transforms/alg_simp_test.cpp b/tests/cpp/transforms/alg_simp_test.cpp index 6857f84969719..50fb41f77b840 100644 --- a/tests/cpp/transforms/alg_simp_test.cpp +++ b/tests/cpp/transforms/alg_simp_test.cpp @@ -4,8 +4,7 @@ #include "taichi/ir/transforms.h" #include "tests/cpp/program/test_program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class AlgebraicSimplicationTest : public ::testing::Test { protected: @@ -173,5 +172,4 @@ TEST_F(AlgebraicSimplicationTest, SimplifyAndMinusOne) { EXPECT_TRUE((*block)[0]->is()); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/transforms/binary_op_simplify_test.cpp b/tests/cpp/transforms/binary_op_simplify_test.cpp index f6cdd8743a47b..d7e1463524ed1 100644 --- a/tests/cpp/transforms/binary_op_simplify_test.cpp +++ b/tests/cpp/transforms/binary_op_simplify_test.cpp @@ -5,8 +5,7 @@ #include "taichi/ir/transforms.h" #include "tests/cpp/program/test_program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class BinaryOpSimplifyTest : public ::testing::Test { protected: @@ -101,5 +100,4 @@ TEST_F(BinaryOpSimplifyTest, ModPOT) { EXPECT_EQ(ir_block->statements[3]->as()->values[0], bin_op); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/transforms/determine_ad_stack_size_test.cpp b/tests/cpp/transforms/determine_ad_stack_size_test.cpp index eb26da430c3d8..a2dcbcd1e4b1e 100644 --- a/tests/cpp/transforms/determine_ad_stack_size_test.cpp +++ b/tests/cpp/transforms/determine_ad_stack_size_test.cpp @@ -6,8 +6,7 @@ #include "taichi/ir/transforms.h" #include "taichi/program/program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class DetermineAdStackSizeTest : public ::testing::TestWithParam> { @@ -184,5 +183,4 @@ TEST_F(DetermineAdStackSizeTest, EmptyNodes) { EXPECT_EQ(stack->max_size, 2); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/transforms/extract_constant_test.cpp b/tests/cpp/transforms/extract_constant_test.cpp index bee205bf5ef18..9d93adebf7471 100644 --- a/tests/cpp/transforms/extract_constant_test.cpp +++ b/tests/cpp/transforms/extract_constant_test.cpp @@ -6,8 +6,7 @@ #include "taichi/ir/transforms.h" #include "taichi/program/program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class ExtractConstantTest : public ::testing::Test { protected: @@ -59,5 +58,4 @@ TEST_F(ExtractConstantTest, ExtractConstant) { EXPECT_EQ(ir_block->size(), 4); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/transforms/inlining_test.cpp b/tests/cpp/transforms/inlining_test.cpp index 8c73fe065d1cc..02de40d543189 100644 --- a/tests/cpp/transforms/inlining_test.cpp +++ b/tests/cpp/transforms/inlining_test.cpp @@ -6,8 +6,7 @@ #include "taichi/ir/transforms.h" #include "taichi/program/program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { class InliningTest : public ::testing::Test { protected: @@ -58,5 +57,4 @@ TEST_F(InliningTest, ArgLoadOfArgLoad) { EXPECT_TRUE(irpass::analysis::same_statements(func_block, kernel_block)); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/transforms/make_block_local_test.cpp b/tests/cpp/transforms/make_block_local_test.cpp index a4094beb8cd8e..c38a80f4916c2 100644 --- a/tests/cpp/transforms/make_block_local_test.cpp +++ b/tests/cpp/transforms/make_block_local_test.cpp @@ -9,8 +9,7 @@ #include "taichi/struct/struct.h" #include "tests/cpp/struct/fake_struct_compiler.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { class MakeBlockLocalTest : public ::testing::Test { @@ -192,5 +191,4 @@ TEST_F(MakeBlockLocalTest, Basic) { } } // namespace -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/transforms/scalar_pointer_lowerer_test.cpp b/tests/cpp/transforms/scalar_pointer_lowerer_test.cpp index d8817948d3969..e9e16f0de98fd 100644 --- a/tests/cpp/transforms/scalar_pointer_lowerer_test.cpp +++ b/tests/cpp/transforms/scalar_pointer_lowerer_test.cpp @@ -10,8 +10,7 @@ #include "taichi/transforms/scalar_pointer_lowerer.h" #include "tests/cpp/struct/fake_struct_compiler.h" -namespace taichi { -namespace lang { +namespace taichi::lang { namespace { constexpr int kPointerSize = 4; @@ -105,5 +104,4 @@ TEST_F(ScalarPointerLowererTest, Basic) { } } // namespace -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/transforms/scalarize_test.cpp b/tests/cpp/transforms/scalarize_test.cpp index ab373492f6c0d..27be6b773f7a6 100644 --- a/tests/cpp/transforms/scalarize_test.cpp +++ b/tests/cpp/transforms/scalarize_test.cpp @@ -4,8 +4,7 @@ #include "taichi/ir/transforms.h" #include "tests/cpp/program/test_program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { // Basic tests within a basic block template @@ -141,5 +140,4 @@ TEST(Scalarize, ScalarizeLoad) { test_load_scalarize(); } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang diff --git a/tests/cpp/transforms/simplify_test.cpp b/tests/cpp/transforms/simplify_test.cpp index 6ead8b6e33d7f..c914c6311bd27 100644 --- a/tests/cpp/transforms/simplify_test.cpp +++ b/tests/cpp/transforms/simplify_test.cpp @@ -4,8 +4,7 @@ #include "taichi/ir/transforms.h" #include "tests/cpp/program/test_program.h" -namespace taichi { -namespace lang { +namespace taichi::lang { // Basic tests within a basic block @@ -54,5 +53,4 @@ TEST(Simplify, SimplifyLinearizedWithTrivialInputs) { } } -} // namespace lang -} // namespace taichi +} // namespace taichi::lang From 11eeee501c34ef0be247984113ece51d0613d328 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 23 Sep 2022 10:16:59 +0000 Subject: [PATCH 4/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- taichi/common/core.h | 1 - taichi/common/serialization.h | 2 +- taichi/program/compile_config.h | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/taichi/common/core.h b/taichi/common/core.h index 93d806b1d4ea2..316181bddb34a 100644 --- a/taichi/common/core.h +++ b/taichi/common/core.h @@ -105,7 +105,6 @@ static_assert(__cplusplus >= 201402L, "C++14 required."); #define TI_STATIC_ASSERT(x) static_assert((x), #x) - void taichi_raise_assertion_failure_in_python(const char *msg); namespace taichi { diff --git a/taichi/common/serialization.h b/taichi/common/serialization.h index 86d043a04b311..778fe7780b94c 100644 --- a/taichi/common/serialization.h +++ b/taichi/common/serialization.h @@ -933,4 +933,4 @@ static_assert( #ifdef TI_INCLUDED } // namespace taichi -#endif \ No newline at end of file +#endif diff --git a/taichi/program/compile_config.h b/taichi/program/compile_config.h index a7d22c58a301a..859044ed1ea54 100644 --- a/taichi/program/compile_config.h +++ b/taichi/program/compile_config.h @@ -113,4 +113,4 @@ struct CompileConfig { extern TI_DLL_EXPORT CompileConfig default_compile_config; -} //namespace taichi::lang \ No newline at end of file +} // namespace taichi::lang