Skip to content
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

enh: support runtime dim for count #3658

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Pranavchiku
Copy link
Contributor

Fixes #3630.

@Pranavchiku Pranavchiku added enhancement Issues or pull request for enhancing existing functionality intrinsic Issue or pull request specific to intrinsic function labels Mar 17, 2024
@Pranavchiku
Copy link
Contributor Author

integration_tests/intrinsic_172.f90 work well for me ( Mac M2 air ), will have to check why it fails on linux.

@Pranavchiku
Copy link
Contributor Author

This works fine on linux as well:

~/lfortran (gh3630)$ lfortran ./integration_tests/intrinsics_172.f90 
7
6
18
2 1 2 2 
2 2 3 
2 1 2 2 
2 2 3 
6
9 
6
6 
6
6
18
4 3 
18
3 3 
18
18
18
18
57
5 3 1 
~/lfortran (gh3630)$ lfortran ./integration_tests/intrinsics_172.f90  --fast
7
6
18
2 1 2 2 
2 2 3 
2 1 2 2 
2 2 3 
6
9 
6
6 
6
6
18
4 3 
18
3 3 
18
18
18
18
57
5 3 1 

@Thirumalai-Shaktivel
Copy link
Member

The tests fail for the LLVM version >= 14. Try creating a new conda env and install LLVM 14. I think you will be able to reproduce the seg fault.

@Pranavchiku
Copy link
Contributor Author

I tried it all, it works somehow, let me see if I can reproduce.

@@ -49,13 +51,27 @@ program intrinsics_172
print *, count(mask, 2)
if (sum(count(mask, 2)) /= 7) error stop

dim = 1
print *, count(mask, dim)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line seems to segfault for LLVM >= 14.

@certik
Copy link
Contributor

certik commented Mar 21, 2024

To Debug:

  • uncomment all changes in the test, run CI, ensure everything passes. If not, the bug is elsewhere in the PR.

Assuming it is coming from the line 55 in the test, then we need to debug it why it fails. Try to remove it from print, as well as do other simplifications.

On macOS you can also use leaks to check the generated binary and see if discovers any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issues or pull request for enhancing existing functionality intrinsic Issue or pull request specific to intrinsic function
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support runtime dim for intrinsic Count
3 participants