Skip to content

Commit 501db6d

Browse files
Aarch64 support
1 parent eaa37b5 commit 501db6d

4 files changed

Lines changed: 68 additions & 1 deletion

File tree

conda-forge.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@ github:
1313
tooling_branch_name: main
1414
provider:
1515
linux_aarch64: default
16-
linux_ppc64le: false
1716
test: native_and_emulated

recipe/build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ if [[ "${target_platform}" == linux* ]]; then
3232

3333
if [[ "${target_platform}" != "${build_platform}" ]]; then
3434
cmake_extra_args+=("-DACPP_HOST_FORCE_MCPU_TARGET=generic")
35+
# Cross build: device libkernel bitcode is target-independent but is
36+
# compiled/linked on the build host, so use build-native clang/llvm-link.
37+
# CLANG_EXECUTABLE_PATH stays on the target toolchain for the runtime config.
38+
cmake_extra_args+=("-DACPP_BITCODE_CLANG=${BUILD_PREFIX}/bin/clang++-${llvm_version}")
39+
cmake_extra_args+=("-DACPP_BITCODE_LLVM_LINK=${BUILD_PREFIX}/bin/llvm-link")
3540
fi
3641

3742
test -f "${PREFIX}/include/spirv/unified1/spirv.hpp"
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
From 7ae15bf526f06b5e6c18e9f908b6c58236f7c6a4 Mon Sep 17 00:00:00 2001
2+
From: conda-forge <noreply@conda-forge.org>
3+
Date: Fri, 24 Jul 2026 10:00:23 +0200
4+
Subject: [PATCH] Use build-native tools for device bitcode when
5+
cross-compiling
6+
7+
The SSCP libkernel bitcode is target-independent (the device triple is
8+
passed explicitly) but is generated on the build host. Route the clang and
9+
llvm-link invocations through ACPP_BITCODE_CLANG / ACPP_BITCODE_LLVM_LINK,
10+
which default to the target tools for native builds and can be overridden
11+
with build-native tools when cross-compiling (e.g. linux-aarch64 on x86_64).
12+
---
13+
src/libkernel/sscp/CMakeLists.txt | 15 +++++++++++++--
14+
1 file changed, 13 insertions(+), 2 deletions(-)
15+
16+
diff --git a/src/libkernel/sscp/CMakeLists.txt b/src/libkernel/sscp/CMakeLists.txt
17+
index 672553a..7ab74f4 100644
18+
--- a/src/libkernel/sscp/CMakeLists.txt
19+
+++ b/src/libkernel/sscp/CMakeLists.txt
20+
@@ -1,3 +1,14 @@
21+
+# Cross-compilation: the device bitcode below is target-independent (the
22+
+# device triple is set explicitly), but it is generated on the *build* host.
23+
+# Use build-native clang/llvm-link so they can execute when cross-compiling,
24+
+# while CLANG_EXECUTABLE_PATH stays pointed at the target toolchain for the
25+
+# runtime configuration. Both default to the target tools for native builds.
26+
+if(NOT ACPP_BITCODE_CLANG)
27+
+ set(ACPP_BITCODE_CLANG "${CLANG_EXECUTABLE_PATH}")
28+
+endif()
29+
+if(NOT ACPP_BITCODE_LLVM_LINK)
30+
+ set(ACPP_BITCODE_LLVM_LINK "${LLVM_TOOLS_BINARY_DIR}/llvm-link")
31+
+endif()
32+
33+
function(libkernel_generate_bitcode_library)
34+
set(options)
35+
@@ -32,7 +43,7 @@ function(libkernel_generate_bitcode_library)
36+
37+
add_custom_command(
38+
OUTPUT ${target_output_file}
39+
- COMMAND ${CLANG_EXECUTABLE_PATH} -target ${triple} -fno-exceptions -fno-rtti -O3 -emit-llvm -std=c++17 -DHIPSYCL_SSCP_LIBKERNEL_LIBRARY
40+
+ COMMAND ${ACPP_BITCODE_CLANG} -target ${triple} -fno-exceptions -fno-rtti -O3 -emit-llvm -std=c++17 -DHIPSYCL_SSCP_LIBKERNEL_LIBRARY
41+
-I ${HIPSYCL_SOURCE_DIR}/include ${additional} ${platform_specific} -o ${target_output_file} -c ${CMAKE_CURRENT_SOURCE_DIR}/${source}
42+
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${source} ${target_depends}
43+
VERBATIM)
44+
@@ -77,7 +88,7 @@ function(libkernel_generate_bitcode_target)
45+
set(linked_output ${CMAKE_CURRENT_BINARY_DIR}/libkernel-sscp-${target}-full.bc)
46+
add_custom_command(
47+
OUTPUT ${linked_output}
48+
- COMMAND ${LLVM_TOOLS_BINARY_DIR}/llvm-link -o=${linked_output} ${output_files}
49+
+ COMMAND ${ACPP_BITCODE_LLVM_LINK} -o=${linked_output} ${output_files}
50+
DEPENDS ${output_files} ${target_depends}
51+
)
52+
53+
--
54+
2.53.0
55+

recipe/recipe.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ source:
1919
then: patches/0002-Fall-back-missing-functions.patch
2020
- if: linux
2121
then: patches/0003-Use-packaged-dependency-sources.patch
22+
- if: linux
23+
then: patches/0004-Cross-compile-native-bitcode-tools.patch
2224
- if: linux and llvm_version == "16"
2325
then:
2426
url: https://github.com/AdaptiveCpp/SPIRV-LLVM-Translator/archive/d678e6a2a95849c9985c8d209f67b318999083c6.tar.gz
@@ -80,6 +82,12 @@ requirements:
8082
then: ${{ compiler("cuda") }}
8183
- if: cuda_compiler_version != "None" and build_platform != target_platform
8284
then: cuda-cudart-dev
85+
# Cross builds compile the device bitcode with build-native clang/llvm-link
86+
# (see ACPP_BITCODE_* in build.sh).
87+
- if: build_platform != target_platform and linux
88+
then: clangdev ${{ llvm_version }}.*
89+
- if: build_platform != target_platform and linux
90+
then: llvm-tools ${{ llvm_version }}.*
8391
host:
8492
- clangdev
8593
- if: linux and x86_64

0 commit comments

Comments
 (0)