The ROCm CSB was broken by the following commit :

880cad8598

The commit leads to linker errors like below :

```
bazel-out/k8-opt/bin/tensorflow/core/kernels/_objs/serialize_sparse_op/serialize_sparse_op.o:
serialize_sparse_op.cc:function tensorflow::(anonymous namespace)::SerializeManySparseOp<tensorflow::tstring, tensorflow::Variant>::Compute(tensorflow::OpKernelContext*): error:
undefined reference to 'tensorflow::DataTypeToEnum<tensorflow::tstring>::value'
```

The breakage seems to be something that should affect all platforms (not just ROCm)

The cause of the error is that the static member varibale `DataTypeToEnum<T>::value` is declared,
but not defined in the file `tensorflow/core/framework/types.h` file. Therefore any use of it
as a "reference" will lead to linker errors. The commit above seems to introduce two such uses.

This commit fixes the issue by adding the explicit definition of `DataTypeToEnum<T>::value` in `types.cc` file
This commit is contained in:
Deven Desai 2020-01-13 18:11:54 +00:00
parent 212eeb3732
commit 473d15a87f

View File

@ -249,4 +249,33 @@ int DataTypeSize(DataType dt) {
#undef CASE #undef CASE
} }
// Define DataTypeToEnum<T>::value.
#define DEFINE_DATATYPETOENUM_VALUE(TYPE) \
constexpr DataType DataTypeToEnum<TYPE>::value;
DEFINE_DATATYPETOENUM_VALUE(float);
DEFINE_DATATYPETOENUM_VALUE(double);
DEFINE_DATATYPETOENUM_VALUE(int32);
DEFINE_DATATYPETOENUM_VALUE(uint32);
DEFINE_DATATYPETOENUM_VALUE(uint16);
DEFINE_DATATYPETOENUM_VALUE(uint8);
DEFINE_DATATYPETOENUM_VALUE(int16);
DEFINE_DATATYPETOENUM_VALUE(int8);
DEFINE_DATATYPETOENUM_VALUE(tstring);
DEFINE_DATATYPETOENUM_VALUE(complex64);
DEFINE_DATATYPETOENUM_VALUE(complex128);
DEFINE_DATATYPETOENUM_VALUE(int64);
DEFINE_DATATYPETOENUM_VALUE(uint64);
DEFINE_DATATYPETOENUM_VALUE(bool);
DEFINE_DATATYPETOENUM_VALUE(qint8);
DEFINE_DATATYPETOENUM_VALUE(quint8);
DEFINE_DATATYPETOENUM_VALUE(qint16);
DEFINE_DATATYPETOENUM_VALUE(quint16);
DEFINE_DATATYPETOENUM_VALUE(qint32);
DEFINE_DATATYPETOENUM_VALUE(bfloat16);
DEFINE_DATATYPETOENUM_VALUE(Eigen::half);
DEFINE_DATATYPETOENUM_VALUE(ResourceHandle);
DEFINE_DATATYPETOENUM_VALUE(Variant);
#undef DEFINE_DATATYPETOENUM_VALUE
} // namespace tensorflow } // namespace tensorflow