Skip to content

Commit

Permalink
Conditionally compile without std::is_trivially_copyable to satisfy o…
Browse files Browse the repository at this point in the history
…ld GCC versions. (#4510)
  • Loading branch information
edgchen1 authored and yuslepukhin committed Jul 15, 2020
1 parent c40c05a commit 1f69a58
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion onnxruntime/core/providers/cuda/shared_inc/cuda_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
// as currently nvcc cannot compile all onnxruntime headers

#pragma once

#include <memory>
#include <type_traits>
#include <vector>
#include "fast_divmod.h"

#include "core/common/common.h"
#include "core/providers/cuda/shared_inc/fast_divmod.h"

namespace onnxruntime {
namespace cuda {
Expand Down Expand Up @@ -57,7 +60,10 @@ struct TArray {
}

TArray(const std::vector<T>& vec) : TArray(static_cast<int32_t>(vec.size())) {
// std::is_trivially_copyable is not implemented in older versions of GCC
#if !defined(__GNUC__) || __GNUC__ >= 5
static_assert(std::is_trivially_copyable<T>::value, "T must be trivially copyable.");
#endif
memcpy(data_, vec.data(), vec.size() * sizeof(T));
}

Expand Down

0 comments on commit 1f69a58

Please sign in to comment.