-
Notifications
You must be signed in to change notification settings - Fork 38
Deforestation with nofib
s in the Benchmark Sub-project
#335
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
base: hkmc2
Are you sure you want to change the base?
Conversation
…ges to avoid creating needless matchRest functions
def addToBindings(symbol: Local, name: String, shadow: Bool) = | ||
if !shadow then assert(lookup(symbol).isEmpty, (symbol, this.showAsTree)) | ||
// FIXME: deforestation makes this assertion fail | ||
// if !shadow then assert(lookup(symbol).isEmpty, (symbol, this.showAsTree)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to look into how to handle this issue, which seems to be caused by using the same Scope
for generating programs both before/after deforestation?
given Config = | ||
if file.segments.contains("nofib-deforest") then | ||
Config.default.copy(deforest = S(Config.Deforestation( | ||
importedPublicModNames = Set("NofibPrelude"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
importedPublicModNames = Set("NofibPrelude"), | |
seethroughModules = Set("NofibPrelude"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 99f34b5
preludeFile) | ||
deforestResult match | ||
case Right(msg) => | ||
println(msg) // TODO: no println |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
println(msg) // TODO: no println |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 68cff7e
case Right(msg) => | ||
println(msg) // TODO: no println | ||
le | ||
case Left(prog -> summary -> detail) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't build a summary string even when not used – use a lambda?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 68cff7e by using trace logger.
|
||
def uid = | ||
import Result.* | ||
val uidValue = ResultId(System.identityHashCode(this)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are not guaranteed to be unique. Use the Uid definitions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 14190b1
def rewriteOneBlk(b: Block) = b match | ||
case Assign(lhs, Value.Lam(params, body), rest) if !lhs.isInstanceOf[TempSymbol] => | ||
val newSym = BlockMemberSymbol(lhs.nme, Nil, | ||
val newSym = BlockMemberSymbol(lhs.nme, syntax.Tree.DummyTermDef(syntax.Fun) :: Nil, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document why the dummy Fun.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in ba5c7b8
val sym = BlockMemberSymbol("lambda", Nil, nameIsMeaningful = false) | ||
val sym = BlockMemberSymbol( | ||
"lambda", | ||
syntax.Tree.DummyTermDef(syntax.Fun) :: Nil, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document why the dummy Fun.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in ba5c7b8
case _ => N | ||
val singleCallBms = BlockMemberSymbol(d.sym.nme + "$", Nil) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 362e212
args(fs): args => | ||
val tmpSym = TempSymbol(N, "arr") | ||
Assign(tmpSym, Value.Arr(mut = false, args), k(Value.Ref(tmpSym))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really needed? At the very least, we shouldn't do it when the array is immediately returned or already assigned to a variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #338
fun insertCompact(mif_s, ls) = if mif_s is [mif, s] then | ||
fun insert(x, ls) = if ls is | ||
Nil then x :: Nil | ||
y :: ys then if x > y then y :: insert(x, ys) else x :: y :: ys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here x > y
converts both x and y (which are JS objects of class MoveInFull
) to string and perform string comparison. It should compare field by field instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the catch. @ychenfo let's remember to fix this when we come back to the PR.
TODO
nofibs
to the benchmark subproject