You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This tries to run a parallel worker with a (badly/non) parametrized lambda, which crashes mojo.
Should probably be detected as an issue at compile time?
Steps to reproduce
from algorithm import parallelize
from os.atomic import Atomic
fn main() raises:
tiles = List[String]()
tiles.extend(List[String]("abcde", "fghij", "klmno", "pqrst", "uvwxy"))
dimx = tiles.size
dimy = len(tiles[0])
var mmax = Atomic[DType.int64](0)
# this doesn't reference any globals so is ok
fn idx(x: Int32, y: Int32) -> Int32:
return 220 + ((y + 1) % 2) * 110 + x + 1
# this references dimx, dimy but is not @parameter bound
fn bar(i: Int) -> SIMD[DType.int32, 4]:
return SIMD[DType.int32, 4](dimy, i - 2 * dimx - dimy, -1, 0)
@parameter
fn foo(start: SIMD[DType.int32, 4]) -> Int64:
return int(idx(start[0], start[1]))
@parameter
fn step2(i: Int):
mmax.max(foo(bar(i)))
@parameter
fn invoke() -> Int64:
parallelize[step2](4)
return mmax.value
# this works, despite bar not having @parameter decorator
print(foo(bar(1)))
# and this causes the whole runtime to crash
print(invoke())
print(tiles.size, "tokens", dimx, dimy)
System information
- What OS did you do install Mojo on ?
Windows 11 / WSL 2
- Provide version information for Mojo by pasting the output of `mojo -v``mojo 24.5.0 (e8aacb95)`
- Provide Modular CLI version by pasting the output of `magic -V``magic 0.2.3`
The text was updated successfully, but these errors were encountered:
Bug description
Sample code below.
This tries to run a parallel worker with a (badly/non) parametrized lambda, which crashes mojo.
Should probably be detected as an issue at compile time?
Steps to reproduce
System information
The text was updated successfully, but these errors were encountered: