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.
callExprfunction takes the function call and transpiles them to appropriate JL-WGSL IR format.WGPUTranspiler.jl/src/codegen/expr.jl
Lines 41 to 51 in f56bdfb
We can specialize certain functions like
size(x)where x is a WgpuArray, lets say, and transpile them toxDims. This will be easier for julia users to adapt than a convention of invisible variable xDims.Example use case:
gId = xDims.x*gIdy + gIdxSince
xDimsis 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)->xDimsat every instance. This would also come with challenges like indexing intosize(x)might fail and needs to handled during transpilation stage.One solution would be have a seperate
SizeExprand define indexing transpile definitions.