Repository navigation
GPU Metal: run the second step of the border merging on the host #16217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,8 @@ | |
|
|
||
| /// \file GPUReconstructionMetalKernelsSpecialize.inc | ||
|
|
||
| #include <chrono> | ||
|
|
||
| template <> | ||
| inline void GPUReconstructionMetal::runKernelBackend<GPUMemClean16, 0>(const krnlSetupTime& _xyz, void* const& ptr, uint64_t const& size) | ||
| { | ||
|
|
@@ -30,3 +32,21 @@ inline void GPUReconstructionMetal::runKernelBackend<GPUMemClean16, 0>(const krn | |
| RecordMarker(_xyz.z.ev, _xyz.x.stream); | ||
| } | ||
| } | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just out of curiosity, why can't you use the HostOnDeviceMemory for this like for all the sorting?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No particular reason, just historical of how the patch came to be. |
||
| // Kernels that are a long serial chain per GPU thread, with little parallelism, | ||
| // run on the host instead, with the CPU code, on the memory shared with the | ||
| // host, as the sorts do with UNIFIED_MEM_SORT_ON_HOST. | ||
| template <class T, int32_t I, typename... Args> | ||
| inline void GPUReconstructionMetal::RunOnHost(const krnlSetupTime& _xyz, uint32_t nBlocks, const Args&... args) | ||
| { | ||
| const auto start = std::chrono::steady_clock::now(); | ||
| krnlSetupArgs<T, I, Args...> argPack{{}, {{{nBlocks, 1, _xyz.x.stream, krnlDeviceType::HostOnDeviceMemory, _xyz.x.step}, _xyz.y, _xyz.z}, _xyz.t}, {args...}}; | ||
| runKernelOnHost(GetKernelNum<T, I>(), &argPack); | ||
| _xyz.t = std::chrono::duration<double>(std::chrono::steady_clock::now() - start).count(); | ||
| } | ||
|
|
||
| template <> | ||
| inline void GPUReconstructionMetal::runKernelBackend<GPUTPCGMMergerMergeBorders, 2>(const krnlSetupTime& _xyz, int32_t const& iSector, uint8_t const& mergeMode) | ||
| { | ||
| RunOnHost<GPUTPCGMMergerMergeBorders, 2>(_xyz, 1, iSector, mergeMode); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not like that this converts a const ptr to a non-const ptr. If you need only 1 version, input and output should have the same constness. Otherwise, please provide 2 overloads.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect it's the usual address-space-part-of-the-type issue. I'll let you know.