Skip to content

@trace function_call() to introduce function barrierΒ #346

@Pangoraw

Description

@Pangoraw

Currently, calling the same function multiple times will generate the IR multiple times due to the tracing.

One idea to circumvent this problem is to update the @trace macro to introduce a MLIR function call as the result op instead of tracing through the function. The cache for this must be specific:

@trace func_call()
func.func @func_call() {
}

func.func @main() {
  ...
  func.call @func_call()
  ...
}
struct Foo
   x::Int
   y::TracedRArray{Float32, 2}
end

f(z::Foo) # 1 version of z.x == 1
f(z::Foo) # 1 version of z.x == 2
f(z::Foo) # 1 version of z.y is size 100x100
f(z::Foo) # 1 version of z.y is size 10x10

Check the values in Julia land, and the MLIR Types to cache the functions among a single trace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions