-
Notifications
You must be signed in to change notification settings - Fork 75
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
remove KernelBundle
, change signature of [get|is]ValidWorkDiv*
#2349
Changes from 2 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 | ||||
---|---|---|---|---|---|---|
|
@@ -118,7 +118,7 @@ auto example(TAccTag const&) -> int | |||||
using Data = std::uint32_t; | ||||||
constexpr Idx nElementsPerDim = 2; | ||||||
|
||||||
const Vec extents(Vec::all(static_cast<Idx>(nElementsPerDim))); | ||||||
Vec const extents(Vec::all(static_cast<Idx>(nElementsPerDim))); | ||||||
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.
Suggested change
since |
||||||
|
||||||
// Allocate host memory buffers | ||||||
// | ||||||
|
@@ -164,9 +164,8 @@ auto example(TAccTag const&) -> int | |||||
|
||||||
FillBufferKernel fillBufferKernel; | ||||||
|
||||||
auto const& bundeledFillBufferKernel = alpaka::KernelBundle(fillBufferKernel, hostViewPlainPtrMdSpan); | ||||||
auto const hostWorkDiv | ||||||
= alpaka::getValidWorkDivForKernel<Host>(devHost, bundeledFillBufferKernel, threadsPerGrid, elementsPerThread); | ||||||
alpaka::KernelCfg<Host> const hostKernelCfg = {threadsPerGrid, elementsPerThread}; | ||||||
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.
Suggested change
? 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. The same comment applies to the other examples. |
||||||
auto const hostWorkDiv = alpaka::getValidWorkDiv(hostKernelCfg, devHost, fillBufferKernel, hostViewPlainPtrMdSpan); | ||||||
|
||||||
alpaka::exec<Host>(hostQueue, hostWorkDiv, fillBufferKernel, | ||||||
hostViewPlainPtrMdSpan); // 1st kernel argument | ||||||
|
@@ -203,11 +202,10 @@ auto example(TAccTag const&) -> int | |||||
auto deviceBufferMdSpan2 = alpaka::experimental::getMdSpan(deviceBuffer2); | ||||||
|
||||||
TestBufferKernel testBufferKernel; | ||||||
auto const& bundeledTestBufferKernel = alpaka::KernelBundle(testBufferKernel, deviceBufferMdSpan1); | ||||||
|
||||||
// Let alpaka calculate good block and grid sizes given our full problem extent | ||||||
auto const devWorkDiv | ||||||
= alpaka::getValidWorkDivForKernel<Acc>(devAcc, bundeledTestBufferKernel, threadsPerGrid, elementsPerThread); | ||||||
alpaka::KernelCfg<Acc> const devKernelCfg = {threadsPerGrid, elementsPerThread}; | ||||||
auto const devWorkDiv = alpaka::getValidWorkDiv(devKernelCfg, devAcc, testBufferKernel, deviceBufferMdSpan1); | ||||||
|
||||||
alpaka::exec<Acc>(devQueue, devWorkDiv, testBufferKernel, deviceBufferMdSpan1); | ||||||
alpaka::exec<Acc>(devQueue, devWorkDiv, testBufferKernel, deviceBufferMdSpan2); | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -265,7 +265,7 @@ auto example(TAccTag const&) -> int | |
alpaka::wait(queueAcc); | ||
|
||
// Calculate the allocated width, due to padding it might be larger then the matrix width | ||
auto const intputWidthAllocated = [&]() -> const Idx | ||
auto const intputWidthAllocated = [&]() -> Idx const | ||
{ | ||
// Calculate pitch: The size of one line in bytes including padding. | ||
auto const rowPitchInput{alpaka::getPitchesInBytes(bufInputAcc)[0]}; | ||
|
@@ -294,7 +294,7 @@ auto example(TAccTag const&) -> int | |
alpaka::wait(queueAcc); | ||
|
||
// Calculate the allocated width, due to padding it might be larger then the matrix width | ||
auto const filterWidthAllocated = [&]() -> const Idx | ||
auto const filterWidthAllocated = [&]() -> Idx const | ||
{ | ||
// Calculate pitch: The size of one line in bytes including padding. | ||
auto const rowPitchFilter{alpaka::getPitchesInBytes(bufFilterAcc)[0]}; | ||
|
@@ -305,20 +305,22 @@ auto example(TAccTag const&) -> int | |
// ConvolutionKernel2DSharedMemory | ||
ConvolutionKernel2DSharedMemory convolutionKernel2D; | ||
|
||
auto const& bundeledKernel = alpaka::KernelBundle( | ||
alpaka::KernelCfg<DevAcc> kernelCfg = {extent, Vec::ones()}; | ||
|
||
// Let alpaka calculate good block and grid sizes given our full problem extent. | ||
auto const workDiv = alpaka::getValidWorkDiv( | ||
kernelCfg, | ||
devAcc, | ||
convolutionKernel2D, | ||
alpaka::getPtrNative(bufInputAcc), | ||
alpaka::getPtrNative(outputDeviceMemory), | ||
std::data(bufInputAcc), | ||
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.
|
||
std::data(outputDeviceMemory), | ||
matrixWidth, | ||
matrixHeight, | ||
alpaka::getPtrNative(bufFilterAcc), | ||
std::data(bufFilterAcc), | ||
filterWidth, | ||
intputWidthAllocated, | ||
filterWidthAllocated); | ||
|
||
// Let alpaka calculate good block and grid sizes given our full problem extent. | ||
auto const workDiv = alpaka::getValidWorkDivForKernel<DevAcc>(devAcc, bundeledKernel, extent, Vec::ones()); | ||
|
||
// Run the kernel | ||
alpaka::exec<DevAcc>( | ||
queueAcc, | ||
|
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.
This should be something like
globalElementsExtent
rather thanglobalThreadExtent
, because the number of elements per thread are also taken into account.