From 102cf2a72d79b18f9e321ce37a58fb833ec2e578 Mon Sep 17 00:00:00 2001 From: Deven Desai Date: Tue, 22 Oct 2019 19:21:27 +0000 Subject: [PATCH] Fix for the HIP build+test errors. The errors were introduced by this commit : After the above mentioned commit, some of the tests started failing with the following error ``` Built target cxx11_tensor_reduction Building HIPCC object unsupported/test/CMakeFiles/cxx11_tensor_reduction_gpu_5.dir/cxx11_tensor_reduction_gpu_5_generated_cxx11_tensor_reduction_gpu.cu.o In file included from /home/rocm-user/eigen/unsupported/test/cxx11_tensor_reduction_gpu.cu:16: In file included from /home/rocm-user/eigen/unsupported/Eigen/CXX11/Tensor:117: /home/rocm-user/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorBlockV2.h:155:5: error: the field type is not amp-compatible DestinationBufferKind m_kind; ^ /home/rocm-user/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorBlockV2.h:211:3: error: the field type is not amp-compatible DestinationBuffer m_destination; ^ ``` For some reason HIPCC does not like device code to contain enum types which do not have the base-type explicitly declared. The fix is trivial, explicitly state "int" as the basetype --- unsupported/Eigen/CXX11/src/Tensor/TensorBlockV2.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorBlockV2.h b/unsupported/Eigen/CXX11/src/Tensor/TensorBlockV2.h index c85c4c6c8..48417c12e 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorBlockV2.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorBlockV2.h @@ -80,7 +80,14 @@ class TensorBlockDescriptor { // evaluated expression scalar type. class DestinationBuffer { public: - enum DestinationBufferKind { + enum DestinationBufferKind : int { + // The above explicit specification of "int" as the enum basetype is needed + // to get around a HIPCC link error ("the field type is not amp-compatible") + // which is issued for class members with the enum type. + // TODO(rocm): + // remove the "int" basetype once HIPCC has been fixed to not error out + // in the above scenario. + // Destination buffer is not defined (`m_data` == nullptr). kEmpty,