-
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
Access out-of-bound checking on CPU backends (Stage 2) #582
Conversation
It still gives me more than one assertion messages:
if I revert 3498767 to test it. I think it is not essential to lock I tried Or we could allocate a buffer for each call of |
Since the kernels are multithreaded, it's normal if you are getting #messages that is <= #cores. As long as there're no false positives we are good. |
How about to allocate a buffer for each core? eg.: struct PerCPU {
char buffer[233];
... // some other resources
}; Very common approach in milti-processor OS kernels. |
You can simply |
Thread-local storage is a good idea but we need more infrastructure before we actually implement this. |
I think I'll choose this solution. As long as |
Oh, it may be better to just implement another Then we can safely use a lock on a global buffer or |
Let's just take the simplest solution |
Actually, as you mentioned, even if we have multiple threads, we only need one error message. This can be done by having something like
The first thread with assertion error just set Then the host will check the error code, and if non-zero, halt the program with the error message. This will allow the host to throw exceptions instead of worker threads in the thread queue, leading to a more testable design. |
By combining |
Looks good! There are many design choices here. Let's briefly skype chat if you are available. |
After this line taichi/taichi/program/kernel.cpp Line 46 in a3df422
call Program::check_runtime_error if in debug mode and on CPU.
in taichi/taichi/program/program.cpp Line 158 in 3498767
taichi/taichi/program/program.cpp Line 166 in 3498767
|
For taichi/taichi/runtime/llvm/runtime.cpp Line 735 in 3498767
|
Hi @xumingkuan, do you want me to merge this in for now, and you open a new PR for the enhanced assertion failure treatment? (Just trying to avoid large changesets...) |
Let's merge this in for now. I found that shopping and cooking take some time, so it may take a longer time than I thought for me to finish the enhanced assertion failure treatment. |
Sounds good. |
Related issue id = #561
A continuation of #572