Files
leleka/engine/strata/sycl/include/dpct/dpct.hpp
T
Pavlo RatushnyiandClaude Sonnet 5.5 87e2633afe engine/strata: bring the Strata subtree to upstream 41cf05a0 (engine 0.1.50) with the local patches re-applied
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>
2026-10-25 12:49:15 +01:00

105 lines
4.5 KiB
C++

//==---- dpct.hpp ---------------------------------*- C++ -*----------------==//
//
// Copyright (C) Intel Corporation
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// See https://llvm.org/LICENSE.txt for license information.
//
//===----------------------------------------------------------------------===//
// clang-format off
/*
There are 3 macros that can be used to control the behavior of the helper
function files.
+========================+=========================+===========================+
| | Helper function files | Helper function files |
| Macro Name | Used in dpct migrated | Used in direct |
| | code | programming |
+========================+=========================+===========================+
| DPCT_USM_LEVEL_NONE | USM by default. | USM by default. |
| (Use USM or SYCL | Use SYCL Buffer by | Define it explicitly to |
| buffer) | running dpct with | use the SYCL buffer. |
| | "--use-level=none". | |
+------------------------+-------------------------+---------------------------+
| DPCT_PROFILING_ENABLED | Enabled heuristically | Disable by default. |
| (Enable SYCL queue | depends on the input | Define it explicitly to |
| profiling) | code. | enable. |
| | Enable explicitly by | |
| | running dpct with | |
| | "--enable-profiling". | |
| | Disable by removing the | |
| | macro definition | |
| | manually. | |
+------------------------+-------------------------+---------------------------+
| DPCT_HELPER_VERBOSE | Disable by default. | Disable by default. |
| (Verbose option) | Define it explicitly to | Define it explicitly to |
| | enable. | enable. |
+========================+=========================+===========================+
*/
// clang-format on
#ifndef __DPCT_HPP__
#define __DPCT_HPP__
#include <sycl/sycl.hpp>
#include <iostream>
#include <limits.h>
#include <math.h>
template <class... Args> class dpct_kernel_name;
template <int Arg> class dpct_kernel_scalar;
#include "atomic.hpp"
#include "device.hpp"
#include "image.hpp"
#include "kernel.hpp"
#include "math.hpp"
#include "memory.hpp"
#include "util.hpp"
#include "bindless_images.hpp"
#include "graph.hpp"
#include "ze_utils.hpp"
#define USE_DPCT_HELPER 1
#if defined(_MSC_VER)
#define __dpct_align__(n) __declspec(align(n))
#define __dpct_inline__ __forceinline
#else
#define __dpct_align__(n) __attribute__((aligned(n)))
#define __dpct_inline__ __inline__ __attribute__((always_inline))
#endif
#if defined(_MSC_VER)
#define __dpct_noinline__ __declspec(noinline)
#else
#define __dpct_noinline__ __attribute__((noinline))
#endif
#define DPCT_COMPATIBILITY_TEMP (900)
namespace dpct {
enum error_code { success = 0, default_error = 999 };
/// A dummy function introduced to assist auto migration.
/// The migration tool user should replace it with a real error-handling function.
/// SYCL reports errors using exceptions and does not use error codes.
inline const char *get_error_string_dummy(int ec) {
return ec == 0 ? "no error" : "error"; // SYCL has no error codes: DPCT_CHECK_ERROR yields 0 on success
}
} // namespace dpct
#define DPCT_CHECK_ERROR(expr) \
[&]() { \
try { \
expr; \
return dpct::success; \
} catch (std::exception const &e) { \
std::cerr << e.what() << std::endl; \
return dpct::default_error; \
} \
}()
#define DPCT_PI_F (3.14159274101257f)
#define DPCT_PI (3.141592653589793115998)
#endif // __DPCT_HPP__