-
Notifications
You must be signed in to change notification settings - Fork 16
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
Hoist malloc/free out of loops. #1500
Comments
Hand-modified MLIR, which, when compiled with tco + clang -O1 runs about 10% faster - that's ONLY by mvoing the malloc/free out of the loop.
Diff for the changes:
|
I understand why hoisting memory management is good, but why does Why wouldn't the compiler try to transform where (qim >= 1.0) qim = 1.0 to something like this forall ( i1 = 1 : size(qim, 1), i2 = 1 : size(qim, 2), &
i3 = 1 : size(qim, 3), i4 = 1 : size(qim, 4) )
if (qim(i1,i2,i3,4) >= 1.0)) then
qim(i1,i2,i3,4) = 1.0
end if
end forall (or something similar)? |
Avoiding malloc/free altogether would be even better, but not always doable.
The following is an example of code that calls malloc & free [as an implementation of
fir.allocmem
andfir.freemem
] to implement theWHERE
functionality.This is another performance enhancement found when investigating performance of the SNAP application.
Here's an example:
The text was updated successfully, but these errors were encountered: