Makes the info that is printed for kernel launches configurable for different plugins. Adds all machinery to print the detailed launch info that the current AMD plugin provides and includes e.g. register spill counts. The files msgpack.cpp, msgpack.def, and msgpack.h are copied from the old plugin and are untouched. The contents of UtilitiesHSA.cpp and .h are copied together from various files from the old plugin. The code was originally written by Jon Chesterfield. I updated the function and type names visible to the outside, i.e. in headers, to respect the LLVM conventions. Reviewed By: jhuber6 Differential Revision: https://reviews.llvm.org/D144521
71 lines
4.3 KiB
C
71 lines
4.3 KiB
C
// RUN: %libomptarget-compile-generic \
|
|
// RUN: -gline-tables-only -fopenmp-extensions
|
|
// RUN: env LIBOMPTARGET_INFO=63 %libomptarget-run-generic 2>&1 | \
|
|
// RUN: %fcheck-generic -allow-empty -check-prefixes=INFO
|
|
// RUN: env LIBOMPTARGET_INFO=63 %libomptarget-run-amdgcn-amd-amdhsa 2>&1 | \
|
|
// RUN: %fcheck-amdgcn-amd-amdhsa -allow-empty -check-prefixes=INFO,AMDGPU
|
|
|
|
#include <omp.h>
|
|
#include <stdio.h>
|
|
|
|
#define N 64
|
|
|
|
#pragma omp declare target
|
|
int global;
|
|
#pragma omp end declare target
|
|
|
|
extern void __tgt_set_info_flag(unsigned);
|
|
|
|
int main() {
|
|
int A[N];
|
|
int B[N];
|
|
int C[N];
|
|
int val = 1;
|
|
|
|
// INFO: info: Entering OpenMP data region at info.c:{{[0-9]+}}:{{[0-9]+}} with 3 arguments:
|
|
// INFO: info: alloc(A[0:64])[256]
|
|
// INFO: info: tofrom(B[0:64])[256]
|
|
// INFO: info: to(C[0:64])[256]
|
|
// INFO: info: Creating new map entry with HstPtrBase={{.*}}, HstPtrBegin={{.*}}, TgtPtrBegin={{.*}}, Size=256, DynRefCount=1, HoldRefCount=0, Name=A[0:64]
|
|
// INFO: info: Creating new map entry with HstPtrBase={{.*}}, HstPtrBegin={{.*}}, TgtPtrBegin={{.*}}, Size=256, DynRefCount=0, HoldRefCount=1, Name=B[0:64]
|
|
// INFO: info: Copying data from host to device, HstPtr={{.*}}, TgtPtr={{.*}}, Size=256, Name=B[0:64]
|
|
// INFO: info: Creating new map entry with HstPtrBase={{.*}}, HstPtrBegin={{.*}}, TgtPtrBegin={{.*}}, Size=256, DynRefCount=1, HoldRefCount=0, Name=C[0:64]
|
|
// INFO: info: Copying data from host to device, HstPtr={{.*}}, TgtPtr={{.*}}, Size=256, Name=C[0:64]
|
|
// INFO: info: OpenMP Host-Device pointer mappings after block at info.c:{{[0-9]+}}:{{[0-9]+}}:
|
|
// INFO: info: Host Ptr Target Ptr Size (B) DynRefCount HoldRefCount Declaration
|
|
// INFO: info: {{.*}} {{.*}} 256 1 0 C[0:64] at info.c:{{[0-9]+}}:{{[0-9]+}}
|
|
// INFO: info: {{.*}} {{.*}} 256 0 1 B[0:64] at info.c:{{[0-9]+}}:{{[0-9]+}}
|
|
// INFO: info: {{.*}} {{.*}} 256 1 0 A[0:64] at info.c:{{[0-9]+}}:{{[0-9]+}}
|
|
// INFO: info: Entering OpenMP kernel at info.c:{{[0-9]+}}:{{[0-9]+}} with 1 arguments:
|
|
// INFO: info: firstprivate(val)[4]
|
|
// INFO: info: Launching kernel __omp_offloading_{{.*}}main{{.*}} with {{[0-9]+}} blocks and {{[0-9]+}} threads in Generic mode
|
|
// AMDGPU: AMDGPU device {{[0-9]}} info: SGN:Generic ConstWGSize:{{[0-9]+}} args:{{[0-9]}} teamsXthrds:({{ [0-9]+}}X {{[0-9]+}}) reqd:( {{[0-9]+}}X {{[0-9]+}}) lds_usage:{{[0-9]+}}B sgpr_count:{{[0-9]+}} vgpr_count:{{[0-9]+}} sgpr_spill_count:{{[0-9]+}} vgpr_spill_count:{{[0-9]+}} tripcount:{{[0-9]+}} rpc:0 n:__omp_offloading_{{.*}}main{{.*}}
|
|
// INFO: info: OpenMP Host-Device pointer mappings after block at info.c:{{[0-9]+}}:{{[0-9]+}}:
|
|
// INFO: info: Host Ptr Target Ptr Size (B) DynRefCount HoldRefCount Declaration
|
|
// INFO: info: {{.*}} {{.*}} 256 1 0 C[0:64] at info.c:{{[0-9]+}}:{{[0-9]+}}
|
|
// INFO: info: {{.*}} {{.*}} 256 0 1 B[0:64] at info.c:{{[0-9]+}}:{{[0-9]+}}
|
|
// INFO: info: {{.*}} {{.*}} 256 1 0 A[0:64] at info.c:{{[0-9]+}}:{{[0-9]+}}
|
|
// INFO: info: Exiting OpenMP data region at info.c:{{[0-9]+}}:{{[0-9]+}} with 3 arguments:
|
|
// INFO: info: alloc(A[0:64])[256]
|
|
// INFO: info: tofrom(B[0:64])[256]
|
|
// INFO: info: to(C[0:64])[256]
|
|
// INFO: info: Copying data from device to host, TgtPtr={{.*}}, HstPtr={{.*}}, Size=256, Name=B[0:64]
|
|
// INFO: info: Removing map entry with HstPtrBegin={{.*}}, TgtPtrBegin={{.*}}, Size=256, Name=C[0:64]
|
|
// INFO: info: Removing map entry with HstPtrBegin={{.*}}, TgtPtrBegin={{.*}}, Size=256, Name=B[0:64]
|
|
// INFO: info: Removing map entry with HstPtrBegin={{.*}}, TgtPtrBegin={{.*}}, Size=256, Name=A[0:64]
|
|
// INFO: info: OpenMP Host-Device pointer mappings after block at info.c:[[#%u,]]:[[#%u,]]:
|
|
// INFO: info: Host Ptr Target Ptr Size (B) DynRefCount HoldRefCount Declaration
|
|
// INFO: info: [[#%#x,]] [[#%#x,]] 4 INF 0 global at unknown:0:0
|
|
#pragma omp target data map(alloc : A[0 : N]) \
|
|
map(ompx_hold, tofrom : B[0 : N]) map(to : C[0 : N])
|
|
#pragma omp target firstprivate(val)
|
|
{ val = 1; }
|
|
|
|
__tgt_set_info_flag(0x0);
|
|
// INFO-NOT: Libomptarget device 0 info: {{.*}}
|
|
#pragma omp target
|
|
{}
|
|
|
|
return 0;
|
|
}
|