aboutsummaryrefslogtreecommitdiff
blob: 49835d2013df87082329946fae46559db3e4b8f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From 0f3a0d9a948fdd8481a5f7751a255ecd9ed4d37a Mon Sep 17 00:00:00 2001
From: Alexey Chernov <4ernov@gmail.com>
Date: Mon, 20 Jan 2020 01:21:22 +0300
Subject: [PATCH 3/3] Remove conversion ambiguity in ternary operators

It fails to compile with recent versions of Clang
(namely, version 10 used behind HCC compiler when
being built with ROCm support) with the
`conditional expression is ambiguous` error.
---
 caffe2/operators/relu_op.cu | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/caffe2/operators/relu_op.cu b/caffe2/operators/relu_op.cu
index f6edf7105e..ab49540fc9 100644
--- a/caffe2/operators/relu_op.cu
+++ b/caffe2/operators/relu_op.cu
@@ -51,7 +51,7 @@ __global__ void ReluCUDAKernel<half2>(const int N, const half2* X, half2* Y) {
 #else
     const float2 xx = __half22float2(X[i]);
     Y[i] =
-        __floats2half2_rn(xx.x > 0.0f ? xx.x : 0.0f, xx.y > 0.0f ? xx.y : 0.0f);
+        __floats2half2_rn(xx.x > 0.0f ? float(xx.x) : 0.0f, xx.y > 0.0f ? float(xx.y) : 0.0f);
 #endif
   }
 }
@@ -101,7 +101,7 @@ __global__ void ReluGradientCUDAKernel<half2>(
     const float2 dy = __half22float2(dY[i]);
     const float2 yy = __half22float2(Y[i]);
     dX[i] =
-        __floats2half2_rn(yy.x > 0.0f ? dy.x : 0.0f, yy.y > 0.0f ? dy.y : 0.0f);
+        __floats2half2_rn(yy.x > 0.0f ? float(dy.x) : 0.0f, yy.y > 0.0f ? float(dy.y) : 0.0f);
 #endif
   }
 }
-- 
2.24.1