-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Dump Metal codegen result to a temporary source file #604
Comments
Currently, no. But for debugging proposed, we may end up emitting intermediate LLVM IR to the sandbox folder. So feel free to use it :-) One worry about the sandbox folder: I think we only use it for development mode now. A little work will have to be done to enable it for release mode. In that case, we need to carefully ensure the sandbox folders are deleted in time so that users' disk space won't get occupied. For a normal run it's fine, but special treatments are needed when users' process crashes halfway (and leaving the sandboxes there...) |
Ah i see. I think I will defer this approach due to the additional works needed... |
In the worst case, since each source file would be just < |
Hmm, this could probably be a bit surprising to the users... But I guess that by creating tmp files in |
+1. dumping codegen result can be really helpful. In fact, OpenGL backend is already doing this for debug purpose: taichi/taichi/codegen/codegen_opengl.cpp Lines 53 to 57 in d3559d0
|
Registering atexit callback doesn't remove the sandbox if taichi crashed accidentally. |
Yep, I am also printing the source code to stdout. But this issue is not only about debugging. We have more and more Metal kernels that are part of the Taichi runtime, and should be shared by all user Taichi kernels. It will be much easier to improve these runtime kernels if they are in their native source format.
SG, actually i'm thinking even less elegant than that. Just leave the files in |
Maybe we want something like
|
+1, I think what you described is more relevant to #439 . The problem in this issue is more around the runtime kernels and the backend-specific helpers that are part of Taichi. For example, it would be easier for me to iterate the development if these helpers taichi/taichi/platform/metal/helpers.metal.h Lines 35 to 62 in d3559d0
are in native Metal, instead of being a string literal. (These helpers may be trivial, but I'm gonna add more runtime Metal code, and it's becoming a bit messy now.) |
Currently the Metal shaders are organized inside |
Concisely describe the proposed feature
I'd like to output the Metal codegen result to an actual source file. Currently, we write the common Metal helper and runtime code as string literals in C++. This approach is becoming very hard to maintain or iterate now, in order to support #593 .
Questions
I saw a sandbox folder is being created when running in
dev
mode. But that seems to be used to only hold of the Taichi runtime.ll
and.bc
, not the compiled user's Taichi kernels. So, are we outputting any tmp source file for any backend? I know that OpenGL doesn't, and the legacy Taichi did. But what about the LLVM backends?On the other hand, when evolving Taichi to the LLVM backend, if there was a particular reason not to generate such files, then I'm fine keeping the helpers just as string literals..
The text was updated successfully, but these errors were encountered: