Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Trace files (pre-processing) can be compressed to around ~10% the raw text file size. Post-processed trace files can be compressed down to just 1%. Trading off CPU time for compression/decompression makes sense on multi-core IO-limited systems.
This commit brings support for xz-compressed trace files. All three of the tracer, the trace post-processor, and the trace-driven simulator have been upgraded to support xz-compressed traces.
export TRACE_FILE_COMPRESS=1
to let the tracer directly create xz-compressed trace files.The commit provides backward-support to raw text format trace files. It figures out automatically whether to decompress a trace file or just consume raw text trace.
The compression and decompression are transparently delegated to a child process running
xz
in a bash shell, the trace data is transmitted between accel-sim and xz using UNIX anonymous pipes. The level of compression (and the compression scheme itself) are chosen to yield good compression ratio without becoming a bottlenecking factor to the tracer/post-processor/simulator's performance.xz
is preferred overgzip
andbzip2
for its superior compression ratio and support of multi-threading.To upgrade (i.e. to compress) legacy trace files, use xz to compress them (e.g.
xz -1 -T0 kernel-1.traceg
) and modify the kernelslist.g file to change the trace file name accordingly ("kernel-1.traceg" -> "kernel-1.traceg.xz"). Pass--keep
toxz
to keep the original trace file if you feel cautious.Convenience bash commands like
xzgrep
,xzless
,xzmore
are at your disposal if you need to search into or read the compressed trace.This PR also optimizes the trace post processor's memory footprint. A
WarpInstLUT
or warp instruction look-up table is introduced to register recurrent string fragments of warp instructions. Warp instructions with identical fragments hold a pointer to a global copy of the string fragment, so the memory overhead of warp instructions is effectively reduced. In one real life test, a trace file that is 500GB in size (pre processing) only incurred a ~150GB memory footprint.Situations of error and exception:
xz
child process is configured to ignore SIGINT and keep running while the parent process is being debugged.xz
is effectively blocked by IO until the parent process resumes.xz
child process aborts due to any reason (e.g. corrupted file): Unimplemented. The parent process has not been designed to handle this situation.xz
child process is still alive: Note that Linux does not normally kill a child process when its parent process dies. However, since the parent and child(ren) are communicating over pipes, and the parent process closes all file descriptors when it terminates, per specification of the Linux pipe, the compression process (reading from the pipe) will receive an EOF and terminate naturally, the decompression process (writing to the pipe) will receive SIGPIPE and terminate.