Use a similar method as in rocBLAS to determine whether to use C++ and HIP features in tensile_bfloat16.h
/**
* MIT License
*
- * Copyright (C) 2019 Advanced Micro Devices, Inc. All rights reserved.
+ * Copyright 2019 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
#ifndef _TENSILE_BFLOAT16_H_
#define _TENSILE_BFLOAT16_H_
-#ifndef __cplusplus
-
-#include <inttypes.h>
+// If this is a C compiler, C++ compiler below C++11, or a host-only compiler,
+// we only include a minimal definition of tensile_bfloat16
+#if __cplusplus < 201103L || !defined(__HCC__)
+#include <stdint.h>
typedef struct
{
uint16_t data;
} tensile_bfloat16;
-#else // __cplusplus
-
-#include <hip/hip_runtime_api.h>
+#else // __cplusplus < 201103L || !defined(__HCC__)
-#include <cinttypes>
#include <cmath>
-#include <iostream>
+#include <cstddef>
+#include <cstdint>
+#include <hip/hip_runtime.h>
+#include <ostream>
#include <type_traits>
struct tensile_bfloat16
@@ -191,6 +192,6 @@ inline __host__ __device__ tensile_bfloat16 abs(tensile_bfloat16 a)
inline tensile_bfloat16 sin(tensile_bfloat16 a) { return tensile_bfloat16(sinf(float(a))); }
inline tensile_bfloat16 cos(tensile_bfloat16 a) { return tensile_bfloat16(cosf(float(a))); }
-#endif // __cplusplus
+#endif // __cplusplus < 201103L || !defined(__HCC__)
#endif // _TENSILE_BFLOAT16_H_
