Harshita Kalani

Week 3 of GSoC 2024: Progress on Intrinsic Functions and Backend Improvements

Hello, welcome to my blog for week 3 of GSoC 2024! This week, I started by implementing array intrinsics like parity and iparity, and elemental intrinsics like isnan, along with some integration tests.
Next, I fixed the code for bit_size, which previously had the wrong return type, and added tests to ensure robustness.
I then removed the lfortran_intrinsic_sin.f90 file from the runtime library and converted it into an integration test. The PR is almost ready with a few changes that I'll do soon.
I continued working on implementing the real intrinsic. Out of four issues that I faced while implementing real, I was able to resolve two: handling the population of optional arguments in intrinsics during compile-time evaluation of implied do loops and managing array output for array input in elemental intrinsics.
While addressing the latter issue, I discovered that the automatic Python script handles both elemental and type inquiry functions. Type inquiry functions inherently return scalars, even for array inputs. Therefore, a more effective solution is to completely separate these two function types rather than using an additional variable to indicate whether a function is elemental or type inquiry (as done in the PR). I plan to discuss this with my mentor and work on it next week. The other two issues are related to this and will be addressed next week.
Then, I implemented two more intrinsics: erfc_scaled and same_as_type. I'm facing some issues with the latter and will discuss them before proceeding. Information about all these intrinsics can be found in the respective PRs tracked in #4017.
I also worked on precision handling for the Fortran backend.
Additionally, I implemented the trim and len_trim intrinsics and removed old code from the runtime library. There's an issue related to generics that I'll discuss with my mentor before proceeding. I'm currently handling the optional arguments for array intrinsics and have picked minloc and maxloc intrinsics to continue with next week.
For the upcoming week, I plan to work on the following tasks:

  • Handle optional arguments for array intrinsics
  • Complete the implementation of real
  • Discuss and implement the solution for handling elemental and type inquiry functions
  • Discuss and implement the solution for same_as_type intrinsic
  • Discuss and implement the solution for generics
  • Work on the remaining intrinsics according to the tracker
Progress tracker: #4017.
Overall, I found this week's work interesting and am grateful to Ondřej Čertík and the rest of the mentors at LFortran for their constant reviews and suggestions. I look forward to next week and am eager to complete the planned tasks.

Here's a link to related blogs:
GSoC: Week 1
GSoC: Week 2
GSoC: Week 4
GSoC: Week 5