P4 to Git Change 1708210 by jatang@jatang_win_pal_lc on 2018/11/16 11:48:47
SWDEV-169078 - Also copy private_segment_size/group_segment_size to runtime handle.
The library need these info to setup child kernel's AQL for device enqueue.
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/devkernel.hpp#6 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palkernel.cpp#69 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palkernel.hpp#26 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.cpp#44 edit
[ROCm/clr commit: dcf21ab5e6]
This commit is contained in:
@@ -17,6 +17,14 @@ namespace llvm {
|
||||
struct Metadata;
|
||||
}}}}
|
||||
typedef llvm::AMDGPU::HSAMD::Kernel::Metadata KernelMD;
|
||||
|
||||
//! Runtime handle structure for device enqueue
|
||||
struct RuntimeHandle {
|
||||
uint64_t kernel_handle; //!< Pointer to amd_kernel_code_s or kernel_descriptor_t
|
||||
uint32_t private_segment_size; //!< From PRIVATE_SEGMENT_FIXED_SIZE
|
||||
uint32_t group_segment_size; //!< From GROUP_SEGMENT_FIXED_SIZE
|
||||
};
|
||||
|
||||
#endif // defined(WITH_LIGHTNING_COMPILER)
|
||||
|
||||
namespace amd {
|
||||
@@ -262,4 +270,4 @@ class Kernel : public amd::HeapObject {
|
||||
std::unordered_map<size_t, size_t> patchReferences_; //!< Patch table for references
|
||||
};
|
||||
|
||||
} // namespace device
|
||||
} // namespace device
|
||||
|
||||
@@ -439,10 +439,15 @@ bool LightningKernel::init(amd::hsa::loader::Symbol* symbol) {
|
||||
// Copy the kernel_object pointer to the runtime handle symbol GPU address
|
||||
const Memory& codeSegGpu = prog_.codeSegGpu();
|
||||
uint64_t offset = symbol_address - codeSegGpu.vmAddress();
|
||||
uint64_t kernel_object = gpuAqlCode();
|
||||
VirtualGPU* gpu = codeSegGpu.dev().xferQueue();
|
||||
|
||||
codeSegGpu.writeRawData(*gpu, offset, 8, &kernel_object, true);
|
||||
const struct RuntimeHandle runtime_handle = {
|
||||
gpuAqlCode(),
|
||||
spillSegSize(),
|
||||
ldsSize()
|
||||
};
|
||||
|
||||
codeSegGpu.writeRawData(*gpu, offset, sizeof(runtime_handle), &runtime_handle, true);
|
||||
}
|
||||
|
||||
// Copy wavefront size
|
||||
|
||||
@@ -74,7 +74,7 @@ class HSAILKernel : public device::Kernel {
|
||||
size_t argsBufferSize() const { return akc_.kernarg_segment_byte_size; }
|
||||
|
||||
//! Returns spill reg size per workitem
|
||||
int spillSegSize() const { return amd::alignUp(akc_.workitem_private_segment_byte_size, sizeof(uint32_t)); }
|
||||
uint32_t spillSegSize() const { return amd::alignUp(akc_.workitem_private_segment_byte_size, sizeof(uint32_t)); }
|
||||
|
||||
//! Returns AQL packet in CPU memory
|
||||
//! if the kernel arguments were successfully loaded, otherwise NULL
|
||||
|
||||
@@ -109,7 +109,13 @@ bool LightningKernel::init() {
|
||||
return false;
|
||||
}
|
||||
|
||||
status = hsa_memory_copy(reinterpret_cast<void*>(variable_address), &kernelCodeHandle_, variable_size);
|
||||
const struct RuntimeHandle runtime_handle = {
|
||||
kernelCodeHandle_,
|
||||
workitemPrivateSegmentByteSize(),
|
||||
WorkgroupGroupSegmentByteSize()
|
||||
};
|
||||
|
||||
status = hsa_memory_copy(reinterpret_cast<void*>(variable_address), &runtime_handle, variable_size);
|
||||
if (status != HSA_STATUS_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user