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
Added detail to codegen section #1216
Conversation
thread to generate work for them. If `parallel_compiler` _is_ true, the LLVM queue is | ||
loaded in parallel. | ||
|
||
At the end, the linker is ran and combines all the compiled codegen units together into one binary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
At the end, the linker is ran and combines all the compiled codegen units together into one binary. | |
At the end, the linker is run and combines all the compiled codegen units together into one binary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the end, the linker is ran and combines all the compiled codegen units together into one binary. | |
At the end, the compiled codegen units together into the final artifact. For binary executable results this is done by a linker. |
Executable binary is not the only kind of the output we have. rlib
s, so
s and o
s are some of the others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nagisa I think your suggestion may be missing the words "are combined together" or similar.
@nagisa Could you give this a review? Feel free to reassign by the way :) |
Once the partitions have been sorted, the smallest and largest halves are iterated over separately. | ||
Their elements are paired and stored in a `Vec` so that the largest | ||
and smallest partitions are first and second, the second largest and smallest are | ||
third and fourth, and so on. These partitions are then translated into LLVM-IR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is misleading to mention LLVM IR explicitly, especially now that there are 5+ rustc codegens for all kinds of IRs. It should mention that a codegen backend is invoked to translate the cgu to its particular IR. Especially because you dont mention cg_llvm, only cg_ssa, and cg_ssa does not do any llvm things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also don't think its all that important to talk about the particularities of how the order of the CUs to translate is established. It suffices to say, I feel, that the compiler partition and order the CUs in an effort to [... whatever the goals are at the given time...]
the largest partitions would be in memory at the same time; increasing memory consumption and | ||
impacting overall performance. | ||
|
||
Once the partitions have been organized they must be translated into LLVM-IR, where they are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same thing as above
- A `rustc` version of an [OwningRef][OwningRef] | ||
|
||
First, we collect and partition the [monomorphized][monomorphization] version of the program | ||
that has been compiled. The individual partitions are then sorted from largest to smallest. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that has been compiled. The individual partitions are then sorted from largest to smallest. | |
that is being compiled. The individual partitions are then sorted from largest to smallest. |
Once the partitions have been sorted, the smallest and largest halves are iterated over separately. | ||
Their elements are paired and stored in a `Vec` so that the largest | ||
and smallest partitions are first and second, the second largest and smallest are | ||
third and fourth, and so on. These partitions are then translated into LLVM-IR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also don't think its all that important to talk about the particularities of how the order of the CUs to translate is established. It suffices to say, I feel, that the compiler partition and order the CUs in an effort to [... whatever the goals are at the given time...]
thread to generate work for them. If `parallel_compiler` _is_ true, the LLVM queue is | ||
loaded in parallel. | ||
|
||
At the end, the linker is ran and combines all the compiled codegen units together into one binary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the end, the linker is ran and combines all the compiled codegen units together into one binary. | |
At the end, the compiled codegen units together into the final artifact. For binary executable results this is done by a linker. |
Executable binary is not the only kind of the output we have. rlib
s, so
s and o
s are some of the others.
@Sl1mb0 Triage ping, could you address the review comments above? |
I'm going to close this as inactive but feel free to re-open another PR or pick up their work if anyone is interested in continuing the work, thanks for contributing! |
This provides more in-depth descriptions of the parallelism occurring during codegen. There are probably a few things I got wrong conceptually, so don't hesitate to point them out :)