From c0b7805435debe1c35b0b01af9717e66f0c6b942 Mon Sep 17 00:00:00 2001 From: Kenneth Moreland Date: Tue, 24 Mar 2020 11:42:08 -0600 Subject: [PATCH] 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. --- .../testing/UnitTestScatterAndMaskWithTopology.cxx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/vtkm/worklet/testing/UnitTestScatterAndMaskWithTopology.cxx b/vtkm/worklet/testing/UnitTestScatterAndMaskWithTopology.cxx index dd49fa072..70c76f94c 100644 --- a/vtkm/worklet/testing/UnitTestScatterAndMaskWithTopology.cxx +++ b/vtkm/worklet/testing/UnitTestScatterAndMaskWithTopology.cxx @@ -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& 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.");