Skip to content
This repository was archived by the owner on Sep 21, 2019. It is now read-only.

Changes for hip-clang for building Caffe2 #13

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cub/device/dispatch/dispatch_histogram.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ namespace cub {
{
hipHostMalloc(&p_, sizeof(T)); new (p_) T{x};
}

#if __HIP__
__device__ operator const T&() const { return p_[0]; }
#else
operator const T&() const [[hc]] { return p_[0]; }
#endif
};

template<typename T>
Expand Down Expand Up @@ -596,7 +599,6 @@ struct DipatchHistogram
return CubDebug(hipErrorNotInitialized);

#else

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace change

hipError_t error = hipSuccess;
do
{
Expand Down
4 changes: 4 additions & 0 deletions cub/device/dispatch/dispatch_radix_sort.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -1642,7 +1642,11 @@ struct DispatchSegmentedRadixSort :
(void)alt_segmented_kernel;

// Kernel launch not supported from this device
#if __HIP__
return CubDebug(hipErrorNotInitialized);
#else
return CubDebug(cudaErrorNotSupported );
#endif
#else

hipError_t error = hipSuccess;
Expand Down
2 changes: 1 addition & 1 deletion cub/iterator/tex_obj_input_iterator.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private:

T* ptr;
difference_type tex_offset;
#ifdef __HCC__
#if defined(__HCC__) || __HIP__
hipTextureObject_t tex_obj;
#else
cudaTextureObject_t tex_obj;
Expand Down
2 changes: 2 additions & 0 deletions cub/thread/thread_load.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@

#pragma once

#ifndef __HIP__
#include <cuda.h>
#endif

#include <iterator>

Expand Down
2 changes: 1 addition & 1 deletion cub/util_debug.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ __host__ __device__ inline hipError_t Debug(
*/
#if !defined(_CubLog)
#if !(defined(__clang__) && defined(__CUDA__))
#if (CUB_PTX_ARCH == 0)
#if (CUB_PTX_ARCH == 0) || __HIP__
#define _CubLog(format, ...) printf(format,__VA_ARGS__);
#elif (CUB_PTX_ARCH >= 200)
#define _CubLog(format, ...) printf("[block (%d,%d,%d), thread (%d,%d,%d)]: " format, hipBlockIdx_z, hipBlockIdx_y, hipBlockIdx_x, hipThreadIdx_z, hipThreadIdx_y, hipThreadIdx_x, __VA_ARGS__);
Expand Down