Skip to content

[DirectX] Adding support for Root Descriptor in Obj2yaml/Yaml2Obj #136732

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 151 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
526b34a
adding rootsignature to obj2yaml
Jan 13, 2025
e84a8e1
adding test
Jan 13, 2025
f25fd64
removing old test
Jan 13, 2025
16552f0
remove useless includes
Jan 13, 2025
a6eb4c0
addressing comments
Jan 14, 2025
7d080b3
updating test
Jan 14, 2025
504527b
removing useless header
Jan 15, 2025
2425672
fix formating
Jan 15, 2025
08c17bb
renaming test
Jan 15, 2025
395a536
addressing pr comments
Jan 16, 2025
f93dff9
adding str to ROOT_ELEMENT_FLAG
Jan 16, 2025
1c1edb8
formating
Jan 17, 2025
5bef775
refactoring to follow llvm standards
Jan 18, 2025
628545a
addressing comments
Jan 27, 2025
c5c2ab6
clean up
Jan 27, 2025
b9db72c
remove version
Jan 30, 2025
f4af043
fix pr
Jan 30, 2025
496b922
adding dxil-dis test
Jan 31, 2025
422578f
adding compatibility test
Jan 31, 2025
b1423eb
addressing test concerns
Feb 3, 2025
b6262b6
clean up
Feb 3, 2025
16d0e8e
addressing comments
Feb 4, 2025
0a9e468
adding fail test
Feb 4, 2025
8295031
adding comment
Feb 4, 2025
c8e1e38
adding few more tests
Feb 4, 2025
434b862
format
Feb 4, 2025
2bfc5ad
cleanup
Feb 5, 2025
479422d
adding metadata extraction
Jan 15, 2025
f61ee77
moving root signature to it's own pass
Jan 16, 2025
499d879
formating
Jan 16, 2025
c4af535
removing useless imports
Jan 16, 2025
819fa0d
fixing pr changes
Jan 16, 2025
d347a87
adding some asserts
Jan 16, 2025
d8824ed
format
Jan 16, 2025
25c0384
fixing assert
Jan 18, 2025
5eb0ad2
cleaning
Jan 27, 2025
559427d
clean up
Jan 29, 2025
8ca5b2a
addressing comments
Jan 30, 2025
d52cd2c
removing version
Jan 30, 2025
5930dcb
fix test
Jan 30, 2025
fc72988
addressing PR Comments
Jan 31, 2025
2d1ee0d
fix test
Feb 3, 2025
92a85fe
filtering root signatures not associated with entry function
Feb 4, 2025
979ee91
separating parsing and validation
Feb 4, 2025
d089674
improve error handling
Feb 6, 2025
980e7d9
clean up
Feb 6, 2025
04667f3
clean up
Feb 6, 2025
8ec40aa
formating
Feb 6, 2025
b0ac6be
addressing comments and fix tests
Feb 7, 2025
6a36503
formating
Feb 7, 2025
f7d2c12
addressing pr comments
Feb 10, 2025
d6c98ed
addressing PR comments
Feb 11, 2025
36746f5
addressing pr comments
Feb 11, 2025
b5208e8
removing copies from root signature use in dx container globals
Feb 11, 2025
1fd6568
adding more tests
Feb 12, 2025
cde4634
maybe fix test?
Feb 12, 2025
4410e7b
try fix format
Feb 12, 2025
cbdb114
removing test
Feb 12, 2025
667ee17
adding llvm unreachable and testing test
Feb 12, 2025
d0dae8b
stopping compilation if root signature error were emitted
Feb 12, 2025
b1b28f8
making sure Error tests fail
Feb 12, 2025
0efd8cc
adding root constants
Feb 12, 2025
11256d8
refactoring root signature analysis to return a map instead
Feb 12, 2025
3c5046e
addressing pr comments
Feb 12, 2025
5d4505c
clean up
Feb 12, 2025
3117530
addressing pr comments
Feb 13, 2025
0af845c
implementing find interface for RootSignatureAnalysisWrapper
Feb 13, 2025
bf49a3a
adding test for null function
Feb 13, 2025
78826a5
fix root signature test error
Feb 14, 2025
4e689e9
fix other functions are checked
Feb 14, 2025
b0d0180
adding missing continue
Feb 14, 2025
3c6894f
adding few more tests
Feb 14, 2025
08f6ddc
adding yaml2obj support
Feb 15, 2025
b232967
adding support for obj2yaml and initial tests
Feb 18, 2025
1026a8e
multiple parameters support and more testing
Feb 19, 2025
00175bf
clean up
Feb 19, 2025
9ed2adc
fixing formating
Feb 19, 2025
e8252ba
reapply rebase fix
Feb 19, 2025
4de5c29
clean up
Feb 20, 2025
fe13b61
addressing pr comments
Feb 22, 2025
767b7d0
first working version
Feb 22, 2025
8434dc2
formating
Feb 22, 2025
d391727
moving the offset logic to it's own class
Feb 24, 2025
68c7513
refactoring to remove use of map and string
Feb 24, 2025
23069ab
addressing comments
Feb 25, 2025
d14471b
using buffer_ostream
Feb 25, 2025
216341c
remove getsize
Feb 25, 2025
85f012c
clean up
Feb 25, 2025
1e2bcf5
clean up
Feb 25, 2025
0e277d9
clean up
Feb 25, 2025
5cd0044
clean up
Feb 25, 2025
7a7c34d
addressing pr comments
Feb 25, 2025
d3fafab
clean up
Feb 25, 2025
15d1a8c
Merge branch 'refactor/improve-offset-calculation' into users/joaosaf…
Feb 25, 2025
7485640
clean up
Feb 26, 2025
17abc82
moving initializer arround
Feb 26, 2025
4b177e2
addressing pr comments
Feb 26, 2025
ec1dd87
addressing changes
Feb 26, 2025
eb9d7d3
Merge branch 'main' into users/joaosaffran/127840
Feb 26, 2025
f2a4f04
fix test
Feb 26, 2025
7c4236c
refactoring to change representations in binary format
Mar 1, 2025
2894f96
addressing pr comments
Mar 2, 2025
7b5e9d8
addressing comments and clean up
Mar 20, 2025
f0e6a46
moving RootSignatureValidations to out of BinaryFormat
Mar 24, 2025
4fe30df
addressing most pr comments
Mar 24, 2025
cbc334a
adding root parameter view
Mar 26, 2025
31bcd73
clean up
Mar 26, 2025
30098e1
addressing pr comments
Mar 29, 2025
1bf6408
wip: implementing comments
Mar 31, 2025
d1b32f3
removing old code
Apr 4, 2025
3b9bf27
address errors
Apr 4, 2025
89632a4
removing validations from obj2yaml
Apr 7, 2025
67da709
ac
Apr 8, 2025
3991c5d
address comments
Apr 8, 2025
cfc6bfb
clean up
Apr 8, 2025
82a31fa
removing param_header_begin and param_header_end
Apr 9, 2025
9b59d01
adding support for root constants in metadata generation
Apr 9, 2025
efc5e52
add test
Apr 9, 2025
e6865a7
Revert "clean up"
Apr 9, 2025
021976d
Reapply "clean up"
Apr 9, 2025
102ff4b
removing unnecessary parameters
Apr 10, 2025
39d4b08
addressing pr comments
Apr 10, 2025
7343d95
adding more tests
Apr 11, 2025
6986945
adding more tests and addressing comments
Apr 11, 2025
c0ac522
adding tests and changing parameter type
Apr 14, 2025
cadc296
Merge branch 'obj2yaml/root-constants' into metadata/root-constants
Apr 14, 2025
c4b78d8
address comments
Apr 14, 2025
8bdc206
address comments
Apr 14, 2025
1e5eee5
addressing pr comments
Apr 14, 2025
a968d81
Revert "addressing pr comments"
Apr 14, 2025
8511fa9
address comments
Apr 14, 2025
330369a
changing back enums to enum class
Apr 15, 2025
d747bcc
addressing PR comments and adding more tests
Apr 16, 2025
6cef567
adding tests and fixing code
Apr 16, 2025
246d5d3
addressing comments
Apr 16, 2025
bb6c0cf
clean up
Apr 16, 2025
2203885
Merge branch 'obj2yaml/root-constants' into metadata/root-constants
Apr 16, 2025
7aed7d1
fixing bugs
Apr 16, 2025
7885eed
addressing nits
Apr 17, 2025
f315bb4
Merge branch 'obj2yaml/root-constants' into metadata/root-constants
Apr 17, 2025
193a80b
Merge branch 'main' into metadata/root-constants
Apr 17, 2025
578faea
addressing pr comments
Apr 24, 2025
860fddd
addressing comments
Apr 24, 2025
3ce683e
adding support for root descriptor
Apr 18, 2025
13d7045
adding test
Apr 18, 2025
fdc12e1
adding test
Apr 18, 2025
c81ce8a
clean up
Apr 22, 2025
9e2b122
try fix clean up
Apr 22, 2025
d982395
changing version namings
Apr 24, 2025
eecea5b
Merge branch 'main' into obj2yaml/root-descriptors
Apr 24, 2025
f1d72e0
Revert "Merge branch 'main' into obj2yaml/root-descriptors"
Apr 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 4 additions & 6 deletions .ci/compute_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@
"clang": {"clang-tools-extra", "compiler-rt", "cross-project-tests"},
"clang-tools-extra": {"libc"},
"mlir": {"flang"},
# Test everything if ci scripts are changed.
# FIXME: Figure out what is missing and add here.
".ci": {"llvm", "clang", "lld", "lldb"},
}

DEPENDENT_RUNTIMES_TO_TEST = {"clang": {"libcxx", "libcxxabi", "libunwind"}}
Expand Down Expand Up @@ -133,11 +130,12 @@ def _add_dependencies(projects: Set[str]) -> Set[str]:
def _compute_projects_to_test(modified_projects: Set[str], platform: str) -> Set[str]:
projects_to_test = set()
for modified_project in modified_projects:
# Skip all projects where we cannot run tests.
if modified_project not in PROJECT_CHECK_TARGETS:
continue
if modified_project in RUNTIMES:
continue
# Skip all projects where we cannot run tests.
if modified_project in PROJECT_CHECK_TARGETS:
projects_to_test.add(modified_project)
projects_to_test.add(modified_project)
if modified_project not in DEPENDENTS_TO_TEST:
continue
for dependent_project in DEPENDENTS_TO_TEST[modified_project]:
Expand Down
17 changes: 0 additions & 17 deletions .ci/compute_projects_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,23 +188,6 @@ def test_exclude_gn(self):
self.assertEqual(env_variables["runtimes_to_build"], "")
self.assertEqual(env_variables["runtimes_check_targets"], "")

def test_ci(self):
env_variables = compute_projects.get_env_variables(
[".ci/compute_projects.py"], "Linux"
)
self.assertEqual(env_variables["projects_to_build"], "clang;lld;llvm;lldb")
self.assertEqual(
env_variables["project_check_targets"],
"check-clang check-lld check-llvm check-lldb",
)
self.assertEqual(
env_variables["runtimes_to_build"], "libcxx;libcxxabi;libunwind"
)
self.assertEqual(
env_variables["runtimes_check_targets"],
"check-cxx check-cxxabi check-unwind",
)


if __name__ == "__main__":
unittest.main()
18 changes: 1 addition & 17 deletions .ci/monolithic-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,10 @@ if [[ -n "${CLEAR_CACHE:-}" ]]; then
ccache --clear
fi

mkdir -p artifacts/reproducers

# Make sure any clang reproducers will end up as artifacts.
export CLANG_CRASH_DIAGNOSTICS_DIR=`realpath artifacts/reproducers`

function at-exit {
retcode=$?

mkdir -p artifacts
ccache --print-stats > artifacts/ccache_stats.txt
cp "${BUILD_DIR}"/.ninja_log artifacts/.ninja_log

Expand All @@ -62,18 +58,9 @@ export PIP_BREAK_SYSTEM_PACKAGES=1
pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt
pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt

# Set the system llvm-symbolizer as preferred.
export LLVM_SYMBOLIZER_PATH=`which llvm-symbolizer`
[[ ! -f "${LLVM_SYMBOLIZER_PATH}" ]] && echo "llvm-symbolizer not found!"

# Set up all runtimes either way. libcxx is a dependency of LLDB.
# It will not be built unless it is used.
cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-D LLVM_ENABLE_PROJECTS="${projects}" \
-D LLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
-G Ninja \
-D CMAKE_PREFIX_PATH="${HOME}/.local" \
-D CMAKE_BUILD_TYPE=Release \
-D LLVM_ENABLE_ASSERTIONS=ON \
-D LLVM_BUILD_EXAMPLES=ON \
Expand All @@ -82,10 +69,7 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-D LLVM_ENABLE_LLD=ON \
-D CMAKE_CXX_FLAGS=-gmlt \
-D LLVM_CCACHE_BUILD=ON \
-D LIBCXX_CXX_ABI=libcxxabi \
-D MLIR_ENABLE_BINDINGS_PYTHON=ON \
-D LLDB_ENABLE_PYTHON=ON \
-D LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=ON \
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}"

echo "--- ninja"
Expand Down
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
/mlir/**/Transforms/SROA.* @moxinilian

# BOLT
/bolt/ @aaupov @maksfb @rafaelauler @ayermolo @yota9
/bolt/ @aaupov @maksfb @rafaelauler @ayermolo @dcci @yota9

# Bazel build system.
/utils/bazel/ @rupprecht @keith @aaronmondal
Expand Down
6 changes: 0 additions & 6 deletions .github/new-prs-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ ClangIR:
- clang/tools/cir-*/**/*
- clang/test/CIR/**/*

clang:bytecode:
- clang/docs/ConstantInterpreter.rst
- clang/lib/AST/ByteCode/**/*
- clang/test/AST/ByteCode/**/*
- clang/unittests/AST/ByteCode/**/*

clang:dataflow:
- clang/include/clang/Analysis/FlowSensitive/**/*
- clang/lib/Analysis/FlowSensitive/**/*
Expand Down
15 changes: 3 additions & 12 deletions bolt/include/bolt/Profile/DataAggregator.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,16 +223,14 @@ class DataAggregator : public DataReader {
bool recordExit(BinaryFunction &BF, uint64_t From, bool Mispred,
uint64_t Count = 1) const;

/// Branch stacks aggregation statistics
uint64_t NumTraces{0};
/// Aggregation statistics
uint64_t NumInvalidTraces{0};
uint64_t NumLongRangeTraces{0};
/// Specifies how many samples were recorded in cold areas if we are dealing
/// with profiling data collected in a bolted binary. For LBRs, incremented
/// for the source of the branch to avoid counting cold activity twice (one
/// for source and another for destination).
uint64_t NumColdSamples{0};
uint64_t NumTotalSamples{0};

/// Looks into system PATH for Linux Perf and set up the aggregator to use it
void findPerfExecutable();
Expand Down Expand Up @@ -329,8 +327,8 @@ class DataAggregator : public DataReader {
/// Parse a single LBR entry as output by perf script -Fbrstack
ErrorOr<LBREntry> parseLBREntry();

/// Parse LBR sample.
void parseLBRSample(const PerfBranchSample &Sample, bool NeedsSkylakeFix);
/// Parse LBR sample, returns the number of traces.
uint64_t parseLBRSample(const PerfBranchSample &Sample, bool NeedsSkylakeFix);

/// Parse and pre-aggregate branch events.
std::error_code parseBranchEvents();
Expand Down Expand Up @@ -489,13 +487,6 @@ class DataAggregator : public DataReader {
void dump(const PerfBranchSample &Sample) const;
void dump(const PerfMemSample &Sample) const;

/// Profile diagnostics print methods
void printColdSamplesDiagnostic() const;
void printLongRangeTracesDiagnostic() const;
void printBranchSamplesDiagnostics() const;
void printBasicSamplesDiagnostics(uint64_t OutOfRangeSamples) const;
void printBranchStacksDiagnostics(uint64_t IgnoredSamples) const;

public:
/// If perf.data was collected without build ids, the buildid-list may contain
/// incomplete entries. Return true if the buffer containing
Expand Down
3 changes: 2 additions & 1 deletion bolt/lib/Core/BinaryBasicBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,8 @@ void BinaryBasicBlock::updateJumpTableSuccessors() {
[](const BinaryBasicBlock *BB1, const BinaryBasicBlock *BB2) {
return BB1->getInputOffset() < BB2->getInputOffset();
});
SuccessorBBs.erase(llvm::unique(SuccessorBBs), SuccessorBBs.end());
SuccessorBBs.erase(std::unique(SuccessorBBs.begin(), SuccessorBBs.end()),
SuccessorBBs.end());

for (BinaryBasicBlock *BB : SuccessorBBs)
addSuccessor(BB);
Expand Down
6 changes: 2 additions & 4 deletions bolt/lib/Core/BinaryEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,8 @@ bool BinaryEmitter::emitFunction(BinaryFunction &Function,
Streamer.emitLabel(StartSymbol);
}

const bool NeedsFDE =
Function.hasCFI() && !(Function.isPatch() && Function.isAnonymous());
// Emit CFI start
if (NeedsFDE) {
if (Function.hasCFI()) {
Streamer.emitCFIStartProc(/*IsSimple=*/false);
if (Function.getPersonalityFunction() != nullptr)
Streamer.emitCFIPersonality(Function.getPersonalityFunction(),
Expand Down Expand Up @@ -423,7 +421,7 @@ bool BinaryEmitter::emitFunction(BinaryFunction &Function,
Streamer.emitBytes(BC.MIB->getTrapFillValue());

// Emit CFI end
if (NeedsFDE)
if (Function.hasCFI())
Streamer.emitCFIEndProc();

MCSymbol *EndSymbol = Function.getFunctionEndLabel(FF.getFragmentNum());
Expand Down
2 changes: 1 addition & 1 deletion bolt/lib/Core/BinaryFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2376,7 +2376,7 @@ Error BinaryFunction::buildCFG(MCPlusBuilder::AllocatorIdTy AllocatorId) {
// Without doing jump table value profiling we don't have a use for extra
// (duplicate) branches.
llvm::sort(TakenBranches);
auto NewEnd = llvm::unique(TakenBranches);
auto NewEnd = std::unique(TakenBranches.begin(), TakenBranches.end());
TakenBranches.erase(NewEnd, TakenBranches.end());

for (std::pair<uint32_t, uint32_t> &Branch : TakenBranches) {
Expand Down
3 changes: 2 additions & 1 deletion bolt/lib/Core/DebugNames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,8 @@ void DWARF5AcceleratorTable::computeBucketCount() {
for (const auto &E : Entries)
Uniques.push_back(E.second.HashValue);
array_pod_sort(Uniques.begin(), Uniques.end());
std::vector<uint32_t>::iterator P = llvm::unique(Uniques);
std::vector<uint32_t>::iterator P =
std::unique(Uniques.begin(), Uniques.end());

UniqueHashCount = std::distance(Uniques.begin(), P);

Expand Down
6 changes: 3 additions & 3 deletions bolt/lib/Core/MCPlusBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,10 @@ void MCPlusBuilder::getUsedRegs(const MCInst &Inst, BitVector &Regs) const {
for (MCPhysReg ImplicitUse : InstInfo.implicit_uses())
Regs |= getAliases(ImplicitUse, /*OnlySmaller=*/true);

for (const MCOperand &Operand : useOperands(Inst)) {
if (!Operand.isReg())
for (unsigned I = 0, E = Inst.getNumOperands(); I != E; ++I) {
if (!Inst.getOperand(I).isReg())
continue;
Regs |= getAliases(Operand.getReg(), /*OnlySmaller=*/true);
Regs |= getAliases(Inst.getOperand(I).getReg(), /*OnlySmaller=*/true);
}
}

Expand Down
Loading
Loading