Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions N/NEO/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,27 @@ const YGGDRASIL_DIR = "../.."
include(joinpath(YGGDRASIL_DIR, "fancy_toys.jl"))

name = "NEO"
version = v"24.26.30049"#.6
version = v"25.27.34303"#.5

# Collection of sources required to build this package.
sources = [
GitSource("https://github.com/intel/compute-runtime.git",
"e16f47e375e4324dae07aadbfe953002a1c45195"),
"d0fdeb0339afaa6db37411e10c41f291945aa727"),
# patches
DirectorySource("./bundled"),
]

# Bash recipe for building across all platforms
function get_script(; debug::Bool)
raw"""
# ocloc segfaults after successful build and before exiting. So we wrap
# a script around ocloc that detects when the build is reported
# successful and ignores the segfault.
atomic_patch -p0 ./patches/ocloc.patch
cp ocloc_wrapper.sh compute-runtime/shared/source/built_ins/kernels/ocloc_wrapper.sh
mkdir -p tmpdir
export TMPDIR=$(pwd)/tmpdir
export CCACHE_TEMPDIR=$(pwd)/tmpdir
cd compute-runtime
install_license LICENSE.md

Expand All @@ -34,8 +44,14 @@ function get_script(; debug::Bool)
## NO
sed -i '/-Werror/d' CMakeLists.txt

# Fails because C header is used in C++ code
sed -i 's/inttypes\.h/cinttypes/g' level_zero/core/source/mutable_cmdlist/mutable_indirect_data.cpp

CMAKE_FLAGS=()

# Need C++20
CMAKE_FLAGS+=(-DCMAKE_CXX_STANDARD=20)
Comment on lines +52 to +53
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also sounds like a patch for upstream. Downstream packagers should never set the C++ standard, that's the developers' business.

Copy link
Collaborator Author

@michel2323 michel2323 Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is actually set here: https://github.com/intel/compute-runtime/blob/d0fdeb0339afaa6db37411e10c41f291945aa727/CMakeLists.txt#L323 . So I'm a bit confused. I definitely get an error without explicitly setting it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is indeed confusing 😕


# Release build for best performance
CMAKE_FLAGS+=(-DCMAKE_BUILD_TYPE=""" * (debug ? "Debug" : "Release") * raw""")

Expand All @@ -62,7 +78,12 @@ function get_script(; debug::Bool)
export PKG_CONFIG_PATH=${prefix}/lib64/pkgconfig:${prefix}/lib/pkgconfig

cmake -B build -S . -GNinja ${CMAKE_FLAGS[@]}
ninja -C build -j ${nproc} install"""
ninja -C build -j ${nproc} install
# Create unversioned symlinks
ln -s libze_intel_gpu.so.1 ${libdir}/libze_intel_gpu.so
ln -s ocloc-25.27.1 ${bindir}/ocloc

"""
end

# These are the platforms we will build for by default, unless further
Expand All @@ -87,9 +108,9 @@ products = [
# when using a non-public release, refer to the compiled manifest
# https://github.com/intel/compute-runtime/blob/master/manifests/manifest.yml.
dependencies = [
Dependency("gmmlib_jll"; compat="=22.3.20"),
Dependency("libigc_jll"; compat="=1.0.17193"),
Dependency("oneAPI_Level_Zero_Headers_jll"; compat="=1.9.2"),
Dependency("gmmlib_jll"; compat="=22.8.1"),
Dependency("libigc_jll"; compat="=2.14.1"),
Dependency("oneAPI_Level_Zero_Headers_jll"; compat="=1.13"),
]

augment_platform_block = raw"""
Expand Down Expand Up @@ -134,7 +155,9 @@ for platform in platforms, debug in (false, true)

# GCC 4 has constexpr incompatibilities
# GCC 7 triggers: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79929
# Needs at least GCC 10 for C++20 support of 'concepts'
# Needs GCC 11 for std::make_unique_for_overwrite
build_tarballs(ARGS, name, version, sources, get_script(; debug), [augmented_platform],
products, dependencies; preferred_gcc_version=v"8", julia_compat = "1.6",
products, dependencies; preferred_gcc_version=v"11", julia_compat = "1.6",
augment_platform_block)
end
51 changes: 51 additions & 0 deletions N/NEO/bundled/ocloc_wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

# Run ocloc and capture output and exit code
echo "Running ocloc with args: $@" >&2
output=$("$@" 2>&1)
exit_code=$?

# Print the output for debugging
echo "$output" >&2

# Check if compilation was successful despite segfault
if echo "$output" | grep -q "Build succeeded" || echo "$output" | grep -q "Compilation from IR"; then
echo "ocloc compilation succeeded (ignoring segfault during cleanup)" >&2
exit 0
fi

# Check if output files were created (another indication of success)
if [ "$exit_code" -ne 0 ]; then
# Look for output files that might have been created
for arg in "$@"; do
case "$arg" in
-out_dir)
next_is_outdir=true
;;
-output)
next_is_output=true
;;
*)
if [ "$next_is_outdir" = true ]; then
outdir="$arg"
next_is_outdir=false
elif [ "$next_is_output" = true ]; then
output_name="$arg"
next_is_output=false
fi
;;
esac
done

# Check if output files exist
if [ -n "$outdir" ] && [ -n "$output_name" ]; then
if ls "$outdir"/"$output_name"* 2>/dev/null | grep -q .; then
echo "ocloc output files found, considering compilation successful" >&2
exit 0
fi
fi
fi

# If we get here, the compilation actually failed
echo "ocloc compilation failed" >&2
exit $exit_code
31 changes: 31 additions & 0 deletions N/NEO/bundled/patches/ocloc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/shared/source/built_ins/kernels/CMakeLists.txt b/shared/source/built_ins/kernels/CMakeLists.txt
index b86efe3a01..34529921f6 100644
--- compute-runtime/shared/source/built_ins/kernels/CMakeLists.txt
+++ compute-runtime/shared/source/built_ins/kernels/CMakeLists.txt
@@ -80,7 +80,7 @@ function(compile_builtin core_type platform_it builtin bits builtin_options mode
set(INTERNAL_OPTIONS "${${mode}_INTERNAL_OPTIONS}")
add_custom_command(
OUTPUT ${OUTPUT_FILE_SPV}
- COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -spv_only -device ${platform_it_lower} -heapless_mode ${heapless_mode} ${builtin_options} -${bits} -output ${mode}_${BASENAME} -out_dir ${OUTPUTDIR} ${INTERNAL_OPTIONS} -options "$<JOIN:${__ocloc__options__}, >"
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ocloc_wrapper.sh ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -spv_only -device ${platform_it_lower} -heapless_mode ${heapless_mode} ${builtin_options} -${bits} -output ${mode}_${BASENAME} -out_dir ${OUTPUTDIR} ${INTERNAL_OPTIONS} -options "$<JOIN:${__ocloc__options__}, >"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${builtin} ocloc copy_compiler_files
)
@@ -111,7 +111,7 @@ function(compile_builtin core_type platform_it builtin bits builtin_options mode
get_filename_component(absolute_filepath_spv ${OUTPUT_FILE_SPV} ABSOLUTE)
add_custom_command(
OUTPUT ${OUTPUT_FILES_BINARIES}
- COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath_spv} -spirv_input -device ${RELEASE} -heapless_mode ${heapless_mode} ${builtin_options} -${bits} -stateful_address_mode ${stateful_address_mode} -output ${mode}_${BASENAME}_${RELEASE_FILENAME} -output_no_suffix -out_dir ${OUTPUTDIR} ${INTERNAL_OPTIONS} -options "$<JOIN:${__ocloc__options__}, >"
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ocloc_wrapper.sh ${ocloc_cmd_prefix} -q -file ${absolute_filepath_spv} -spirv_input -device ${RELEASE} -heapless_mode ${heapless_mode} ${builtin_options} -${bits} -stateful_address_mode ${stateful_address_mode} -output ${mode}_${BASENAME}_${RELEASE_FILENAME} -output_no_suffix -out_dir ${OUTPUTDIR} ${INTERNAL_OPTIONS} -options "$<JOIN:${__ocloc__options__}, >"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${OUTPUT_FILE_SPV} ocloc copy_compiler_files ${OUTPUT_FILES_BINARIES_PREV}
)
@@ -165,7 +165,7 @@ function(generate_cpp_spirv builtin)
if(NOT NEO_DISABLE_BUILTINS_COMPILATION)
add_custom_command(
OUTPUT ${GENERATED_SPV_INPUT}
- COMMAND ${ocloc_cmd_prefix} -q -spv_only -file ${absolute_filepath} -out_dir ${OUTPUTDIR} -output_no_suffix -options "-cl-kernel-arg-info"
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ocloc_wrapper.sh ${ocloc_cmd_prefix} -q -spv_only -file ${absolute_filepath} -out_dir ${OUTPUTDIR} -output_no_suffix -options "-cl-kernel-arg-info"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${INPUT_FILENAME} ocloc copy_compiler_files ${OUTPUT_FILES_SPIRV_PREV}
)