[flang] [clang-tools-extra] [compiler-rt] [lldb] [llvm] [mlir] [clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-11-15 Thread Zequan Wu via cfe-commits
https://github.com/ZequanWu edited https://github.com/llvm/llvm-project/pull/69493 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[compiler-rt] [llvm] [flang] [clang-tools-extra] [mlir] [lldb] [clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-11-09 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay commented: The comment `The data and names sections are omitted in lightweight mode.` in compiler-rt should be updated since binary correlation is different from the lightweight mode https://github.com/llvm/llvm-project/pull/69493

[clang-tools-extra] [compiler-rt] [flang] [llvm] [lldb] [mlir] [clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-11-09 Thread Fangrui Song via cfe-commits
@@ -1331,6 +1336,18 @@ static int merge_main(int argc, const char *argv[]) { "(default: 1)")); cl::ParseCommandLineOptions(argc, argv, "LLVM profile data merger\n"); + if (!DebugInfoFilename.empty() && !BinaryFilename.empty()) { +

[clang-tools-extra] [compiler-rt] [flang] [llvm] [lldb] [mlir] [clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-11-09 Thread Fangrui Song via cfe-commits
@@ -1829,6 +1833,22 @@ void CoverageMappingModuleGen::emit() { llvm::GlobalValue::InternalLinkage, NamesArrVal, llvm::getCoverageUnusedNamesVarName()); } + const StringRef

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-23 Thread Zequan Wu via cfe-commits
ZequanWu wrote: > > > > This should works with PGO when value profiling is disabled > > > > > > > > > Is this not compatible with value profiling? or just not implemented yet? > > > > > > Not compatible, but this feature is mainly for coverage testing. > > Ok, not a big deal as it's

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-23 Thread Zequan Wu via cfe-commits
@@ -60,10 +60,7 @@ using namespace llvm; #define DEBUG_TYPE "instrprof" namespace llvm { -cl::opt -DebugInfoCorrelate("debug-info-correlate", - cl::desc("Use debug info to correlate profiles."), - cl::init(false));

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-23 Thread via cfe-commits
WenleiHe wrote: > > > This should works with PGO when value profiling is disabled > > > > > > Is this not compatible with value profiling? or just not implemented yet? > > Not compatible, but this feature is mainly for coverage testing. Ok, not a big deal as it's probably not worth the

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-23 Thread David Li via cfe-commits
david-xl wrote: > > This should works with PGO when value profiling is disabled > > Is this not compatible with value profiling? or just not implemented yet? Not compatible, but this feature is mainly for coverage testing. https://github.com/llvm/llvm-project/pull/69493

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread David Li via cfe-commits
@@ -98,13 +99,16 @@ extern cl::opt PrintPipelinePasses; static cl::opt ClSanitizeOnOptimizerEarlyEP( "sanitizer-early-opt-ep", cl::Optional, cl::desc("Insert sanitizers on OptimizerEarlyEP."), cl::init(false)); -} + +extern cl::opt ProfileCorrelate;

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread Zequan Wu via cfe-commits
@@ -98,13 +99,16 @@ extern cl::opt PrintPipelinePasses; static cl::opt ClSanitizeOnOptimizerEarlyEP( "sanitizer-early-opt-ep", cl::Optional, cl::desc("Insert sanitizers on OptimizerEarlyEP."), cl::init(false)); -} + +extern cl::opt ProfileCorrelate;

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread Zequan Wu via cfe-commits
ZequanWu wrote: > > I think there should be a proper Clang flag to control this, instead of > > requiring users to pass internal `-mllvm` flags. (Also the flag should be > > well documented.) > > I believe Zequan did that at one point, but he ran into the problem that Rust > and Clang need

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread David Li via cfe-commits
@@ -540,10 +540,10 @@ Error RawInstrProfReader::readHeader( "\nPLEASE update this tool to version in the raw profile, or " "regenerate raw profile with expected version.") .str()); - if (useDebugInfoCorrelate() &&

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread David Li via cfe-commits
@@ -61,9 +64,20 @@ uint64_t __llvm_profile_get_num_data(const __llvm_profile_data *Begin, COMPILER_RT_VISIBILITY uint64_t __llvm_profile_get_data_size(const __llvm_profile_data *Begin, const __llvm_profile_data *End) { + if

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread David Li via cfe-commits
@@ -259,19 +259,19 @@ lprofWriteDataImpl(ProfDataWriter *Writer, const __llvm_profile_data *DataBegin, const char *CountersBegin, const char *CountersEnd, VPDataReaderType *VPDataReader, const char *NamesBegin, const

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread David Li via cfe-commits
@@ -61,9 +64,20 @@ uint64_t __llvm_profile_get_num_data(const __llvm_profile_data *Begin, COMPILER_RT_VISIBILITY uint64_t __llvm_profile_get_data_size(const __llvm_profile_data *Begin, const __llvm_profile_data *End) { + if

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread David Li via cfe-commits
@@ -267,6 +267,9 @@ uint64_t __llvm_profile_get_num_data(const __llvm_profile_data *Begin, uint64_t __llvm_profile_get_data_size(const __llvm_profile_data *Begin, const __llvm_profile_data *End); +/*! \brief Get the size of the profile

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread David Li via cfe-commits
@@ -66,8 +66,9 @@ int __llvm_profile_check_compatibility(const char *ProfileData, Header->NumCounters != __llvm_profile_get_num_counters(__llvm_profile_begin_counters(), __llvm_profile_end_counters()) || -

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread David Li via cfe-commits
@@ -374,6 +376,14 @@ class RawInstrProfReader : public InstrProfReader { return (Version & VARIANT_MASK_DBG_CORRELATE) != 0; } + bool useBinaryCorrelate() const override { +return (Version & VARIANT_MASK_BIN_CORRELATE) != 0; + } + + bool useCorrelate() const {

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread David Li via cfe-commits
@@ -98,13 +99,16 @@ extern cl::opt PrintPipelinePasses; static cl::opt ClSanitizeOnOptimizerEarlyEP( "sanitizer-early-opt-ep", cl::Optional, cl::desc("Insert sanitizers on OptimizerEarlyEP."), cl::init(false)); -} + +extern cl::opt ProfileCorrelate;

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread Reid Kleckner via cfe-commits
rnk wrote: > I think there should be a proper Clang flag to control this, instead of > requiring users to pass internal `-mllvm` flags. (Also the flag should be > well documented.) I believe Zequan did that at one point, but he ran into the problem that Rust and Clang need to agree on the

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-19 Thread via cfe-commits
https://github.com/zmodem commented: I think there should be a proper Clang flag to control this, instead of requiring users to pass internal `-mllvm` flags. (Also the flag should be well documented.) https://github.com/llvm/llvm-project/pull/69493

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-18 Thread Ellis Hoag via cfe-commits
@@ -60,10 +60,7 @@ using namespace llvm; #define DEBUG_TYPE "instrprof" namespace llvm { -cl::opt -DebugInfoCorrelate("debug-info-correlate", - cl::desc("Use debug info to correlate profiles."), - cl::init(false));

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-18 Thread David Li via cfe-commits
david-xl wrote: Can you send a RFC for this enhancement ? The first 2 paragraph of this PR can be expanded a little more to show motivations (RAM saving, or raw profile size saving and why) and the savings data. https://github.com/llvm/llvm-project/pull/69493

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-18 Thread Zequan Wu via cfe-commits
@@ -0,0 +1,11 @@ +; RUN: opt < %s -passes=instrprof -profile-correlate=binary -S | FileCheck %s + +; CHECK: @__profd_foo = private global { i64, i64, i64, ptr, ptr, i32, [2 x i16] } { i64 {{.*}}, i64 {{.*}}, i64 ptrtoint (ptr @__profc_foo to i64) ZequanWu wrote:

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-18 Thread Zequan Wu via cfe-commits
https://github.com/ZequanWu updated https://github.com/llvm/llvm-project/pull/69493 >From 3a394ce5d4d7d91251337bd0a2c1c1a074eb37e6 Mon Sep 17 00:00:00 2001 From: Zequan Wu Date: Tue, 17 Oct 2023 19:24:12 -0400 Subject: [PATCH 1/5] [Profile] Add binary profile correlation. ---

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-18 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff c9b7d21dc577b10dce2b8d67b86b279cfc374d40 c5cca07062572077c4140b4eb9a4bdbb22a385a6 --

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-18 Thread Zequan Wu via cfe-commits
https://github.com/ZequanWu edited https://github.com/llvm/llvm-project/pull/69493 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-18 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Zequan Wu (ZequanWu) Changes This is similar to debug info correlation. The motivation is that debug info correlation doesn't work on Windows because it's hard to make codeview contains those artificial debug info. The idea is to

[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-10-18 Thread Zequan Wu via cfe-commits
https://github.com/ZequanWu created https://github.com/llvm/llvm-project/pull/69493 This is similar to debug info correlation. The motivation is that debug info correlation doesn't work on Windows because it's hard to make codeview contains those artificial debug info. The idea is to