================
@@ -0,0 +1,31 @@
+! This test checks lowering of the OpenMP tile directive
+! It is done 3 times corresponding to every possible fraction of the last
+! iteration before passing beyond UB.
+
+! RUN: %flang %flags %openmp_flags -fopenmp-version=51 -DUB=16 %s -o 
%t-ub16.exe
----------------
Meinersbur wrote:

The ability has been added in #150722.

It is an established pattern for Clang. The OpenMP (runtime) tests are OpenMP 
code, for which Clang is used to generate calls to the runtime. Therefore this 
indeed an end2end test which are usually avoided in LLVM (See e.g. discussion 
at https://discourse.llvm.org/t/rfc-end-to-end-testing/53306). The alternative 
would have been to have test unittests that call the OpenMP runtime function as 
Clang would generate them (like we actually do for Flang-RT). However, these 
are end2end from the beginning when Intel donated the runtime to the LLVM 
project and no effort has been made to change it for the sake of it. Note that 
other runtime projects, such as 
[libc++](https://github.com/llvm/llvm-project/blob/main/libcxx/test/selftest/), 
have end2end tests as well.

The fact that `!$omp tile` does not emit any runtime call IMHO is an 
implementation detail. It could well involved the runtime like `!$omp do`. We 
already have clang tests for tiling, unrolling, etc. (there was a discusscusson 
about it soewehere in Phabricator), so I think it is consequential to allow 
them for Flang as well. Some of Clang versions of those, and maybe future Flang 
tests, also test implementation-specific behavior, such as [how often arguments 
inside clauses are 
evaluated](https://github.com/llvm/llvm-project/blob/main/openmp/runtime/test/transform/tile/intfor.c).
 Those are tied to specific version of the compiler and would be a pain point 
to keep synchronized in the llvm-test-suite.

In the past I myself argued having Flang's end-2-end tests to be in the 
llvm-test-suite instead of in the monorepository. Reason are that Clang does so 
as well, and you can only run tests for your native architecture; you would not 
be able to test ARM compilation when your machine is x86. For a runtime, you 
can only test it if you run the target arch's code, which might be why end2end 
tests are accepted for LLVM_ENABLE_RUNTIMES projects.

I would not have added them here if OpenMP didn't already rely on end-to-end 
testing. I can create an RFC about end2end tests for OpenMP/runtimes.

> Does this test need a requires line ensuring that flang is built?

`.f90` and `.F90` file are only enabled when Flang is available:
https://github.com/llvm/llvm-project/blob/c80d49590871c2060bbea758e09382bc5f9561c6/openmp/runtime/test/lit.cfg#L45-L46

https://github.com/llvm/llvm-project/pull/160298
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to