P4 to Git Change 1567935 by gandryey@gera-w8 on 2018/06/13 16:49:10
SWDEV-79445 - OCL generic changes and code clean-up - Remove array of hidden parameters. Hidden parameters will be placed together with OCL kernel arguments. http://ocltc.amd.com/reviews/r/15178/ Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#222 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#308 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#326 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palkernel.cpp#55 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.cpp#37 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/kernel.cpp#33 edit
Цей коміт міститься в:
@@ -601,7 +601,7 @@ Settings::Settings() {
|
||||
}
|
||||
|
||||
bool Kernel::createSignature(
|
||||
const parameters_t& params, const parameters_t& hiddenParams,
|
||||
const parameters_t& params, uint32_t numParameters,
|
||||
uint32_t version) {
|
||||
std::stringstream attribs;
|
||||
if (workGroupInfo_.compileSize_[0] != 0) {
|
||||
@@ -634,7 +634,7 @@ bool Kernel::createSignature(
|
||||
// Destroy old signature if it was allocated before
|
||||
// (offline devices path)
|
||||
delete signature_;
|
||||
signature_ = new amd::KernelSignature(params, attribs.str(), hiddenParams, version);
|
||||
signature_ = new amd::KernelSignature(params, attribs.str(), numParameters, version);
|
||||
if (NULL != signature_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -853,7 +853,7 @@ class Kernel : public amd::HeapObject {
|
||||
|
||||
//! Initializes the kernel parameters for the abstraction layer
|
||||
bool createSignature(
|
||||
const parameters_t& params, const parameters_t& hiddenParams,
|
||||
const parameters_t& params, uint32_t numParameters,
|
||||
uint32_t version);
|
||||
|
||||
//! Returns TRUE if it's a HSA kernel
|
||||
|
||||
@@ -752,8 +752,7 @@ bool NullKernel::create(const std::string& code, const std::string& metadata,
|
||||
workGroupInfo_.usedStackSize_ = calFuncInfo.stackSizeUsed;
|
||||
|
||||
device::Kernel::parameters_t params;
|
||||
device::Kernel::parameters_t hiddenParams;
|
||||
if (!createSignature(params, hiddenParams, amd::KernelSignature::ABIVersion_0)) {
|
||||
if (!createSignature(params, params.size(), amd::KernelSignature::ABIVersion_0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1338,8 +1337,7 @@ bool Kernel::initParameters() {
|
||||
workGroupInfo_.localMemSize_ = hwLocalSize_;
|
||||
}
|
||||
|
||||
device::Kernel::parameters_t hiddenParams;
|
||||
if (!createSignature(params, hiddenParams, amd::KernelSignature::ABIVersion_0)) {
|
||||
if (!createSignature(params, params.size(), amd::KernelSignature::ABIVersion_0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3019,8 +3017,7 @@ void HSAILKernel::initArgList(const aclArgData* aclArg) {
|
||||
}
|
||||
}
|
||||
|
||||
device::Kernel::parameters_t hiddenParams;
|
||||
createSignature(params, hiddenParams, amd::KernelSignature::ABIVersion_0);
|
||||
createSignature(params, params.size(), amd::KernelSignature::ABIVersion_0);
|
||||
}
|
||||
|
||||
void HSAILKernel::initHsailArgs(const aclArgData* aclArg) {
|
||||
|
||||
@@ -529,8 +529,11 @@ void HSAILKernel::initArgList(const aclArgData* aclArg) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
createSignature(params, hiddenParams, amd::KernelSignature::ABIVersion_1);
|
||||
// Save the number of OCL arguments
|
||||
uint32_t numParams = params.size();
|
||||
// Append the hidden arguments to the OCL arguments
|
||||
params.insert(params.end(), hiddenParams.begin(), hiddenParams.end());
|
||||
createSignature(params, numParams, amd::KernelSignature::ABIVersion_1);
|
||||
}
|
||||
|
||||
void HSAILKernel::initHsailArgs(const aclArgData* aclArg) {
|
||||
@@ -954,7 +957,8 @@ hsa_kernel_dispatch_packet_t* HSAILKernel::loadArguments(
|
||||
const amd::KernelSignature& signature = kernel.signature();
|
||||
|
||||
// Check if runtime has to setup hidden arguments
|
||||
for (const auto& it : signature.hiddenParameters()) {
|
||||
for (uint32_t i = signature.numParameters(); i < signature.numParametersAll(); ++i) {
|
||||
const auto it = signature.at(i);
|
||||
size_t offset;
|
||||
switch (it.info_.oclObject_) {
|
||||
case amd::KernelParameterDescriptor::HiddenNone:
|
||||
@@ -1387,10 +1391,19 @@ void LightningKernel::initArgList(const KernelMD& kernelMD) {
|
||||
// Update read only flag
|
||||
desc.info_.readOnly_ = (arguments_[i]->access_ == HSAIL_ACCESS_TYPE_RO) ? true : false;
|
||||
|
||||
if (arguments_[i]->type_ == HSAIL_ARGTYPE_IMAGE) {
|
||||
flags_.imageEna_ = true;
|
||||
if (desc.accessQualifier_ != CL_KERNEL_ARG_ACCESS_READ_ONLY) {
|
||||
flags_.imageWriteEna_ = true;
|
||||
}
|
||||
}
|
||||
params.push_back(desc);
|
||||
}
|
||||
|
||||
createSignature(params, hiddenParams, amd::KernelSignature::ABIVersion_1);
|
||||
// Save the number of OCL arguments
|
||||
uint32_t numParams = params.size();
|
||||
// Append the hidden arguments to the OCL arguments
|
||||
params.insert(params.end(), hiddenParams.begin(), hiddenParams.end());
|
||||
createSignature(params, numParams, amd::KernelSignature::ABIVersion_1);
|
||||
}
|
||||
|
||||
static const KernelMD* FindKernelMetadata(const CodeObjectMD* programMD, const std::string& name) {
|
||||
|
||||
@@ -581,8 +581,7 @@ void HSAILKernel::initArguments(const aclArgData* aclArg) {
|
||||
|
||||
params.push_back(desc);
|
||||
}
|
||||
device::Kernel::parameters_t hiddenParams;
|
||||
createSignature(params, hiddenParams, amd::KernelSignature::ABIVersion_0);
|
||||
createSignature(params, params.size(), amd::KernelSignature::ABIVersion_0);
|
||||
}
|
||||
#endif // defined(WITH_COMPILER_LIB)
|
||||
|
||||
@@ -661,8 +660,7 @@ void LightningKernel::initArguments(const KernelMD& kernelMD) {
|
||||
|
||||
params.push_back(desc);
|
||||
}
|
||||
device::Kernel::parameters_t hiddenParams;
|
||||
createSignature(params, hiddenParams, amd::KernelSignature::ABIVersion_0);
|
||||
createSignature(params, params.size(), amd::KernelSignature::ABIVersion_0);
|
||||
}
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
|
||||
@@ -244,11 +244,11 @@ void KernelParameters::release(address mem, const amd::Device& device) const {
|
||||
|
||||
KernelSignature::KernelSignature(const std::vector<KernelParameterDescriptor>& params,
|
||||
const std::string& attrib,
|
||||
const std::vector<KernelParameterDescriptor>& hiddenParams,
|
||||
uint32_t version)
|
||||
uint32_t numParameters,
|
||||
uint32_t version)
|
||||
: params_(params)
|
||||
, hiddenParams_(hiddenParams)
|
||||
, attributes_(attrib)
|
||||
, numParameters_(numParameters)
|
||||
, paramsSize_(0)
|
||||
, numMemories_(0)
|
||||
, numSamplers_(0)
|
||||
@@ -298,15 +298,5 @@ KernelSignature::KernelSignature(const std::vector<KernelParameterDescriptor>& p
|
||||
// 16 bytes is the current HW alignment for the arguments
|
||||
paramsSize_ = alignUp(paramsSize_, 16);
|
||||
}
|
||||
|
||||
if (hiddenParams.size() > 0) {
|
||||
uint32_t lastArg = hiddenParams.size() - 1;
|
||||
// Check if it's LC path and the hidden arguments are placed at the end
|
||||
if (hiddenParams[lastArg].offset_ >= paramsSize_) {
|
||||
paramsSize_ = hiddenParams[lastArg].offset_ + hiddenParams[lastArg].size_;
|
||||
// 16 bytes is the current HW alignment for the arguments
|
||||
paramsSize_ = alignUp(paramsSize_, 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace amd
|
||||
|
||||
Посилання в новій задачі
Заблокувати користувача