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

Apparent dependency lost with DeliteReduceTupleElem #25

Open
asujeeth opened this issue Sep 11, 2012 · 1 comment
Open

Apparent dependency lost with DeliteReduceTupleElem #25

asujeeth opened this issue Sep 11, 2012 · 1 comment
Assignees
Labels

Comments

@asujeeth
Copy link
Contributor

The following OptiML code looks ok to me, but produces a violated ordering of effect error:

val slice = (Matrix.rand(3,3)*100).map(_.AsInstanceOf[Int])    
val histogram = DenseVector[Int](256, true)    
var row = 0
while (row < slice.numRows) {
  var col = 0
  while (col < slice.numCols) {
    histogram(slice(row,col)) = histogram(slice(row,col))+1
    col += 1
  }
  row += 1
}      

// this produces violated error:
if (histogram.max > 1) histogram.maxIndex else 0
histogram.maxIndex

However, if we replace the last two lines with:
histogram.max

Or:
val htest = histogram.unsafeImmutable
if (htest.max > 1) htest.maxIndex else 0

the error goes away.

@asujeeth
Copy link
Contributor Author

This code exists and is runnable in Scratchpad.scala in the optiml-beta branch (under the comment "Bug 1").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant