5ba83829e2
SWDEV-94640 - Re-submit CL#1292110 after integration from fsa_foundation: - [OCL-LC-ROCm] OpenCL Runtime Library Implements OpenCL runtime API. Add HSA virtual device to ORCA. Rename hsa_foundation to ROCm Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/Makefile#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/build/Makefile#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/build/Makefile.rocm#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/mesa_glinterop.h#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocappprofile.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocappprofile.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocbinary.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocbinary.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocblit.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocblit.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompiler.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompilerlib.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompilerlib.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdefs.hpp#4 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#4 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocglinterop.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocglinterop.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roclib.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roclib.h#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocmemory.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocmemory.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprintf.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprintf.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocregisters.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocsettings.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocsettings.hpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.cpp#3 add ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.hpp#3 add
116 řádky
3.2 KiB
C++
116 řádky
3.2 KiB
C++
//
|
|
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
|
|
//
|
|
#pragma once
|
|
|
|
/*! \addtogroup GPU GPU Device Implementation
|
|
* @{
|
|
*/
|
|
#ifndef isinf
|
|
#ifdef _MSC_VER
|
|
#define isinf(X) (!_finite(X) && !_isnan(X))
|
|
#endif //_MSC_VER
|
|
#endif // isinf
|
|
|
|
#ifndef isnan
|
|
#ifdef _MSC_VER
|
|
#define isnan(X) (_isnan(X))
|
|
#endif //_MSC_VER
|
|
#endif // isnan
|
|
|
|
#ifndef copysign
|
|
#ifdef _MSC_VER
|
|
#define copysign(X, Y) (_copysign(X, Y))
|
|
#endif //_MSC_VER
|
|
#endif // copysign
|
|
|
|
//! GPU Device Implementation
|
|
namespace roc {
|
|
|
|
//! Printf info structure
|
|
struct PrintfInfo {
|
|
std::string fmtString_; //!< formated string for printf
|
|
std::vector<uint> arguments_; //!< passed arguments to the printf() call
|
|
};
|
|
|
|
class Kernel;
|
|
class VirtualGPU;
|
|
class Device;
|
|
|
|
class PrintfDbg : public amd::HeapObject {
|
|
public:
|
|
//! Debug buffer size per workitem
|
|
static const uint WorkitemDebugSize = 4096;
|
|
|
|
//! constructor
|
|
PrintfDbg(Device& device, FILE* file = NULL);
|
|
|
|
//! Destructor
|
|
~PrintfDbg();
|
|
|
|
//! Initializes the debug buffer before kernel's execution
|
|
bool init(bool printfEnabled //!< checks for printf
|
|
);
|
|
|
|
//! Prints the kernel's debug informaiton from the buffer
|
|
bool output(VirtualGPU& gpu,
|
|
bool printfEnabled, //!< checks for printf
|
|
const std::vector<PrintfInfo>& printfInfo //!< printf info
|
|
);
|
|
|
|
//! Returns debug buffer object
|
|
address dbgBuffer() const { return dbgBuffer_; }
|
|
|
|
protected:
|
|
address dbgBuffer_; //!< Buffer to hold debug output
|
|
size_t dbgBuffer_size_; //!< Size of the debugger buffer
|
|
FILE* dbgFile_; //!< Debug file
|
|
Device& gpuDevice_; //!< GPU device object
|
|
|
|
//! Gets GPU device object
|
|
Device& dev() const { return gpuDevice_; }
|
|
|
|
//! Allocates the debug buffer
|
|
bool allocate(
|
|
bool realloc = false //!< If TRUE then reallocate the debug memory
|
|
);
|
|
|
|
//! Returns TRUE if a float value has to be printed
|
|
bool checkFloat(const std::string& fmt //!< Format string
|
|
) const;
|
|
|
|
//! Returns TRUE if a string value has to be printed
|
|
bool checkString(const std::string& fmt //!< Format string
|
|
) const;
|
|
|
|
//! Finds the specifier in the format string
|
|
int checkVectorSpecifier(const std::string& fmt, //!< Format string
|
|
size_t startPos, //!< Start position for processing
|
|
size_t& curPos //!< End position for processing
|
|
) const;
|
|
|
|
//! Outputs an argument
|
|
size_t outputArgument(const std::string& fmt, //!< Format strint
|
|
bool printFloat, //!< Argument is a float value
|
|
size_t size, //!< Argument's size
|
|
const uint32_t* argument //!< Argument's location
|
|
) const;
|
|
|
|
//! Displays the PrintfDbg
|
|
void outputDbgBuffer(
|
|
const PrintfInfo& info, //!< printf info
|
|
const uint32_t* workitemData, //!< The PrintfDbg dump buffer
|
|
size_t& i //!< index to the data in the buffer
|
|
) const;
|
|
|
|
private:
|
|
//! Disable copy constructor
|
|
PrintfDbg(const PrintfDbg&);
|
|
|
|
//! Disable assignment
|
|
PrintfDbg& operator=(const PrintfDbg&);
|
|
};
|
|
|
|
/*@}*/} // namespace roc
|
|
|