Skip to content

Commit

Permalink
Resolves the remaining comments from #878
Browse files Browse the repository at this point in the history
  • Loading branch information
s8jsweis committed Apr 19, 2024
1 parent 6fe417a commit 6e35a8f
Showing 1 changed file with 28 additions and 14 deletions.
42 changes: 28 additions & 14 deletions varats/varats/experiments/vara/architecture_report_experiment.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
"""Implements an empty experiment that just compiles the project."""
"""Implements an experiment which generates an architecture report for the
project."""

import typing as tp

from benchbuild import Project
from benchbuild.extensions import compiler, run, time
from benchbuild.utils import actions
from benchbuild.utils.cmd import touch
from benchbuild.utils.cmd import opt

from varats.data.reports.architecture_report import ArchitectureReport
from varats.experiment.experiment_util import (
Expand All @@ -14,9 +15,14 @@
exec_func_with_pe_error_handler,
get_default_compile_error_wrapped,
create_default_analysis_failure_handler,
create_default_compiler_error_handler,
create_new_success_result_filepath,
)
from varats.experiment.wllvm import RunWLLVM
from varats.experiment.wllvm import (
RunWLLVM,
BCFileExtensions,
get_bc_cache_actions,
)
from varats.project.varats_project import VProject
from varats.report.report import ReportSpecification
from varats.utils.config import get_current_config_id
Expand All @@ -35,11 +41,6 @@ def __init__(self, project: Project, experiment_handle: ExperimentHandle):
self.__experiment_handle = experiment_handle

def __call__(self) -> actions.StepResult:
return self.analyze()

def analyze(self) -> actions.StepResult:
#

config_id = get_current_config_id(self.project)

for binary in self.project.binaries:
Expand All @@ -49,8 +50,9 @@ def analyze(self) -> actions.StepResult:
)

opt_params = [
"-O0", "-g0", "-fvara-GB", "-S", "-fvara-arch",
"--enable-new-pm=0",
f"-vara-report-outfile={result_file}",
# TODO an option which enables the analysis pass on VaRA's side

Check warning on line 55 in varats/varats/experiments/vara/architecture_report_experiment.py

View workflow job for this annotation

GitHub Actions / pylint

[pylint] varats/varats/experiments/vara/architecture_report_experiment.py#L55 <511>

TODO an option which enables the analysis pass on VaRA's side (fixme)
Raw output
varats/varats/experiments/vara/architecture_report_experiment.py:55:17: W0511: TODO an option which enables the analysis pass on VaRA's side (fixme)
get_cached_bc_file_path(

Check failure on line 56 in varats/varats/experiments/vara/architecture_report_experiment.py

View workflow job for this annotation

GitHub Actions / mypy

[mypy] varats/varats/experiments/vara/architecture_report_experiment.py#L56

error: Name "get_cached_bc_file_path" is not defined [name-defined]
Raw output
varats/varats/experiments/vara/architecture_report_experiment.py:56:17: error: Name "get_cached_bc_file_path" is not defined  [name-defined]

Check failure on line 56 in varats/varats/experiments/vara/architecture_report_experiment.py

View workflow job for this annotation

GitHub Actions / pylint

[pylint] varats/varats/experiments/vara/architecture_report_experiment.py#L56 <602>

Undefined variable 'get_cached_bc_file_path' (undefined-variable)
Raw output
varats/varats/experiments/vara/architecture_report_experiment.py:56:16: E0602: Undefined variable 'get_cached_bc_file_path' (undefined-variable)
self.project, binary,
[BCFileExtensions.NO_OPT, BCFileExtensions.ARCH]
Expand All @@ -69,8 +71,7 @@ def analyze(self) -> actions.StepResult:
return actions.StepResult.OK


# Please take care when changing this file, see docs experiments/just_compile
class ArchitectureReport(VersionExperiment, shorthand="ARE"):
class ArchitectureReportExperiment(VersionExperiment, shorthand="ARE"):
"""Generates an Architecture report file."""

NAME = "GenerateArchitectureReport"
Expand All @@ -92,13 +93,26 @@ def actions_for_project(
<< RunWLLVM() \
<< run.WithTimeout()

project.cflags += [
"-O1", "-Xclang", "-disable-llvm-optzns", "-g0", "-fvara-arch"
]
project.compile = get_default_compile_error_wrapped(
self.get_handle(), project, self.REPORT_SPEC.main_report
)

analysis_actions = []
analysis_actions.append(actions.Compile(project))
analysis_actions.append(EmptyAnalysis(project, self.get_handle()))
bc_file_extensions = [
BCFileExtensions.NO_OPT,
BCFileExtentions.ARCH,

Check failure on line 105 in varats/varats/experiments/vara/architecture_report_experiment.py

View workflow job for this annotation

GitHub Actions / mypy

[mypy] varats/varats/experiments/vara/architecture_report_experiment.py#L105

error: Name "BCFileExtentions" is not defined [name-defined]
Raw output
varats/varats/experiments/vara/architecture_report_experiment.py:105:13: error: Name "BCFileExtentions" is not defined  [name-defined]

Check failure on line 105 in varats/varats/experiments/vara/architecture_report_experiment.py

View workflow job for this annotation

GitHub Actions / pylint

[pylint] varats/varats/experiments/vara/architecture_report_experiment.py#L105 <602>

Undefined variable 'BCFileExtentions' (undefined-variable)
Raw output
varats/varats/experiments/vara/architecture_report_experiment.py:105:12: E0602: Undefined variable 'BCFileExtentions' (undefined-variable)
]
extraction_error_handler = create_default_compiler_error_handler(
self.get_handle(), project, self.REPORT_SPEC.main_report
)
analysis_actions = get_bc_cache_actions(
project, bc_file_extensions, extraction_error_handler
)
analysis_actions.append(
ArchitectureAnalysis(project, self.get_handle())
)
analysis_actions.append(actions.Clean(project))

return analysis_actions

0 comments on commit 6e35a8f

Please sign in to comment.