Merge topic 'atomic-array-device-execution'

96ae94420 Simplified execution object creation for atomic array
0bd197af9 moved TwoLevelUniformGridExecutionObject to vtkm/exec/internal
6ce895be8 simplified how atomic arrays create execution objects
f1ee5b92a fix a rebase error
25d140361 fix bad rabse for wireframer
f892695f1 fixing so wierd merging issue
9bb00ec66 moved the execution object for TwoLevelUniform grid to vrkm::exec
db1c9bfee Change the namespacing of atomic array
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !1243
This commit is contained in:
Kenneth Moreland 2018-07-18 22:07:40 +00:00 committed by Kitware Robot
commit b4bfb95131
14 changed files with 219 additions and 101 deletions

@ -17,17 +17,18 @@
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#ifndef vtk_m_exec_AtomicArray_h
#define vtk_m_exec_AtomicArray_h
#ifndef vtk_m_cont_AtomicArray_h
#define vtk_m_cont_AtomicArray_h
#include <vtkm/ListTag.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/ExecutionObjectBase.h>
#include <vtkm/exec/AtomicArrayExecutionObject.h>
namespace vtkm
{
namespace exec
namespace cont
{
/// \brief A type list containing types that can be used with an AtomicArray.
@ -36,6 +37,7 @@ struct AtomicArrayTypeListTag : vtkm::ListTagBase<vtkm::Int32, vtkm::Int64>
{
};
/// A class that can be used to atomically operate on an array of values safely
/// across multiple instances of the same worklet. This is useful when you have
/// an algorithm that needs to accumulate values in parallel, but writing out a
@ -50,47 +52,33 @@ struct AtomicArrayTypeListTag : vtkm::ListTagBase<vtkm::Int32, vtkm::Int64>
/// Supported Types: 32 / 64 bit signed integers
///
///
template <typename T, typename DeviceAdapterTag>
template <typename T>
class AtomicArray : public vtkm::cont::ExecutionObjectBase
{
public:
using ValueType = T;
template <typename Device>
VTKM_CONT vtkm::exec::AtomicArrayExecutionObject<T, Device> PrepareForExecution(Device) const
{
return vtkm::exec::AtomicArrayExecutionObject<T, Device>(this->Handle);
}
VTKM_CONT
AtomicArray()
: AtomicImplementation((vtkm::cont::ArrayHandle<T>()))
: Handle(vtkm::cont::ArrayHandle<T>())
{
}
template <typename StorageType>
VTKM_CONT AtomicArray(vtkm::cont::ArrayHandle<T, StorageType> handle)
: AtomicImplementation(handle)
: Handle(handle)
{
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
T Add(vtkm::Id index, const T& value) const
{
return this->AtomicImplementation.Add(index, value);
}
//
// Compare and Swap is an atomic exchange operation. If the value at
// the index is equal to oldValue, then newValue is written to the index.
// The operation was successful if return value is equal to oldValue
//
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
T CompareAndSwap(vtkm::Id index, const T& newValue, const T& oldValue) const
{
return this->AtomicImplementation.CompareAndSwap(index, newValue, oldValue);
}
private:
vtkm::cont::DeviceAdapterAtomicArrayImplementation<T, DeviceAdapterTag> AtomicImplementation;
vtkm::cont::ArrayHandle<T> Handle;
};
}
} // namespace vtkm::exec
#endif //vtk_m_exec_AtomicArray_h
#endif //vtk_m_cont_AtomicArray_h

@ -46,6 +46,7 @@ set(headers
ArrayHandleConcatenate.h
ArrayRangeCompute.h
AssignerMultiBlock.h
AtomicArray.h
BoundingIntervalHierarchyNode.h
BoundingIntervalHierarchy.h
BoundsCompute.h

@ -26,6 +26,7 @@
#include <vtkm/cont/CoordinateSystem.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/DynamicCellSet.h>
#include <vtkm/exec/internal/TwoLevelUniformGridExecutionObject.h>
#include <vtkm/exec/CellInside.h>
#include <vtkm/exec/ParametricCoordinates.h>
@ -121,13 +122,6 @@ private:
FloatVec3 Max;
};
struct Grid
{
DimVec3 Dimensions;
FloatVec3 Origin;
FloatVec3 BinSize;
};
VTKM_EXEC_CONT static DimVec3 ComputeGridDimension(vtkm::Id numberOfCells,
const FloatVec3& size,
vtkm::FloatDefault density)
@ -157,7 +151,10 @@ private:
return idx[0] + (dim[0] * (idx[1] + (dim[1] * idx[2])));
}
VTKM_EXEC static Grid ComputeLeafGrid(const DimVec3& idx, const DimVec3& dim, const Grid& l1Grid)
VTKM_EXEC static vtkm::exec::twolevelgrid::Grid ComputeLeafGrid(
const DimVec3& idx,
const DimVec3& dim,
const vtkm::exec::twolevelgrid::Grid& l1Grid)
{
return { dim,
l1Grid.Origin + (static_cast<FloatVec3>(idx) * l1Grid.BinSize),
@ -180,7 +177,8 @@ private:
return { FloatVec3(minp), FloatVec3(maxp) };
}
VTKM_EXEC static BinsBBox ComputeIntersectingBins(const Bounds cellBounds, const Grid& grid)
VTKM_EXEC static BinsBBox ComputeIntersectingBins(const Bounds cellBounds,
const vtkm::exec::twolevelgrid::Grid& grid)
{
auto minb = static_cast<DimVec3>((cellBounds.Min - grid.Origin) / grid.BinSize);
auto maxb = static_cast<DimVec3>((cellBounds.Max - grid.Origin) / grid.BinSize);
@ -287,7 +285,7 @@ public:
FieldOutCell<IdType> bincount);
using ExecutionSignature = void(_2, _3);
CountBinsL1(const Grid& grid)
CountBinsL1(const vtkm::exec::twolevelgrid::Grid& grid)
: L1Grid(grid)
{
}
@ -301,7 +299,7 @@ public:
}
private:
Grid L1Grid;
vtkm::exec::twolevelgrid::Grid L1Grid;
};
class FindBinsL1 : public vtkm::worklet::WorkletMapPointToCell
@ -313,7 +311,7 @@ public:
WholeArrayOut<IdType> binIds);
using ExecutionSignature = void(_2, _3, _4);
FindBinsL1(const Grid& grid)
FindBinsL1(const vtkm::exec::twolevelgrid::Grid& grid)
: L1Grid(grid)
{
}
@ -334,7 +332,7 @@ public:
}
private:
Grid L1Grid;
vtkm::exec::twolevelgrid::Grid L1Grid;
};
class GenerateBinsL1 : public vtkm::worklet::WorkletMapField
@ -375,7 +373,7 @@ public:
FieldOutCell<IdType> bincount);
using ExecutionSignature = void(_2, _3, _4);
CountBinsL2(const Grid& grid)
CountBinsL2(const vtkm::exec::twolevelgrid::Grid& grid)
: L1Grid(grid)
{
}
@ -391,14 +389,15 @@ public:
numBins = 0;
for (BBoxIterator i(binsBBox, this->L1Grid.Dimensions); !i.Done(); i.Next())
{
Grid leaf = ComputeLeafGrid(i.GetIdx(), binDimensions.Get(i.GetFlatIdx()), this->L1Grid);
vtkm::exec::twolevelgrid::Grid leaf =
ComputeLeafGrid(i.GetIdx(), binDimensions.Get(i.GetFlatIdx()), this->L1Grid);
auto binsBBoxL2 = ComputeIntersectingBins(cellBounds, leaf);
numBins += GetNumberOfBins(binsBBoxL2);
}
}
private:
Grid L1Grid;
vtkm::exec::twolevelgrid::Grid L1Grid;
};
class FindBinsL2 : public vtkm::worklet::WorkletMapPointToCell
@ -413,7 +412,7 @@ public:
WholeArrayOut<IdType> cellIds);
using ExecutionSignature = void(InputIndex, _2, _3, _4, _5, _6, _7);
FindBinsL2(const Grid& grid)
FindBinsL2(const vtkm::exec::twolevelgrid::Grid& grid)
: L1Grid(grid)
{
}
@ -436,7 +435,8 @@ public:
for (BBoxIterator i(binsBBox, this->L1Grid.Dimensions); !i.Done(); i.Next())
{
Grid leaf = ComputeLeafGrid(i.GetIdx(), binDimensions.Get(i.GetFlatIdx()), this->L1Grid);
vtkm::exec::twolevelgrid::Grid leaf =
ComputeLeafGrid(i.GetIdx(), binDimensions.Get(i.GetFlatIdx()), this->L1Grid);
auto binsBBoxL2 = ComputeIntersectingBins(cellBounds, leaf);
vtkm::Id leafStart = binStarts.Get(i.GetFlatIdx());
@ -450,7 +450,7 @@ public:
}
private:
Grid L1Grid;
vtkm::exec::twolevelgrid::Grid L1Grid;
};
class GenerateBinsL2 : public vtkm::worklet::WorkletMapField
@ -491,7 +491,7 @@ public:
auto cellset = this->CellSet.ResetCellSetList(cellSetTypes);
const auto& coords = this->Coordinates;
TwoLevelUniformGridExecutionObjectFactory ls;
TwoLevelUniformGrid ls;
// 1: Compute the top level grid
auto bounds = this->Coordinates.GetBounds();
@ -593,30 +593,13 @@ public:
std::swap(this->LookupStructure, ls);
}
template <typename Device>
struct TwoLevelUniformGridExecution
{
template <typename T>
using ArrayPortalConst =
typename vtkm::cont::ArrayHandle<T>::template ExecutionTypes<Device>::PortalConst;
Grid TopLevel;
ArrayPortalConst<DimVec3> LeafDimensions;
ArrayPortalConst<vtkm::Id> LeafStartIndex;
ArrayPortalConst<vtkm::Id> CellStartIndex;
ArrayPortalConst<vtkm::Id> CellCount;
ArrayPortalConst<vtkm::Id> CellIds;
};
struct TwoLevelUniformGridExecutionObjectFactory : public vtkm::cont::ExecutionObjectBase
struct TwoLevelUniformGrid : public vtkm::cont::ExecutionObjectBase
{
template <typename DeviceAdapter>
VTKM_CONT TwoLevelUniformGridExecution<DeviceAdapter> PrepareForExecution(
DeviceAdapter device) const
VTKM_CONT vtkm::exec::twolevelgrid::TwoLevelUniformGridExecutionObject<DeviceAdapter>
PrepareForExecution(DeviceAdapter device) const
{
TwoLevelUniformGridExecution<DeviceAdapter> deviceObject;
vtkm::exec::twolevelgrid::TwoLevelUniformGridExecutionObject<DeviceAdapter> deviceObject;
deviceObject.TopLevel = this->TopLevel;
deviceObject.LeafDimensions = this->LeafDimensions.PrepareForInput(device);
deviceObject.LeafStartIndex = this->LeafStartIndex.PrepareForInput(device);
@ -626,7 +609,7 @@ public:
return deviceObject;
}
Grid TopLevel;
vtkm::exec::twolevelgrid::Grid TopLevel;
vtkm::cont::ArrayHandle<DimVec3> LeafDimensions;
vtkm::cont::ArrayHandle<vtkm::Id> LeafStartIndex;
@ -665,7 +648,7 @@ public:
static_cast<FloatDefault>(point[1]),
static_cast<FloatDefault>(point[2]));
const Grid& topLevelGrid = lookupStruct.TopLevel;
const vtkm::exec::twolevelgrid::Grid& topLevelGrid = lookupStruct.TopLevel;
DimVec3 binId3 = static_cast<DimVec3>((p - topLevelGrid.Origin) / topLevelGrid.BinSize);
if (binId3[0] >= 0 && binId3[0] < topLevelGrid.Dimensions[0] && binId3[1] >= 0 &&
@ -739,7 +722,7 @@ private:
vtkm::cont::DynamicCellSet CellSet;
vtkm::cont::CoordinateSystem Coordinates;
TwoLevelUniformGridExecutionObjectFactory LookupStructure;
TwoLevelUniformGrid LookupStructure;
};
}
}

@ -27,7 +27,7 @@
#include <vtkm/cont/arg/Transport.h>
#include <vtkm/exec/AtomicArray.h>
#include <vtkm/cont/AtomicArray.h>
namespace vtkm
{
@ -53,7 +53,8 @@ struct Transport<vtkm::cont::arg::TransportTagAtomicArray,
vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagBasic>,
Device>
{
using ExecObjectType = vtkm::exec::AtomicArray<T, Device>;
using ExecObjectType = vtkm::exec::AtomicArrayExecutionObject<T, Device>;
using ExecType = vtkm::cont::AtomicArray<T>;
template <typename InputDomainType>
VTKM_CONT ExecObjectType
@ -65,8 +66,8 @@ struct Transport<vtkm::cont::arg::TransportTagAtomicArray,
// Note: we ignore the size of the domain because the randomly accessed
// array might not have the same size depending on how the user is using
// the array.
return ExecObjectType(array);
ExecType obj(array);
return obj.PrepareForExecution(Device());
}
};
}

@ -27,7 +27,7 @@
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/StorageBasic.h>
#include <vtkm/exec/AtomicArray.h>
#include <vtkm/cont/AtomicArray.h>
namespace vtkm
{
@ -40,7 +40,7 @@ namespace arg
/// that is valid for atomic access. There are many restrictions on the
/// type of data that can be used for an atomic array.
///
template <typename TypeList = vtkm::exec::AtomicArrayTypeListTag>
template <typename TypeList = vtkm::cont::AtomicArrayTypeListTag>
struct TypeCheckTagAtomicArray
{
VTKM_IS_LIST_TAG(TypeList);
@ -57,7 +57,7 @@ struct TypeCheck<TypeCheckTagAtomicArray<TypeList>,
vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagBasic>>
{
static constexpr bool value = (vtkm::ListContains<TypeList, T>::value &&
vtkm::ListContains<vtkm::exec::AtomicArrayTypeListTag, T>::value);
vtkm::ListContains<vtkm::cont::AtomicArrayTypeListTag, T>::value);
};
}
}

@ -196,7 +196,7 @@ void TryArrayOutTransport(Device)
{
vtkm::testing::Testing::TryTypes(TryWholeArrayType<Device>(), vtkm::TypeListTagCommon());
vtkm::testing::Testing::TryTypes(TryAtomicArrayType<Device>(),
vtkm::exec::AtomicArrayTypeListTag());
vtkm::cont::AtomicArrayTypeListTag());
}
void TestWholeArrayTransport()

@ -42,7 +42,7 @@
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/exec/AtomicArray.h>
#include <vtkm/cont/AtomicArray.h>
#include <algorithm>
#include <cmath>
@ -332,8 +332,8 @@ public:
struct AtomicKernel
{
VTKM_CONT
AtomicKernel(const vtkm::exec::AtomicArray<T, DeviceAdapterTag>& array)
: AArray(array)
AtomicKernel(const vtkm::cont::AtomicArray<T>& array)
: AArray(array.PrepareForExecution(DeviceAdapterTag()))
{
}
@ -345,15 +345,15 @@ public:
VTKM_CONT void SetErrorMessageBuffer(const vtkm::exec::internal::ErrorMessageBuffer&) {}
vtkm::exec::AtomicArray<T, DeviceAdapterTag> AArray;
vtkm::exec::AtomicArrayExecutionObject<T, DeviceAdapterTag> AArray;
};
template <typename T>
struct AtomicCASKernel
{
VTKM_CONT
AtomicCASKernel(const vtkm::exec::AtomicArray<T, DeviceAdapterTag>& array)
: AArray(array)
AtomicCASKernel(const vtkm::cont::AtomicArray<T>& array)
: AArray(array.PrepareForExecution(DeviceAdapterTag()))
{
}
@ -374,7 +374,7 @@ public:
VTKM_CONT void SetErrorMessageBuffer(const vtkm::exec::internal::ErrorMessageBuffer&) {}
vtkm::exec::AtomicArray<T, DeviceAdapterTag> AArray;
vtkm::exec::AtomicArrayExecutionObject<T, DeviceAdapterTag> AArray;
};
class VirtualObjectTransferKernel
@ -2228,7 +2228,7 @@ private:
vtkm::cont::ArrayHandle<vtkm::Int32> atomicElement =
vtkm::cont::make_ArrayHandle(singleElement);
vtkm::exec::AtomicArray<vtkm::Int32, DeviceAdapterTag> atomic(atomicElement);
vtkm::cont::AtomicArray<vtkm::Int32> atomic(atomicElement);
Algorithm::Schedule(AtomicKernel<vtkm::Int32>(atomic), SHORT_ARRAY_SIZE);
vtkm::Int32 expected = vtkm::Int32(atomicCount);
vtkm::Int32 actual = atomicElement.GetPortalControl().Get(0);
@ -2242,7 +2242,7 @@ private:
vtkm::cont::ArrayHandle<vtkm::Int64> atomicElement =
vtkm::cont::make_ArrayHandle(singleElement);
vtkm::exec::AtomicArray<vtkm::Int64, DeviceAdapterTag> atomic(atomicElement);
vtkm::cont::AtomicArray<vtkm::Int64> atomic(atomicElement);
Algorithm::Schedule(AtomicKernel<vtkm::Int64>(atomic), SHORT_ARRAY_SIZE);
vtkm::Int64 expected = vtkm::Int64(atomicCount);
vtkm::Int64 actual = atomicElement.GetPortalControl().Get(0);
@ -2256,7 +2256,7 @@ private:
vtkm::cont::ArrayHandle<vtkm::Int32> atomicElement =
vtkm::cont::make_ArrayHandle(singleElement);
vtkm::exec::AtomicArray<vtkm::Int32, DeviceAdapterTag> atomic(atomicElement);
vtkm::cont::AtomicArray<vtkm::Int32> atomic(atomicElement);
Algorithm::Schedule(AtomicCASKernel<vtkm::Int32>(atomic), SHORT_ARRAY_SIZE);
vtkm::Int32 expected = vtkm::Int32(atomicCount);
vtkm::Int32 actual = atomicElement.GetPortalControl().Get(0);
@ -2270,7 +2270,7 @@ private:
vtkm::cont::ArrayHandle<vtkm::Int64> atomicElement =
vtkm::cont::make_ArrayHandle(singleElement);
vtkm::exec::AtomicArray<vtkm::Int64, DeviceAdapterTag> atomic(atomicElement);
vtkm::cont::AtomicArray<vtkm::Int64> atomic(atomicElement);
Algorithm::Schedule(AtomicCASKernel<vtkm::Int64>(atomic), SHORT_ARRAY_SIZE);
vtkm::Int64 expected = vtkm::Int64(atomicCount);
vtkm::Int64 actual = atomicElement.GetPortalControl().Get(0);

@ -0,0 +1,75 @@
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//
// Copyright 2015 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2015 UT-Battelle, LLC.
// Copyright 2015 Los Alamos National Security.
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#ifndef vtk_m_exec_AtomicArrayExecutionObject_h
#define vtk_m_exec_AtomicArrayExecutionObject_h
#include <vtkm/ListTag.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/DeviceAdapter.h>
namespace vtkm
{
namespace exec
{
template <typename T, typename Device>
class AtomicArrayExecutionObject
{
public:
using ValueType = T;
VTKM_CONT
AtomicArrayExecutionObject()
: AtomicImplementation((vtkm::cont::ArrayHandle<T>()))
{
}
template <typename StorageType>
VTKM_CONT AtomicArrayExecutionObject(vtkm::cont::ArrayHandle<T, StorageType> handle)
: AtomicImplementation(handle)
{
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
T Add(vtkm::Id index, const T& value) const
{
return this->AtomicImplementation.Add(index, value);
}
//
// Compare and Swap is an atomic exchange operation. If the value at
// the index is equal to oldValue, then newValue is written to the index.
// The operation was successful if return value is equal to oldValue
//
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
T CompareAndSwap(vtkm::Id index, const T& newValue, const T& oldValue) const
{
return this->AtomicImplementation.CompareAndSwap(index, newValue, oldValue);
}
private:
vtkm::cont::DeviceAdapterAtomicArrayImplementation<T, Device> AtomicImplementation;
};
}
} // namespace vtkm::exec
#endif //vtk_m_exec_AtomicArrayExecutionObject_h

@ -19,8 +19,8 @@
##============================================================================
set(headers
AtomicArray.h
BoundingIntervalHierarchyExec.h
AtomicArrayExecutionObject.h
CellDerivative.h
CellEdge.h
CellFace.h

@ -24,6 +24,7 @@ set(headers
ReduceByKeyLookup.h
TaskSingular.h
WorkletInvokeFunctorDetail.h
TwoLevelUniformGridExecutionObject.h
)
vtkm_declare_headers(${headers})

@ -0,0 +1,67 @@
//
// Created by Matthew Letter on 6/8/18.
//
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//
// Copyright 2017 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2017 UT-Battelle, LLC.
// Copyright 2017 Los Alamos National Security.
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#ifndef vtk_m_exec_TwoLevelUniformGridExecutonObject_h
#define vtk_m_exec_TwoLevelUniformGridExecutonObject_h
#include <vtkm/cont/ArrayHandle.h>
namespace vtkm
{
namespace exec
{
namespace twolevelgrid
{
using DimensionType = vtkm::Int16;
using DimVec3 = vtkm::Vec<DimensionType, 3>;
using FloatVec3 = vtkm::Vec<vtkm::FloatDefault, 3>;
struct Grid
{
DimVec3 Dimensions;
FloatVec3 Origin;
FloatVec3 BinSize;
};
template <typename Device>
struct TwoLevelUniformGridExecutionObject
{
template <typename T>
using ArrayPortalConst =
typename vtkm::cont::ArrayHandle<T>::template ExecutionTypes<Device>::PortalConst;
Grid TopLevel;
ArrayPortalConst<DimVec3> LeafDimensions;
ArrayPortalConst<vtkm::Id> LeafStartIndex;
ArrayPortalConst<vtkm::Id> CellStartIndex;
ArrayPortalConst<vtkm::Id> CellCount;
ArrayPortalConst<vtkm::Id> CellIds;
};
}
}
}
#endif // vtk_m_cont_TwoLevelUniformGridExecutonObject_h

@ -27,8 +27,8 @@
#include <vtkm/Types.h>
#include <vtkm/VectorAnalysis.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/AtomicArray.h>
#include <vtkm/cont/DynamicArrayHandle.h>
#include <vtkm/exec/AtomicArray.h>
#include <vtkm/rendering/MatrixHelpers.h>
#include <vtkm/rendering/Triangulator.h>
#include <vtkm/worklet/DispatcherMapField.h>
@ -158,7 +158,9 @@ template <typename DeviceTag>
class EdgePlotter : public vtkm::worklet::WorkletMapField
{
public:
using AtomicPackedFrameBufferHandle = vtkm::exec::AtomicArray<vtkm::Int64, DeviceTag>;
using AtomicPackedFrameBufferHandle =
vtkm::exec::AtomicArrayExecutionObject<vtkm::Int64, DeviceTag>;
using AtomicPackedFrameBuffer = vtkm::cont::AtomicArray<vtkm::Int64>;
using ControlSignature = void(FieldIn<Id2Type>, WholeArrayIn<Vec3>, WholeArrayIn<Scalar>);
using ExecutionSignature = void(_1, _2, _3);
@ -175,7 +177,7 @@ public:
bool assocPoints,
const vtkm::Range& fieldRange,
const ColorMapHandle& colorMap,
const AtomicPackedFrameBufferHandle& frameBuffer,
const AtomicPackedFrameBuffer& frameBuffer,
const vtkm::Range& clippingRange)
: WorldToProjection(worldToProjection)
, Width(width)
@ -187,7 +189,7 @@ public:
, AssocPoints(assocPoints)
, ColorMap(colorMap.PrepareForInput(DeviceTag()))
, ColorMapSize(vtkm::Float32(colorMap.GetNumberOfValues() - 1))
, FrameBuffer(frameBuffer)
, FrameBuffer(frameBuffer.PrepareForExecution(DeviceTag()))
, FieldMin(vtkm::Float32(fieldRange.Min))
{
InverseFieldDelta = 1.0f / vtkm::Float32(fieldRange.Length());

@ -29,7 +29,7 @@
#include <vtkm/cont/Timer.h>
#include <vtkm/cont/TryExecute.h>
#include <vtkm/exec/AtomicArray.h>
#include <vtkm/cont/AtomicArray.h>
#include <vtkm/rendering/raytracing/BoundingVolumeHierarchy.h>
#include <vtkm/rendering/raytracing/Logger.h>
@ -297,7 +297,7 @@ private:
vtkm::Int32 LeafCount;
//Int8Handle Counters;
//Int8ArrayPortal CountersPortal;
vtkm::exec::AtomicArray<vtkm::Int32, Device> Counters;
vtkm::exec::AtomicArrayExecutionObject<vtkm::Int32, Device> Counters;
public:
VTKM_CONT
@ -306,12 +306,12 @@ public:
IdArrayHandle& rightChildren,
vtkm::Int32 leafCount,
Float4ArrayHandle flatBVH,
const vtkm::exec::AtomicArray<vtkm::Int32, Device>& counters)
const vtkm::cont::AtomicArray<vtkm::Int32>& counters)
: Parents(parents.PrepareForInput(Device()))
, LeftChildren(leftChildren.PrepareForInput(Device()))
, RightChildren(rightChildren.PrepareForInput(Device()))
, LeafCount(leafCount)
, Counters(counters)
, Counters(counters.PrepareForExecution(Device()))
{
this->FlatBVH = flatBVH.PrepareForOutput((LeafCount - 1) * 4, Device());
@ -774,7 +774,7 @@ VTKM_CONT void LinearBVHBuilder::RunOnDevice(LinearBVH& linearBVH, Device device
vtkm::Int32 zero = 0;
vtkm::worklet::DispatcherMapField<MemSet<vtkm::Int32>, Device>(MemSet<vtkm::Int32>(zero))
.Invoke(counters);
vtkm::exec::AtomicArray<vtkm::Int32, Device> atomicCounters(counters);
vtkm::cont::AtomicArray<vtkm::Int32> atomicCounters(counters);
vtkm::worklet::DispatcherMapField<PropagateAABBs<Device>, Device>(

@ -163,7 +163,7 @@ void TestWorkletMapFieldExecArg()
std::cout << "--- Worklet accepting atomics." << std::endl;
vtkm::testing::Testing::TryTypes(map_whole_array::DoTestAtomicArrayWorklet(),
vtkm::exec::AtomicArrayTypeListTag());
vtkm::cont::AtomicArrayTypeListTag());
}
} // anonymous namespace