File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
cpp/tensorrt_llm/kernels/flashMLA Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -21,3 +21,27 @@ file(GLOB_RECURSE SRC_CU *.cu)
21
21
add_library (flash_mla_src OBJECT ${SRC_CPP} ${SRC_CU} )
22
22
set_property (TARGET flash_mla_src PROPERTY POSITION_INDEPENDENT_CODE ON )
23
23
set_property (TARGET flash_mla_src PROPERTY CUDA_RESOLVE_DEVICE_SYMBOLS ON )
24
+
25
+ # Get all targeted architectures from parent CMake
26
+ if (CMAKE_CUDA_ARCHITECTURES )
27
+ # Create a list for FlashMLA's supported architectures
28
+ set (FLASH_MLA_CUDA_ARCHS "" )
29
+
30
+ # Only include architectures 90 and above
31
+ foreach (arch ${CMAKE_CUDA_ARCHITECTURES} )
32
+ # Extract the numeric part before any dash
33
+ string (REGEX MATCH "^([0-9]+)" arch_num "${arch} " )
34
+
35
+ # Only add architectures 90 and above
36
+ if (arch_num GREATER_EQUAL 90 )
37
+ list (APPEND FLASH_MLA_CUDA_ARCHS "${arch} " )
38
+ endif ()
39
+ endforeach ()
40
+
41
+ # Set specific architectures for this target only
42
+ set_property (TARGET flash_mla_src PROPERTY CUDA_ARCHITECTURES
43
+ ${FLASH_MLA_CUDA_ARCHS} )
44
+
45
+ # Log which architectures we're building for
46
+ message (STATUS "Building FlashMLA for architectures: ${FLASH_MLA_CUDA_ARCHS} " )
47
+ endif ()
You can’t perform that action at this time.
0 commit comments