Commit 022c9871 authored by Robert Maynard's avatar Robert Maynard

Correct warnings and errors found with MSVC2017+CUDA9

parent 668b3086
......@@ -56,8 +56,8 @@ endif()
# Enable large object support so we can have 2^32 addressable sections
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -bigobj")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=-bigobj")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=\"/bigobj\" -Xcudafe=\"--diag_suppress=1394 --diag_suppress=766 --display_error_number\"")
endif()
# Setup the include directories that are needed for vtkm
......@@ -96,14 +96,14 @@ if(VTKM_COMPILER_IS_MSVC)
#CMake COMPILE_LANGUAGE doesn't work with MSVC, ans since we want these flags
#only for C++ compilation we have to resort to setting CMAKE_CXX_FLAGS :(
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4702 -wd4505")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=\"-wd4702 -wd4505\"")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4702 /wd4505")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=\"/wd4702 /wd4505\"")
if(MSVC_VERSION LESS 1900)
# In VS2013 the C4127 warning has a bug in the implementation and
# generates false positive warnings for lots of template code
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4127")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=\"-wd4127\"")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=\"/wd4127\"")
endif()
elseif(VTKM_COMPILER_IS_ICC)
......
......@@ -45,7 +45,6 @@ struct Bounds
VTKM_EXEC_CONT
Bounds() {}
VTKM_EXEC_CONT
Bounds(const Bounds&) = default;
VTKM_EXEC_CONT
......@@ -91,7 +90,6 @@ struct Bounds
{
}
VTKM_EXEC_CONT
vtkm::Bounds& operator=(const vtkm::Bounds& src) = default;
/// \b Determine if the bounds are valid (i.e. has at least one valid point).
......
......@@ -49,7 +49,6 @@ struct Range
{
}
VTKM_EXEC_CONT
Range(const Range&) = default;
template <typename T1, typename T2>
......@@ -59,7 +58,6 @@ struct Range
{
}
VTKM_EXEC_CONT
vtkm::Range& operator=(const vtkm::Range& src) = default;
/// \b Determine if the range is valid (i.e. has at least one valid point).
......
......@@ -42,7 +42,10 @@ namespace vtkm
class VTKM_ALWAYS_EXPORT VirtualObjectBase
{
public:
VTKM_EXEC_CONT virtual ~VirtualObjectBase() = default;
VTKM_EXEC_CONT virtual ~VirtualObjectBase(){
//we implement this as we need a destructor with cuda markup
//but using =default causes warnings with CUDA 9
};
VTKM_EXEC_CONT void Modified() { this->ModifiedCount++; }
......@@ -54,7 +57,11 @@ protected:
{
}
VTKM_EXEC_CONT VirtualObjectBase(const VirtualObjectBase&) = default;
VTKM_EXEC_CONT VirtualObjectBase(const VirtualObjectBase& other)
{ //we implement this as we need a copy constructor with cuda markup
//but using =default causes warnings with CUDA 9
this->ModifiedCount = other.ModifiedCount;
}
VTKM_EXEC_CONT VirtualObjectBase(VirtualObjectBase&& other)
: ModifiedCount(other.ModifiedCount)
......
......@@ -37,6 +37,7 @@ class VTKM_ALWAYS_EXPORT ArrayPortalConcatenate
public:
using ValueType = typename PortalType1::ValueType;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC_CONT
ArrayPortalConcatenate()
: portal1()
......
......@@ -870,7 +870,6 @@ public:
{
}
VTKM_EXEC
T Add(vtkm::Id index, const T& value) const
{
T* lockedValue;
......@@ -886,7 +885,6 @@ public:
#endif
}
VTKM_EXEC
T CompareAndSwap(vtkm::Id index, const T& newValue, const T& oldValue) const
{
T* lockedValue;
......@@ -910,19 +908,16 @@ private:
IteratorsType Iterators;
#if defined(VTKM_MSVC) //MSVC atomics
VTKM_EXEC
vtkm::Int32 vtkmAtomicAdd(vtkm::Int32* address, const vtkm::Int32& value) const
{
return InterlockedExchangeAdd(reinterpret_cast<volatile long*>(address), value);
}
VTKM_EXEC
vtkm::Int64 vtkmAtomicAdd(vtkm::Int64* address, const vtkm::Int64& value) const
{
return InterlockedExchangeAdd64(reinterpret_cast<volatile long long*>(address), value);
}
VTKM_EXEC
vtkm::Int32 vtkmCompareAndSwap(vtkm::Int32* address,
const vtkm::Int32& newValue,
const vtkm::Int32& oldValue) const
......@@ -931,7 +926,6 @@ private:
reinterpret_cast<volatile long*>(address), newValue, oldValue);
}
VTKM_EXEC
vtkm::Int64 vtkmCompareAndSwap(vtkm::Int64* address,
const vtkm::Int64& newValue,
const vtkm::Int64& oldValue) const
......@@ -942,19 +936,16 @@ private:
#else //gcc built-in atomics
VTKM_EXEC
vtkm::Int32 vtkmAtomicAdd(vtkm::Int32* address, const vtkm::Int32& value) const
{
return __sync_fetch_and_add(address, value);
}
VTKM_EXEC
vtkm::Int64 vtkmAtomicAdd(vtkm::Int64* address, const vtkm::Int64& value) const
{
return __sync_fetch_and_add(address, value);
}
VTKM_EXEC
vtkm::Int32 vtkmCompareAndSwap(vtkm::Int32* address,
const vtkm::Int32& newValue,
const vtkm::Int32& oldValue) const
......@@ -962,7 +953,6 @@ private:
return __sync_val_compare_and_swap(address, oldValue, newValue);
}
VTKM_EXEC
vtkm::Int64 vtkmCompareAndSwap(vtkm::Int64* address,
const vtkm::Int64& newValue,
const vtkm::Int64& oldValue) const
......
......@@ -68,6 +68,7 @@ public:
{
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
T Add(vtkm::Id index, const T& value) const
{
......@@ -79,6 +80,7 @@ public:
// 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
{
......
......@@ -66,6 +66,7 @@ struct ReduceByKeyLookup : vtkm::exec::ExecutionObjectBase
{
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC_CONT
ReduceByKeyLookup() {}
};
......
......@@ -48,7 +48,7 @@ public:
VTKM_CONT
TaskSingular(const WorkletType& worklet,
const InvocationType& invocation,
const vtkm::Id& globalIndexOffset = 0)
vtkm::Id globalIndexOffset = 0)
: Worklet(worklet)
, Invocation(invocation)
, GlobalIndexOffset(globalIndexOffset)
......
......@@ -172,9 +172,7 @@ public:
/// This constructor supports any vtkm worklet and the associated invocation
/// parameters that go along with it
template <typename WorkletType, typename InvocationType>
TaskTiling1D(WorkletType& worklet,
InvocationType& invocation,
const vtkm::Id& globalIndexOffset = 0)
TaskTiling1D(WorkletType& worklet, InvocationType& invocation, vtkm::Id globalIndexOffset)
: Worklet(nullptr)
, Invocation(nullptr)
, ExecuteFunction(nullptr)
......@@ -193,7 +191,7 @@ public:
/// explicit Copy constructor.
/// Note this required so that compilers don't use the templated constructor
/// as the copy constructor which will cause compile issues
TaskTiling1D(const TaskTiling1D& task)
TaskTiling1D(TaskTiling1D& task)
: Worklet(task.Worklet)
, Invocation(task.Invocation)
, ExecuteFunction(task.ExecuteFunction)
......@@ -202,6 +200,8 @@ public:
{
}
TaskTiling1D(TaskTiling1D&& task) = default;
void SetErrorMessageBuffer(const vtkm::exec::internal::ErrorMessageBuffer& buffer)
{
this->SetErrorBufferFunction(this->Worklet, buffer);
......@@ -262,9 +262,7 @@ public:
}
template <typename WorkletType, typename InvocationType>
TaskTiling3D(WorkletType& worklet,
InvocationType& invocation,
const vtkm::Id& globalIndexOffset = 0)
TaskTiling3D(WorkletType& worklet, InvocationType& invocation, vtkm::Id globalIndexOffset = 0)
: Worklet(nullptr)
, Invocation(nullptr)
, ExecuteFunction(nullptr)
......@@ -283,7 +281,7 @@ public:
/// explicit Copy constructor.
/// Note this required so that compilers don't use the templated constructor
/// as the copy constructor which will cause compile issues
TaskTiling3D(const TaskTiling3D& task)
TaskTiling3D(TaskTiling3D& task)
: Worklet(task.Worklet)
, Invocation(task.Invocation)
, ExecuteFunction(task.ExecuteFunction)
......@@ -292,6 +290,8 @@ public:
{
}
TaskTiling3D(TaskTiling3D&& task) = default;
void SetErrorMessageBuffer(const vtkm::exec::internal::ErrorMessageBuffer& buffer)
{
this->SetErrorBufferFunction(this->Worklet, buffer);
......
......@@ -81,10 +81,10 @@ struct RenderBitmapFont : public vtkm::worklet::WorkletMapField
}
template <typename ColorBufferPortal>
void Plot(vtkm::Float32 x,
vtkm::Float32 y,
vtkm::Float32 intensity,
ColorBufferPortal& colorBuffer) const
VTKM_EXEC void Plot(vtkm::Float32 x,
vtkm::Float32 y,
vtkm::Float32 intensity,
ColorBufferPortal& colorBuffer) const
{
vtkm::Id index =
static_cast<vtkm::Id>(vtkm::Round(y)) * Width + static_cast<vtkm::Id>(vtkm::Round(x));
......
......@@ -346,7 +346,8 @@ public:
vtkm::Vec<Precision, 3> reflect = 2.f * vtkm::dot(lightDir, normal) * normal - lightDir;
vtkm::Normalize(reflect);
Precision cosPhi = vtkm::dot(reflect, viewDir);
Precision specularConstant = Precision(pow(vtkm::Max(cosPhi, zero), SpecularExponent));
Precision specularConstant =
Precision(pow(vtkm::Max(cosPhi, zero), (Precision)SpecularExponent));
vtkm::Int32 colorIdx = vtkm::Int32(scalar * Precision(ColorMapSize - 1));
//Just in case clamp the value to the valid range
......
......@@ -45,10 +45,10 @@ namespace rendering
#endif
template <typename ArrayHandleType>
inline void BoundsCheck(const ArrayHandleType& handle,
const vtkm::Id& index,
const char* file,
int line)
VTKM_EXEC inline void BoundsCheck(const ArrayHandleType& handle,
const vtkm::Id& index,
const char* file,
int line)
{
if (index < 0 || index >= handle.GetNumberOfValues())
printf("Bad Index %d at file %s line %d\n", (int)index, file, line);
......
......@@ -726,6 +726,7 @@ public:
{
return rcp((fabs(f) < 1e-8f) ? 1e-8f : f);
}
VTKM_EXEC
inline vtkm::Float64 rcp(vtkm::Float64 f) const { return 1.0 / f; }
VTKM_EXEC
inline vtkm::Float64 rcp_safe(vtkm::Float64 f) const
......@@ -884,6 +885,7 @@ public:
{
return rcp((fabs(f) < 1e-8f) ? 1e-8f : f);
}
VTKM_EXEC
inline vtkm::Float32 rcp_safe(vtkm::Float32 f) const
{
return rcp((fabs(f) < 1e-8f) ? 1e-8f : f);
......
......@@ -90,6 +90,7 @@ public:
VTKM_EXEC_CONT
FillSupernodes() {}
VTKM_EXEC
vtkm::Id operator()(const vtkm::Id& upCandidate, const vtkm::Id& downCandidate) const
{
vtkm::Id isSupernode = ((upCandidate != 1) || (downCandidate != 1));
......
......@@ -438,22 +438,39 @@ private:
static_assert(isAllValid::value == expectedLen::value,
"All arguments failed the TypeCheck pass");
#if defined __NVCC__
#if defined(__CUDACC__)
// Disable warning "calling a __host__ function from a __host__ __device__"
// In some cases nv_exec_check_disable doesn't work and therefore you need
// to use the following suppressions
// This have been found by eigen:
// https://github.com/RLovelett/eigen/blame/master/Eigen/src/Core/util/DisableStupidWarnings.h
// To discover new dia_supress values use -Xcudafe "--display_error_number"
#if defined(VTKM_MSVC)
#pragma warning(push)
#pragma warning(disable : 4068) //unknown pragma
#endif
#pragma push
#pragma diag_suppress 2737
#pragma diag_suppress 2739
#pragma diag_suppress 2828
#if defined(VTKM_MSVC)
#pragma warning(pop)
#endif
#endif
auto fi =
vtkm::internal::make_FunctionInterface<void, typename std::decay<Args>::type...>(args...);
#if defined __NVCC__
#if defined __CUDACC__
#if defined(VTKM_MSVC)
#pragma warning(push)
#pragma warning(disable : 4068) //unknown pragma
#endif
#pragma pop
#if defined(VTKM_MSVC)
#pragma warning(pop)
#endif
#endif
auto ivc = vtkm::internal::Invocation<ParameterInterface,
......
......@@ -85,7 +85,6 @@ public:
{
}
VTKM_EXEC_CONT
Particles(vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>>& posArray,
vtkm::cont::ArrayHandle<vtkm::Id>& stepsArray,
vtkm::cont::ArrayHandle<vtkm::Id>& statusArray,
......@@ -248,7 +247,6 @@ public:
{
}
VTKM_EXEC_CONT
StateRecordingParticles(vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>>& posArray,
vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>>& historyArray,
vtkm::cont::ArrayHandle<vtkm::Id>& stepsArray,
......@@ -266,7 +264,6 @@ public:
History = historyArray.PrepareForOutput(NumPos * HistSize, DeviceAdapterTag());
}
VTKM_EXEC_CONT
StateRecordingParticles(vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>>& posArray,
vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>>& historyArray,
vtkm::cont::ArrayHandle<vtkm::Id>& stepsArray,
......
......@@ -226,7 +226,6 @@ public:
else
{
sigPretendX = sigPretendY = sigPretendZ = 0; // so the compiler doesn't complain
vtkm::cont::ErrorInternal("Invalid extension mode for cubes!");
}
if (sigPretendX == sigPretendDimX || // decides to pad a zero
......@@ -329,10 +328,6 @@ public:
cube = 3;
idx = inZ * dimX3 * dimY3 + inY * dimX3 + inX_local;
}
else
{
vtkm::cont::ErrorInternal("Invalid index!");
}
}
private:
......@@ -407,10 +402,6 @@ public:
cube = 3;
idx = inZ * dimX3 * dimY3 + inY_local * dimX3 + inX;
}
else
{
vtkm::cont::ErrorInternal("Invalid index!");
}
}
private:
......@@ -483,10 +474,6 @@ public:
cube = 3;
idx = inZ_local * dimX3 * dimY3 + inY * dimX3 + inX;
}
else
{
vtkm::cont::ErrorInternal("Invalid index!");
}
}
private:
......@@ -614,10 +601,6 @@ public:
cube = 4; // ext4
idx = inZ * dimX4 * dimY4 + inY * dimX4 + inX_local;
}
else
{
vtkm::cont::ErrorInternal("Invalid index!");
}
}
private:
......@@ -734,10 +717,6 @@ public:
cube = 4; // ext4
idx = inZ * dimX4 * dimY4 + inY_local * dimX4 + inX;
}
else
{
vtkm::cont::ErrorInternal("Invalid index!");
}
}
private:
......@@ -851,10 +830,6 @@ public:
cube = 4; // ext4
idx = inZ_local * dimX4 * dimY4 + inY * dimX4 + inX;
}
else
{
vtkm::cont::ErrorInternal("Invalid index!");
}
}
private:
......@@ -878,7 +853,6 @@ public:
typedef void ExecutionSignature(_1, _2, _3, _4, WorkIndex);
typedef _4 InputDomain;
VTKM_EXEC_CONT
ForwardTransform3DLeftRight(const vtkm::cont::ArrayHandle<vtkm::Float64>& loFilter,
const vtkm::cont::ArrayHandle<vtkm::Float64>& hiFilter,
vtkm::Id filter_len,
......@@ -963,7 +937,6 @@ public:
}
else
{
vtkm::cont::ErrorInternal("Invalid cube index!");
return -1;
}
}
......@@ -1034,7 +1007,6 @@ public:
typedef void ExecutionSignature(_1, _2, _3, _4, WorkIndex);
typedef _4 InputDomain;
VTKM_EXEC_CONT
ForwardTransform3DTopDown(const vtkm::cont::ArrayHandle<vtkm::Float64>& loFilter,
const vtkm::cont::ArrayHandle<vtkm::Float64>& hiFilter,
vtkm::Id filter_len,
......@@ -1119,7 +1091,6 @@ public:
}
else
{
vtkm::cont::ErrorInternal("Invalid cube index!");
return -1;
}
}
......@@ -1190,7 +1161,6 @@ public:
typedef void ExecutionSignature(_1, _2, _3, _4, WorkIndex);
typedef _4 InputDomain;
VTKM_EXEC_CONT
ForwardTransform3DFrontBack(const vtkm::cont::ArrayHandle<vtkm::Float64>& loFilter,
const vtkm::cont::ArrayHandle<vtkm::Float64>& hiFilter,
vtkm::Id filter_len,
......@@ -1275,7 +1245,6 @@ public:
}
else
{
vtkm::cont::ErrorInternal("Invalid cube index!");
return -1;
}
}
......@@ -1362,7 +1331,6 @@ public:
typedef _6 InputDomain;
// Constructor
VTKM_EXEC_CONT
InverseTransform3DLeftRight(const vtkm::cont::ArrayHandle<vtkm::Float64>& lo_fil,
const vtkm::cont::ArrayHandle<vtkm::Float64>& hi_fil,
vtkm::Id fil_len,
......@@ -1470,7 +1438,6 @@ public:
}
else
{
vtkm::cont::ErrorInternal("Invalid matrix index!");
return -1;
}
}
......@@ -1596,7 +1563,6 @@ public:
typedef _6 InputDomain;
// Constructor
VTKM_EXEC_CONT
InverseTransform3DTopDown(const vtkm::cont::ArrayHandle<vtkm::Float64>& lo_fil,
const vtkm::cont::ArrayHandle<vtkm::Float64>& hi_fil,
vtkm::Id fil_len,
......@@ -1704,7 +1670,6 @@ public:
}
else
{
vtkm::cont::ErrorInternal("Invalid matrix index!");
return -1;
}
}
......@@ -1830,7 +1795,6 @@ public:
typedef _6 InputDomain;
// Constructor
VTKM_EXEC_CONT
InverseTransform3DFrontBack(const vtkm::cont::ArrayHandle<vtkm::Float64>& lo_fil,
const vtkm::cont::ArrayHandle<vtkm::Float64>& hi_fil,
vtkm::Id fil_len,
......@@ -1940,7 +1904,6 @@ public:
}
else
{
vtkm::cont::ErrorInternal("Invalid matrix index!");
return -1;
}
}
......@@ -2156,10 +2119,6 @@ public:
mat = 4; // ext4
idx = inY * x4 + (inX - x1 - xa - x2 - x3 - xd);
}
else
{
vtkm::cont::ErrorInternal("Invalid index!");
}
}
else // top-down mode
{
......@@ -2193,10 +2152,6 @@ public:
mat = 4; // ext4
idx = (inY - y1 - ya - y2 - y3 - yd) * x4 + inX;
}
else
{
vtkm::cont::ErrorInternal("Invalid index!");
}
}
}
......@@ -2268,10 +2223,6 @@ public:
mat = 3;
idx = inY * dimX3 + (inX - dimX1 - pretendDimX2);
}
else
{
vtkm::cont::ErrorInternal("Invalid index!");
}
}
else // top-down mode
{
......@@ -2290,10 +2241,6 @@ public:
mat = 3;
idx = (inY - dimY1 - pretendDimY2) * dimX3 + inX;
}
else
{
vtkm::cont::ErrorInternal("Invalid index!");
}
}
}
......@@ -2430,10 +2377,6 @@ public:
sigPretendY++;
}
}
else
{
vtkm::cont::ErrorInternal("Invalid extension mode for matrices!");
}
if (sigPretendX == sigPretendDimX || sigPretendY == sigPretendDimY)
{
......@@ -2466,7 +2409,6 @@ public:
typedef _4 InputDomain;
// Constructor
VTKM_EXEC_CONT
ForwardTransform2D(const vtkm::cont::ArrayHandle<vtkm::Float64>& loFilter,
const vtkm::cont::ArrayHandle<vtkm::Float64>& hiFilter,
vtkm::Id filter_len,
......@@ -2529,7 +2471,6 @@ public:
}
else
{
vtkm::cont::ErrorInternal("Invalid matrix index!");
return -1;
}
}
......@@ -2657,7 +2598,6 @@ public:
typedef _6 InputDomain;
// Constructor
VTKM_EXEC_CONT
InverseTransform2D(const vtkm::cont::ArrayHandle<vtkm::Float64>& lo_fil,
const vtkm::cont::ArrayHandle<vtkm::Float64>& hi_fil,
vtkm::Id fil_len,
......@@ -2759,7 +2699,6 @@ public:
}
else
{
vtkm::cont::ErrorInternal("Invalid matrix index!");
return -1;
}
}
......@@ -2963,7 +2902,6 @@ public:
typedef _1 InputDomain;
// Constructor
VTKM_EXEC_CONT
ForwardTransform(const vtkm::cont::ArrayHandle<vtkm::Float64>& loFilter,
const vtkm::cont::ArrayHandle<vtkm::Float64>& hiFilter,
vtkm::Id filLen,
......@@ -3130,7 +3068,6 @@ public:
typedef _1 InputDomain;
// Constructor
VTKM_EXEC_CONT
InverseTransformEven(const vtkm::cont::ArrayHandle<vtkm::Float64>& loFilter,
const vtkm::cont::ArrayHandle<vtkm::Float64>& hiFilter,
vtkm::Id filtL,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment