From 3fcfcd51fbb951f9f96269b62fb528fa6dd0a720 Mon Sep 17 00:00:00 2001 From: sneaxiy <32832641+sneaxiy@users.noreply.github.com> Date: Thu, 2 Jun 2022 18:24:23 +0800 Subject: [PATCH] Fix bug of CUDAGraph kernel parameter comparation (#43163) * fix cuda graph sizeof * fix tuple type --- paddle/fluid/platform/device/gpu/cuda/cuda_graph.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/paddle/fluid/platform/device/gpu/cuda/cuda_graph.h b/paddle/fluid/platform/device/gpu/cuda/cuda_graph.h index 8f84f26adbd..083478ed7e6 100644 --- a/paddle/fluid/platform/device/gpu/cuda/cuda_graph.h +++ b/paddle/fluid/platform/device/gpu/cuda/cuda_graph.h @@ -60,17 +60,18 @@ template struct IsSameKernelHelper { private: + using FuncArgsTuple = decltype(std::make_tuple(std::declval()...)); + template struct Impl { static bool Compare(const CUDAKernelParams ¶ms, const TupleT &args) { - using CompareT = typename std::tuple_element::type; + using CompareT = typename std::tuple_element::type; if (!IsBitwiseEqual(params.As(IDX), std::get(args))) { return false; } - constexpr auto NewIsEnd = - (IDX + 1 == sizeof(std::tuple_size::value)); + constexpr auto NewIsEnd = (IDX + 1 == std::tuple_size::value); return Impl::Compare(params, args); } }; @@ -83,8 +84,6 @@ struct IsSameKernelHelper { }; public: - using FuncArgsTuple = decltype(std::make_tuple(std::declval()...)); - template static bool Compare(const CUDAKernelParams ¶ms, Args... args) { constexpr auto kNumArgs = sizeof...(FuncArgs); -- GitLab