diff --git a/N/NEO/build_tarballs.jl b/N/NEO/build_tarballs.jl index 401dc5eaea9..b78418da5ce 100644 --- a/N/NEO/build_tarballs.jl +++ b/N/NEO/build_tarballs.jl @@ -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 @@ -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) + # Release build for best performance CMAKE_FLAGS+=(-DCMAKE_BUILD_TYPE=""" * (debug ? "Debug" : "Release") * raw""") @@ -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 @@ -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""" @@ -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 diff --git a/N/NEO/bundled/ocloc_wrapper.sh b/N/NEO/bundled/ocloc_wrapper.sh new file mode 100755 index 00000000000..1c82b309b95 --- /dev/null +++ b/N/NEO/bundled/ocloc_wrapper.sh @@ -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 diff --git a/N/NEO/bundled/patches/ocloc.patch b/N/NEO/bundled/patches/ocloc.patch new file mode 100644 index 00000000000..94998d6e01b --- /dev/null +++ b/N/NEO/bundled/patches/ocloc.patch @@ -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 "$" ++ 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 "$" + 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 "$" ++ 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 "$" + 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} + )