stanford-ppl / spatial

Spatial: "Specify Parameterized Accelerators Through Inordinately Abstract Language"
https://spatial.stanford.edu
MIT License
271 stars 33 forks source link

darkVolume for B>1 components of hierarchically banked memory #219

Closed mattfel1 closed 5 years ago

mattfel1 commented 5 years ago

I got code smell that if B > 1 for a component of a hierarchically banked memory and P % N != 0 for that component, darkVolume is being calculated incorrectly and the app does not validate. Its really hard to come up with a test case for this, but if you use BroadcastRandom as the test app and hack the compiler in the following ways, you can get a case that looks like this:

in BankingData.scala, AlphaBestGuess's def expand() should have val possibleAs = accessBased ++ dimBased (do not include List(0,1))

in ExhaustiveBanking.scala, the line should be val P_expanded = Seq.tabulate(alpha.size){i => divisors(P_raw(i)) ++ {if (P_raw(i) != 1) List(stagedDims(i)) else List()}} (do not require && b == 1).

Now that I'm almost done with banking refactor, its possible that a weird scheme like this could be chosen out in the wild so this is probably worth fixing correctly.

mattfel1 commented 5 years ago

Pretty sure this was caused because I was calculating "visibleBanks" incorrectly when resolving offset and also wasn't computing the offset bump from preceding dimensions correctly for block cyclic. Should be fixed now. Caught and fixed this in the bankapalooza app.