Skip to content
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

i#6662 public traces, part 2: encoding_filter #6663

Merged
merged 61 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
c4106e0
i#6662 public traces, part 1: encoding_filter
edeiana Feb 21, 2024
66a29a2
Merge branch 'master' into i6662-public-record-filter
edeiana Apr 15, 2024
710a5d3
Saving previous work.
edeiana Apr 24, 2024
7d16393
Reverted back to not changing trace_entry_t length and pc.
edeiana Apr 25, 2024
d0f102c
Reverted back workaround for virtual register remapping.
edeiana Apr 25, 2024
38c2c60
Merge branch 'master' into i6662-public-record-filter
edeiana Apr 25, 2024
3653ee4
Added -encoding_filter_enabled flag, which also (indirectly) disables…
edeiana Apr 25, 2024
8263e76
Removed unnecessary headers.
edeiana Apr 25, 2024
8a121b4
We now use dynamorio encoding functionality, so we need to link it
edeiana Apr 25, 2024
cedc3bc
Fixing static dynamorio linking to client not working on mac.
edeiana Apr 25, 2024
064697f
Added TODO.
edeiana Apr 25, 2024
edb3d55
Fixed warning as error on windows.
edeiana Apr 25, 2024
8825a91
Minor comment improvement.
edeiana Apr 25, 2024
d4eb820
Another fix of warning as error on windows.
edeiana Apr 25, 2024
8924620
Now modifying the file_type of the trace to regdeps ISA.
edeiana Apr 29, 2024
9a8cd02
Improved comments.
edeiana Apr 29, 2024
f1fdd2c
Moved is_any_instr_type() to trace_entry.h.
edeiana Apr 29, 2024
0ef52fa
Refactoring: renaming of generic encoding_filter to
edeiana Apr 30, 2024
09c4d15
Renaming class encoding_filter_t to encodings2regdeps_t.
edeiana Apr 30, 2024
96d0925
Fixed memory leak.
edeiana Apr 30, 2024
3ebaf39
Added encodings2regdeps test (note: record_filter is tested
edeiana Apr 30, 2024
bfbe022
Fixed opcode_mix analyzer to work with DR_ISA_REGDEPS
edeiana Apr 30, 2024
6950c7b
Removed unnecessary space.
edeiana Apr 30, 2024
241819c
Indentation fix.
edeiana Apr 30, 2024
33e3bf0
Formatting fixed.
edeiana Apr 30, 2024
b61c5b7
Code cleanup.
edeiana Apr 30, 2024
05abd7e
clang-format pass.
edeiana Apr 30, 2024
454aac2
Templatex for new encodings2regdeps test. To fix.
edeiana Apr 30, 2024
84fa480
Improved comments.
edeiana Apr 30, 2024
4c7c201
Added OP_UNDECODED and interface between record_filter and its filters.
edeiana May 1, 2024
599fb04
Addressed minor PR feedback.
edeiana May 1, 2024
19c06a6
Updated version.
edeiana May 1, 2024
f31811c
Fix arm warning as error.
edeiana May 1, 2024
5fcc6c1
Fixed doxygen link in release doc.
edeiana May 1, 2024
201df94
From -encodings2regdeps to -filter_encodings2regdeps in test.
edeiana May 1, 2024
a31cd26
Doxygen could not resolve links.
edeiana May 1, 2024
d763c30
Fixed test, using existing infrastructure.
edeiana May 1, 2024
1fe93cb
Testing arm fix for opcode name.
edeiana May 1, 2024
7d40b2a
Fixed tests.
edeiana May 1, 2024
86bd2f8
Fixed encodings2regdeps opcode_mix analyzer test.
edeiana May 1, 2024
831d0a6
Reverted changed to OP_UNDECODED name for arm.
edeiana May 1, 2024
91fca5f
Moved include to its correct place, not the top of the file like clangd
edeiana May 1, 2024
f12c3a8
Addressing PR feedback.
edeiana May 2, 2024
807df45
Attempt to fix doxygen.
edeiana May 2, 2024
0e5d075
Attempt to fix doxygen 2.
edeiana May 2, 2024
8f483e9
Handling opcode name of OP_INVALID and OP_UNDECODED for x86.
edeiana May 2, 2024
fc50942
Fixed doxygen comment.
edeiana May 2, 2024
0e0a9b9
Added test entries to check different conditions.
edeiana May 2, 2024
3c416cb
Attempt to fix macos build.
edeiana May 2, 2024
db81af6
Attempt to fix macos build 2.
edeiana May 2, 2024
5b20bb5
Now using configure_DynamoRIO_standalone() for drmemtrace_record_filter.
edeiana May 2, 2024
b35faf4
Build fix, use before def in cmakelist.
edeiana May 2, 2024
2509adf
Fixed chunking in encodings2regdeps unit test.
edeiana May 2, 2024
fc0a744
Fixed test_encodings2regdeps_filter().
edeiana May 3, 2024
7a04272
Updated comment on chunk_footer, whose value is the chunk ordinal.
edeiana May 3, 2024
0f76ec8
Fixed doxygen comment on chunk_footer.
edeiana May 3, 2024
6b95e4d
Removed comment on marker value of TRACE_MARKER_TYPE_CHUNK_FOOTER.
edeiana May 5, 2024
4ffe2d1
Added memset for result reproducibility.
edeiana May 6, 2024
3d617ab
Added test for when real ISA encoding has more (or less)
edeiana May 6, 2024
bc7e4a0
Renaming encodings2regdeps* to encodings2regdeps_filter*
edeiana May 6, 2024
82a113b
Merge branch 'master' into i6662-public-record-filter
edeiana May 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion clients/drcachesim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ add_exported_library(drmemtrace_record_filter STATIC
tools/filter/type_filter.h
tools/filter/encodings2regdeps.h
tools/filter/null_filter.h)
target_link_libraries(drmemtrace_record_filter drmemtrace_simulator dynamorio)
target_link_libraries(drmemtrace_record_filter drmemtrace_simulator)
configure_DynamoRIO_standalone(drmemtrace_record_filter)

add_exported_library(directory_iterator STATIC common/directory_iterator.cpp)
add_dependencies(directory_iterator api_headers)
Expand Down
7 changes: 5 additions & 2 deletions clients/drcachesim/common/trace_entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,11 @@ typedef enum {
TRACE_MARKER_TYPE_CHUNK_INSTR_COUNT,

/**
* Marks the end of a chunk. The final chunk does not have such a marker
* but instead relies on the #TRACE_TYPE_FOOTER entry.
* Marks the end of a chunk. The value of this marker is the chunk ordinal, which
* is an increasing counter set by #dynamorio::drmemtrace::record_filter_t starting
edeiana marked this conversation as resolved.
Show resolved Hide resolved
* from 0.
* The final chunk does not have such a marker but instead relies on the
* #TRACE_TYPE_FOOTER entry.
*/
TRACE_MARKER_TYPE_CHUNK_FOOTER,

Expand Down
58 changes: 40 additions & 18 deletions clients/drcachesim/tests/record_filter_unit_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,9 @@ process_entries_and_check_result(test_record_filter_t *record_filter,
static bool
test_encodings2regdeps_filter()
{
constexpr addr_t PC = 0x7f6fdd3ec360;
constexpr addr_t ENCODING_REAL_ISA = 0xe78948;
constexpr addr_t ENCODING_REGDEPS_ISA = 0x0006090600010011;
std::vector<test_case_t> entries = {
// Trace shard header.
{ { TRACE_TYPE_HEADER, 0, { 0x1 } }, true, { true } },
Expand All @@ -314,27 +317,46 @@ test_encodings2regdeps_filter()
{ { TRACE_TYPE_MARKER, TRACE_MARKER_TYPE_CACHE_LINE_SIZE, { 0x6 } },
true,
{ true } },
// Unit header.
{ { TRACE_TYPE_MARKER, TRACE_MARKER_TYPE_CHUNK_INSTR_COUNT, { 0x3 } },
true,
{ true } },

// Chunk 1.
{ { TRACE_TYPE_MARKER, TRACE_MARKER_TYPE_TIMESTAMP, { 0x7 } }, true, { true } },
{ { TRACE_TYPE_MARKER, TRACE_MARKER_TYPE_CPU_ID, { 0x8 } }, true, { true } },
// Encoding, modified by the record_filter encodings2regdeps.
{ { TRACE_TYPE_ENCODING, 4, { 0xe78948 } }, true, { false } },
{ { TRACE_TYPE_ENCODING, 8, { 0x0006090600010011 } }, false, { true } },
{ { TRACE_TYPE_INSTR, 3, { 0x7f6fdd3ec360 } }, true, { true } },
// Same instr same chunk.
{ { TRACE_TYPE_INSTR, 3, { 0x7f6fdd3ec360 } }, true, { true } },
// Unit header.
{ { TRACE_TYPE_MARKER, TRACE_MARKER_TYPE_TIMESTAMP, { 0xc } }, true, { true } },
{ { TRACE_TYPE_MARKER, TRACE_MARKER_TYPE_CPU_ID, { 0xd } }, true, { true } },
{ { TRACE_TYPE_ENCODING, 3, { ENCODING_REAL_ISA } }, true, { false } },
{ { TRACE_TYPE_ENCODING, 8, { ENCODING_REGDEPS_ISA } }, false, { true } },
{ { TRACE_TYPE_INSTR, 3, { PC } }, true, { true } },
{ { TRACE_TYPE_INSTR, 3, { PC } }, true, { true } },
{ { TRACE_TYPE_INSTR, 3, { PC } }, true, { true } },
{ { TRACE_TYPE_MARKER, TRACE_MARKER_TYPE_CHUNK_FOOTER, { 0 } }, true, { true } },

// Chunk 2.
{ { TRACE_TYPE_MARKER, TRACE_MARKER_TYPE_RECORD_ORDINAL, { 0xa } },
true,
{ true } },
{ { TRACE_TYPE_MARKER, TRACE_MARKER_TYPE_TIMESTAMP, { 0x7 } }, true, { true } },
{ { TRACE_TYPE_MARKER, TRACE_MARKER_TYPE_CPU_ID, { 0x8 } }, true, { true } },
// Duplicated encoding across chunk boundary.
edeiana marked this conversation as resolved.
Show resolved Hide resolved
{ { TRACE_TYPE_ENCODING, 4, { 0xe78948 } }, true, { false } },
{ { TRACE_TYPE_ENCODING, 8, { 0x0006090600010011 } }, false, { true } },
{ { TRACE_TYPE_INSTR, 3, { 0x7f6fdd3ec360 } }, true, { true } },
// Unit header.
{ { TRACE_TYPE_MARKER, TRACE_MARKER_TYPE_TIMESTAMP, { 0xe } }, true, { true } },
{ { TRACE_TYPE_MARKER, TRACE_MARKER_TYPE_CPU_ID, { 0xf } }, true, { true } },
// Same instr in different chunk.
{ { TRACE_TYPE_INSTR, 3, { 0x7f6fdd3ec360 } }, true, { true } },
{ { TRACE_TYPE_ENCODING, 3, { ENCODING_REAL_ISA } }, true, { false } },
{ { TRACE_TYPE_ENCODING, 8, { ENCODING_REGDEPS_ISA } }, false, { true } },
{ { TRACE_TYPE_INSTR, 3, { PC } }, true, { true } },
{ { TRACE_TYPE_INSTR, 3, { PC } }, true, { true } },
{ { TRACE_TYPE_INSTR, 3, { PC } }, true, { true } },
{ { TRACE_TYPE_MARKER, TRACE_MARKER_TYPE_CHUNK_FOOTER, { 1 } }, true, { true } },

// Chunk 3.
{ { TRACE_TYPE_MARKER, TRACE_MARKER_TYPE_RECORD_ORDINAL, { 0xe } },
true,
{ true } },
{ { TRACE_TYPE_MARKER, TRACE_MARKER_TYPE_TIMESTAMP, { 0x7 } }, true, { true } },
{ { TRACE_TYPE_MARKER, TRACE_MARKER_TYPE_CPU_ID, { 0x8 } }, true, { true } },
// Same instr in different chunk. We expect record_filter to add
// ENCODING_REGDEPS_ISA here (not ENCODING_REAL_ISA).
edeiana marked this conversation as resolved.
Show resolved Hide resolved
{ { TRACE_TYPE_ENCODING, 8, { ENCODING_REGDEPS_ISA } }, false, { true } },
{ { TRACE_TYPE_INSTR, 3, { PC } }, true, { true } },
{ { TRACE_TYPE_INSTR, 3, { PC } }, true, { true } },
// Trace shard footer.
{ { TRACE_TYPE_FOOTER, 0, { 0x0 } }, true, { true } },
};
Expand All @@ -350,7 +372,7 @@ test_encodings2regdeps_filter()
}
filters.push_back(std::move(encodings2regdeps_filter));
auto record_filter = std::unique_ptr<test_record_filter_t>(
new test_record_filter_t(std::move(filters), 0));
new test_record_filter_t(std::move(filters), 0, /*write_archive=*/true));
if (!process_entries_and_check_result(record_filter.get(), entries, 0))
return false;

Expand Down
Loading