sxjscience commented on a change in pull request #15560: Add fp16 support for 
topk
URL: https://github.com/apache/incubator-mxnet/pull/15560#discussion_r317255526
 
 

 ##########
 File path: src/operator/tensor/sort_op-inl.cuh
 ##########
 @@ -227,18 +251,18 @@ SortByKeyImpl(mshadow::Tensor<gpu, 1, KDType> keys,
   CHECK_EQ(values.CheckContiguous(), true);
 #if CUDA_VERSION >= 9000
   cudaStream_t stream = mshadow::Stream<gpu>::GetStream(keys.stream_);
-  thrust::device_ptr<half> key_iter = thrust::device_pointer_cast(
-    reinterpret_cast<half*>(keys.dptr_));
-  thrust::device_ptr<half> value_iter = thrust::device_pointer_cast(
-    reinterpret_cast<half*>(values.dptr_));
+  thrust::device_ptr<__half> key_iter = thrust::device_pointer_cast(
+    reinterpret_cast<__half*>(keys.dptr_));
+  thrust::device_ptr<__half> value_iter = thrust::device_pointer_cast(
+    reinterpret_cast<__half*>(values.dptr_));
   if (is_ascend) {
     thrust::stable_sort_by_key(
       thrust::cuda::par.on(stream),
-      key_iter, key_iter + (keys.size(0)), value_iter, 
cuda::less_half<half>());
+      key_iter, key_iter + (keys.size(0)), value_iter.get(), 
cuda::less_half<__half>());
 
 Review comment:
   Why adding `.get()` to the `value_iter`?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to