P4 to Git Change 2016080 by gandryey@gera-win10 on 2019/10/18 13:08:03
SWDEV-204511 - [NV14 XTM] OpenCL Conformance Test Fails
- Handle different ABI versions for LC and HSAIL if single context with multiple devices was used. LC changed the locaiton of hidden arguments and HSAIL path requires patching
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/devkernel.cpp#26 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palkernel.cpp#83 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palkernel.hpp#30 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/kernel.hpp#26 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/program.cpp#105 edit
[ROCm/clr commit: 50ad4d1a7f]
This commit is contained in:
@@ -1557,7 +1557,7 @@ void Kernel::InitParameters(const amd_comgr_metadata_node_t kernelMD) {
|
||||
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);
|
||||
createSignature(params, numParams, amd::KernelSignature::ABIVersion_2);
|
||||
}
|
||||
#else // not define USE_COMGR_LIBRARY
|
||||
void Kernel::InitParameters(const KernelMD& kernelMD, uint32_t argBufferSize) {
|
||||
@@ -1632,7 +1632,7 @@ void Kernel::InitParameters(const KernelMD& kernelMD, uint32_t argBufferSize) {
|
||||
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);
|
||||
createSignature(params, numParams, amd::KernelSignature::ABIVersion_2);
|
||||
}
|
||||
#endif // defined(USE_COMGR_LIBRARY)
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY)
|
||||
|
||||
@@ -273,9 +273,10 @@ const HSAILProgram& HSAILKernel::prog() const {
|
||||
|
||||
hsa_kernel_dispatch_packet_t* HSAILKernel::loadArguments(VirtualGPU& gpu, const amd::Kernel& kernel,
|
||||
const amd::NDRangeContainer& sizes,
|
||||
const_address parameters,
|
||||
const_address params,
|
||||
size_t ldsAddress, uint64_t vmDefQueue,
|
||||
uint64_t* vmParentWrap) const {
|
||||
const_address parameters = params;
|
||||
uint64_t argList;
|
||||
address aqlArgBuf = gpu.managedBuffer().reserve(
|
||||
argsBufferSize() + sizeof(hsa_kernel_dispatch_packet_t), &argList);
|
||||
@@ -289,7 +290,18 @@ hsa_kernel_dispatch_packet_t* HSAILKernel::loadArguments(VirtualGPU& gpu, const
|
||||
gpu.addVmMemory(gpu.cb(1)->ActiveMemory());
|
||||
}
|
||||
|
||||
const amd::KernelSignature& signature = kernel.signature();
|
||||
// The check below handles a special case of single context with multiple devices
|
||||
// when the devices use different compilers(HSAIL and LC) and have different signatures
|
||||
const amd::KernelSignature& signature =
|
||||
(this->signature().version() == kernel.signature().version()) ?
|
||||
kernel.signature() : this->signature();
|
||||
|
||||
// If signatures don't match, then patch the parameters
|
||||
if (signature.version() != kernel.signature().version()) {
|
||||
WriteAqlArgAt(aqlArgBuf, parameters, signature.paramsSize() - signature.at(0).offset_,
|
||||
signature.at(0).offset_);
|
||||
parameters = aqlArgBuf;
|
||||
}
|
||||
|
||||
// Check if runtime has to setup hidden arguments
|
||||
for (uint32_t i = signature.numParameters(); i < signature.numParametersAll(); ++i) {
|
||||
@@ -342,7 +354,10 @@ hsa_kernel_dispatch_packet_t* HSAILKernel::loadArguments(VirtualGPU& gpu, const
|
||||
}
|
||||
|
||||
// Load all kernel arguments
|
||||
WriteAqlArgAt(aqlArgBuf, parameters, argsBufferSize(), 0);
|
||||
if (signature.version() == kernel.signature().version()) {
|
||||
WriteAqlArgAt(aqlArgBuf, parameters, argsBufferSize(), 0);
|
||||
}
|
||||
|
||||
// Note: In a case of structs the size won't match,
|
||||
// since HSAIL compiler expects a reference...
|
||||
assert(argsBufferSize() <= signature.paramsSize() &&
|
||||
|
||||
@@ -81,7 +81,7 @@ class HSAILKernel : public device::Kernel {
|
||||
VirtualGPU& gpu, //!< Running GPU context
|
||||
const amd::Kernel& kernel, //!< AMD kernel object
|
||||
const amd::NDRangeContainer& sizes, //!< NDrange container
|
||||
const_address parameters, //!< Application arguments for the kernel
|
||||
const_address params, //!< Application arguments for the kernel
|
||||
size_t ldsAddress, //!< LDS address that includes all arguments.
|
||||
uint64_t vmDefQueue, //!< GPU VM default queue pointer
|
||||
uint64_t* vmParentWrap //!< GPU VM parent aql wrap object
|
||||
|
||||
@@ -48,7 +48,8 @@ class KernelSignature : public HeapObject {
|
||||
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
|
||||
ABIVersion_1 = 1, //! ABI constructed based on the HW ABI returned from HSAIL
|
||||
ABIVersion_2 = 2 //! ABI constructed based on the HW ABI returned from LC
|
||||
};
|
||||
|
||||
//! Default constructor
|
||||
@@ -110,12 +111,12 @@ class KernelParameters : protected HeapObject {
|
||||
std::vector<void*> execSvmPtr_; //!< The non argument svm pointers for kernel
|
||||
FGSStatus svmSystemPointersSupport_; //!< The flag for the status of the kernel
|
||||
// support of fine-grain system sharing.
|
||||
uint32_t memoryObjOffset_; //!< The offset of execInfo
|
||||
uint32_t samplerObjOffset_; //!< The offset of execInfo
|
||||
uint32_t queueObjOffset_; //!< The offset of execInfo
|
||||
amd::Memory** memoryObjects_; //!< The non argument svm pointers for kernel
|
||||
amd::Sampler** samplerObjects_; //!< The non argument svm pointers for kernel
|
||||
amd::DeviceQueue** queueObjects_; //!< The non argument svm pointers for kernel
|
||||
uint32_t memoryObjOffset_; //!< The number of memory objects
|
||||
uint32_t samplerObjOffset_; //!< The number of sampler objects
|
||||
uint32_t queueObjOffset_; //!< The number of queue objects
|
||||
amd::Memory** memoryObjects_; //!< Memory objects, associated with the kernel
|
||||
amd::Sampler** samplerObjects_; //!< Sampler objects, associated with the kernel
|
||||
amd::DeviceQueue** queueObjects_; //!< Queue objects, associated with the kernel
|
||||
|
||||
uint32_t totalSize_; //!< The total size of all captured parameters
|
||||
|
||||
|
||||
@@ -635,7 +635,8 @@ bool Program::ParseAllOptions(const std::string& options, option::Options& parse
|
||||
|
||||
bool Symbol::setDeviceKernel(const Device& device, const device::Kernel* func) {
|
||||
if (deviceKernels_.size() == 0 ||
|
||||
(func->signature().version() > KernelSignature::ABIVersion_0)) {
|
||||
// Always pick the most recent version in MGPU case
|
||||
(func->signature().version() > signature_.version())) {
|
||||
signature_ = func->signature();
|
||||
}
|
||||
deviceKernels_[&device] = func;
|
||||
|
||||
Reference in New Issue
Block a user