Fix an inappropriate use of virtual methods in an execution test

One of the execution tests, UnitTestScatterAndMaskWithTopology,
was defining a hierarchy of worklets that defined a virtual
operator(). It mostly still worked since the code was executed
with the final type and thus did not actually need to look up
the virtual table. However, some invalid memory access must have
been happening in CUDA since under some unpredictable circumstances
a memory protection error was happening.

This fixes the problem by removing the virtual methods.
This commit is contained in:
Kenneth Moreland 2020-03-24 11:42:08 -06:00
parent b54719b4e0
commit c0b7805435

@ -26,12 +26,6 @@ class TestWorkletMapTopo : public vtkm::worklet::WorkletVisitPointsWithCells
public:
using ControlSignature = void(CellSetIn topology, FieldInVisit pointCoords);
using ExecutionSignature = void(_2, WorkIndex, InputIndex, OutputIndex, VisitIndex);
virtual VTKM_EXEC void operator()(const vtkm::Vec<int, 3>& vtkmNotUsed(coords),
const vtkm::Id& workIndex,
const vtkm::Id& inputIndex,
const vtkm::Id& outputIndex,
const vtkm::Id& visitIndex) const = 0;
};
class TestWorkletMapTopoIdentity : public TestWorkletMapTopo
@ -43,7 +37,7 @@ public:
const vtkm::Id& workIndex,
const vtkm::Id& inputIndex,
const vtkm::Id& outputIndex,
const vtkm::Id& visitIndex) const override
const vtkm::Id& visitIndex) const
{
if (workIndex != inputIndex)
{
@ -69,7 +63,7 @@ public:
const vtkm::Id& workIndex,
const vtkm::Id& inputIndex,
const vtkm::Id& outputIndex,
const vtkm::Id& visitIndex) const override
const vtkm::Id& visitIndex) const
{
if ((workIndex / 2) != inputIndex)
{
@ -95,7 +89,7 @@ public:
const vtkm::Id& workIndex,
const vtkm::Id& inputIndex,
const vtkm::Id& outputIndex,
const vtkm::Id& visitIndex) const override
const vtkm::Id& visitIndex) const
{
if (workIndex != inputIndex)
{
@ -121,7 +115,7 @@ public:
const vtkm::Id& vtkmNotUsed(workIndex),
const vtkm::Id& vtkmNotUsed(inputIndex),
const vtkm::Id& vtkmNotUsed(outputIndex),
const vtkm::Id& vtkmNotUsed(visitIndex)) const override
const vtkm::Id& vtkmNotUsed(visitIndex)) const
{
// This method should never be called
this->RaiseError("An element was selected, this test selects none.");