This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][libomptarget][test] Separate lit tests for different offloading targets
ClosedPublic

Authored by protze.joachim on Apr 26 2021, 11:23 AM.

Details

Summary

This patch creates a separate test directory for each offloading target to be tested.
This allows to test multiple architectures in one configuration, while still see all failing tests separately.
The lit test names include the target triple, so that it will be easier to spot the failing target.

The new %...-generic substitutions are preferred over the specialized rules. The specialized rules should only be used, if different action is required for different targets. I only updated mapping/private_mapping.c to demonstrate the necessary change.

This patch also allows to mark expected failing tests based on the target-triple, the currently used triple is added to the "features":

%XFAIL: target-triple

Diff Detail

Event Timeline

protze.joachim requested review of this revision.Apr 26 2021, 11:23 AM

Nice!

Does the permit one line for 'generic' and one for 'nvptx', where generic would run everything except for nvptx?

Maybe add an example of the target specific XFAIL trick?

The majority of tests has 5 identical RUN lines, which just differ in the triple-suffix. These 5 identical lines fold into the generic RUN line like I showed for private_mappings.c
The code I added in lit.cfg effectively makes the generic RUN line an alias for the selected specific RUN line.
I'm not sure, what special handling for nvptx you have in mind.

Tests in unified_shared_memory have 4 RUN lines and omit a nvptx line.
In these tests, I would also use the generic RUN line and mark nvptx64-nvidia-cuda as UNSUPPORTED or XFAIL. I just added api.c and close_enter_exit.c to showcase the changes.
This demonstrates, how you would use UNSUPPORTED / XFAIL for specific target triples.

When I run the libomptarget-nvptx64-nvidia-cuda tests, the output will contain:

$ make check-libomptarget-nvptx64-nvidia-cuda
Unsupported Tests (1):
  libomptarget :: nvptx64-nvidia-cuda :: unified_shared_memory/api.c

********************
Expectedly Failed Tests (1):
  libomptarget :: nvptx64-nvidia-cuda :: unified_shared_memory/close_enter_exit.c

UNSUPPORTED will not even try to run the test for the specified target. XFAIL will try and expect to fail.
I prefer XFAIL if there is a chance, that the test might succeed in the future, so that we remember to activate a test once the test case is supported.
I use UNSUPPORTED in two cases

  • if there is no chance, the test will ever work with this feature (like some clauses/directives are just not available in older clang).
  • if a specific test was fixed between minor releases (e.g. fail with clang/11.0, succeeds with clang/11.1)

I moved the RUN line changes into D101326, which updates all tests.

JonChesterfield accepted this revision.Apr 26 2021, 3:57 PM

That works exactly like I hoped it would. Thanks!

This revision is now accepted and ready to land.Apr 26 2021, 3:57 PM