@@ -116,12 +116,6 @@ option(ROCFFT_RUNTIME_COMPILE_DEFAULT "Compile kernels at runtime by default" OF
116116# Set default to OFF since users are not likely to tune
117117option (ROCFFT_BUILD_OFFLINE_TUNER "Build with offline tuner executable rocfft_offline_tuner" OFF )
118118
119- if (BUILD_ADDRESS_SANITIZER)
120- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -shared-libasan" )
121- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -shared-libasan" )
122- add_link_options (-fuse-ld=lld)
123- endif ()
124-
125119# FOR HANDLING ENABLE/DISABLE OPTIONAL BACKWARD COMPATIBILITY for FILE/FOLDER REORG
126120option (BUILD_FILE_REORG_BACKWARD_COMPATIBILITY "Build with file/folder reorg with backward compatibility enabled" OFF )
127121if (BUILD_FILE_REORG_BACKWARD_COMPATIBILITY AND NOT WIN32 )
@@ -138,6 +132,52 @@ if( WERROR )
138132 set ( WARNING_FLAGS ${WARNING_FLAGS} -Werror )
139133endif ( )
140134
135+ set (DEFAULT_GPUS
136+ gfx803
137+ gfx900
138+ gfx906
139+ gfx908
140+ gfx90a
141+ gfx940
142+ gfx941
143+ gfx942
144+ gfx1030
145+ gfx1100
146+ gfx1101
147+ gfx1102
148+ gfx1151
149+ gfx1200
150+ gfx1201)
151+
152+ if (BUILD_ADDRESS_SANITIZER)
153+ add_compile_options (-fsanitize=address)
154+ add_link_options (-fsanitize=address)
155+ add_link_options (-shared-libasan)
156+ SET (DEFAULT_GPUS
157+ gfx908:xnack+
158+ gfx90a:xnack+
159+ gfx940:xnack+
160+ gfx941:xnack+
161+ gfx942:xnack+)
162+ add_link_options (-fuse-ld=lld)
163+ set (ROCFFT_KERNEL_CACHE_ENABLE off )
164+ add_compile_definitions (ADDRESS_SANITIZER)
165+ endif ()
166+
167+ # Build only for local GPU architecture
168+ if (BUILD_LOCAL_GPU_TARGET_ONLY)
169+ message (STATUS "Building only for local GPU target" )
170+ if (COMMAND rocm_local_targets)
171+ rocm_local_targets(DEFAULT_GPUS)
172+ else ()
173+ message (WARNING "Unable to determine local GPU targets. Falling back to default GPUs." )
174+ endif ()
175+ endif ()
176+
177+
178+ set (AMDGPU_TARGETS "${DEFAULT_GPUS} " CACHE STRING "Target default GPUs if AMDGPU_TARGETS is not defined." )
179+ rocm_check_target_ids(AMDGPU_TARGETS TARGETS "${AMDGPU_TARGETS} " )
180+
141181# Use target ID syntax if supported for AMDGPU_TARGETS
142182rocm_check_target_ids(DEFAULT_AMDGPU_TARGETS
143183 TARGETS "gfx803;gfx900;gfx906;gfx908;gfx90a;gfx940;gfx941;gfx942;gfx1030;gfx1100;gfx1101;gfx1102;gfx1151;gfx1200;gfx1201" )
0 commit comments