Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
composable_kernel_ROCM
Commits
47486abb
Commit
47486abb
authored
Oct 02, 2024
by
Mirza Halilcevic
Browse files
Fix cmake.
parent
52426f84
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
38 deletions
+47
-38
CMakeLists.txt
CMakeLists.txt
+35
-17
codegen/CMakeLists.txt
codegen/CMakeLists.txt
+12
-21
No files found.
CMakeLists.txt
View file @
47486abb
...
@@ -26,7 +26,23 @@ set(version 1.1.0)
...
@@ -26,7 +26,23 @@ set(version 1.1.0)
project
(
composable_kernel VERSION
${
version
}
LANGUAGES CXX HIP
)
project
(
composable_kernel VERSION
${
version
}
LANGUAGES CXX HIP
)
include
(
CTest
)
include
(
CTest
)
find_package
(
Python3 3.6 COMPONENTS Interpreter REQUIRED
)
# Usage: for customized Python location cmake -DCK_USE_ALTERNATIVE_PYTHON="/opt/Python-3.8.13/bin/python3.8"
# CK Codegen requires dataclass which is added in Python 3.7
# Python version 3.8 is required for general good practice as it is default for Ubuntu 20.04
if
(
NOT CK_USE_ALTERNATIVE_PYTHON
)
find_package
(
Python3 3.8 COMPONENTS Interpreter REQUIRED
)
else
()
message
(
"Using alternative python version"
)
set
(
EXTRA_PYTHON_PATH
)
# this is overly restrictive, we may need to be more flexible on the following
string
(
REPLACE
"/bin/python3.8"
""
EXTRA_PYTHON_PATH
"
${
CK_USE_ALTERNATIVE_PYTHON
}
"
)
message
(
"alternative python path is:
${
EXTRA_PYTHON_PATH
}
"
)
find_package
(
Python3 3.6 COMPONENTS Interpreter REQUIRED
)
add_definitions
(
-DPython3_EXECUTABLE=
"
${
CK_USE_ALTERNATIVE_PYTHON
}
"
)
set
(
Python3_EXECUTABLE
"
${
CK_USE_ALTERNATIVE_PYTHON
}
"
)
set
(
PYTHON_EXECUTABLE
"
${
CK_USE_ALTERNATIVE_PYTHON
}
"
)
set
(
ENV{LD_LIBRARY_PATH}
"
${
EXTRA_PYTHON_PATH
}
/lib:$ENV{LD_LIBRARY_PATH}"
)
endif
()
list
(
APPEND CMAKE_MODULE_PATH
"
${
PROJECT_SOURCE_DIR
}
/cmake"
)
list
(
APPEND CMAKE_MODULE_PATH
"
${
PROJECT_SOURCE_DIR
}
/cmake"
)
...
@@ -62,17 +78,14 @@ if (DTYPES)
...
@@ -62,17 +78,14 @@ if (DTYPES)
endif
()
endif
()
message
(
"DTYPES macro set to
${
DTYPES
}
"
)
message
(
"DTYPES macro set to
${
DTYPES
}
"
)
else
()
else
()
add_definitions
(
-DCK_ENABLE_INT8 -DCK_ENABLE_FP16 -DCK_ENABLE_FP32 -DCK_ENABLE_FP64 -DCK_ENABLE_BF16
)
add_definitions
(
-DCK_ENABLE_INT8 -DCK_ENABLE_FP16 -DCK_ENABLE_FP32 -DCK_ENABLE_FP64 -DCK_ENABLE_BF16
-DCK_ENABLE_FP8 -DCK_ENABLE_BF8
)
set
(
CK_ENABLE_INT8
"ON"
)
set
(
CK_ENABLE_INT8
"ON"
)
set
(
CK_ENABLE_FP16
"ON"
)
set
(
CK_ENABLE_FP16
"ON"
)
set
(
CK_ENABLE_FP32
"ON"
)
set
(
CK_ENABLE_FP32
"ON"
)
set
(
CK_ENABLE_FP64
"ON"
)
set
(
CK_ENABLE_FP64
"ON"
)
set
(
CK_ENABLE_BF16
"ON"
)
set
(
CK_ENABLE_BF16
"ON"
)
if
(
GPU_TARGETS MATCHES
"gfx94"
)
add_definitions
(
-DCK_ENABLE_FP8 -DCK_ENABLE_BF8
)
set
(
CK_ENABLE_FP8
"ON"
)
set
(
CK_ENABLE_FP8
"ON"
)
set
(
CK_ENABLE_BF8
"ON"
)
set
(
CK_ENABLE_BF8
"ON"
)
endif
()
endif
()
endif
()
#for f8/bf8_t type
#for f8/bf8_t type
...
@@ -191,12 +204,18 @@ endif()
...
@@ -191,12 +204,18 @@ endif()
configure_file
(
include/ck/config.h.in
${
CMAKE_CURRENT_BINARY_DIR
}
/include/ck/config.h
)
configure_file
(
include/ck/config.h.in
${
CMAKE_CURRENT_BINARY_DIR
}
/include/ck/config.h
)
if
(
NOT WIN32 AND
${
hip_VERSION_FLAT
}
GREATER 500723302
)
if
(
NOT WIN32 AND
${
hip_VERSION_FLAT
}
GREATER 500723302
)
check_cxx_compiler_flag
(
"-fno-offload-uniform-block"
HAS_NO_OFFLOAD_UNIFORM_BLOCK
)
if
(
HAS_NO_OFFLOAD_UNIFORM_BLOCK
)
message
(
"Adding the fno-offload-uniform-block compiler flag"
)
message
(
"Adding the fno-offload-uniform-block compiler flag"
)
add_compile_options
(
-fno-offload-uniform-block
)
add_compile_options
(
-fno-offload-uniform-block
)
endif
()
endif
()
endif
()
if
(
NOT WIN32 AND
${
hip_VERSION_FLAT
}
GREATER 600140090
)
if
(
NOT WIN32 AND
${
hip_VERSION_FLAT
}
GREATER 600140090
)
check_cxx_compiler_flag
(
"-mllvm -enable-post-misched=0"
HAS_ENABLE_POST_MISCHED
)
if
(
HAS_ENABLE_POST_MISCHED
)
message
(
"Adding the enable-post-misched=0 compiler flag"
)
message
(
"Adding the enable-post-misched=0 compiler flag"
)
add_compile_options
(
"SHELL: -mllvm -enable-post-misched=0"
)
add_compile_options
(
"SHELL: -mllvm -enable-post-misched=0"
)
endif
()
endif
()
endif
()
set
(
check-coerce
)
set
(
check-coerce
)
check_cxx_compiler_flag
(
" -mllvm -amdgpu-coerce-illegal-types=1"
check-coerce
)
check_cxx_compiler_flag
(
" -mllvm -amdgpu-coerce-illegal-types=1"
check-coerce
)
...
@@ -550,12 +569,7 @@ if(NOT DEFINED INSTANCES_ONLY)
...
@@ -550,12 +569,7 @@ if(NOT DEFINED INSTANCES_ONLY)
PACKAGE_NAME examples
PACKAGE_NAME examples
)
)
add_subdirectory
(
example
)
add_subdirectory
(
example
)
if
(
GPU_TARGETS MATCHES
"gfx9"
AND NOT INSTANCES_ONLY
)
add_subdirectory
(
codegen
)
endif
()
if
(
BUILD_TESTING
)
add_subdirectory
(
test
)
add_subdirectory
(
test
)
endif
()
rocm_package_setup_component
(
profiler
rocm_package_setup_component
(
profiler
LIBRARY_NAME composablekernel
LIBRARY_NAME composablekernel
...
@@ -572,6 +586,10 @@ if(NOT DEFINED INSTANCES_ONLY)
...
@@ -572,6 +586,10 @@ if(NOT DEFINED INSTANCES_ONLY)
endif
()
endif
()
endif
()
endif
()
if
(
NOT DEFINED PROFILER_ONLY
AND
(
GPU_TARGETS MATCHES
"gfx9"
OR DEFINED INSTANCES_ONLY
))
add_subdirectory
(
codegen
)
endif
()
#Create an interface target for the include only files and call it "composablekernels"
#Create an interface target for the include only files and call it "composablekernels"
include
(
CMakePackageConfigHelpers
)
include
(
CMakePackageConfigHelpers
)
...
...
codegen/CMakeLists.txt
View file @
47486abb
cmake_minimum_required
(
VERSION 3.16
)
project
(
composable_kernel_host LANGUAGES CXX HIP
)
find_package
(
ROCM
)
include
(
ROCMInstallTargets
)
include
(
ROCMTest
)
set
(
CMAKE_EXPORT_COMPILE_COMMANDS ON
)
set
(
CMAKE_EXPORT_COMPILE_COMMANDS ON
)
set
(
CMAKE_LIBRARY_OUTPUT_DIRECTORY
${
CMAKE_BINARY_DIR
}
/lib
)
set
(
CMAKE_LIBRARY_OUTPUT_DIRECTORY
${
CMAKE_BINARY_DIR
}
/lib
)
...
@@ -21,7 +15,6 @@ include_directories(BEFORE
...
@@ -21,7 +15,6 @@ include_directories(BEFORE
${
PROJECT_SOURCE_DIR
}
/include
${
PROJECT_SOURCE_DIR
}
/include
${
PROJECT_SOURCE_DIR
}
/library/include
${
PROJECT_SOURCE_DIR
}
/library/include
${
HIP_INCLUDE_DIRS
}
${
HIP_INCLUDE_DIRS
}
${
CK_ROOT
}
/include/
)
)
list
(
APPEND CMAKE_MODULE_PATH
${
CK_ROOT
}
/cmake
)
list
(
APPEND CMAKE_MODULE_PATH
${
CK_ROOT
}
/cmake
)
...
@@ -46,15 +39,13 @@ set_target_properties(ck_host PROPERTIES
...
@@ -46,15 +39,13 @@ set_target_properties(ck_host PROPERTIES
target_include_directories
(
ck_host PUBLIC
target_include_directories
(
ck_host PUBLIC
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
/include>
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
/include>
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_BINARY_DIR
}
/solution_instances>
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_BINARY_DIR
}
/embed/ck_headers/include>
)
)
add_executable
(
ck-template-driver driver/main.cpp
)
add_executable
(
ck-template-driver driver/main.cpp
)
target_link_libraries
(
ck-template-driver ck_host
)
target_link_libraries
(
ck-template-driver ck_host
)
rocm_install
(
rocm_install
(
TARGETS ck_host
TARGETS ck_host
ck_headers
EXPORT ck_hostTargets
EXPORT ck_hostTargets
)
)
rocm_install
(
DIRECTORY include/ck DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
)
rocm_install
(
DIRECTORY include/ck DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment