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

Upgrade taichi to use LLVM15 #6447

Closed
8 tasks done
ailzhang opened this issue Oct 26, 2022 · 4 comments
Closed
8 tasks done

Upgrade taichi to use LLVM15 #6447

ailzhang opened this issue Oct 26, 2022 · 4 comments
Assignees
Labels
potential bug Something that looks like a bug but not yet confirmed

Comments

@ailzhang
Copy link
Contributor

ailzhang commented Oct 26, 2022

Thanks to @python3kgae we have pretty nice LLVM15 compatible code across the codebase now. And using an old version of LLVM (LLVM10) have limited us from applying advanced optimizations as well as adapting to newer hardware. So we're planning to upgrade taichi to depend on LLVM15. The overall process is kinda simple, fix the failed tests and enable TI_LLVM_15 in every CI job we have, and finally remove all the ifdef TI_LLVM_15 in the codebase.

A rough list of tasks:

@ailzhang ailzhang added the potential bug Something that looks like a bug but not yet confirmed label Oct 26, 2022
@ailzhang ailzhang changed the title LLVM upgrad Upgrade taichi to use LLVM15 Oct 26, 2022
@python3kgae
Copy link
Collaborator

python3kgae commented Oct 27, 2022

  • windows cpu
    windows cpu is enabled too.
  • do we want to upgrade the compiler to compile .bc files?
    It would be nice to upgrade clang to 15, that will generate more test cases for opaque ptr.
  • release prebuilt llvm binaries across different platforms & update docs (or shall we add llvm as a submodule?)
    rust add llvm as a submodule. But that will make clean build very slow. Also clone llvm repo will take some time.

@ailzhang
Copy link
Contributor Author

But that will make clean build very slow. Also clone llvm repo will take some time.
+1 that's the main reason we ship prebuilt llvm binaries on different platform IIRC. Building llvm from source does take a long time so we might have to stay on the current prebuilt approach ...

ailzhang added a commit that referenced this issue Oct 28, 2022
…6458)

Issue: #6447

### Brief Summary
Previously we inject some cuda kernel metadata after linking, that was
problematic since when you modify metadata for a llvm::Function you'll
have to use the exactly same LLVMContext it was created in. Thus we
failed verifyModule check from LLVM15. And we happened to only TI_WARN
there so didn't notice this issue.
![Screenshot from 2022-10-26
17-10-43](https://user-images.githubusercontent.com/5248122/198422336-fd4ed5e8-aa3c-4baf-841a-95bba5c148e0.png)

This PR fixes it by moving the mark as CUDA step up to parallel
compilation so that it was guaranteed to be in the same LLVMContext.
ailzhang added a commit that referenced this issue Oct 31, 2022
ailzhang added a commit that referenced this issue Nov 17, 2022
Issue: #6447 

### Brief Summary
Just trying my luck in CI since my local mac is on macOS12.
ailzhang added a commit that referenced this issue Nov 17, 2022
Issue: #6447

### Brief Summary
Deleting this job first since we're almost there, deleting this one can
make the windows queue shorter.
ailzhang added a commit that referenced this issue Nov 17, 2022
Issue: #6447 

### Brief Summary
Getting closer...
ailzhang added a commit that referenced this issue Nov 18, 2022
Issue: #6447 

### Brief Summary
Updating links in dev install doc. 

Nit: we still depend on clang-10/clang-11 to produce runtime.bc files
and that part will be updated once those are cleaned up.
ailzhang added a commit that referenced this issue Nov 18, 2022
For taichi devs, if you hit any issues with this option, please turn it
off temporarily and open an issue.

Issue: #6447

### Brief Summary

There're a few followup cleanups after PR but let's turn it on by
default to shake out all the problems.
@ailzhang
Copy link
Contributor Author

ailzhang commented Nov 18, 2022

FYI #6649 turned on TI_LLVM_15 by default, we'll make sure nightly runs well and then remove all the #ifdef TI_LLVM_15 in the codebase.

Other tasks I'm looking into atm:

ailzhang added a commit that referenced this issue Nov 20, 2022
Issue: #6447 

### Brief Summary
Got the following error message when building manylinux2014 wheel since
the base docker image doesn't have `unzip`:
```
2022-11-18T06:14:27.6476325Z + unzip taichi-llvm-15-linux.zip
2022-11-18T06:14:27.6485595Z /home/dev/taichi/.github/workflows/scripts/unix-build.sh: line 13: unzip: command not found
```
reference log:
https://pipelines.actions.githubusercontent.com/serviceHosts/ebf0abad-1193-4ff9-9c60-da990d1eacd9/_apis/pipelines/1/runs/56327/signedlogcontent/20?urlExpires=2022-11-18T06%3A42%3A59.6939664Z&urlSigningMethod=HMACV1&urlSignature=pRp%2BtWL7jg6DXBr5bfgq0r5KqUwjrJ6bAM4WAXwP5S0%3D
@ailzhang
Copy link
Contributor Author

FYI I'd consider LLVM15 upgrade is done at this point. There're two followups that might be helpful but with lower priority:

I'll open separate issues to track these followups.

quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
Issue: taichi-dev#6447 

### Brief Summary
Just trying my luck in CI since my local mac is on macOS12.
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
Issue: taichi-dev#6447

### Brief Summary
Deleting this job first since we're almost there, deleting this one can
make the windows queue shorter.
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
Issue: taichi-dev#6447 

### Brief Summary
Updating links in dev install doc. 

Nit: we still depend on clang-10/clang-11 to produce runtime.bc files
and that part will be updated once those are cleaned up.
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
For taichi devs, if you hit any issues with this option, please turn it
off temporarily and open an issue.

Issue: taichi-dev#6447

### Brief Summary

There're a few followup cleanups after PR but let's turn it on by
default to shake out all the problems.
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
Issue: taichi-dev#6447 

### Brief Summary
Got the following error message when building manylinux2014 wheel since
the base docker image doesn't have `unzip`:
```
2022-11-18T06:14:27.6476325Z + unzip taichi-llvm-15-linux.zip
2022-11-18T06:14:27.6485595Z /home/dev/taichi/.github/workflows/scripts/unix-build.sh: line 13: unzip: command not found
```
reference log:
https://pipelines.actions.githubusercontent.com/serviceHosts/ebf0abad-1193-4ff9-9c60-da990d1eacd9/_apis/pipelines/1/runs/56327/signedlogcontent/20?urlExpires=2022-11-18T06%3A42%3A59.6939664Z&urlSigningMethod=HMACV1&urlSignature=pRp%2BtWL7jg6DXBr5bfgq0r5KqUwjrJ6bAM4WAXwP5S0%3D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
potential bug Something that looks like a bug but not yet confirmed
Projects
Status: Done
Development

No branches or pull requests

2 participants