Skip to content
Draft
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: 5 additions & 1 deletion aten/src/ATen/cuda/cub.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@
#define ATEN_CUB_MAXIMUM() NO_ROCM(at_cuda_detail)ROCM_HIPCUB(::cub)::Max()
#endif

#if defined(USE_ROCM)
// Pre ROCm 8.0 we require backporting of FpLimits specialization
// for 'c10::BFloat16'. However, ROCm 8.0 lifts the compatible
// CUB version to 3.x which uses libhipcxx and derives numerical
// limits from there.
#if defined(USE_ROCM) && CUB_VERSION < 300000

// backport https://github.com/NVIDIA/cub/pull/306 for c10::BFloat16

Expand Down
14 changes: 10 additions & 4 deletions aten/src/ATen/cuda/cub_definitions.cuh
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
#pragma once

#if !defined(USE_ROCM)
#include <cuda.h> // for CUDA_VERSION
#endif

#if !defined(USE_ROCM)
#include <cuda.h> // for CUDA_VERSION
#include <cub/version.cuh>
#else
// Check if we can find HIPCUB_CCCL_VERSION.
#include <hipcub/hipcub_version.hpp>
// Older versions of hipCUB do not support the CUB V3 API.
#if defined(HIPCUB_CCCL_VERSION) && HIPCUB_CCCL_VERSION >= 300000
#define CUB_VERSION HIPCUB_CCCL_VERSION
#else
// If we cannot find a compatible CCCL version, fallback to
// a very old version.
#define CUB_VERSION 200001
#endif
#endif

// cub support for CUB_WRAPPED_NAMESPACE is added to cub 1.13.1 in:
// https://github.com/NVIDIA/cub/pull/326
Expand Down
3 changes: 3 additions & 0 deletions cmake/public/LoadHIP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ if(HIP_FOUND)

# Optional components.
find_package_and_print_version(hipsparselt) # Will be required when ready.
# ROCm 8.0 and later requires libhipcxx! This should be marked as
# 'REQUIRED' once minimal ROCm version is bumped to 8.0 or later.
find_package_and_print_version(libhipcxx)

list(REMOVE_DUPLICATES ROCM_INCLUDE_DIRS)

Expand Down