Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[build] Remove circular dependencies in Taichi build system #6838

Open
jim19930609 opened this issue Dec 8, 2022 · 0 comments
Open

[build] Remove circular dependencies in Taichi build system #6838

jim19930609 opened this issue Dec 8, 2022 · 0 comments
Assignees

Comments

@jim19930609
Copy link
Contributor

One prerequisite work to minimize libtaichi_c_api.so library size (#6793) is to migrate CMake OBJECT targets to STATIC targets across Taichi repository. However, ld linker on Linux has strict restriction on the link order of static libraries (https://stackoverflow.com/questions/45135/why-does-the-order-in-which-libraries-are-linked-sometimes-cause-errors-in-gcc), which gives zero tolerance for circular dependencies between static libraries.

We will temporarily work around the circular dependencies issue when compiling for libtaichi_c_api target, but in the long run we'll have to properly fix this issue.

Some known circular dependencies are as follow:

get_implementation_holder_instance_##T()

[taichi_core: taichi/system/interface_registry.cpp] defined
[taichi_common: taichi/common/task.cpp] used

JITSession

[taichi_core: taichi/jit/jit_session.cpp] defined
[cpu_runtime: taichi/runtime/cpu/jit_cpu.cpp] used
[cuda_runtime: taichi/runtime/cuda/jit_cuda.cpp] used
[llvm_runtime: taichi/runtime/llvm/llvm_context.cpp] used

KernelCodeGen

[taichi_core: taichi/codegen/codegen.h] defined
[cpu_codegen: taichi/codegen/cpu/codegen_cpu.h] used
[cuda_codegen: taichi/codegen/cuda/codegen_cuda.h] used
...

StructCompiler

[taichi_core: taichi/struct/struct.h] defined
[llvm_codegen: taichi/codegen/llvm/struct_llvm.cpp] used

AotModuleBuilder

[taichi_core: taichi/aot/module_builder.h] defined
[gfx_cache: taichi/cache/gfx/cache_manager.h] used
[cpu_runtime: taichi/runtime/cpu/aot_module_builder_impl.h] used
[cuda_runtime: taichi/runtime/cuda/aot_module_builder_impl.h] used
...

ParallelExecutor

[taichi_core: taichi/program/parallel_executor.h] defined
[llvm_program_impl: taichi/runtime/program_impls/llvm/llvm_program.h] used

ModuleToFunctionConverter

[taichi_core: taichi/codegen/codegen.h] defined
[cpu_codegen: taichi/codegen/cpu/codegen_cpu.h] used
[cuda_codegen: taichi/codegen/cuda/codegen_cuda.h] used
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

1 participant