Skip to content

Commit

Permalink
important fixes for pool avg / max computation
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoreilly committed Nov 16, 2024
1 parent 68e5653 commit a06e5de
Show file tree
Hide file tree
Showing 4 changed files with 196 additions and 32 deletions.
9 changes: 6 additions & 3 deletions axon/pool.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions axon/pool.goal
Original file line number Diff line number Diff line change
Expand Up @@ -202,22 +202,25 @@ func PoolAvgMaxUpdate(pi, di, ni uint32) {
// PoolAvgMaxCalcVar does Calc on Cycle level, and re-inits, for given Var
func PoolAvgMaxCalcVar(vr AvgMaxVars, pi, di uint32) {
floatFromInt := float32(1.0) / float32(uint32(1) << 20)
vim := AvgMaxIntVarIndex(vr, Max)
sum := PoolsInt[vim, pi, di]
vis := AvgMaxIntVarIndex(vr, Avg)
sum := PoolsInt[vis, pi, di]
if sum < 0 {
//gosl:end
log.Println("PoolAvgMaxCalc overflow in Sum", "pi:", pi, "di:", di, "sum:", sum)
//gosl:start
sum = int32(uint32(1) << 20)
}
Pools[AvgMaxVarIndex(vr, AMCycle, Avg), pi, di] = float32(sum) * floatFromInt
mx := PoolsInt[AvgMaxIntVarIndex(vr, Max), pi, di]
PoolsInt[vis, pi, di] = 0
vim := AvgMaxIntVarIndex(vr, Max)
mx := PoolsInt[vim, pi, di]
if mx < 0 {
//gosl:end
log.Println("PoolAvgMaxCalc overflow in Max", "pi:", pi, "di:", di, "max:", mx)
//gosl:start
mx = int32(uint32(1) << 20)
}
PoolsInt[vim, pi, di] = 0
Pools[AvgMaxVarIndex(vr, AMCycle, Max), pi, di] = float32(mx) * floatFromInt
}

Expand Down
105 changes: 92 additions & 13 deletions examples/ra25/ra25.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a06e5de

Please sign in to comment.