Skip to content

Supportding dict in LLVM backend #964

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

Closed
czgdp1807 opened this issue Aug 13, 2022 · 2 comments · Fixed by #975
Closed

Supportding dict in LLVM backend #964

czgdp1807 opened this issue Aug 13, 2022 · 2 comments · Fixed by #975
Assignees

Comments

@czgdp1807
Copy link
Collaborator

I gave a thought on how should we go about implementing this. Before writing my conclusion following points should be noted,

  1. Implementing a Hash function is tricky for now in LLVM backend. In addition, using a pre-existing one written in C language sounds like a good choice for me.
  2. Scaling for various combination of types is extremely tricky and unsafe in C. Our asr_to_llvm.cpp allows to scale very easily. We did this for lists and tuples in LLVM backend by generating only the types required by the user code.
  3. In future I believe, we will be able to implement complicated hash functions in Python itself and then compile them via LPython.

So now my conclusion is,

  1. Implement everything other than hash function in LLVM itself, like collision handling, accessing key-value pair, etc.
  2. Implement hash function in C for now and call it from LLVM. In future once we will be able to write and compile hash function in Python itself then we will directly call it from LLVM and stop using the one defined in C runtime.
  3. We should implement everything in dict so that drop in replacement of hash functions is possible.

Rest of the details, blockers I will try to figure out while actually implementing dict.

@czgdp1807 czgdp1807 self-assigned this Aug 13, 2022
@czgdp1807
Copy link
Collaborator Author

@certik What are your thoughts on this?

@certik
Copy link
Contributor

certik commented Aug 13, 2022

Yes, I think that seems like a good plan forward. Let's start in LLVM/C, and then later as LPython becomes stronger, we can move some parts of it to LPython and compile to ASR and then call it from the LLVM backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants