P4 to Git Change 1607675 by gandryey@gera-w8 on 2018/09/18 18:42:34
SWDEV-79445 - OCL generic changes and code clean-up
Program compilation clean-up. Step#1:
- Move device::Program implementation into a separate file
- Combine the common fields accros all 3 layers into the abstract device::Program
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#230 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#318 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/devprogram.cpp#1 add
... //depot/stg/opencl/drivers/opencl/runtime/device/devprogram.hpp#1 add
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpucompiler.cpp#159 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.cpp#241 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.hpp#73 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprogram.cpp#72 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprogram.hpp#29 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.cpp#125 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.cpp#86 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.hpp#35 edit
[ROCm/clr commit: 0253c1afb3]
Tento commit je obsažen v:
@@ -303,10 +303,17 @@ int NullProgram::compileBinaryToIL(amd::option::Options* options) {
|
||||
}
|
||||
|
||||
if (options->oVariables->BinBIF30) {
|
||||
if (!createBIFBinary(bin)) {
|
||||
acl_error err;
|
||||
char* binaryIn = nullptr;
|
||||
size_t size;
|
||||
err = aclWriteToMem(bin, reinterpret_cast<void**>(&binaryIn), &size);
|
||||
if (err != ACL_SUCCESS) {
|
||||
LogWarning("aclWriteToMem failed");
|
||||
aclBinaryFini(bin);
|
||||
return CL_BUILD_PROGRAM_FAILURE;
|
||||
}
|
||||
clBinary()->saveBIFBinary(binaryIn, size);
|
||||
aclFreeMem(bin, binaryIn);
|
||||
}
|
||||
|
||||
size_t len = 0;
|
||||
|
||||
@@ -1527,39 +1527,22 @@ bool Program::loadBinary(bool* hasRecompile) {
|
||||
|
||||
HSAILProgram::HSAILProgram(Device& device)
|
||||
: Program(device),
|
||||
llvmBinary_(),
|
||||
binaryElf_(NULL),
|
||||
rawBinary_(NULL),
|
||||
kernels_(NULL),
|
||||
maxScratchRegs_(0),
|
||||
isNull_(false),
|
||||
executable_(NULL),
|
||||
loaderContext_(this) {
|
||||
memset(&binOpts_, 0, sizeof(binOpts_));
|
||||
binOpts_.struct_size = sizeof(binOpts_);
|
||||
binOpts_.elfclass = LP64_SWITCH(ELFCLASS32, ELFCLASS64);
|
||||
binOpts_.bitness = ELFDATA2LSB;
|
||||
binOpts_.alloc = &::malloc;
|
||||
binOpts_.dealloc = &::free;
|
||||
loader_ = amd::hsa::loader::Loader::Create(&loaderContext_);
|
||||
}
|
||||
|
||||
HSAILProgram::HSAILProgram(NullDevice& device)
|
||||
: Program(device),
|
||||
llvmBinary_(),
|
||||
binaryElf_(NULL),
|
||||
rawBinary_(NULL),
|
||||
kernels_(NULL),
|
||||
maxScratchRegs_(0),
|
||||
isNull_(true),
|
||||
executable_(NULL),
|
||||
loaderContext_(this) {
|
||||
memset(&binOpts_, 0, sizeof(binOpts_));
|
||||
binOpts_.struct_size = sizeof(binOpts_);
|
||||
binOpts_.elfclass = LP64_SWITCH(ELFCLASS32, ELFCLASS64);
|
||||
binOpts_.bitness = ELFDATA2LSB;
|
||||
binOpts_.alloc = &::malloc;
|
||||
binOpts_.dealloc = &::free;
|
||||
isNull_ = true;
|
||||
loader_ = amd::hsa::loader::Loader::Create(&loaderContext_);
|
||||
}
|
||||
|
||||
|
||||
@@ -452,9 +452,6 @@ class HSAILProgram : public device::Program {
|
||||
//! Default destructor
|
||||
~HSAILProgram();
|
||||
|
||||
//! Returns the aclBinary associated with the progrm
|
||||
aclBinary* binaryElf() const { return static_cast<aclBinary*>(binaryElf_); }
|
||||
|
||||
void addGlobalStore(Memory* mem) { globalStores_.push_back(mem); }
|
||||
|
||||
const std::vector<Memory*>& globalStores() const { return globalStores_; }
|
||||
@@ -474,9 +471,6 @@ class HSAILProgram : public device::Program {
|
||||
//! Add internal static sampler
|
||||
void addSampler(Sampler* sampler) { staticSamplers_.push_back(sampler); }
|
||||
|
||||
//! Returns TRUE if the program just compiled
|
||||
bool isNull() const { return isNull_; }
|
||||
|
||||
//! Returns TRUE if the program contains static samplers
|
||||
bool isStaticSampler() const { return (staticSamplers_.size() != 0); }
|
||||
|
||||
@@ -539,18 +533,12 @@ class HSAILProgram : public device::Program {
|
||||
//! Allocate kernel table
|
||||
bool allocKernelTable();
|
||||
|
||||
std::string openCLSource_; //!< Original OpenCL source
|
||||
std::string HSAILProgram_; //!< FSAIL program after compilation
|
||||
std::string llvmBinary_; //!< LLVM IR binary code
|
||||
aclBinary* binaryElf_; //!< Binary for the new compiler library
|
||||
void* rawBinary_; //!< Pointer to the raw binary
|
||||
aclBinaryOptions binOpts_; //!< Binary options to create aclBinary
|
||||
std::vector<Memory*> globalStores_; //!< Global memory for the program
|
||||
Memory* kernels_; //!< Table with kernel object pointers
|
||||
uint
|
||||
maxScratchRegs_; //!< Maximum number of scratch regs used in the program by individual kernel
|
||||
std::list<Sampler*> staticSamplers_; //!< List od internal static samplers
|
||||
bool isNull_; //!< Null program no memory allocations
|
||||
amd::hsa::loader::Loader* loader_; //!< Loader object
|
||||
amd::hsa::loader::Executable* executable_; //!< Executable for HSA Loader
|
||||
ORCAHSALoaderContext loaderContext_; //!< Context for HSA Loader
|
||||
|
||||
Odkázat v novém úkolu
Zablokovat Uživatele