Skip to content

inlinable call expressions #3

@arhik

Description

@arhik

callExpr function takes the function call and transpiles them to appropriate JL-WGSL IR format.

function callExpr(scope::Scope, f::Union{Symbol, Expr}, args::Vector{Any})
func = inferExpr(scope, f)
inferScope!(scope, func)
arguments = []
for arg in args
argument = inferExpr(scope, arg)
inferScope!(scope, argument)
push!(arguments, argument)
end
return CallExpr(func, arguments)
end

We can specialize certain functions like size(x) where x is a WgpuArray, lets say, and transpile them to xDims. This will be easier for julia users to adapt than a convention of invisible variable xDims.

Example use case: gId = xDims.x*gIdy + gIdx

Since xDims is a reference to user invisible constant defined by transpiler during compute block transpilation, it would be unintuitive for new users to adapt to such hidden conventions.

So it would be ideal to transpile size(x) -> xDims at every instance. This would also come with challenges like indexing into size(x) might fail and needs to handled during transpilation stage.

One solution would be have a seperate SizeExpr and define indexing transpile definitions.

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