Page MenuHomePhabricator

[VE][compiler-rt] Add VE as a target of crt
ClosedPublic

Authored by kaz7 on Dec 7 2020, 2:04 AM.

Details

Summary

SX Aurora VE is an experimental target. We upstreamed many part of
ported llvm and clang. In order to continue this move, we need to
support libraries next, then we need to show the ability of llvm for
VE through test cases. As a first step for that, we need to use
crt in compiler-rt. VE has it's own crt but they are a part of
proprietary compiler. So, we want to use crt in compiler-rt as an
alternative.

This patch enables VE as a candidate of crt in compiler-rt.

Diff Detail

Event Timeline

kaz7 created this revision.Dec 7 2020, 2:04 AM
kaz7 requested review of this revision.Dec 7 2020, 2:04 AM
Herald added a subscriber: Restricted Project. · View Herald TranscriptDec 7 2020, 2:04 AM
kaz7 added a comment.Dec 7 2020, 2:08 AM

VE is on the way to upstream, so it is an experimental target at the moment. This time, I'd like to add this VE as a candidate of crt/profile target in config-ix.cmake. I think it's better to be reviewed by people who are working on config-ix.cmake. So, I add people working on this file. Please review these modifications. Thanks!

Maybe I am missing something, but it doesn't seem to be supported in llvm yet:
https://github.com/llvm/llvm-project/blob/main/llvm/CMakeLists.txt#L302-L320

Is this target supported by gcc perhaps?

kaz7 added a comment.Dec 7 2020, 4:18 PM

Maybe I am missing something, but it doesn't seem to be supported in llvm yet:
https://github.com/llvm/llvm-project/blob/main/llvm/CMakeLists.txt#L302-L320

Thank you for your comment. No, it isn't supported yet. It is being upstreamed:
https://lists.llvm.org/pipermail/llvm-dev/2019-April/131580.html
https://github.com/llvm/llvm-project/tree/main/llvm/lib/Target/VE

So, it is not officially supported yet. It is an experimental target at the moment. However, in order to compile crt/profile for VE using LLVM for VE, we need above modifications. I'm not sure whether it is OK to add experimental target like above or not. It's the reason I add several people who know config-ix.cmake a lot as reviewers of this patch.

If it is OK to add experimental target, please review above as is. If not, please let me know how to add such a experimental target to config-ix.cmake. Thanks in advance.

compnerd requested changes to this revision.Dec 8 2020, 11:24 AM

I think that once the LLVM backend target is merged, it would be reasonable to commit this change. The target being experimental is fine, but it should be available. (Marking as requesting changes until the backend is merged).

This revision now requires changes to proceed.Dec 8 2020, 11:24 AM
kaz7 added a comment.Dec 8 2020, 1:26 PM

Thank you for your comment. Well, I'll continue merging backend first. The backend of VE is almost merged, so I wanted to show it compiles compiler-rt, libcxxabi, libcxx, and openmp before making VE as an official target. I change my mind. I try to make it as an official target first. Thanks.

kaz7 added a comment.Dec 15 2020, 1:37 AM

@compnerd , I have a question. I'm thinking that you might misunderstand my explanations. VE is almost merged. I can compile llvm-project using already upstreamed llvm/clang. Now, in order to continue the upstreaming, I need crtbegin.o and crtend.o in compiler-rt. It is a reason why I submit this patch. Didn't you misunderstand the situation? Thanks!

rengolin added a subscriber: rengolin.EditedJan 5 2021, 1:25 AM

@compnerd , I have a question. I'm thinking that you might misunderstand my explanations. VE is almost merged. I can compile llvm-project using already upstreamed llvm/clang. Now, in order to continue the upstreaming, I need crtbegin.o and crtend.o in compiler-rt. It is a reason why I submit this patch. Didn't you misunderstand the situation? Thanks!

Hi @kaz7,

I re-read @compnerd reply and I agree with you that it's confusing. :)

Your target is available to build (via experimental flags) and it's not on the default list because it's not in production yet.

@compnerd, the VE code has landed already on both LLVM and Clang, and it's on its way to gain production quality before it's moved to the default list. But for that, it needs a runtime library.

I'm not sure what's the reason behind holing until it's in production. This only works for targets that have alternative libraries (in GCC or proprietary).

If you fear is dead code, IIUC, it should be pretty trivial to remove the RT VE side of things if the target is ultimately rejected (I'm not expecting it, but...), just like Clang and LLVM.

Makes sense?

kaz7 added a comment.Jan 5 2021, 1:30 AM

Hi @kaz7,

If I understand correctly, this is a chicken-egg problem. You can't upstream the back-end without the RT changes because you have no other RT to rely on (unlike other targets that can use the GCC toolchain). In this case, I think it makes sense that we merge at least some bootstrapping code in RT before the back-end.

Hi @rengolin,

Thank you for the response. Your description is correct. That is what I tried to describe. Thanks.

Thank you for the response. Your description is correct. That is what I tried to describe. Thanks.

Perfect! I re-read the comments and I see your point. I have edited my answer to fit the new understanding, sorry for the mess. :)

kaz7 updated this revision to Diff 315116.Jan 7 2021, 6:01 AM

Remove modification on the candidates of profilers.
Leave only modification on the candidates of crt and rebase.
Add explanations too.

kaz7 retitled this revision from [VE][compiler-rt] Add VE as a candidate of crt/profile to [VE][compiler-rt] Add VE as a target of crt.Jan 7 2021, 6:02 AM
kaz7 edited the summary of this revision. (Show Details)

Not sure what is the problem... Remove profile support to make this patch as simple as possible.

phosek accepted this revision.Jan 7 2021, 1:50 PM

LGTM

kaz7 added a comment.Jan 8 2021, 6:07 AM

LGTM

Thanks. But the status of this patch is still Needs Review. I guess this patch requires @compnerd's acceptance (please let me know if I misunderstand).

@compnerd , please review this patch if you have time. Thanks.

compnerd accepted this revision.Jan 11 2021, 1:57 PM
This revision is now accepted and ready to land.Jan 11 2021, 1:57 PM
This revision was automatically updated to reflect the committed changes.