Skip to content

Implement code generation of Tapir IR - #11

Merged
aleph-oh merged 19 commits into
cilkfrom
codegen-tapir-ir
Apr 23, 2024
Merged

Implement code generation of Tapir IR#11
aleph-oh merged 19 commits into
cilkfrom
codegen-tapir-ir

Conversation

@aleph-oh

@aleph-ohaleph-oh commented Apr 11, 2024

Copy link
Copy Markdown
Owner

This PR generates Tapir IR from programs that use Cilk keywords. It does this by requiring code generation backends indicate whether they support Tapir and implement code generation for the analogous MIR constructs. The LLVM backend is the only one which currently indicates that it provides Tapir support, and it additionally modifies the code generation process to link in the OpenCilk runtime's bitcode files. We also download the OpenCilk runtime and productivity-tools during bootstrapping so that the default compiler supports using Cilk constructs at runtime, which required some changes to the bootstrapping process.

There are a few limitations at the moment:

  • unwind handling is not supported: code must be compiled with panic=abort
  • functions must have at most 1 sync region
  • sync region tokens are not special-cased, so their naming is not immediately clear (OpenCilk/Clang handles this better)
  • the path to the OpenCilk runtime bitcode files that are linked in is provided through an environment variable OPENCILK_ABI_PATH
  • the path to the OpenCilk runtime search directory is provided through an environment variable OPENCILK_RT_SEARCH_DIR

This PR also changes the test suite by compiling Cilk tests with panic=abort and statically linking the standard library (which has to be rebuilt since it's typically built with the unwinding panic runtime). Building with LTO also could be better tested: it's possible that when building with LTO we don't properly link the runtime.

Implements these Tapir codegen constructs for LLVM as well.
The Cilk tests are only expected to work with panic=abort since code generation for
landing pads and resumes (and general unwind handling) is not implemented yet.
We need to add no-prefer-dynamic to avoid dynamically linking the standard library,
since libstd.so links with libpanic_unwind and we want to link with libpanic_abort.
This commit currently has the Cilk tests which are expected to pass, failing, since
they're being expected to fail rather than pass by the test runner. I'm not sure why
this occurs.
This still doesn't work with the same error. Maybe there's a different
place we use TLII and it's not set, or there's some place where we should
be.
…iables
We now use the enviroment variable OPENCILK_ABI_PATH to configure the path to
the OpenCilk ABI, and the environment variable OPENCILK_RT_SEARCH_DIR to
configure the search path for the OpenCilk runtime. At some point this should
change so that we search many paths for both.
@aleph-oh
aleph-oh marked this pull request as ready for review April 23, 2024 15:49
@aleph-oh
aleph-oh merged commit 080a9c0 into cilkApr 23, 2024
@aleph-oh
aleph-oh deleted the codegen-tapir-ir branch June 4, 2024 20:58
oooacaiooo referenced this pull request in mcj-group/rust-cilk Sep 28, 2025
# This is the 1st commit message:
in llvm-project: Move Orphaning analysis to parent functions
# This is the commit message #2:
in llvm-project: Move Orphaning analysis to parent functions
# This is the commit message #3:
in llvm-project: Move Orphaning analysis to parent functions
# This is the commit message #4:
in llvm-project: Move Orphaning analysis to parent functions
# This is the commit message #5:
in llvm-project: Move Orphaning analysis to parent functions
# This is the commit message #6:
debug
# This is the commit message #7:
debug
# This is the commit message #8:
debug
# This is the commit message #9:
debug
# This is the commit message #10:
debug
# This is the commit message #11:
debug
oooacaiooo referenced this pull request in mcj-group/rust-cilk Oct 24, 2025
# This is the 1st commit message:
in llvm-project: Move Orphaning analysis to parent functions
# This is the commit message #2:
in llvm-project: Move Orphaning analysis to parent functions
# This is the commit message #3:
in llvm-project: Move Orphaning analysis to parent functions
# This is the commit message #4:
in llvm-project: Move Orphaning analysis to parent functions
# This is the commit message #5:
in llvm-project: Move Orphaning analysis to parent functions
# This is the commit message #6:
debug
# This is the commit message #7:
debug
# This is the commit message #8:
debug
# This is the commit message #9:
debug
# This is the commit message #10:
debug
# This is the commit message #11:
debug
oooacaiooo referenced this pull request in mcj-group/rust-cilk Mar 25, 2026
# This is the 1st commit message:
in llvm-project: Move Orphaning analysis to parent functions
# This is the commit message #2:
in llvm-project: Move Orphaning analysis to parent functions
# This is the commit message #3:
in llvm-project: Move Orphaning analysis to parent functions
# This is the commit message #4:
in llvm-project: Move Orphaning analysis to parent functions
# This is the commit message #5:
in llvm-project: Move Orphaning analysis to parent functions
# This is the commit message #6:
debug
# This is the commit message #7:
debug
# This is the commit message #8:
debug
# This is the commit message #9:
debug
# This is the commit message #10:
debug
# This is the commit message #11:
debug
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@aleph-oh