Closed rmoyard closed 3 months ago
[sc-67709]
Hello. You may have forgotten to update the changelog!
Please edit doc/changelog.md
on your branch with:
What is nofree
?
From LLVM docs:
This indicates that callee does not free the pointer argument. This is not a valid attribute for return values.
@rmoyard, just a small correction, nofree
as an annotation exists for parameters and functions. The documentation you pointed to is for parameters but you added it to the function. Here is the documentation for the attribute nofree for functions:
nofree
This function attribute indicates that the function does not, directly or transitively, call a memory-deallocation function (free, for example) on a memory allocation which existed before the call.
As a result, uncaptured pointers that are known to be dereferenceable prior to a call to a function with the nofree attribute are still known to be dereferenceable after the call. The capturing condition is necessary in environments where the function might communicate the pointer to another thread which then deallocates the memory. Alternatively, nosync would ensure such communication cannot happen and even captured pointers cannot be freed by the function.
A nofree function is explicitly allowed to free memory which it allocated or (if not nosync) arrange for another thread to free memory on it’s behalf. As a result, perhaps surprisingly, a nofree function can return a pointer to a previously deallocated memory object.
Context: Update to use latest Enzyme release. Description of the Change: I added
NoFree
attribute to the function__catalyst_inactive_callback
in order to be compatible with Enzyme changes in this PR https://github.com/EnzymeAD/Enzyme/pull/1687/.