Commit 62acda9d authored by Lukas Sommer's avatar Lukas Sommer

Introduce additional flag for compose command, setting the effort level;

parent 6e310f30
......@@ -54,11 +54,12 @@ final case class BulkImportJob(csvFile: Path) extends Job("bulkimport")
* i.e., each combination of [[base.Architecture]] and [[base.Platform]] given.
* @param composition Composition to synthesize micro-architecture for.
* @param designFrequency Operating frequency of PEs in the design.
* @param implementation Composer Implementation (e.g., Vivado).
* @param _implementation Composer Implementation (e.g., Vivado).
* @param _architectures Name list of [[base.Architecture]] instances.
* @param _platforms Name list of [[base.Platform]] instances.
* @param features List of [[base.Feature]] configurations for the design (opt.).
* @param debugMode Debug mode name (opt.).
* @param synthEffort Synthesis effort level (opt.).
**/
final case class ComposeJob(
composition: Composition,
......@@ -68,7 +69,8 @@ final case class ComposeJob(
private val _platforms: Option[Seq[String]] = None,
features: Option[Seq[Feature]] = None,
debugMode: Option[String] = None,
deleteProjects: Option[Boolean] = None) extends Job("compose") {
deleteProjects: Option[Boolean] = None,
synthEffort : Option[String] = Some("normal")) extends Job("compose") {
/** Returns the selected composer tool implementation. */
lazy val implementation: Composer.Implementation = Composer.Implementation(_implementation)
......
......@@ -117,7 +117,8 @@ package object json {
(JsPath \ "Platforms").readNullable[Seq[String]] ~
(JsPath \ "Features").readNullable[Seq[Feature]] ~
(JsPath \ "DebugMode").readNullable[String] ~
(JsPath \ "DeleteProjects").readNullable[Boolean]
(JsPath \ "DeleteProjects").readNullable[Boolean] ~
(JsPath \ "SynthEffort").readNullable[String]
) (ComposeJob.apply _)
implicit val composeJobWrites: Writes[ComposeJob] = (
......@@ -129,7 +130,8 @@ package object json {
(JsPath \ "Platforms").writeNullable[Seq[String]] ~
(JsPath \ "Features").writeNullable[Seq[Feature]] ~
(JsPath \ "DebugMode").writeNullable[String] ~
(JsPath \ "DeleteProjects").writeNullable[Boolean]
(JsPath \ "DeleteProjects").writeNullable[Boolean] ~
(JsPath \ "SynthEffort").writeNullable[String]
) (unlift(ComposeJob.unapply _ andThen (_ map ("Compose" +: _))))
/* ComposeJob @} */
......
......@@ -73,6 +73,10 @@ private object CommonArgParsers {
(longOption("deleteProjects", "DeleteProjects") ~ ws ~/
( boolstr ~ ws).?) map {case s => (s._1, s._2.getOrElse(true))}
def synthEffort : Parser[(String, String)] =
longOption("synthEffort", "SynthEffort") ~ ws ~/
string.opaque("Synthesis effort") ~ ws
def implementation: Parser[(String, String)] =
longOption("implementation", "Implementation") ~
ws ~/
......
......@@ -39,9 +39,12 @@ private object ComposeParser {
private val jobid = identity[ComposeJob] _
private def options: Parser[ComposeJob => ComposeJob] =
(implementation | architectures | platforms | features | debugMode | delProj).rep
(implementation | architectures | platforms | features | debugMode | synthEffort | delProj).rep
.map (opts => (opts map (applyOption _) fold jobid) (_ andThen _))
private val effortModes : Set[String] = Set("fastest", "fast", "normal",
"optimal", "aggressive_performance", "aggressive_area")
private def applyOption(opt: (String, _)): ComposeJob => ComposeJob =
opt match {
case ("Implementation", i: String) => _.copy(_implementation = i)
......@@ -50,6 +53,13 @@ private object ComposeParser {
case ("Features", fs: Seq[Feature @unchecked]) => _.copy(features = Some(fs))
case ("DebugMode", m: String) => _.copy(debugMode = Some(m))
case ("DeleteProjects", e: Boolean) => _.copy(deleteProjects = Some(e))
case ("SynthEffort", effort : String) => if(effortModes.contains(effort)){
_.copy(synthEffort = Some(effort))
}
else{
logger.warn(s"Unknown effort level $effort, using default normal")
_.copy(synthEffort = Some("normal"))
}
case o => throw new Exception(s"parsed illegal option: $o")
}
}
......@@ -169,7 +169,14 @@ configuration via `tapasco -n config.json`.
Indent(Arg(" r", "generate random result values") &
Arg(" f", "generate only timing failures") &
Arg(" p", "generate only placer errors") &
Arg(" o", "generate only other errors"))) &
Arg(" o", "generate only other errors")) &
Arg("--synthEffort EFFORT", "set effort level for synthesis and PnR; levels:") &
Indent(Arg("fastest", "lowest effort, minimal runtime") &
Arg("fast", "slightly slower, but still short runtime") &
Arg("normal", "default options") &
Arg("optimal", "slower, get best QoR possible") &
Arg("aggressive_performance", "maximal optimization for performance") &
Arg("aggressive_area", "maximal optimization for area"))) &
"" &
"NOTE: Currently the total number of PEs must be <= ${PLATFORM_NUM_SLOTS}.")
......
......@@ -59,7 +59,12 @@ class CommonArgParsersSpec extends FlatSpec with Matchers with Checkers {
"The deleteProject switch" should "be parsed correctly by deleteProject" in
check(forAllNoShrink(deleteProjectsGen) { d =>
checkParsed( P( delProj ~ End).parse(d) )
checkParsed(P(delProj ~ End).parse(d))
})
"All valid synthEffort parameters" should "be parsed correctly by synthEffort" in
check(forAllNoShrink(effortModeGen) { e =>
checkParsed( P(synthEffort ~ End).parse(e))
})
"All valid implementation parameters" should "be parsed correctly by implementation" in
......@@ -108,9 +113,16 @@ private object CommonArgParsersSpec {
qstringGen
))
<<<<<<< HEAD
val booleanOrNoneGen: Gen[String] = Gen.oneOf("true", "false", "")
val deleteProjectsGen: Gen[String] = join(Seq(genLongOption("deleteProjects"), booleanOrNoneGen))
=======
val effortModeGen : Gen[String] = join(Seq(
genLongOption("synthEffort"),
Gen.oneOf("fastest", "fast", "normal", "optimal", "optimal", "aggressive_performance", "aggressive_area")
))
>>>>>>> Introduce additional flag for compose command, setting the effort level;
val implementationGen: Gen[String] = join(Seq(
genLongOption("implementation"),
......
......@@ -41,7 +41,8 @@ private object ComposeParserSpec {
CommonArgParsersSpec.platformsGen,
FeatureParsersSpec.featuresGen,
CommonArgParsersSpec.debugModeGen,
CommonArgParsersSpec.deleteProjectsGen
CommonArgParsersSpec.deleteProjectsGen,
CommonArgParsersSpec.effortModeGen
)
val optionsGen: Gen[String] = for {
n <- Gen.choose(1, 20)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment