From e08ed959a997f347e1f2913c23052467c96d9e94 Mon Sep 17 00:00:00 2001
From: Abhishek Yenpure <abhishek.yenpure@hotmail.com>
Date: Tue, 9 Jan 2024 09:15:36 -0800
Subject: [PATCH] Fixes for VTK compilation with Intel icpx compiler

---
 Accelerators/Vtkm/Core/vtkmlib/vtkmDataArray.hxx |  4 ++--
 Accelerators/Vtkm/DataModel/vtkmDataSet.cxx      | 15 ++++++++++-----
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/Accelerators/Vtkm/Core/vtkmlib/vtkmDataArray.hxx b/Accelerators/Vtkm/Core/vtkmlib/vtkmDataArray.hxx
index 42afe17e124..505be152f45 100644
--- a/Accelerators/Vtkm/Core/vtkmlib/vtkmDataArray.hxx
+++ b/Accelerators/Vtkm/Core/vtkmlib/vtkmDataArray.hxx
@@ -334,7 +334,7 @@ template <typename ArrayHandleType>
 auto TransformForScalarRange(const ArrayHandleType& src,
   const vtkm::cont::ArrayHandle<vtkm::UInt8>& ghost, vtkm::UInt8 ghostValueToSkip, bool finitesOnly)
 {
-  DecoratorForScalarRanage decorator{ ghostValueToSkip, finitesOnly };
+  DecoratorForScalarRanage decorator{ DecoratorParameters{ ghostValueToSkip, finitesOnly } };
   return vtkm::cont::make_ArrayHandleDecorator(src.GetNumberOfValues(), decorator, src, ghost);
 }
 
@@ -342,7 +342,7 @@ template <typename ArrayHandleType>
 auto TransformForVectorRange(const ArrayHandleType& src,
   const vtkm::cont::ArrayHandle<vtkm::UInt8>& ghost, vtkm::UInt8 ghostValueToSkip, bool finitesOnly)
 {
-  DecoratorForVectorRanage decorator{ ghostValueToSkip, finitesOnly };
+  DecoratorForVectorRanage decorator{ DecoratorParameters{ ghostValueToSkip, finitesOnly } };
   return vtkm::cont::make_ArrayHandleDecorator(src.GetNumberOfValues(), decorator, src, ghost);
 }
 
diff --git a/Accelerators/Vtkm/DataModel/vtkmDataSet.cxx b/Accelerators/Vtkm/DataModel/vtkmDataSet.cxx
index e7df6914a15..324f910fd3d 100644
--- a/Accelerators/Vtkm/DataModel/vtkmDataSet.cxx
+++ b/Accelerators/Vtkm/DataModel/vtkmDataSet.cxx
@@ -220,14 +220,19 @@ struct WorkletGetPointCells : vtkm::worklet::WorkletVisitPointsWithCells
   {
   }
 
-  template <typename IndicesVecType>
-  VTKM_EXEC void operator()(vtkm::Id, IndicesVecType, vtkm::cont::DeviceAdapterTagCuda) const
+  template <typename IndicesVecType, typename Device>
+  VTKM_EXEC void operator()(vtkm::Id, IndicesVecType, Device) const
   {
+    this->RaiseError("This worklet should only be called on serial device");
   }
 
-  VTKM_SUPPRESS_EXEC_WARNINGS
-  template <typename IndicesVecType, typename Device>
-  VTKM_EXEC void operator()(vtkm::Id count, IndicesVecType idxs, Device) const
+  // This method is declared VTKM_CONT because we have set it to only
+  // run on the serial device (see the third argument). Declaring it
+  // as VTKM_CONT will prevent compiler warnings/errors about calling
+  // a host function from a device that can never happen.
+  template <typename IndicesVecType>
+  VTKM_CONT void operator()(
+    vtkm::Id count, IndicesVecType idxs, vtkm::cont::DeviceAdapterTagSerial) const
   {
     this->Output->SetNumberOfIds(count);
     for (vtkm::Id i = 0; i < count; ++i)
-- 
GitLab