This patch adds contiguity check with the runtime to avoid copyin/copyout
in case the actual argument is actually contiguous.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
flang/lib/Lower/ConvertExpr.cpp | ||
---|---|---|
2852 | Currently a single call to IsContiguous is made. call runtime if present if contiguous // no copy else copy end if present && !contiguous copyout Would it make sense to nest it in the first if so it is not performed when an arg is not present or so on? It would require an extra call when the first condition is true but no call when it is false. if present call runtime if contiguous no copy else copy end end if present call runtime if !contiguous copyout end end |
Logic looks good to me. One suggestion to maybe simplify the copy-out lowering code a bit.
flang/lib/Lower/ConvertExpr.cpp | ||
---|---|---|
2819 | I do not think a new value here, you can still use "restrictCopyAndFreeAtRuntime" and leave the copy-out code unmodified if you compute restrictCopyAndFreeAtRuntime = isContiguous || restrictCopyAndFreeAtRuntime before building the CopyOut pairs. |
flang/lib/Lower/ConvertExpr.cpp | ||
---|---|---|
2852 | The runtime should not spend too much time on arguments that are not present since a nullptr descriptor should be passed. I am not sure doing the runtime call twice in the other cases wouldn't be a worse drawback. |
I do not think a new value here, you can still use "restrictCopyAndFreeAtRuntime" and leave the copy-out code unmodified if you compute restrictCopyAndFreeAtRuntime = isContiguous || restrictCopyAndFreeAtRuntime before building the CopyOut pairs.