Skip to content

Commit 206d22b

Browse files
committed
Add GGML_HIP_ROCWMMA_FATTN and rocwmma header check
1 parent 36c258e commit 206d22b

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

ggml/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ option(GGML_CUDA_GRAPHS "ggml: use CUDA graphs (llama.cpp on
157157
option(GGML_HIP "ggml: use HIP" OFF)
158158
option(GGML_HIP_GRAPHS "ggml: use HIP graph, experimental, slow" OFF)
159159
option(GGML_HIP_NO_VMM "ggml: do not try to use HIP VMM" ON)
160+
option(GGML_HIP_ROCWMMA_FATTN "ggml: enable rocWMMA for FlashAttention" OFF)
160161
option(GGML_HIP_UMA "ggml: use HIP unified memory architecture" OFF)
161162
option(GGML_VULKAN "ggml: use Vulkan" OFF)
162163
option(GGML_VULKAN_CHECK_RESULTS "ggml: run Vulkan op checks" OFF)

ggml/src/ggml-hip/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ endif()
3939
find_package(hip REQUIRED)
4040
find_package(hipblas REQUIRED)
4141
find_package(rocblas REQUIRED)
42+
if (GGML_HIP_ROCWMMA_FATTN)
43+
CHECK_INCLUDE_FILE_CXX("rocwmma/rocwmma.hpp" FOUND_ROCWMMA)
44+
if (NOT ${FOUND_ROCWMMA})
45+
message(FATAL_ERROR "rocwmma is not found")
46+
endif()
47+
endif()
4248

4349
if (${hip_VERSION} VERSION_LESS 5.5)
4450
message(FATAL_ERROR "At least ROCM/HIP V5.5 is required")
@@ -107,6 +113,10 @@ if (GGML_HIP_NO_VMM)
107113
add_compile_definitions(GGML_HIP_NO_VMM)
108114
endif()
109115

116+
if (GGML_HIP_ROCWMMA_FATTN)
117+
add_compile_definitions(GGML_HIP_ROCWMMA_FATTN)
118+
endif()
119+
110120
if (CXX_IS_HIPCC)
111121
set_source_files_properties(${GGML_SOURCES_ROCM} PROPERTIES LANGUAGE CXX)
112122
target_link_libraries(ggml-hip PRIVATE hip::device)

0 commit comments

Comments
 (0)