Rename Undefined and Any DeviceAdapterId subclasses for consistency.

This commit is contained in:
Allison Vacanti 2018-08-28 14:52:35 -07:00
parent a878474a38
commit b124984817
7 changed files with 18 additions and 30 deletions

@ -498,7 +498,7 @@ public:
{
return this->Internals->ExecutionArrayValid
? this->Internals->ExecutionArray->GetDeviceAdapterId()
: DeviceAdapterIdUndefined{};
: DeviceAdapterTagUndefined{};
}
struct VTKM_ALWAYS_EXPORT InternalStruct

@ -405,7 +405,7 @@ VTKM_CONT auto CellSetExplicit<ShapeStorageTag,
OffsetsStorageTag>::GetShapesArray(FromTopology, ToTopology) const
-> const typename ConnectivityChooser<FromTopology, ToTopology>::ShapeArrayType&
{
this->BuildConnectivity(vtkm::cont::DeviceAdapterIdAny{}, FromTopology(), ToTopology());
this->BuildConnectivity(vtkm::cont::DeviceAdapterTagAny{}, FromTopology(), ToTopology());
return this->GetConnectivity(FromTopology(), ToTopology()).Shapes;
}
@ -421,7 +421,7 @@ VTKM_CONT auto CellSetExplicit<ShapeStorageTag,
ToTopology) const -> const
typename ConnectivityChooser<FromTopology, ToTopology>::NumIndicesArrayType&
{
this->BuildConnectivity(vtkm::cont::DeviceAdapterIdAny{}, FromTopology(), ToTopology());
this->BuildConnectivity(vtkm::cont::DeviceAdapterTagAny{}, FromTopology(), ToTopology());
return this->GetConnectivity(FromTopology(), ToTopology()).NumIndices;
}
@ -437,7 +437,7 @@ VTKM_CONT auto CellSetExplicit<ShapeStorageTag,
ToTopology) const -> const
typename ConnectivityChooser<FromTopology, ToTopology>::ConnectivityArrayType&
{
this->BuildConnectivity(vtkm::cont::DeviceAdapterIdAny{}, FromTopology(), ToTopology());
this->BuildConnectivity(vtkm::cont::DeviceAdapterTagAny{}, FromTopology(), ToTopology());
return this->GetConnectivity(FromTopology(), ToTopology()).Connectivity;
}
@ -453,7 +453,7 @@ VTKM_CONT auto CellSetExplicit<ShapeStorageTag,
ToTopology) const -> const
typename ConnectivityChooser<FromTopology, ToTopology>::IndexOffsetArrayType&
{
this->BuildConnectivity(vtkm::cont::DeviceAdapterIdAny{}, FromTopology(), ToTopology());
this->BuildConnectivity(vtkm::cont::DeviceAdapterTagAny{}, FromTopology(), ToTopology());
return this->GetConnectivity(FromTopology(), ToTopology()).IndexOffsets;
}

@ -222,7 +222,7 @@ DeviceAdapterNameType RuntimeDeviceTracker::GetDeviceName(DeviceAdapterId device
case VTKM_DEVICE_ADAPTER_ERROR:
return vtkm::cont::DeviceAdapterTraits<vtkm::cont::DeviceAdapterTagError>::GetName();
case VTKM_DEVICE_ADAPTER_UNDEFINED:
return "Undefined"; // This device id does not have traits.
return vtkm::cont::DeviceAdapterTraits<vtkm::cont::DeviceAdapterTagUndefined>::GetName();
default:
break;
}
@ -232,7 +232,7 @@ DeviceAdapterNameType RuntimeDeviceTracker::GetDeviceName(DeviceAdapterId device
switch (id)
{
case VTKM_DEVICE_ADAPTER_ANY:
return "Any"; // This device id does not have traits
return vtkm::cont::DeviceAdapterTraits<vtkm::cont::DeviceAdapterTagAny>::GetName();
default:
break;
}

@ -44,7 +44,7 @@ inline bool TryExecuteIfValid(std::true_type,
vtkm::cont::RuntimeDeviceTracker& tracker,
Args&&... args)
{
if ((tag == devId || devId == DeviceAdapterIdAny()) && tracker.CanRunOn(tag))
if ((tag == devId || devId == DeviceAdapterTagAny()) && tracker.CanRunOn(tag))
{
try
{
@ -344,7 +344,7 @@ template <typename Functor, typename... Args>
VTKM_CONT bool TryExecute(Functor&& functor, Args&&... args)
{
return TryExecuteOnDevice(
vtkm::cont::DeviceAdapterIdAny(), std::forward<Functor>(functor), std::forward<Args>(args)...);
vtkm::cont::DeviceAdapterTagAny(), std::forward<Functor>(functor), std::forward<Args>(args)...);
}

@ -250,7 +250,7 @@ bool ArrayHandleImpl::PrepareForDevice(DeviceAdapterId devId, vtkm::UInt64 sizeO
DeviceAdapterId ArrayHandleImpl::GetDeviceAdapterId() const
{
return this->ExecutionArrayValid ? this->ExecutionInterface->GetDeviceId()
: DeviceAdapterIdUndefined{};
: DeviceAdapterTagUndefined{};
}

@ -72,25 +72,6 @@ private:
vtkm::Int8 Value;
};
// Represents when using TryExecute that the functor
// can be executed on any device instead of a specific
// one
struct DeviceAdapterIdAny : DeviceAdapterId
{
constexpr DeviceAdapterIdAny()
: DeviceAdapterId(127)
{
}
};
struct DeviceAdapterIdUndefined : DeviceAdapterId
{
constexpr DeviceAdapterIdUndefined()
: DeviceAdapterId(VTKM_DEVICE_ADAPTER_UNDEFINED)
{
}
};
template <typename DeviceAdapter>
struct DeviceAdapterTraits;
}
@ -144,6 +125,13 @@ struct DeviceAdapterTraits;
} \
}
// Represents when using TryExecute that the functor
// can be executed on any device instead of a specific
// one
VTKM_VALID_DEVICE_ADAPTER(Any, VTKM_DEVICE_ADAPTER_ANY)
VTKM_INVALID_DEVICE_ADAPTER(Undefined, VTKM_DEVICE_ADAPTER_UNDEFINED)
/// Checks that the argument is a proper device adapter tag. This is a handy
/// concept check for functions and classes to make sure that a template
/// argument is actually a device adapter tag. (You can get weird errors

@ -65,7 +65,7 @@ void TestNames()
{
DeviceAdapterTagInvalidDeviceId invalidTag;
vtkm::cont::DeviceAdapterTagError errorTag;
vtkm::cont::DeviceAdapterIdUndefined undefinedTag;
vtkm::cont::DeviceAdapterTagUndefined undefinedTag;
vtkm::cont::DeviceAdapterTagSerial serialTag;
vtkm::cont::DeviceAdapterTagTBB tbbTag;
vtkm::cont::DeviceAdapterTagOpenMP openmpTag;