Commit 47d82851 authored by Cianciosa, Mark's avatar Cianciosa, Mark Committed by Cianciosa, Mark
Browse files

Inital working hip backend. WIP

parent de4d2391
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -94,9 +94,13 @@ else ()

        find_package (hip REQUIRED)

        target_compile_definitions (hip_lib
                                    INTERFACE
                                    USE_HIP
        )
        target_link_libraries (hip_lib
                               INTERFACE
                               $<$<BOOL:${HIP_FOUND}>:hip::host>
                               $<$<BOOL:${hip_FOUND}>:hip::host>
        )
    endif ()
endif ()
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ target_compile_definitions (graph_framework
                            EFIT_FILE="${CMAKE_CURRENT_SOURCE_DIR}/../graph_tests/efit.nc"
                            VMEC_FILE="${CMAKE_CURRENT_SOURCE_DIR}/../graph_tests/vmec.nc"
                            $<$<BOOL:${USE_CUDA}>:HEADER_DIR="$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>">
                            $<$<BOOL:${USE_HIP}>:HEADER_DIR="$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>">
                            $<$<BOOL:${SAVE_KERNEL_SOURCE}>:SAVE_KERNEL_SOURCE>
                            $<$<BOOL:${USE_CONSTANT_CACHE}>:USE_CONSTANT_CACHE>
                            $<$<BOOL:${SHOW_USE_COUNT}>:SHOW_USE_COUNT>
+472 −8

File changed.

Preview size limit exceeded, changes collapsed.

+4 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@
#include "metal_context.hpp"
#elif defined(USE_CUDA)
#include "cuda_context.hpp"
#elif defined(USE_HIP)
#include "hip_context.hpp"
#endif
#include "cpu_context.hpp"

@@ -63,6 +65,8 @@ namespace jit {
        using gpu_context_type = typename std::conditional<use_gpu<T> (),
#ifdef USE_CUDA
                                                           gpu::cuda_context<T, SAFE_MATH>,
#elif defined(USE_HIP)
                                                           gpu::hip_context<T, SAFE_MATH>,
#elif defined(USE_METAL)
                                                           gpu::metal_context<SAFE_MATH>,
#else
+12 −1
Original line number Diff line number Diff line
@@ -72,6 +72,17 @@ namespace jit {
#endif
    }

//------------------------------------------------------------------------------
///  @brief Test to use Hip
//------------------------------------------------------------------------------
    constexpr bool use_hip() {
#ifdef USE_HIP
        return true;
#else
        return false;
#endif
    }

//------------------------------------------------------------------------------
///  @brief Test to use metal.
///
@@ -93,7 +104,7 @@ namespace jit {
//------------------------------------------------------------------------------
    template<float_scalar T>
    constexpr bool use_gpu() {
        return use_cuda() || use_metal<T> ();
        return use_cuda() || use_hip() || use_metal<T> ();
    }

//------------------------------------------------------------------------------
Loading