Documented tree replacement (the history has no git-subtree metadata): 3-way merge of the old subtree (570201a:engine/strata) against upstream 41cf05a06a25dd29103b7b27a2279a3f60c21876 (2026-10-25), merge base = the old pin d9ab8435 (tree-identical to upstream 5b734e42; d9ab8435 is not an ancestor of upstream main). Local patches re-applied by hand where they conflicted (15 files): STRATA_CUDA_STATIC profile, experimental KAR experts and KAR PLE arms, keyless V-only arm (now beside upstream's K8V4 hybrid KV and fused norm+rope). Details, conflict table and left-out files are in docs/upstream.md. Left out (weights, captures, logs, media): new bench/results (2022 files), binary media and app assets (61), docs/work/evidence (24), *.bin / *.gguf data files, and the 7 files the first import already left out. scripts/build-cpu.sh: build the 11 CPU tests upstream registered since the old pin (they ran as "Not Run"). Checked: build-cpu.sh 16/16 ctest in WSL; sm_86 CUDA objects of the patched files compile, also with the KAR macros on. No GPU run, no quality gate. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
122 lines
3.2 KiB
C++
122 lines
3.2 KiB
C++
//==---- lib_common_utils.hpp ---------------------*- C++ -*----------------==//
|
|
//
|
|
// Copyright (C) Intel Corporation
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef __DPCT_LIB_COMMON_UTILS_HPP__
|
|
#define __DPCT_LIB_COMMON_UTILS_HPP__
|
|
|
|
#include "compat_service.hpp"
|
|
|
|
#if defined(__has_include) && __has_include(<oneapi/math.hpp>)
|
|
#include <oneapi/math.hpp>
|
|
#include <oneapi/mkl/namespace_alias.hpp>
|
|
#elif defined(__has_include) && __has_include(<oneapi/mkl.hpp>)
|
|
#include <oneapi/mkl.hpp>
|
|
#elif defined(__has_include)
|
|
#error "SYCLomatic runtime requires oneMath/oneMKL support"
|
|
#else
|
|
#error "SYCLomatic runtime requires __has_include support"
|
|
#endif
|
|
|
|
namespace dpct {
|
|
|
|
enum class version_field : int { major, minor, update, patch };
|
|
|
|
/// Returns the requested field of Intel(R) oneAPI Math Kernel Library version.
|
|
/// \param field The version information field (major, minor, update or patch).
|
|
/// \param result The result value.
|
|
inline void mkl_get_version(version_field field, int *result) {
|
|
#ifndef __INTEL_MKL__
|
|
throw std::runtime_error("The oneAPI Math Kernel Library (oneMKL) Interfaces "
|
|
"Project does not support this API.");
|
|
#else
|
|
MKLVersion version;
|
|
mkl_get_version(&version);
|
|
if (version_field::major == field) {
|
|
*result = version.MajorVersion;
|
|
} else if (version_field::minor == field) {
|
|
*result = version.MinorVersion;
|
|
} else if (version_field::update == field) {
|
|
*result = version.UpdateVersion;
|
|
} else if (version_field::patch == field) {
|
|
*result = 0;
|
|
} else {
|
|
throw std::runtime_error("unknown field");
|
|
}
|
|
#endif
|
|
}
|
|
|
|
enum class library_data_t : unsigned char {
|
|
real_float = 0,
|
|
complex_float,
|
|
real_double,
|
|
complex_double,
|
|
real_half,
|
|
complex_half,
|
|
real_bfloat16,
|
|
complex_bfloat16,
|
|
real_int4,
|
|
complex_int4,
|
|
real_uint4,
|
|
complex_uint4,
|
|
real_int8,
|
|
complex_int8,
|
|
real_uint8,
|
|
complex_uint8,
|
|
real_int16,
|
|
complex_int16,
|
|
real_uint16,
|
|
complex_uint16,
|
|
real_int32,
|
|
complex_int32,
|
|
real_uint32,
|
|
complex_uint32,
|
|
real_int64,
|
|
complex_int64,
|
|
real_uint64,
|
|
complex_uint64,
|
|
real_int8_4,
|
|
real_int8_32,
|
|
real_uint8_4,
|
|
real_f8_e4m3,
|
|
real_f8_e5m2,
|
|
library_data_t_size
|
|
};
|
|
|
|
enum class compute_type : int {
|
|
f16,
|
|
f16_standard,
|
|
f32,
|
|
f32_standard,
|
|
f32_fast_bf16,
|
|
f32_fast_tf32,
|
|
f64,
|
|
f64_standard,
|
|
i32,
|
|
i32_standard,
|
|
};
|
|
|
|
#ifdef DPCT_USM_LEVEL_NONE
|
|
/// Cast a "rvalue reference to a temporary object" to an "lvalue reference to
|
|
/// that temporary object".
|
|
/// CAUTION:
|
|
/// The returned lvalue reference is available only before the last step in
|
|
/// evaluating the full-expression that contains this function call.
|
|
/// \param [in] temporary_object The rvalue reference to a temporary object.
|
|
/// \returns The lvalue reference to that temporary object.
|
|
template <typename T>
|
|
inline typename std::enable_if_t<std::is_rvalue_reference_v<T &&>, T &>
|
|
rvalue_ref_to_lvalue_ref(T &&temporary_object) {
|
|
return temporary_object;
|
|
}
|
|
#endif
|
|
} // namespace dpct
|
|
|
|
#include "detail/lib_common_utils_detail.hpp"
|
|
|
|
#endif // __DPCT_LIB_COMMON_UTILS_HPP__
|