forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OpenMP] Add OpenMP extension API to dump mapping tables (llvm#85381)
This adds an API call ompx_dump_mapping_tables. This allows users to debug the mapping tables and can be especially useful for unified shared memory applications to check if the code behaves in the way it should. The implementation reuses code already present to dump mapping tables (in a debug setting). --------- Co-authored-by: Joseph Huber <huberjn@outlook.com>
- Loading branch information
Showing
8 changed files
with
87 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// RUN: %libomptarget-compilexx-run-and-check-generic | ||
|
||
#include <cstdio> | ||
#include <omp.h> | ||
|
||
#define N 10 | ||
|
||
int main() { | ||
int *a = new int[N]; // mapped and released from device 0 | ||
int *b = new int[N]; // mapped to device 2 | ||
|
||
// clang-format off | ||
// CHECK: Mapping tables after target enter data: | ||
// CHECK-NEXT: omptarget device 0 info: OpenMP Host-Device pointer mappings after block | ||
// CHECK-NEXT: omptarget device 0 info: Host Ptr Target Ptr Size (B) DynRefCount HoldRefCount Declaration | ||
// CHECK-NEXT: omptarget device 0 info: {{(0x[0-9a-f]{16})}} {{(0x[0-9a-f]{16})}} | ||
// CHECK-NEXT: omptarget device 1 info: OpenMP Host-Device pointer mappings table empty | ||
// CHECK-NEXT: omptarget device 2 info: OpenMP Host-Device pointer mappings after block | ||
// CHECK-NEXT: omptarget device 2 info: Host Ptr Target Ptr Size (B) DynRefCount HoldRefCount Declaration | ||
// CHECK-NEXT: omptarget device 2 info: {{(0x[0-9a-f]{16})}} {{(0x[0-9a-f]{16})}} | ||
// clang-format on | ||
#pragma omp target enter data device(0) map(to : a[ : N]) | ||
#pragma omp target enter data device(2) map(to : b[ : N]) | ||
printf("Mapping tables after target enter data:\n"); | ||
ompx_dump_mapping_tables(); | ||
|
||
// clang-format off | ||
// CHECK: Mapping tables after target exit data for a: | ||
// CHECK-NEXT: omptarget device 0 info: OpenMP Host-Device pointer mappings table empty | ||
// CHECK-NEXT: omptarget device 1 info: OpenMP Host-Device pointer mappings table empty | ||
// CHECK-NEXT: omptarget device 2 info: OpenMP Host-Device pointer mappings after block | ||
// CHECK-NEXT: omptarget device 2 info: Host Ptr Target Ptr Size (B) DynRefCount HoldRefCount Declaration | ||
// CHECK-NEXT: omptarget device 2 info: {{(0x[0-9a-f]{16})}} {{(0x[0-9a-f]{16})}} | ||
// clang-format on | ||
#pragma omp target exit data device(0) map(release : a[ : N]) | ||
printf("\nMapping tables after target exit data for a:\n"); | ||
ompx_dump_mapping_tables(); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters