You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the EnzymeCreateForwardDiff function in enzyme to calculate the gradient of a function (rhs). This function calculates the gradient of a vector-valued function. I'm using threading: the function is designed to be called from different threads, passing in two ints that give the current thread id, and the total number of threads. Each thread computes part of the vector of values
I'm using atomics to implement synchronisation barriers within the function, and this is where my problem is occuring. I have a global value thread_counter which is used to implement the barrier, and enzyme is incorrectly considering this global as active, but it should have no effect on the values I'm taking the gradient of. Is there a way of forcing enzyme to consider thread_counter as inactive?
The IR for the function and the error I'm getting is reproduced below:
After looking through the enzyme code, I figured that I could mark thread_counter as inactive by either:
adding the metadata "enzyme_inactive", or
incorporating the string "enzyme_const" in the name of the global
I tried 1, but this didn't seem to have any effect (it could be an inkwell bug as I also tried to print the module and it segfaulted when it got to the metadata I added). I tried 2 and this worked and enzyme no longer errored on the atomicrmw instruction. I'll carry on and check that the forward gradient is calculated correctly
I'm using the
EnzymeCreateForwardDiff
function in enzyme to calculate the gradient of a function (rhs
). This function calculates the gradient of a vector-valued function. I'm using threading: the function is designed to be called from different threads, passing in two ints that give the current thread id, and the total number of threads. Each thread computes part of the vector of valuesI'm using atomics to implement synchronisation barriers within the function, and this is where my problem is occuring. I have a global value
thread_counter
which is used to implement the barrier, and enzyme is incorrectly considering this global as active, but it should have no effect on the values I'm taking the gradient of. Is there a way of forcing enzyme to considerthread_counter
as inactive?The IR for the function and the error I'm getting is reproduced below:
The text was updated successfully, but these errors were encountered: