P4 to Git Change 1567428 by gandryey@gera-w8 on 2018/06/12 18:39:23

SWDEV-79445 - OCL generic changes and code clean-up
	- Optimize setup of kernel arguments. Stage 2.
	- Add HW ABI support in the abstraction layer
	- Remove arguments parsing loop from the kernel launch. Memory processing will be responsible for dependency tracking and  patching of arguments.

	http://ocltc.amd.com/reviews/r/15122/

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#221 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#307 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#325 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palblit.cpp#24 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palkernel.cpp#53 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palkernel.hpp#17 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palmemory.hpp#9 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.cpp#107 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.hpp#53 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.cpp#36 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/kernel.cpp#30 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/kernel.hpp#23 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/program.cpp#95 edit


[ROCm/clr commit: 1be400ff01]
This commit is contained in:
foreman
2018-06-12 18:57:20 -04:00
parent 028339d9be
commit 665aab7ca4
13 changed files with 430 additions and 320 deletions
@@ -243,13 +243,17 @@ void KernelParameters::release(address mem, const amd::Device& device) const {
}
KernelSignature::KernelSignature(const std::vector<KernelParameterDescriptor>& params,
const std::string& attrib)
const std::string& attrib,
const std::vector<KernelParameterDescriptor>& hiddenParams,
uint32_t version)
: params_(params)
, hiddenParams_(hiddenParams)
, attributes_(attrib)
, paramsSize_(0)
, numMemories_(0)
, numSamplers_(0)
, numQueues_(0) {
, numQueues_(0)
, version_(version) {
size_t maxOffset = 0;
size_t last = 0;
// Find the last entry
@@ -283,7 +287,15 @@ KernelSignature::KernelSignature(const std::vector<KernelParameterDescriptor>& p
if (lastSize == 0 /* local mem */) {
lastSize = sizeof(cl_mem);
}
paramsSize_ = params[last].offset_ + alignUp(lastSize, sizeof(intptr_t));
// Note: It's a special case. HW ABI expects 64 bit for SRD, regardless of the binary.
// Force the size to 64 bit for those cases.
if ((params[last].info_.oclObject_ == amd::KernelParameterDescriptor::ImageObject) ||
(params[last].info_.oclObject_ == amd::KernelParameterDescriptor::SamplerObject) ||
(params[last].info_.oclObject_ == amd::KernelParameterDescriptor::QueueObject)) {
lastSize = alignUp(lastSize, sizeof(uint64_t));
}
paramsSize_ = params[last].offset_ + lastSize;
paramsSize_ = alignUp(paramsSize_, sizeof(intptr_t));
}
}
} // namespace amd
@@ -36,18 +36,30 @@ class Program;
class KernelSignature : public HeapObject {
private:
std::vector<KernelParameterDescriptor> params_;
std::vector<KernelParameterDescriptor> hiddenParams_;
std::string attributes_; //!< The kernel attributes
uint32_t paramsSize_;
uint32_t numMemories_;
uint32_t numSamplers_;
uint32_t numQueues_;
uint32_t version_;
public:
enum {
ABIVersion_0 = 0, //! ABI constructed based on the OCL semantics
ABIVersion_1 = 1 //! ABI constructed based on the HW ABI returned from the compiler
};
//! Default constructor
KernelSignature() : paramsSize_(0), numMemories_(0), numSamplers_(0), numQueues_(0) {}
KernelSignature():
paramsSize_(0), numMemories_(0), numSamplers_(0),
numQueues_(0), version_(ABIVersion_0) {}
//! Construct a new signature.
KernelSignature(const std::vector<KernelParameterDescriptor>& params, const std::string& attrib);
KernelSignature(const std::vector<KernelParameterDescriptor>& params,
const std::string& attrib,
const std::vector<KernelParameterDescriptor>& hiddenParams,
uint32_t version);
//! Return the number of parameters
size_t numParameters() const { return params_.size(); }
@@ -72,8 +84,17 @@ class KernelSignature : public HeapObject {
//! Returns the number of queue objects.
uint32_t numQueues() const { return numQueues_; }
//! Returns the signature version
uint32_t version() const { return version_; }
//! Return the kernel attributes
const std::string& attributes() const { return attributes_; }
const std::vector<KernelParameterDescriptor>& hiddenParameters() const
{ return hiddenParams_; }
const std::vector<KernelParameterDescriptor>& parameters() const
{ return params_; }
};
// @todo: look into a copy-on-write model instead of copy-on-read.
@@ -604,8 +604,8 @@ bool Program::ParseAllOptions(const std::string& options, option::Options& parse
}
bool Symbol::setDeviceKernel(const Device& device, const device::Kernel* func) {
// FIXME_lmoriche: check that the signatures are compatible
if (deviceKernels_.size() == 0) {
if (deviceKernels_.size() == 0 ||
(func->signature().version() > KernelSignature::ABIVersion_0)) {
signature_ = func->signature();
}
deviceKernels_[&device] = func;