Refactor CPU compile preamble (#708)

* refactor cpu preamble

* fix include order

* fix some issues'

* fixes for linux

* try to fix includes

* add back warning suppression

* more linux fixes
This commit is contained in:
Awni Hannun
2024-02-19 06:12:53 -08:00
committed by GitHub
parent 0925af43b0
commit 1a4f4c5ea6
12 changed files with 732 additions and 1355 deletions

View File

@@ -1,3 +1,33 @@
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CLANG TRUE)
endif()
add_custom_command(
OUTPUT compiled_preamble.cpp
COMMAND /bin/bash
${CMAKE_CURRENT_SOURCE_DIR}/make_compiled_preamble.sh
${CMAKE_CURRENT_BINARY_DIR}/compiled_preamble.cpp
${CMAKE_CXX_COMPILER}
${CMAKE_SOURCE_DIR}
${CLANG}
DEPENDS make_compiled_preamble.sh
compiled_preamble.h
${CMAKE_SOURCE_DIR}/mlx/types/half_types.h
${CMAKE_SOURCE_DIR}/mlx/types/fp16.h
${CMAKE_SOURCE_DIR}/mlx/types/bf16.h
${CMAKE_SOURCE_DIR}/mlx/types/complex.h
ops.h
)
add_custom_target(
cpu_compiled_preamble
DEPENDS compiled_preamble.cpp
)
add_dependencies(mlx cpu_compiled_preamble)
target_sources(
mlx
PRIVATE
@@ -19,4 +49,5 @@ target_sources(
${CMAKE_CURRENT_SOURCE_DIR}/indexing.cpp
${CMAKE_CURRENT_SOURCE_DIR}/load.cpp
${CMAKE_CURRENT_SOURCE_DIR}/qrf.cpp
${CMAKE_CURRENT_BINARY_DIR}/compiled_preamble.cpp
)