Skip to content

Commit

Permalink
Merge remote-tracking branch 'parent/main' into wasmlibunwindfix
Browse files Browse the repository at this point in the history
  • Loading branch information
trcrsired committed Oct 1, 2024
2 parents 13918ae + 32ffc9f commit 02452b4
Show file tree
Hide file tree
Showing 7,449 changed files with 516,500 additions and 207,341 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
7 changes: 6 additions & 1 deletion .github/new-prs-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ mlgo:
- llvm/lib/CodeGen/ML*
- llvm/unittests/CodeGen/ML*
- llvm/test/CodeGen/MLRegAlloc/**
- llvm/utils/mlgo-utils/*
- llvm/utils/mlgo-utils/**

tools:llvm-exegesis:
- llvm/tools/llvm-exegesis/**
Expand Down Expand Up @@ -1008,3 +1008,8 @@ bazel:

offload:
- offload/**

tablegen:
- llvm/include/TableGen/**
- llvm/lib/TableGen/**
- llvm/utils/TableGen/**
5 changes: 2 additions & 3 deletions .github/workflows/commit-access-review.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,10 @@ def main():
gh = github.Github(login_or_token=token)
org = gh.get_organization("llvm")
repo = org.get_repo("llvm-project")
team = org.get_team_by_slug("llvm-committers")
one_year_ago = datetime.datetime.now() - datetime.timedelta(days=365)
triage_list = {}
for member in team.get_members():
triage_list[member.login] = User(member.login, triage_list)
for collaborator in repo.get_collaborators(permission="push"):
triage_list[collaborator.login] = User(collaborator.login, triage_list)

print("Start:", len(triage_list), "triagers")
# Step 0 Check if users have requested commit access in the last year.
Expand Down
23 changes: 15 additions & 8 deletions .github/workflows/libcxx-build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,24 @@ jobs:
**/crash_diagnostics/*
macos:
runs-on: macos-14
needs: [ stage1 ]
strategy:
fail-fast: true
fail-fast: false
matrix:
config: [
generic-cxx03,
generic-cxx23,
generic-modules,
apple-configuration
]
include:
- config: generic-cxx03
os: macos-latest
- config: generic-cxx23
os: macos-latest
- config: generic-modules
os: macos-latest
- config: apple-configuration
os: macos-latest
- config: apple-system
os: macos-13
- config: apple-system-hardened
os: macos-13
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: maxim-lobanov/setup-xcode@v1
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-binaries-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ on:
- '.github/workflows/release-binaries.yml'
- '.github/workflows/release-binaries-setup-stage/*'
- '.github/workflows/release-binaries-save-stage/*'
- 'clang/cmake/caches/Release.cmake'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || 'dispatch' }}
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/release-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,14 @@ jobs:
attestations: write # For artifact attestations

steps:
- name: Checkout Release Scripts
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
sparse-checkout: |
llvm/utils/release/github-upload-release.py
llvm/utils/git/requirements.txt
sparse-checkout-cone-mode: false

- name: 'Download artifact'
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
Expand All @@ -442,11 +450,14 @@ jobs:
name: ${{ needs.prepare.outputs.release-binary-filename }}-attestation
path: ${{ needs.prepare.outputs.release-binary-filename }}.jsonl

- name: Install Python Requirements
run: |
pip install --require-hashes -r ./llvm/utils/git/requirements.txt
- name: Upload Release
shell: bash
run: |
sudo apt install python3-github
./llvm-project/llvm/utils/release/github-upload-release.py \
./llvm/utils/release/github-upload-release.py \
--token ${{ github.token }} \
--release ${{ needs.prepare.outputs.release-version }} \
upload \
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/release-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,20 @@ jobs:
ref: main
fetch-depth: 0
path: www-releases
persist-credentials: false

- name: Upload Release Notes
if: env.upload
env:
WWW_RELEASES_TOKEN: ${{ secrets.WWW_RELEASES_TOKEN }}
GH_TOKEN: ${{ secrets.WWW_RELEASES_TOKEN }}
run: |
mkdir -p ../www-releases/${{ inputs.release-version }}
mv ./docs-build/html-export/* ../www-releases/${{ inputs.release-version }}
cd ../www-releases
mkdir -p www-releases/${{ inputs.release-version }}
mv ./docs-build/html-export/* www-releases/${{ inputs.release-version }}
cd www-releases
git checkout -b ${{ inputs.release-version }}
git add ${{ inputs.release-version }}
git config user.email "llvmbot@llvm.org"
git config user.name "llvmbot"
git commit -a -m "Add ${{ inputs.release-version }} documentation"
git push "https://$WWW_RELEASES_TOKEN@github.com/${{ github.repository_owner }}/www-releases" main:main
git push --force "https://$GH_TOKEN@github.com/llvmbot/www-releases.git" HEAD:refs/heads/${{ inputs.release-version }}
gh pr create -f -B main -H ${{ inputs.release-version }} -R llvmbot/www-releases
1 change: 1 addition & 0 deletions bolt/include/bolt/Core/BinaryBasicBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "bolt/Core/MCPlus.h"
#include "llvm/ADT/GraphTraits.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/ErrorOr.h"
Expand Down
9 changes: 5 additions & 4 deletions bolt/include/bolt/Core/BinaryContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,15 @@ struct SegmentInfo {
uint64_t FileOffset; /// Offset in the file.
uint64_t FileSize; /// Size in file.
uint64_t Alignment; /// Alignment of the segment.
bool IsExecutable; /// Is the executable bit set on the Segment?

void print(raw_ostream &OS) const {
OS << "SegmentInfo { Address: 0x"
<< Twine::utohexstr(Address) << ", Size: 0x"
<< Twine::utohexstr(Size) << ", FileOffset: 0x"
OS << "SegmentInfo { Address: 0x" << Twine::utohexstr(Address)
<< ", Size: 0x" << Twine::utohexstr(Size) << ", FileOffset: 0x"
<< Twine::utohexstr(FileOffset) << ", FileSize: 0x"
<< Twine::utohexstr(FileSize) << ", Alignment: 0x"
<< Twine::utohexstr(Alignment) << "}";
<< Twine::utohexstr(Alignment) << ", " << (IsExecutable ? "x" : " ")
<< "}";
};
};

Expand Down
1 change: 0 additions & 1 deletion bolt/include/bolt/Core/BinaryData.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ inline raw_ostream &operator<<(raw_ostream &OS,
Sep = ",\n ";
TotalCount += AccessInfo.Count;
}
SS.flush();

OS << TotalCount << " total counts : " << TempString;
return OS;
Expand Down
1 change: 0 additions & 1 deletion bolt/include/bolt/Core/BinaryFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ inline raw_ostream &operator<<(raw_ostream &OS,
TotalCount += CSP.Count;
TotalMispreds += CSP.Mispreds;
}
SS.flush();

OS << TotalCount << " (" << TotalMispreds << " misses) :" << TempString;
return OS;
Expand Down
81 changes: 65 additions & 16 deletions bolt/include/bolt/Profile/ProfileYAMLMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,24 +95,29 @@ template <> struct MappingTraits<bolt::SuccessorInfo> {

namespace bolt {
struct PseudoProbeInfo {
llvm::yaml::Hex64 GUID;
uint64_t Index;
uint8_t Type;
uint32_t InlineTreeIndex = 0;
uint64_t BlockMask = 0; // bitset with probe indices from 1 to 64
std::vector<uint64_t> BlockProbes; // block probes with indices above 64
std::vector<uint64_t> CallProbes;
std::vector<uint64_t> IndCallProbes;
std::vector<uint32_t> InlineTreeNodes;

bool operator==(const PseudoProbeInfo &Other) const {
return GUID == Other.GUID && Index == Other.Index;
}
bool operator!=(const PseudoProbeInfo &Other) const {
return !(*this == Other);
return InlineTreeIndex == Other.InlineTreeIndex &&
BlockProbes == Other.BlockProbes && CallProbes == Other.CallProbes &&
IndCallProbes == Other.IndCallProbes;
}
};
} // end namespace bolt

template <> struct MappingTraits<bolt::PseudoProbeInfo> {
static void mapping(IO &YamlIO, bolt::PseudoProbeInfo &PI) {
YamlIO.mapRequired("guid", PI.GUID);
YamlIO.mapRequired("id", PI.Index);
YamlIO.mapRequired("type", PI.Type);
YamlIO.mapOptional("blx", PI.BlockMask, 0);
YamlIO.mapOptional("blk", PI.BlockProbes, std::vector<uint64_t>());
YamlIO.mapOptional("call", PI.CallProbes, std::vector<uint64_t>());
YamlIO.mapOptional("icall", PI.IndCallProbes, std::vector<uint64_t>());
YamlIO.mapOptional("id", PI.InlineTreeIndex, 0);
YamlIO.mapOptional("ids", PI.InlineTreeNodes, std::vector<uint32_t>());
}

static const bool flow = true;
Expand Down Expand Up @@ -158,15 +163,35 @@ template <> struct MappingTraits<bolt::BinaryBasicBlockProfile> {
std::vector<bolt::CallSiteInfo>());
YamlIO.mapOptional("succ", BBP.Successors,
std::vector<bolt::SuccessorInfo>());
YamlIO.mapOptional("pseudo_probes", BBP.PseudoProbes,
YamlIO.mapOptional("probes", BBP.PseudoProbes,
std::vector<bolt::PseudoProbeInfo>());
}
};

namespace bolt {
struct InlineTreeNode {
uint32_t ParentIndexDelta;
uint32_t CallSiteProbe;
// Index in PseudoProbeDesc.GUID, UINT32_MAX for same as previous (omitted)
uint32_t GUIDIndex;
bool operator==(const InlineTreeNode &) const { return false; }
};
} // end namespace bolt

template <> struct MappingTraits<bolt::InlineTreeNode> {
static void mapping(IO &YamlIO, bolt::InlineTreeNode &ITI) {
YamlIO.mapOptional("g", ITI.GUIDIndex, UINT32_MAX);
YamlIO.mapOptional("p", ITI.ParentIndexDelta, 0);
YamlIO.mapOptional("cs", ITI.CallSiteProbe, 0);
}

static const bool flow = true;
};
} // end namespace yaml
} // end namespace llvm

LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::bolt::BinaryBasicBlockProfile)
LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(llvm::yaml::bolt::InlineTreeNode)

namespace llvm {
namespace yaml {
Expand All @@ -179,8 +204,7 @@ struct BinaryFunctionProfile {
llvm::yaml::Hex64 Hash{0};
uint64_t ExecCount{0};
std::vector<BinaryBasicBlockProfile> Blocks;
llvm::yaml::Hex64 GUID{0};
llvm::yaml::Hex64 PseudoProbeDescHash{0};
std::vector<InlineTreeNode> InlineTree;
bool Used{false};
};
} // end namespace bolt
Expand All @@ -194,9 +218,8 @@ template <> struct MappingTraits<bolt::BinaryFunctionProfile> {
YamlIO.mapRequired("nblocks", BFP.NumBasicBlocks);
YamlIO.mapOptional("blocks", BFP.Blocks,
std::vector<bolt::BinaryBasicBlockProfile>());
YamlIO.mapOptional("guid", BFP.GUID, (uint64_t)0);
YamlIO.mapOptional("pseudo_probe_desc_hash", BFP.PseudoProbeDescHash,
(uint64_t)0);
YamlIO.mapOptional("inline_tree", BFP.InlineTree,
std::vector<bolt::InlineTreeNode>());
}
};

Expand Down Expand Up @@ -246,10 +269,33 @@ template <> struct MappingTraits<bolt::BinaryProfileHeader> {
}
};

namespace bolt {
struct ProfilePseudoProbeDesc {
std::vector<Hex64> GUID;
std::vector<Hex64> Hash;
std::vector<uint32_t> GUIDHashIdx; // Index of hash for that GUID in Hash

bool operator==(const ProfilePseudoProbeDesc &Other) const {
// Only treat empty Desc as equal
return GUID.empty() && Other.GUID.empty() && Hash.empty() &&
Other.Hash.empty() && GUIDHashIdx.empty() &&
Other.GUIDHashIdx.empty();
}
};
} // end namespace bolt

template <> struct MappingTraits<bolt::ProfilePseudoProbeDesc> {
static void mapping(IO &YamlIO, bolt::ProfilePseudoProbeDesc &PD) {
YamlIO.mapRequired("gs", PD.GUID);
YamlIO.mapRequired("gh", PD.GUIDHashIdx);
YamlIO.mapRequired("hs", PD.Hash);
}
};
} // end namespace yaml
} // end namespace llvm

LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::bolt::BinaryFunctionProfile)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::bolt::ProfilePseudoProbeDesc)

namespace llvm {
namespace yaml {
Expand All @@ -258,13 +304,16 @@ namespace bolt {
struct BinaryProfile {
BinaryProfileHeader Header;
std::vector<BinaryFunctionProfile> Functions;
ProfilePseudoProbeDesc PseudoProbeDesc;
};
} // namespace bolt

template <> struct MappingTraits<bolt::BinaryProfile> {
static void mapping(IO &YamlIO, bolt::BinaryProfile &BP) {
YamlIO.mapRequired("header", BP.Header);
YamlIO.mapRequired("functions", BP.Functions);
YamlIO.mapOptional("pseudo_probe_desc", BP.PseudoProbeDesc,
bolt::ProfilePseudoProbeDesc());
}
};

Expand Down
52 changes: 51 additions & 1 deletion bolt/include/bolt/Profile/YAMLProfileWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,27 @@ class YAMLProfileWriter {
/// Save execution profile for that instance.
std::error_code writeProfile(const RewriteInstance &RI);

using InlineTreeMapTy =
DenseMap<const MCDecodedPseudoProbeInlineTree *, uint32_t>;
struct InlineTreeDesc {
template <typename T> using GUIDMapTy = std::unordered_map<uint64_t, T>;
using GUIDNodeMap = GUIDMapTy<const MCDecodedPseudoProbeInlineTree *>;
using GUIDNumMap = GUIDMapTy<uint32_t>;
GUIDNodeMap TopLevelGUIDToInlineTree;
GUIDNumMap GUIDIdxMap;
GUIDNumMap HashIdxMap;
};

static std::tuple<std::vector<yaml::bolt::InlineTreeNode>, InlineTreeMapTy>
convertBFInlineTree(const MCPseudoProbeDecoder &Decoder,
const InlineTreeDesc &InlineTree, uint64_t GUID);

static std::tuple<yaml::bolt::ProfilePseudoProbeDesc, InlineTreeDesc>
convertPseudoProbeDesc(const MCPseudoProbeDecoder &PseudoProbeDecoder);

static yaml::bolt::BinaryFunctionProfile
convert(const BinaryFunction &BF, bool UseDFS,
const InlineTreeDesc &InlineTree,
const BoltAddressTranslation *BAT = nullptr);

/// Set CallSiteInfo destination fields from \p Symbol and return a target
Expand All @@ -42,8 +61,39 @@ class YAMLProfileWriter {
setCSIDestination(const BinaryContext &BC, yaml::bolt::CallSiteInfo &CSI,
const MCSymbol *Symbol, const BoltAddressTranslation *BAT,
uint32_t Offset = 0);
};

private:
struct InlineTreeNode {
const MCDecodedPseudoProbeInlineTree *InlineTree;
uint64_t GUID;
uint64_t Hash;
uint32_t ParentId;
uint32_t InlineSite;
};
static std::vector<InlineTreeNode>
collectInlineTree(const MCPseudoProbeDecoder &Decoder,
const MCDecodedPseudoProbeInlineTree &Root);

// 0 - block probe, 1 - indirect call, 2 - direct call
using ProbeList = std::array<SmallVector<uint64_t, 0>, 3>;
using NodeIdToProbes = DenseMap<uint32_t, ProbeList>;
static std::vector<yaml::bolt::PseudoProbeInfo>
convertNodeProbes(NodeIdToProbes &NodeProbes);

public:
template <typename T>
static std::vector<yaml::bolt::PseudoProbeInfo>
writeBlockProbes(T Probes, const InlineTreeMapTy &InlineTreeNodeId) {
NodeIdToProbes NodeProbes;
for (const MCDecodedPseudoProbe &Probe : Probes) {
auto It = InlineTreeNodeId.find(Probe.getInlineTreeNode());
if (It == InlineTreeNodeId.end())
continue;
NodeProbes[It->second][Probe.getType()].emplace_back(Probe.getIndex());
}
return convertNodeProbes(NodeProbes);
}
};
} // namespace bolt
} // namespace llvm

Expand Down
Loading

0 comments on commit 02452b4

Please sign in to comment.