This pull request is a revised version of #76587. This pull request fixes some build issues that were present in the previous version of this change. > 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.
23 lines
808 B
C++
23 lines
808 B
C++
//===------- 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
|