P4 to Git Change 1309486 by lmoriche@lmoriche_opencl_dev on 2016/08/31 20:40:56
SWDEV-94610 - Fix the indentation and function declarations (coding standards).
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompiler.cpp#13 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.cpp#23 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.hpp#10 edit
[ROCm/clr commit: 8d309ccae6]
This commit is contained in:
@@ -35,19 +35,21 @@ extern int openclFrontEnd(const char* cmdline, std::string*, std::string* typeIn
|
||||
namespace roc {
|
||||
|
||||
/* Temporary log function for the compiler library */
|
||||
static void logFunction(const char* msg, size_t size)
|
||||
static void
|
||||
logFunction(const char* msg, size_t size)
|
||||
{
|
||||
std::cout<< "Compiler Log: " << msg << std::endl;
|
||||
std::cout<< "Compiler Log: " << msg << std::endl;
|
||||
}
|
||||
|
||||
static int programsCount = 0;
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
bool
|
||||
HSAILProgram::compileImpl_LC(const std::string& sourceCode,
|
||||
const std::vector<const std::string*>& headers,
|
||||
const char** headerIncludeNames,
|
||||
amd::option::Options* options)
|
||||
HSAILProgram::compileImpl_LC(
|
||||
const std::string& sourceCode,
|
||||
const std::vector<const std::string*>& headers,
|
||||
const char** headerIncludeNames,
|
||||
amd::option::Options* options)
|
||||
{
|
||||
using namespace amd::opencl_driver;
|
||||
std::auto_ptr<Compiler> C(newCompilerInstance());
|
||||
@@ -57,7 +59,7 @@ HSAILProgram::compileImpl_LC(const std::string& sourceCode,
|
||||
std::ofstream f(options->getDumpFileName(".cl").c_str(), std::ios::trunc);
|
||||
if(f.is_open()) {
|
||||
f << "/* Compiler options:\n" << options->origOptionStr
|
||||
<< "\n*/\n\n" << sourceCode;
|
||||
<< "\n*/\n\n" << sourceCode;
|
||||
} else {
|
||||
buildLog_ +=
|
||||
"Warning: opening the file to dump the OpenCL source failed.\n";
|
||||
@@ -93,7 +95,7 @@ HSAILProgram::compileImpl_LC(const std::string& sourceCode,
|
||||
for (std::string::iterator it = headerIncludeName.begin(),
|
||||
end = headerIncludeName.end();
|
||||
it != end;
|
||||
++it) {
|
||||
++it) {
|
||||
if (*it == '/') *it = amd::Os::fileSeparator();
|
||||
}
|
||||
}
|
||||
@@ -109,7 +111,7 @@ HSAILProgram::compileImpl_LC(const std::string& sourceCode,
|
||||
newDirs.push_back(headerPath);
|
||||
}
|
||||
std::string headerFullName
|
||||
= headerPath + amd::Os::fileSeparator() + headerIncludeName;
|
||||
= headerPath + amd::Os::fileSeparator() + headerIncludeName;
|
||||
headerFileNames[i] = headerFullName;
|
||||
f.open(headerFullName.c_str(), std::fstream::out);
|
||||
//Should we allow asserts
|
||||
@@ -236,10 +238,11 @@ HSAILProgram::compileImpl_LC(const std::string& sourceCode,
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
bool
|
||||
HSAILProgram::compileImpl(const std::string& sourceCode,
|
||||
const std::vector<const std::string*>& headers,
|
||||
const char** headerIncludeNames,
|
||||
amd::option::Options* options)
|
||||
HSAILProgram::compileImpl(
|
||||
const std::string& sourceCode,
|
||||
const std::vector<const std::string*>& headers,
|
||||
const char** headerIncludeNames,
|
||||
amd::option::Options* options)
|
||||
{
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
return compileImpl_LC(sourceCode, headers, headerIncludeNames, options);
|
||||
@@ -279,7 +282,7 @@ HSAILProgram::compileImpl(const std::string& sourceCode,
|
||||
for (std::string::iterator it = headerIncludeName.begin(),
|
||||
end = headerIncludeName.end();
|
||||
it != end;
|
||||
++it) {
|
||||
++it) {
|
||||
if (*it == '/') *it = amd::Os::fileSeparator();
|
||||
}
|
||||
}
|
||||
@@ -295,7 +298,7 @@ HSAILProgram::compileImpl(const std::string& sourceCode,
|
||||
newDirs.push_back(headerPath);
|
||||
}
|
||||
std::string headerFullName
|
||||
= headerPath + amd::Os::fileSeparator() + headerIncludeName;
|
||||
= headerPath + amd::Os::fileSeparator() + headerIncludeName;
|
||||
headerFileNames[i] = headerFullName;
|
||||
f.open(headerFullName.c_str(), std::fstream::out);
|
||||
//Should we allow asserts
|
||||
|
||||
File diff soppresso perché troppo grande
Carica Diff
@@ -26,159 +26,159 @@ using namespace HSAIL_ASM;
|
||||
//! \namespace roc HSA Device Implementation
|
||||
namespace roc {
|
||||
|
||||
//! \class empty program
|
||||
class HSAILProgram : public device::Program
|
||||
{
|
||||
friend class ClBinary;
|
||||
public:
|
||||
//! Default constructor
|
||||
HSAILProgram(roc::NullDevice& device);
|
||||
//! Default destructor
|
||||
~HSAILProgram();
|
||||
//! \class empty program
|
||||
class HSAILProgram : public device::Program
|
||||
{
|
||||
friend class ClBinary;
|
||||
public:
|
||||
//! Default constructor
|
||||
HSAILProgram(roc::NullDevice& device);
|
||||
//! Default destructor
|
||||
~HSAILProgram();
|
||||
|
||||
// Initialize Binary for GPU (used only for clCreateProgramWithBinary()).
|
||||
virtual bool initClBinary(char *binaryIn, size_t size);
|
||||
// Initialize Binary for GPU (used only for clCreateProgramWithBinary()).
|
||||
virtual bool initClBinary(char *binaryIn, size_t size);
|
||||
|
||||
//! Returns the aclBinary associated with the program
|
||||
const aclBinary* binaryElf() const {
|
||||
return static_cast<const aclBinary*>(binaryElf_);
|
||||
}
|
||||
//! Returns the aclBinary associated with the program
|
||||
const aclBinary* binaryElf() const {
|
||||
return static_cast<const aclBinary*>(binaryElf_);
|
||||
}
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
//! Returns the program metadata.
|
||||
const RuntimeMD::Program::Metadata* metadata() const { return metadata_; }
|
||||
//! Returns the program metadata.
|
||||
const RuntimeMD::Program::Metadata* metadata() const { return metadata_; }
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
//! Return a typecasted GPU device
|
||||
const NullDevice& dev() const
|
||||
{ return static_cast<const NullDevice&>(device()); }
|
||||
//! Return a typecasted GPU device
|
||||
const NullDevice& dev() const
|
||||
{ return static_cast<const NullDevice&>(device()); }
|
||||
|
||||
//! Returns the hsaBinary associated with the program
|
||||
hsa_agent_t hsaDevice() const {
|
||||
return dev().getBackendDevice();
|
||||
}
|
||||
//! Returns the hsaBinary associated with the program
|
||||
hsa_agent_t hsaDevice() const {
|
||||
return dev().getBackendDevice();
|
||||
}
|
||||
|
||||
protected:
|
||||
//! pre-compile setup for GPU
|
||||
virtual bool initBuild(amd::option::Options* options);
|
||||
protected:
|
||||
//! pre-compile setup for GPU
|
||||
virtual bool initBuild(amd::option::Options* options);
|
||||
|
||||
//! post-compile setup for GPU
|
||||
virtual bool finiBuild(bool isBuildGood);
|
||||
//! post-compile setup for GPU
|
||||
virtual bool finiBuild(bool isBuildGood);
|
||||
|
||||
/*! \brief Compiles GPU CL program to LLVM binary (compiler frontend)
|
||||
*
|
||||
* \return True if we successfully compiled a GPU program
|
||||
*/
|
||||
virtual bool compileImpl(
|
||||
const std::string& sourceCode, //!< the program's source code
|
||||
const std::vector<const std::string*>& headers,
|
||||
const char** headerIncludeNames,
|
||||
amd::option::Options* options //!< compile options's object
|
||||
);
|
||||
/*! \brief Compiles GPU CL program to LLVM binary (compiler frontend)
|
||||
*
|
||||
* \return True if we successfully compiled a GPU program
|
||||
*/
|
||||
virtual bool compileImpl(
|
||||
const std::string& sourceCode, //!< the program's source code
|
||||
const std::vector<const std::string*>& headers,
|
||||
const char** headerIncludeNames,
|
||||
amd::option::Options* options //!< compile options's object
|
||||
);
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
virtual bool compileImpl_LC(
|
||||
const std::string& sourceCode, //!< the program's source code
|
||||
const std::vector<const std::string*>& headers,
|
||||
const char** headerIncludeNames,
|
||||
amd::option::Options* options //!< compile options's object
|
||||
);
|
||||
virtual bool compileImpl_LC(
|
||||
const std::string& sourceCode, //!< the program's source code
|
||||
const std::vector<const std::string*>& headers,
|
||||
const char** headerIncludeNames,
|
||||
amd::option::Options* options //!< compile options's object
|
||||
);
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
/*! \brief Compiles LLVM binary to HSAIL code (compiler backend: link+opt+codegen)
|
||||
*
|
||||
* \return The build error code
|
||||
*/
|
||||
int compileBinaryToHSAIL(
|
||||
amd::option::Options* options //!< options for compilation
|
||||
);
|
||||
/*! \brief Compiles LLVM binary to HSAIL code (compiler backend: link+opt+codegen)
|
||||
*
|
||||
* \return The build error code
|
||||
*/
|
||||
int compileBinaryToHSAIL(
|
||||
amd::option::Options* options //!< options for compilation
|
||||
);
|
||||
|
||||
|
||||
virtual bool linkImpl(amd::option::Options* options);
|
||||
virtual bool linkImpl(amd::option::Options* options);
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
virtual bool linkImpl_LC(amd::option::Options* options);
|
||||
virtual bool linkImpl_LC(amd::option::Options* options);
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
//! Link the device programs.
|
||||
virtual bool linkImpl (const std::vector<Program*>& inputPrograms,
|
||||
amd::option::Options* options,
|
||||
bool createLibrary);
|
||||
//! Link the device programs.
|
||||
virtual bool linkImpl (const std::vector<Program*>& inputPrograms,
|
||||
amd::option::Options* options,
|
||||
bool createLibrary);
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
virtual bool linkImpl_LC(const std::vector<Program*>& inputPrograms,
|
||||
amd::option::Options* options,
|
||||
bool createLibrary);
|
||||
virtual bool linkImpl_LC(const std::vector<Program*>& inputPrograms,
|
||||
amd::option::Options* options,
|
||||
bool createLibrary);
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
virtual bool createBinary(amd::option::Options* options);
|
||||
virtual bool createBinary(amd::option::Options* options);
|
||||
|
||||
//! Initialize Binary
|
||||
virtual bool initClBinary();
|
||||
//! Initialize Binary
|
||||
virtual bool initClBinary();
|
||||
|
||||
//! Release the Binary
|
||||
virtual void releaseClBinary();
|
||||
//! Release the Binary
|
||||
virtual void releaseClBinary();
|
||||
|
||||
virtual const aclTargetInfo & info(const char * str = ""){
|
||||
return info_;
|
||||
}
|
||||
virtual const aclTargetInfo & info(const char * str = ""){
|
||||
return info_;
|
||||
}
|
||||
|
||||
virtual bool isElf(const char* bin) const {
|
||||
return amd::isElfMagic(bin);
|
||||
//return false;
|
||||
}
|
||||
virtual bool isElf(const char* bin) const {
|
||||
return amd::isElfMagic(bin);
|
||||
//return false;
|
||||
}
|
||||
|
||||
//! Returns the binary
|
||||
// This should ensure that the binary is updated with all the kernels
|
||||
// ClBinary& clBinary() { return binary_; }
|
||||
ClBinary* clBinary() {
|
||||
return static_cast<ClBinary*>(device::Program::clBinary());
|
||||
}
|
||||
const ClBinary* clBinary() const {
|
||||
return static_cast<const ClBinary*>(device::Program::clBinary());
|
||||
}
|
||||
private:
|
||||
/* \brief Returns the next stage to compile from, based on sections in binary,
|
||||
* also returns completeStages in a vector, which contains at least ACL_TYPE_DEFAULT,
|
||||
* sets needOptionsCheck to true if options check is needed to decide whether or not to recompile
|
||||
*/
|
||||
aclType getCompilationStagesFromBinary(std::vector<aclType>& completeStages, bool& needOptionsCheck);
|
||||
//! Returns the binary
|
||||
// This should ensure that the binary is updated with all the kernels
|
||||
// ClBinary& clBinary() { return binary_; }
|
||||
ClBinary* clBinary() {
|
||||
return static_cast<ClBinary*>(device::Program::clBinary());
|
||||
}
|
||||
const ClBinary* clBinary() const {
|
||||
return static_cast<const ClBinary*>(device::Program::clBinary());
|
||||
}
|
||||
private:
|
||||
/* \brief Returns the next stage to compile from, based on sections in binary,
|
||||
* also returns completeStages in a vector, which contains at least ACL_TYPE_DEFAULT,
|
||||
* sets needOptionsCheck to true if options check is needed to decide whether or not to recompile
|
||||
*/
|
||||
aclType getCompilationStagesFromBinary(std::vector<aclType>& completeStages, bool& needOptionsCheck);
|
||||
|
||||
/* \brief Returns the next stage to compile from, based on sections and options in binary
|
||||
*/
|
||||
aclType getNextCompilationStageFromBinary(amd::option::Options* options);
|
||||
bool saveBinaryAndSetType(type_t type);
|
||||
bool initBrigContainer();
|
||||
void destroyBrigContainer();
|
||||
//Initializes BRIG module
|
||||
bool initBrigModule();
|
||||
void destroyBrigModule();
|
||||
//! Disable default copy constructor
|
||||
HSAILProgram(const HSAILProgram&);
|
||||
/* \brief Returns the next stage to compile from, based on sections and options in binary
|
||||
*/
|
||||
aclType getNextCompilationStageFromBinary(amd::option::Options* options);
|
||||
bool saveBinaryAndSetType(type_t type);
|
||||
bool initBrigContainer();
|
||||
void destroyBrigContainer();
|
||||
//Initializes BRIG module
|
||||
bool initBrigModule();
|
||||
void destroyBrigModule();
|
||||
//! Disable default copy constructor
|
||||
HSAILProgram(const HSAILProgram&);
|
||||
|
||||
//! Disable operator=
|
||||
HSAILProgram& operator=(const HSAILProgram&);
|
||||
//! Disable operator=
|
||||
HSAILProgram& operator=(const HSAILProgram&);
|
||||
|
||||
//! Returns all the options to be appended while passing to the
|
||||
//compiler
|
||||
std::string hsailOptions(amd::option::Options* options);
|
||||
//! Returns all the options to be appended while passing to the
|
||||
//compiler
|
||||
std::string hsailOptions(amd::option::Options* options);
|
||||
|
||||
// aclBinary and aclCompiler - for the compiler library
|
||||
aclBinary* binaryElf_; //!< Binary for the new compiler library
|
||||
aclBinaryOptions binOpts_; //!< Binary options to create aclBinary
|
||||
// aclBinary and aclCompiler - for the compiler library
|
||||
aclBinary* binaryElf_; //!< Binary for the new compiler library
|
||||
aclBinaryOptions binOpts_; //!< Binary options to create aclBinary
|
||||
|
||||
/* Brig and Brig modules */
|
||||
BrigModule_t brigModule_; //!< Brig that should be used in the HSA runtime
|
||||
BrigContainer* hsaBrigContainer_; //!< Container for the BRIG;
|
||||
hsa_ext_program_t hsaProgramHandle_; //!< Handle to HSA runtime program
|
||||
hsa_code_object_t hsaProgramCodeObject_; //!< Handle to HSA code object
|
||||
hsa_executable_t hsaExecutable_; //!< Handle to HSA executable
|
||||
/* Brig and Brig modules */
|
||||
BrigModule_t brigModule_; //!< Brig that should be used in the HSA runtime
|
||||
BrigContainer* hsaBrigContainer_; //!< Container for the BRIG;
|
||||
hsa_ext_program_t hsaProgramHandle_; //!< Handle to HSA runtime program
|
||||
hsa_code_object_t hsaProgramCodeObject_; //!< Handle to HSA code object
|
||||
hsa_executable_t hsaExecutable_; //!< Handle to HSA executable
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
RuntimeMD::Program::Metadata* metadata_; //!< Runtime metadata
|
||||
//! Return a new transient compiler instance.
|
||||
static std::auto_ptr<amd::opencl_driver::Compiler> newCompilerInstance();
|
||||
RuntimeMD::Program::Metadata* metadata_; //!< Runtime metadata
|
||||
//! Return a new transient compiler instance.
|
||||
static std::auto_ptr<amd::opencl_driver::Compiler> newCompilerInstance();
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
};
|
||||
};
|
||||
|
||||
/*@}*/} // namespace roc
|
||||
/*@}*/} // namespace roc
|
||||
|
||||
#endif /*WITHOUT_HSA_BACKEND*/
|
||||
|
||||
|
||||
Fai riferimento in un nuovo problema
Block a user