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

Synthetic Compile Time Case studies #838

Merged
merged 12 commits into from
Oct 18, 2023
233 changes: 233 additions & 0 deletions varats/varats/projects/perf_tests/feature_perf_cs_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,3 +752,236 @@ def compile(self) -> None:
def recompile(self) -> None:
"""Recompile the project."""
_do_feature_perf_cs_collection_recompile(self)


class SynthCTTraitBased(VProject):
"""Synthetic case-study project for testing flow sensitivity."""

NAME = 'SynthCTTraitBased'
GROUP = 'perf_tests'
DOMAIN = ProjectDomains.TEST

SOURCE = [
bb.source.Git(
remote="https://github.com/se-sic/FeaturePerfCSCollection.git",
local="SynthCTTraitBased",
refspec="origin/f-SynthCompileTimeCS",
limit=None,
shallow=False,
version_filter=project_filter_generator("SynthCTTraitBased")
),
FeatureSource()
]

WORKLOADS = {
WorkloadSet(WorkloadCategory.EXAMPLE): [
VCommand(
SourceRoot("SynthCTTraitBased") / RSBinary("CTTraitBased"),
label="CompileTime-TraitBased"
)
]
}

@staticmethod
def binaries_for_revision(
revision: ShortCommitHash # pylint: disable=W0613
) -> tp.List[ProjectBinaryWrapper]:
binary_map = RevisionBinaryMap(
get_local_project_git_path(SynthCTTraitBased.NAME)
)

binary_map.specify_binary(
"build/bin/CTTraitBased",
BinaryType.EXECUTABLE,
only_valid_in=RevisionRange("a4a133a186", "HEAD")
)

return binary_map[revision]

def run_tests(self) -> None:
pass

def compile(self) -> None:
"""Compile the project."""
_do_feature_perf_cs_collection_compile(
self, "FPCSC_ENABLE_PROJECT_SYNTHCTTRAITBASED"
)

def recompile(self) -> None:
"""Recompile the project."""
_do_feature_perf_cs_collection_recompile(self)


class SynthCTPolicies(VProject):
"""Synthetic case-study project for compile time variability using
policies."""

NAME = 'SynthCTPolicies'
GROUP = 'perf_tests'
DOMAIN = ProjectDomains.TEST

SOURCE = [
bb.source.Git(
remote="https://github.com/se-sic/FeaturePerfCSCollection.git",
local="SynthCTPolicies",
refspec="origin/f-SynthCompileTimeCS",
limit=None,
shallow=False,
version_filter=project_filter_generator("SynthCTPolicies")
),
FeatureSource()
]

WORKLOADS = {
WorkloadSet(WorkloadCategory.EXAMPLE): [
VCommand(
SourceRoot("SynthCTPolicies") / RSBinary("CTPolicies"),
label="CompileTime-Policies"
)
]
}

@staticmethod
def binaries_for_revision(
revision: ShortCommitHash # pylint: disable=W0613
) -> tp.List[ProjectBinaryWrapper]:
binary_map = RevisionBinaryMap(
get_local_project_git_path(SynthCTPolicies.NAME)
)

binary_map.specify_binary(
"build/bin/CTPolicies",
BinaryType.EXECUTABLE,
only_valid_in=RevisionRange("a4a133a186", "HEAD")
)

return binary_map[revision]

def run_tests(self) -> None:
pass

def compile(self) -> None:
"""Compile the project."""
_do_feature_perf_cs_collection_compile(
self, "FPCSC_ENABLE_PROJECT_SYNTHCTPOLICIES"
)

def recompile(self) -> None:
"""Recompile the project."""
_do_feature_perf_cs_collection_recompile(self)


class SynthCTCRTP(VProject):
"""Synthetic case-study project for compile time variability using CRTP."""

NAME = 'SynthCTCRTP'
GROUP = 'perf_tests'
DOMAIN = ProjectDomains.TEST

SOURCE = [
bb.source.Git(
remote="https://github.com/se-sic/FeaturePerfCSCollection.git",
local=NAME,
refspec="origin/f-SynthCompileTimeCS",
limit=None,
shallow=False,
version_filter=project_filter_generator(NAME)
),
FeatureSource()
]

WORKLOADS = {
WorkloadSet(WorkloadCategory.EXAMPLE): [
VCommand(
SourceRoot(NAME) / RSBinary("CTCRTP"), label="CompileTime-CRTP"
)
]
}

@staticmethod
def binaries_for_revision(
revision: ShortCommitHash # pylint: disable=W0613
) -> tp.List[ProjectBinaryWrapper]:
binary_map = RevisionBinaryMap(
get_local_project_git_path(SynthCTCRTP.NAME)
)

binary_map.specify_binary(
"build/bin/CTCRTP",
BinaryType.EXECUTABLE,
only_valid_in=RevisionRange("a4a133a186", "HEAD")
)

return binary_map[revision]

def run_tests(self) -> None:
pass

def compile(self) -> None:
"""Compile the project."""
_do_feature_perf_cs_collection_compile(
self, "FPCSC_ENABLE_PROJECT_SYNTHCTCRTP"
)

def recompile(self) -> None:
"""Recompile the project."""
_do_feature_perf_cs_collection_recompile(self)


class SynthCTTemplateSpecialization(VProject):
"""Synthetic case-study project for compile time variability using template
specialization."""

NAME = 'SynthCTTemplateSpecialization'
GROUP = 'perf_tests'
DOMAIN = ProjectDomains.TEST

SOURCE = [
bb.source.Git(
remote="https://github.com/se-sic/FeaturePerfCSCollection.git",
local=NAME,
refspec="origin/f-SynthCompileTimeCS",
limit=None,
shallow=False,
version_filter=project_filter_generator(NAME)
),
FeatureSource()
]

WORKLOADS = {
WorkloadSet(WorkloadCategory.EXAMPLE): [
VCommand(
SourceRoot(NAME) / RSBinary("CTTemplateSpecialization"),
label="CompileTime-Template-Specialization"
)
]
}

@staticmethod
def binaries_for_revision(
revision: ShortCommitHash # pylint: disable=W0613
) -> tp.List[ProjectBinaryWrapper]:
binary_map = RevisionBinaryMap(
get_local_project_git_path(SynthCTTemplateSpecialization.NAME)
)

binary_map.specify_binary(
"build/bin/CTTemplateSpecialization",
BinaryType.EXECUTABLE,
only_valid_in=RevisionRange("a4a133a186", "HEAD")
)

return binary_map[revision]

def run_tests(self) -> None:
pass

def compile(self) -> None:
"""Compile the project."""
_do_feature_perf_cs_collection_compile(
self, "FPCSC_ENABLE_PROJECT_SYNTHCTSPECIALIZATION"
)

def recompile(self) -> None:
"""Recompile the project."""
_do_feature_perf_cs_collection_recompile(self)
Loading