-
Notifications
You must be signed in to change notification settings - Fork 16
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
[flang][nfc] Move tests from intrinsic-procedures.f90 to dedicated files #927
[flang][nfc] Move tests from intrinsic-procedures.f90 to dedicated files #927
Conversation
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.
On my side that looks reasonable. I agree an intrinsic by intrinsic file split will help regression investigation and is the easiest to reason about.
If other people are OK with this change, could you rename the new directory to intrinsic-procedures
(without the new
suffix), it won't be new for long ! There is also a tutorial about intrinsic that would need a small update regarding where to write tests: (here and here).
Thanks !
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.
How difficult would it be to convert to lowercase file names (subject to someone else also asking for it)?
I have suggested some changes as questions.
Not difficult at all #! /usr/bin/env bash
set -euo pipefail
LLVM_PROJECT_ROOT=$1
INTRINSIC_TEST_DIR=$LLVM_PROJECT_ROOT/flang/test/Lower/intrinsic-procedures
cd $INTRINSIC_TEST_DIR
for test_file in *
do
dest_file=$(echo $test_file | tr 'A-Z' 'a-z')
mv $test_file $dest_file
done Just run like this: bash rename.sh <f18-llvm-project-root-dir> |
Overall, looks good to me. As @jeanPerier stated, please update the intrinsic tutorial to indicate the new process for adding intrinsic tests. |
I have just rebased this on top of @kiranchandramohan I'm a bit confused with the test in |
Rebased on top of |
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.
LGTM.
I still prefer lowercase file names. :)
Lowercase file names would be more consistent with the rest of the tests. |
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.
Thanks for splitting this up.
I know you didn't write the tests initially, but it looks like some of the individual tests could be hardened here. More CHECK lines, more elaborated CHECK lines that include types, getting rid of CHECK-DAGs that don't seem to be necessary, etc.
Hi @schweitzpgi ,
I agree. In general, I would rather do such refactoring in a separate patch. It would make for a cleaner Git history. I will try that next time - this patch already fixes quite a few tests (i.e. it's no longer a verbatim copy). I've just uploaded a patch with updated |
@schweitzpgi , @kiranchandramohan , the 4th commit that I've just uploaded renames this files as suggested. |
I commented on a possible typo. Looks like you used the generate script with the I'm fine with processing the rest of the files with the script in a separate PR. |
Yes, after a few hundred hand-written lines you reach the "there must a better way" point :) Do you use it and does it work for you out of the box? |
I do use it. But, no, it doesn't always work right. |
Can you squash the commits? Then we can get this merged in. Thanks, Andrzej. |
All tests from flang/test/Lower/intrinsic-procedures.f90 are moved to dedicated files (with the exception of `lge`, `lgt`, `lle` and `llt`). With this change, every filename clearly defines which intrinsic procedure is being tested. After the initial split, we discovered that some tests were invalid (e.g. `! CHECK` was used instead of `! CHECK:`). These tests are now fixed. Some tests are additionally hardened (e.g. some `CHECK-DAG` directives was replaced with `CHECK`). Some tests are updated with checks generated with mlir/utils/generate-test-checks.py. In other words, this patch _moves_ and _reformats_ the tests. The documentation is updated accordingly (with some extra clarifications, as suggested by the reviewers). Please see the following PRs for a complete discussion: * #927 * #914
There appears to be a problem with intrinsic-procedures/verify.f90. I get a CHECK failure when I build with clang++ (head). |
I have not been able to reproduce this :/ Tried with Clang-12 and Clang-13. I did have to tweak 2 values in verify.f90 (these changed between the builds, so I replaced them with regex patterns): https://github.com/flang-compiler/f18-llvm-project/blob/fir-dev/flang/test/Lower/intrinsic-procedures/verify.f90#L18-L19. The first one looks like an address, so I'm not surprised that it might change. The 2nd is a bit of mystery to me. Otherwise, I don't see anything suspicious. |
All tests from flang/test/Lower/intrinsic-procedures.f90 are moved to dedicated files (with the exception of `lge`, `lgt`, `lle` and `llt`). With this change, every filename clearly defines which intrinsic procedure is being tested. After the initial split, we discovered that some tests were invalid (e.g. `! CHECK` was used instead of `! CHECK:`). These tests are now fixed. Some tests are additionally hardened (e.g. some `CHECK-DAG` directives was replaced with `CHECK`). Some tests are updated with checks generated with mlir/utils/generate-test-checks.py. In other words, this patch _moves_ and _reformats_ the tests. The documentation is updated accordingly (with some extra clarifications, as suggested by the reviewers). Please see the following PRs for a complete discussion: * #927 * #914
All tests from flang/test/Lower/intrinsic-procedures.f90 are moved to dedicated files (with the exception of `lge`, `lgt`, `lle` and `llt`). With this change, every filename clearly defines which intrinsic procedure is being tested. After the initial split, we discovered that some tests were invalid (e.g. `! CHECK` was used instead of `! CHECK:`). These tests are now fixed. Some tests are additionally hardened (e.g. some `CHECK-DAG` directives was replaced with `CHECK`). Some tests are updated with checks generated with mlir/utils/generate-test-checks.py. In other words, this patch _moves_ and _reformats_ the tests. The documentation is updated accordingly (with some extra clarifications, as suggested by the reviewers). Please see the following PRs for a complete discussion: * #927 * #914
All new tests files have been extracted automatically from
intrinsic-procedures.f90
with the following script (I had to do a few minor edits manually too):Please consider this patch as an RFC.
Also, I am aware that 2 tests are currently failing:I've not had the time to investigate this. I'd like to hear your thoughts first.EDIT
Lower/intrinsic-procedures-new/SPACING.f90
was failing due to invalidCHECK
lines, e.g.: https://github.com/flang-compiler/f18-llvm-project/blob/fir-dev/flang/test/Lower/intrinsic-procedures.f90#L1188 (missing:
afterCHECK
).Lower/intrinsic-procedures-new/TRIM.f90
was getting confused when matching theCHECK-LABEL
directives. They are not unique enough and get matched match with code inside the functions.I have fixed these in my 2nd commit.