Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inlinable call expressions #3

Open
arhik opened this issue Mar 14, 2024 · 0 comments
Open

inlinable call expressions #3

arhik opened this issue Mar 14, 2024 · 0 comments

Comments

@arhik
Copy link
Member

arhik commented Mar 14, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant