StanfordLegion / legion

The Legion Parallel Programming System
https://legion.stanford.edu
Apache License 2.0
678 stars 145 forks source link

Regent: codegen bug with cross product #1128

Open rupanshusoi opened 3 years ago

rupanshusoi commented 3 years ago

The following

import "regent"

task main()
  var r = region(ispace(int1d, 10), int)
  var p = partition(equal, r, ispace(int1d, 1))
  var cp = cross_product(p, p)
  cp[0][0][0] = 1
  for i in cp[0][0] do end
end

regentlib.start(main)

outputs

legion/language/terra/src/terralib.lua:1130: Errors reported during typechecking.
legion/language/src/regent/codegen.t:2460: definition of variable with symbol $r is not in scope in this context
      lr = `([cx:region(region_type).logical_region]).impl
               ^
/home/rootpi/code/legion/language/src/regent/codegen.t:8864: definition of variable with symbol $r is not in scope in this context
      is = `([value.value].impl.index_space)
                  ^
elliottslaughter commented 3 years ago

I'm pretty sure this is a normalizer issue. If you change the code as follows the problem goes away.

import "regent"

task main()
  var r = region(ispace(int1d, 10), int)
  var p = partition(equal, r, ispace(int1d, 1))
  var cp = cross_product(p, p)
  var a = cp[0]
  var b = a[0]
  b[0] = 1
  for i in b do end
end

regentlib.start(main)