P4 to Git Change 1702548 by wchau@wchau_OCL_boltzmann on 2018/11/05 14:14:59

SWDEV-162389 - OpenCL Support for COMgr
	- currently COMgr library does not support gfx10+
	- to build the OCL driver with the COMgr support, add an COMGR_DIR option for the MAKE command
	- the COMGR_DIR specifies the directory that contains the COMgr header file, "include/amd_comgr.h", and library, "lib/libamd_comgr.so"
	NOTE: check in the codes to unblock German's work for now, codes will be modified to handle HSAIL and LC paths dynamically.

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/build/Makefile.api#176 edit
... //depot/stg/opencl/drivers/opencl/opencldefs#235 edit
... //depot/stg/opencl/drivers/opencl/runtime/build/Makefile.runtime#76 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/devprogram.cpp#12 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/devprogram.hpp#8 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/build/Makefile.oclrocm#21 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdefs.hpp#20 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.cpp#94 edit
This commit is contained in:
foreman
2018-11-05 14:24:49 -05:00
parent de83580574
commit 9c877959f6
4 changed files with 729 additions and 28 deletions
+41 -1
View File
@@ -8,6 +8,9 @@
#include "platform/object.hpp"
#include "platform/memory.hpp"
#include "devwavelimiter.hpp"
#if defined(USE_COMGR_LIBRARY)
#include "amd_comgr.h"
#endif
#if defined(WITH_LIGHTNING_COMPILER)
#include "driver/AmdCompiler.h"
@@ -296,6 +299,43 @@ class Program : public amd::HeapObject {
//! Link the device program with HSAIL path
bool linkImplHSAIL(amd::option::Options* options);
#if defined(USE_COMGR_LIBRARY)
//! Dump the code object data
void extractByteCodeBinary(const amd_comgr_data_set_t inDataSet,
const amd_comgr_data_kind_t dataKind, const std::string& outFileName,
char* outBinary[] = nullptr, size_t* outSize = nullptr);
//! Set the OCL language and target triples with feature
void setLangAndTargetStr(const char* clStd, amd_comgr_language_t* oclver,
std::string& targetIdent);
//! Create code object and add it into the data set
amd_comgr_status_t addCodeObjData(const char *source,
const size_t size, const amd_comgr_data_kind_t type,
const char* name, amd_comgr_data_set_t* dataSet);
//! Create action for the specified language, target and options
amd_comgr_status_t createAction(const amd_comgr_language_t oclvar,
const std::string& targetIdent, const std::string& options,
amd_comgr_action_info_t* action);
//! Create the bitcode of the linked input dataset
bool linkLLVMBitcode(const amd_comgr_data_set_t inputs,
const std::string& options, const bool requiredDump,
amd::option::Options* amdOptions, amd_comgr_data_set_t* output,
char* binary[] = nullptr, size_t* binarySize = nullptr);
//! Create the bitcode of the compiled input dataset
bool compileToLLVMBitcode(const amd_comgr_data_set_t inputs,
const std::string& options, amd::option::Options* amdOptions,
char* binary[], size_t* binarySize);
//! Compile and create the excutable of the input dataset
bool compileAndLinkExecutable(const amd_comgr_data_set_t inputs,
const std::string& options, amd::option::Options* amdOptions,
char* executable[], size_t* executableSize);
#endif
//! Disable default copy constructor
Program(const Program&);
@@ -303,4 +343,4 @@ class Program : public amd::HeapObject {
Program& operator=(const Program&);
};
} // namespace device
} // namespace device