diff --git a/README.md b/README.md index a0d6b14b84..8f7b659eb8 100644 --- a/README.md +++ b/README.md @@ -97,3 +97,8 @@ The README with the procedures and tips the team used during this porting effort * **hipexamine.sh** : Script to scan directory, find all code, and report statistics on how much can be ported with HIP (and identify likely features not yet supported) * **doc**: Documentation - markdown and doxygen info + +## Reporting an issue +Use the [GitHub issue tracker] (https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP/issues). +If reporting a bug, include the output of "hipconfig --full" and samples/1_hipInfo/hipInfo (if possible). + diff --git a/include/hcc_detail/trace_helper.h b/include/hcc_detail/trace_helper.h new file mode 100644 index 0000000000..af24531742 --- /dev/null +++ b/include/hcc_detail/trace_helper.h @@ -0,0 +1,71 @@ +#include +#include +#include + +#define CASE_STR(x) case x: return #x; + + +// Building block functions: +template +std::string ToHexString(T v) +{ + std::ostringstream ss; + ss << "0x" << std::hex << v; + return ss.str(); +}; + + + +// Template overloads for ToString to handle various types: +// Note these use C++11 variadic templates +template +std::string ToString(T v) { + std::ostringstream ss; + ss << v; + return ss.str(); +}; + + +#if 0 +template <> +std::string ToString(void* v) { + std::ostringstream ss; + //ss << "0x" << std::setw(16) << std::setfill('0') << std::hex << v; + ss << "0x" << std::hex << v; + return ss.str(); +}; +#endif + + +template <> +std::string ToString(hipMemcpyKind v) { + switch(v) { + CASE_STR(hipMemcpyHostToHost); + CASE_STR(hipMemcpyHostToDevice); + CASE_STR(hipMemcpyDeviceToHost); + CASE_STR(hipMemcpyDeviceToDevice); + CASE_STR(hipMemcpyDefault); + default : return ToHexString(v); + }; +}; + + +template <> +std::string ToString(hipError_t v) { + return ihipErrorString(v); +}; + + +// Catch empty arguments case +std::string ToString() { + return (""); +} + + /// +// C++11 variadic template - peels off first argument, converts to string, and calls itself again to peel the next arg. +template +std::string ToString(T first, Args... args) { + return ToString(first) + ", " + ToString(args...) ; +} + +