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

[LLVM] Add TI_WITH_LLVM option to disable LLVM backends #1659

Closed
archibate opened this issue Aug 7, 2020 · 6 comments
Closed

[LLVM] Add TI_WITH_LLVM option to disable LLVM backends #1659

archibate opened this issue Aug 7, 2020 · 6 comments
Assignees
Labels
c++ C++ engineering related feature request Suggest an idea on this project llvm LLVM backend

Comments

@archibate
Copy link
Collaborator

Concisely describe the proposed feature
Currently the LLVM backend (originally created by @yuanming-hu) is powerful yet often cause compatibility issue.
For example, I just got a strange segmentation fault when importing Taichi in Blender, whose stacktrace contains *llvm*...
In fact such situation is so often, that I just meet a CUDA RuntimeError when installing taichi on my father's computer willing to show off our works 🤣
So I'd like to minimize the superior position of LLVM over other source-to-source backends (which has better compatibility in this binary perspective):

Describe the solution you'd like (if any)

Currently some nice backends I enjoy with:

  1. OpenGL backend is able to Prevent any OpenGL related function invocation if not specified ti.opengl explicitly.
  2. CUDA backend is able to Prevent any CUDA related function invocation if not specified ti.cuda via @yuanming-hu's DynamicLoader.
  3. Metal, OpenGL and C backend is able to disable from build by simply set TI_WITH_METAL=OFF in CMake options.

It would be great if we could do the same to all LLVM backends, including CPU, since C backend could replace it if needed:

  1. At least prevent any LLVM related function invocation if not specified ti.cpu or ti.cuda.
  2. Provide a TI_WITH_LLVM option in CMake, when set to OFF, to disable all LLVM backends including ti.cpu and ti.cuda.

Additional comments
Add any other context or screenshots about the feature request here.

@archibate archibate added the feature request Suggest an idea on this project label Aug 7, 2020
@archibate archibate added c++ C++ engineering related help wanted llvm LLVM backend labels Aug 7, 2020
@Rullec
Copy link
Contributor

Rullec commented Aug 7, 2020

If here are something I can do, I would be glad to help!

@archibate
Copy link
Collaborator Author

@Rullec thank for the kindness. Do you have a developer setup for Taichi? I.e. build Taichi from source?
You'll need to add #ifdef TI_WITH_LLVM guards at correct positions, which is hard even to me. IMO such error-prone should be assigned to people who are familiar with the LLVM backend, e.g. @yuanming-hu. Not sure if a newscomer could resolve this task easily, sorry.

@Rullec
Copy link
Contributor

Rullec commented Aug 7, 2020

Thanks for your reply and please be no sorry! My standing point is quite simple: do something I can do.

But as you said, though I have the developer setup, It would be hard to me who is not familiar with the backend to handle it.

So do you have some other issue to recommend? I can work on them in my spare time, IMHO It's a lot of fun.

@yuanming-hu
Copy link
Member

Thanks for proposing this!

I have to stress that the LLVM backends have been the most compatible backends and has the greatest portability. They will stay "superior" and will continue to serve as the default backends shipped with all Taichi releases in the foreseeable future.

Adding TI_WITH_LLVM is still helpful, but the main motivation to do that is to make it easier for some developers who happen to not need it. For example, maybe someone only wants to build WASM outputs, or he just wants to ship a pure Taichi shared object with only the Metal backend.

I probably won't have much time to do this in the near future, but if anyone with basic understanding of LLVM is interested in this, feel free to go ahead and implement! :-) Thanks in advance.

@yuanming-hu yuanming-hu removed their assignment Aug 10, 2020
@archibate archibate self-assigned this Aug 10, 2020
@archibate
Copy link
Collaborator Author

I have to stress that the LLVM backends have been the most compatible backends and has the greatest portability.

Not really. In fact, my first motivation for writing a OpenGL backend is that CUDA backend keeps throwing error message despite I have a NVIDIA card.. Do we have test for CUDA against old NVIDIA card? Not to say about #958..

@bobcao3
Copy link
Collaborator

bobcao3 commented Apr 14, 2022

This feature has been added into taichi.

@bobcao3 bobcao3 closed this as completed Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ C++ engineering related feature request Suggest an idea on this project llvm LLVM backend
Projects
None yet
Development

No branches or pull requests

5 participants