ModularM
Modular2y ago
3 replies
pascalpolygon

Invalid Parameter to Vectorize from example

Hello!

I just got started with Mojo, been playing with in for the past 2 days. I run into an a syntax error from just copying the matmul example.

@mojo
from algorithm.functional import vectorize

fn matmul_tiled(inout C: Matrix, A: Matrix, B: Matrix):
    @parameter
    fn calc_row(m: Int):
        @parameter
        fn calc_tile[tile_x: Int, tile_y: Int](x: Int, y: Int):
            for k in range(y, y + tile_y):

                @parameter
                fn dot[nelts: Int](n: Int):
                    C.store(
                        m,
                        n + x,
                        C.load[nelts](m, n + x)
                        + A[m, k] * B.load[nelts](k, n + x),
                    )

                vectorize[dot, nelts, size=tile_x]()

        tile[calc_tile, tile_n, tile_k](C.cols, B.rows)

    parallelize[calc_row](C.rows, C.rows)

On this line vectorize[dot, nelts, size=tile_x]() I get the error : Cannot pass 'fn[Int](n = Int) capturing -> None' value, parameter expected 'Int'mojo
Was this page helpful?