-
Notifications
You must be signed in to change notification settings - Fork 164
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
Adding Support for symbolics in the list data structure #2368
Conversation
But I am not sure if this is what we want. As in we also need to think about supporting the print operation (which is something I would like to address next). Considering the print operation we would like to have this
OR if we don't want to lose the CPtr based list we need to do introduce a temporary list
|
I'm also a bit confused about transforming the following through the pass. Consider the following program where we are extracting elements out of the list
I would expect something like this to do the job.
But I get a segmentation fault when I try resolving this
|
That should work. Try a simpler example first: def main0():
l1: list[CPtr] = [??]
CPtr: S = l1[0] And put something instead of |
I didn't catch this line correctly. As in
We just need to declare it as we have been doing and everything should work fine
|
Also I observe something weird. Not sure we need to change anything here but this went unnoticed because everything worked perfectly. Consider the following
The work around we introduced allows us to assign a basic variable from right to left like we would do by default. But symengine documentation stresses that we should only use Even that works perfectly though
This is something fundamental as per symengine but I think so everything worked correctly hence we missed implemented |
Yes, |
Yes, I wrote it wrong. It should be:
|
I was just trying to figure to why do I see a segmentation fault when I realized that the following doesn't work
But the following does work
Not sure why this would be the case. Trying to think through it. |
There might be something funny with the initializers for lists. You have to analyze the ASR and then the generated LLVM or C code. |
Well the C code generated works perfectly for both cases. I pasted the above cases in
I think the issue here lies on with the llvm backend ! |
Great. We just have to debug it. |
The latest commit added support for declaring and extracting elements out of a list that is symbolic in nature
Though currently the llvm backend gives us a segmentation fault, at the ASR level we are ready! I haven't thought of how but I'll see if we could support printing of the list next. |
Perfect! Just create a test and only enable the C backend, not LLVM yet. Then we can merge this. |
I've added the tests, I think so the CI would pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks great, thanks!
Use the The other advice: try to create a smaller example that still segfaults. It will make it easier to debug. |
This is an attempt to allow the list data structure to handle symbolics.
So suppose we have something like
Through the pass the following takes place
x
or an intrinsic function likepi
, we do whatever's required like introducing the placeholder , changing type fromS
toCPtr
)So after the pass we have