8000 Dev 0.6 by iangneal · Pull Request #4 · efeslab/lapidary · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Mar 3, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ lapidary-code.code-workspace
.vscode/ipch/681ea811cfbf718c/get_fs_base.ipch
.vscode/ipch/681ea811cfbf718c/mmap_address.bin

# Proprietary
# Proprietary/testing related
spec-cpu2017
workspace_lapidary_spec17/
*.bak
log.txt
simulation_results
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "gistsnip"]
path = gistsnip
url = https://github.com/loov/gistsnip.git
[submodule "gem5_master"]
path = gem5_master
url = https://gem5.googlesource.com/public/gem5
4 changes: 2 additions & 2 deletions .lapidary.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
gem5_path: ./custom_gem5
gem5_path: ./gem5_master
gem5_features:
syscall_trace: true

Expand All @@ -7,5 +7,5 @@ libc_path: ./libc/glibc/build/install
gem5_flag_config_plugin: ./test/test_configurations.py

spec2017_config:
spec2017_src_path: ./spec-cpu2017
spec2017_src_path: ../cooldown/spec-cpu2017
workspace_path: ./workspace_lapidary_spec17
File renamed without changes.
1 change: 1 addition & 0 deletions gem5_master
Submodule gem5_master added at c288af
22 changes: 20 additions & 2 deletions lapidary/checkpoint/CheckpointConvert.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,40 @@
from time import sleep

from lapidary.utils import *
from lapidary.checkpoint.Checkpoints import GDBCheckpoint
from lapidary.checkpoint.Checkpoints import *

class GDBCheckpointConverter:

def __init__(self, gdb_checkpoint):
def __init__(self, gdb_checkpoint, keyframe=None, diffs=None):
assert isinstance(gdb_checkpoint, GDBCheckpoint)
assert gdb_checkpoint.is_valid_checkpoint()
assert keyframe is None or isinstance(keyframe, Gem5Checkpoint)
self.gdb_checkpoint = gdb_checkpoint
self.mappings = self.gdb_checkpoint.get_mappings()
self.keyframe = keyframe
self.diff_frames = diffs

@staticmethod
def compress_memory_image(file_path):
'''
gem5 can accept either compressed or uncompressed pmem files
(compressed with gzip), as long as they have the same file name.

The only downside is that simulations take longer to start.
'''
subprocess.call(['gzip', '-f', str(file_path)])
gzip_path = Path(str(file_path) + '.gz')
gzip_path.rename(file_path)


def _create_diff_file(self, src_pmem_fp, new_pmem_fp):
if self.keyframe is None:
return new_pmem_file

from diff_match_patch import diff_match_patch
dmp = diff_match_patch()


def create_pmem_file(self):

with self.gdb_checkpoint.get_pmem_file_handle() as pmem_raw,\
Expand Down
10 changes: 9 additions & 1 deletion lapidary/checkpoint/Checkpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ def __str__(self):


class Gem5Checkpoint(GDBCheckpoint):

def is_valid_checkpoint(self):
return super().is_valid_checkpoint(self) and self.pmem_file.exists()

class Gem5DiffCheckpoint(GDBCheckpoint):

def __init__(self, checkpoint_directory):
super().__init__(self, checkpoint_directory)
self.pmem_diff_file = self.pmem_file + '.diff'

def is_valid_checkpoint(self):
return super().is_valid_checkpoint(self) and self.pmem_diff_file.exists()
Loading
0