diff --git a/dev-libs/intel-compute-runtime/files/00-clang-compat.patch b/dev-libs/intel-compute-runtime/files/00-clang-compat.patch new file mode 100644 index 0000000..c9590b7 --- /dev/null +++ b/dev-libs/intel-compute-runtime/files/00-clang-compat.patch @@ -0,0 +1,15 @@ +--- a/shared/source/os_interface/os_library.h ++++ b/shared/source/os_interface/os_library.h +@@ -8,2 +8,3 @@ + #pragma once ++#include "uchar_string_traits.hpp" + #include + +--- a/level_zero/core/source/kernel/kernel_shared_state.h ++++ b/level_zero/core/source/kernel/kernel_shared_state.h +@@ -11,4 +11,1 @@ +- +-namespace std { +-class mutex; +-} ++#include diff --git a/dev-libs/intel-compute-runtime/files/uchar_string_traits.hpp b/dev-libs/intel-compute-runtime/files/uchar_string_traits.hpp new file mode 100644 index 0000000..b83ec79 --- /dev/null +++ b/dev-libs/intel-compute-runtime/files/uchar_string_traits.hpp @@ -0,0 +1,92 @@ +// uchar_string_traits.hpp +#pragma once +#include +#include +#include +#include +#include + +static_assert(sizeof(unsigned char) == 1, "Assumes 8-bit unsigned char"); + +namespace std { + +// Пользовательская специализация char_traits для unsigned char. +// Разрешено стандартом, т.к. char_traits предназначен для специализации. +template<> +struct char_traits { + using char_type = unsigned char; + using int_type = int; // согласовано с базовой специализацией + using off_type = std::streamoff; + using pos_type = std::streampos; + using state_type = std::mbstate_t; + + static void assign(char_type& r, const char_type& a) noexcept { r = a; } + static constexpr bool eq(char_type a, char_type b) noexcept { return a == b; } + static constexpr bool lt(char_type a, char_type b) noexcept { return a < b; } + + static int compare(const char_type* s1, const char_type* s2, size_t n) noexcept { + for (size_t i = 0; i < n; ++i) { + if (lt(s1[i], s2[i])) return -1; + if (lt(s2[i], s1[i])) return 1; + } + return 0; + } + + static size_t length(const char_type* s) noexcept { + // Ищем нуль-терминатор (0), как в C-строках + size_t i = 0; + while (s[i] != 0) ++i; + return i; + } + + static const char_type* find(const char_type* s, size_t n, const char_type& a) noexcept { + for (size_t i = 0; i < n; ++i) + if (eq(s[i], a)) return s + i; + return nullptr; + } + + static char_type* move(char_type* s1, const char_type* s2, size_t n) noexcept { + if (s1 == s2 || n == 0) return s1; + // корректно обрабатываем перекрытие + std::memmove(s1, s2, n); + return s1; + } + + static char_type* copy(char_type* s1, const char_type* s2, size_t n) noexcept { + if (n) std::memcpy(s1, s2, n); + return s1; + } + + static char_type* assign(char_type* s, size_t n, char_type a) noexcept { + if (n) std::memset(s, a, n); + return s; + } + + static constexpr int_type to_int_type(char_type c) noexcept { + return static_cast(c); + } + + static constexpr char_type to_char_type(int_type c) noexcept { + return static_cast(static_cast(c) & 0xFFu); + } + + static constexpr bool eq_int_type(int_type c1, int_type c2) noexcept { + return c1 == c2; + } + + static constexpr int_type eof() noexcept { + return -1; + } + + static constexpr int_type not_eof(int_type c) noexcept { + return (c == eof()) ? 0 : c; + } +}; + +} // namespace std + +// Удобный вывод: печатаем как байты/символы ASCII (без гарантий по локали) +inline std::ostream& operator<<(std::ostream& os, const std::basic_string& s) { + for (unsigned char ch : s) os.put(static_cast(ch)); + return os; +} diff --git a/dev-libs/intel-compute-runtime/intel-compute-runtime-25.40.9999.ebuild b/dev-libs/intel-compute-runtime/intel-compute-runtime-25.40.9999.ebuild new file mode 100644 index 0000000..b35a882 --- /dev/null +++ b/dev-libs/intel-compute-runtime/intel-compute-runtime-25.40.9999.ebuild @@ -0,0 +1,100 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +CMAKE_BUILD_TYPE="Release" +MY_PN="${PN/intel-/}" +MY_P="${MY_PN}-${PV}" + +inherit cmake flag-o-matic git-r3 + +DESCRIPTION="Intel Graphics Compute Runtime for oneAPI Level Zero and OpenCL Driver" +HOMEPAGE="https://github.com/intel/compute-runtime" + +#SRC_URI="https://github.com/intel/${MY_PN}/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz" +EGIT_REPO_URI="https://github.com/intel/${MY_PN}.git" +EGIT_OVERRIDE_BRANCH_INTEL_COMPUTE_RUNTIME="releases/25.40" +EGIT_SUBMODULES=() + +S="${WORKDIR}/${PN}-${PV}" + +LICENSE="MIT" +SLOT="0/1.6" +KEYWORDS="~amd64" +IUSE="disable-mitigations +l0 +vaapi test" + +RDEPEND=" + !dev-libs/intel-compute-runtime:legacy + >=dev-util/intel-graphics-compiler-2.19.1:0 + !dev-util/intel-graphics-compiler:legacy + >=media-libs/gmmlib-22.7.1:= + + dev-libs/intel-metrics-discovery:= + >=dev-libs/intel-metrics-library-1.0.200:= + dev-libs/libnl:3 + dev-libs/libxml2:2 + >=dev-util/intel-graphics-system-controller-0.9.6:= + media-libs/mesa + >=virtual/opencl-3 + l0? ( >=dev-libs/level-zero-1.24.2:= ) + vaapi? ( + x11-libs/libdrm[video_cards_intel] + media-libs/libva + ) + test? ( ${CATEGORY}/${PN}:${SLOT} ) +" + +BDEPEND="virtual/pkgconfig" + +DOCS=( "README.md" "FAQ.md" ) + +#PATCHES=( +# "${FILESDIR}/${PN}-test.patch" +#) + +src_prepare() { + # Remove '-Werror' from default + sed -e '/Werror/d' -i CMakeLists.txt || die + + # uchar + [[ ${CC} == *clang* ]] && \ + cp "${FILESDIR}/uchar_string_traits.hpp" "${S}/shared/source/os_interface/" && \ + eapply "${FILESDIR}/00-clang-compat.patch" + + cmake_src_prepare +} + +src_configure() { + # Filtered for two reasons: + # 1) https://github.com/intel/compute-runtime/issues/528 + # 2) bug #930199 + filter-lto + + local mycmakeargs=( + -DCCACHE_ALLOWED="OFF" + -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr" + -DCMAKE_INSTALL_LIBDIR="$(get_libdir)" + -DBUILD_WITH_L0="$(usex l0)" + -DDISABLE_LIBVA="$(usex !vaapi)" + -DNEO_ALLOW_LEGACY_PLATFORMS_SUPPORT="ON" + -DNEO_DISABLE_LTO="ON" + -DNEO_DISABLE_MITIGATIONS="$(usex disable-mitigations)" + -DNEO_ENABLE_REFERENCE_TRACKING="OFF" + -DNEO__METRICS_LIBRARY_INCLUDE_DIR="${ESYSROOT}/usr/include" + -DKHRONOS_GL_HEADERS_DIR="${ESYSROOT}/usr/include" + -DOCL_ICD_VENDORDIR="${EPREFIX}/etc/OpenCL/vendors" + -DSUPPORT_DG1="ON" + -Wno-dev + + # See https://github.com/intel/intel-graphics-compiler/issues/204 + # -DNEO_DISABLE_BUILTINS_COMPILATION="ON" + + # If enabled, tests are automatically run during + # the compile phase and we cannot run them because + # they require permissions to access the hardware. + -DSKIP_UNIT_TESTS="$(usex !test)" + ) + + cmake_src_configure +}