diff options
| author | Ethan Luis McDonough <ethanluismcdonough@gmail.com> | 2024-06-28 10:42:19 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-28 10:42:19 -0500 |
| commit | 5fd2af38e461445c583d7ffc2fe23858966eee76 (patch) | |
| tree | 68d0c11967d2c9e5be737284aa492cb4c15a91cf /offload/DeviceRTL/src | |
| parent | 3497500946c9b6a1b2e1452312a24c41ee412b34 (diff) | |
[PGO][OpenMP] Instrumentation for GPU devices (#76587)
This pull request is the first part of an ongoing effort to extends PGO
instrumentation to GPU device code. This PR makes the following changes:
- Adds blank registration functions to device RTL
- Gives PGO globals protected visibility when targeting a supported GPU
- Handles any addrspace casts for PGO calls
- Implements PGO global extraction in GPU plugins (currently only dumps
info)
These changes can be tested by supplying `-fprofile-instrument=clang`
while targeting a GPU.
Diffstat (limited to 'offload/DeviceRTL/src')
| -rw-r--r-- | offload/DeviceRTL/src/Profiling.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/offload/DeviceRTL/src/Profiling.cpp b/offload/DeviceRTL/src/Profiling.cpp new file mode 100644 index 000000000000..bb3caaadcc03 --- /dev/null +++ b/offload/DeviceRTL/src/Profiling.cpp @@ -0,0 +1,22 @@ +//===------- Profiling.cpp ---------------------------------------- C++ ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "Profiling.h" + +#pragma omp begin declare target device_type(nohost) + +extern "C" { + +// Provides empty implementations for certain functions in compiler-rt +// that are emitted by the PGO instrumentation. +void __llvm_profile_register_function(void *Ptr) {} +void __llvm_profile_register_names_function(void *Ptr, long int I) {} +void __llvm_profile_instrument_memop(long int I, void *Ptr, int I2) {} +} + +#pragma omp end declare target |
