Skip to content

Commit

Permalink
Fix the device used by KernelExecutionFixture (#2344)
Browse files Browse the repository at this point in the history
Fix KernelExecutionFixture to use the device associated to the queue, when a queue
is passed as argument, instead of always using the first device.

Note that, if the Platform is not stateless (e.g. with SYCL), the platform data
member is still wrong. However, there is no way to access the platform associated
to a device object.
Since the platform object will not be used, ignore this issue for the time being.
  • Loading branch information
fwyzard authored Aug 5, 2024
1 parent 2c386dc commit 4b7bd17
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions include/alpaka/test/KernelExecutionFixture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,20 @@ namespace alpaka::test
{
}

KernelExecutionFixture(Queue queue, WorkDiv workDiv) : m_queue{std::move(queue)}, m_workDiv{std::move(workDiv)}
KernelExecutionFixture(Queue queue, WorkDiv workDiv)
: m_platform{} // if the platform is not stateless, this is wrong; we ignore it because it is not be used
, m_device{alpaka::getDev(queue)}
, m_queue{std::move(queue)}
, m_workDiv{std::move(workDiv)}
{
}

template<typename TExtent>
KernelExecutionFixture(Queue queue, TExtent const& extent) : m_queue{std::move(queue)}
, m_extent{extent}
KernelExecutionFixture(Queue queue, TExtent const& extent)
: m_platform{} // if the platform is not stateless, this is wrong; we ignore it because it is not be used
, m_device{alpaka::getDev(queue)}
, m_queue{std::move(queue)}
, m_extent{extent}
{
}

Expand Down

0 comments on commit 4b7bd17

Please sign in to comment.