Skip to content
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

NVPTX cannot select AtomicLoad with OpenMP and Eigen #64079

Open
markdewing opened this issue Jul 24, 2023 · 0 comments
Open

NVPTX cannot select AtomicLoad with OpenMP and Eigen #64079

markdewing opened this issue Jul 24, 2023 · 0 comments

Comments

@markdewing
Copy link
Contributor

As mentioned at the end of #64017, if Eigen is modified to remove the dynamic stack allocation, another 'cannot select' error results

LLVM ERROR: Cannot select: t47: i16,ch = AtomicLoad<(dereferenceable load acquire (s8) from `ptr addrspacecast (ptr addrspace(1) @_ZGVZN5Eigen8internal20manage_caching_sizesENS_6ActionEPlS2_S2_E12m_cacheSizes to ptr)`, align 8)> t26, t28
  t28: i64 = addrspacecast[1 -> 0] t51
    t51: i64 = NVPTXISD::Wrapper TargetGlobalAddress:i64<ptr addrspace(1) @_ZGVZN5Eigen8internal20manage_caching_sizesENS_6ActionEPlS2_S2_E12m_cacheSizes> 0
      t50: i64 = TargetGlobalAddress<ptr addrspace(1) @_ZGVZN5Eigen8internal20manage_caching_sizesENS_6ActionEPlS2_S2_E12m_cacheSizes> 0
In function: _ZN5Eigen8internal20manage_caching_sizesENS_6ActionEPlS2_S2_

Use the test case from #64017, and modify Eigen to undefine EIGEN_ALLOCA after it is defined in Core/util/Memory.h
The diff is

diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h
index f4217e261..6a8d2e738 100644
--- a/Eigen/src/Core/util/Memory.h
+++ b/Eigen/src/Core/util/Memory.h
@@ -680,6 +680,8 @@ template<typename T> EIGEN_DEVICE_FUNC T* smart_move(T* start, T* end, T* target
   #undef EIGEN_ALLOCA
 #endif
 
+#undef EIGEN_ALLOCA
+
 // This helper class construct the allocated memory, and takes care of destructing and freeing the handled data
 // at destruction time. In practice this helper class is mainly useful to avoid memory leak in case of exceptions.
 template<typename T> class aligned_stack_memory_handler : noncopyable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants