Archived
libxe2: the Intel kernel library's skeleton, and its first op, add
libxe2 is a kernel plugin like any other, built by rad_add_plugin from the icpx sub-build into the build tree's $RADIANCE_HOME. It declares no schemas (every op it serves is libref's vocabulary), only device rows, written with designated initialisers. xe2_common.h holds what every kernel needs: the launch's queue (rad_sycl.h), row views over padded operands, refusals that name the geometry, and libref's own dtype conversions so results round where the reference's do. add passes rad-kbench against libref at tolerance zero, on the recorded fixture (30 cases) and on MiniCPM5-2B's container (20 cases), inside guarded allocations. In a SYCL build the kbench replays run libxe2 on the card, so they are labelled sycl there, as they are gpu in a HIP build. scripts/sycl/notify.sh posts to the Discord webhook when the port needs the user. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
This commit is contained in:
1 parent
8addda231b
commit
ea065f596c
11 files changed
+362
-10
No files matched your search
+3
-1
@@ -320,7 +320,8 @@ endif()
|
||||
|
||||
# ---------------------------------------------------------------- the icpx sub-build
|
||||
# sycl/ is its own CMake project, configured with icpx, so -fsycl code never meets this project's
|
||||
# compiler. rad_core links librad_sycl.so (the device backend) as an imported library.
|
||||
# compiler. rad_core links librad_sycl.so (the device backend) as an imported library; the kernel
|
||||
# library libxe2 lands in ${RAD_PLUGIN_OUT}/kernels beside the others.
|
||||
if(RAD_SYCL_FOUND)
|
||||
include(ExternalProject)
|
||||
set(RAD_SYCL_BINARY_DIR ${CMAKE_BINARY_DIR}/sycl)
|
||||
@@ -331,6 +332,7 @@ if(RAD_SYCL_FOUND)
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DRAD_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
|
||||
-DRAD_SYCL_TARGETS=${RAD_SYCL_TARGETS}
|
||||
-DRAD_PLUGIN_OUT=${RAD_PLUGIN_OUT}
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||
BUILD_ALWAYS ON
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
+53
-9
@@ -17,7 +17,10 @@ from it alone.
|
||||
|
||||
## Open blockers / questions for the user
|
||||
|
||||
1. **No `.rad` container for any milestone model is in `/mnt/model-library`.**
|
||||
1. ~~**No `.rad` container for any milestone model is in `/mnt/model-library`.**~~ Resolved for bf16
|
||||
(2026-10-23): `StillDeadcode/minicpm5-2b-bf16/minicpm5-2b-bf16.rad` (5,501,632,512 bytes) appeared;
|
||||
copied to `/models/minicpm5-2b-bf16/` and verified with `cmp`. **Still missing: `minicpm5-2b-fp8.rad`**
|
||||
(Milestone B). Original note:
|
||||
`StillDeadcode/minicpm5-2b-bf16/` holds only `README.md` and `minicpm5-2b-bf16-dspark.recipe`; there
|
||||
is no `minicpm5-2b-bf16.rad`, no `minicpm5-2b-fp8.rad`, and no raw `openbmb/MiniCPM5-2B` /
|
||||
`MiniCPM5-2B-DSpark` checkpoint to convert from. A `find -iname '*.rad'` over the library and
|
||||
@@ -31,9 +34,9 @@ from it alone.
|
||||
brought up and compared against the host backend on until the real containers exist.
|
||||
Optionally, `HuggingFaceTB/SmolLM2-135M` (real bf16 llama weights, head_dim 64, tied embeddings)
|
||||
could be converted as a real-weights check; that needs the user's OK, since it is a conversion.
|
||||
3. **No ROCm on this machine** (`hipcc` absent, no `/opt/rocm`). "The HIP build must still compile"
|
||||
cannot be checked here; it needs a ROCm host or a ROCm container (the repo's `Dockerfile` may
|
||||
serve). Until then, HIP-side edits are kept to a minimum and listed below for review.
|
||||
3. **No ROCm on this machine** (`hipcc` absent, no `/opt/rocm`), and `sudo` needs a password. The user
|
||||
authorized installing what is needed; the HIP compile check runs in docker instead
|
||||
(`rocm/dev-ubuntu-24.04:10.1.0-full`, the Dockerfile's base, stock clang; see "HIP compile check").
|
||||
|
||||
## Phase 0 results (2026-10-23)
|
||||
|
||||
@@ -236,13 +239,54 @@ Planned use: Milestone A = `minicpm5-2b-bf16.rad` (blocked, item 1); Milestone B
|
||||
- SYCL build, `ctest -LE 'gpu|oot'` with the oneAPI environment loaded (card present, hidden):
|
||||
83/88, the baseline's failures (FFmpeg, CPU budgets); `trigger_test`'s load flake did not occur.
|
||||
|
||||
## libxe2 (started 2026-10-23)
|
||||
|
||||
`libxe2/` is built by the sycl sub-build with `rad_add_plugin` into `radiance_home/kernels`
|
||||
(`xe2_common.h`: queue, row views, refusals; `xe2_rows.cpp`: rows with designated initialisers).
|
||||
Ops so far: `add`.
|
||||
|
||||
**The correctness check for every op is `rad-kbench`**: it replays each kernel against libref's
|
||||
recorded answers on seeded inputs inside guarded allocations (`data/kernels.rkb`, recorded from
|
||||
qwen3.8-27b; `kernels_moe.rkb`), at the project's per-op tolerances, and with `-m` against a real
|
||||
container at its geometry. In a SYCL build the `kbench` and `kbench_moe` tests are labelled
|
||||
`kbench;sycl` (card tier), as they are `kbench;gpu` in a HIP build. Per op:
|
||||
|
||||
```sh
|
||||
. /opt/intel/oneapi/setvars.sh
|
||||
RADIANCE_SYCL_TIMING=1 RADIANCE_HOME=$PWD/build-sycl/radiance_home build-sycl/bin/rad-kbench --op <op>
|
||||
RADIANCE_SYCL_TIMING=1 RADIANCE_HOME=$PWD/build-sycl/radiance_home build-sycl/bin/rad-kbench \
|
||||
-m /models/minicpm5-2b-bf16/minicpm5-2b-bf16.rad --num-speculative-tokens 0 --op <op>
|
||||
```
|
||||
|
||||
`add`: fixture 30/30 and MiniCPM5 20/20, worst rel_l2 0, no writes outside guarded allocations.
|
||||
`ctest -L '^sycl$'` (device_test_sycl, kbench, kbench_moe): 3/3 on the B65.
|
||||
|
||||
In a SYCL build the host tier is `ctest -LE 'gpu|oot|sycl'` (kbench moved to the card tier).
|
||||
|
||||
### MiniCPM5-2B bf16, the real container (`--debug-graph`, host backend)
|
||||
|
||||
42 layers, n_embd 2048, 16 q / 2 kv heads, head_dim 128 (gqa 8), ffn 6144, vocab 130560, rope theta
|
||||
5e6 neox, eps 1e-6. With `--num-speculative-tokens 0`: 523 ops, exactly the 13 + 13 of
|
||||
`SYCL_PORTING.md` §3.1 (gemm_nt at N,K = 2560x2048 qkv, 2048x2048 o, 12288x2048 gate_up,
|
||||
2048x6144 down; logits 130560x2048). With its DSpark drafter (default, depth 7): 619 ops, adding
|
||||
`gemm_nt_q` fp8a8 (128x128 blocks) and `w2a8` (the 2-bit head), `gemm_nt_q_gated`, `silu_mul`,
|
||||
`quant_act_i8`, `row_topk` (N 130560, R 16), `dflash_select`, a non-causal `attn_paged`, and
|
||||
`rmsnorm` n=128. Milestone A runs with speculation off first; the drafter's ops are Milestone B.
|
||||
|
||||
## Next steps
|
||||
|
||||
1. `libxe2/` skeleton built by the icpx sub-build, installed under `radiance_home/kernels`, with one
|
||||
op (`add`) and a libref-checked test on the card (`sycl` label); its `oot` rebuild.
|
||||
2. `code_runs` under SYCL from `build_target` (D4), so a host-only build target never claims the card.
|
||||
3. Phase 3: the 13 + 13 ops of `SYCL_PORTING.md` §3.1, each with a libref test, then the tiny
|
||||
llama end to end against the host backend.
|
||||
1. Phase 3, Milestone A's 13 + 13 ops in libxe2, each passing `rad-kbench` (fixture and MiniCPM5),
|
||||
correctness-first kernels. Order: elementwise/norm/rope/cast/embed/gather, sampler, gemm_nt and
|
||||
logits_gemm, kv_store and attn_paged.
|
||||
2. Then serve MiniCPM5 on the B65 with `--num-speculative-tokens 0` and compare greedy output with
|
||||
the host backend.
|
||||
3. `code_runs` under SYCL from `build_target` (D4); install rules and the `oot` rebuild for
|
||||
`librad_sycl.so` and libxe2.
|
||||
|
||||
## Notifications
|
||||
|
||||
`scripts/sycl/notify.sh "msg"` posts to the Discord webhook (user's request, 2026-10-23): used for
|
||||
blockers, questions and milestones. Tested: posted.
|
||||
|
||||
## HIP-side edits awaiting a ROCm compile check
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
# libxe2 -- radiance's kernel library for Intel Xe2 GPUs (Battlemage; the Arc Pro B65), in SYCL.
|
||||
# docs/SYCL_PORTING.md has the design, docs/SYCL_PROGRESS.md the state.
|
||||
#
|
||||
# Links radiance::abi and the SYCL runtime, nothing of radiance's. Built by icpx: in radiance's tree
|
||||
# through the sycl/ sub-build, or standalone against an installed radiance:
|
||||
# cmake -S libxe2 -B build -DCMAKE_CXX_COMPILER=icpx -DCMAKE_PREFIX_PATH=<radiance prefix>
|
||||
if(NOT COMMAND rad_add_plugin)
|
||||
cmake_minimum_required(VERSION 3.21)
|
||||
project(libxe2 LANGUAGES CXX)
|
||||
find_package(radiance REQUIRED)
|
||||
rad_plugin_defaults()
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
|
||||
message(FATAL_ERROR "libxe2 is SYCL and needs icpx (-DCMAKE_CXX_COMPILER=icpx); this configure "
|
||||
"has ${CMAKE_CXX_COMPILER_ID}.")
|
||||
endif()
|
||||
if(NOT RAD_SYCL_TARGETS)
|
||||
set(RAD_SYCL_TARGETS "intel_gpu_bmg_g31")
|
||||
endif()
|
||||
|
||||
file(GLOB XE2_SRC CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
rad_add_plugin(libxe2 kernels SOURCES ${XE2_SRC})
|
||||
|
||||
# -ffp-contract=off is a correctness flag here as in libref: kernels are checked against it, so
|
||||
# `a*b + c` rounds twice on both sides. It follows -ffp-model=precise, which would otherwise set
|
||||
# contraction back on.
|
||||
set(_xe2_sycl -fsycl "-fsycl-targets=${RAD_SYCL_TARGETS}")
|
||||
target_compile_options(libxe2 PRIVATE ${_xe2_sycl} -ffp-model=precise -ffp-contract=off -Wno-overriding-option
|
||||
-fvisibility=hidden)
|
||||
get_filename_component(_xe2_icpx_bin "${CMAKE_CXX_COMPILER}" DIRECTORY)
|
||||
get_filename_component(_xe2_oneapi_lib "${_xe2_icpx_bin}/../lib" ABSOLUTE)
|
||||
target_link_options(libxe2 PRIVATE ${_xe2_sycl} "LINKER:-rpath,${_xe2_oneapi_lib}"
|
||||
"LINKER:--no-undefined")
|
||||
@@ -0,0 +1,57 @@
|
||||
/* xe2_common.cpp -- the shared helpers of xe2_common.h. */
|
||||
#include "xe2_common.h"
|
||||
|
||||
#include <cstdarg>
|
||||
|
||||
namespace xe2 {
|
||||
|
||||
namespace {
|
||||
thread_local char t_refusal[512] = "";
|
||||
}
|
||||
|
||||
const char* last_refusal() { return t_refusal; }
|
||||
|
||||
int refuse(const char* fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
std::vsnprintf(t_refusal, sizeof t_refusal, fmt, ap);
|
||||
va_end(ap);
|
||||
std::fprintf(stderr, "libxe2: %s\n", t_refusal);
|
||||
return RAD_E_UNSUPPORTED;
|
||||
}
|
||||
|
||||
sycl::queue* queue_of(RadStream s) {
|
||||
sycl::queue* q = rad_sycl_queue(s);
|
||||
if (!q) refuse("the stream is not a SYCL stream of version %u (another backend?)",
|
||||
RAD_SYCL_STREAM_VERSION);
|
||||
return q;
|
||||
}
|
||||
|
||||
int rows_view(const RadTensor* t, int64_t n, Rows* out, const char* what) {
|
||||
if (!t || !t->data || n <= 0) return refuse("%s: missing operand or n <= 0", what);
|
||||
out->base = (char*)t->data;
|
||||
out->dtype = t->dtype;
|
||||
out->rows = rad_tensor_numel(t) / n;
|
||||
if (t->rank >= 2 && t->shape[t->rank - 1] == n) {
|
||||
if (t->stride[t->rank - 1] != 1) return refuse("%s: last-axis stride %lld, not 1", what,
|
||||
(long long)t->stride[t->rank - 1]);
|
||||
/* Every leading axis must step by the one below it times its extent, so a row index maps
|
||||
* to one pitch (libref's rowoff walks them; here they must agree). */
|
||||
const int64_t pitch = t->stride[t->rank - 2];
|
||||
int64_t span = pitch;
|
||||
for (int i = (int)t->rank - 3; i >= 0; --i) {
|
||||
span *= t->shape[i + 1];
|
||||
if (t->shape[i] != 1 && t->stride[i] != span)
|
||||
return refuse("%s: leading axes do not collapse to one row pitch", what);
|
||||
}
|
||||
out->pitch = pitch;
|
||||
return RAD_OK;
|
||||
}
|
||||
if (!rad_tensor_is_contiguous(t))
|
||||
return refuse("%s: read as rows of %lld but neither its last extent nor contiguous", what,
|
||||
(long long)n);
|
||||
out->pitch = n;
|
||||
return RAD_OK;
|
||||
}
|
||||
|
||||
} // namespace xe2
|
||||
@@ -0,0 +1,67 @@
|
||||
/* xe2_common.h -- what every libxe2 kernel shares: the queue a launch submits to, row geometry,
|
||||
* and the dtype conversions.
|
||||
*
|
||||
* Correctness first (docs/SYCL_PORTING.md §4.8): the conversions are rad_plugin.h's, the ones
|
||||
* libref computes with, so a result rounds where the reference's does. Device code is compiled
|
||||
* with -ffp-contract=off for the same reason (libxe2/CMakeLists.txt). A kernel that cannot serve
|
||||
* the geometry it is handed returns RAD_E_UNSUPPORTED and names why through xe2_refuse; it never
|
||||
* hands the work to the host.
|
||||
*/
|
||||
#pragma once
|
||||
#include "rad_abi.h"
|
||||
#include "rad_plugin.h"
|
||||
#include "rad_sycl.h"
|
||||
|
||||
#include <sycl/sycl.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
|
||||
namespace xe2 {
|
||||
|
||||
namespace syclex = sycl::ext::oneapi::experimental;
|
||||
|
||||
/* The sub-group every libxe2 kernel is written for: Xe2's native SIMD16. */
|
||||
constexpr int kSub = 16;
|
||||
|
||||
/* Why the last launch on this thread refused, for the engine's error report and the tests. */
|
||||
const char* last_refusal();
|
||||
int refuse(const char* fmt, ...) __attribute__((format(printf, 1, 2)));
|
||||
|
||||
/* A row-major view of an operand read as rows of `n` elements: the base, and the element distance
|
||||
* between consecutive rows. A tensor whose last axis is `n` may have padded rows, provided every
|
||||
* leading axis collapses to one uniform pitch; anything else (`n` not the last extent) must be
|
||||
* contiguous and is read as rows of `n`. The last axis must have stride 1. */
|
||||
struct Rows {
|
||||
char* base = nullptr;
|
||||
int64_t pitch = 0; /* elements */
|
||||
int64_t rows = 0;
|
||||
uint32_t dtype = 0;
|
||||
};
|
||||
|
||||
/* Fills `out` for `t` read as rows of `n`; RAD_E_UNSUPPORTED (with a reason) for a layout the
|
||||
* kernels do not stride over. `rows` is numel / n, as libref counts them. */
|
||||
int rows_view(const RadTensor* t, int64_t n, Rows* out, const char* what);
|
||||
|
||||
/* The queue behind a launch's stream, or null with a reason (not a SYCL stream). */
|
||||
sycl::queue* queue_of(RadStream s);
|
||||
|
||||
/* Runs `submit`, turning a SYCL exception into RAD_E_DEVICE with its message. */
|
||||
template <typename F>
|
||||
int submit(F&& f) {
|
||||
try {
|
||||
f();
|
||||
} catch (const sycl::exception& e) {
|
||||
return refuse("SYCL: %s", e.what());
|
||||
}
|
||||
return RAD_OK;
|
||||
}
|
||||
|
||||
/* Rounds `v` through a store and load of `dt`, as libref's round_dt does. */
|
||||
inline float round_dt(uint32_t dt, float v) {
|
||||
uint64_t buf = 0;
|
||||
rad_store_f32(&buf, dt, 0, v);
|
||||
return rad_load_f32(&buf, dt, 0);
|
||||
}
|
||||
|
||||
} // namespace xe2
|
||||
@@ -0,0 +1,47 @@
|
||||
/* xe2_elementwise.cpp -- elementwise ops, one work-item an element.
|
||||
*
|
||||
* add: y = a + b, b broadcast along rows when it holds one row (a bias add), and with `div`,
|
||||
* y = rd(rd(a + b) / div), rd being y's dtype: libref's elementwise2 (ref_elementwise.cpp).
|
||||
*/
|
||||
#include "xe2_common.h"
|
||||
#include "xe2_ops.h"
|
||||
|
||||
namespace xe2 {
|
||||
|
||||
int add(const RadArgs* a, RadStream s) {
|
||||
if (!rad_args_have(a, 3)) return refuse("add: missing operand");
|
||||
const RadTensor *A = &a->t[0], *B = &a->t[1], *Y = &a->t[2];
|
||||
const int64_t n = rad_args_geti_or(a, "n", rad_tensor_numel(Y));
|
||||
const float div = (float)rad_args_getf_or(a, "div", 1.0);
|
||||
if (!(div != 0.0f) || !sycl::isfinite(div)) return RAD_E_INVAL;
|
||||
if (n <= 0) return RAD_E_SHAPE;
|
||||
Rows ya, aa, ba;
|
||||
if (int rc = rows_view(Y, n, &ya, "add y"); rc < 0) return rc;
|
||||
const int64_t rows = ya.rows;
|
||||
if (rows <= 0 || rad_tensor_numel(A) < rows * n) return RAD_E_SHAPE;
|
||||
const bool bcast = rad_tensor_numel(B) == n && rows > 1;
|
||||
if (!bcast && rad_tensor_numel(B) < rows * n) return RAD_E_SHAPE;
|
||||
if (int rc = rows_view(A, n, &aa, "add a"); rc < 0) return rc;
|
||||
if (int rc = rows_view(B, n, &ba, "add b"); rc < 0) return rc;
|
||||
if (bcast) ba.pitch = 0;
|
||||
|
||||
sycl::queue* q = queue_of(s);
|
||||
if (!q) return RAD_E_DEVICE;
|
||||
const int64_t total = rows * n;
|
||||
const size_t wg = 256;
|
||||
const size_t groups = (size_t)((total + (int64_t)wg - 1) / (int64_t)wg);
|
||||
return submit([&] {
|
||||
syclex::nd_launch(*q, sycl::nd_range<1>{groups * wg, wg}, [=](sycl::nd_item<1> it) {
|
||||
const int64_t g = (int64_t)it.get_global_id(0);
|
||||
if (g >= total) return;
|
||||
const int64_t r = g / n, i = g % n;
|
||||
const float u = rad_load_f32(aa.base, aa.dtype, r * aa.pitch + i);
|
||||
const float v = rad_load_f32(ba.base, ba.dtype, r * ba.pitch + i);
|
||||
float x = u + v;
|
||||
if (div != 1.0f) x = round_dt(ya.dtype, x) / div;
|
||||
rad_store_f32(ya.base, ya.dtype, r * ya.pitch + i, x);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace xe2
|
||||
@@ -0,0 +1,9 @@
|
||||
/* xe2_ops.h -- every libxe2 launch, by op. The rows that select them are in xe2_rows.cpp. */
|
||||
#pragma once
|
||||
#include "rad_abi.h"
|
||||
|
||||
namespace xe2 {
|
||||
|
||||
int add(const RadArgs* a, RadStream s);
|
||||
|
||||
} // namespace xe2
|
||||
@@ -0,0 +1,48 @@
|
||||
/* xe2_rows.cpp -- libxe2's plugin exports: identity and the kernel rows the engine selects from.
|
||||
*
|
||||
* libxe2 is radiance's kernel library for Intel Xe2 GPUs (the Arc Pro B65, Battlemage G31) through
|
||||
* SYCL. It defines no op schemas of its own: every op it serves is in the conventional vocabulary,
|
||||
* whose schemas libref fixes (docs/OPS.md). All rows are device-domain; an op libxe2 lacks has no
|
||||
* row here, and on the SYCL backend the engine stops at startup naming it (docs/SYCL_PORTING.md
|
||||
* §4.4).
|
||||
*/
|
||||
#include "rad_abi.h"
|
||||
#include "xe2_ops.h"
|
||||
|
||||
namespace {
|
||||
|
||||
/* Rows by field name (C++20 designated initialisers must follow declaration order, so the compiler
|
||||
* checks it), unlike a positional table where a shifted field can still compile. */
|
||||
const RadKernelInfo kKernels[] = {
|
||||
{ .name = "xe2_add", .op = "add", .family = "elem",
|
||||
.computes = "elementwise sum, b broadcast along rows when it is one row; optional div",
|
||||
.shape = "any n and row count; rows may be padded, the last axis dense",
|
||||
.dtypes = "any float dtype in and out (bf16, f16, f32, fp8), f32 arithmetic, rounded as libref",
|
||||
.domain = RAD_DOMAIN_DEVICE, .priority = 0,
|
||||
.launch = xe2::add },
|
||||
};
|
||||
|
||||
const RadPluginInfo kInfo = {
|
||||
RAD_PLUGIN_KERNEL, "libxe2", "0.1",
|
||||
"Intel Xe2 (Battlemage) kernels in SYCL, checked against libref",
|
||||
"intel_gpu_bmg_g31",
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
extern "C" {
|
||||
|
||||
__attribute__((visibility("default"))) uint32_t rad_plugin_abi_version(void) {
|
||||
return RAD_ABI_VERSION;
|
||||
}
|
||||
__attribute__((visibility("default"))) const RadPluginInfo* rad_plugin_info(void) { return &kInfo; }
|
||||
__attribute__((visibility("default"))) int rad_kernel_schema_count(void) { return 0; }
|
||||
__attribute__((visibility("default"))) const RadOpSchema* rad_kernel_schema_at(int) { return nullptr; }
|
||||
__attribute__((visibility("default"))) int rad_kernel_count(void) {
|
||||
return (int)(sizeof kKernels / sizeof kKernels[0]);
|
||||
}
|
||||
__attribute__((visibility("default"))) const RadKernelInfo* rad_kernel_at(int i) {
|
||||
return i >= 0 && i < rad_kernel_count() ? &kKernels[i] : nullptr;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
# notify.sh -- post a short message to the Discord webhook in ~/.config/radiance-bench.env
|
||||
# (DISCORD_WEBHOOK_URL), for anything in the SYCL port that needs the user's attention: a blocker,
|
||||
# a question, a finished milestone. The URL is a secret: it is read from the file, never printed.
|
||||
#
|
||||
# Usage: scripts/sycl/notify.sh "message" (cut to Discord's 2000 characters)
|
||||
# Exit status: 0 posted, 1 no webhook configured, 2 the post failed (HTTP status printed).
|
||||
set -e
|
||||
msg=${1:?usage: notify.sh "message"}
|
||||
env_file=${RAD_BENCH_ENV:-$HOME/.config/radiance-bench.env}
|
||||
[ -r "$env_file" ] && . "$env_file"
|
||||
if [ -z "$DISCORD_WEBHOOK_URL" ]; then
|
||||
echo "notify.sh: no DISCORD_WEBHOOK_URL (looked in $env_file); not posted" >&2
|
||||
exit 1
|
||||
fi
|
||||
payload=$(printf '%s' "$msg" | jq -Rs '{content: (.[0:2000])}')
|
||||
code=$(printf '%s' "$payload" | curl -sS -o /dev/null -w '%{http_code}' \
|
||||
-H 'Content-Type: application/json' --data-binary @- "$DISCORD_WEBHOOK_URL") || code=000
|
||||
case "$code" in
|
||||
2??) exit 0 ;;
|
||||
*) echo "notify.sh: the webhook answered HTTP $code" >&2; exit 2 ;;
|
||||
esac
|
||||
@@ -48,3 +48,20 @@ target_compile_options(rad_sycl PRIVATE ${RAD_SYCL_FLAGS} -fvisibility=hidden)
|
||||
target_link_options(rad_sycl PRIVATE ${RAD_SYCL_FLAGS} "LINKER:-rpath,${RAD_ONEAPI_LIBDIR}"
|
||||
"LINKER:--no-undefined")
|
||||
set_target_properties(rad_sycl PROPERTIES OUTPUT_NAME rad_sycl)
|
||||
|
||||
# ---------------------------------------------------------------- the kernel library
|
||||
# libxe2 is a plugin like any other: built by rad_add_plugin against the ABI headers alone, into
|
||||
# the main build's $RADIANCE_HOME (RAD_PLUGIN_OUT, passed down by the main project). The variables
|
||||
# cmake/RadAddPlugin.cmake expects describe a build with no HIP; libxe2 adds its SYCL flags itself.
|
||||
set(RAD_PLUGIN_OUT "${CMAKE_BINARY_DIR}/radiance_home" CACHE PATH "the build tree's $RADIANCE_HOME")
|
||||
set(RAD_HIP_FOUND OFF)
|
||||
set(RAD_GPU_TARGETS "")
|
||||
set(RAD_HIP_RUNTIME "")
|
||||
# The sub-build installs nothing; the main project installs what it needs from here.
|
||||
set(RAD_PLUGIN_INSTALL OFF)
|
||||
add_library(rad_abi INTERFACE)
|
||||
add_library(radiance::abi ALIAS rad_abi)
|
||||
target_include_directories(rad_abi INTERFACE ${RAD_SOURCE_DIR}/abi)
|
||||
include(GNUInstallDirs)
|
||||
include(${RAD_SOURCE_DIR}/cmake/RadAddPlugin.cmake)
|
||||
add_subdirectory(${RAD_SOURCE_DIR}/libxe2 ${CMAKE_BINARY_DIR}/libxe2)
|
||||
@@ -599,6 +599,11 @@ set(RAD_KBENCH_LABELS "kbench")
|
||||
if(RAD_HIP_FOUND AND TARGET libr4d)
|
||||
set(RAD_KBENCH_LABELS "kbench;gpu")
|
||||
endif()
|
||||
# A SYCL build's replay runs libxe2 on the Intel card, so it is a card test there (label sycl; load
|
||||
# the oneAPI environment first).
|
||||
if(RAD_SYCL_FOUND)
|
||||
set(RAD_KBENCH_LABELS "kbench;sycl")
|
||||
endif()
|
||||
set(RAD_KBENCH_ROWS ${CMAKE_SOURCE_DIR}/data/kbench_rows)
|
||||
if(TARGET rad-kbench AND EXISTS ${CMAKE_SOURCE_DIR}/data/kernels.rkb)
|
||||
add_test(NAME kbench
|
||||
|
||||
Reference in new issue
Block a user