Skip to content

Commit e597a4a

Browse files
committed
chipstar: WIP recipe for a post-1.1.0 version
Signed-off-by: Zoltán Böszörményi <[email protected]>
1 parent f791d69 commit e597a4a

8 files changed

+449
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
From f744933a68f40ca1fde55b233a9435f5561e1c02 Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
3+
4+
Date: Mon, 17 Jun 2024 14:28:01 +0200
5+
Subject: [PATCH] Build ccompat with native hipcc
6+
MIME-Version: 1.0
7+
Content-Type: text/plain; charset=UTF-8
8+
Content-Transfer-Encoding: 8bit
9+
10+
Upstream-Status: Inappropriate [Yocto specific]
11+
Signed-off-by: Zoltán Böszörményi <[email protected]>
12+
---
13+
samples/ccompat/CMakeLists.txt | 6 +++---
14+
1 file changed, 3 insertions(+), 3 deletions(-)
15+
16+
diff --git a/samples/ccompat/CMakeLists.txt b/samples/ccompat/CMakeLists.txt
17+
index 2c0e7648..05a478e9 100644
18+
--- a/samples/ccompat/CMakeLists.txt
19+
+++ b/samples/ccompat/CMakeLists.txt
20+
@@ -1,18 +1,18 @@
21+
add_custom_command(
22+
OUTPUT saxpy.o DEPENDS ${CMAKE_SOURCE_DIR}/samples/ccompat/saxpy.hip
23+
- COMMAND ${CMAKE_BINARY_DIR}/bin/hipcc
24+
+ COMMAND hipcc
25+
${CMAKE_SOURCE_DIR}/samples/ccompat/saxpy.hip -c -g -pthread
26+
-I${CMAKE_SOURCE_DIR}/include -I${CMAKE_SOURCE_DIR}/HIP/include)
27+
28+
add_custom_command(
29+
OUTPUT ccompat.o DEPENDS ${CMAKE_SOURCE_DIR}/samples/ccompat/ccompat.c
30+
- COMMAND ${CMAKE_BINARY_DIR}/bin/hipcc
31+
+ COMMAND hipcc
32+
${CMAKE_SOURCE_DIR}/samples/ccompat/ccompat.c -c -g -pthread
33+
-I${CMAKE_SOURCE_DIR}/include -I${CMAKE_SOURCE_DIR}/HIP/include)
34+
35+
add_custom_command(
36+
OUTPUT ccompat DEPENDS ccompat.o saxpy.o
37+
-COMMAND ${CMAKE_BINARY_DIR}/bin/hipcc
38+
+COMMAND hipcc
39+
./ccompat.o ./saxpy.o -o ccompat -g -pthread)
40+
41+
add_custom_target(ccompatBuild ALL
42+
--
43+
2.45.2
44+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
From f65d4a6be3da2cce6ae1fbb06a473284526376c1 Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
3+
4+
Date: Mon, 17 Jun 2024 14:20:48 +0200
5+
Subject: [PATCH] Build hipInfo with native hipcc
6+
MIME-Version: 1.0
7+
Content-Type: text/plain; charset=UTF-8
8+
Content-Transfer-Encoding: 8bit
9+
10+
Upstream-Status: Inappropriate [Yocto specific]
11+
Signed-off-by: Zoltán Böszörményi <[email protected]>
12+
---
13+
CMakeLists.txt | 2 +-
14+
1 file changed, 1 insertion(+), 1 deletion(-)
15+
16+
diff --git a/CMakeLists.txt b/CMakeLists.txt
17+
index ea989ca2..5514d6ee 100644
18+
--- a/CMakeLists.txt
19+
+++ b/CMakeLists.txt
20+
@@ -395,7 +395,7 @@ endif()
21+
# once hipcc.bin is built, execute hipcc ./samples/hipSample.cpp
22+
add_custom_command(
23+
OUTPUT ${CMAKE_BINARY_DIR}/hipInfo
24+
- COMMAND ${HIPCC_BUILD_PATH}/hipcc ${CMAKE_SOURCE_DIR}/samples/hipInfo/hipInfo.cpp -o ${CMAKE_BINARY_DIR}/hipInfo
25+
+ COMMAND hipcc ${CMAKE_SOURCE_DIR}/samples/hipInfo/hipInfo.cpp -o ${CMAKE_BINARY_DIR}/hipInfo
26+
DEPENDS ${CMAKE_SOURCE_DIR}/samples/hipInfo/hipInfo.cpp hipcc.bin CHIP devicelib_bc
27+
)
28+
29+
--
30+
2.45.2
31+
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
From d86a6b7c55a024343a206b78163111df508bc760 Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
3+
4+
Date: Wed, 19 Jun 2024 07:54:25 +0200
5+
Subject: [PATCH] Eliminate RPATH
6+
MIME-Version: 1.0
7+
Content-Type: text/plain; charset=UTF-8
8+
Content-Transfer-Encoding: 8bit
9+
10+
Signed-off-by: Zoltán Böszörményi <[email protected]>
11+
---
12+
CMakeLists.txt | 11 -----------
13+
1 file changed, 11 deletions(-)
14+
15+
diff --git a/CMakeLists.txt b/CMakeLists.txt
16+
index 5514d6ee..481c7485 100644
17+
--- a/CMakeLists.txt
18+
+++ b/CMakeLists.txt
19+
@@ -208,7 +208,6 @@ option(CHIP_VERBOSE "Verbose compilation" OFF)
20+
option(CHIP_BUILD_SHARED_LIBS "Build chipStar as a shared library" ON)
21+
option(CHIP_BUILD_DOCS "Build doxygen documentation" OFF)
22+
option(CHIP_LLVM_USE_INTERGRATED_SPIRV "Use LLVM's intergrated SPIR-V backend for emitting device binary instead of SPIR-V translator. Requires LLVM 15" OFF)
23+
-option(CHIP_SET_RPATH "Add CMAKE_INSTALL_PREFIX/lib to the RPATH for chipStar executables" ON)
24+
option(CHIP_ENABLE_UNCOMPILABLE_TESTS "Enable tests which are known to not compile" OFF)
25+
option(CHIP_BUILD_TESTS "Enable build_tests target" ON)
26+
option(CHIP_BUILD_SAMPLES "Build samples" ON)
27+
@@ -506,8 +505,6 @@ set(HIP_OFFLOAD_COMPILE_OPTIONS_BUILD_
28+
-I${CMAKE_SOURCE_DIR}/HIP/include
29+
-I${CMAKE_BINARY_DIR}/include)
30+
31+
-# HIP applications need to link against libCHIP.so; add it to rpath
32+
-#
33+
# -no-hip-rt: Prevents linking amdhip64 library implicitly when doing
34+
# combined compile and link or when the --hip-link is
35+
# present at the link step.
36+
@@ -517,22 +514,14 @@ list(APPEND HIP_OFFLOAD_LINK_OPTIONS_BUILD_
37+
"-L${CMAKE_BINARY_DIR}" "-lCHIP" "-no-hip-rt")
38+
39+
if(OpenCL_LIBRARY)
40+
- target_link_options(CHIP PUBLIC -Wl,-rpath,${OpenCL_DIR})
41+
target_link_directories(CHIP PUBLIC ${OpenCL_DIR})
42+
endif()
43+
44+
if(LevelZero_LIBRARY)
45+
include_directories(CHIP PUBLIC ${LevelZeroInclude_DIR})
46+
- target_link_options(CHIP PUBLIC -Wl,-rpath,${LevelZeroLib_DIR})
47+
target_link_directories(CHIP PUBLIC ${LevelZeroLib_DIR})
48+
endif()
49+
50+
-if(CHIP_SET_RPATH)
51+
- list(APPEND HIP_OFFLOAD_LINK_OPTIONS_INSTALL_ "-Wl,-rpath,${LIB_INSTALL_DIR}")
52+
- list(APPEND HIP_OFFLOAD_LINK_OPTIONS_BUILD_ "-Wl,-rpath,${CMAKE_BINARY_DIR}")
53+
- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
54+
-endif()
55+
-
56+
# Workaround istead of trying to generate the CMake generator expression
57+
string(REPLACE ";" " " HIP_OFFLOAD_COMPILE_OPTIONS_INSTALL "${HIP_OFFLOAD_COMPILE_OPTIONS_INSTALL_}")
58+
string(REPLACE ";" " " HIP_OFFLOAD_COMPILE_OPTIONS_BUILD "${HIP_OFFLOAD_COMPILE_OPTIONS_BUILD_}")
59+
--
60+
2.45.2
61+
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
From 449a7530f6e417aa1c845937f50673a2828199b7 Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
3+
4+
Date: Mon, 17 Jun 2024 11:12:55 +0200
5+
Subject: [PATCH] Fix executing commands in opencl_bc_lib macro in
6+
cmake/OCL.cmake
7+
MIME-Version: 1.0
8+
Content-Type: text/plain; charset=UTF-8
9+
Content-Transfer-Encoding: 8bit
10+
11+
Upstream-Status: Inappropriate [Yocto specific]
12+
Signed-off-by: Zoltán Böszörményi <[email protected]>
13+
---
14+
cmake/OCL.cmake | 10 +++++-----
15+
1 file changed, 5 insertions(+), 5 deletions(-)
16+
17+
diff --git a/cmake/OCL.cmake b/cmake/OCL.cmake
18+
index 2eaf44e..8fd0a2d 100644
19+
--- a/cmake/OCL.cmake
20+
+++ b/cmake/OCL.cmake
21+
@@ -32,7 +32,7 @@ endif()
22+
# Disable code object version module flag if available.
23+
file(WRITE ${CMAKE_BINARY_DIR}/tmp.cl "")
24+
execute_process (
25+
- COMMAND ${LLVM_TOOLS_BINARY_DIR}/clang${EXE_SUFFIX} ${CLANG_OCL_FLAGS} -Xclang -mcode-object-version=none ${CMAKE_BINARY_DIR}/tmp.cl
26+
+ COMMAND clang${EXE_SUFFIX} ${CLANG_OCL_FLAGS} -Xclang -mcode-object-version=none ${CMAKE_BINARY_DIR}/tmp.cl
27+
RESULT_VARIABLE TEST_CODE_OBJECT_VERSION_NONE_RESULT
28+
ERROR_QUIET
29+
)
30+
@@ -99,7 +99,7 @@ macro(opencl_bc_lib)
31+
if (fext STREQUAL ".cl")
32+
set(output "${CMAKE_CURRENT_BINARY_DIR}/${fname_we}${BC_EXT}")
33+
add_custom_command(OUTPUT "${output}"
34+
- COMMAND ${CLANG_ROOT_PATH_BIN}/clang ${inc_options} ${CLANG_OCL_FLAGS}
35+
+ COMMAND clang ${inc_options} ${CLANG_OCL_FLAGS}
36+
-emit-llvm -Xclang -mlink-builtin-bitcode -Xclang "${irif_lib_output}"
37+
-c "${file}" -o "${output}"
38+
DEPENDS "${file}" "${irif_lib_output}" "${CLANG}"
39+
@@ -130,12 +130,12 @@ macro(opencl_bc_lib)
40+
41+
add_custom_command(OUTPUT ${OUTPUT_BC_LIB}
42+
# Link regular library dependencies
43+
- COMMAND ${CLANG_ROOT_PATH_BIN}/llvm-link
44+
+ COMMAND ${LLVM_LINK}
45+
-o "${OUT_NAME}.link0${LIB_SUFFIX}" "@${OUT_NAME}_response"
46+
# Extra link step with internalize
47+
- COMMAND ${CLANG_ROOT_PATH_BIN}/llvm-link -internalize -only-needed "${name}.link0${LIB_SUFFIX}"
48+
+ COMMAND ${LLVM_LINK} -internalize -only-needed "${name}.link0${LIB_SUFFIX}"
49+
-o "${OUT_NAME}${LIB_SUFFIX}" ${internal_link_libs}
50+
- COMMAND ${CLANG_ROOT_PATH_BIN}/opt -passes=strip
51+
+ COMMAND opt -passes=strip
52+
-o "${OUT_NAME}${STRIP_SUFFIX}" "${OUT_NAME}${LIB_SUFFIX}"
53+
COMMAND "${PREPARE_BUILTINS}"
54+
-o ${OUTPUT_BC_LIB} "${OUT_NAME}${STRIP_SUFFIX}"
55+
--
56+
2.45.2
57+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
From f8c861eaae683e6d6f9557d3e50217d29ac60682 Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
3+
4+
Date: Mon, 17 Jun 2024 10:36:21 +0200
5+
Subject: [PATCH] Fix irif/CMakeLists.txt to find llvm-link
6+
MIME-Version: 1.0
7+
Content-Type: text/plain; charset=UTF-8
8+
Content-Transfer-Encoding: 8bit
9+
10+
Upstream-Status: Inappropriate [Yocto specific]
11+
Signed-off-by: Zoltán Böszörményi <[email protected]>
12+
---
13+
irif/CMakeLists.txt | 16 ++++++++++------
14+
1 file changed, 10 insertions(+), 6 deletions(-)
15+
16+
diff --git a/irif/CMakeLists.txt b/irif/CMakeLists.txt
17+
index a874772..d9e3502 100644
18+
--- a/irif/CMakeLists.txt
19+
+++ b/irif/CMakeLists.txt
20+
@@ -11,12 +11,16 @@ file(GLOB sources
21+
22+
set(irif_lib_file ${CMAKE_CURRENT_BINARY_DIR}/irif.bc)
23+
24+
-# find_program(LLVM_LINK_EXECUTABLE NAMES llvm-link PATHS ${LLVM_CONFIG_DIR} NO_DEFAULT_PATH)
25+
-# if(NOT LLVM_LINK_EXECUTABLE)
26+
-# message(FATAL_ERROR "llvm-link not found")
27+
-# endif()
28+
-# add_executable(llvm-link IMPORTED)
29+
-# set_target_properties(llvm-link PROPERTIES IMPORTED_LOCATION ${LLVM_LINK_EXECUTABLE})
30+
+if(NOT DEFINED LLVM_LINK)
31+
+ find_program(LLVM_LINK NAMES llvm-link NO_DEFAULT_PATH PATHS ${CLANG_ROOT_PATH_BIN} ENV PATH)
32+
+ if(NOT LLVM_LINK)
33+
+ message(FATAL_ERROR "Can't find llvm-link. Please provide CMake argument -D$LLVM_LINK=/path/to/llvm-link<-version>")
34+
+ endif()
35+
+endif()
36+
+message(STATUS "Using llvm-link: ${LLVM_LINK}")
37+
+
38+
+add_executable(llvm-link IMPORTED)
39+
+set_target_properties(llvm-link PROPERTIES IMPORTED_LOCATION ${LLVM_LINK})
40+
41+
add_custom_command(OUTPUT ${irif_lib_file}
42+
COMMAND $<TARGET_FILE:llvm-link> ${sources} -o ${irif_lib_file}
43+
--
44+
2.45.2
45+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
From 81c0ab815785aa884e29aa7b7bc8a599185b4a6f Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
3+
4+
Date: Wed, 19 Jun 2024 07:42:16 +0200
5+
Subject: [PATCH] H4I-HipBLAS: Don't set CMAKE_INSTALL_RPATH
6+
MIME-Version: 1.0
7+
Content-Type: text/plain; charset=UTF-8
8+
Content-Transfer-Encoding: 8bit
9+
10+
Upstream-Status: Inappropriate [Yocto specific]
11+
Signed-off-by: Zoltán Böszörményi <[email protected]>
12+
---
13+
CMakeLists.txt | 1 -
14+
1 file changed, 1 deletion(-)
15+
16+
diff --git a/CMakeLists.txt b/CMakeLists.txt
17+
index ed479ac..aefcd15 100644
18+
--- a/CMakeLists.txt
19+
+++ b/CMakeLists.txt
20+
@@ -51,7 +51,6 @@ file(RELATIVE_PATH relRPath
21+
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}
22+
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}
23+
)
24+
-set(CMAKE_INSTALL_RPATH $ORIGIN $ORIGIN/${relRPath})
25+
26+
# Define a target capturing common configuration settings.
27+
# Although we use 'add_library' for this, it is not a library -
28+
--
29+
2.45.2
30+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
From 81e528767342d17e06851ea8a932cc8c07d991e9 Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
3+
4+
Date: Mon, 17 Jun 2024 13:50:00 +0200
5+
Subject: [PATCH] Use TARGET_SYS for offload compiler commands
6+
MIME-Version: 1.0
7+
Content-Type: text/plain; charset=UTF-8
8+
Content-Transfer-Encoding: 8bit
9+
10+
Upstream-Status: Inappropriate [Yocto specific]
11+
Signed-off-by: Zoltán Böszörményi <[email protected]>
12+
---
13+
CMakeLists.txt | 4 ++--
14+
1 file changed, 2 insertions(+), 2 deletions(-)
15+
16+
diff --git a/CMakeLists.txt b/CMakeLists.txt
17+
index 272e759e..ea989ca2 100644
18+
--- a/CMakeLists.txt
19+
+++ b/CMakeLists.txt
20+
@@ -493,14 +493,14 @@ set(HIP_OFFLOAD_COMPILE_OPTIONS_INSTALL_
21+
${HIP_ENABLE_SPIRV}
22+
${HIP_OFFLOAD_COMPILE_ONLY_OPTIONS_}
23+
--hip-path=${CMAKE_INSTALL_PREFIX}
24+
- ${HOST_ARCH}
25+
+ --target=${TARGET_SYS}
26+
${HIP_FIXUPS_HEADER_INSTALL})
27+
28+
set(HIP_OFFLOAD_COMPILE_OPTIONS_BUILD_
29+
${HIP_ENABLE_SPIRV}
30+
${HIP_OFFLOAD_COMPILE_ONLY_OPTIONS_}
31+
--hip-path=${CMAKE_BINARY_DIR}
32+
- ${HOST_ARCH}
33+
+ --target=${TARGET_SYS}
34+
${HIP_FIXUPS_HEADER_BUILD}
35+
-I${CMAKE_SOURCE_DIR}/include
36+
-I${CMAKE_SOURCE_DIR}/HIP/include
37+
--
38+
2.45.2
39+

0 commit comments

Comments
 (0)