@@ -210,7 +210,30 @@ endif()
210210if ((AVX512_FOUND AND NOT AVX512_DISABLED) OR (ASIMD_FOUND AND NOT APPLE_SILICON_FOUND) OR POWER9_FOUND OR POWER10_FOUND OR POWER11_FOUND)
211211 # Fetch and build Arm Compute Library (ACL) as oneDNN's backend for AArch64
212212 # TODO [fadara01]: remove this once ACL can be fetched and built automatically as a dependency of oneDNN
213+ set (ONEDNN_AARCH64_USE_ACL OFF CACHE BOOL "" )
213214 if (ASIMD_FOUND)
215+ # Set number of parallel build processes
216+ include (ProcessorCount)
217+ ProcessorCount(NPROC)
218+ if (NOT NPROC)
219+ set (NPROC 4)
220+ endif ()
221+ # locate PyTorch's libgomp (e.g. site-packages/torch.libs/libgomp-947d5fa1.so.1.0.0)
222+ # and create a local shim dir with it
223+ vllm_prepare_torch_gomp_shim(VLLM_TORCH_GOMP_SHIM_DIR)
224+
225+ find_library (OPEN_MP
226+ NAMES gomp
227+ PATHS ${VLLM_TORCH_GOMP_SHIM_DIR}
228+ NO_DEFAULT_PATH
229+ REQUIRED
230+ )
231+ # Set LD_LIBRARY_PATH to include the shim dir at build time to use the same libgomp as PyTorch
232+ if (OPEN_MP)
233+ set (ENV{LD_LIBRARY_PATH} "${VLLM_TORCH_GOMP_SHIM_DIR} :$ENV{LD_LIBRARY_PATH} " )
234+ endif ()
235+
236+ # Fetch and populate ACL
214237 if (DEFINED ENV{ACL_ROOT_DIR} AND IS_DIRECTORY "$ENV{ACL_ROOT_DIR} " )
215238 message (STATUS "Using ACL from specified source directory: $ENV{ACL_ROOT_DIR} " )
216239 else ()
@@ -224,38 +247,53 @@ if ((AVX512_FOUND AND NOT AVX512_DISABLED) OR (ASIMD_FOUND AND NOT APPLE_SILICON
224247 GIT_PROGRESS TRUE
225248 )
226249 set (ENV{ACL_ROOT_DIR} "${arm_compute_SOURCE_DIR} " )
250+ set (ACL_LIB_DIR "$ENV{ACL_ROOT_DIR} /build" )
227251 endif ()
228252
229- # Build ACL with scons
230- include (ProcessorCount)
231- ProcessorCount(_NPROC)
232- set (_scons_cmd
233- scons -j${_NPROC}
234- Werror=0 debug=0 neon=1 examples=0 embed_kernels=0 os=linux
235- arch=armv8.2-a build =native benchmark_examples=0 fixed_format_kernels=1
236- multi_isa=1 openmp=1 cppthreads=0
253+ # Build ACL with CMake
254+ set (ARM_COMPUTE_BUILD_SHARED_LIB "OFF" )
255+ set (CMAKE_BUILD_TYPE "Release" )
256+ set (ARM_COMPUTE_ARCH "armv8.2-a" )
257+ set (ARM_COMPUTE_ENABLE_ASSERTS "OFF" )
258+ set (ARM_COMPUTE_ENABLE_CPPTHREADS "OFF" )
259+ set (ONEDNN_ENABLE_PRIMITIVE "MATMUL;REORDER" )
260+ set (ARM_COMPUTE_ENABLE_OPENMP "ON" )
261+ set (ARM_COMPUTE_ENABLE_WERROR "OFF" )
262+ set (ARM_COMPUTE_BUILD_EXAMPLES "OFF" )
263+ set (ARM_COMPUTE_BUILD_TESTING "OFF" )
264+
265+ set (_cmake_config_cmd
266+ ${CMAKE_COMMAND} -G Ninja -B build
267+ -DARM_COMPUTE_BUILD_SHARED_LIB=OFF
268+ -DCMAKE_BUILD_TYPE=Release
269+ -DARM_COMPUTE_ARCH=armv8.2-a
270+ -DARM_COMPUTE_ENABLE_ASSERTS=OFF
271+ -DARM_COMPUTE_ENABLE_CPPTHREADS=OFF
272+ -DARM_COMPUTE_ENABLE_OPENMP=ON
273+ -DARM_COMPUTE_ENABLE_WERROR=OFF
274+ -DARM_COMPUTE_BUILD_EXAMPLES=OFF
275+ -DARM_COMPUTE_BUILD_TESTING=OFF )
276+ set (_cmake_build_cmd
277+ ${CMAKE_COMMAND} --build build -- -j${NPROC}
237278 )
238279
239- # locate PyTorch's libgomp (e.g. site-packages/torch.libs/libgomp-947d5fa1.so.1.0.0)
240- # and create a local shim dir with it
241- include ("${CMAKE_CURRENT_LIST_DIR} /utils.cmake" )
242- vllm_prepare_torch_gomp_shim(VLLM_TORCH_GOMP_SHIM_DIR)
243-
244- if (NOT VLLM_TORCH_GOMP_SHIM_DIR STREQUAL "" )
245- list (APPEND _scons_cmd extra_link_flags=-L${VLLM_TORCH_GOMP_SHIM_DIR} )
246- endif ()
247-
248280 execute_process (
249- COMMAND ${_scons_cmd}
281+ COMMAND ${_cmake_config_cmd}
282+ WORKING_DIRECTORY "$ENV{ACL_ROOT_DIR} "
283+ )
284+ execute_process (
285+ COMMAND ${_cmake_build_cmd}
250286 WORKING_DIRECTORY "$ENV{ACL_ROOT_DIR} "
251287 RESULT_VARIABLE _acl_rc
252288 )
289+
253290 if (NOT _acl_rc EQUAL 0)
254291 message (FATAL_ERROR "ACL SCons build failed (exit ${_acl_rc} )." )
255292 endif ()
293+ message (STATUS "Arm Compute Library (ACL) built successfully." )
256294
257- set (ONEDNN_AARCH64_USE_ACL "ON" )
258- set (CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -Wl,-rpath, $ENV{ACL_ROOT_DIR} /build/" )
295+ # VLLM/oneDNN settings for ACL
296+ set (ONEDNN_AARCH64_USE_ACL ON CACHE BOOL "" FORCE )
259297 add_compile_definitions (VLLM_USE_ACL)
260298 endif ()
261299
0 commit comments