diff --git a/docs/INTEL.md b/docs/INTEL.md
index c8e3e8ff..6d5e7e03 100644
--- a/docs/INTEL.md
+++ b/docs/INTEL.md
@@ -151,6 +151,7 @@ need model fixtures (`iq_parity`, `ple_parity`) or the tensor-core kernel below
| bf16_gemv, cvec, dequant_s2, elementwise, gdn, gr, kv_q4, kv_q8, kv_stream, qsa, quantize_act, rope, router_top10, s2_gemv, s2_gemv_q8, s_gemv, s_gemv_q8k, sampler, shared_expert | pass |
| iq_parity, ple_parity | need fixtures (a `logs/iq_fixture` directory, a Q2_0 shard) |
| qsa_prompt_attn_parity | needs the tensor-core kernel (below) |
+| kv_hybrid_parity (0.1.27, hybrid K8V4 KV) | appends, gathers and attention pass; its last step is that same tensor-core kernel |
**The engine end to end (2026-09-29, later the same day).** It generates. Prompt "Write a Python function
that returns the n-th Fibonacci number", greedy, 64 tokens:
@@ -223,6 +224,23 @@ the engine plus `sycl/rank_kernels.py` gives device time per kernel. `mmvq_bench
NATIVE_BENCH=1` time the two hot kernel families in isolation (warm the clocks first: a 5 ms run measures
the ramp, not the kernel).
+**Keeping up with upstream.** A merge of upstream `main` into `b70` leaves the copies in `sycl/` behind
+wherever upstream touched a file they mirror. They are refreshed by re-migration, not by hand (done for
+0.1.25-0.1.27, 2026-09-30):
+
+1. Merge upstream into `b70` and resolve `setup.py` (the Intel path lives beside upstream's AMD one).
+2. Migrate the *old* upstream tree (a `git archive` of the pre-merge commit) with `migrate.sh` into
+ `sycl-base`, and the merged tree into `sycl-new`; about 3 minutes each in the dev image.
+3. `sycl/tools/normalize.sh
` on both: dpct's file names, the unchanged files, the
+ message serials, then `fixups.py`. Two runs of dpct on the same source now differ only in the kernel
+ name hashes it generates.
+4. For every file present in both: `git merge-file sycl/F sycl-base/F sycl-new/F`. Files upstream did not
+ change are left alone. Copies dpct never produced (`verify.cpp`, `mtp.cpp`, `remote_experts.cpp`
+ include no CUDA header directly) take upstream's diff by hand; new parity tests are copied in and
+ listed in `sycl/CMakeLists.txt`.
+5. A fixup whose pattern upstream changed shows up as a compile error (the PTX gate became an `#elif`
+ under upstream's `__HIPCC__` guard); extend the fixup, re-run it, rebuild.
+
**Not ported yet.**
- Three kernels carry inline PTX (`mma.sync` tensor-core matrix ops, `ldmatrix`, `cp.async`):
diff --git a/sycl/CMakeLists.txt b/sycl/CMakeLists.txt
index 5b260f1e..2ab04dda 100644
--- a/sycl/CMakeLists.txt
+++ b/sycl/CMakeLists.txt
@@ -24,15 +24,20 @@ set(STRATA_SYCL_AOT "" CACHE STRING "AOT device for the GPU code, e.g. bmg-g31 (
set(_sycl_flags -fsycl)
if(STRATA_SYCL_AOT)
list(APPEND _sycl_flags -fsycl-targets=spir64_gen)
- set(_sycl_link -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen "-device ${STRATA_SYCL_AOT}")
+ # the divide/sqrt rounding option (below) must reach ocloc here: an AOT build has no spir64 backend to take it
+ set(_sycl_link -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen
+ "-device ${STRATA_SYCL_AOT} -options -cl-fp32-correctly-rounded-divide-sqrt")
else()
set(_sycl_link -fsycl)
endif()
# The Intel GPU's fp32 divide is not correctly rounded by default (OpenCL allows 2.5 ulp). Strata's quantizers
# are byte-exact against ggml through `amax / 127`, so the device compiler is told to round divides and sqrt
# properly; measured: quantize_act_parity goes from 303k mismatches to byte-exact. (Same as
-# SYCL_PROGRAM_COMPILE_OPTIONS=-cl-fp32-correctly-rounded-divide-sqrt at run time.)
-list(APPEND _sycl_link "-Xsycl-target-backend=spir64" "-cl-fp32-correctly-rounded-divide-sqrt")
+# SYCL_PROGRAM_COMPILE_OPTIONS=-cl-fp32-correctly-rounded-divide-sqrt at run time.) The AOT build passes it to
+# ocloc above; without that the 303k mismatches came back on 2026-09-30, unnoticed since the AOT switch.
+if(NOT STRATA_SYCL_AOT)
+ list(APPEND _sycl_link "-Xsycl-target-backend=spir64" "-cl-fp32-correctly-rounded-divide-sqrt")
+endif()
# Every translation unit gets -fsycl: the migrated host files construct queues and USM, not only the kernels.
# icpx defaults to a fast floating-point model (reciprocal approximations, reassociation); the kernels are
# compared byte-for-byte against ggml's, which nvcc built value-safe, so ask for the same here.
@@ -175,6 +180,12 @@ if(STRATA_SYCL_PARITY)
strata_resolve(_src src/kernels/qsa_prompt_attn_parity.cpp)
add_executable(qsa_prompt_attn_parity ${_src})
target_link_libraries(qsa_prompt_attn_parity PRIVATE strata_kernels)
+ # the hybrid K8V4 KV test (upstream 0.1.27) passes its appends, gathers and attention here and fails only its
+ # last step, the same tensor-core prompt kernel. Built, not registered, until that kernel is ported.
+ strata_resolve(_src src/kernels/kv_hybrid_parity.cpp)
+ add_executable(kv_hybrid_parity ${_src})
+ target_include_directories(kv_hybrid_parity PRIVATE ${STRATA_ROOT}/src/kernels)
+ target_link_libraries(kv_hybrid_parity PRIVATE strata_kernels)
add_executable(mmvq_bench ${CMAKE_CURRENT_SOURCE_DIR}/src/kernels/mmvq_bench.cpp) # dense mmvq timing
target_link_libraries(mmvq_bench PRIVATE strata_kernels)
# one native expert three ways on real GGUF rows (ggml reference, CPU path, GPU native_expert_grouped):
diff --git a/sycl/include/strata/core/mtp.hpp b/sycl/include/strata/core/mtp.hpp
index 6469dbb5..52847e1d 100644
--- a/sycl/include/strata/core/mtp.hpp
+++ b/sycl/include/strata/core/mtp.hpp
@@ -73,6 +73,26 @@ public:
double ms_draft = 0, ms_prefill = 0;
int64_t rounds = 0;
+ /// E-9: the prompt path computes this layer's prompt K/V in batches (Prefill::draft_kv): its tensors, its K/V
+ /// state, the first cell a round can still read, its device, and a wait for its own stream.
+ const float* tensor_f32(const char* name) const { return f32(name); }
+ const uint16_t* tensor_bf16(const char* name) const { return bf16(name); }
+ const void* tensor_q8(const char* name) const { return q8(name); }
+ QsaState& kv_state_rw() { return st_; }
+ int64_t first_needed() const { return (window_ > 0 && prompt_len_ > 0) ? prompt_len_ - window_ - 64 : 0; }
+ int device() const { return device_; }
+ bool idle(std::string &err) try {
+ if (cs_ && DPCT_CHECK_ERROR(cs_->wait()) != 0) {
+ err = "mtp: its stream failed"; return false;
+ }
+ return true;
+ }
+ catch (sycl::exception const &exc) {
+ std::cerr << exc.what() << "Exception caught at file:" << __FILE__
+ << ", line:" << __LINE__ << std::endl;
+ std::exit(1);
+ }
+
private:
bool record_forward(int T, int step_row0, dpct::queue_ptr cs,
std::string &err);
diff --git a/sycl/include/strata/core/on_device.hpp b/sycl/include/strata/core/on_device.hpp
index b6c620bb..ee2d7b3b 100644
--- a/sycl/include/strata/core/on_device.hpp
+++ b/sycl/include/strata/core/on_device.hpp
@@ -13,7 +13,7 @@ struct OnDevice {
explicit OnDevice(int device) try {
int cur = 0;
/*
- DPCT1093:7: The "device" device may be not the one intended for use.
+ DPCT1093: The "device" device may be not the one intended for use.
Adjust the selected device if needed.
*/
if (device >= 0 &&
@@ -27,7 +27,7 @@ struct OnDevice {
std::exit(1);
}
/*
- DPCT1093:8: The "previous" device may be not the one intended for use.
+ DPCT1093: The "previous" device may be not the one intended for use.
Adjust the selected device if needed.
*/
~OnDevice() { if (previous >= 0) dpct::select_device(previous); }
diff --git a/sycl/include/strata/kernels/bf16_bits.hpp b/sycl/include/strata/kernels/bf16_bits.hpp
index 11a85f28..a315a834 100644
--- a/sycl/include/strata/kernels/bf16_bits.hpp
+++ b/sycl/include/strata/kernels/bf16_bits.hpp
@@ -22,7 +22,7 @@
#include
#include
-#if defined(SYCL_LANGUAGE_VERSION)
+#if defined(SYCL_LANGUAGE_VERSION) || defined(__HIPCC__)
#define STRATA_BF16_HD
#else
#define STRATA_BF16_HD
@@ -33,7 +33,11 @@ namespace strata::kernels {
/// Round-to-nearest-even f32 -> bf16, returned as raw bits in the LOW half of the uint16.
STRATA_BF16_HD inline uint16_t bf16_from_f32(float f) {
uint32_t i;
+#if defined(__HIP_DEVICE_COMPILE__)
+ __builtin_memcpy(&i, &f, 4);
+#else
std::memcpy(&i, &f, 4);
+#endif
i = (i + ((i >> 16) & 1u) + 0x7FFFu) & 0xFFFF0000u;
return (uint16_t) (i >> 16);
}
@@ -42,7 +46,11 @@ STRATA_BF16_HD inline uint16_t bf16_from_f32(float f) {
STRATA_BF16_HD inline float f32_from_bf16(uint16_t h) {
const uint32_t i = (uint32_t) h << 16;
float f;
+#if defined(__HIP_DEVICE_COMPILE__)
+ __builtin_memcpy(&f, &i, 4);
+#else
std::memcpy(&f, &i, 4);
+#endif
return f;
}
diff --git a/sycl/include/strata/kernels/f16_bits.hpp b/sycl/include/strata/kernels/f16_bits.hpp
index 3ac2a524..cd5625f6 100644
--- a/sycl/include/strata/kernels/f16_bits.hpp
+++ b/sycl/include/strata/kernels/f16_bits.hpp
@@ -28,7 +28,7 @@
#include
#include
-#if defined(SYCL_LANGUAGE_VERSION)
+#if defined(SYCL_LANGUAGE_VERSION) || defined(__HIPCC__)
#define STRATA_HD
#else
#define STRATA_HD
@@ -39,7 +39,11 @@ namespace strata::kernels {
/// Round-to-nearest-even f32 -> fp16, returned as raw bits.
STRATA_HD inline uint16_t f16_from_f32(float f) {
uint32_t x;
+#if defined(__HIP_DEVICE_COMPILE__)
+ __builtin_memcpy(&x, &f, 4);
+#else
std::memcpy(&x, &f, 4);
+#endif
const uint32_t sign = (x >> 16) & 0x8000u;
const uint32_t rawexp = (x >> 23) & 0xFFu;
int exp = (int) rawexp - 127 + 15;
@@ -92,7 +96,11 @@ STRATA_HD inline float f32_from_f16(uint16_t h) {
out = sign | ((ex - 15 + 127) << 23) | (man << 13);
}
float f;
+#if defined(__HIP_DEVICE_COMPILE__)
+ __builtin_memcpy(&f, &out, 4);
+#else
std::memcpy(&f, &out, 4);
+#endif
return f;
}
diff --git a/sycl/include/strata/kernels/mrope.hpp b/sycl/include/strata/kernels/mrope.hpp
index 11fcfe1e..fecd3737 100644
--- a/sycl/include/strata/kernels/mrope.hpp
+++ b/sycl/include/strata/kernels/mrope.hpp
@@ -25,12 +25,12 @@ namespace strata::kernels {
void mrope_table_set(const int32_t* device_table);
const int32_t* mrope_table();
-#if defined(SYCL_LANGUAGE_VERSION)
+#if defined(SYCL_LANGUAGE_VERSION) || defined(__HIPCC__)
/// ggml rope_multi, is_imrope, sections {11, 11, 10, 0}: sector = pair % 32; sector % 3 == 1 -> h (sector < 33),
/// == 2 -> w (sector < 30), == 0 -> t (sector < 33). For pairs 0..31 all three bounds hold, so it is pair % 3.
__dpct_inline__ int mrope_pos(const int32_t *tab, int pos, int pair) {
/*
- DPCT1098:387: The '*' expression is used instead of the __ldg call. These
+ DPCT1098: The '*' expression is used instead of the __ldg call. These
two expressions do not provide the exact same functionality. Check the
generated code for potential precision and/or performance issues.
*/
diff --git a/sycl/include/strata/kernels/rope.hpp b/sycl/include/strata/kernels/rope.hpp
index 5b262748..be6a53bd 100644
--- a/sycl/include/strata/kernels/rope.hpp
+++ b/sycl/include/strata/kernels/rope.hpp
@@ -13,7 +13,7 @@
#include
#include
-#if defined(SYCL_LANGUAGE_VERSION)
+#if defined(SYCL_LANGUAGE_VERSION) || defined(__HIPCC__)
#define STRATA_ROPE_HD
#else
#define STRATA_ROPE_HD
diff --git a/sycl/src/core/concurrent_main.cpp b/sycl/src/core/concurrent_main.cpp
index 599e98be..8fb792b0 100644
--- a/sycl/src/core/concurrent_main.cpp
+++ b/sycl/src/core/concurrent_main.cpp
@@ -111,7 +111,7 @@ int main(int argc, char** argv) {
std::vector hx((size_t) n_in, 0x3C00);
std::vector hs((size_t) n_out * (size_t) (n_in / 64), 0.001f);
/*
- DPCT1114:922: cudaMemcpy is migrated to asynchronization memcpy, assuming in
+ DPCT1114: cudaMemcpy is migrated to asynchronization memcpy, assuming in
the original code the source host memory is pageable memory. If the memory
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
@@ -120,7 +120,7 @@ int main(int argc, char** argv) {
d_x, hx.data(), hx.size() * sizeof(uint16_t)).wait()),
"copy x");
/*
- DPCT1114:923: cudaMemcpy is migrated to asynchronization memcpy, assuming in
+ DPCT1114: cudaMemcpy is migrated to asynchronization memcpy, assuming in
the original code the source host memory is pageable memory. If the memory
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
@@ -158,7 +158,7 @@ int main(int argc, char** argv) {
check(DPCT_CHECK_ERROR(ev[b] = new sycl::event()), "event");
uint8_t* buf[2] = {d_codes, d_codes}; // one buffer is enough: the timing is what is measured
/*
- DPCT1124:924: cudaMemcpyAsync is migrated to asynchronous memcpy API.
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API.
While the origin API might be synchronous, it depends on the type of
operand memory, so you may need to call wait() on event return by memcpy
API to ensure synchronization behavior.
@@ -167,7 +167,7 @@ int main(int argc, char** argv) {
DPCT_CHECK_ERROR(s_copy->memcpy(buf[0], arena.data(), role_codes)),
"prologue");
/*
- DPCT1024:925: The original code returned the error code that was further
+ DPCT1024: The original code returned the error code that was further
consumed by the program logic. This original code was replaced with 0.
You may need to rewrite the program logic consuming the error code.
*/
@@ -177,7 +177,7 @@ int main(int argc, char** argv) {
const int cur = i & 1, nxt = (i + 1) & 1;
if (i + 1 < roles) {
/*
- DPCT1124:926: cudaMemcpyAsync is migrated to asynchronous memcpy
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy
API. While the origin API might be synchronous, it depends on
the type of operand memory, so you may need to call wait() on
event return by memcpy API to ensure synchronization behavior.
@@ -189,7 +189,7 @@ int main(int argc, char** argv) {
role_codes)),
"copy");
/*
- DPCT1024:927: The original code returned the error code that was
+ DPCT1024: The original code returned the error code that was
further consumed by the program logic. This original code was
replaced with 0. You may need to rewrite the program logic
consuming the error code.
diff --git a/sycl/src/core/device.dp.cpp b/sycl/src/core/device.dp.cpp
index ce679dd6..d72b556a 100644
--- a/sycl/src/core/device.dp.cpp
+++ b/sycl/src/core/device.dp.cpp
@@ -13,17 +13,17 @@ namespace {
void check(dpct::err0 e, const char *what) {
/*
- DPCT1000:1125: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (e != 0) {
/*
- DPCT1009:1126: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:1124: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
throw CudaError(
std::string(what) + ": " + dpct::get_error_string_dummy(e), (int)e);
@@ -47,7 +47,11 @@ DeviceInfo device_info(int ordinal) {
int count = 0;
check(DPCT_CHECK_ERROR(count = dpct::device_count()), "cudaGetDeviceCount");
if (count == 0) {
- throw CudaError("no CUDA device is present; Strata needs an NVIDIA GPU of compute capability 8.0 or newer", -1);
+#if defined(STRATA_USE_HIP)
+ throw CudaError("no HIP device is present; this backend targets gfx1100 wave32", -1);
+#else
+ throw CudaError("no CUDA device is present; Strata needs an NVIDIA GPU (RTX 20 series or newer)", -1);
+#endif
}
if (ordinal < 0 || ordinal >= count) {
throw CudaError("device ordinal " + std::to_string(ordinal) + " is out of range (have " +
@@ -57,7 +61,7 @@ DeviceInfo device_info(int ordinal) {
DeviceInfo d;
d.ordinal = ordinal;
/*
- DPCT1093:1127: The "ordinal" device may be not the one intended for use.
+ DPCT1093: The "ordinal" device may be not the one intended for use.
Adjust the selected device if needed.
*/
check(DPCT_CHECK_ERROR(dpct::select_device(ordinal)), "cudaSetDevice");
@@ -67,12 +71,12 @@ DeviceInfo device_info(int ordinal) {
"cudaGetDeviceProperties");
d.name = p.get_name();
/*
- DPCT1005:1128: The SYCL device version is different from CUDA Compute
+ DPCT1005: The SYCL device version is different from CUDA Compute
Compatibility. You may need to rewrite this code.
*/
d.cc_major = p.get_major_version();
/*
- DPCT1005:1129: The SYCL device version is different from CUDA Compute
+ DPCT1005: The SYCL device version is different from CUDA Compute
Compatibility. You may need to rewrite this code.
*/
d.cc_minor = p.get_minor_version();
@@ -80,7 +84,7 @@ DeviceInfo device_info(int ordinal) {
size_t free_b = 0, total_b = 0;
/*
- DPCT1106:1130: 'cudaMemGetInfo' was migrated with the Intel extensions for
+ DPCT1106: 'cudaMemGetInfo' was migrated with the Intel extensions for
device information which may not be supported by all compilers or runtimes.
You may need to adjust the code.
*/
@@ -91,30 +95,37 @@ DeviceInfo device_info(int ordinal) {
d.total_bytes = total_b;
/*
- DPCT1043:1131: The version-related API is different in SYCL. An initial code
+ DPCT1043: The version-related API is different in SYCL. An initial code
was generated, but you need to adjust it.
*/
check(DPCT_CHECK_ERROR(d.driver_version = dpct::get_major_version(
dpct::get_current_device())),
"cudaDriverGetVersion");
/*
- DPCT1043:1132: The version-related API is different in SYCL. An initial code
+ DPCT1043: The version-related API is different in SYCL. An initial code
was generated, but you need to adjust it.
*/
check(DPCT_CHECK_ERROR(d.runtime_version = dpct::get_major_version(
dpct::get_current_device())),
"cudaRuntimeGetVersion");
- // The kernels need sm_80 or newer (tf32 mma in the attention scorer, bf16 math) - the same floor the
- // arch guard in CMakeLists enforces at build time (RTX 30 / 40 / 50). Anything older is caught here,
- // because a binary can be carried to a machine with an older card and would otherwise silently take
- // whatever path the driver chose. Pre-Blackwell is untested by the author; trust, then verify.
- if (d.cc_major < 8) {
+ // The engine supports compute capability 7.5 and newer (Turing: the QSA scorer's tf32 mma has a portable
+ // fp32-FMA fallback below sm_80, the tensor-core prompt kernels refuse and fall back). Compiling for a
+ // supported arch is enforced by CMake; RUNNING on an older card is caught here, because a binary can be carried
+ // to a machine with an older card and would otherwise silently take whatever path the driver chose. The HIP
+ // backend is validated on gfx1100 (wave32) only.
+#if defined(STRATA_USE_HIP)
+ if (std::strncmp(p.gcnArchName, "gfx1100", 7) != 0 || p.warpSize != 32) {
+ throw CudaError("HIP backend requires validated gfx1100 wave32 hardware", -1);
+ }
+#else
+ if (d.cc_major * 10 + d.cc_minor < 75) {
throw CudaError("device " + d.name + " reports compute capability " + std::to_string(d.cc_major) +
"." + std::to_string(d.cc_minor) +
- "; Strata needs an NVIDIA GPU of compute capability 8.0 or newer (RTX 30 / 40 / 50)",
+ "; Strata needs compute capability 7.5 or newer (RTX 20 / 30 / 40 / 50 series)",
-1);
}
+#endif
return d;
}
@@ -122,7 +133,7 @@ DeviceArena::DeviceArena(uint64_t bytes, int ordinal, bool poison)
: capacity_(bytes), ordinal_(ordinal), poison_(poison) {
if (bytes == 0) throw CudaError("DeviceArena of 0 bytes", -1);
/*
- DPCT1093:1133: The "ordinal" device may be not the one intended for use.
+ DPCT1093: The "ordinal" device may be not the one intended for use.
Adjust the selected device if needed.
*/
check(DPCT_CHECK_ERROR(dpct::select_device(ordinal)), "cudaSetDevice");
@@ -150,7 +161,7 @@ DeviceArena::DeviceArena(uint64_t bytes, int ordinal, bool poison)
auto n_b_threads_ct1 = n - b * threads;
cgh.parallel_for<
- dpct_kernel_name>(
+ dpct_kernel_name>(
sycl::nd_range<3>(sycl::range(1, 1, (unsigned)chunk) *
sycl::range(1, 1, threads),
sycl::range(1, 1, threads)),
@@ -161,7 +172,7 @@ DeviceArena::DeviceArena(uint64_t bytes, int ordinal, bool poison)
});
}
/*
- DPCT1010:1134: SYCL uses exceptions to report errors and does not
+ DPCT1010: SYCL uses exceptions to report errors and does not
use the error codes. The cudaGetLastError function call was replaced
with 0. You need to rewrite this code.
*/
diff --git a/sycl/src/core/expert_cache.cpp b/sycl/src/core/expert_cache.cpp
index 752bebab..32e16730 100644
--- a/sycl/src/core/expert_cache.cpp
+++ b/sycl/src/core/expert_cache.cpp
@@ -71,6 +71,22 @@ bool read_expert_profile(const std::string& path, int64_t n_layers, int64_t n_ex
ExpertCache::~ExpertCache() { close(); }
+#if defined(STRATA_USE_HIP)
+bool ExpertCache::ensure_blocking_staging(std::size_t bytes, std::string& err) {
+ if (bytes <= blocking_staging_bytes_) return true;
+ void* next = nullptr;
+ const cudaError_t status = cudaHostAlloc(&next, bytes, cudaHostAllocDefault);
+ if (status != cudaSuccess) {
+ err = std::string("ExpertCache: HIP blocking staging allocation: ") + cudaGetErrorString(status);
+ return false;
+ }
+ if (blocking_staging_) (void) cudaFreeHost(blocking_staging_);
+ blocking_staging_ = static_cast(next);
+ blocking_staging_bytes_ = bytes;
+ return true;
+}
+#endif
+
bool ExpertCache::open(int64_t n_slots, int64_t n_layers, int64_t n_expert,
int64_t blob_bytes, std::string &err) try {
close();
@@ -93,7 +109,7 @@ bool ExpertCache::open(int64_t n_slots, int64_t n_layers, int64_t n_expert,
// and the two numbers are named in the refusal.
size_t free_b = 0, total_b = 0;
/*
- DPCT1106:759: 'cudaMemGetInfo' was migrated with the Intel extensions for
+ DPCT1106: 'cudaMemGetInfo' was migrated with the Intel extensions for
device information which may not be supported by all compilers or runtimes.
You may need to adjust the code.
*/
@@ -119,12 +135,12 @@ bool ExpertCache::open(int64_t n_slots, int64_t n_layers, int64_t n_expert,
std::snprintf(
buf, sizeof buf, "ExpertCache: cudaMalloc(%.2f GiB) failed: %s",
/*
- DPCT1009:760: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1010:761: SYCL uses exceptions to report errors and does not use
+ DPCT1010: SYCL uses exceptions to report errors and does not use
the error codes. The cudaGetLastError function call was replaced
with 0. You need to rewrite this code.
*/
@@ -147,6 +163,12 @@ bool ExpertCache::open(int64_t n_slots, int64_t n_layers, int64_t n_expert,
n_layers_ = n_layers;
n_expert_ = n_expert;
blob_ = blob_bytes;
+#if defined(STRATA_USE_HIP)
+ if (!ensure_blocking_staging((std::size_t) blob_, err)) {
+ close();
+ return false;
+ }
+#endif
next_free_ = 0;
fills_ = 0;
admitted_ = 0;
@@ -181,11 +203,22 @@ bool ExpertCache::open_sized(const std::vector& slot_bytes, int64_t n_l
slots_ = (int64_t) slot_bytes.size();
blob_ = mx;
off_ = std::move(off);
+#if defined(STRATA_USE_HIP)
+ if (!ensure_blocking_staging((std::size_t) blob_, err)) {
+ close();
+ return false;
+ }
+#endif
layer_next_.assign((size_t) (n_layers > 0 ? n_layers : 0), 0);
return true;
}
void ExpertCache::close() {
+#if defined(STRATA_USE_HIP)
+ if (blocking_staging_) (void) cudaFreeHost(blocking_staging_);
+ blocking_staging_ = nullptr;
+ blocking_staging_bytes_ = 0;
+#endif
off_.clear();
if (base_ != nullptr) {
sycl::free(base_, dpct::get_in_order_queue());
@@ -264,7 +297,7 @@ bool ExpertCache::fill_slot(int32_t slot, const uint8_t *host_blob,
return false;
}
/*
- DPCT1124:764: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
the origin API might be synchronous, it depends on the type of operand
memory, so you may need to call wait() on event return by memcpy API to
ensure synchronization behavior.
@@ -272,17 +305,17 @@ bool ExpertCache::fill_slot(int32_t slot, const uint8_t *host_blob,
const dpct::err0 e =
DPCT_CHECK_ERROR(strata::q_of(stream)->memcpy(dst, host_blob, n));
/*
- DPCT1000:763: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (e != 0) {
/*
- DPCT1009:765: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:762: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = std::string("ExpertCache::fill_slot: ") +
dpct::get_error_string_dummy(e);
@@ -309,26 +342,37 @@ bool ExpertCache::fill_slot_blocking(int32_t slot, const uint8_t *host_blob,
err = "ExpertCache::fill_slot_blocking: the host blob is null";
return false;
}
+#if defined(STRATA_USE_HIP)
+ // Bound HIP's pageable-source staging to one expert instead of repeatedly
+ // registering regions of the mmap. The blocking copy completes before reuse.
+ if (!blocking_staging_ || n > blocking_staging_bytes_) {
+ err = "ExpertCache::fill_slot_blocking: HIP staging buffer is too small";
+ return false;
+ }
+ std::memcpy(blocking_staging_, host_blob, n);
+ const cudaError_t e = cudaMemcpy(dst, blocking_staging_, n, cudaMemcpyHostToDevice);
+#else
/*
- DPCT1114:768: cudaMemcpy is migrated to asynchronization memcpy, assuming in
+ DPCT1114: cudaMemcpy is migrated to asynchronization memcpy, assuming in
the original code the source host memory is pageable memory. If the memory
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
*/
const dpct::err0 e =
DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(dst, host_blob, n).wait());
+#endif
/*
- DPCT1000:767: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (e != 0) {
/*
- DPCT1009:769: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:766: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = std::string("ExpertCache::fill_slot_blocking: ") +
dpct::get_error_string_dummy(e);
@@ -353,7 +397,7 @@ bool ExpertCache::fill_slot_queued(int32_t slot, const uint8_t *host_blob,
return false;
}
/*
- DPCT1124:772: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
the origin API might be synchronous, it depends on the type of operand
memory, so you may need to call wait() on event return by memcpy API to
ensure synchronization behavior.
@@ -361,17 +405,17 @@ bool ExpertCache::fill_slot_queued(int32_t slot, const uint8_t *host_blob,
const dpct::err0 e =
DPCT_CHECK_ERROR(dpct::get_in_order_queue().memcpy(dst, host_blob, n).wait());
/*
- DPCT1000:771: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (e != 0) {
/*
- DPCT1009:773: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:770: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = std::string("ExpertCache::fill_slot_queued: ") +
dpct::get_error_string_dummy(e);
@@ -389,17 +433,17 @@ catch (sycl::exception const &exc) {
bool ExpertCache::sync_queued(std::string &err) try {
const dpct::err0 e = DPCT_CHECK_ERROR(dpct::get_in_order_queue().wait());
/*
- DPCT1000:775: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (e != 0) {
/*
- DPCT1009:776: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:774: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = std::string("ExpertCache::sync_queued: ") +
dpct::get_error_string_dummy(e);
@@ -428,17 +472,17 @@ bool ExpertCache::verify_slot(int32_t slot, const uint8_t *host_blob,
const dpct::err0 e = DPCT_CHECK_ERROR(
dpct::get_in_order_queue().memcpy(got.data(), src, (size_t)nb).wait());
/*
- DPCT1000:778: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (e != 0) {
/*
- DPCT1009:779: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:777: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = std::string("ExpertCache::verify_slot: ") +
dpct::get_error_string_dummy(e);
diff --git a/sycl/src/core/expert_source.cpp b/sycl/src/core/expert_source.cpp
index 8beed71d..c6173702 100644
--- a/sycl/src/core/expert_source.cpp
+++ b/sycl/src/core/expert_source.cpp
@@ -19,11 +19,18 @@
#include
#include
#include
+#include
+#include
+#include
#include
+#include
#include
#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
+#ifndef NOMINMAX
+#define NOMINMAX // std::numeric_limits::max() below
+#endif
#include
#else
#include
@@ -34,6 +41,213 @@
namespace strata::core {
+namespace detail {
+
+bool cgroup_available_bytes(uint64_t limit, const CgroupMemoryStat& stat, uint64_t& bytes) {
+ bytes = 0;
+ if (!stat.valid) return false;
+
+ // memory.stat's inactive_file can race memory.current, so bound it to charged usage first.
+ uint64_t reclaimable = std::min(stat.inactive_file, stat.current);
+ reclaimable = stat.file_dirty >= reclaimable ? 0 : reclaimable - stat.file_dirty;
+ reclaimable = stat.file_writeback >= reclaimable ? 0 : reclaimable - stat.file_writeback;
+
+ // Reclaiming clean file pages reduces usage; saturating subtraction also handles a transient over-limit read.
+ const uint64_t usage_after_reclaim = stat.current - reclaimable;
+ bytes = usage_after_reclaim < limit ? limit - usage_after_reclaim : 0;
+ return true;
+}
+
+bool make_cache_complement_plan(
+ int64_t n_layers, int64_t n_expert, const std::vector& layer_blob_bytes,
+ const std::vector>& primary_gpu_pairs,
+ const std::vector>& additional_gpu_pairs,
+ std::vector& offsets, uint64_t& bytes, std::string& err) {
+ offsets.clear();
+ bytes = 0;
+ err.clear();
+ if (n_layers <= 0 || n_expert <= 0 || layer_blob_bytes.size() != (size_t) n_layers) {
+ err = "FileExpertSource: invalid geometry for the cache complement plan";
+ return false;
+ }
+ if ((uint64_t) n_layers > (uint64_t) std::numeric_limits::max() / (uint64_t) n_expert) {
+ err = "FileExpertSource: cache complement index table is too large";
+ return false;
+ }
+ const size_t count = (size_t) n_layers * (size_t) n_expert;
+ std::vector omitted(count, 0);
+ auto mark_pairs = [&](const std::vector>& pairs, uint8_t bit,
+ const char* label) -> bool {
+ for (const auto& pair : pairs) {
+ if (pair.first < 0 || pair.second < 0 || pair.first >= n_layers || pair.second >= n_expert) {
+ err = std::string("FileExpertSource: ") + label + " pair is outside the expert geometry";
+ return false;
+ }
+ const size_t index = (size_t) pair.first * (size_t) n_expert + (size_t) pair.second;
+ if ((omitted[index] & bit) != 0) {
+ err = std::string("FileExpertSource: duplicate ") + label + " pair in the cache complement plan";
+ return false;
+ }
+ if (bit == 2 && (omitted[index] & 1) != 0) {
+ err = "FileExpertSource: the primary and additional GPU expert tiers overlap";
+ return false;
+ }
+ omitted[index] |= bit;
+ }
+ return true;
+ };
+ if (!mark_pairs(primary_gpu_pairs, 1, "primary GPU") ||
+ !mark_pairs(additional_gpu_pairs, 2, "additional GPU")) return false;
+ for (uint64_t blob_bytes : layer_blob_bytes) {
+ if (blob_bytes == 0) {
+ err = "FileExpertSource: cache complement layer has zero-sized expert blobs";
+ return false;
+ }
+ }
+
+ offsets.assign(count, kNoCacheComplement);
+ for (int64_t layer = 0; layer < n_layers; ++layer) {
+ const uint64_t blob_bytes = layer_blob_bytes[(size_t) layer];
+ for (int64_t expert = 0; expert < n_expert; ++expert) {
+ const size_t index = (size_t) layer * (size_t) n_expert + (size_t) expert;
+ if (omitted[index] != 0) continue;
+ if (bytes > std::numeric_limits::max() - blob_bytes) {
+ offsets.clear();
+ bytes = 0;
+ err = "FileExpertSource: cache complement size overflows";
+ return false;
+ }
+ offsets[index] = bytes;
+ bytes += blob_bytes;
+ }
+ }
+ if (bytes > (uint64_t) std::numeric_limits::max()) {
+ offsets.clear();
+ bytes = 0;
+ err = "FileExpertSource: cache complement exceeds the host address space";
+ return false;
+ }
+ return true;
+}
+
+const uint8_t* cache_complement_blob_or_fallback(
+ size_t index, const std::vector& offsets, const uint8_t* complement_host,
+ const uint8_t* mapped_fallback) {
+ if (complement_host != nullptr && index < offsets.size() && offsets[index] != kNoCacheComplement)
+ return complement_host + (size_t) offsets[index];
+ return mapped_fallback;
+}
+
+} // namespace detail
+
+namespace {
+constexpr uint64_t kPinnedMemoryHeadroom = 8ull << 30;
+
+#if defined(__linux__)
+bool read_cgroup_memory_stat(const std::filesystem::path& path, uint64_t current,
+ detail::CgroupMemoryStat& stat) {
+ std::ifstream input(path / "memory.stat");
+ if (!input) return false;
+
+ bool inactive_file = false, file_dirty = false, file_writeback = false;
+ std::string line;
+ while (std::getline(input, line)) {
+ std::istringstream fields(line);
+ std::string key;
+ uint64_t value = 0;
+ if (!(fields >> key >> value)) return false;
+ fields >> std::ws;
+ if (!fields.eof()) return false;
+
+ if (key == "inactive_file") {
+ if (inactive_file) return false;
+ inactive_file = true;
+ stat.inactive_file = value;
+ } else if (key == "file_dirty") {
+ if (file_dirty) return false;
+ file_dirty = true;
+ stat.file_dirty = value;
+ } else if (key == "file_writeback") {
+ if (file_writeback) return false;
+ file_writeback = true;
+ stat.file_writeback = value;
+ }
+ }
+ if (!input.eof() || !inactive_file || !file_dirty || !file_writeback) return false;
+ stat.current = current;
+ stat.valid = true;
+ return true;
+}
+#endif
+
+bool available_memory_bytes(uint64_t& bytes) {
+#if defined(_WIN32)
+ MEMORYSTATUSEX status{};
+ status.dwLength = sizeof(status);
+ if (!GlobalMemoryStatusEx(&status)) return false;
+ bytes = (uint64_t) status.ullAvailPhys;
+ return bytes > 0;
+#elif defined(__linux__)
+ // MemAvailable includes reclaimable page cache, unlike _SC_AVPHYS_PAGES.
+ std::ifstream info("/proc/meminfo");
+ std::string line;
+ bytes = 0;
+ while (std::getline(info, line)) {
+ std::istringstream fields(line);
+ std::string key, unit;
+ uint64_t value = 0;
+ if (fields >> key >> value >> unit && key == "MemAvailable:" && unit == "kB" &&
+ value <= std::numeric_limits::max() / 1024) bytes = value * 1024;
+ }
+ if (bytes == 0) return false;
+ // Account for the tightest cgroup-v2 ancestor limit when its normal mount is visible.
+ // This is a point-in-time guard, not a reservation against concurrent allocations.
+ std::ifstream groups("/proc/self/cgroup");
+ if (!groups) return false;
+ bool resolved_v2 = false;
+ while (std::getline(groups, line)) {
+ if (line.rfind("0::/", 0) != 0) continue;
+ const std::filesystem::path root("/sys/fs/cgroup");
+ auto path = (root / line.substr(4)).lexically_normal();
+ if (path.string().rfind(root.string(), 0) != 0 || !std::filesystem::is_directory(path)) return false;
+ resolved_v2 = true;
+ while (path.string().rfind(root.string(), 0) == 0) {
+ std::ifstream limit_file(path / "memory.max"), current_file(path / "memory.current");
+ std::string limit;
+ uint64_t current = 0;
+ const bool readable = bool(limit_file >> limit) && bool(current_file >> current);
+ // The host's root cgroup has no memory.max; ordinary child groups must expose their limits.
+ if (!readable && !(path == root && !std::filesystem::exists(path / "memory.max") &&
+ std::filesystem::exists(path / "cgroup.controllers"))) return false;
+ if (readable && limit != "max") {
+ try {
+ size_t consumed = 0;
+ const uint64_t cap = std::stoull(limit, &consumed);
+ if (consumed != limit.size()) return false;
+ detail::CgroupMemoryStat stat;
+ if (!read_cgroup_memory_stat(path, current, stat)) return false;
+ uint64_t cgroup_available = 0;
+ if (!detail::cgroup_available_bytes(cap, stat, cgroup_available)) return false;
+ bytes = std::min(bytes, cgroup_available);
+ } catch (...) { return false; }
+ }
+ if (path == root) break;
+ path = path.parent_path();
+ }
+ }
+ return resolved_v2;
+#else
+ const long pages = sysconf(_SC_AVPHYS_PAGES);
+ const long page_bytes = sysconf(_SC_PAGESIZE);
+ if (pages <= 0 || page_bytes <= 0 ||
+ (uint64_t) pages > std::numeric_limits::max() / (uint64_t) page_bytes) return false;
+ bytes = (uint64_t) pages * (uint64_t) page_bytes;
+ return bytes > 0;
+#endif
+}
+
+} // namespace
+
// ================================ THE FILE-BACKED SOURCE ================================
FileExpertSource::~FileExpertSource() { close(); }
@@ -41,9 +255,74 @@ FileExpertSource::~FileExpertSource() { close(); }
bool FileExpertSource::open(const std::string& pack_dir, int64_t n_layers, int64_t n_expert, std::string& err) {
close();
if (n_layers <= 0 || n_expert <= 0) { err = "FileExpertSource: the geometry is empty"; return false; }
- n_expert_ = n_expert;
- blobs_ = n_layers * n_expert;
- const uint64_t want = (uint64_t) blobs_ * (uint64_t) strata::kernels::cpu::BLOB;
+ const auto& layout = strata::kernels::cpu::expert_layout();
+ if (layout.n_layers != n_layers || layout.n_expert != n_expert) {
+ err = "FileExpertSource: the requested geometry does not match the loaded expert layout";
+ return false;
+ }
+ if ((uint64_t) n_layers > (uint64_t) std::numeric_limits::max() / (uint64_t) n_expert) {
+ err = "FileExpertSource: the expert count overflows";
+ return false;
+ }
+ const uint64_t blob_count = (uint64_t) n_layers * (uint64_t) n_expert;
+ if (blob_count > (uint64_t) std::numeric_limits::max() ||
+ (uint64_t) n_layers > (uint64_t) std::numeric_limits::max()) {
+ err = "FileExpertSource: the expert count overflows";
+ return false;
+ }
+
+ std::vector layer_offsets((size_t) n_layers), layer_blob_bytes((size_t) n_layers);
+ const uint64_t want = layout.total;
+ if (want == 0 || want > (uint64_t) std::numeric_limits::max()) {
+ err = "FileExpertSource: the loaded expert layout has an invalid size";
+ return false;
+ }
+ if (!layout.native) {
+ if (blob_count > std::numeric_limits::max() / (uint64_t) strata::kernels::cpu::BLOB) {
+ err = "FileExpertSource: the canonical expert size overflows";
+ return false;
+ }
+ const uint64_t canonical_size = blob_count * (uint64_t) strata::kernels::cpu::BLOB;
+ if (want != canonical_size) {
+ err = "FileExpertSource: the canonical expert layout has an inconsistent size";
+ return false;
+ }
+ const uint64_t bytes = (uint64_t) strata::kernels::cpu::BLOB;
+ const uint64_t layer_bytes = (uint64_t) n_expert * bytes;
+ for (int64_t layer = 0; layer < n_layers; ++layer) {
+ layer_offsets[(size_t) layer] = (uint64_t) layer * layer_bytes;
+ layer_blob_bytes[(size_t) layer] = bytes;
+ }
+ } else {
+ if (layout.offset.size() != (size_t) n_layers || layout.bytes.size() != (size_t) n_layers ||
+ layout.fmt.size() != (size_t) n_layers) {
+ err = "FileExpertSource: the native expert layout is incomplete";
+ return false;
+ }
+ uint64_t at = 0;
+ for (int64_t layer = 0; layer < n_layers; ++layer) {
+ const size_t i = (size_t) layer;
+ const uint64_t bytes = (uint64_t) layout.fmt[i].bytes;
+ if (layout.offset[i] != at || bytes == 0 || layout.bytes[i] != bytes ||
+ bytes > std::numeric_limits::max() / (uint64_t) n_expert) {
+ err = "FileExpertSource: the native expert layout is invalid at layer " + std::to_string(layer);
+ return false;
+ }
+ const uint64_t layer_bytes = bytes * (uint64_t) n_expert;
+ if (at > want || layer_bytes > want - at) {
+ err = "FileExpertSource: the native expert layout exceeds its declared size at layer " +
+ std::to_string(layer);
+ return false;
+ }
+ layer_offsets[i] = layout.offset[i];
+ layer_blob_bytes[i] = bytes;
+ at += layer_bytes;
+ }
+ if (at != want) {
+ err = "FileExpertSource: the native expert layout has an inconsistent size";
+ return false;
+ }
+ }
const std::string path = pack_dir + "/experts.bin";
#if defined(_WIN32)
@@ -78,10 +357,9 @@ bool FileExpertSource::open(const std::string& pack_dir, int64_t n_layers, int64
if ((uint64_t) sz.QuadPart != want) {
char buf[400];
std::snprintf(buf, sizeof buf,
- "FileExpertSource: %s is %llu B but %lld layers x %lld experts x %d B is %llu B - this "
- "is not the pack this geometry came from",
- path.c_str(), (unsigned long long) sz.QuadPart, (long long) n_layers,
- (long long) n_expert, (int) strata::kernels::cpu::BLOB, (unsigned long long) want);
+ "FileExpertSource: %s is %llu B but the loaded expert layout requires %llu B - this is not "
+ "the pack this geometry came from",
+ path.c_str(), (unsigned long long) sz.QuadPart, (unsigned long long) want);
CloseHandle(f);
err = buf;
return false;
@@ -107,13 +385,13 @@ bool FileExpertSource::open(const std::string& pack_dir, int64_t n_layers, int64
if (fd < 0) { err = "FileExpertSource: cannot open " + path; return false; }
struct stat st{};
if (fstat(fd, &st) != 0) { ::close(fd); err = "FileExpertSource: cannot stat " + path; return false; }
- if ((uint64_t) st.st_size != want) {
+ if (st.st_size < 0 || (uint64_t) st.st_size != want) {
char buf[400];
std::snprintf(buf, sizeof buf,
- "FileExpertSource: %s is %llu B but %lld layers x %lld experts x %d B is %llu B - this "
- "is not the pack this geometry came from",
- path.c_str(), (unsigned long long) st.st_size, (long long) n_layers, (long long) n_expert,
- (int) strata::kernels::cpu::BLOB, (unsigned long long) want);
+ "FileExpertSource: %s is %llu B but the loaded expert layout requires %llu B - this is not "
+ "the pack this geometry came from",
+ path.c_str(), (unsigned long long) (st.st_size < 0 ? 0 : st.st_size),
+ (unsigned long long) want);
::close(fd);
err = buf;
return false;
@@ -123,10 +401,28 @@ bool FileExpertSource::open(const std::string& pack_dir, int64_t n_layers, int64
fd_ = fd;
base_ = (const uint8_t*) view;
#endif
+ blobs_ = (int64_t) blob_count;
+ n_layers_ = n_layers;
+ n_expert_ = n_expert;
+ mapped_bytes_ = want;
+ layer_offsets_ = std::move(layer_offsets);
+ layer_blob_bytes_ = std::move(layer_blob_bytes);
return true;
}
void FileExpertSource::close() {
+ if (complement_arena_ != nullptr) {
+ if (complement_pinned_)(void) DPCT_CHECK_ERROR(
+ sycl::free(complement_arena_, dpct::get_in_order_queue()));
+ else std::free(complement_arena_);
+ }
+ complement_arena_ = nullptr;
+ complement_host_ = nullptr;
+ complement_device_ = nullptr;
+ complement_bytes_ = 0;
+ complement_offsets_.clear();
+ complement_pinned_ = false;
+ complement_ready_ = false;
#if defined(_WIN32)
if (base_ != nullptr) UnmapViewOfFile((LPCVOID) base_);
if (mapping_ != nullptr) CloseHandle((HANDLE) mapping_);
@@ -134,27 +430,286 @@ void FileExpertSource::close() {
mapping_ = nullptr;
file_ = nullptr;
#else
- if (base_ != nullptr) munmap((void*) base_, (size_t) blobs_ * (size_t) strata::kernels::cpu::BLOB);
+ if (base_ != nullptr) munmap((void*) base_, (size_t) mapped_bytes_);
if (fd_ >= 0) ::close(fd_);
fd_ = -1;
#endif
base_ = nullptr;
blobs_ = 0;
+ n_layers_ = 0;
+ n_expert_ = 0;
+ mapped_bytes_ = 0;
+ layer_offsets_.clear();
+ layer_blob_bytes_.clear();
reads_ = 0;
}
+const uint8_t* FileExpertSource::mapped_blob(int64_t layer, int64_t expert) const {
+ if (base_ == nullptr || layer < 0 || expert < 0 || layer >= n_layers_ || expert >= n_expert_) return nullptr;
+ const size_t i = (size_t) layer;
+ if (i >= layer_offsets_.size() || i >= layer_blob_bytes_.size()) return nullptr;
+ const uint64_t blob_bytes = layer_blob_bytes_[i];
+ if (blob_bytes == 0 || (uint64_t) expert > std::numeric_limits::max() / blob_bytes) return nullptr;
+ const uint64_t expert_offset = (uint64_t) expert * blob_bytes;
+ const uint64_t layer_offset = layer_offsets_[i];
+ if (layer_offset > mapped_bytes_ || expert_offset > mapped_bytes_ - layer_offset) return nullptr;
+ const uint64_t offset = layer_offset + expert_offset;
+ if (blob_bytes > mapped_bytes_ - offset) return nullptr;
+ return base_ + (size_t) offset;
+}
+
+bool FileExpertSource::pin_cache_complement(
+ const ExpertCache &cache, std::string &err, bool pin,
+ const std::vector> &additional_gpu_pairs) try {
+ err.clear();
+ if (base_ == nullptr) { err = "FileExpertSource: open the mapped experts before pinning a complement"; return false; }
+ if (complement_ready_) { err = "FileExpertSource: the cache complement is already pinned"; return false; }
+ if (!cache.valid()) { err = "FileExpertSource: the GPU expert cache is not open"; return false; }
+ if (cache.fills() != cache.resident()) {
+ err = "FileExpertSource: the GPU expert cache is not fully filled";
+ return false;
+ }
+ const dpct::err0 sync =
+ DPCT_CHECK_ERROR(dpct::get_current_device().queues_wait_and_throw());
+ /*
+ DPCT1000: Error handling if-stmt was detected but could not be
+ rewritten.
+ */
+ if (sync != 0) {
+ /*
+ DPCT1009: SYCL reports errors using exceptions and does not use
+ error codes. Please replace the "get_error_string_dummy(...)" with a
+ real error-handling function.
+ */
+ /*
+ DPCT1001: The statement could not be removed.
+ */
+ err = std::string("FileExpertSource: GPU expert cache is not ready: ") +
+ dpct::get_error_string_dummy(sync);
+ /*
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
+ error codes. The cudaGetLastError function call was replaced with 0. You
+ need to rewrite this code.
+ */
+ (void)0;
+ return false;
+ }
+
+ std::vector> primary_gpu_pairs;
+ primary_gpu_pairs.reserve((size_t) cache.resident());
+ for (int64_t layer = 0; layer < n_layers_; ++layer) {
+ for (int64_t expert = 0; expert < n_expert_; ++expert) {
+ if (cache.slot_of(layer, expert) != kNotResident)
+ primary_gpu_pairs.emplace_back((int32_t) layer, (int32_t) expert);
+ }
+ }
+ std::vector offsets;
+ uint64_t bytes = 0;
+ if (!detail::make_cache_complement_plan(n_layers_, n_expert_, layer_blob_bytes_, primary_gpu_pairs,
+ additional_gpu_pairs, offsets, bytes, err)) return false;
+
+ if (bytes > 0) {
+ uint64_t physical = 0;
+ if (!available_memory_bytes(physical)) {
+ err = "FileExpertSource: cannot determine available RAM for the resident-memory safety check";
+ return false;
+ }
+ if (physical <= kPinnedMemoryHeadroom || bytes > physical - kPinnedMemoryHeadroom) {
+ char message[256];
+ std::snprintf(message, sizeof message,
+ "FileExpertSource: resident complement %.2f GiB exceeds available RAM minus the 8 GiB safety headroom",
+ (double) bytes / 1073741824.0);
+ err = message;
+ return false;
+ }
+ }
+
+ void* arena = nullptr;
+ const uint8_t* host = nullptr;
+ const uint8_t* device = nullptr;
+ if (bytes > 0) {
+ std::fprintf(stderr, "FileExpertSource: allocating %.2f GiB %s cache complement\n",
+ (double) bytes / 1073741824.0, pin ? "mapped pinned" : "pageable resident");
+ std::fflush(stderr);
+ if (pin) {
+ const dpct::err0 allocated = DPCT_CHECK_ERROR(
+ arena = (void *)sycl::malloc_host((size_t)bytes,
+ dpct::get_in_order_queue()));
+ /*
+ DPCT1000: Error handling if-stmt was detected but could not be
+ rewritten.
+ */
+ if (allocated != 0) {
+ /*
+ DPCT1001: The statement could not be removed.
+ */
+ err = std::string("FileExpertSource: mapped pinned complement "
+ "allocation failed: ") +
+ /*
+ DPCT1009: SYCL reports errors using exceptions and
+ does not use error codes. Please replace the
+ "get_error_string_dummy(...)" with a real error-handling
+ function.
+ */
+ dpct::get_error_string_dummy(allocated);
+ std::fprintf(stderr, "%s\n", err.c_str());
+ std::fflush(stderr);
+ /*
+ DPCT1010: SYCL uses exceptions to report errors and does not
+ use the error codes. The cudaGetLastError function call was
+ replaced with 0. You need to rewrite this code.
+ */
+ (void)0;
+ return false;
+ }
+ host = (const uint8_t*) arena;
+ void* alias = nullptr;
+ const dpct::err0 aliased = DPCT_CHECK_ERROR(alias = (void *)arena);
+ if (aliased != 0 || alias == nullptr) {
+ err = std::string("FileExpertSource: mapped pinned complement "
+ "device alias failed: ") +
+ /*
+ DPCT1009: SYCL reports errors using exceptions and
+ does not use error codes. Please replace the
+ "get_error_string_dummy(...)" with a real error-handling
+ function.
+ */
+ dpct::get_error_string_dummy(aliased);
+ std::fprintf(stderr, "%s\n", err.c_str());
+ std::fflush(stderr);
+ /*
+ DPCT1010: SYCL uses exceptions to report errors and does not
+ use the error codes. The cudaGetLastError function call was
+ replaced with 0. You need to rewrite this code.
+ */
+ (void)0;
+ (void)DPCT_CHECK_ERROR(
+ sycl::free(arena, dpct::get_in_order_queue()));
+ return false;
+ }
+ device = (const uint8_t*) alias;
+ } else {
+ arena = std::malloc((size_t) bytes);
+ if (arena == nullptr) {
+ err = "FileExpertSource: pageable resident complement allocation failed";
+ return false;
+ }
+ host = (const uint8_t*) arena;
+ }
+ }
+
+ uint64_t copied = 0;
+ for (int64_t layer = 0; layer < n_layers_; ++layer) {
+ const uint64_t blob_bytes = layer_blob_bytes_[(size_t) layer];
+ for (int64_t expert = 0; expert < n_expert_; ++expert) {
+ const size_t index = (size_t) layer * (size_t) n_expert_ + (size_t) expert;
+ const uint64_t offset = offsets[index];
+ if (offset == kNoComplement) continue;
+ const uint8_t* source = mapped_blob(layer, expert);
+ if (source == nullptr || offset > bytes || blob_bytes > bytes - offset) {
+ err = "FileExpertSource: invalid blob bounds while building the cache complement";
+ if (arena != nullptr) {
+ if (pin)(void) DPCT_CHECK_ERROR(
+ sycl::free(arena, dpct::get_in_order_queue()));
+ else std::free(arena);
+ }
+ return false;
+ }
+ std::memcpy((uint8_t*) host + (size_t) offset, source, (size_t) blob_bytes);
+ copied += blob_bytes;
+ }
+#if !defined(_WIN32)
+ const uint64_t layer_offset = layer_offsets_[(size_t) layer];
+ const uint64_t layer_bytes = blob_bytes * (uint64_t) n_expert_;
+ const uint64_t layer_end = layer_offset + layer_bytes;
+ const long page_bytes = sysconf(_SC_PAGESIZE);
+ if (page_bytes <= 0) {
+ err = "FileExpertSource: cannot determine page size for mapped-page release";
+ if (arena != nullptr) {
+ if (pin)(void) DPCT_CHECK_ERROR(
+ sycl::free(arena, dpct::get_in_order_queue()));
+ else std::free(arena);
+ }
+ return false;
+ }
+ const uint64_t page = (uint64_t) page_bytes;
+ const uint64_t advice_start = layer_offset - layer_offset % page;
+ const uint64_t end_remainder = layer_end % page;
+ const uint64_t extra = end_remainder == 0 ? 0 : page - end_remainder;
+ const uint64_t advice_end = extra > mapped_bytes_ - layer_end ? mapped_bytes_ : layer_end + extra;
+ if (advice_end > advice_start &&
+ madvise((void*) (base_ + (size_t) advice_start), (size_t) (advice_end - advice_start), MADV_DONTNEED) != 0) {
+ err = "FileExpertSource: madvise could not release mapped expert layer " + std::to_string(layer);
+ if (arena != nullptr) {
+ if (pin)(void) DPCT_CHECK_ERROR(
+ sycl::free(arena, dpct::get_in_order_queue()));
+ else std::free(arena);
+ }
+ return false;
+ }
+ const int advice = posix_fadvise(fd_, (off_t) layer_offset, (off_t) layer_bytes, POSIX_FADV_DONTNEED);
+ if (advice != 0) {
+ err = "FileExpertSource: posix_fadvise could not release expert layer " + std::to_string(layer);
+ if (arena != nullptr) {
+ if (pin)(void) DPCT_CHECK_ERROR(
+ sycl::free(arena, dpct::get_in_order_queue()));
+ else std::free(arena);
+ }
+ return false;
+ }
+#endif
+ if ((layer + 1) % 8 == 0 || layer + 1 == n_layers_) {
+ std::fprintf(stderr, "FileExpertSource: copied cache complement through layer %lld/%lld (%.2f GiB)\n",
+ (long long) (layer + 1), (long long) n_layers_, (double) copied / 1073741824.0);
+ std::fflush(stderr);
+ }
+ }
+
+ complement_arena_ = arena;
+ complement_host_ = host;
+ complement_device_ = device;
+ complement_bytes_ = bytes;
+ complement_offsets_ = std::move(offsets);
+ complement_pinned_ = pin && bytes > 0;
+ complement_ready_ = true;
+ std::fprintf(stderr, "FileExpertSource: %s cache complement ready: resident %.2f GiB, pinned %.2f GiB\n",
+ complement_pinned_ ? "mapped pinned" : "pageable resident",
+ (double) resident_bytes() / 1073741824.0, (double) pinned_bytes() / 1073741824.0);
+ if (!additional_gpu_pairs.empty()) {
+ std::fprintf(stderr, "FileExpertSource: %zu verified additional-GPU experts remain on the mmap fallback\n",
+ additional_gpu_pairs.size());
+ }
+ std::fflush(stderr);
+ return true;
+}
+catch (sycl::exception const &exc) {
+ std::cerr << exc.what() << "Exception caught at file:" << __FILE__
+ << ", line:" << __LINE__ << std::endl;
+ std::exit(1);
+}
+
const uint8_t* FileExpertSource::blob(int64_t layer, int64_t expert) {
- if (base_ == nullptr) return nullptr;
- if (layer < 0 || expert < 0) return nullptr;
- // **`expert >= n_expert_` IS CHECKED SEPARATELY, AND THE FLAT INDEX ALONE DOES NOT CATCH IT.** The blob
- // index is `layer * n_expert + expert`, so `blob(0, 512)` has flat index 512 - which is in range, and is
- // `blob(1, 0)`. A router id one past the end of a layer would then read the NEXT LAYER's first expert:
- // finite, correctly sized, and wrong. Layer and expert are separate axes and are validated as such.
- if (expert >= n_expert_) return nullptr;
- const int64_t i = layer * n_expert_ + expert;
- if (i >= blobs_) return nullptr;
- ++reads_;
- return base_ + (size_t) i * strata::kernels::cpu::BLOB;
+ if (base_ == nullptr || layer < 0 || expert < 0 || layer >= n_layers_ || expert >= n_expert_) return nullptr;
+ const size_t index = (size_t) layer * (size_t) n_expert_ + (size_t) expert;
+ const uint8_t* mapped_fallback = mapped_blob(layer, expert);
+ const uint8_t* result = complement_ready_
+ ? detail::cache_complement_blob_or_fallback(index, complement_offsets_, complement_host_, mapped_fallback)
+ : mapped_fallback;
+ if (result != nullptr) ++reads_;
+ return result;
+}
+
+bool FileExpertSource::pinned(int64_t layer, int64_t expert) const {
+ if (!complement_ready_ || !complement_pinned_ || complement_host_ == nullptr || layer < 0 || expert < 0 ||
+ layer >= n_layers_ || expert >= n_expert_) return false;
+ const size_t index = (size_t) layer * (size_t) n_expert_ + (size_t) expert;
+ return index < complement_offsets_.size() && complement_offsets_[index] != kNoComplement;
+}
+
+const uint8_t* FileExpertSource::device_alias(int64_t layer, int64_t expert) const {
+ if (!pinned(layer, expert) || complement_device_ == nullptr) return nullptr;
+ const size_t index = (size_t) layer * (size_t) n_expert_ + (size_t) expert;
+ return complement_device_ + (size_t) complement_offsets_[index];
}
// ================================ THE ADAPTER ================================
@@ -546,7 +1101,7 @@ void expert_hit_run(void *user, void *stream, HitPhase phase,
if (DPCT_CHECK_ERROR(cs->memset(
d.hit_out, 0, (size_t)d.parts_elems * sizeof(float))) != 0 ||
/*
- DPCT1124:653: cudaMemcpyAsync is migrated to asynchronous memcpy
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy
API. While the origin API might be synchronous, it depends on the
type of operand memory, so you may need to call wait() on event
return by memcpy API to ensure synchronization behavior.
@@ -554,7 +1109,7 @@ void expert_hit_run(void *user, void *stream, HitPhase phase,
DPCT_CHECK_ERROR(
cs->memcpy(d.d_slot, d.h_slot.data(), list_bytes)) != 0 ||
/*
- DPCT1124:654: cudaMemcpyAsync is migrated to asynchronous memcpy
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy
API. While the origin API might be synchronous, it depends on the
type of operand memory, so you may need to call wait() on event
return by memcpy API to ensure synchronization behavior.
@@ -764,7 +1319,7 @@ bool ArenaExpertSource::open(const std::string &pack_dir, int64_t n_layers,
void* d = nullptr;
if (DPCT_CHECK_ERROR(d = (void *)(void *)(base_ + off)) != 0) {
/*
- DPCT1010:655: SYCL uses exceptions to report errors and does not
+ DPCT1010: SYCL uses exceptions to report errors and does not
use the error codes. The cudaGetLastError function call was
replaced with 0. You need to rewrite this code.
*/
diff --git a/sycl/src/core/graph.cpp b/sycl/src/core/graph.cpp
index eab5afa0..5d455022 100644
--- a/sycl/src/core/graph.cpp
+++ b/sycl/src/core/graph.cpp
@@ -17,7 +17,7 @@ namespace {
/// site is the least useful error this API can produce and the easiest to avoid.
bool fail(std::string &err, const char *what, dpct::err0 e) {
/*
- DPCT1009:68: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
@@ -58,10 +58,10 @@ bool CapturedGraph::begin(void *stream, std::string &err) try {
const dpct::err0 e = DPCT_CHECK_ERROR(
dpct::experimental::begin_recording(strata::q_of(stream)));
/*
- DPCT1001:69: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:70: Error handling if-stmt was detected but could not be rewritten.
+ DPCT1000: Error handling if-stmt was detected but could not be rewritten.
*/
if (e != 0) return fail(err, "cudaStreamBeginCapture", e);
return true;
@@ -76,10 +76,10 @@ bool CapturedGraph::end(void *stream, std::string &err) try {
dpct::err0 e = DPCT_CHECK_ERROR(
dpct::experimental::end_recording(strata::q_of(stream), &graph_));
/*
- DPCT1001:71: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:72: Error handling if-stmt was detected but could not be rewritten.
+ DPCT1000: Error handling if-stmt was detected but could not be rewritten.
*/
if (e != 0) {
graph_ = nullptr; return fail(err, "cudaStreamEndCapture", e);
@@ -89,10 +89,10 @@ bool CapturedGraph::end(void *stream, std::string &err) try {
e = DPCT_CHECK_ERROR(
dpct::experimental::get_nodes(graph_, nullptr, &nodes_));
/*
- DPCT1001:73: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:74: Error handling if-stmt was detected but could not be rewritten.
+ DPCT1000: Error handling if-stmt was detected but could not be rewritten.
*/
if (e != 0) return fail(err, "cudaGraphGetNodes", e);
// A capture that recorded NOTHING is a wiring mistake, and a graph that replays nothing produces no error
@@ -104,10 +104,10 @@ bool CapturedGraph::end(void *stream, std::string &err) try {
sycl::ext::oneapi::experimental::graph_state::executable>(
(graph_)->finalize()));
/*
- DPCT1001:75: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:76: Error handling if-stmt was detected but could not be rewritten.
+ DPCT1000: Error handling if-stmt was detected but could not be rewritten.
*/
if (e != 0) return fail(err, "cudaGraphInstantiate", e);
@@ -115,10 +115,10 @@ bool CapturedGraph::end(void *stream, std::string &err) try {
// what makes `wait_ms` a query rather than a sync.
e = DPCT_CHECK_ERROR(done_ = new sycl::event());
/*
- DPCT1001:77: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:78: Error handling if-stmt was detected but could not be rewritten.
+ DPCT1000: Error handling if-stmt was detected but could not be rewritten.
*/
if (e != 0) return fail(err, "cudaEventCreateWithFlags", e);
return true;
@@ -134,19 +134,19 @@ bool CapturedGraph::launch(void *stream, std::string &err) const try {
dpct::err0 e =
DPCT_CHECK_ERROR(strata::q_of(stream)->ext_oneapi_graph(*exec_));
/*
- DPCT1001:79: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:80: Error handling if-stmt was detected but could not be rewritten.
+ DPCT1000: Error handling if-stmt was detected but could not be rewritten.
*/
if (e != 0) return fail(err, "cudaGraphLaunch", e);
/*
- DPCT1012:83: Detected kernel execution time measurement pattern and
+ DPCT1012: Detected kernel execution time measurement pattern and
generated an initial code for time measurements in SYCL. You can change the
way time is measured depending on your goals.
*/
/*
- DPCT1024:84: The original code returned the error code that was further
+ DPCT1024: The original code returned the error code that was further
consumed by the program logic. This original code was replaced with 0. You
may need to rewrite the program logic consuming the error code.
*/
@@ -154,10 +154,10 @@ bool CapturedGraph::launch(void *stream, std::string &err) const try {
e = DPCT_CHECK_ERROR(*done_ = strata::q_of(stream)
->ext_oneapi_submit_barrier());
/*
- DPCT1001:81: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:82: Error handling if-stmt was detected but could not be rewritten.
+ DPCT1000: Error handling if-stmt was detected but could not be rewritten.
*/
if (e != 0) return fail(err, "cudaEventRecord", e);
return true;
@@ -203,19 +203,19 @@ bool GraphRegistry::record(LayerType type, int n_tokens, const std::functiond_x_f, db->d_ids, db->d_weights, db->d_seq,
stream);
/*
-DPCT1124:795: cudaMemcpyAsync is migrated to asynchronous memcpy API. While the
+DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API. While the
origin API might be synchronous, it depends on the type of operand memory, so
you may need to call wait() on event return by memcpy API to ensure
synchronization behavior.
@@ -568,10 +570,15 @@ KvPlan kv_plan(const QsaShapes& s, int64_t max_cells, int64_t ring_cells) {
}
return p;
}
-uint64_t kv_pool_bytes(const QsaShapes& s, int64_t pages) {
+uint64_t kv_pool_bytes(const QsaShapes& s, int64_t pages, bool hybrid, bool int8) {
+ if (hybrid) { // K8V4: the INT8 K half (codes + scales) plus the Q4_0 V half (kv_q4.hpp's rotation)
+ const uint64_t rows = (uint64_t) pages * s.page_size * s.n_head_kv;
+ return rows * (uint64_t) s.head_dim + rows * (uint64_t) (s.head_dim / strata::kernels::KV_Q8_GROUP) * 2 +
+ rows * strata::kernels::kv_q4_bytes_per_head((int) s.head_dim) + 64;
+ }
if (g_kv_q4) return (uint64_t) pages * s.page_size * strata::kernels::kv_q4_bytes_per_cell(s) + 64;
- return g_kv_int8 ? (uint64_t) pages * s.page_size * strata::kernels::kv_q8_bytes_per_cell(s) + 64
- : (uint64_t) pages * s.n_head_kv * s.page_size * s.head_dim * 2 * 2;
+ return int8 ? (uint64_t) pages * s.page_size * strata::kernels::kv_q8_bytes_per_cell(s) + 64
+ : (uint64_t) pages * s.n_head_kv * s.page_size * s.head_dim * 2 * 2;
}
} // namespace
@@ -584,7 +591,8 @@ uint64_t qsa_state_bytes(const ModelGeometry& g, int64_t max_cells, bool with_ro
const QsaShapes s = qsa_shapes(g);
const KvPlan p = kv_plan(s, max_cells, ring_cells);
uint64_t n = 0;
- n += kv_pool_bytes(s, p.slots) + 4 * 16; // K/V pools (the VRAM slots)
+ n += kv_pool_bytes(s, p.slots, g_kv_hybrid && ring_cells <= 0,
+ g_kv_int8 || g_kv_hybrid) + 4 * 16; // K/V pools (the VRAM slots)
n += (uint64_t) p.pages * 4; // page_table
if (p.mode == 1) n += strata::kernels::kv_stream_map_bytes(p.slots) + 6 * 16; // the residency map
n += (uint64_t) (s.idx_block - 1) * s.idx_dim * 4; // tail
@@ -606,14 +614,29 @@ uint64_t qsa_state_init(const ModelGeometry &g, int64_t max_cells, void *base,
Cursor c{(uint8_t*) base};
st.kv_int8 = g_kv_int8 && !g_kv_q4;
st.kv_q4 = g_kv_q4;
+ // Hybrid K8V4, main layers only (the drafter's state is created with the globals toggled to INT8 -
+ // mtp.cpp). Streamed mode is refused outright; generate.cpp validates it too, this is the backstop.
+ if (g_kv_hybrid && ring_cells <= 0) {
+ if (p.mode == 1) {
+ std::fprintf(stderr, "strata: hybrid K8V4 KV does not support --kv-resident streaming\n");
+ return 0;
+ }
+ st.kv_hybrid = true;
+ st.kv_int8 = false;
+ st.kv_q4 = false;
+ }
st.kv_mode = p.mode;
st.n_slots = p.slots;
const uint64_t rows = (uint64_t) p.slots * s.n_head_kv * s.page_size; // VRAM rows: the slots
const uint64_t q4_row = strata::kernels::kv_q4_bytes_per_head((int) s.head_dim);
- if (st.kv_q4) {
+ if (st.kv_hybrid) {
+ st.k_q = c.take(rows * s.head_dim);
+ st.k_scale = c.take(rows * (s.head_dim / strata::kernels::KV_Q8_GROUP));
+ st.v_q4 = c.take(rows * q4_row);
+ } else if (st.kv_q4) {
st.k_q4 = c.take(rows * q4_row);
st.v_q4 = c.take(rows * q4_row);
- } else if (g_kv_int8) {
+ } else if (st.kv_int8) { // st, not the global: the drafter's ring is INT8 under --kv k8v4 too
st.k_q = c.take(rows * s.head_dim);
st.v_q = c.take(rows * s.head_dim);
st.k_scale = c.take(rows * (s.head_dim / strata::kernels::KV_Q8_GROUP));
@@ -658,12 +681,12 @@ uint64_t qsa_state_init(const ModelGeometry &g, int64_t max_cells, void *base,
strata::kernels::qsa_step_bytes() + sizeof(int32_t),
dpct::get_in_order_queue())) != 0 ||
/*
- DPCT1048:8: The original value cudaHostAllocMapped is not meaningful in
+ DPCT1048: The original value cudaHostAllocMapped is not meaningful in
the migrated code and was removed or replaced with 0. You may need to
check the migrated code.
*/
/*
- DPCT1048:9: The original value cudaHostAllocPortable is not meaningful
+ DPCT1048: The original value cudaHostAllocPortable is not meaningful
in the migrated code and was removed or replaced with 0. You may need to
check the migrated code.
*/
@@ -681,12 +704,12 @@ uint64_t qsa_state_init(const ModelGeometry &g, int64_t max_cells, void *base,
uint8_t* h = nullptr;
uint8_t* d = nullptr;
/*
- DPCT1048:10: The original value cudaHostAllocMapped is not meaningful in
+ DPCT1048: The original value cudaHostAllocMapped is not meaningful in
the migrated code and was removed or replaced with 0. You may need to
check the migrated code.
*/
/*
- DPCT1048:11: The original value cudaHostAllocPortable is not meaningful
+ DPCT1048: The original value cudaHostAllocPortable is not meaningful
in the migrated code and was removed or replaced with 0. You may need to
check the migrated code.
*/
@@ -705,7 +728,7 @@ uint64_t qsa_state_init(const ModelGeometry &g, int64_t max_cells, void *base,
if (st.kv_q4) {
st.host.k_q4 = hc.take(hrows * q4_row);
st.host.v_q4 = hc.take(hrows * q4_row);
- } else if (g_kv_int8) {
+ } else if (st.kv_int8) {
st.host.k_q = hc.take(hrows * s.head_dim);
st.host.v_q = hc.take(hrows * s.head_dim);
st.host.k_scale = hc.take(hrows * (s.head_dim / strata::kernels::KV_Q8_GROUP));
@@ -755,7 +778,14 @@ void qsa_state_zero(const QsaState& st, const ModelGeometry& g, void* stream) {
const QsaShapes s = qsa_shapes(g);
dpct::queue_ptr cs = strata::q_of(stream);
const size_t rows = (size_t) st.n_slots * s.n_head_kv * s.page_size;
- if (st.kv_q4) {
+ if (st.kv_hybrid) {
+ cs->memset(st.k_q, 0, rows * s.head_dim);
+ cs->memset(st.k_scale, 0,
+ rows * (s.head_dim / strata::kernels::KV_Q8_GROUP) * 2);
+ cs->memset(st.v_q4, 0,
+ rows *
+ strata::kernels::kv_q4_bytes_per_head((int)s.head_dim));
+ } else if (st.kv_q4) {
cs->memset(st.k_q4, 0,
rows *
strata::kernels::kv_q4_bytes_per_head((int)s.head_dim));
@@ -785,7 +815,8 @@ void qsa_state_zero(const QsaState& st, const ModelGeometry& g, void* stream) {
strata::kernels::QsaAttnPools qsa_attn_pools(const QsaState& st) {
strata::kernels::QsaAttnPools pools;
pools.page_table = st.page_table;
- if (st.kv_q4) { pools.k_q4 = st.k_q4; pools.v_q4 = st.v_q4; }
+ if (st.kv_hybrid) { pools.k_q = st.k_q; pools.k_scale = st.k_scale; pools.v_q4 = st.v_q4; }
+ else if (st.kv_q4) { pools.k_q4 = st.k_q4; pools.v_q4 = st.v_q4; }
else if (st.kv_int8) { pools.k_q = st.k_q; pools.v_q = st.v_q; pools.k_scale = st.k_scale; pools.v_scale = st.v_scale; }
else { pools.k_pool = st.k_pool; pools.v_pool = st.v_pool; }
return pools;
@@ -984,7 +1015,7 @@ if (!w_attnk->native_data || !w_attnv->native_data || !w_attnq->native_data) {
strata::kernels::copy_i32_from_mapped(st.pos_dev, m_pos, g.n_head, stream);
} else
/*
- DPCT1124:796: cudaMemcpyAsync is migrated to asynchronous memcpy API.
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API.
While the origin API might be synchronous, it depends on the type of
operand memory, so you may need to call wait() on event return by memcpy
API to ensure synchronization behavior.
@@ -1002,11 +1033,18 @@ if (!gemv_quantized(*w_attnk, p_k, f_k, b.x_q8_0, b.x_q8k, b.kcur, g.n_embd, g.n
// EVERY ENTRY POINT FROM HERE ON IS THE CAPTURABLE ONE: the per-token counts come from `st.step` and every
// launch is sized from a capacity in `st`/`b`, so this sequence can be captured and replayed. The
// host-scalar wrappers would be correct here today and silently wrong in a graph.
-if (st.kv_q4) {
+if (st.kv_hybrid) {
+ // K8V4: only V is rotated (kv_q4.hpp's H); the scores pair unrotated q with unrotated INT8 K, and the
+ // output - a mix of rotated values - is rotated back after attention. Each append/gather call folds the
+ // unused half's lanes onto the used pool (a bit-identical duplicate write), so no kernel variants exist.
+ strata::kernels::fwht256_inplace_cuda(b.vcur, g.n_head_kv, stream);
+ kv_append_q8_step(st.k_q, st.k_q, st.k_scale, st.k_scale, st.page_table, st.step, b.kcur, b.kcur, s, stream, nullptr); // mode 0: no host mirror
+ strata::kernels::kv_append_q4_step(st.v_q4, st.v_q4, st.page_table, st.step, b.vcur, b.vcur, s, stream, nullptr);
+} else if (st.kv_q4) {
strata::kernels::fwht256_inplace_cuda(b.kcur, g.n_head_kv, stream); // Q4_0: rotated K and V (kv_q4.hpp)
strata::kernels::fwht256_inplace_cuda(b.vcur, g.n_head_kv, stream);
strata::kernels::kv_append_q4_step(st.k_q4, st.v_q4, st.page_table, st.step, b.kcur, b.vcur, s, stream, &st.host);
-} else if (st.kv_int8) kv_append_q8_step(st.k_q, st.v_q, st.k_scale, st.v_scale, st.page_table, st.step, b.kcur, b.vcur, s, stream, &st.host); else kv_append_step(st.k_pool, st.v_pool, st.page_table, st.step, b.kcur, b.vcur, s, stream, &st.host); { const uint64_t nvk = (uint64_t) g.n_head_kv * g.head_dim; const uint64_t base = (uint64_t) 2 * g.n_embd + 2 * g.hc + (uint64_t) g.n_head * g.head_dim + 2 * nvk + 8; if (!st.kv_int8) dump_slot(dump, g, layer, (const float*) st.k_pool, base, nvk / 2, stream); if (!st.kv_int8) dump_slot(dump, g, layer, (const float*) st.v_pool, base + nvk / 2, nvk / 2, stream); dump_slot(dump, g, layer, b.vcur, base + nvk, nvk, stream); dump_slot(dump, g, layer, b.kcur, base + 2 * nvk, nvk, stream); } { const QsaIndexerBuffers ib{st.idx_tail, st.idx_dead, st.idx_pooled, st.idx_block_pos}; if (native_qsa_indexer_enabled()) {
+} else if (st.kv_int8) kv_append_q8_step(st.k_q, st.v_q, st.k_scale, st.v_scale, st.page_table, st.step, b.kcur, b.vcur, s, stream, &st.host); else kv_append_step(st.k_pool, st.v_pool, st.page_table, st.step, b.kcur, b.vcur, s, stream, &st.host); { const uint64_t nvk = (uint64_t) g.n_head_kv * g.head_dim; const uint64_t base = (uint64_t) 2 * g.n_embd + 2 * g.hc + (uint64_t) g.n_head * g.head_dim + 2 * nvk + 8; if (!st.kv_int8 && !st.kv_hybrid) dump_slot(dump, g, layer, (const float*) st.k_pool, base, nvk / 2, stream); if (!st.kv_int8 && !st.kv_hybrid) dump_slot(dump, g, layer, (const float*) st.v_pool, base + nvk / 2, nvk / 2, stream); dump_slot(dump, g, layer, b.vcur, base + nvk, nvk, stream); dump_slot(dump, g, layer, b.kcur, base + 2 * nvk, nvk, stream); } { const QsaIndexerBuffers ib{st.idx_tail, st.idx_dead, st.idx_pooled, st.idx_block_pos}; if (native_qsa_indexer_enabled()) {
try {
native_qsa_indexer_append(b.idx_raw, st.step + kStepPos, pos_base,
(const float*) w_ikn->data, RMS_EPS, ib, s, st.max_cells, (float) qsa_freq_base(), stream);
@@ -1024,7 +1062,7 @@ if (!gemv_quantized(*w_attnq, p_q, f_q, b.x_q8_0, b.x_q8k, b.q_full, g.n_embd, g
// the norm and the rotation see whole rows. A 2-D copy is a memcpy node, which captures (`pinned_capture`
// case A) and needs no kernel.
/*
-DPCT1124:797: cudaMemcpy2DAsync is migrated to asynchronous memcpy API. While
+DPCT1124: cudaMemcpy2DAsync is migrated to asynchronous memcpy API. While
the origin API might be synchronous, it depends on the type of operand memory,
so you may need to call wait() on event return by memcpy API to ensure
synchronization behavior.
@@ -1057,7 +1095,13 @@ int64_t max_blocks = (st.max_cells / s.idx_block) + 2;
const strata::kernels::QsaAttnPools pools = qsa_attn_pools(st);
strata::kernels::qsa_decode_attn_step(b.qcur, pools, b.ids, st.step, cap, s, b.attn_scratch, b.attn, stream);
} else {
- if (st.kv_q4) strata::kernels::kv_gather_q4_step(st.k_q4, st.v_q4, st.page_table, b.ids, st.step, cap, s, b.k_scratch, b.v_scratch, stream);
+ if (st.kv_hybrid) {
+ kv_gather_q8_step(st.k_q, st.k_q, st.k_scale, st.k_scale, st.page_table, b.ids, st.step, cap, s,
+ b.k_scratch, b.k_scratch, stream);
+ strata::kernels::kv_gather_q4_step(st.v_q4, st.v_q4, st.page_table, b.ids, st.step, cap, s,
+ b.v_scratch, b.v_scratch, stream);
+ }
+ else if (st.kv_q4) strata::kernels::kv_gather_q4_step(st.k_q4, st.v_q4, st.page_table, b.ids, st.step, cap, s, b.k_scratch, b.v_scratch, stream);
else if (st.kv_int8) kv_gather_q8_step(st.k_q, st.v_q, st.k_scale, st.v_scale, st.page_table, b.ids, st.step, cap, s, b.k_scratch, b.v_scratch, stream); else kv_gather_step(st.k_pool, st.v_pool, st.page_table, b.ids, st.step, cap, s, b.k_scratch, b.v_scratch, stream); if (native_flash_attn_short) {
if (st.max_cells < 1 || st.max_cells > 256 || !st.attention_status || !st.host_step) {
err = v.name("native_flash_attn") + ": short adapter requires context <=256 and persistent status storage";
@@ -1068,7 +1112,7 @@ int64_t max_blocks = (st.max_cells / s.idx_block) + 2;
(int) st.max_cells, s, b.attn, st.attention_status, nullptr, stream);
} catch (const std::exception& error) { err = v.name("native_flash_attn") + ": " + error.what(); return false; }
/*
- DPCT1124:798: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
the origin API might be synchronous, it depends on the type of operand
memory, so you may need to call wait() on event return by memcpy API to
ensure synchronization behavior.
@@ -1080,7 +1124,7 @@ int64_t max_blocks = (st.max_cells / s.idx_block) + 2;
}
} else qsa_attend_step(b.qcur, b.k_scratch, b.v_scratch, st.step, cap, s, b.attn, nullptr, stream);
}
- if (st.kv_q4) strata::kernels::fwht256_inplace_cuda(b.attn, g.n_head, stream); // the output back: H is self-inverse
+ if (st.kv_q4 || st.kv_hybrid) strata::kernels::fwht256_inplace_cuda(b.attn, g.n_head, stream); // the output back: H is self-inverse
dump_slot(dump, g, layer, b.attn, (uint64_t) 2 * g.n_embd + 2 * g.hc, (uint64_t) g.n_head * g.head_dim, stream); { const uint64_t vs = (uint64_t) 2 * g.n_embd + 2 * g.hc + (uint64_t) g.n_head * g.head_dim + (uint64_t) 2 * g.n_head_kv * g.head_dim; dump_slot(dump, g, layer, (const float*) b.v_scratch, vs, (uint64_t) g.n_head_kv * g.head_dim / 2, stream); dump_slot(dump, g, layer, (const float*) b.ids, vs + (uint64_t) g.n_head_kv * g.head_dim / 2, 4, stream); dump_slot(dump, g, layer, (const float*) st.step, vs + (uint64_t) g.n_head_kv * g.head_dim / 2 + 4, 4, stream); }
// ---- 9. Gate the attention output before its projection. Native CUDA keeps F32
// sigmoid/multiply arithmetic and uses Q8_1 for the native quantized projection.
@@ -1103,7 +1147,7 @@ uint64_t doorbell_init(const ModelGeometry& g, int64_t k, Doorbell& db) { db.
// ONE region per field, each MAPPED PINNED, so the device and the host have different pointers to the same
// bytes and no copy is needed to publish them.
/*
-DPCT1048:12: The original value cudaHostAllocMapped is not meaningful in the
+DPCT1048: The original value cudaHostAllocMapped is not meaningful in the
migrated code and was removed or replaced with 0. You may need to check the
migrated code.
*/
@@ -1260,7 +1304,7 @@ static void dump_slot(float* dump, const ModelGeometry& g, int64_t layer, const
uint64_t n, void* stream) {
if (dump == nullptr || src == nullptr || n == 0) return;
/*
- DPCT1124:799: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
the origin API might be synchronous, it depends on the type of operand
memory, so you may need to call wait() on event return by memcpy API to
ensure synchronization behavior.
@@ -1332,7 +1376,7 @@ bool block_layer_pre(const WeightTable &tables, const ModelGeometry &g,
// would be the natural reading and would scramble the channels.
strata::kernels::ple_history_advance(ple->hist, po.normalized, stream);
/*
- DPCT1010:800: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaPeekAtLastError function call was replaced with 0.
You need to rewrite this code.
*/
@@ -1420,7 +1464,7 @@ bool ple_finish_token(const PleRun &p, void *stream, std::string &err) try {
if (!p.ready()) { err = "ple_finish_token: the PLE run is not ready"; return false; }
if (!p.table->collect(p.emb_host, err)) { err = "ple_finish_token: " + err; return false; }
/*
- DPCT1124:801: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
the origin API might be synchronous, it depends on the type of operand
memory, so you may need to call wait() on event return by memcpy API to
ensure synchronization behavior.
diff --git a/sycl/src/core/mtp.cpp b/sycl/src/core/mtp.cpp
index ec52da5b..6f0f9eee 100644
--- a/sycl/src/core/mtp.cpp
+++ b/sycl/src/core/mtp.cpp
@@ -57,7 +57,7 @@ struct Bump {
bool mapped(size_t bytes, void **h, void **d) try {
/*
- DPCT1048:0: The original value cudaHostAllocMapped is not meaningful in the
+ DPCT1048: The original value cudaHostAllocMapped is not meaningful in the
migrated code and was removed or replaced with 0. You may need to check the
migrated code.
*/
@@ -177,13 +177,13 @@ bool MtpDrafter::load(const std::string &rt_dir, const ModelGeometry &g,
DPCT_CHECK_ERROR(dense_ = (uint8_t *)sycl::malloc_device(
blob.size(), dpct::get_in_order_queue()));
/*
- DPCT1000:10: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (alloc != 0) {
size_t free_bytes = 0, total_bytes = 0;
/*
- DPCT1106:12: 'cudaMemGetInfo' was migrated with the Intel extensions
+ DPCT1106: 'cudaMemGetInfo' was migrated with the Intel extensions
for device information which may not be supported by all compilers
or runtimes. You may need to adjust the code.
*/
@@ -191,12 +191,12 @@ bool MtpDrafter::load(const std::string &rt_dir, const ModelGeometry &g,
DPCT_CHECK_ERROR(dpct::get_current_device().get_memory_info(
free_bytes, total_bytes));
/*
- DPCT1009:13: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:9: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = "mtp: dense weights allocation failed (" +
std::string(dpct::get_error_string_dummy(alloc)) +
@@ -207,7 +207,7 @@ bool MtpDrafter::load(const std::string &rt_dir, const ModelGeometry &g,
return false;
}
/*
- DPCT1114:11: cudaMemcpy is migrated to asynchronization memcpy, assuming
+ DPCT1114: cudaMemcpy is migrated to asynchronization memcpy, assuming
in the original code the source host memory is pageable memory. If the
memory is not pageable, call wait() on event return by memcpy API to
ensure synchronization behavior.
@@ -253,6 +253,12 @@ bool MtpDrafter::load(const std::string &rt_dir, const ModelGeometry &g,
// window (plus the cells a round writes ahead of its queries) over a host copy, refilled on a resume. The host copy
// is pinned after the expert arena has pinned what it could: if it does not fit, the K/V stays whole in VRAM.
int64_t ring = (window > 0 && window < max_cells) ? window + 4 * (int64_t) max_t + 64 : 0;
+ // K8V4 never applies to the drafter: its own attention paths (below, and verify.cpp) handle whole formats
+ // only, whatever ring shape it takes (0, a window, or the -1 fully-resident fallback).
+ const bool kv_hybrid_was = qsa_kv_hybrid();
+ const bool kv_int8_was = qsa_kv_int8();
+ qsa_set_kv_hybrid(false);
+ if (kv_hybrid_was) qsa_set_kv_int8(true); // the drafter under --kv k8v4: plain INT8
uint64_t sb = qsa_state_bytes(g, max_cells, false, ring);
if (DPCT_CHECK_ERROR(state_arena_ = (void *)sycl::malloc_device(
sb, dpct::get_in_order_queue())) != 0) {
@@ -262,7 +268,7 @@ bool MtpDrafter::load(const std::string &rt_dir, const ModelGeometry &g,
if (st_.kv_mode == 0) { err = "mtp: state init failed"; return false; }
std::fprintf(stderr, "strata mtp: no pinned RAM left for the draft layer's K/V copy; keeping it in VRAM\n");
/*
- DPCT1026:14: The call to cudaGetLastError was removed because this
+ DPCT1026: The call to cudaGetLastError was removed because this
functionality is redundant in SYCL.
*/
sycl::free(state_arena_, dpct::get_in_order_queue());
@@ -275,6 +281,8 @@ bool MtpDrafter::load(const std::string &rt_dir, const ModelGeometry &g,
}
if (qsa_state_init(g, max_cells, state_arena_, st_, &ss.qsa_states[0], ring) == 0) { err = "mtp: state init failed"; return false; }
}
+ qsa_set_kv_int8(kv_int8_was);
+ qsa_set_kv_hybrid(kv_hybrid_was);
qsa_state_zero(st_, g, nullptr);
dpct::get_current_device().queues_wait_and_throw();
vram_ += sb;
@@ -337,7 +345,7 @@ bool MtpDrafter::load(const std::string &rt_dir, const ModelGeometry &g,
for (uint64_t t = 0; t < T; ++t)
for (int64_t i = 0; i < cap_; ++i) id[(size_t) (t * (uint64_t) cap_ + (uint64_t) i)] = (int32_t) i;
/*
- DPCT1114:15: cudaMemcpy is migrated to asynchronization memcpy, assuming
+ DPCT1114: cudaMemcpy is migrated to asynchronization memcpy, assuming
in the original code the source host memory is pageable memory. If the
memory is not pageable, call wait() on event return by memcpy API to
ensure synchronization behavior.
@@ -345,7 +353,7 @@ bool MtpDrafter::load(const std::string &rt_dir, const ModelGeometry &g,
dpct::get_in_order_queue().memcpy(ident_, id.data(), id.size() * 4).wait();
}
/*
- DPCT1025:16: The SYCL queue is created ignoring the flag and priority
+ DPCT1025: The SYCL queue is created ignoring the flag and priority
options.
*/
if (DPCT_CHECK_ERROR(cs_ = dpct::get_current_device().create_queue(true)) !=
@@ -496,7 +504,7 @@ bool MtpDrafter::record_forward(int T, int step_row0, dpct::queue_ptr cs,
for (int t = 0; t < T; ++t) {
float* qc = qcur_ + t * NH * HD;
/*
- DPCT1124:17: cudaMemcpy2DAsync is migrated to asynchronous memcpy
+ DPCT1124: cudaMemcpy2DAsync is migrated to asynchronous memcpy
API. While the origin API might be synchronous, it depends on the
type of operand memory, so you may need to call wait() on event
return by memcpy API to ensure synchronization behavior.
@@ -603,7 +611,7 @@ bool finish_capture(dpct::queue_ptr cs, bool ok,
graph->finalize())) != 0) {
if (graph) delete (graph);
/*
- DPCT1009:19: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
@@ -614,7 +622,7 @@ bool finish_capture(dpct::queue_ptr cs, bool ok,
delete (graph);
// an explicit upload: the first launch's implicit one blocked behind a device-side spin (verify.cpp)
/*
- DPCT1007:18: Migration of cudaGraphUpload is not supported.
+ DPCT1007: Migration of cudaGraphUpload is not supported.
*/
// no cudaGraphUpload on SYCL: a finalized command_graph is already resident
cs->wait();
@@ -764,7 +772,7 @@ bool MtpDrafter::prefill(const float *R_rows, const int32_t *next_tokens,
for (int64_t h = 0; h < NHp; ++h) ps[i * NHp + h] = (int32_t) cell;
}
/*
- DPCT1124:20: cudaMemcpyAsync is migrated to asynchronous memcpy API.
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API.
While the origin API might be synchronous, it depends on the type of
operand memory, so you may need to call wait() on event return by memcpy
API to ensure synchronization behavior.
@@ -782,7 +790,7 @@ bool MtpDrafter::prefill(const float *R_rows, const int32_t *next_tokens,
if (cell0 + c + T <= first_needed) continue;
if (!capture_prefill_dev(T, err)) return false;
/*
- DPCT1124:21: cudaMemcpyAsync is migrated to asynchronous memcpy API.
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API.
While the origin API might be synchronous, it depends on the type of
operand memory, so you may need to call wait() on event return by
memcpy API to ensure synchronization behavior.
@@ -790,7 +798,7 @@ bool MtpDrafter::prefill(const float *R_rows, const int32_t *next_tokens,
if (DPCT_CHECK_ERROR(cs_->memcpy(tok_, d_tk + c, (size_t)T * 4)) !=
0 ||
/*
- DPCT1124:22: cudaMemcpyAsync is migrated to asynchronous memcpy
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy
API. While the origin API might be synchronous, it depends on
the type of operand memory, so you may need to call wait() on
event return by memcpy API to ensure synchronization behavior.
@@ -798,7 +806,7 @@ bool MtpDrafter::prefill(const float *R_rows, const int32_t *next_tokens,
DPCT_CHECK_ERROR(
cs_->memcpy(step_, d_stp + c * 4, (size_t)T * 16)) != 0 ||
/*
- DPCT1124:23: cudaMemcpyAsync is migrated to asynchronous memcpy
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy
API. While the origin API might be synchronous, it depends on
the type of operand memory, so you may need to call wait() on
event return by memcpy API to ensure synchronization behavior.
@@ -806,7 +814,7 @@ bool MtpDrafter::prefill(const float *R_rows, const int32_t *next_tokens,
DPCT_CHECK_ERROR(cs_->memcpy(pos_, d_ps + c * NHp,
(size_t)(T * NHp) * 4)) != 0 ||
/*
- DPCT1124:24: cudaMemcpyAsync is migrated to asynchronous memcpy
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy
API. While the origin API might be synchronous, it depends on
the type of operand memory, so you may need to call wait() on
event return by memcpy API to ensure synchronization behavior.
@@ -817,13 +825,13 @@ bool MtpDrafter::prefill(const float *R_rows, const int32_t *next_tokens,
DPCT_CHECK_ERROR(
(cs_)->ext_oneapi_graph(*prefill_dev_exec_[T])) != 0) {
/*
- DPCT1009:25: SYCL reports errors using exceptions and does not
+ DPCT1009: SYCL reports errors using exceptions and does not
use error codes. Please replace the
"get_error_string_dummy(...)" with a real error-handling
function.
*/
/*
- DPCT1010:26: SYCL uses exceptions to report errors and does not
+ DPCT1010: SYCL uses exceptions to report errors and does not
use the error codes. The cudaGetLastError function call was
replaced with 0. You need to rewrite this code.
*/
@@ -834,12 +842,12 @@ bool MtpDrafter::prefill(const float *R_rows, const int32_t *next_tokens,
}
if (DPCT_CHECK_ERROR(cs_->wait()) != 0) {
/*
- DPCT1009:27: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1010:28: SYCL uses exceptions to report errors and does not use
+ DPCT1010: SYCL uses exceptions to report errors and does not use
the error codes. The cudaGetLastError function call was replaced
with 0. You need to rewrite this code.
*/
@@ -864,7 +872,7 @@ bool MtpDrafter::prefill(const float *R_rows, const int32_t *next_tokens,
for (int64_t h = 0; h < g_->n_head; ++h) h_pos_[t * g_->n_head + h] = (int32_t) cell;
}
/*
- DPCT1124:29: cudaMemcpyAsync is migrated to asynchronous memcpy API.
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API.
While the origin API might be synchronous, it depends on the type of
operand memory, so you may need to call wait() on event return by memcpy
API to ensure synchronization behavior.
@@ -875,12 +883,12 @@ bool MtpDrafter::prefill(const float *R_rows, const int32_t *next_tokens,
DPCT_CHECK_ERROR((cs_)->ext_oneapi_graph(*prefill_exec_[T])) != 0 ||
DPCT_CHECK_ERROR(cs_->wait()) != 0) {
/*
- DPCT1009:30: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1010:31: SYCL uses exceptions to report errors and does not use
+ DPCT1010: SYCL uses exceptions to report errors and does not use
the error codes. The cudaGetLastError function call was replaced
with 0. You need to rewrite this code.
*/
@@ -923,12 +931,12 @@ bool MtpDrafter::draft(int T, const int32_t* tokens, int64_t p, int a, int32_t*
if (DPCT_CHECK_ERROR((cs_)->ext_oneapi_graph(*round_exec_[T])) != 0 ||
DPCT_CHECK_ERROR(cs_->wait()) != 0) {
/*
- DPCT1009:32: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
/*
- DPCT1010:33: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
@@ -947,12 +955,12 @@ bool MtpDrafter::draft(int T, const int32_t* tokens, int64_t p, int a, int32_t*
if (DPCT_CHECK_ERROR((cs_)->ext_oneapi_graph(*step_exec_[j])) != 0 ||
DPCT_CHECK_ERROR(cs_->wait()) != 0) {
/*
- DPCT1009:34: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1010:35: SYCL uses exceptions to report errors and does not use
+ DPCT1010: SYCL uses exceptions to report errors and does not use
the error codes. The cudaGetLastError function call was replaced
with 0. You need to rewrite this code.
*/
diff --git a/sycl/src/core/native_dense.cpp b/sycl/src/core/native_dense.cpp
index 51c2ca97..1d7da714 100644
--- a/sycl/src/core/native_dense.cpp
+++ b/sycl/src/core/native_dense.cpp
@@ -18,9 +18,9 @@ namespace {
bool eligible(const strata::TensorInfo& tensor, bool include_ple_key) {
const auto& name = tensor.name;
if (name.rfind("blk.", 0) != 0) return false;
- // The native PLE kernel accepts Q2_0. Other quantized keys can be converted to BF16 by iq_pack;
- // keep their packed bytes resident instead of overriding them with an unsupported native key.
- if (name == "blk.1.ple_key.weight") return include_ple_key && tensor.type == 42; // 42 = Q2_0
+ // Match the native PLE kernel: Q2_0, IQ3_XXS and IQ4_XS. Other keys retain the packed BF16 fallback.
+ if (name == "blk.1.ple_key.weight")
+ return include_ple_key && (tensor.type == 42 || tensor.type == 18 || tensor.type == 23);
static const char* suffixes[] = {".attn_qkv.weight", ".attn_gate.weight", ".ssm_out.weight",
".attn_q.weight", ".attn_k.weight", ".attn_v.weight", ".attn_output.weight",
".ffn_gate_shexp.weight", ".ffn_up_shexp.weight", ".ffn_down_shexp.weight"};
@@ -165,18 +165,18 @@ bool NativeDense::load(const std::vector &shards,
.memcpy(data.get(), gguf.tensor_data(tensor), bytes)
.wait());
/*
- DPCT1000:420: Error handling if-stmt was detected but could not
+ DPCT1000: Error handling if-stmt was detected but could not
be rewritten.
*/
if (status != 0) {
/*
- DPCT1009:421: SYCL reports errors using exceptions and does
+ DPCT1009: SYCL reports errors using exceptions and does
not use error codes. Please replace the
"get_error_string_dummy(...)" with a real error-handling
function.
*/
/*
- DPCT1001:419: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = "native dense upload " + tensor.name + ": " +
dpct::get_error_string_dummy(status);
@@ -195,15 +195,15 @@ bool NativeDense::load(const std::vector &shards,
dpct::get_in_order_queue()));
DevicePtr scratch(allocation);
/*
- DPCT1009:422: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:417: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:418: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (status != 0) {
diff --git a/sycl/src/core/native_head.cpp b/sycl/src/core/native_head.cpp
index 5c8566a8..a3924b65 100644
--- a/sycl/src/core/native_head.cpp
+++ b/sycl/src/core/native_head.cpp
@@ -61,19 +61,19 @@ bool NativeHead::load(const std::string &path, int64_t n_in, int64_t n_out,
.memcpy(weights, gguf.tensor_data(*tensor), bytes)
.wait());
/*
- DPCT1000:1107: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (status != 0) {
if (scratch) sycl::free(scratch, dpct::get_in_order_queue());
if (weights) sycl::free(weights, dpct::get_in_order_queue());
/*
- DPCT1009:1108: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:1106: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = std::string("native head upload: ") +
dpct::get_error_string_dummy(status);
@@ -115,23 +115,23 @@ bool NativeHead::run(const float *mixed, float *logits, void *stream,
return false;
}
/*
- DPCT1010:1111: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaPeekAtLastError function call was replaced with 0. You
need to rewrite this code.
*/
const dpct::err0 status = 0;
/*
- DPCT1000:1110: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (status != 0) {
/*
- DPCT1009:1112: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:1109: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = std::string("native head launch: ") +
dpct::get_error_string_dummy(status);
@@ -173,12 +173,12 @@ bool NativeEmbed::load(const std::string &path, int64_t n_embd, int64_t n_vocab,
row_ = strata::kernels::iq_row_bytes((int) t->type, n_embd);
bytes_ = (uint64_t) row_ * (uint64_t) n_vocab;
/*
- DPCT1048:19: The original value cudaHostAllocMapped is not meaningful in
+ DPCT1048: The original value cudaHostAllocMapped is not meaningful in
the migrated code and was removed or replaced with 0. You may need to
check the migrated code.
*/
/*
- DPCT1048:20: The original value cudaHostAllocPortable is not meaningful
+ DPCT1048: The original value cudaHostAllocPortable is not meaningful
in the migrated code and was removed or replaced with 0. You may need to
check the migrated code.
*/
diff --git a/sycl/src/core/overlap_main.cpp b/sycl/src/core/overlap_main.cpp
index 3297a2e5..31d0a88e 100644
--- a/sycl/src/core/overlap_main.cpp
+++ b/sycl/src/core/overlap_main.cpp
@@ -104,7 +104,7 @@ int main(int argc, char** argv) {
std::vector hx((size_t) n_in, 0x3C00);
std::vector hs((size_t) n_out * (size_t) (n_in / 64), 0.001f);
/*
- DPCT1114:657: cudaMemcpy is migrated to asynchronization memcpy, assuming in
+ DPCT1114: cudaMemcpy is migrated to asynchronization memcpy, assuming in
the original code the source host memory is pageable memory. If the memory
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
@@ -113,7 +113,7 @@ int main(int argc, char** argv) {
d_x, hx.data(), hx.size() * sizeof(uint16_t)).wait()),
"copy x");
/*
- DPCT1114:658: cudaMemcpy is migrated to asynchronization memcpy, assuming in
+ DPCT1114: cudaMemcpy is migrated to asynchronization memcpy, assuming in
the original code the source host memory is pageable memory. If the memory
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
@@ -142,7 +142,7 @@ int main(int argc, char** argv) {
auto t0 = std::chrono::steady_clock::now();
for (int i = 0; i < experts; ++i) {
/*
- DPCT1124:659: cudaMemcpyAsync is migrated to asynchronous memcpy API.
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API.
While the origin API might be synchronous, it depends on the type of
operand memory, so you may need to call wait() on event return by memcpy
API to ensure synchronization behavior.
@@ -167,7 +167,7 @@ int main(int argc, char** argv) {
check(DPCT_CHECK_ERROR(ev[b] = new sycl::event()), "event");
t0 = std::chrono::steady_clock::now();
/*
- DPCT1124:660: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
the origin API might be synchronous, it depends on the type of operand
memory, so you may need to call wait() on event return by memcpy API to
ensure synchronization behavior.
@@ -176,7 +176,7 @@ int main(int argc, char** argv) {
DPCT_CHECK_ERROR(s_copy->memcpy(d_codes[0], arena.data(), role_codes)),
"prologue");
/*
- DPCT1024:661: The original code returned the error code that was further
+ DPCT1024: The original code returned the error code that was further
consumed by the program logic. This original code was replaced with 0. You
may need to rewrite the program logic consuming the error code.
*/
@@ -186,7 +186,7 @@ int main(int argc, char** argv) {
const int cur = i & 1, nxt = (i + 1) & 1;
if (i + 1 < experts) {
/*
- DPCT1124:662: cudaMemcpyAsync is migrated to asynchronous memcpy
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy
API. While the origin API might be synchronous, it depends on the
type of operand memory, so you may need to call wait() on event
return by memcpy API to ensure synchronization behavior.
@@ -197,7 +197,7 @@ int main(int argc, char** argv) {
role_codes)),
"overlap copy");
/*
- DPCT1024:663: The original code returned the error code that was
+ DPCT1024: The original code returned the error code that was
further consumed by the program logic. This original code was
replaced with 0. You may need to rewrite the program logic consuming
the error code.
diff --git a/sycl/src/core/pinned.dp.cpp b/sycl/src/core/pinned.dp.cpp
index 86c84dbb..5b5d33da 100644
--- a/sycl/src/core/pinned.dp.cpp
+++ b/sycl/src/core/pinned.dp.cpp
@@ -122,7 +122,7 @@ uint64_t fnv1a64(const uint8_t* p, uint64_t n, uint64_t seed) {
namespace {
/*
-DPCT1010:1113: SYCL uses exceptions to report errors and does not use the error
+DPCT1010: SYCL uses exceptions to report errors and does not use the error
codes. The cudaGetLastError function call was replaced with 0. You need to
rewrite this code.
*/
@@ -156,7 +156,7 @@ PinnedArena::PinnedArena(uint64_t bytes, const std::vector &bounds,
const dpct::err0 e =
capped ? 0 :
/*
- DPCT1027:1114: The call to cudaHostRegister was replaced with
+ DPCT1027: The call to cudaHostRegister was replaced with
0 because SYCL currently does not support registering of
existing host memory for use by device. Use USM to allocate
memory for use by host and device.
@@ -173,14 +173,14 @@ PinnedArena::PinnedArena(uint64_t bytes, const std::vector &bounds,
const uint64_t off = bounds[i], n = bounds[i + 1] - bounds[i];
if (capped && (off > max_pinned_bytes || n > max_pinned_bytes - off)) break;
/*
- DPCT1027:1115: The call to cudaHostRegister was replaced with 0
+ DPCT1027: The call to cudaHostRegister was replaced with 0
because SYCL currently does not support registering of existing
host memory for use by device. Use USM to allocate memory for
use by host and device.
*/
if (0 != 0) {
/*
- DPCT1010:1116: SYCL uses exceptions to report errors and
+ DPCT1010: SYCL uses exceptions to report errors and
does not use the error codes. The cudaGetLastError function
call was replaced with 0. You need to rewrite this code.
*/
@@ -197,7 +197,7 @@ PinnedArena::PinnedArena(uint64_t bytes, const std::vector &bounds,
" GiB for CUDA1; "
:
/*
- DPCT1009:1117: SYCL reports errors using exceptions and
+ DPCT1009: SYCL reports errors using exceptions and
does not use error codes. Please replace the
"get_error_string_dummy(...)" with a real error-handling
function.
@@ -217,7 +217,7 @@ PinnedArena::PinnedArena(uint64_t bytes, const std::vector &bounds,
}
} else {
/*
- DPCT1009:1118: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
@@ -237,7 +237,7 @@ PinnedArena::PinnedArena(uint64_t bytes, const std::vector &bounds,
// It is the same trap `gr.cu` warns about for ASYNC faults, in the other direction: a synchronous
// failure is sticky too, and it lies about where it happened just as convincingly.
/*
- DPCT1010:1119: SYCL uses exceptions to report errors and does not
+ DPCT1010: SYCL uses exceptions to report errors and does not
use the error codes. The cudaGetLastError function call was replaced
with 0. You need to rewrite this code.
*/
@@ -267,7 +267,7 @@ PinnedArena::~PinnedArena() {
if (locked_bytes) strata::platform::unlock_resident((uint8_t*) base + (slice_bytes ? registered_bytes : 0), locked_bytes);
if (slice_bytes) {
/*
- DPCT1027:1120: The call to cudaHostUnregister was replaced with 0
+ DPCT1027: The call to cudaHostUnregister was replaced with 0
because SYCL currently does not support registering of existing host
memory for use by device. Use USM to allocate memory for use by host
and device.
@@ -275,7 +275,7 @@ PinnedArena::~PinnedArena() {
for (uint64_t off : slice_starts) 0;
} else {
/*
- DPCT1026:1121: The call to cudaHostUnregister was removed because
+ DPCT1026: The call to cudaHostUnregister was removed because
SYCL currently does not support registering of existing host memory
for use by device. Use USM to allocate memory for use by host and
device.
@@ -411,7 +411,7 @@ StreamStats stream_bandwidth(const uint8_t *src, uint64_t bytes, uint64_t chunk,
// one untimed pass so the first transfer's page-fault and setup cost is not in the measurement
for (uint64_t off = 0; off + chunk <= bytes; off += chunk) {
/*
- DPCT1124:1122: cudaMemcpyAsync is migrated to asynchronous memcpy API.
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API.
While the origin API might be synchronous, it depends on the type of
operand memory, so you may need to call wait() on event return by memcpy
API to ensure synchronization behavior.
@@ -424,7 +424,7 @@ StreamStats stream_bandwidth(const uint8_t *src, uint64_t bytes, uint64_t chunk,
for (int it = 0; it < iters; ++it) {
for (uint64_t off = 0; off + chunk <= bytes; off += chunk) {
/*
- DPCT1124:1123: cudaMemcpyAsync is migrated to asynchronous memcpy
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy
API. While the origin API might be synchronous, it depends on the
type of operand memory, so you may need to call wait() on event
return by memcpy API to ensure synchronization behavior.
diff --git a/sycl/src/core/remote_experts.cpp b/sycl/src/core/remote_experts.cpp
index 2cec2f1b..5d198b0f 100644
--- a/sycl/src/core/remote_experts.cpp
+++ b/sycl/src/core/remote_experts.cpp
@@ -41,7 +41,7 @@ struct DeviceScope {
return;
}
/*
- DPCT1093:88: The "device" device may be not the one intended for use.
+ DPCT1093: The "device" device may be not the one intended for use.
Adjust the selected device if needed.
*/
status = DPCT_CHECK_ERROR(dpct::select_device(device));
@@ -52,7 +52,7 @@ struct DeviceScope {
ok = true;
}
/*
- DPCT1093:89: The "previous" device may be not the one intended for use.
+ DPCT1093: The "previous" device may be not the one intended for use.
Adjust the selected device if needed.
*/
~DeviceScope() { if (previous >= 0) dpct::select_device(previous); }
@@ -60,7 +60,7 @@ struct DeviceScope {
return std::string("CUDA") + std::to_string(device) +
" experts: " + (failed_step ? failed_step : "device switch") +
/*
- DPCT1009:90: SYCL reports errors using exceptions and does not
+ DPCT1009: SYCL reports errors using exceptions and does not
use error codes. Please replace the "get_error_string_dummy(...)"
with a real error-handling function.
*/
@@ -74,7 +74,7 @@ struct DeviceScope {
bool check(dpct::err0 result, const char *what, std::string &err, int device) {
if (result == 0) return true;
/*
- DPCT1009:91: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
@@ -100,18 +100,18 @@ bool RemoteExperts::preflight(int device, double &free_gib,
// before the device's context exists, so first thing; STRATA_REMOTE_SPIN=0 keeps the driver's default.
const char* spin = std::getenv("STRATA_REMOTE_SPIN");
/*
- DPCT1007:93: Migration of cudaInitDevice is not supported.
+ DPCT1007: Migration of cudaInitDevice is not supported.
*/
(void) spin; // SYCL: no cudaInitDevice scheduling flags; the runtime picks its own wait policy
/*
- DPCT1026:92: The call to cudaGetLastError was removed because this
+ DPCT1026: The call to cudaGetLastError was removed because this
functionality is redundant in SYCL.
*/
DeviceScope scope(device);
if (!scope.ok) { err = scope.error(device); return false; }
size_t free_bytes = 0, total_bytes = 0;
/*
- DPCT1106:94: 'cudaMemGetInfo' was migrated with the Intel extensions for
+ DPCT1106: 'cudaMemGetInfo' was migrated with the Intel extensions for
device information which may not be supported by all compilers or runtimes.
You may need to adjust the code.
*/
@@ -195,7 +195,7 @@ bool RemoteExperts::open(int device, int slots, int64_t layers, int64_t experts,
}
size_t free_bytes = 0, total_bytes = 0;
/*
- DPCT1106:96: 'cudaMemGetInfo' was migrated with the Intel extensions for
+ DPCT1106: 'cudaMemGetInfo' was migrated with the Intel extensions for
device information which may not be supported by all compilers or runtimes.
You may need to adjust the code.
*/
@@ -237,19 +237,19 @@ bool RemoteExperts::open(int device, int slots, int64_t layers, int64_t experts,
strata::kernels::native_expert_scratch_bytes(CAP, FF));
const bool allocated =
/*
- DPCT1025:97: The SYCL queue is created ignoring the flag and priority
+ DPCT1025: The SYCL queue is created ignoring the flag and priority
options.
*/
check(DPCT_CHECK_ERROR(
stream_ = dpct::get_current_device().create_queue(true)),
"stream", err, device) &&
/*
- DPCT1048:2: The original value cudaHostAllocPortable is not meaningful
+ DPCT1048: The original value cudaHostAllocPortable is not meaningful
in the migrated code and was removed or replaced with 0. You may need to
check the migrated code.
*/
/*
- DPCT1048:3: The original value cudaHostAllocMapped is not meaningful in
+ DPCT1048: The original value cudaHostAllocMapped is not meaningful in
the migrated code and was removed or replaced with 0. You may need to
check the migrated code.
*/
@@ -258,12 +258,12 @@ bool RemoteExperts::open(int device, int slots, int64_t layers, int64_t experts,
(size_t)CAP * H, dpct::get_in_order_queue())),
"input staging", err, device) &&
/*
- DPCT1048:4: The original value cudaHostAllocPortable is not meaningful
+ DPCT1048: The original value cudaHostAllocPortable is not meaningful
in the migrated code and was removed or replaced with 0. You may need to
check the migrated code.
*/
/*
- DPCT1048:5: The original value cudaHostAllocMapped is not meaningful in
+ DPCT1048: The original value cudaHostAllocMapped is not meaningful in
the migrated code and was removed or replaced with 0. You may need to
check the migrated code.
*/
@@ -272,7 +272,7 @@ bool RemoteExperts::open(int device, int slots, int64_t layers, int64_t experts,
(size_t)CAP * H, dpct::get_in_order_queue())),
"result staging", err, device) &&
/*
- DPCT1048:6: The original value cudaHostAllocPortable is not meaningful
+ DPCT1048: The original value cudaHostAllocPortable is not meaningful
in the migrated code and was removed or replaced with 0. You may need to
check the migrated code.
*/
@@ -311,7 +311,7 @@ bool RemoteExperts::open(int device, int slots, int64_t layers, int64_t experts,
DPCT_CHECK_ERROR(*(void **)&z_x_ = (float *)h_x_) == 0 &&
DPCT_CHECK_ERROR(*(void **)&z_out_ = (float *)h_out_) == 0;
/*
- DPCT1026:95: The call to cudaGetLastError was removed because this
+ DPCT1026: The call to cudaGetLastError was removed because this
functionality is redundant in SYCL.
*/
auto *meta = (RemoteMeta *)d_meta_;
@@ -405,7 +405,7 @@ bool RemoteExperts::begin(int64_t layer, const float *x, const int32_t *ids,
const dpct::queue_ptr s = stream_;
const bool staged =
/*
- DPCT1124:98: cudaMemcpyAsync is migrated to asynchronous memcpy API.
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API.
While the origin API might be synchronous, it depends on the type of
operand memory, so you may need to call wait() on event return by memcpy
API to ensure synchronization behavior.
@@ -415,7 +415,7 @@ bool RemoteExperts::begin(int64_t layer, const float *x, const int32_t *ids,
s->memcpy(d_x_, h_x_, (size_t)n_tok * H * sizeof(float))),
"copy input", err, device_)) &&
/*
- DPCT1124:99: cudaMemcpyAsync is migrated to asynchronous memcpy API.
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API.
While the origin API might be synchronous, it depends on the type of
operand memory, so you may need to call wait() on event return by memcpy
API to ensure synchronization behavior.
@@ -437,7 +437,7 @@ bool RemoteExperts::begin(int64_t layer, const float *x, const int32_t *ids,
}
const uint64_t compact_bytes = (uint64_t) dst_.size() * H * sizeof(float);
/*
- DPCT1124:100: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
the origin API might be synchronous, it depends on the type of operand
memory, so you may need to call wait() on event return by memcpy API to
ensure synchronization behavior.
diff --git a/sycl/src/core/session.cpp b/sycl/src/core/session.cpp
index f23b4a0a..1b3bd740 100644
--- a/sycl/src/core/session.cpp
+++ b/sycl/src/core/session.cpp
@@ -116,7 +116,7 @@ void session_zero(SessionState& s, const ModelGeometry& g, const float* R_init,
if (R_init != nullptr) {
for (int64_t c = 0; c < g.hc; ++c)
/*
- DPCT1124:538: cudaMemcpyAsync is migrated to asynchronous memcpy
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy
API. While the origin API might be synchronous, it depends on the
type of operand memory, so you may need to call wait() on event
return by memcpy API to ensure synchronization behavior.
@@ -234,17 +234,17 @@ bool session_capture(const WeightTable& tables, const ModelGeometry& g, SessionS
DPCT_CHECK_ERROR(dpct::experimental::end_recording(cs, &graph));
dpct::get_current_device().destroy_queue(cs);
/*
- DPCT1000:540: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (ce != 0) {
/*
- DPCT1001:539: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = "session_capture: " + std::string(what) + " layer " +
std::to_string(l) + ": " +
/*
- DPCT1009:541: SYCL reports errors using exceptions and
+ DPCT1009: SYCL reports errors using exceptions and
does not use error codes. Please replace the
"get_error_string_dummy(...)" with a real error-handling
function.
@@ -301,17 +301,17 @@ bool session_replay(const ModelGeometry &g, int64_t pos, int32_t pos_base,
const dpct::err0 e =
DPCT_CHECK_ERROR(cs->ext_oneapi_graph(*gr.execs[l]));
/*
- DPCT1000:543: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (e != 0) {
/*
- DPCT1009:544: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:542: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = "session_replay: layer " + std::to_string(l) + ": " +
dpct::get_error_string_dummy(e);
@@ -340,17 +340,17 @@ bool session_replay_full(const ModelGeometry &g, int64_t pos, int32_t pos_base,
// `post[l]` reads what `pre[l]` wrote, so they cannot be reordered or run concurrently.
dpct::err0 e = DPCT_CHECK_ERROR(cs->ext_oneapi_graph(*gr.execs[l]));
/*
- DPCT1000:546: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (e != 0) {
/*
- DPCT1009:549: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:545: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = "session_replay_full: pre[" + std::to_string(l) +
"]: " + dpct::get_error_string_dummy(e);
@@ -358,17 +358,17 @@ bool session_replay_full(const ModelGeometry &g, int64_t pos, int32_t pos_base,
}
e = DPCT_CHECK_ERROR(cs->ext_oneapi_graph(*gr.posts[l]));
/*
- DPCT1000:548: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (e != 0) {
/*
- DPCT1009:550: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:547: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = "session_replay_full: post[" + std::to_string(l) +
"]: " + dpct::get_error_string_dummy(e);
@@ -491,17 +491,17 @@ bool session_replay_stage_sweep(const ModelGeometry &g, int64_t pos,
const dpct::err0 e =
DPCT_CHECK_ERROR(cs->ext_oneapi_graph(*gr.preP[k - 1][l]));
/*
- DPCT1000:552: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (e != 0) {
/*
- DPCT1001:551: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
dpct::destroy_event(a);
dpct::destroy_event(b);
/*
- DPCT1009:553: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
@@ -578,7 +578,7 @@ bool session_replay_stage_prefixes(const ModelGeometry &g, int64_t pos,
for (int64_t l = 0; l < n; ++l) {
// The residual as this layer receives it, before any prefix has advanced it.
/*
- DPCT1124:554: cudaMemcpyAsync is migrated to asynchronous memcpy API.
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API.
While the origin API might be synchronous, it depends on the type of
operand memory, so you may need to call wait() on event return by memcpy
API to ensure synchronization behavior.
@@ -586,7 +586,7 @@ bool session_replay_stage_prefixes(const ModelGeometry &g, int64_t pos,
cs->memcpy(saved, s.block.R, r_floats * sizeof(float));
for (int k = 1; k <= 5; ++k) {
/*
- DPCT1124:557: cudaMemcpyAsync is migrated to asynchronous memcpy
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy
API. While the origin API might be synchronous, it depends on the
type of operand memory, so you may need to call wait() on event
return by memcpy API to ensure synchronization behavior.
@@ -597,18 +597,18 @@ bool session_replay_stage_prefixes(const ModelGeometry &g, int64_t pos,
(k == 5) ? gr.execs[l] : gr.preP[k - 1][l];
const dpct::err0 e = DPCT_CHECK_ERROR(cs->ext_oneapi_graph(*ge));
/*
- DPCT1000:556: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (e != 0) {
/*
- DPCT1001:555: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = std::string(
"session_replay_stage_prefixes: launch prefix ") +
std::to_string(k) + ": " +
/*
- DPCT1009:558: SYCL reports errors using exceptions and
+ DPCT1009: SYCL reports errors using exceptions and
does not use error codes. Please replace the
"get_error_string_dummy(...)" with a real error-handling
function.
@@ -723,12 +723,12 @@ bool SessionLoopScratch::init(size_t parts_bytes_in, std::string &err) try {
parts_bytes = parts_bytes_in;
// MAPPED as well as pinned: the token graph's handoff kernel reads it through its device pointer.
/*
- DPCT1048:0: The original value cudaHostAllocMapped is not meaningful in the
+ DPCT1048: The original value cudaHostAllocMapped is not meaningful in the
migrated code and was removed or replaced with 0. You may need to check the
migrated code.
*/
/*
- DPCT1048:1: The original value cudaHostAllocPortable is not meaningful in
+ DPCT1048: The original value cudaHostAllocPortable is not meaningful in
the migrated code and was removed or replaced with 0. You may need to check
the migrated code.
*/
@@ -844,7 +844,7 @@ bool session_loop(const ModelGeometry &g, int64_t pos, int32_t pos_base,
// the first layer has no previous layer's experts: `y_miss` starts at zero, which is what "hits are empty
// in this phase" means once every miss has been computed
/*
- DPCT1124:559: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
the origin API might be synchronous, it depends on the type of operand
memory, so you may need to call wait() on event return by memcpy API to
ensure synchronization behavior.
@@ -862,7 +862,7 @@ bool session_loop(const ModelGeometry &g, int64_t pos, int32_t pos_base,
if (dump_layers != nullptr) {
const size_t n = (size_t) g.hc * (size_t) g.n_embd;
/*
- DPCT1124:562: cudaMemcpyAsync is migrated to asynchronous memcpy API.
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API.
While the origin API might be synchronous, it depends on the type of
operand memory, so you may need to call wait() on event return by memcpy
API to ensure synchronization behavior.
@@ -870,17 +870,17 @@ bool session_loop(const ModelGeometry &g, int64_t pos, int32_t pos_base,
const dpct::err0 de =
DPCT_CHECK_ERROR(cs->memcpy(dump_layers, s.R, n * sizeof(float)));
/*
- DPCT1000:561: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (de != 0) {
/*
- DPCT1009:563: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:560: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = "session_loop: dump the input residual: " +
std::string(dpct::get_error_string_dummy(de));
@@ -892,17 +892,17 @@ bool session_loop(const ModelGeometry &g, int64_t pos, int32_t pos_base,
const dpct::err0 le =
DPCT_CHECK_ERROR(cs->ext_oneapi_graph(*gr.execs[0]));
/*
- DPCT1000:565: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (le != 0) {
/*
- DPCT1009:566: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:564: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = "session_loop: launch pre[0]: " +
std::string(dpct::get_error_string_dummy(le));
@@ -940,7 +940,7 @@ bool session_loop(const ModelGeometry &g, int64_t pos, int32_t pos_base,
if (q == 0) break; // the graph has ended
if (q != 1) {
/*
- DPCT1009:568: SYCL reports errors using exceptions and does not
+ DPCT1009: SYCL reports errors using exceptions and does not
use error codes. Please replace the
"get_error_string_dummy(...)" with a real error-handling
function.
@@ -980,7 +980,7 @@ bool session_loop(const ModelGeometry &g, int64_t pos, int32_t pos_base,
// the weights were current. It produced finite, fluent, deterministic tokens that were not the
// model's, and no timing test could see it.
/*
- DPCT1124:567: cudaMemcpyAsync is migrated to asynchronous memcpy API.
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API.
While the origin API might be synchronous, it depends on the type of
operand memory, so you may need to call wait() on event return by memcpy
API to ensure synchronization behavior.
@@ -994,18 +994,18 @@ bool session_loop(const ModelGeometry &g, int64_t pos, int32_t pos_base,
const dpct::err0 pe =
DPCT_CHECK_ERROR(cs->ext_oneapi_graph(*gr.posts[l]));
/*
- DPCT1000:570: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (pe != 0) {
/*
- DPCT1009:571: SYCL reports errors using exceptions and does not
+ DPCT1009: SYCL reports errors using exceptions and does not
use error codes. Please replace the
"get_error_string_dummy(...)" with a real error-handling
function.
*/
/*
- DPCT1001:569: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = "session_loop: launch post[" + std::to_string(l) +
"]: " + dpct::get_error_string_dummy(pe);
@@ -1019,7 +1019,7 @@ bool session_loop(const ModelGeometry &g, int64_t pos, int32_t pos_base,
if (dump_layers != nullptr) {
const size_t n = (size_t) g.hc * (size_t) g.n_embd;
/*
- DPCT1124:574: cudaMemcpyAsync is migrated to asynchronous memcpy
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy
API. While the origin API might be synchronous, it depends on the
type of operand memory, so you may need to call wait() on event
return by memcpy API to ensure synchronization behavior.
@@ -1027,18 +1027,18 @@ bool session_loop(const ModelGeometry &g, int64_t pos, int32_t pos_base,
const dpct::err0 de = DPCT_CHECK_ERROR(cs->memcpy(
dump_layers + (size_t)(l + 1) * n, s.R, n * sizeof(float)));
/*
- DPCT1000:573: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (de != 0) {
/*
- DPCT1009:575: SYCL reports errors using exceptions and does not
+ DPCT1009: SYCL reports errors using exceptions and does not
use error codes. Please replace the
"get_error_string_dummy(...)" with a real error-handling
function.
*/
/*
- DPCT1001:572: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = "session_loop: dump layer " + std::to_string(l) + ": " +
dpct::get_error_string_dummy(de);
@@ -1060,18 +1060,18 @@ bool session_loop(const ModelGeometry &g, int64_t pos, int32_t pos_base,
const dpct::err0 ne =
DPCT_CHECK_ERROR(cs->ext_oneapi_graph(*gr.execs[l + 1]));
/*
- DPCT1000:577: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (ne != 0) {
/*
- DPCT1009:578: SYCL reports errors using exceptions and does not
+ DPCT1009: SYCL reports errors using exceptions and does not
use error codes. Please replace the
"get_error_string_dummy(...)" with a real error-handling
function.
*/
/*
- DPCT1001:576: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = "session_loop: launch pre[" + std::to_string(l + 1) +
"]: " + dpct::get_error_string_dummy(ne);
@@ -1138,18 +1138,18 @@ bool session_token(const WeightTable &tables, const ModelGeometry &g,
// IT, instead of a wrong number 40 layers later or at the end of the token.
const dpct::err0 e = DPCT_CHECK_ERROR(cs->wait());
/*
- DPCT1000:580: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (e != 0) {
/*
- DPCT1009:581: SYCL reports errors using exceptions and does not
+ DPCT1009: SYCL reports errors using exceptions and does not
use error codes. Please replace the
"get_error_string_dummy(...)" with a real error-handling
function.
*/
/*
- DPCT1001:579: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = "layer " + std::to_string(l) + ": " +
dpct::get_error_string_dummy(e);
@@ -1235,17 +1235,17 @@ bool session_capture_token(const WeightTable &tables, const ModelGeometry &g,
dpct::get_current_device().destroy_queue(cs);
if (!ok) { if (graph) delete (graph); return false; }
/*
- DPCT1000:583: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (ce != 0) {
/*
- DPCT1009:586: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:582: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = std::string("session_capture_token: end capture: ") +
dpct::get_error_string_dummy(ce);
@@ -1257,17 +1257,17 @@ bool session_capture_token(const WeightTable &tables, const ModelGeometry &g,
graph->finalize()));
delete (graph);
/*
- DPCT1000:585: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (ie != 0) {
/*
- DPCT1009:587: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:584: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = std::string("session_capture_token: instantiate: ") +
dpct::get_error_string_dummy(ie);
@@ -1296,15 +1296,15 @@ bool session_run_token(const ModelGeometry &g, int64_t pos, int32_t pos_base,
doorbell_reset(*s.db);
const dpct::err0 le = DPCT_CHECK_ERROR(cs->ext_oneapi_graph(*tg.exec));
/*
- DPCT1009:592: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
/*
- DPCT1001:588: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:589: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (le != 0) {
@@ -1340,7 +1340,7 @@ bool session_run_token(const ModelGeometry &g, int64_t pos, int32_t pos_base,
err = "session_run_token: layer " + std::to_string(l) +
" never rang (" +
/*
- DPCT1009:593: SYCL reports errors using exceptions and
+ DPCT1009: SYCL reports errors using exceptions and
does not use error codes. Please replace the
"get_error_string_dummy(...)" with a real
error-handling function.
@@ -1370,15 +1370,15 @@ bool session_run_token(const ModelGeometry &g, int64_t pos, int32_t pos_base,
progress_at("token: waiting for the GPU to finish the token");
const dpct::err0 se = DPCT_CHECK_ERROR(cs->wait());
/*
- DPCT1009:594: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
/*
- DPCT1001:590: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:591: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (se != 0) {
diff --git a/sycl/src/core/verify.cpp b/sycl/src/core/verify.cpp
index 02d2af22..ba0c9ca4 100644
--- a/sycl/src/core/verify.cpp
+++ b/sycl/src/core/verify.cpp
@@ -71,7 +71,7 @@ struct Bump {
bool mapped(size_t bytes, void **h, void **d) try {
/*
- DPCT1048:1: The original value cudaHostAllocMapped is not meaningful in the
+ DPCT1048: The original value cudaHostAllocMapped is not meaningful in the
migrated code and was removed or replaced with 0. You may need to check the
migrated code.
*/
@@ -290,7 +290,7 @@ bool Verifier::init(const WeightTable &wt, const ModelGeometry &g,
if (prof_on_) {
const size_t np = (size_t) g.n_layers * kProfPer + 4;
/*
- DPCT1026:36: The call to cudaGetLastError was removed because this
+ DPCT1026: The call to cudaGetLastError was removed because this
functionality is redundant in SYCL.
*/
if (DPCT_CHECK_ERROR(prof_ = (unsigned long long *)sycl::malloc_device(
@@ -308,7 +308,7 @@ bool Verifier::init(const WeightTable &wt, const ModelGeometry &g,
sink_.staging_cap = kStagingBlobs;
(void) TS;
/*
- DPCT1025:37: The SYCL queue is created ignoring the flag and priority
+ DPCT1025: The SYCL queue is created ignoring the flag and priority
options.
*/
if (DPCT_CHECK_ERROR(
@@ -317,7 +317,7 @@ bool Verifier::init(const WeightTable &wt, const ModelGeometry &g,
return false;
}
/*
- DPCT1025:38: The SYCL queue is created ignoring the flag and priority
+ DPCT1025: The SYCL queue is created ignoring the flag and priority
options.
*/
if (DPCT_CHECK_ERROR(cs_ = dpct::get_current_device().create_queue(true)) !=
@@ -349,7 +349,7 @@ bool Verifier::init(const WeightTable &wt, const ModelGeometry &g,
.wait()) == 0;
}
/*
- DPCT1026:39: The call to cudaGetLastError was removed because this
+ DPCT1026: The call to cudaGetLastError was removed because this
functionality is redundant in SYCL.
*/
if (!ok2) {; device_plan_ = false; }
@@ -579,12 +579,19 @@ bool Verifier::record_window(int T, dpct::queue_ptr cs, std::string &err) {
if (st.kv_q4) { // Q4_0 KV (kv_q4.hpp): K and V rotated before they are stored
fwht256_inplace_cuda(kcur_ + tb * NKV * HD, (int64_t) n * NKV, cs);
fwht256_inplace_cuda(vcur_ + tb * NKV * HD, (int64_t) n * NKV, cs);
+ } else if (st.kv_hybrid) { // K8V4: only V is rotated
+ fwht256_inplace_cuda(vcur_ + tb * NKV * HD, (int64_t) n * NKV, cs);
}
stamp(l, 8, grp);
if (grp == 0) copy_from_mapped(tail_snap_ + (size_t) qi * TS, st.idx_tail, TS, cs);
for (int t = tb; t < te; ++t) {
const int32_t* step_t = step_ + t * kStepCount;
- if (st.kv_q4)
+ if (st.kv_hybrid) { // K8V4: the unused half's lanes folded onto the used pool (layer.cpp)
+ kv_append_q8_step(st.k_q, st.k_q, st.k_scale, st.k_scale, st.page_table, step_t,
+ kcur_ + t * NKV * HD, kcur_ + t * NKV * HD, s, cs, nullptr);
+ kv_append_q4_step(st.v_q4, st.v_q4, st.page_table, step_t, vcur_ + t * NKV * HD,
+ vcur_ + t * NKV * HD, s, cs, nullptr);
+ } else if (st.kv_q4)
kv_append_q4_step(st.k_q4, st.v_q4, st.page_table, step_t, kcur_ + t * NKV * HD,
vcur_ + t * NKV * HD, s, cs, &st.host);
else if (st.kv_int8)
@@ -604,7 +611,7 @@ bool Verifier::record_window(int T, dpct::queue_ptr cs, std::string &err) {
n, cs);
if (qb) {
/*
- DPCT1124:40: cudaMemcpy2DAsync is migrated to asynchronous
+ DPCT1124: cudaMemcpy2DAsync is migrated to asynchronous
memcpy API. While the origin API might be synchronous, it
depends on the type of operand memory, so you may need to
call wait() on event return by memcpy API to ensure
@@ -626,7 +633,7 @@ bool Verifier::record_window(int T, dpct::queue_ptr cs, std::string &err) {
for (int t = tb; t < te; ++t) {
float* qc = qcur_ + t * NH * HD;
/*
- DPCT1124:41: cudaMemcpy2DAsync is migrated to asynchronous
+ DPCT1124: cudaMemcpy2DAsync is migrated to asynchronous
memcpy API. While the origin API might be synchronous, it
depends on the type of operand memory, so you may need to
call wait() on event return by memcpy API to ensure
@@ -661,7 +668,7 @@ bool Verifier::record_window(int T, dpct::queue_ptr cs, std::string &err) {
qsa_decode_attn_batch(qcur_ + tb * NH * HD, pools, sel_ + (size_t) tb * cap_, step_ + tb * kStepCount, cap_,
s, attn_scratch_ + (size_t) tb * attn_scratch_floats_, attn_ + tb * NH * HD, n, cs);
stamp(l, 13, grp);
- if (st.kv_q4) fwht256_inplace_cuda(attn_ + tb * NH * HD, (int64_t) n * NH, cs); // back: H^-1 = H
+ if (st.kv_q4 || st.kv_hybrid) fwht256_inplace_cuda(attn_ + tb * NH * HD, (int64_t) n * NH, cs); // back: H^-1 = H
if (qb) native_qsa_gate_apply(attn_ + tb * NH * HD, qfull_ + tb * NH * 2 * HD, attn32_ + tb * NH * HD,
(int) (n * NH), (int) HD, cs);
else
@@ -920,16 +927,16 @@ bool Verifier::capture(int T, std::string &err) try {
return false;
}
/*
- DPCT1000:43: Error handling if-stmt was detected but could not be rewritten.
+ DPCT1000: Error handling if-stmt was detected but could not be rewritten.
*/
if (ce != 0) {
/*
- DPCT1009:46: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
/*
- DPCT1001:42: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = std::string("verify: end capture: ") +
dpct::get_error_string_dummy(ce);
@@ -966,23 +973,23 @@ bool Verifier::capture(int T, std::string &err) try {
graph->finalize()));
delete (graph);
/*
- DPCT1000:45: Error handling if-stmt was detected but could not be rewritten.
+ DPCT1000: Error handling if-stmt was detected but could not be rewritten.
*/
if (ie != 0) {
/*
- DPCT1009:50: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
/*
- DPCT1001:44: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
err = std::string("verify: instantiate: ") +
dpct::get_error_string_dummy(ie);
return false;
}
/*
- DPCT1007:51: Migration of cudaGraphUpload is not supported.
+ DPCT1007: Migration of cudaGraphUpload is not supported.
*/
const dpct::err0 ue = 0; // no cudaGraphUpload on SYCL: a finalized command_graph is already resident
const dpct::err0 us = DPCT_CHECK_ERROR(cs_->wait());
@@ -990,7 +997,7 @@ bool Verifier::capture(int T, std::string &err) try {
stderr,
"strata verify: captured the %d-token window (upload %s, sync %s)\n", T,
/*
- DPCT1009:52: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
@@ -1068,7 +1075,7 @@ bool Verifier::capture_commit(std::string &err) try {
graph->finalize())) != 0) {
if (graph) delete (graph);
/*
- DPCT1009:53: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
@@ -1132,15 +1139,15 @@ bool Verifier::run(int T, const int32_t *tokens, int64_t pos0, PoolMultiFn pool,
? (record_window(T, cs_, err) ? 0 : 1) // SYCL port: eager replay of the window body
: DPCT_CHECK_ERROR((cs_)->ext_oneapi_graph(*exec_[T]));
/*
- DPCT1009:58: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
/*
- DPCT1001:54: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:55: Error handling if-stmt was detected but could not be rewritten.
+ DPCT1000: Error handling if-stmt was detected but could not be rewritten.
*/
if (le != 0) {
err =
@@ -1179,7 +1186,7 @@ bool Verifier::run(int T, const int32_t *tokens, int64_t pos0, PoolMultiFn pool,
err = "verify: layer " + std::to_string(l) +
" never rang (" +
/*
- DPCT1009:59: SYCL reports errors using exceptions and
+ DPCT1009: SYCL reports errors using exceptions and
does not use error codes. Please replace the
"get_error_string_dummy(...)" with a real
error-handling function.
@@ -1231,15 +1238,15 @@ bool Verifier::run(int T, const int32_t *tokens, int64_t pos0, PoolMultiFn pool,
t_prev_end = t_done;
}
/*
- DPCT1009:60: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
/*
- DPCT1001:56: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:57: Error handling if-stmt was detected but could not be rewritten.
+ DPCT1000: Error handling if-stmt was detected but could not be rewritten.
*/
if (se != 0) {
err = std::string("verify: ") + dpct::get_error_string_dummy(se);
@@ -1426,7 +1433,7 @@ void Verifier::fetch_dma(void* ctx, const uint8_t* const* src, int n, size_t byt
if (n <= 0) { raise_flag(v->h_flagB_, want); return; }
uint8_t* stage = (uint8_t*) v->sink_.staging; // this group's half in a split window
/*
- DPCT1124:61: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
the origin API might be synchronous, it depends on the type of operand
memory, so you may need to call wait() on event return by memcpy API to
ensure synchronization behavior.
@@ -1459,15 +1466,15 @@ bool Verifier::commit(int n_keep, std::string &err) try {
const dpct::err0 le =
DPCT_CHECK_ERROR((cs_)->ext_oneapi_graph(*commit_exec_));
/*
- DPCT1009:66: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
/*
- DPCT1001:62: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:63: Error handling if-stmt was detected but could not be rewritten.
+ DPCT1000: Error handling if-stmt was detected but could not be rewritten.
*/
if (le != 0) {
err = std::string("verify: commit launch: ") +
@@ -1476,15 +1483,15 @@ bool Verifier::commit(int n_keep, std::string &err) try {
}
const dpct::err0 se = DPCT_CHECK_ERROR(cs_->wait());
/*
- DPCT1009:67: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
/*
- DPCT1001:64: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:65: Error handling if-stmt was detected but could not be rewritten.
+ DPCT1000: Error handling if-stmt was detected but could not be rewritten.
*/
if (se != 0) {
err =
diff --git a/sycl/src/core/weights.cpp b/sycl/src/core/weights.cpp
index e4119797..e09aa13c 100644
--- a/sycl/src/core/weights.cpp
+++ b/sycl/src/core/weights.cpp
@@ -202,14 +202,14 @@ bool WeightTable::load(const std::string &pack_dir, void *arena_base,
void* stage_in = nullptr;
void* stage_out = nullptr;
/*
- DPCT1048:17: The original value cudaHostAllocDefault is not meaningful in
+ DPCT1048: The original value cudaHostAllocDefault is not meaningful in
the migrated code and was removed or replaced with 0. You may need to check
the migrated code.
*/
if (DPCT_CHECK_ERROR(stage_in = (void *)sycl::malloc_host(
CHUNK, dpct::get_in_order_queue())) != 0 ||
/*
- DPCT1048:18: The original value cudaHostAllocDefault is not meaningful
+ DPCT1048: The original value cudaHostAllocDefault is not meaningful
in the migrated code and was removed or replaced with 0. You may need to
check the migrated code.
*/
@@ -431,7 +431,7 @@ bool WeightTable::load(const std::string &pack_dir, void *arena_base,
const double u0 = now_ms();
/*
- DPCT1114:1055: cudaMemcpy is migrated to asynchronization
+ DPCT1114: cudaMemcpy is migrated to asynchronization
memcpy, assuming in the original code the source host memory is
pageable memory. If the memory is not pageable, call wait() on
event return by memcpy API to ensure synchronization behavior.
diff --git a/sycl/src/kernels/bf16_gemv_parity.cpp b/sycl/src/kernels/bf16_gemv_parity.cpp
index 18c57934..519c7618 100644
--- a/sycl/src/kernels/bf16_gemv_parity.cpp
+++ b/sycl/src/kernels/bf16_gemv_parity.cpp
@@ -103,7 +103,7 @@ int main(int argc, char** argv) {
(size_t)s.n_out * 4, dpct::get_in_order_queue())),
"y");
/*
- DPCT1114:1141: cudaMemcpy is migrated to asynchronization memcpy,
+ DPCT1114: cudaMemcpy is migrated to asynchronization memcpy,
assuming in the original code the source host memory is pageable memory.
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
@@ -112,7 +112,7 @@ int main(int argc, char** argv) {
x.size() * 2).wait()),
"cx");
/*
- DPCT1114:1142: cudaMemcpy is migrated to asynchronization memcpy,
+ DPCT1114: cudaMemcpy is migrated to asynchronization memcpy,
assuming in the original code the source host memory is pageable memory.
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
@@ -158,7 +158,7 @@ int main(int argc, char** argv) {
// fp16. That is the whole difference between the two contracts at this call site.
for (size_t i = 0; i < fp16_as_f32.size(); ++i) x[i] = bf16_from_f32(fp16_as_f32[i]);
/*
- DPCT1114:1143: cudaMemcpy is migrated to asynchronization memcpy,
+ DPCT1114: cudaMemcpy is migrated to asynchronization memcpy,
assuming in the original code the source host memory is pageable
memory. If the memory is not pageable, call wait() on event return
by memcpy API to ensure synchronization behavior.
diff --git a/sycl/src/kernels/cuda/bf16_gemv.dp.cpp b/sycl/src/kernels/cuda/bf16_gemv.dp.cpp
index 9ed03958..42996b23 100644
--- a/sycl/src/kernels/cuda/bf16_gemv.dp.cpp
+++ b/sycl/src/kernels/cuda/bf16_gemv.dp.cpp
@@ -53,7 +53,7 @@ __dpct_inline__ void bf16_gemv_warp_kernel(const uint16_t *__restrict__ x,
for (long long i = lane; i < n_in; i += 32)
acc += f32_from_bf16(x[i]) * f32_from_bf16(row[i]);
/*
-DPCT1108:171: '__shfl_down_sync' was migrated with the experimental feature
+DPCT1108: '__shfl_down_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
@@ -89,7 +89,7 @@ __dpct_inline__ void bf16_gemv_split_kernel(const uint16_t *__restrict__ x,
for (int off = tpr >> 1; off > 0; off >>= 1) {
if (t < off) scratch[t] += scratch[t + off];
/*
- DPCT1118:172: SYCL group functions and algorithms must be encountered in
+ DPCT1118: SYCL group functions and algorithms must be encountered in
converged control flow. You may need to adjust the code.
*/
item_ct1.barrier(sycl::access::fence_space::local_space);
@@ -99,7 +99,7 @@ __dpct_inline__ void bf16_gemv_split_kernel(const uint16_t *__restrict__ x,
inline void finish(void *stream, const char *what) try {
/*
- DPCT1010:839: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
@@ -213,7 +213,7 @@ void bf16_gemv_split(const uint16_t* x, const uint16_t* w, float* y, int64_t n_i
}
const unsigned grid = (unsigned) n_out;
/*
- DPCT1049:173: The work-group size passed to the SYCL kernel may exceed the
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed the
limit. To get the device limit, query info::device::max_work_group_size.
Adjust the work-group size if needed.
*/
@@ -224,7 +224,7 @@ void bf16_gemv_split(const uint16_t* x, const uint16_t* w, float* y, int64_t n_i
strata::q_of(stream)
->submit([&](sycl::handler &cgh) {
/*
- DPCT1083:1164: The size of local memory in the migrated code may
+ DPCT1083: The size of local memory in the migrated code may
be different from the original code. Check that the allocated
memory size in the migrated code is correct.
*/
diff --git a/sycl/src/kernels/cuda/cvec.dp.cpp b/sycl/src/kernels/cuda/cvec.dp.cpp
index 246fe5ca..8d0a4be4 100644
--- a/sycl/src/kernels/cuda/cvec.dp.cpp
+++ b/sycl/src/kernels/cuda/cvec.dp.cpp
@@ -44,7 +44,7 @@ bool upload_here(std::string &err) try {
DPCT_CHECK_ERROR(t.on = sycl::malloc_device(
1, dpct::get_in_order_queue())) != 0 ||
/*
- DPCT1114:507: cudaMemcpy is migrated to asynchronization memcpy,
+ DPCT1114: cudaMemcpy is migrated to asynchronization memcpy,
assuming in the original code the source host memory is pageable memory.
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
@@ -53,7 +53,7 @@ bool upload_here(std::string &err) try {
t.dir, g_dir_host.data(), g_dir_host.size() * sizeof(float)).wait()) !=
0 ||
/*
- DPCT1114:508: cudaMemcpy is migrated to asynchronization memcpy,
+ DPCT1114: cudaMemcpy is migrated to asynchronization memcpy,
assuming in the original code the source host memory is pageable memory.
If the memory is not pageable, call wait() on event return by memcpy API
to ensure synchronization behavior.
@@ -82,7 +82,7 @@ __dpct_inline__ float sigmoidf_(float x) {
// one block per (stream, token): the pending write, then h . v over the stream, then the update
/*
-DPCT1110:95: The total declared local variable size in device function
+DPCT1110: The total declared local variable size in device function
cvec_kernel exceeds 128 bytes and may cause high register pressure. Consult with
your hardware vendor to find the total register size available and adjust the
code, or use smaller sub-group size to avoid high register pressure.
@@ -121,7 +121,7 @@ cvec_kernel(float *__restrict__ R, const float *__restrict__ dir,
sycl::ext::oneapi::this_work_item::get_work_group<3>());
#pragma unroll
/*
- DPCT1108:98: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -132,11 +132,11 @@ cvec_kernel(float *__restrict__ R, const float *__restrict__ dir,
if ((item_ct1.get_local_id(2) & 31) == 0)
part[item_ct1.get_local_id(2) >> 5] = dot;
/*
- DPCT1118:96: SYCL group functions and algorithms must be encountered in
+ DPCT1118: SYCL group functions and algorithms must be encountered in
converged control flow. You may need to adjust the code.
*/
/*
- DPCT1065:509: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for
better performance if there is no access to global memory.
*/
@@ -147,7 +147,7 @@ cvec_kernel(float *__restrict__ R, const float *__restrict__ dir,
: 0.0f;
#pragma unroll
/*
- DPCT1108:99: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -158,11 +158,11 @@ cvec_kernel(float *__restrict__ R, const float *__restrict__ dir,
if (item_ct1.get_local_id(2) == 0) part[0] = p;
}
/*
- DPCT1118:97: SYCL group functions and algorithms must be encountered in
+ DPCT1118: SYCL group functions and algorithms must be encountered in
converged control flow. You may need to adjust the code.
*/
/*
- DPCT1065:510: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for
better performance if there is no access to global memory.
*/
@@ -194,7 +194,7 @@ bool cvec_upload(const std::vector& dir, const std::vector& s, int
for (int d = 0; d < kDevices; ++d) {
if (g_dev[d].dir == nullptr) continue;
/*
- DPCT1093:512: The "d" device may be not the one intended for use. Adjust
+ DPCT1093: The "d" device may be not the one intended for use. Adjust
the selected device if needed.
*/
dpct::select_device(d);
@@ -205,7 +205,7 @@ bool cvec_upload(const std::vector& dir, const std::vector& s, int
g_dev[d] = DevTables{};
}
/*
- DPCT1093:511: The "prev" device may be not the one intended for use. Adjust
+ DPCT1093: The "prev" device may be not the one intended for use. Adjust
the selected device if needed.
*/
dpct::select_device(prev);
@@ -237,7 +237,7 @@ void cvec_set_enabled(bool on) {
for (int d = 0; d < kDevices; ++d) {
if (g_dev[d].on == nullptr) continue;
/*
- DPCT1093:514: The "d" device may be not the one intended for use. Adjust
+ DPCT1093: The "d" device may be not the one intended for use. Adjust
the selected device if needed.
*/
dpct::select_device(d);
@@ -247,7 +247,7 @@ void cvec_set_enabled(bool on) {
dpct::get_in_order_queue().memcpy(g_dev[d].on, &v, sizeof(int)).wait();
}
/*
- DPCT1093:513: The "prev" device may be not the one intended for use. Adjust
+ DPCT1093: The "prev" device may be not the one intended for use. Adjust
the selected device if needed.
*/
dpct::select_device(prev);
@@ -287,7 +287,7 @@ void cvec_apply(float *R, int64_t layer, int64_t T, int64_t r_ld,
});
}
/*
- DPCT1010:515: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaPeekAtLastError function call was replaced with 0. You
need to rewrite this code.
*/
diff --git a/sycl/src/kernels/cuda/dequant_bf16.dp.cpp b/sycl/src/kernels/cuda/dequant_bf16.dp.cpp
index bfdb54fc..14da1e84 100644
--- a/sycl/src/kernels/cuda/dequant_bf16.dp.cpp
+++ b/sycl/src/kernels/cuda/dequant_bf16.dp.cpp
@@ -45,7 +45,7 @@ __dpct_inline__ void scale_min_k4(int j, const uint8_t *q, int &d, int &m) {
// One 32-element group `g` (row-major over the whole slice); `out` points at that group's 32 outputs.
template
/*
-DPCT1110:176: The total declared local variable size in device function group32
+DPCT1110: The total declared local variable size in device function group32
exceeds 128 bytes and may cause high register pressure. Consult with your
hardware vendor to find the total register size available and adjust the code,
or use smaller sub-group size to avoid high register pressure.
@@ -251,13 +251,13 @@ void launch(int type, const void* blocks, int64_t row0, int64_t rows, int64_t co
}
#undef STRATA_DQ
/*
- DPCT1010:854: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const dpct::err0 e = 0;
/*
- DPCT1009:855: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
diff --git a/sycl/src/kernels/cuda/elementwise.dp.cpp b/sycl/src/kernels/cuda/elementwise.dp.cpp
index 377de2cb..731c6fbd 100644
--- a/sycl/src/kernels/cuda/elementwise.dp.cpp
+++ b/sycl/src/kernels/cuda/elementwise.dp.cpp
@@ -35,14 +35,14 @@ __dpct_inline__ void embedding_gather_kernel(const uint8_t *__restrict__ codes,
const int code = (codes[i / per_byte] >> ((i % per_byte) * code_bits)) & mask;
const int64_t group = i / group_elems;
/*
- DPCT1013:1056: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
*/
const float product = (float)(code + code_bias) * scales[group];
/*
- DPCT1013:1057: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -151,7 +151,7 @@ __dpct_inline__ void rms_norm_weighted_kernel(float *__restrict__ x,
#pragma unroll
for (int64_t c = lane; c < cols; c += 32) acc += r[c] * r[c];
/*
-DPCT1108:275: '__shfl_down_sync' was migrated with the experimental feature
+DPCT1108: '__shfl_down_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
@@ -166,7 +166,7 @@ runtimes. You may need to adjust the code.
float inv = 0.0f;
if (lane == 0) inv = sycl::rsqrt(acc / (float)cols + eps);
/*
- DPCT1108:276: '__shfl_sync' was migrated with the experimental feature
+ DPCT1108: '__shfl_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
@@ -191,7 +191,7 @@ catch (sycl::exception const &exc) {
bool check_launch(const char* what) {
/*
- DPCT1010:1059: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
@@ -365,7 +365,7 @@ void silu_inplace(float* x, int64_t n, void* stream) {
/// very expensive substitute for one fence instruction.
__dpct_inline__ void doorbell_ring_kernel(uint32_t *seq) {
/*
- DPCT1078:277: Consider replacing memory_order::acq_rel with
+ DPCT1078: Consider replacing memory_order::acq_rel with
memory_order::seq_cst for correctness if strong memory order restrictions
are needed.
*/
@@ -377,13 +377,13 @@ __dpct_inline__ void doorbell_wait_kernel(const volatile uint32_t *flag,
const volatile uint32_t *seq) {
const uint32_t want = strata::sys_load(seq);
/*
- DPCT1008:1061: __nanosleep function is not defined in SYCL. This is a
+ DPCT1008: __nanosleep function is not defined in SYCL. This is a
hardware-specific feature. Consult with your hardware vendor to find a
replacement.
*/
for (uint32_t spin = 0; spin < strata::kSpinMax && strata::sys_load(flag) != want; ++spin) {}
/*
- DPCT1078:278: Consider replacing memory_order::acq_rel with
+ DPCT1078: Consider replacing memory_order::acq_rel with
memory_order::seq_cst for correctness if strong memory order restrictions
are needed.
*/
@@ -407,7 +407,7 @@ void doorbell_wait(const uint32_t* d_flag, const uint32_t* d_seq, void* stream)
}
/*
-DPCT1052:1062: SYCL does not support the member access for a volatile qualified
+DPCT1052: SYCL does not support the member access for a volatile qualified
vector type. The volatile qualifier was removed. You may need to rewrite the
code.
*/
@@ -428,7 +428,7 @@ __dpct_inline__ void copy_from_mapped_kernel(sycl::float4 *__restrict__ dst,
// the CPU rows of a verify window, skipping the rows the GPU plan computes itself (the
// pool writes +0.0 into those, so this writes +0.0 too): block = row, the plan's hit rows `dst[0, *count)`.
/*
-DPCT1052:1063: SYCL does not support the member access for a volatile qualified
+DPCT1052: SYCL does not support the member access for a volatile qualified
vector type. The volatile qualifier was removed. You may need to rewrite the
code.
*/
@@ -455,7 +455,7 @@ __dpct_inline__ void copy_rows_from_mapped_kernel(
d[i] = sycl::float4(0.0f, 0.0f, 0.0f, 0.0f);
} else {
/*
- DPCT1052:1064: SYCL does not support the member access for a volatile
+ DPCT1052: SYCL does not support the member access for a volatile
qualified vector type. The volatile qualifier was removed. You may need
to rewrite the code.
*/
@@ -537,20 +537,20 @@ __dpct_inline__ void doorbell_publish_kernel(const float *__restrict__ x,
w_out[item_ct1.get_local_id(2)] = w[item_ct1.get_local_id(2)];
}
/*
- DPCT1078:279: Consider replacing memory_order::acq_rel with
+ DPCT1078: Consider replacing memory_order::acq_rel with
memory_order::seq_cst for correctness if strong memory order restrictions
are needed.
*/
sycl::atomic_fence(sycl::memory_order::acq_rel, sycl::memory_scope::system);
/*
- DPCT1065:1065: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
item_ct1.barrier();
if (item_ct1.get_local_id(2) == 0) {
/*
- DPCT1078:280: Consider replacing memory_order::acq_rel with
+ DPCT1078: Consider replacing memory_order::acq_rel with
memory_order::seq_cst for correctness if strong memory order
restrictions are needed.
*/
@@ -564,7 +564,7 @@ void doorbell_publish(const float* x, const int32_t* ids, const float* weights,
int32_t* ids_out, float* weights_out, uint32_t* d_seq, void* stream) {
if (k > 1024) { std::fprintf(stderr, "doorbell_publish: k too large\n"); std::exit(1); }
/*
- DPCT1049:281: The work-group size passed to the SYCL kernel may exceed the
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed the
limit. To get the device limit, query info::device::max_work_group_size.
Adjust the work-group size if needed.
*/
diff --git a/sycl/src/kernels/cuda/fused_gdn.dp.cpp b/sycl/src/kernels/cuda/fused_gdn.dp.cpp
index 0e587e88..eca2bab0 100644
--- a/sycl/src/kernels/cuda/fused_gdn.dp.cpp
+++ b/sycl/src/kernels/cuda/fused_gdn.dp.cpp
@@ -16,7 +16,7 @@ constexpr int RG = 4; // row groups
constexpr int RPG = S / RG; // 32 rows per thread
/*
-DPCT1110:292: The total declared local variable size in device function
+DPCT1110: The total declared local variable size in device function
gdn_step_norm_kernel exceeds 128 bytes and may cause high register pressure.
Consult with your hardware vendor to find the total register size available and
adjust the code, or use smaller sub-group size to avoid high register pressure.
@@ -50,7 +50,7 @@ auto &sk = *sycl::ext::oneapi::group_local_memory_for_overwrite(
#pragma unroll
for (int r = 0; r < RPG; ++r) s[r] = base[r * row_stride];
/*
- DPCT1065:1151: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -61,7 +61,7 @@ auto &sk = *sycl::ext::oneapi::group_local_memory_for_overwrite(
for (int r = 0; r < RPG; ++r) kv = sycl::fma(s[r], sk[rg * RPG + r], kv);
red[rg][col] = kv;
/*
- DPCT1065:1152: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -76,14 +76,14 @@ auto &sk = *sycl::ext::oneapi::group_local_memory_for_overwrite(
base[r * row_stride] = s[r];
}
/*
- DPCT1065:1153: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
item_ct1.barrier(); // every thread has read red[] for kv_col
red[rg][col] = o;
/*
- DPCT1065:1154: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -96,7 +96,7 @@ auto &sk = *sycl::ext::oneapi::group_local_memory_for_overwrite(
}
// RMS over the head's 128 outputs: warps of row group 0 are threads 0..127.
/*
-DPCT1108:293: '__shfl_xor_sync' was migrated with the experimental feature
+DPCT1108: '__shfl_xor_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
@@ -107,7 +107,7 @@ runtimes. You may need to adjust the code.
sq_part, o2);
if ((tid & 31) == 0) wsum[tid >> 5] = sq_part;
/*
- DPCT1065:1155: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -140,7 +140,7 @@ auto &part =
if ((int)item_ct1.get_group(2) < qk_heads) {
float sq = y * y;
/*
-DPCT1108:295: '__shfl_xor_sync' was migrated with the experimental feature
+DPCT1108: '__shfl_xor_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
@@ -152,11 +152,11 @@ runtimes. You may need to adjust the code.
if ((item_ct1.get_local_id(2) & 31) == 0)
part[item_ct1.get_local_id(2) >> 5] = sq;
/*
- DPCT1118:294: SYCL group functions and algorithms must be encountered in
+ DPCT1118: SYCL group functions and algorithms must be encountered in
converged control flow. You may need to adjust the code.
*/
/*
- DPCT1065:1156: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for
better performance if there is no access to global memory.
*/
@@ -183,7 +183,7 @@ gdn_ab_kernel(const float *__restrict__ x, const uint16_t *__restrict__ wa,
float acc = 0.0f;
for (int j = lane; j < n / 8; j += 32) {
/*
- DPCT1098:1157: The '*' expression is used instead of the __ldg call.
+ DPCT1098: The '*' expression is used instead of the __ldg call.
These two expressions do not provide the exact same functionality. Check
the generated code for potential precision and/or performance issues.
*/
@@ -210,7 +210,7 @@ gdn_ab_kernel(const float *__restrict__ x, const uint16_t *__restrict__ wa,
(float)(xb.w()), acc);
}
/*
-DPCT1108:296: '__shfl_xor_sync' was migrated with the experimental feature
+DPCT1108: '__shfl_xor_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
@@ -254,13 +254,13 @@ void fused_gdn_conv_l2(float* history, const float* qkv, const float* conv_w, fl
});
}
/*
- DPCT1010:1158: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const dpct::err0 e = 0;
/*
- DPCT1009:1159: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
@@ -290,13 +290,13 @@ void fused_gdn_ab(const float* x, const uint16_t* w_alpha, const uint16_t* w_bet
});
}
/*
- DPCT1010:1160: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const dpct::err0 e = 0;
/*
- DPCT1009:1161: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
@@ -310,7 +310,7 @@ void fused_gdn_step_norm(float* state, const float* q, const float* k, const flo
std::exit(1);
}
/*
- DPCT1049:297: The work-group size passed to the SYCL kernel may exceed the
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed the
limit. To get the device limit, query info::device::max_work_group_size.
Adjust the work-group size if needed.
*/
@@ -331,7 +331,7 @@ void fused_gdn_step_norm(float* state, const float* q, const float* k, const flo
});
}
/*
- DPCT1010:1162: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
diff --git a/sycl/src/kernels/cuda/fused_gr.dp.cpp b/sycl/src/kernels/cuda/fused_gr.dp.cpp
index 431e90b5..86375f1d 100644
--- a/sycl/src/kernels/cuda/fused_gr.dp.cpp
+++ b/sycl/src/kernels/cuda/fused_gr.dp.cpp
@@ -26,7 +26,7 @@ constexpr int UP_BLOCKS = N / UP_COLS; // 80
__dpct_inline__ float warp_sum(float v) {
#pragma unroll
/*
- DPCT1108:88: '__shfl_xor_sync' was migrated with the experimental feature
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
@@ -55,7 +55,7 @@ __dpct_inline__ float dot8(const sycl::uint4 w, const float *x) {
}
/*
-DPCT1110:89: The total declared local variable size in device function
+DPCT1110: The total declared local variable size in device function
gr_down_kernel exceeds 128 bytes and may cause high register pressure. Consult
with your hardware vendor to find the total register size available and adjust
the code, or use smaller sub-group size to avoid high register pressure.
@@ -102,7 +102,7 @@ auto &xn = *sycl::ext::oneapi::group_local_memory_for_overwrite(
if (lane == 0) part[warp][c] = v;
}
/*
- DPCT1065:457: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -115,7 +115,7 @@ auto &xn = *sycl::ext::oneapi::group_local_memory_for_overwrite(
if (item_ct1.get_group(2) == 0) a.rs[t] = s_rs[t];
}
/*
- DPCT1065:458: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -123,7 +123,7 @@ auto &xn = *sycl::ext::oneapi::group_local_memory_for_overwrite(
#pragma unroll
for (int i = t; i < D; i += THREADS) xn[i] *= s_rs[i / N];
/*
- DPCT1065:459: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -137,7 +137,7 @@ auto &xn = *sycl::ext::oneapi::group_local_memory_for_overwrite(
float acc = 0.0f;
#pragma unroll 4
/*
- DPCT1098:460: The '*' expression is used instead of the __ldg call. These
+ DPCT1098: The '*' expression is used instead of the __ldg call. These
two expressions do not provide the exact same functionality. Check the
generated code for potential precision and/or performance issues.
*/
@@ -164,7 +164,7 @@ auto &lo = *sycl::ext::oneapi::group_local_memory_for_overwrite(
#pragma unroll
for (int k = t; k < LR; k += THREADS) lo[k] = a.lo[k];
/*
- DPCT1065:461: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -175,13 +175,13 @@ auto &lo = *sycl::ext::oneapi::group_local_memory_for_overwrite(
const sycl::uint4 *w4 =
reinterpret_cast(a.w_up + (size_t)i * LR);
/*
- DPCT1098:463: The '*' expression is used instead of the __ldg call.
+ DPCT1098: The '*' expression is used instead of the __ldg call.
These two expressions do not provide the exact same functionality. Check
the generated code for potential precision and/or performance issues.
*/
float acc = dot8(*(w4 + lane), lo + lane * 8);
/*
- DPCT1098:464: The '*' expression is used instead of the __ldg call.
+ DPCT1098: The '*' expression is used instead of the __ldg call.
These two expressions do not provide the exact same functionality. Check
the generated code for potential precision and/or performance issues.
*/
@@ -200,7 +200,7 @@ auto &lo = *sycl::ext::oneapi::group_local_memory_for_overwrite(
}
}
/*
- DPCT1065:462: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -222,7 +222,7 @@ struct GrMulti {
// Step 1 of `gr_down_kernel`, one block per token, same threads and reduction order: rs[t] and xn[t] to global.
/*
-DPCT1110:90: The total declared local variable size in device function
+DPCT1110: The total declared local variable size in device function
gr_norm_multi_kernel exceeds 128 bytes and may cause high register pressure.
Consult with your hardware vendor to find the total register size available and
adjust the code, or use smaller sub-group size to avoid high register pressure.
@@ -268,7 +268,7 @@ auto &part =
if (lane == 0) part[warp][c] = v;
}
/*
- DPCT1065:465: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -281,7 +281,7 @@ auto &part =
a.rs[t] = s_rs[t];
}
/*
- DPCT1065:466: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -290,14 +290,18 @@ auto &part =
for (int i = t; i < D; i += THREADS) xn[i] *= s_rs[i / N];
}
+#if defined(__HIPCC__)
+constexpr int TILE = 1280; // eight-token tile fits gfx1100's 64 KiB LDS limit
+#else
constexpr int TILE = 2560; // xn floats per token staged at a time: 320 chunks of 8, 10 per lane
+#endif
constexpr int TQ = TILE / 8 / 32; // uint4 weight chunks per lane per tile
// Step 2 of `gr_down_kernel` for T tokens. One warp per row (so each lane accumulates the same chunks in the
// same order as the single-token kernel); per tile the lane's 10 weight chunks are loaded BEFORE the activation
// tile is staged, so the DRAM and L2 traffic are in flight together.
/*
-DPCT1110:91: The total declared local variable size in device function
+DPCT1110: The total declared local variable size in device function
gr_down_multi_kernel exceeds 128 bytes and may cause high register pressure.
Consult with your hardware vendor to find the total register size available and
adjust the code, or use smaller sub-group size to avoid high register pressure.
@@ -320,7 +324,7 @@ __dpct_inline__ void gr_down_multi_kernel(GrMulti m, uint8_t *dpct_local) {
if (active) {
#pragma unroll
/*
- DPCT1098:469: The '*' expression is used instead of the __ldg call.
+ DPCT1098: The '*' expression is used instead of the __ldg call.
These two expressions do not provide the exact same functionality.
Check the generated code for potential precision and/or performance
issues.
@@ -329,11 +333,11 @@ __dpct_inline__ void gr_down_multi_kernel(GrMulti m, uint8_t *dpct_local) {
wv[q] = *(w4 + base / 8 + lane + 32 * q);
}
/*
- DPCT1118:92: SYCL group functions and algorithms must be encountered in
+ DPCT1118: SYCL group functions and algorithms must be encountered in
converged control flow. You may need to adjust the code.
*/
/*
- DPCT1065:467: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for
better performance if there is no access to global memory.
*/
@@ -345,11 +349,11 @@ __dpct_inline__ void gr_down_multi_kernel(GrMulti m, uint8_t *dpct_local) {
tile4[i] = src4[((size_t) k * D + base) / 4 + off];
}
/*
- DPCT1118:93: SYCL group functions and algorithms must be encountered in
+ DPCT1118: SYCL group functions and algorithms must be encountered in
converged control flow. You may need to adjust the code.
*/
/*
- DPCT1065:468: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for
better performance if there is no access to global memory.
*/
@@ -386,7 +390,7 @@ constexpr int UPM_BLOCKS = N / UPM_COLS; // 160
// `gr_up_kernel` for T tokens: each row of w_up read once; the T dots reduced by xor so every lane holds every
// sum, and lane k runs token k's epilogue - the T epilogues in parallel instead of one after another.
/*
-DPCT1110:94: The total declared local variable size in device function
+DPCT1110: The total declared local variable size in device function
gr_up_multi_kernel exceeds 128 bytes and may cause high register pressure.
Consult with your hardware vendor to find the total register size available and
adjust the code, or use smaller sub-group size to avoid high register pressure.
@@ -406,7 +410,7 @@ auto &lo = *sycl::ext::oneapi::group_local_memory_for_overwrite<
for (int i = t; i < T * LR; i += THREADS)
lo[i / LR][i % LR] = m.a[i / LR].lo[i % LR];
/*
- DPCT1065:470: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -416,13 +420,13 @@ auto &lo = *sycl::ext::oneapi::group_local_memory_for_overwrite<
const sycl::uint4 *w4 =
reinterpret_cast(m.a[0].w_up + (size_t)i * LR);
/*
- DPCT1098:472: The '*' expression is used instead of the __ldg call.
+ DPCT1098: The '*' expression is used instead of the __ldg call.
These two expressions do not provide the exact same functionality. Check
the generated code for potential precision and/or performance issues.
*/
const sycl::uint4 wa = *(w4 + lane);
/*
- DPCT1098:473: The '*' expression is used instead of the __ldg call.
+ DPCT1098: The '*' expression is used instead of the __ldg call.
These two expressions do not provide the exact same functionality. Check
the generated code for potential precision and/or performance issues.
*/
@@ -458,7 +462,7 @@ auto &lo = *sycl::ext::oneapi::group_local_memory_for_overwrite<
}
}
/*
- DPCT1065:471: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -498,7 +502,7 @@ void fused_gr_read_multi(const FusedGrArgs* a, int n_tok, float* xn_scratch, voi
auto exp_props = sycl::ext::oneapi::experimental::properties{
sycl::ext::oneapi::experimental::use_root_sync};
- st->parallel_for>(
+ st->parallel_for>(
sycl::nd_range<3>(sycl::range(1, 1, n_tok) *
sycl::range(1, 1, THREADS),
sycl::range(1, 1, THREADS)),
@@ -511,13 +515,14 @@ void fused_gr_read_multi(const FusedGrArgs* a, int n_tok, float* xn_scratch, voi
// the shared-memory opt-in is a per-DEVICE setting: once per device, not once per process (a layer split
// runs this kernel on two cards)
static bool attr[64] = {};
+ static int chunk[64] = {}; // Turing port: tokens the down kernel may carry in one launch on this card
int dev = 0;
dev = dpct::get_current_device_id();
- if (dev < 0 || dev >= 64 || !attr[dev]) {
+ if (dev >= 0 && dev < 64 && !attr[dev]) {
// at most what the card allows (Turing: 64 KB - enough for windows of up to 6 tokens)
int optin = 0;
/*
- DPCT1019:474: local_mem_size in SYCL is not a complete equivalent of
+ DPCT1019: local_mem_size in SYCL is not a complete equivalent of
cudaDevAttrMaxSharedMemoryPerBlockOptin in CUDA. You may need to adjust
the code.
*/
@@ -525,30 +530,40 @@ void fused_gr_read_multi(const FusedGrArgs* a, int n_tok, float* xn_scratch, voi
int want = (int) (kFusedGrMaxT * TILE * sizeof(float));
if (optin > 0 && want > optin) want = optin;
/*
- DPCT1026:475: The call to cudaFuncSetAttribute was removed because SYCL
+ DPCT1026: The call to cudaFuncSetAttribute was removed because SYCL
currently does not support corresponding setting.
*/
/*
- DPCT1026:476: The call to cudaGetLastError was removed because this
+ DPCT1026: The call to cudaGetLastError was removed because this
functionality is redundant in SYCL.
*/
- if (dev >= 0 && dev < 64) attr[dev] = true;
+; // drop any error the attempt left behind
+ // Turing port: the down kernel stages n_tok*TILE floats of dynamic shared memory - 80 KB at the full
+ // 8 tokens. A card whose opt-in is below that (Turing: 64 KB, so 7+ tokens fail to launch as
+ // "invalid argument") processes the tokens in slices that fit; a card that reports no opt-in gets what
+ // fits the 48 KB default (4 tokens of the CUDA tile; all 8 of HIP's smaller tile). The down kernel's
+ // outputs (lo, inject_out) are strictly per-token, so the chunk boundaries are safe, and the up kernel
+ // below still sees every token of the batch in one launch.
+ const int capacity = (optin > 0 ? optin : 48 * 1024) / (int) (TILE * sizeof(float));
+ chunk[dev] = capacity < 1 ? 1 : (capacity > kFusedGrMaxT ? kFusedGrMaxT : capacity);
+ attr[dev] = true;
}
- {
+ const int chunk_tok = (dev >= 0 && dev < 64 && chunk[dev]) ? chunk[dev] : kFusedGrMaxT;
+ if (chunk_tok >= n_tok) {
auto exp_props = sycl::ext::oneapi::experimental::properties{
sycl::ext::oneapi::experimental::use_root_sync};
st->submit([&](sycl::handler &cgh) {
/*
- DPCT1083:1166: The size of local memory in the migrated code may be
- different from the original code. Check that the allocated memory
- size in the migrated code is correct.
+ DPCT1083: The size of local memory in the migrated code may
+ be different from the original code. Check that the allocated
+ memory size in the migrated code is correct.
*/
sycl::local_accessor dpct_local_acc_ct1(
sycl::range((size_t)n_tok * TILE * sizeof(float)), cgh);
cgh.parallel_for<
- dpct_kernel_name>(
+ dpct_kernel_name>(
sycl::nd_range<3>(sycl::range(1, 1, DOWN_BLOCKS + 1) *
sycl::range(1, 1, THREADS),
sycl::range(1, 1, THREADS)),
@@ -561,13 +576,50 @@ void fused_gr_read_multi(const FusedGrArgs* a, int n_tok, float* xn_scratch, voi
.get());
});
});
+ } else {
+ for (int c0 = 0; c0 < n_tok; c0 += chunk_tok) {
+ const int ct = n_tok - c0 < chunk_tok ? n_tok - c0 : chunk_tok;
+ GrMulti c{};
+ c.xn = xn_scratch + (size_t) c0 * D;
+ c.T = ct;
+ for (int k = 0; k < ct; ++k) c.a[k] = a[c0 + k];
+ {
+ auto exp_props = sycl::ext::oneapi::experimental::properties{
+ sycl::ext::oneapi::experimental::use_root_sync};
+
+ st->submit([&](sycl::handler &cgh) {
+ /*
+ DPCT1083: The size of local memory in the migrated code
+ may be different from the original code. Check that the
+ allocated memory size in the migrated code is correct.
+ */
+ sycl::local_accessor dpct_local_acc_ct1(
+ sycl::range((size_t)ct * TILE * sizeof(float)), cgh);
+
+ cgh.parallel_for<
+ dpct_kernel_name>(
+ sycl::nd_range<3>(sycl::range(1, 1, DOWN_BLOCKS + 1) *
+ sycl::range(1, 1, THREADS),
+ sycl::range(1, 1, THREADS)),
+ exp_props,
+ [=](sycl::nd_item<3> item_ct1)
+ [[sycl::reqd_sub_group_size(32)]] {
+ gr_down_multi_kernel(
+ c, dpct_local_acc_ct1
+ .get_multi_ptr<
+ sycl::access::decorated::no>()
+ .get());
+ });
+ });
+ }
+ }
}
if (stamp_buf) gpu_stamp(stamp_buf, stamp_i0 + 1, stream);
{
auto exp_props = sycl::ext::oneapi::experimental::properties{
sycl::ext::oneapi::experimental::use_root_sync};
- st->parallel_for>(
+ st->parallel_for>(
sycl::nd_range<3>(sycl::range(1, 1, UPM_BLOCKS) *
sycl::range(1, 1, THREADS),
sycl::range(1, 1, THREADS)),
@@ -577,7 +629,7 @@ void fused_gr_read_multi(const FusedGrArgs* a, int n_tok, float* xn_scratch, voi
});
}
/*
- DPCT1010:477: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
@@ -600,7 +652,7 @@ void fused_gr_read(const FusedGrArgs& a, void* stream) {
auto exp_props = sycl::ext::oneapi::experimental::properties{
sycl::ext::oneapi::experimental::use_root_sync};
- st->parallel_for>(
+ st->parallel_for>(
sycl::nd_range<3>(sycl::range(1, 1, DOWN_BLOCKS + 1) *
sycl::range(1, 1, THREADS),
sycl::range(1, 1, THREADS)),
@@ -613,7 +665,7 @@ void fused_gr_read(const FusedGrArgs& a, void* stream) {
auto exp_props = sycl::ext::oneapi::experimental::properties{
sycl::ext::oneapi::experimental::use_root_sync};
- st->parallel_for>(
+ st->parallel_for>(
sycl::nd_range<3>(sycl::range(1, 1, UP_BLOCKS) *
sycl::range(1, 1, THREADS),
sycl::range(1, 1, THREADS)),
@@ -623,7 +675,7 @@ void fused_gr_read(const FusedGrArgs& a, void* stream) {
});
}
/*
- DPCT1010:479: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
diff --git a/sycl/src/kernels/cuda/gdn.dp.cpp b/sycl/src/kernels/cuda/gdn.dp.cpp
index b56c9629..3373560a 100644
--- a/sycl/src/kernels/cuda/gdn.dp.cpp
+++ b/sycl/src/kernels/cuda/gdn.dp.cpp
@@ -84,7 +84,7 @@ auto &ks =
}
}
/*
- DPCT1065:326: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -155,7 +155,7 @@ __dpct_inline__ void gdn_l2_kernel(float *__restrict__ x, int cols, float eps) {
i += item_ct1.get_local_range(2)) acc += (double)p[i] * (double)p[i];
// warp reduction
/*
-DPCT1108:35: '__shfl_down_sync' was migrated with the experimental feature
+DPCT1108: '__shfl_down_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
@@ -168,7 +168,7 @@ runtimes. You may need to adjust the code.
sycl::ext::oneapi::this_work_item::get_work_group<3>());
if (item_ct1.get_local_id(2) == 0) ssum = acc;
/*
- DPCT1065:327: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -195,7 +195,7 @@ __dpct_inline__ void gdn_out_norm_kernel(const float *__restrict__ o,
for (int i = item_ct1.get_local_id(2); i < S;
i += item_ct1.get_local_range(2)) acc += (double)po[i] * (double)po[i];
/*
-DPCT1108:36: '__shfl_down_sync' was migrated with the experimental feature
+DPCT1108: '__shfl_down_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
diff --git a/sycl/src/kernels/cuda/gr.dp.cpp b/sycl/src/kernels/cuda/gr.dp.cpp
index 4091f3f9..fd8f809b 100644
--- a/sycl/src/kernels/cuda/gr.dp.cpp
+++ b/sycl/src/kernels/cuda/gr.dp.cpp
@@ -76,12 +76,12 @@ __dpct_inline__ float sigmoid_f(float x) {
__dpct_inline__ double warp_sum(double v) {
/*
-DPCT1108:37: '__shfl_down_sync' was migrated with the experimental feature
+DPCT1108: '__shfl_down_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
/*
-DPCT1121:38: Make sure that the "v" which is used in the SYCL group
+DPCT1121: Make sure that the "v" which is used in the SYCL group
function/algorithm is initialized.
*/
#pragma unroll
@@ -90,12 +90,12 @@ function/algorithm is initialized.
0xFFFFFFFFu, sycl::ext::oneapi::this_work_item::get_sub_group(), v,
off);
/*
- DPCT1108:39: '__shfl_sync' was migrated with the experimental feature masked
+ DPCT1108: '__shfl_sync' was migrated with the experimental feature masked
sub_group function which may not be supported by all compilers or runtimes.
You may need to adjust the code.
*/
/*
- DPCT1121:40: Make sure that the "v" which is used in the SYCL group
+ DPCT1121: Make sure that the "v" which is used in the SYCL group
function/algorithm is initialized.
*/
return dpct::experimental::select_from_sub_group(
@@ -104,12 +104,12 @@ function/algorithm is initialized.
__dpct_inline__ float warp_sumf(float v) {
/*
-DPCT1108:41: '__shfl_down_sync' was migrated with the experimental feature
+DPCT1108: '__shfl_down_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
/*
-DPCT1121:42: Make sure that the "v" which is used in the SYCL group
+DPCT1121: Make sure that the "v" which is used in the SYCL group
function/algorithm is initialized.
*/
#pragma unroll
@@ -118,12 +118,12 @@ function/algorithm is initialized.
0xFFFFFFFFu, sycl::ext::oneapi::this_work_item::get_sub_group(), v,
off);
/*
- DPCT1108:43: '__shfl_sync' was migrated with the experimental feature masked
+ DPCT1108: '__shfl_sync' was migrated with the experimental feature masked
sub_group function which may not be supported by all compilers or runtimes.
You may need to adjust the code.
*/
/*
- DPCT1121:44: Make sure that the "v" which is used in the SYCL group
+ DPCT1121: Make sure that the "v" which is used in the SYCL group
function/algorithm is initialized.
*/
return dpct::experimental::select_from_sub_group(
@@ -143,7 +143,7 @@ inline float block_sumf(float v, double *scratch_raw) {
// of `scratch[0]` by every thread and a later call reuses the array, so without it a fast thread can
// overwrite `scratch[0]` before a slow one has read the previous result.
/*
- DPCT1065:355: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -153,7 +153,7 @@ inline float block_sumf(float v, double *scratch_raw) {
v = warp_sumf(v);
if (lane == 0) scratch[warp] = v;
/*
- DPCT1065:356: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -164,7 +164,7 @@ inline float block_sumf(float v, double *scratch_raw) {
if (warp == 0) v = warp_sumf(v);
if (item_ct1.get_local_id(2) == 0) scratch[0] = v;
/*
- DPCT1065:357: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -183,7 +183,7 @@ inline float block_sumf(float v, double *scratch_raw) {
/// `scratch[0]` before a slow one has read the previous result - a race that is invisible in most runs.
double block_sum(double v, double* scratch) {
/*
- DPCT1065:358: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -194,7 +194,7 @@ double block_sum(double v, double* scratch) {
v = warp_sum(v);
if (lane == 0) scratch[warp] = v;
/*
- DPCT1065:359: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -205,7 +205,7 @@ double block_sum(double v, double* scratch) {
if (warp == 0) v = warp_sum(v);
if (item_ct1.get_local_id(2) == 0) scratch[0] = v;
/*
- DPCT1065:360: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -624,7 +624,7 @@ void gr_read(const float *R, const float *w_norm, const uint16_t *w_down,
bf16_gemv_fp32_mmvf(ws.xn, w_inject, inject, hc_dim, hc, stream);
else if (use_fp32)
/*
- DPCT1049:45: The work-group size passed to the SYCL kernel may
+ DPCT1049: The work-group size passed to the SYCL kernel may
exceed the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if
needed.
@@ -645,7 +645,7 @@ void gr_read(const float *R, const float *w_norm, const uint16_t *w_down,
});
} else
/*
- DPCT1049:46: The work-group size passed to the SYCL kernel may
+ DPCT1049: The work-group size passed to the SYCL kernel may
exceed the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if
needed.
@@ -668,7 +668,7 @@ void gr_read(const float *R, const float *w_norm, const uint16_t *w_down,
}
/*
- DPCT1010:361: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
@@ -699,7 +699,7 @@ void gr_write(const float *R, const float *block_out, const float *inject,
strata::q_of(stream)
->submit([&](sycl::handler &cgh) {
/*
- DPCT1083:1165: The size of local memory in the migrated code may
+ DPCT1083: The size of local memory in the migrated code may
be different from the original code. Check that the allocated
memory size in the migrated code is correct.
*/
diff --git a/sycl/src/kernels/cuda/iq_kernels.dp.cpp b/sycl/src/kernels/cuda/iq_kernels.dp.cpp
index 2c7eab32..5a30fe7b 100644
--- a/sycl/src/kernels/cuda/iq_kernels.dp.cpp
+++ b/sycl/src/kernels/cuda/iq_kernels.dp.cpp
@@ -23,13 +23,13 @@ namespace {
void check(const char* what) {
/*
- DPCT1010:928: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const dpct::err0 e = 0;
/*
- DPCT1009:929: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
@@ -393,7 +393,7 @@ template<> struct Fmt<42> { static constexpr int qk = 64, ipb = 2, step = 1;
__dpct_inline__ float warp_sum(float v) {
#pragma unroll
/*
- DPCT1108:230: '__shfl_xor_sync' was migrated with the experimental feature
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
@@ -439,7 +439,7 @@ __dpct_inline__ float row_dot(const uint8_t *row, const block_q8_1 *x, int nb,
for (int k = lane; k < nb * F::ipb; k += 32) {
const int kbx = k / F::ipb, iqs = F::step * (k % F::ipb);
/*
- DPCT1084:298: The function call "Fmt::dot" has multiple migration
+ DPCT1084: The function call "Fmt::dot" has multiple migration
results in different template instantiations that could not be unified.
You may need to adjust the code.
*/
@@ -768,7 +768,7 @@ __dpct_inline__ void quantize_q8_1_kernel(const float *__restrict__ x,
#pragma unroll
for (int o = 16; o > 0; o >>= 1) {
/*
- DPCT1108:231: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -778,7 +778,7 @@ __dpct_inline__ void quantize_q8_1_kernel(const float *__restrict__ x,
0xffffffffu, sycl::ext::oneapi::this_work_item::get_sub_group(),
amax, o));
/*
- DPCT1108:232: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -1052,7 +1052,7 @@ void iq_mmvq(int t, const void* w, const void* x_q8_1, float* y, int n_in, int n
const auto* X = (const block_q8_1*) x_q8_1;
switch (t) {
/*
- DPCT1049:233: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -1073,7 +1073,7 @@ void iq_mmvq(int t, const void* w, const void* x_q8_1, float* y, int n_in, int n
});
} break;
/*
- DPCT1049:234: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -1094,7 +1094,7 @@ void iq_mmvq(int t, const void* w, const void* x_q8_1, float* y, int n_in, int n
});
} break;
/*
- DPCT1049:235: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -1115,7 +1115,7 @@ void iq_mmvq(int t, const void* w, const void* x_q8_1, float* y, int n_in, int n
});
} break;
/*
- DPCT1049:236: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -1136,7 +1136,7 @@ void iq_mmvq(int t, const void* w, const void* x_q8_1, float* y, int n_in, int n
});
} break;
/*
- DPCT1049:237: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -1157,7 +1157,7 @@ void iq_mmvq(int t, const void* w, const void* x_q8_1, float* y, int n_in, int n
});
} break;
/*
- DPCT1049:238: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -1178,7 +1178,7 @@ void iq_mmvq(int t, const void* w, const void* x_q8_1, float* y, int n_in, int n
});
} break;
/*
- DPCT1049:239: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -1199,7 +1199,7 @@ void iq_mmvq(int t, const void* w, const void* x_q8_1, float* y, int n_in, int n
});
} break;
/*
- DPCT1049:240: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -1220,7 +1220,7 @@ void iq_mmvq(int t, const void* w, const void* x_q8_1, float* y, int n_in, int n
});
} break;
/*
- DPCT1049:241: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
diff --git a/sycl/src/kernels/cuda/kv_q4.dp.cpp b/sycl/src/kernels/cuda/kv_q4.dp.cpp
index 8834a75f..630fe2e9 100644
--- a/sycl/src/kernels/cuda/kv_q4.dp.cpp
+++ b/sycl/src/kernels/cuda/kv_q4.dp.cpp
@@ -16,7 +16,7 @@ namespace {
void check(const char* what) {
/*
- DPCT1010:430: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
@@ -54,7 +54,7 @@ __dpct_inline__ void fwht256_kernel(const float *__restrict__ src,
for (int j = 0; j < el_w; ++j) {
const float val = reg[j];
/*
- DPCT1108:77: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -92,7 +92,7 @@ __dpct_inline__ uint16_t q4_group(float x, int lane, uint8_t &byte) {
#pragma unroll
for (int o = 16; o > 0; o >>= 1) {
/*
- DPCT1108:78: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -100,7 +100,7 @@ __dpct_inline__ uint16_t q4_group(float x, int lane, uint8_t &byte) {
0xffffffffu, sycl::ext::oneapi::this_work_item::get_sub_group(),
amax, o);
/*
- DPCT1108:79: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -115,7 +115,7 @@ __dpct_inline__ uint16_t q4_group(float x, int lane, uint8_t &byte) {
.convert()[0];
const uint8_t qc = (uint8_t) (q < 0 ? 0 : (q > 15 ? 15 : q));
/*
- DPCT1108:80: '__shfl_down_sync' was migrated with the experimental feature
+ DPCT1108: '__shfl_down_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
@@ -142,7 +142,7 @@ __dpct_inline__ void kv_append_q4_kernel(
const float *__restrict__ kcur, const float *__restrict__ vcur,
int kv_heads, int head_dim, int page_size, KvHostPools host) {
/*
- DPCT1098:432: The '*' expression is used instead of the __ldg call. These
+ DPCT1098: The '*' expression is used instead of the __ldg call. These
two expressions do not provide the exact same functionality. Check the
generated code for potential precision and/or performance issues.
*/
@@ -191,7 +191,7 @@ __dpct_inline__ void kv_gather_q4_kernel(
const int32_t *__restrict__ step, int kv_heads, int head_dim, int page_size,
uint16_t *__restrict__ k_scratch, uint16_t *__restrict__ v_scratch) {
/*
- DPCT1098:433: The '*' expression is used instead of the __ldg call. These
+ DPCT1098: The '*' expression is used instead of the __ldg call. These
two expressions do not provide the exact same functionality. Check the
generated code for potential precision and/or performance issues.
*/
diff --git a/sycl/src/kernels/cuda/kv_q8.dp.cpp b/sycl/src/kernels/cuda/kv_q8.dp.cpp
index 952d40ad..215ea943 100644
--- a/sycl/src/kernels/cuda/kv_q8.dp.cpp
+++ b/sycl/src/kernels/cuda/kv_q8.dp.cpp
@@ -14,7 +14,7 @@ namespace {
void check(const char* what) {
/*
- DPCT1010:1135: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
@@ -37,7 +37,7 @@ __dpct_inline__ void kv_append_q8_kernel(
const float *__restrict__ kcur, const float *__restrict__ vcur,
int kv_heads, int head_dim, int page_size, KvHostPools host) {
/*
- DPCT1098:1138: The '*' expression is used instead of the __ldg call. These
+ DPCT1098: The '*' expression is used instead of the __ldg call. These
two expressions do not provide the exact same functionality. Check the
generated code for potential precision and/or performance issues.
*/
@@ -51,7 +51,7 @@ __dpct_inline__ void kv_append_q8_kernel(
// max |x| over the 64 values: two warps, then combine through shared memory in a fixed order
float a = sycl::fabs(x);
/*
-DPCT1108:289: '__shfl_xor_sync' was migrated with the experimental feature
+DPCT1108: '__shfl_xor_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
@@ -65,7 +65,7 @@ runtimes. You may need to adjust the code.
sycl::ext::oneapi::this_work_item::get_work_group<3>());
if ((t & 31) == 0) warp_max[t >> 5] = a;
/*
- DPCT1065:1137: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -101,7 +101,7 @@ __dpct_inline__ void kv_gather_q8_kernel(
const int32_t *__restrict__ step, int kv_heads, int head_dim, int page_size,
uint16_t *__restrict__ k_scratch, uint16_t *__restrict__ v_scratch) {
/*
- DPCT1098:1139: The '*' expression is used instead of the __ldg call. These
+ DPCT1098: The '*' expression is used instead of the __ldg call. These
two expressions do not provide the exact same functionality. Check the
generated code for potential precision and/or performance issues.
*/
diff --git a/sycl/src/kernels/cuda/kv_stream.dp.cpp b/sycl/src/kernels/cuda/kv_stream.dp.cpp
index fe1769d1..d8118d42 100644
--- a/sycl/src/kernels/cuda/kv_stream.dp.cpp
+++ b/sycl/src/kernels/cuda/kv_stream.dp.cpp
@@ -17,7 +17,7 @@ namespace {
void check(const char* what) {
/*
- DPCT1010:314: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
@@ -66,7 +66,7 @@ inline int block_scan(int v, int *warp_sums, int &total) {
int x = v;
for (int o = 1; o < 32; o <<= 1) {
/*
- DPCT1108:29: '__shfl_up_sync' was migrated with the experimental feature
+ DPCT1108: '__shfl_up_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
@@ -77,7 +77,7 @@ inline int block_scan(int v, int *warp_sums, int &total) {
}
if (lane == 31) warp_sums[w] = x;
/*
- DPCT1065:316: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -86,7 +86,7 @@ inline int block_scan(int v, int *warp_sums, int &total) {
int t = warp_sums[lane];
for (int o = 1; o < 32; o <<= 1) {
/*
- DPCT1108:30: '__shfl_up_sync' was migrated with the experimental
+ DPCT1108: '__shfl_up_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -98,7 +98,7 @@ inline int block_scan(int v, int *warp_sums, int &total) {
warp_sums[lane] = t;
}
/*
- DPCT1065:317: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -106,7 +106,7 @@ inline int block_scan(int v, int *warp_sums, int &total) {
total = warp_sums[31];
const int excl = x - v + (w > 0 ? warp_sums[w - 1] : 0);
/*
- DPCT1065:318: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -131,7 +131,7 @@ auto &s_nmiss = *sycl::ext::oneapi::group_local_memory_for_overwrite(
const int epoch = m.ctl[0] + 1;
if (item_ct1.get_local_id(2) == 0) { s_nmiss = 0; s_lookups = 0; }
/*
- DPCT1065:319: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -162,7 +162,7 @@ auto &s_nmiss = *sycl::ext::oneapi::group_local_memory_for_overwrite(
dpct::atomic_fetch_add(
&s_lookups, lookups);
/*
- DPCT1065:320: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -180,11 +180,11 @@ auto &s_nmiss = *sycl::ext::oneapi::group_local_memory_for_overwrite(
const int want = need - got;
if (item_ct1.get_local_id(2) == 0) s_cut = RT;
/*
- DPCT1118:31: SYCL group functions and algorithms must be encountered in
+ DPCT1118: SYCL group functions and algorithms must be encountered in
converged control flow. You may need to adjust the code.
*/
/*
- DPCT1065:321: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for
better performance if there is no access to global memory.
*/
@@ -193,11 +193,11 @@ auto &s_nmiss = *sycl::ext::oneapi::group_local_memory_for_overwrite(
item_ct1.get_local_id(2) +
1; // the hand stops just past the last slot taken
/*
- DPCT1118:32: SYCL group functions and algorithms must be encountered in
+ DPCT1118: SYCL group functions and algorithms must be encountered in
converged control flow. You may need to adjust the code.
*/
/*
- DPCT1065:322: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for
better performance if there is no access to global memory.
*/
@@ -212,11 +212,11 @@ auto &s_nmiss = *sycl::ext::oneapi::group_local_memory_for_overwrite(
got += total < want ? total : want;
hand = (int) (((long long) hand + cut) % n);
/*
- DPCT1118:33: SYCL group functions and algorithms must be encountered in
+ DPCT1118: SYCL group functions and algorithms must be encountered in
converged control flow. You may need to adjust the code.
*/
/*
- DPCT1065:323: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for
better performance if there is no access to global memory.
*/
@@ -331,7 +331,7 @@ void kv_stream_resolve(const KvStreamMap& m, const QsaAttnPools& slots, const Kv
std::exit(1);
}
/*
- DPCT1049:34: The work-group size passed to the SYCL kernel may exceed the
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed the
limit. To get the device limit, query info::device::max_work_group_size.
Adjust the work-group size if needed.
*/
@@ -396,7 +396,7 @@ void kv_ring_restore(const QsaAttnPools &slots, const KvHostPools &host,
const int64_t sl = b % n_slots, run = std::min(b1 - b, n_slots - sl); // up to the ring's end
for (int a = 0; a < r.n; ++a)
/*
- DPCT1124:324: cudaMemcpyAsync is migrated to asynchronous memcpy
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy
API. While the origin API might be synchronous, it depends on the
type of operand memory, so you may need to call wait() on event
return by memcpy API to ensure synchronization behavior.
@@ -421,7 +421,7 @@ void kv_stage_from_host(const QsaAttnPools &stage, const KvHostPools &host,
const Runs r = runs_of(stage, host, fmt, s);
for (int a = 0; a < r.n; ++a)
/*
- DPCT1124:325: cudaMemcpyAsync is migrated to asynchronous memcpy API.
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API.
While the origin API might be synchronous, it depends on the type of
operand memory, so you may need to call wait() on event return by memcpy
API to ensure synchronization behavior.
diff --git a/sycl/src/kernels/cuda/native_bf16.dp.cpp b/sycl/src/kernels/cuda/native_bf16.dp.cpp
index 6745f079..61f05901 100644
--- a/sycl/src/kernels/cuda/native_bf16.dp.cpp
+++ b/sycl/src/kernels/cuda/native_bf16.dp.cpp
@@ -41,7 +41,7 @@ __dpct_inline__ float mmvf_warp_sum(float value) {
#pragma unroll
for (int offset = 16; offset > 0; offset >>= 1)
/*
- DPCT1108:288: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -73,14 +73,14 @@ __dpct_inline__ void bf16_f32_mmvf_kernel(const float *__restrict__ x,
const sycl::float2 input = inputs2[pair];
// Match the two ordered multiply-adds in ggml_cuda_mad, not a pair sum followed by one add.
/*
- DPCT1013:1094: The rounding mode could not be specified and the
+ DPCT1013: The rounding mode could not be specified and the
generated code may have different accuracy than the original code.
Verify the correctness. SYCL math built-in function rounding mode is
aligned with OpenCL C 1.2 standard.
*/
acc = sycl::fma(f32_from_bf16((uint16_t)weight), input.x(), acc);
/*
- DPCT1013:1095: The rounding mode could not be specified and the
+ DPCT1013: The rounding mode could not be specified and the
generated code may have different accuracy than the original code.
Verify the correctness. SYCL math built-in function rounding mode is
aligned with OpenCL C 1.2 standard.
@@ -131,14 +131,14 @@ __dpct_inline__ void bf16_f32_mmvf_multi_kernel(
reinterpret_cast(x + (size_t)k *
ldx)[pair];
/*
- DPCT1013:1096: The rounding mode could not be specified and the
+ DPCT1013: The rounding mode could not be specified and the
generated code may have different accuracy than the original
code. Verify the correctness. SYCL math built-in function
rounding mode is aligned with OpenCL C 1.2 standard.
*/
acc[k] = sycl::fma(w0, input.x(), acc[k]);
/*
- DPCT1013:1097: The rounding mode could not be specified and the
+ DPCT1013: The rounding mode could not be specified and the
generated code may have different accuracy than the original
code. Verify the correctness. SYCL math built-in function
rounding mode is aligned with OpenCL C 1.2 standard.
@@ -249,23 +249,23 @@ void bf16_gemv_fp32_mmvf_multi(const float* x, int64_t ldx, const uint16_t* w, f
}
#undef STRATA_MMVF_M
/*
- DPCT1010:1100: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const dpct::err0 result = 0;
/*
- DPCT1000:1099: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (result != 0)
/*
- DPCT1009:1101: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:1098: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
throw std::runtime_error(
std::string("bf16_gemv_fp32_mmvf_multi launch: ") +
@@ -319,23 +319,23 @@ void bf16_gemv_fp32_mmvf(const float* x, const uint16_t* w, float* y,
}
#undef STRATA_MMVF_CASE
/*
- DPCT1010:1104: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const dpct::err0 result = 0;
/*
- DPCT1000:1103: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (result != 0)
/*
- DPCT1009:1105: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:1102: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
throw std::runtime_error(std::string("bf16_gemv_fp32_mmvf launch: ") +
dpct::get_error_string_dummy(result));
diff --git a/sycl/src/kernels/cuda/native_flash_attn.dp.cpp b/sycl/src/kernels/cuda/native_flash_attn.dp.cpp
index 55c204a1..4b2d2951 100644
--- a/sycl/src/kernels/cuda/native_flash_attn.dp.cpp
+++ b/sycl/src/kernels/cuda/native_flash_attn.dp.cpp
@@ -37,7 +37,7 @@ template __dpct_inline__ float warp_sum(float x) {
#pragma unroll
for (int offset = Width / 2; offset; offset >>= 1)
/*
- DPCT1108:81: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -50,7 +50,7 @@ __dpct_inline__ float warp_max(float x) {
#pragma unroll
for (int offset = 16; offset; offset >>= 1)
/*
- DPCT1108:82: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -66,7 +66,7 @@ __dpct_inline__ float warp_max(float x) {
// four values (float2) per load, four V columns per iteration. Padded length256
// gives ntiles_KV=ceil(256/D)=1, so the pinned launcher selects grid.y=1.
/*
-DPCT1110:83: The total declared local variable size in device function attend
+DPCT1110: The total declared local variable size in device function attend
exceeds 128 bytes and may cause high register pressure. Consult with your
hardware vendor to find the total register size available and adjust the code,
or use smaller sub-group size to avoid high register pressure.
@@ -156,7 +156,7 @@ attend(const float *__restrict__ q, const sycl::half *__restrict__ k,
#pragma unroll
for (int offset = 8; offset < 32; offset <<= 1)
/*
- DPCT1108:84: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -202,7 +202,7 @@ attend(const float *__restrict__ q, const sycl::half *__restrict__ k,
// that order despite this adapter's masked-load branches.
if (k0 == 0) {
/*
- DPCT1013:437: The rounding mode could not be specified
+ DPCT1013: The rounding mode could not be specified
and the generated code may have different accuracy than
the original code. Verify the correctness. SYCL math
built-in function rounding mode is aligned with OpenCL
@@ -211,7 +211,7 @@ attend(const float *__restrict__ q, const sycl::half *__restrict__ k,
vkq[i0 / 8 + j].x() =
sycl::fma(rescale, vkq[i0 / 8 + j].x(), a * weight);
/*
- DPCT1013:438: The rounding mode could not be specified
+ DPCT1013: The rounding mode could not be specified
and the generated code may have different accuracy than
the original code. Verify the correctness. SYCL math
built-in function rounding mode is aligned with OpenCL
@@ -221,7 +221,7 @@ attend(const float *__restrict__ q, const sycl::half *__restrict__ k,
sycl::fma(rescale, vkq[i0 / 8 + j].y(), b * weight);
} else {
/*
- DPCT1013:439: The rounding mode could not be specified
+ DPCT1013: The rounding mode could not be specified
and the generated code may have different accuracy than
the original code. Verify the correctness. SYCL math
built-in function rounding mode is aligned with OpenCL
@@ -230,7 +230,7 @@ attend(const float *__restrict__ q, const sycl::half *__restrict__ k,
vkq[i0 / 8 + j].x() =
sycl::fma(a, weight, vkq[i0 / 8 + j].x());
/*
- DPCT1013:440: The rounding mode could not be specified
+ DPCT1013: The rounding mode could not be specified
and the generated code may have different accuracy than
the original code. Verify the correctness. SYCL math
built-in function rounding mode is aligned with OpenCL
@@ -245,14 +245,14 @@ attend(const float *__restrict__ q, const sycl::half *__restrict__ k,
}
if (warp == 0) { max_shared[lane] = -FLT_MAX / 2.0f; sum_shared[lane] = 0.0f; }
/*
- DPCT1065:434: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
item_ct1.barrier();
if (lane == 0) max_shared[warp] = maximum;
/*
- DPCT1065:435: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -262,14 +262,14 @@ attend(const float *__restrict__ q, const sycl::half *__restrict__ k,
#pragma unroll
for (int i = 0; i < 16; ++i) {
/*
- DPCT1013:441: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
*/
vkq[i].x() = vkq[i].x() * rescale;
/*
- DPCT1013:442: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -289,7 +289,7 @@ attend(const float *__restrict__ q, const sycl::half *__restrict__ k,
sum = warp_sum<32>(sum);
if (lane == 0) sum_shared[warp] = sum;
/*
- DPCT1065:436: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -358,23 +358,23 @@ void native_flash_attn_short_step(const float* q, const uint16_t* k, const uint1
});
}
/*
- DPCT1010:445: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const auto result = 0;
/*
- DPCT1000:444: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (result != 0)
/*
- DPCT1009:446: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:443: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
throw std::runtime_error(std::string("native FlashAttention launch: ") +
dpct::get_error_string_dummy(result));
diff --git a/sycl/src/kernels/cuda/native_gdn.dp.cpp b/sycl/src/kernels/cuda/native_gdn.dp.cpp
index c4309722..4faf25a3 100644
--- a/sycl/src/kernels/cuda/native_gdn.dp.cpp
+++ b/sycl/src/kernels/cuda/native_gdn.dp.cpp
@@ -43,7 +43,7 @@ __dpct_inline__ float warp_sum(float value) {
#pragma unroll
for (int offset = 16; offset > 0; offset >>= 1)
/*
- DPCT1108:157: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -144,21 +144,21 @@ void native_gdn_step(float* state, const float* q, const float* k, const float*
});
}
/*
- DPCT1010:804: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const auto error = 0;
/*
- DPCT1009:805: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
/*
- DPCT1001:802: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:803: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (error !=
diff --git a/sycl/src/kernels/cuda/native_gdn_preprocess.dp.cpp b/sycl/src/kernels/cuda/native_gdn_preprocess.dp.cpp
index f0bd4ed3..d9f3b1f9 100644
--- a/sycl/src/kernels/cuda/native_gdn_preprocess.dp.cpp
+++ b/sycl/src/kernels/cuda/native_gdn_preprocess.dp.cpp
@@ -41,7 +41,7 @@ __dpct_inline__ float warp_sum(float value) {
#pragma unroll
for (int offset = 16; offset > 0; offset >>= 1)
/*
- DPCT1108:100: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -56,7 +56,7 @@ __dpct_inline__ float norm_sum(float value, float *sums) {
value = warp_sum(value);
if (lane == 0) sums[item_ct1.get_local_id(2) / 32] = value;
/*
- DPCT1065:516: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -83,7 +83,7 @@ __dpct_inline__ void conv_silu(float *__restrict__ history,
for (int tap = 0; tap < 4; ++tap) sum += values[tap] * weights[c * 4 + tap];
// The native SSM kernel adds its zero bias even when there is no bias input.
/*
- DPCT1013:517: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -110,14 +110,14 @@ __dpct_inline__ void l2_norm(float *input, float epsilon, float scale_after) {
if (col < S) {
// Preserve the FP32 store boundary between RMSNorm and ggml_scale.
/*
- DPCT1013:518: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
*/
const float normalized = scale * value;
/*
- DPCT1013:519: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -141,7 +141,7 @@ __dpct_inline__ void gate_softplus(const float *__restrict__ alpha,
item_ct1.get_local_id(2);
if (i >= count) return;
/*
- DPCT1013:520: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -170,7 +170,7 @@ __dpct_inline__ void out_norm(const float *__restrict__ input,
if (col < S) {
// RMSNorm+gamma is one pinned fused operator, followed by sigmoid*mul.
/*
- DPCT1013:521: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -202,21 +202,21 @@ void norm_geometry(int64_t rows, int64_t cols, float epsilon, void* stream) {
}
void check_launch() {
/*
- DPCT1010:524: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const auto error = 0;
/*
- DPCT1009:525: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
/*
- DPCT1001:522: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:523: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (error !=
diff --git a/sycl/src/kernels/cuda/native_gr_norm.dp.cpp b/sycl/src/kernels/cuda/native_gr_norm.dp.cpp
index 6bc15c6e..63258c37 100644
--- a/sycl/src/kernels/cuda/native_gr_norm.dp.cpp
+++ b/sycl/src/kernels/cuda/native_gr_norm.dp.cpp
@@ -41,7 +41,7 @@ __dpct_inline__ float norm_warp_sum(float value) {
#pragma unroll
for (int offset = 16; offset > 0; offset >>= 1) {
/*
- DPCT1108:290: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -121,7 +121,7 @@ void native_gr_rms_norm_weighted(const float* input, const float* gamma, float*
});
} else
/*
- DPCT1049:291: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -140,23 +140,23 @@ void native_gr_rms_norm_weighted(const float* input, const float* gamma, float*
});
}
/*
- DPCT1010:1149: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const auto error = 0;
/*
- DPCT1000:1148: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (error != 0)
/*
- DPCT1009:1150: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:1147: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
throw std::runtime_error(std::string("native GR RMSNorm launch: ") +
dpct::get_error_string_dummy(error));
diff --git a/sycl/src/kernels/cuda/native_gr_postops.dp.cpp b/sycl/src/kernels/cuda/native_gr_postops.dp.cpp
index a758831f..436af20f 100644
--- a/sycl/src/kernels/cuda/native_gr_postops.dp.cpp
+++ b/sycl/src/kernels/cuda/native_gr_postops.dp.cpp
@@ -44,7 +44,7 @@ __dpct_inline__ float sigmoid(float x) {
// explicitly so compile-time zero does not change signed-zero behavior.
__dpct_inline__ float scale_zero_bias(float x, float scale) {
/*
- DPCT1013:908: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -74,7 +74,7 @@ pre_gated(const float *__restrict__ xn, float *__restrict__ gate,
const std::size_t i = std::size_t(c) * n_embd + d;
const float x = xn[i], w = sigmoid(gate[i]);
/*
- DPCT1013:909: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -82,14 +82,14 @@ pre_gated(const float *__restrict__ xn, float *__restrict__ gate,
const float product = x * w;
gate[i] = product;
/*
- DPCT1013:910: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
*/
if constexpr (Fused) sum = sycl::fma(x, w, sum);
/*
- DPCT1013:911: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -112,7 +112,7 @@ __dpct_inline__ void post(const float *residual,
const float weight = scale_zero_bias(sigmoid(scale_zero_bias(inject[c], scale)), 2.0f);
// Exact residual/output alias is supported; no other thread reads residual[i].
/*
- DPCT1013:912: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -130,23 +130,23 @@ void check_shape(int n, int hc) {
unsigned blocks(std::size_t n) { return unsigned((n + THREADS - 1) / THREADS); }
void check_launch() {
/*
- DPCT1010:915: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const auto error = 0;
/*
- DPCT1000:914: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (error != 0)
/*
- DPCT1009:916: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:913: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
throw std::runtime_error(std::string("native GR postops launch: ") +
dpct::get_error_string_dummy(error));
diff --git a/sycl/src/kernels/cuda/native_mmvq.dp.cpp b/sycl/src/kernels/cuda/native_mmvq.dp.cpp
index 61ad826d..3d05318d 100644
--- a/sycl/src/kernels/cuda/native_mmvq.dp.cpp
+++ b/sycl/src/kernels/cuda/native_mmvq.dp.cpp
@@ -131,7 +131,7 @@ __dpct_inline__ float warp_sum(float x) {
#pragma unroll
for (int offset = WARP / 2; offset > 0; offset >>= 1) {
/*
- DPCT1108:203: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -146,7 +146,7 @@ __dpct_inline__ float warp_max(float x) {
#pragma unroll
for (int offset = WARP / 2; offset > 0; offset >>= 1) {
/*
- DPCT1108:204: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -204,7 +204,7 @@ q5_q8_dot_impl(const int *__restrict__ vl, const int *__restrict__ vh,
}
/*
-DPCT1110:205: The total declared local variable size in device function
+DPCT1110: The total declared local variable size in device function
q5_q8_dot exceeds 128 bytes and may cause high register pressure. Consult with
your hardware vendor to find the total register size available and adjust the
code, or use smaller sub-group size to avoid high register pressure.
@@ -286,7 +286,7 @@ __dpct_inline__ void native_q5_k_mmvq_kernel(const Q5KBlock *__restrict__ w,
tmp[i];
}
/*
- DPCT1065:896: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -365,7 +365,7 @@ __dpct_inline__ void native_q2_0_mmvq_kernel(const Q20Block *__restrict__ w,
tmp[i];
}
/*
- DPCT1065:897: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -467,7 +467,7 @@ __dpct_inline__ void native_q3_k_mmvq_kernel(const Q3KBlock *__restrict__ w,
tmp[i];
}
/*
- DPCT1065:898: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -568,7 +568,7 @@ native_iq4_xs_mmvq_kernel(const IQ4XSBlock *__restrict__ w,
tmp[i];
}
/*
- DPCT1065:899: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -681,7 +681,7 @@ __dpct_inline__ void native_q4_k_mmvq_kernel(const Q4KBlock *__restrict__ w,
tmp[i];
}
/*
- DPCT1065:900: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -768,7 +768,7 @@ __dpct_inline__ void native_q6_k_mmvq_kernel(const Q6KBlock *__restrict__ w,
tmp[i];
}
/*
- DPCT1065:901: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -905,7 +905,7 @@ __dpct_inline__ void native_small_mmvq_kernel(const Weight *__restrict__ w,
tmp[i];
}
/*
- DPCT1065:902: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -1183,7 +1183,7 @@ bool g_multi_exact = true; // until the upstream layout is timed on an idle GP
template
/*
-DPCT1110:206: The total declared local variable size in device function
+DPCT1110: The total declared local variable size in device function
native_mmvq_multi_kernel exceeds 128 bytes and may cause high register pressure.
Consult with your hardware vendor to find the total register size available and
adjust the code, or use smaller sub-group size to avoid high register pressure.
@@ -1210,7 +1210,7 @@ native_mmvq_multi_kernel(const typename F::Block *__restrict__ w,
if (row0 + i < n_out) {
const std::size_t block = std::size_t(row0 + i) * blocks_per_row + kbx;
/*
- DPCT1084:299: The function call "Q5KTraits::load" has multiple
+ DPCT1084: The function call "Q5KTraits::load" has multiple
migration results in different template instantiations that
could not be unified. You may need to adjust the code.
*/
@@ -1219,7 +1219,7 @@ native_mmvq_multi_kernel(const typename F::Block *__restrict__ w,
#pragma unroll
for (int j = 0; j < NCOLS; ++j) // then per column
/*
- DPCT1084:300: The function call "Q5KTraits::apply" has
+ DPCT1084: The function call "Q5KTraits::apply" has
multiple migration results in different template
instantiations that could not be unified. You may need to
adjust the code.
@@ -1241,7 +1241,7 @@ native_mmvq_multi_kernel(const typename F::Block *__restrict__ w,
[item_ct1.get_local_id(2)] = tmp[j][i];
}
/*
- DPCT1065:903: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -1424,7 +1424,7 @@ void launch_multi_n(const void *weights, const void *x_q8_1, float *y, int n_in,
constexpr int ROWS = 1; // SYCL port: one row per work-group (more groups: the kernel is latency-bound here)
const unsigned blocks = unsigned((std::size_t(n_out) + ROWS - 1) / ROWS);
/*
- DPCT1049:207: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -1453,7 +1453,7 @@ void launch_multi_n(const void *weights, const void *x_q8_1, float *y, int n_in,
if (n_in / F::DIV < F::BPI) {
const unsigned blocks = unsigned((std::size_t(n_out) + WARPS - 1) / WARPS);
/*
- DPCT1049:208: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -1476,7 +1476,7 @@ void launch_multi_n(const void *weights, const void *x_q8_1, float *y, int n_in,
}
} else {
/*
- DPCT1049:209: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -1529,23 +1529,23 @@ void validate_stream(void* stream) {
}
void launch_check() {
/*
- DPCT1010:906: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const auto error = 0;
/*
- DPCT1000:905: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (error != 0) {
/*
- DPCT1009:907: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:904: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
throw std::runtime_error(std::string("native MMVQ launch: ") +
dpct::get_error_string_dummy(error));
@@ -1573,7 +1573,7 @@ void small_mmvq(const void* weights, const void* x_q8_1, float* y,
if (n_in / 32 < 2 * WARPS * WARP / Qi) {
const unsigned blocks = unsigned((std::size_t(n_out) + WARPS - 1) / WARPS);
/*
- DPCT1049:210: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -1601,7 +1601,7 @@ void small_mmvq(const void* weights, const void* x_q8_1, float* y,
}
} else {
/*
- DPCT1049:211: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -1703,7 +1703,7 @@ void native_q5_k_mmvq(const void* weights, const void* x_q8_1, float* y,
if (n_in / QK < VDR * WARPS * WARP / QI) {
const unsigned blocks = unsigned((std::size_t(n_out) + WARPS - 1) / WARPS);
/*
- DPCT1049:212: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -1724,7 +1724,7 @@ void native_q5_k_mmvq(const void* weights, const void* x_q8_1, float* y,
}
} else {
/*
- DPCT1049:213: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -1778,7 +1778,7 @@ void native_q2_0_mmvq(const void* weights, const void* x_q8_1, float* y,
if (n_in / 64 < WARPS * WARP / 2) {
const unsigned blocks = unsigned((std::size_t(n_out) + WARPS - 1) / WARPS);
/*
- DPCT1049:214: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -1798,7 +1798,7 @@ void native_q2_0_mmvq(const void* weights, const void* x_q8_1, float* y,
}
} else {
/*
- DPCT1049:215: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -1850,7 +1850,7 @@ void native_q3_k_mmvq(const void* weights, const void* x_q8_1, float* y,
if (n_in / 256 < WARPS * WARP / 16) {
const unsigned blocks = unsigned((std::size_t(n_out) + WARPS - 1) / WARPS);
/*
- DPCT1049:216: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -1870,7 +1870,7 @@ void native_q3_k_mmvq(const void* weights, const void* x_q8_1, float* y,
}
} else {
/*
- DPCT1049:217: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -1922,7 +1922,7 @@ void native_iq4_xs_mmvq(const void* weights, const void* x_q8_1, float* y,
if (n_in / 256 < 4 * WARPS * WARP / 32) {
const unsigned blocks = unsigned((std::size_t(n_out) + WARPS - 1) / WARPS);
/*
- DPCT1049:218: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -1950,7 +1950,7 @@ void native_iq4_xs_mmvq(const void* weights, const void* x_q8_1, float* y,
}
} else {
/*
- DPCT1049:219: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -2011,7 +2011,7 @@ void native_q4_k_mmvq(const void* weights, const void* x_q8_1, float* y,
if (n_in / 256 < WARPS * WARP / 16) {
const unsigned blocks = unsigned((std::size_t(n_out) + WARPS - 1) / WARPS);
/*
- DPCT1049:220: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -2032,7 +2032,7 @@ void native_q4_k_mmvq(const void* weights, const void* x_q8_1, float* y,
}
} else {
/*
- DPCT1049:221: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -2105,7 +2105,7 @@ void native_q6_k_mmvq(const void* weights, const void* x_q8_1, float* y,
if (n_in / 256 < WARPS * WARP / 32) {
const unsigned blocks = unsigned((std::size_t(n_out) + WARPS - 1) / WARPS);
/*
- DPCT1049:222: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
@@ -2125,7 +2125,7 @@ void native_q6_k_mmvq(const void* weights, const void* x_q8_1, float* y,
}
} else {
/*
- DPCT1049:223: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
diff --git a/sycl/src/kernels/cuda/native_moe.dp.cpp b/sycl/src/kernels/cuda/native_moe.dp.cpp
index b94b5f85..3212e3ce 100644
--- a/sycl/src/kernels/cuda/native_moe.dp.cpp
+++ b/sycl/src/kernels/cuda/native_moe.dp.cpp
@@ -94,21 +94,21 @@ void native_moe_combine(const float* parts, const float* weights, const float* s
});
}
/*
- DPCT1010:597: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const auto error = 0;
/*
- DPCT1009:598: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
/*
- DPCT1001:595: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:596: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (error !=
@@ -133,21 +133,21 @@ void native_moe_combine_multi(const float* parts, const float* weights, const fl
});
}
/*
- DPCT1010:601: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const auto error = 0;
/*
- DPCT1009:602: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
/*
- DPCT1001:599: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:600: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (error !=
diff --git a/sycl/src/kernels/cuda/native_ple_postops.dp.cpp b/sycl/src/kernels/cuda/native_ple_postops.dp.cpp
index d90b7a45..a55748bd 100644
--- a/sycl/src/kernels/cuda/native_ple_postops.dp.cpp
+++ b/sycl/src/kernels/cuda/native_ple_postops.dp.cpp
@@ -37,7 +37,7 @@ namespace {
constexpr int N = 2560, H = 4, D = N * H, HISTORY = 9;
inline float warp_sum(float x) {
/*
-DPCT1108:50: '__shfl_xor_sync' was migrated with the experimental feature masked
+DPCT1108: '__shfl_xor_sync' was migrated with the experimental feature masked
sub_group function which may not be supported by all compilers or runtimes. You
may need to adjust the code.
*/
@@ -58,7 +58,7 @@ __dpct_inline__ void gate_kernel(const float *key, const float *query,
for (int j = 0; j < 8; ++j) {
const int d = item_ct1.get_local_id(2) + j * 512;
/*
- DPCT1013:372: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -82,7 +82,7 @@ __dpct_inline__ void gate_kernel(const float *key, const float *query,
sum = warp_sum(sum);
if (item_ct1.get_local_id(2) == 0) {
/*
- DPCT1013:373: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -91,7 +91,7 @@ __dpct_inline__ void gate_kernel(const float *key, const float *query,
const float mag = sycl::sqrt(sycl::fmax(sycl::fabs(s), 1e-6f));
const float sign = float((s > 0.0f) - (s < 0.0f));
/*
- DPCT1013:374: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -106,7 +106,7 @@ __dpct_inline__ void broadcast_kernel(const float *value, const float *gate,
const int i = item_ct1.get_group(2) * item_ct1.get_local_range(2) +
item_ct1.get_local_id(2);
/*
- DPCT1013:375: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -130,14 +130,14 @@ conv_residual_kernel(const float *history, const float *normalized,
sycl::bit_cast(weights[c * 4 + k]))
.convert()[0];
/*
- DPCT1013:376: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
*/
const float term = x * w;
/*
- DPCT1013:377: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -148,7 +148,7 @@ conv_residual_kernel(const float *history, const float *normalized,
conv[c] = activation;
// Exact hidden/result alias is safe: each thread owns one element.
/*
- DPCT1013:378: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -160,7 +160,7 @@ conv_residual_kernel(const float *history, const float *normalized,
inline float norm_warp_sum(float value) {
#pragma unroll
/*
- DPCT1108:51: '__shfl_xor_sync' was migrated with the experimental feature
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
@@ -212,7 +212,7 @@ __dpct_inline__ void broadcast_batch_kernel(const float *value,
if (i >= size_t(T) * D) return;
const size_t t = i / D, d = i % D;
/*
- DPCT1013:379: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -241,14 +241,14 @@ __dpct_inline__ void conv_residual_batch_kernel(const float *history,
sycl::bit_cast(weights[c * 4 + k]))
.convert()[0];
/*
- DPCT1013:380: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
*/
const float term = x * wk;
/*
- DPCT1013:381: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -257,7 +257,7 @@ __dpct_inline__ void conv_residual_batch_kernel(const float *history,
}
const float activation = sum / (1.0f + sycl::native::exp(-sum));
/*
- DPCT1013:382: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -293,21 +293,21 @@ void validate(Span span) {
}
void launch_check() {
/*
- DPCT1010:385: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const auto error = 0;
/*
- DPCT1009:386: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
/*
- DPCT1001:383: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:384: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (error !=
@@ -339,7 +339,7 @@ void native_ple_postops(const float* projected_key, const float* hidden,
native_gr_rms_norm_weighted(hidden,w.norm_query,b.query,N,H,NG_RMS_EPS,stream);
auto st = strata::q_of(stream);
/*
- DPCT1049:52: The work-group size passed to the SYCL kernel may exceed the
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed the
limit. To get the device limit, query info::device::max_work_group_size.
Adjust the work-group size if needed.
*/
@@ -399,7 +399,7 @@ void native_ple_postops_batch(float* key, float* hidden, const float* value, flo
const unsigned rows = unsigned(T) * H;
const unsigned blocks = unsigned((size_t(T) * D + 255) / 256);
/*
- DPCT1049:53: The work-group size passed to the SYCL kernel may exceed the
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed the
limit. To get the device limit, query info::device::max_work_group_size.
Adjust the work-group size if needed.
*/
@@ -416,7 +416,7 @@ void native_ple_postops_batch(float* key, float* hidden, const float* value, flo
});
}
/*
- DPCT1049:54: The work-group size passed to the SYCL kernel may exceed the
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed the
limit. To get the device limit, query info::device::max_work_group_size.
Adjust the work-group size if needed.
*/
@@ -433,7 +433,7 @@ void native_ple_postops_batch(float* key, float* hidden, const float* value, flo
});
}
/*
- DPCT1049:55: The work-group size passed to the SYCL kernel may exceed the
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed the
limit. To get the device limit, query info::device::max_work_group_size.
Adjust the work-group size if needed.
*/
@@ -469,7 +469,7 @@ void native_ple_postops_batch(float* key, float* hidden, const float* value, flo
});
}
/*
- DPCT1049:56: The work-group size passed to the SYCL kernel may exceed the
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed the
limit. To get the device limit, query info::device::max_work_group_size.
Adjust the work-group size if needed.
*/
diff --git a/sycl/src/kernels/cuda/native_qsa.dp.cpp b/sycl/src/kernels/cuda/native_qsa.dp.cpp
index f0c4c0f9..22183145 100644
--- a/sycl/src/kernels/cuda/native_qsa.dp.cpp
+++ b/sycl/src/kernels/cuda/native_qsa.dp.cpp
@@ -42,7 +42,7 @@ __dpct_inline__ float warp_sum(float value) {
#pragma unroll
for (int offset = 16; offset; offset >>= 1)
/*
- DPCT1108:174: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -114,23 +114,23 @@ void buffers(const float* input, std::size_t in_bytes, const float* weight, std:
}
void check_launch() {
/*
- DPCT1010:844: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const auto result = 0;
/*
- DPCT1000:843: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (result != 0)
/*
- DPCT1009:845: SYCL reports errors using exceptions and does not use
+ DPCT1009: SYCL reports errors using exceptions and does not use
error codes. Please replace the "get_error_string_dummy(...)" with a
real error-handling function.
*/
/*
- DPCT1001:842: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
throw std::runtime_error(std::string("native QSA launch: ") +
dpct::get_error_string_dummy(result));
@@ -164,7 +164,7 @@ void native_qsa_rms_norm_weighted(const float* input, const float* gamma, float*
});
} else
/*
- DPCT1049:175: The work-group size passed to the SYCL kernel may exceed
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed
the limit. To get the device limit, query
info::device::max_work_group_size. Adjust the work-group size if needed.
*/
diff --git a/sycl/src/kernels/cuda/native_qsa_indexer.dp.cpp b/sycl/src/kernels/cuda/native_qsa_indexer.dp.cpp
index bda43e8b..c216b8d5 100644
--- a/sycl/src/kernels/cuda/native_qsa_indexer.dp.cpp
+++ b/sycl/src/kernels/cuda/native_qsa_indexer.dp.cpp
@@ -39,7 +39,7 @@ inline float warp_sum(float x) {
#pragma unroll
for (int offset = 16; offset; offset >>= 1)
/*
- DPCT1108:133: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -82,14 +82,14 @@ append(const float *__restrict__ raw, const int32_t *__restrict__ pos_dev,
#pragma unroll
for (int j = 1; j < R; ++j)
/*
- DPCT1013:637: The rounding mode could not be specified and the
+ DPCT1013: The rounding mode could not be specified and the
generated code may have different accuracy than the original code.
Verify the correctness. SYCL math built-in function rounding mode is
aligned with OpenCL C 1.2 standard.
*/
sum = sum + pos == 0 || j == R - 1 ? incoming : tail[j * D + d];
/*
- DPCT1013:638: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -102,7 +102,7 @@ append(const float *__restrict__ raw, const int32_t *__restrict__ pos_dev,
const int lane = d % 32;
if (lane == 0) partials[d / 32] = square_sum;
/*
- DPCT1065:635: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -112,7 +112,7 @@ append(const float *__restrict__ raw, const int32_t *__restrict__ pos_dev,
const float scale = sycl::rsqrt(square_sum / D + epsilon);
if (d < D) values[d] = scale * mean * gamma[d];
/*
- DPCT1065:636: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -159,7 +159,7 @@ __dpct_inline__ float norm_scale(float mean, float *partials, int d) {
const int lane = d % 32;
if (lane == 0) partials[d / 32] = square_sum;
/*
- DPCT1065:639: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -192,14 +192,14 @@ __dpct_inline__ void append_first(const float *__restrict__ raw,
float sum = incoming;
#pragma unroll
/*
- DPCT1013:641: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
*/
for (int j = 1; j < R; ++j) sum = sum + incoming;
/*
- DPCT1013:642: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -210,7 +210,7 @@ __dpct_inline__ void append_first(const float *__restrict__ raw,
const float scale = sycl::rsqrt(square_sum / D + epsilon);
if (d < D) values[d] = scale * mean * gamma[d];
/*
- DPCT1113:640: Consider replacing
+ DPCT1113: Consider replacing
sycl::nd_item::barrier(sycl::access::fence_space::local_space) with
sycl::nd_item::barrier() if function "append_first" is called in a
multidimensional kernel.
@@ -253,14 +253,14 @@ append_blocks(const float *__restrict__ raw, int64_t n, int64_t p0,
float sum = key(0);
#pragma unroll
/*
- DPCT1013:643: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
*/
for (int j = 1; j < R; ++j) sum = sum + key(j);
/*
- DPCT1013:644: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -344,21 +344,21 @@ void native_qsa_indexer_append(const float* raw, const int32_t* relative_pos_dev
});
}
/*
- DPCT1010:647: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const auto error = 0;
/*
- DPCT1009:648: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
/*
- DPCT1001:645: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:646: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (error !=
@@ -419,21 +419,21 @@ void native_qsa_indexer_append_batch(const float* raw, int64_t n, int64_t p0, in
});
}
/*
- DPCT1010:651: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const auto error = 0;
/*
- DPCT1009:652: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
/*
- DPCT1001:649: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:650: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (error !=
diff --git a/sycl/src/kernels/cuda/native_qsa_score.dp.cpp b/sycl/src/kernels/cuda/native_qsa_score.dp.cpp
index d544e2e6..fe57d98a 100644
--- a/sycl/src/kernels/cuda/native_qsa_score.dp.cpp
+++ b/sycl/src/kernels/cuda/native_qsa_score.dp.cpp
@@ -35,6 +35,7 @@ constexpr int D=128, HEADS=4, R=4, ROWS=32, WARPS=2, STRIDE=36, COMBINE=68;
struct TileA { uint32_t x[4]; };
struct TileB { uint32_t x[2]; };
struct TileC { float x[4]={0.0f,0.0f,0.0f,0.0f}; };
+#if !defined(__HIPCC__)
#if 0 // SYCL: inline PTX (mma/ldmatrix/cp.async) - the XMX port is pending; see tools/fixups.py
__dpct_inline__ void load_a(TileA &a, const float *p) {
auto item_ct1 = sycl::ext::oneapi::this_work_item::get_nd_item<3>();
@@ -64,7 +65,7 @@ __dpct_inline__ void load_b(TileB &b, const float *p) {
__dpct_inline__ void mma(TileC &c, const TileA &a, const TileB &b) {
// Deliberately no cvt.rn.tf32: pinned mma.cuh passes raw F32 bits directly.
/*
- DPCT1053:75: Migration of device assembly code is not supported.
+ DPCT1053: Migration of device assembly code is not supported.
*/
asm("mma.sync.aligned.m16n8k8.row.col.f32.tf32.tf32.f32 {%0,%1,%2,%3}, "
"{%4,%5,%6,%7}, {%8,%9}, {%0,%1,%2,%3};"
@@ -74,7 +75,7 @@ __dpct_inline__ void mma(TileC &c, const TileA &a, const TileB &b) {
}
#endif
/*
-DPCT1110:76: The total declared local variable size in device function
+DPCT1110: The total declared local variable size in device function
score_kernel exceeds 128 bytes and may cause high register pressure. Consult
with your hardware vendor to find the total register size available and adjust
the code, or use smaller sub-group size to avoid high register pressure.
@@ -143,7 +144,7 @@ __dpct_inline__ void score_kernel(const float *__restrict__ pooled,
}
}
/*
- DPCT1065:405: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -158,7 +159,7 @@ __dpct_inline__ void score_kernel(const float *__restrict__ pooled,
}
}
/*
- DPCT1065:406: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -172,14 +173,14 @@ __dpct_inline__ void score_kernel(const float *__restrict__ pooled,
#pragma unroll
for(int j=0;jmax_cells||step[kStepPos]!=n-1||full!=n/R||
+ step[kStepWidth]!=(n<2051?n:2051))return;
+ const int row=blockIdx.x;
+ if(row>full)return;
+ __shared__ float head_score[HEADS];
+ const int head=threadIdx.x;
+ if(head0.0f?dot:0.0f;
+ }
+ __syncthreads();
+ if(head==0){
+ float sum=(0.0f + head_score[0]);
+ sum=(sum + head_score[1]);
+ sum=(sum + head_score[2]);
+ sum=(sum + head_score[3]);
+ if(bias)sum=(sum + bias[row]);
+ sum=(sum + row==full&&n%R?1e9f:0.0f);
+ sum=(sum + 0.0f);
+ for(int i=row*R;i(s.p);
@@ -245,12 +282,16 @@ void native_qsa_score(const float* pooled,const float* query,const float* bias,
for(int i=0;i(stream)>>>(
+ pooled,query,bias,step,int(max_cells),cells);
+#else
{
auto exp_props = sycl::ext::oneapi::experimental::properties{
sycl::ext::oneapi::experimental::use_root_sync};
((sycl::queue *)(strata::q_of(stream)))
- ->parallel_for>(
+ ->parallel_for>(
sycl::nd_range<3>(
sycl::range(1, 1,
unsigned((max_blocks + ROWS - 1) / ROWS)) *
@@ -263,22 +304,23 @@ void native_qsa_score(const float* pooled,const float* query,const float* bias,
cells);
});
}
+#endif
/*
- DPCT1010:415: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const auto error = 0;
/*
- DPCT1009:416: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
/*
- DPCT1001:413: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:414: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (error !=
diff --git a/sycl/src/kernels/cuda/native_rope.dp.cpp b/sycl/src/kernels/cuda/native_rope.dp.cpp
index 8c809bb3..fa30f027 100644
--- a/sycl/src/kernels/cuda/native_rope.dp.cpp
+++ b/sycl/src/kernels/cuda/native_rope.dp.cpp
@@ -122,21 +122,21 @@ void native_rope_apply(const float* x, float* out, int rows, int head_dim,
});
}
/*
- DPCT1010:390: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const auto error = 0;
/*
- DPCT1009:391: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
/*
- DPCT1001:388: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:389: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (error !=
diff --git a/sycl/src/kernels/cuda/native_router.dp.cpp b/sycl/src/kernels/cuda/native_router.dp.cpp
index fe28562c..d0d36162 100644
--- a/sycl/src/kernels/cuda/native_router.dp.cpp
+++ b/sycl/src/kernels/cuda/native_router.dp.cpp
@@ -37,7 +37,7 @@ std::atomic enabled{false};
__dpct_inline__ float warp_sum(float value) {
#pragma unroll
/*
- DPCT1108:177: '__shfl_xor_sync' was migrated with the experimental feature
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
@@ -50,7 +50,7 @@ __dpct_inline__ float warp_sum(float value) {
__dpct_inline__ float warp_max(float value) {
#pragma unroll
/*
- DPCT1108:178: '__shfl_xor_sync' was migrated with the experimental feature
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
@@ -62,7 +62,7 @@ __dpct_inline__ float warp_max(float value) {
return value;
}
/*
-DPCT1110:179: The total declared local variable size in device function route
+DPCT1110: The total declared local variable size in device function route
exceeds 128 bytes and may cause high register pressure. Consult with your
hardware vendor to find the total register size available and adjust the code,
or use smaller sub-group size to avoid high register pressure.
@@ -110,7 +110,7 @@ __dpct_inline__ void route(const float *__restrict__ logits,
#pragma unroll
for (int mask = 16; mask; mask >>= 1) {
/*
- DPCT1108:180: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -118,7 +118,7 @@ __dpct_inline__ void route(const float *__restrict__ logits,
0xffffffffu, sycl::ext::oneapi::this_work_item::get_sub_group(),
best, mask);
/*
- DPCT1108:181: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -170,21 +170,21 @@ void native_router_top10(const float* logits, int32_t* ids, float* weights, void
});
}
/*
- DPCT1010:858: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const auto error = 0;
/*
- DPCT1009:859: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
/*
- DPCT1001:856: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:857: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (error !=
@@ -210,21 +210,21 @@ void native_router_top10_multi(const float* logits, int32_t* ids, float* weights
});
}
/*
- DPCT1010:862: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
const auto error = 0;
/*
- DPCT1009:863: SYCL reports errors using exceptions and does not use error
+ DPCT1009: SYCL reports errors using exceptions and does not use error
codes. Please replace the "get_error_string_dummy(...)" with a real
error-handling function.
*/
/*
- DPCT1001:860: The statement could not be removed.
+ DPCT1001: The statement could not be removed.
*/
/*
- DPCT1000:861: Error handling if-stmt was detected but could not be
+ DPCT1000: Error handling if-stmt was detected but could not be
rewritten.
*/
if (error !=
diff --git a/sycl/src/kernels/cuda/ple.dp.cpp b/sycl/src/kernels/cuda/ple.dp.cpp
index b8d46677..a6c06b87 100644
--- a/sycl/src/kernels/cuda/ple.dp.cpp
+++ b/sycl/src/kernels/cuda/ple.dp.cpp
@@ -82,7 +82,7 @@ __dpct_inline__ float silu_f(float x) {
/// fires.
inline double block_sum(double v, double *scratch) {
/*
- DPCT1065:1040: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -91,12 +91,12 @@ inline double block_sum(double v, double *scratch) {
const int lane = item_ct1.get_local_id(2) & 31,
warp = item_ct1.get_local_id(2) >> 5;
/*
-DPCT1108:271: '__shfl_down_sync' was migrated with the experimental feature
+DPCT1108: '__shfl_down_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
/*
-DPCT1121:272: Make sure that the "v" which is used in the SYCL group
+DPCT1121: Make sure that the "v" which is used in the SYCL group
function/algorithm is initialized.
*/
#pragma unroll
@@ -106,7 +106,7 @@ function/algorithm is initialized.
off);
if (lane == 0) scratch[warp] = v;
/*
- DPCT1065:1041: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -116,12 +116,12 @@ function/algorithm is initialized.
: 0.0;
if (warp == 0)
/*
-DPCT1108:273: '__shfl_down_sync' was migrated with the experimental feature
+DPCT1108: '__shfl_down_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
/*
-DPCT1121:274: Make sure that the "v" which is used in the SYCL group
+DPCT1121: Make sure that the "v" which is used in the SYCL group
function/algorithm is initialized.
*/
#pragma unroll
@@ -131,7 +131,7 @@ function/algorithm is initialized.
v, off);
if (item_ct1.get_local_id(2) == 0) scratch[0] = v;
/*
- DPCT1065:1042: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -306,7 +306,7 @@ void ple_history_advance(float* hist, const float* normalized, void* stream) {
});
}
/*
- DPCT1010:1044: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
@@ -336,8 +336,9 @@ void ple_block(const float* emb, const float* hidden, const float* hist_rows, co
PleOut& out, void* scratch, void* stream) {
const bool native_key = w.key_native_data != nullptr && w.key_bf16 == nullptr;
if (native_key && (!emb || !hidden || !hist_rows || !out.result || !scratch || !stream ||
- !w.key_native_q8_1 || w.key_native_type != 42))
- throw std::invalid_argument("ple_block: native key requires Q2_0 weights, input/output, private scratch and explicit stream");
+ !w.key_native_q8_1 ||
+ (w.key_native_type != 42 && w.key_native_type != 18 && w.key_native_type != 23)))
+ throw std::invalid_argument("ple_block: native key requires Q2_0, IQ3_XXS or IQ4_XS weights, input/output, private scratch and explicit stream");
if (emb == nullptr || hidden == nullptr || hist_rows == nullptr || out.result == nullptr) return;
const int n_embd = NG_N_EMBD, hc = NG_HC, hc_dim = NG_HC_DIM;
static_assert(NG_N_EMBD == 2560 && NG_HC_DIM == 10240, "native PLE key geometry changed");
@@ -429,7 +430,7 @@ void ple_block(const float* emb, const float* hidden, const float* hist_rows, co
st->submit([&](sycl::handler &cgh) {
auto NG_RMS_EPS_ct4 = NG_RMS_EPS;
- cgh.parallel_for>(
+ cgh.parallel_for>(
sycl::nd_range<3>(sycl::range(1, 1, hc) *
sycl::range(1, 1, THREADS),
sycl::range(1, 1, THREADS)),
@@ -450,7 +451,7 @@ void ple_block(const float* emb, const float* hidden, const float* hist_rows, co
st->submit([&](sycl::handler &cgh) {
auto NG_RMS_EPS_ct4 = NG_RMS_EPS;
- cgh.parallel_for>(
+ cgh.parallel_for>(
sycl::nd_range<3>(sycl::range(1, 1, hc) *
sycl::range(1, 1, THREADS),
sycl::range(1, 1, THREADS)),
@@ -472,7 +473,7 @@ void ple_block(const float* emb, const float* hidden, const float* hist_rows, co
auto exp_props = sycl::ext::oneapi::experimental::properties{
sycl::ext::oneapi::experimental::use_root_sync};
- st->parallel_for>(
+ st->parallel_for>(
sycl::nd_range<3>(
sycl::range(1, 1, (n_embd + THREADS - 1) / THREADS) *
sycl::range(1, 1, THREADS),
@@ -487,7 +488,7 @@ void ple_block(const float* emb, const float* hidden, const float* hist_rows, co
dpct::has_capability_or_fail(st->get_device(),
{sycl::aspect::fp64});
- st->parallel_for>(
+ st->parallel_for>(
sycl::nd_range<3>(
sycl::range(1, 1, (n_embd + THREADS - 1) / THREADS) *
sycl::range(1, 1, THREADS),
@@ -516,7 +517,7 @@ void ple_block(const float* emb, const float* hidden, const float* hist_rows, co
st->submit([&](sycl::handler &cgh) {
auto sqrtf_float_n_embd_ct4 = 1.0f / sqrtf((float)n_embd);
- cgh.parallel_for>(
+ cgh.parallel_for>(
sycl::nd_range<3>(sycl::range(1, 1, hc) *
sycl::range(1, 1, THREADS),
sycl::range(1, 1, THREADS)),
@@ -532,7 +533,7 @@ void ple_block(const float* emb, const float* hidden, const float* hist_rows, co
auto exp_props = sycl::ext::oneapi::experimental::properties{
sycl::ext::oneapi::experimental::use_root_sync};
- st->parallel_for>(
+ st->parallel_for>(
sycl::nd_range<3>(
sycl::range(1, 1, (hc_dim + THREADS - 1) / THREADS) *
sycl::range(1, 1, THREADS),
@@ -550,7 +551,7 @@ void ple_block(const float* emb, const float* hidden, const float* hist_rows, co
st->submit([&](sycl::handler &cgh) {
auto NG_RMS_EPS_ct4 = NG_RMS_EPS;
- cgh.parallel_for>(
+ cgh.parallel_for>(
sycl::nd_range<3>(sycl::range(1, 1, hc) *
sycl::range(1, 1, THREADS),
sycl::range(1, 1, THREADS)),
@@ -571,7 +572,7 @@ void ple_block(const float* emb, const float* hidden, const float* hist_rows, co
auto NGRAM_SIZE_ct6 = NGRAM_SIZE;
auto NG_HIST_ct7 = NG_HIST;
- cgh.parallel_for>(
+ cgh.parallel_for>(
sycl::nd_range<3>(
sycl::range(1, 1, (hc_dim + THREADS - 1) / THREADS) *
sycl::range(1, 1, THREADS),
@@ -587,7 +588,7 @@ void ple_block(const float* emb, const float* hidden, const float* hist_rows, co
auto exp_props = sycl::ext::oneapi::experimental::properties{
sycl::ext::oneapi::experimental::use_root_sync};
- st->parallel_for>(
+ st->parallel_for>(
sycl::nd_range<3>(
sycl::range(1, 1, (hc_dim + THREADS - 1) / THREADS) *
sycl::range(1, 1, THREADS),
@@ -602,7 +603,7 @@ void ple_block(const float* emb, const float* hidden, const float* hist_rows, co
// `cb(key, ...)` capture is after `gnorm`; `value` is the projection before the gate. Each stage the
// oracle records is reproduced here so a mismatch can be attributed instead of guessed at.
/*
- DPCT1124:1045: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
the origin API might be synchronous, it depends on the type of operand
memory, so you may need to call wait() on event return by memcpy API to
ensure synchronization behavior.
@@ -612,7 +613,7 @@ void ple_block(const float* emb, const float* hidden, const float* hist_rows, co
"key");
if (out.value)
/*
- DPCT1124:1046: cudaMemcpyAsync is migrated to asynchronous memcpy API.
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API.
While the origin API might be synchronous, it depends on the type of
operand memory, so you may need to call wait() on event return by memcpy
API to ensure synchronization behavior.
@@ -621,7 +622,7 @@ void ple_block(const float* emb, const float* hidden, const float* hist_rows, co
st->memcpy(out.value, d_value, n_embd * sizeof(float))),
"value");
/*
- DPCT1124:1047: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API. While
the origin API might be synchronous, it depends on the type of operand
memory, so you may need to call wait() on event return by memcpy API to
ensure synchronization behavior.
@@ -631,7 +632,7 @@ void ple_block(const float* emb, const float* hidden, const float* hist_rows, co
"gate");
if (out.gated)
/*
- DPCT1124:1048: cudaMemcpyAsync is migrated to asynchronous memcpy API.
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API.
While the origin API might be synchronous, it depends on the type of
operand memory, so you may need to call wait() on event return by memcpy
API to ensure synchronization behavior.
@@ -641,7 +642,7 @@ void ple_block(const float* emb, const float* hidden, const float* hist_rows, co
"gated");
if (out.normalized)
/*
- DPCT1124:1049: cudaMemcpyAsync is migrated to asynchronous memcpy API.
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API.
While the origin API might be synchronous, it depends on the type of
operand memory, so you may need to call wait() on event return by memcpy
API to ensure synchronization behavior.
@@ -651,7 +652,7 @@ void ple_block(const float* emb, const float* hidden, const float* hist_rows, co
"norm");
if (out.conv)
/*
- DPCT1124:1050: cudaMemcpyAsync is migrated to asynchronous memcpy API.
+ DPCT1124: cudaMemcpyAsync is migrated to asynchronous memcpy API.
While the origin API might be synchronous, it depends on the type of
operand memory, so you may need to call wait() on event return by memcpy
API to ensure synchronization behavior.
@@ -661,7 +662,7 @@ void ple_block(const float* emb, const float* hidden, const float* hist_rows, co
"conv");
/*
- DPCT1010:1051: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
diff --git a/sycl/src/kernels/cuda/qsa.dp.cpp b/sycl/src/kernels/cuda/qsa.dp.cpp
index 767417f3..09ccaff8 100644
--- a/sycl/src/kernels/cuda/qsa.dp.cpp
+++ b/sycl/src/kernels/cuda/qsa.dp.cpp
@@ -69,7 +69,7 @@ void fail(const char* what) {
void check_launch(const char* what) {
/*
- DPCT1010:806: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
@@ -130,7 +130,7 @@ kv_append_kernel(uint16_t *__restrict__ k_pool, uint16_t *__restrict__ v_pool,
const float *__restrict__ kcur, const float *__restrict__ vcur,
int kv_heads, int head_dim, int page_size, KvHostPools host) {
/*
- DPCT1098:809: The '*' expression is used instead of the __ldg call. These
+ DPCT1098: The '*' expression is used instead of the __ldg call. These
two expressions do not provide the exact same functionality. Check the
generated code for potential precision and/or performance issues.
*/
@@ -177,7 +177,7 @@ __dpct_inline__ void indexer_key_append_kernel(
auto s_mean = (double *)dpct_local; // idx_dim doubles
const int d = item_ct1.get_local_id(2);
/*
- DPCT1098:813: The '*' expression is used instead of the __ldg call. These
+ DPCT1098: The '*' expression is used instead of the __ldg call. These
two expressions do not provide the exact same functionality. Check the
generated code for potential precision and/or performance issues.
*/
@@ -204,7 +204,7 @@ __dpct_inline__ void indexer_key_append_kernel(
for (int i = 0; i < idx_dim; ++i) {
const double v = (double) raw[i];
/*
- DPCT1013:814: The rounding mode could not be specified and the
+ DPCT1013: The rounding mode could not be specified and the
generated code may have different accuracy than the original code.
Verify the correctness. SYCL math built-in function rounding mode is
aligned with OpenCL C 1.2 standard.
@@ -212,7 +212,7 @@ __dpct_inline__ void indexer_key_append_kernel(
ss = ss + v * v;
}
/*
- DPCT1013:815: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -226,7 +226,7 @@ __dpct_inline__ void indexer_key_append_kernel(
if (slot != r - 1) return;
/*
- DPCT1065:810: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -238,7 +238,7 @@ __dpct_inline__ void indexer_key_append_kernel(
// but the order of the SUM OF SQUARES below can, and it is fixed to d ascending on both sides.
double m = 0.0;
/*
-DPCT1013:816: The rounding mode could not be specified and the generated code
+DPCT1013: The rounding mode could not be specified and the generated code
may have different accuracy than the original code. Verify the correctness. SYCL
math built-in function rounding mode is aligned with OpenCL C 1.2 standard.
*/
@@ -246,7 +246,7 @@ math built-in function rounding mode is aligned with OpenCL C 1.2 standard.
for (int j = 0; j < r - 1; ++j)
m = m + (double)tail[(size_t)j * idx_dim + d];
/*
- DPCT1013:817: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -255,7 +255,7 @@ math built-in function rounding mode is aligned with OpenCL C 1.2 standard.
m = m / (double) r;
s_mean[d] = m;
/*
- DPCT1065:811: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -263,14 +263,14 @@ math built-in function rounding mode is aligned with OpenCL C 1.2 standard.
double ss = 0.0;
/*
-DPCT1013:818: The rounding mode could not be specified and the generated code
+DPCT1013: The rounding mode could not be specified and the generated code
may have different accuracy than the original code. Verify the correctness. SYCL
math built-in function rounding mode is aligned with OpenCL C 1.2 standard.
*/
#pragma unroll
for (int i = 0; i < idx_dim; ++i) ss = ss + s_mean[i] * s_mean[i];
/*
- DPCT1013:819: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -285,7 +285,7 @@ math built-in function rounding mode is aligned with OpenCL C 1.2 standard.
// block's first cell's POSITION, `pos_base + b*r`, and NOT the cell index `b*r`.
if (d == 0) *block_pos = (int32_t) (pos_base + b * r);
/*
- DPCT1065:812: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -320,14 +320,14 @@ __dpct_inline__ void qsa_index_kernel(const float *__restrict__ pooled,
const int32_t *__restrict__ step,
float *__restrict__ cell_scores) {
/*
- DPCT1098:820: The '*' expression is used instead of the __ldg call. These
+ DPCT1098: The '*' expression is used instead of the __ldg call. These
two expressions do not provide the exact same functionality. Check the
generated code for potential precision and/or performance issues.
*/
auto item_ct1 = sycl::ext::oneapi::this_work_item::get_nd_item<3>();
const long long n_bid = (long long)*(step + kStepNBid);
/*
- DPCT1098:821: The '*' expression is used instead of the __ldg call. These
+ DPCT1098: The '*' expression is used instead of the __ldg call. These
two expressions do not provide the exact same functionality. Check the
generated code for potential precision and/or performance issues.
*/
@@ -351,7 +351,7 @@ __dpct_inline__ void qsa_index_kernel(const float *__restrict__ pooled,
#pragma unroll
for (int d = lane; d < idx_dim; d += 32)
/*
- DPCT1013:822: The rounding mode could not be specified and the generated
+ DPCT1013: The rounding mode could not be specified and the generated
code may have different accuracy than the original code. Verify the
correctness. SYCL math built-in function rounding mode is aligned with
OpenCL C 1.2 standard.
@@ -359,12 +359,12 @@ __dpct_inline__ void qsa_index_kernel(const float *__restrict__ pooled,
acc = acc + (double)pooled[(size_t)b * idx_dim + d] *
(double)q_idx[(size_t)wid * idx_dim + d];
/*
-DPCT1108:158: '__shfl_xor_sync' was migrated with the experimental feature
+DPCT1108: '__shfl_xor_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
/*
-DPCT1013:823: The rounding mode could not be specified and the generated code
+DPCT1013: The rounding mode could not be specified and the generated code
may have different accuracy than the original code. Verify the correctness. SYCL
math built-in function rounding mode is aligned with OpenCL C 1.2 standard.
*/
@@ -412,7 +412,7 @@ __dpct_inline__ uint32_t order_key(float s) {
constexpr int TOPK_THREADS = 256;
/*
-DPCT1110:159: The total declared local variable size in device function
+DPCT1110: The total declared local variable size in device function
topk_kernel exceeds 128 bytes and may cause high register pressure. Consult with
your hardware vendor to find the total register size available and adjust the
code, or use smaller sub-group size to avoid high register pressure.
@@ -421,14 +421,14 @@ __dpct_inline__ void topk_kernel(const float *__restrict__ scores,
const int32_t *__restrict__ step,
int *__restrict__ out_ids) {
/*
- DPCT1098:824: The '*' expression is used instead of the __ldg call. These
+ DPCT1098: The '*' expression is used instead of the __ldg call. These
two expressions do not provide the exact same functionality. Check the
generated code for potential precision and/or performance issues.
*/
auto item_ct1 = sycl::ext::oneapi::this_work_item::get_nd_item<3>();
const long long n_kv = (long long)*(step + kStepNKv);
/*
- DPCT1098:825: The '*' expression is used instead of the __ldg call. These
+ DPCT1098: The '*' expression is used instead of the __ldg call. These
two expressions do not provide the exact same functionality. Check the
generated code for potential precision and/or performance issues.
*/
@@ -459,7 +459,7 @@ __dpct_inline__ void topk_kernel(const float *__restrict__ scores,
++j) if (order_key(scores[j]) >= cand)++ c;
s_a[t] = c;
/*
- DPCT1118:160: SYCL group functions and algorithms must be encountered in
+ DPCT1118: SYCL group functions and algorithms must be encountered in
converged control flow. You may need to adjust the code.
*/
item_ct1.barrier(sycl::access::fence_space::local_space);
@@ -467,7 +467,7 @@ __dpct_inline__ void topk_kernel(const float *__restrict__ scores,
for (int s = TOPK_THREADS / 2; s > 0; s >>= 1) {
if (t < s) s_a[t] += s_a[t + s];
/*
- DPCT1118:162: SYCL group functions and algorithms must be
+ DPCT1118: SYCL group functions and algorithms must be
encountered in converged control flow. You may need to adjust the
code.
*/
@@ -475,7 +475,7 @@ __dpct_inline__ void topk_kernel(const float *__restrict__ scores,
}
const int tot = s_a[0];
/*
- DPCT1118:161: SYCL group functions and algorithms must be encountered in
+ DPCT1118: SYCL group functions and algorithms must be encountered in
converged control flow. You may need to adjust the code.
*/
item_ct1.barrier(
@@ -558,7 +558,7 @@ __dpct_inline__ void kv_gather_kernel(
const int32_t *__restrict__ step, int kv_heads, int head_dim, int page_size,
uint16_t *__restrict__ k_scratch, uint16_t *__restrict__ v_scratch) {
/*
- DPCT1098:826: The '*' expression is used instead of the __ldg call. These
+ DPCT1098: The '*' expression is used instead of the __ldg call. These
two expressions do not provide the exact same functionality. Check the
generated code for potential precision and/or performance issues.
*/
@@ -587,7 +587,7 @@ __dpct_inline__ void kv_gather_kernel(
__dpct_inline__ float warp_max(float v) {
/*
-DPCT1108:163: '__shfl_xor_sync' was migrated with the experimental feature
+DPCT1108: '__shfl_xor_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
@@ -601,7 +601,7 @@ runtimes. You may need to adjust the code.
__dpct_inline__ float warp_sum(float v) {
/*
-DPCT1108:164: '__shfl_xor_sync' was migrated with the experimental feature
+DPCT1108: '__shfl_xor_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
@@ -615,7 +615,7 @@ runtimes. You may need to adjust the code.
/// One block per query head. `s` holds the scores, which are then overwritten with the softmax weights.
/*
-DPCT1110:165: The total declared local variable size in device function
+DPCT1110: The total declared local variable size in device function
qsa_attend_kernel exceeds 128 bytes and may cause high register pressure.
Consult with your hardware vendor to find the total register size available and
adjust the code, or use smaller sub-group size to avoid high register pressure.
@@ -626,7 +626,7 @@ __dpct_inline__ void qsa_attend_kernel(
int n_head, int n_head_kv, int head_dim, float *__restrict__ attn,
float *__restrict__ weights, uint8_t *dpct_local) {
/*
- DPCT1098:834: The '*' expression is used instead of the __ldg call. These
+ DPCT1098: The '*' expression is used instead of the __ldg call. These
two expressions do not provide the exact same functionality. Check the
generated code for potential precision and/or performance issues.
*/
@@ -663,7 +663,7 @@ __dpct_inline__ void qsa_attend_kernel(
w[j] = acc * scale;
}
/*
- DPCT1065:827: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -676,7 +676,7 @@ __dpct_inline__ void qsa_attend_kernel(
mx = warp_max(mx);
if (lane == 0) red[wid] = mx;
/*
- DPCT1065:828: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -687,14 +687,14 @@ __dpct_inline__ void qsa_attend_kernel(
if (lane == 0) red[0] = mx;
}
/*
- DPCT1065:829: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
item_ct1.barrier();
mx = red[0];
/*
- DPCT1065:830: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -709,7 +709,7 @@ __dpct_inline__ void qsa_attend_kernel(
sum = warp_sum(sum);
if (lane == 0) red[wid] = sum;
/*
- DPCT1065:831: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -720,14 +720,14 @@ __dpct_inline__ void qsa_attend_kernel(
if (lane == 0) red[0] = 1.0f / sum;
}
/*
- DPCT1065:832: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
item_ct1.barrier();
const float inv = red[0];
/*
- DPCT1065:833: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -799,7 +799,7 @@ catch (sycl::exception const &exc) {
void step_upload_raw(const int32_t *h_step) try {
int32_t* d = step_scratch();
/*
- DPCT1114:835: cudaMemcpy is migrated to asynchronization memcpy, assuming in
+ DPCT1114: cudaMemcpy is migrated to asynchronization memcpy, assuming in
the original code the source host memory is pageable memory. If the memory
is not pageable, call wait() on event return by memcpy API to ensure
synchronization behavior.
@@ -894,7 +894,7 @@ void qsa_index_step(const float* pooled, const float* q_idx, const float* bias,
// `b > n_bid`, so the surplus blocks cost a launch and nothing else.
const int threads = 32 * (int) s.idx_n_head;
/*
- DPCT1049:166: The work-group size passed to the SYCL kernel may exceed the
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed the
limit. To get the device limit, query info::device::max_work_group_size.
Adjust the work-group size if needed.
*/
@@ -992,7 +992,7 @@ void qsa_attend_step(const float *q, const uint16_t *k_scratch,
// then index past it at token 500. The kernel reads the real count from `step`, so a larger allocation is
// exactly what it wants. The opt-in therefore happens once, for the capacity.
/*
- DPCT1083:168: The size of local memory in the migrated code may be different
+ DPCT1083: The size of local memory in the migrated code may be different
from the original code. Check that the allocated memory size in the migrated
code is correct.
*/
@@ -1006,7 +1006,7 @@ void qsa_attend_step(const float *q, const uint16_t *k_scratch,
int dev = 0, max_shared = 0;
dev = dpct::get_current_device_id();
/*
- DPCT1019:836: local_mem_size in SYCL is not a complete equivalent of
+ DPCT1019: local_mem_size in SYCL is not a complete equivalent of
cudaDevAttrMaxSharedMemoryPerBlockOptin in CUDA. You may need to adjust
the code.
*/
@@ -1018,7 +1018,7 @@ void qsa_attend_step(const float *q, const uint16_t *k_scratch,
}
const dpct::err0 e =
/*
- DPCT1027:837: The call to cudaFuncSetAttribute was replaced with 0
+ DPCT1027: The call to cudaFuncSetAttribute was replaced with 0
because SYCL currently does not support corresponding setting.
*/
0;
@@ -1026,7 +1026,7 @@ void qsa_attend_step(const float *q, const uint16_t *k_scratch,
s_configured = smem;
}
/*
- DPCT1049:167: The work-group size passed to the SYCL kernel may exceed the
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed the
limit. To get the device limit, query info::device::max_work_group_size.
Adjust the work-group size if needed.
*/
@@ -1100,7 +1100,7 @@ void indexer_key_append(const float* raw, const int32_t* pos_dev, int32_t pos_ba
fail("indexer_key_append: the indexer buffers are not all set (tail/dead/pooled/block_pos)");
const int threads = (int) s.idx_dim;
/*
- DPCT1083:170: The size of local memory in the migrated code may be different
+ DPCT1083: The size of local memory in the migrated code may be different
from the original code. Check that the allocated memory size in the migrated
code is correct.
*/
@@ -1109,7 +1109,7 @@ void indexer_key_append(const float* raw, const int32_t* pos_dev, int32_t pos_ba
// arguments here are identical for every token, which is the property a CUDA graph needs: this function can
// be captured and replayed, and the position arrives through `pos_dev` like every other kernel's data.
/*
- DPCT1049:169: The work-group size passed to the SYCL kernel may exceed the
+ DPCT1049: The work-group size passed to the SYCL kernel may exceed the
limit. To get the device limit, query info::device::max_work_group_size.
Adjust the work-group size if needed.
*/
diff --git a/sycl/src/kernels/cuda/qsa_decode_attn.dp.cpp b/sycl/src/kernels/cuda/qsa_decode_attn.dp.cpp
index b1ce2fb3..0caac021 100644
--- a/sycl/src/kernels/cuda/qsa_decode_attn.dp.cpp
+++ b/sycl/src/kernels/cuda/qsa_decode_attn.dp.cpp
@@ -24,7 +24,7 @@ constexpr int WARPS = THREADS / 32;
__dpct_inline__ float warp_sum(float v) {
#pragma unroll
/*
- DPCT1108:85: '__shfl_xor_sync' was migrated with the experimental feature
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
@@ -37,7 +37,7 @@ __dpct_inline__ float warp_sum(float v) {
__dpct_inline__ float warp_max(float v) {
#pragma unroll
/*
- DPCT1108:86: '__shfl_xor_sync' was migrated with the experimental feature
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
@@ -49,55 +49,67 @@ __dpct_inline__ float warp_max(float v) {
}
// 8 consecutive values of one cell's key or value row for KV head `kvh`, dimensions [d0, d0+8).
+// Per-format bodies; `load8` below is the KV_MODE dispatcher. value=false is the K side, true the V side.
+__dpct_inline__ void load8_f16(const QsaAttnPools &p, bool value, long long row,
+ int d0, float *out) {
+ const uint16_t* base = (value ? p.v_pool : p.k_pool) + row * HD + d0;
+ const sycl::uint4 raw = *reinterpret_cast(base);
+ const sycl::half2 *h2 = reinterpret_cast(&raw);
+#pragma unroll
+ for (int j = 0; j < 4; ++j) {
+ const sycl::float2 f =
+ h2[j].template convert();
+ out[2 * j] = f.x();
+ out[2 * j + 1] = f.y();
+ }
+}
+__dpct_inline__ void load8_q8(const QsaAttnPools &p, bool value, long long row,
+ int d0, float *out) {
+ const int8_t* codes = (value ? p.v_q : p.k_q) + row * HD + d0;
+ const uint16_t sbits = (value ? p.v_scale : p.k_scale)[row * (HD / KV_Q8_GROUP) + d0 / KV_Q8_GROUP];
+ const float sc = sycl::vec(
+ sycl::bit_cast(sbits))
+ .convert()[0];
+ const sycl::uint2 raw = *reinterpret_cast(codes);
+ const int8_t* c = reinterpret_cast(&raw);
+#pragma unroll
+ for (int j = 0; j < 8; ++j) out[j] = (float) c[j] * sc;
+}
+__dpct_inline__ void load8_q4(const QsaAttnPools &p, bool value, long long row,
+ int d0, float *out) {
+ constexpr int bytes_per_head = (HD / QK4_0) * sizeof(block_q4_0);
+ const int b = d0 / QK4_0;
+ const int rem = d0 % QK4_0;
+ const block_q4_0* blk = reinterpret_cast((value ? p.v_q4 : p.k_q4) + row * bytes_per_head) + b;
+ const float d = sycl::vec(
+ sycl::bit_cast(blk->d))
+ .convert()[0];
+ const int j = (rem == 0 || rem == 16) ? 0 : 8;
+ const uint8_t* bytes = blk->qs + j;
+ if (rem < 16) {
+#pragma unroll
+ for (int k = 0; k < 8; ++k) out[k] = (float) ((int)(bytes[k] & 0x0F) - 8) * d;
+ } else {
+#pragma unroll
+ for (int k = 0; k < 8; ++k) out[k] = (float) ((int)(bytes[k] >> 4) - 8) * d;
+ }
+}
template
__dpct_inline__ void load8(const QsaAttnPools &p, bool value, long long row,
int d0, float *out) {
- if constexpr (KV_MODE == 0) {
- const uint16_t* base = (value ? p.v_pool : p.k_pool) + row * HD + d0;
- const sycl::uint4 raw = *reinterpret_cast(base);
- const sycl::half2 *h2 = reinterpret_cast(&raw);
-#pragma unroll
- for (int j = 0; j < 4; ++j) {
- const sycl::float2 f =
- h2[j].template convert();
- out[2 * j] = f.x();
- out[2 * j + 1] = f.y();
- }
- } else if constexpr (KV_MODE == 1) {
- const int8_t* codes = (value ? p.v_q : p.k_q) + row * HD + d0;
- const uint16_t sbits = (value ? p.v_scale : p.k_scale)[row * (HD / KV_Q8_GROUP) + d0 / KV_Q8_GROUP];
- const float sc =
- sycl::vec(
- sycl::bit_cast(sbits))
- .convert()[0];
- const sycl::uint2 raw = *reinterpret_cast(codes);
- const int8_t* c = reinterpret_cast(&raw);
-#pragma unroll
- for (int j = 0; j < 8; ++j) out[j] = (float) c[j] * sc;
- } else {
- constexpr int bytes_per_head = (HD / QK4_0) * sizeof(block_q4_0);
- const int b = d0 / QK4_0;
- const int rem = d0 % QK4_0;
- const block_q4_0* blk = reinterpret_cast((value ? p.v_q4 : p.k_q4) + row * bytes_per_head) + b;
- const float d =
- sycl::vec(
- sycl::bit_cast(blk->d))
- .convert()[0];
- const int j = (rem == 0 || rem == 16) ? 0 : 8;
- const uint8_t* bytes = blk->qs + j;
- if (rem < 16) {
-#pragma unroll
- for (int k = 0; k < 8; ++k) out[k] = (float) ((int)(bytes[k] & 0x0F) - 8) * d;
- } else {
-#pragma unroll
- for (int k = 0; k < 8; ++k) out[k] = (float) ((int)(bytes[k] >> 4) - 8) * d;
- }
- }
+ if constexpr (KV_MODE == 0) load8_f16(p, value, row, d0, out);
+ else if constexpr (KV_MODE == 1) load8_q8(p, value, row, d0, out);
+ else if constexpr (KV_MODE == 3) {
+ // hybrid K8V4: both sides are defined - K unrotated INT8, V rotated Q4_0 - so a value=true call
+ // reads the Q4_0 pool instead of dereferencing the null v_q (no call site does today; PR review)
+ if (value) load8_q4(p, value, row, d0, out);
+ else load8_q8(p, value, row, d0, out);
+ } else load8_q4(p, value, row, d0, out);
}
template
/*
-DPCT1110:87: The total declared local variable size in device function
+DPCT1110: The total declared local variable size in device function
attn_chunk_kernel exceeds 128 bytes and may cause high register pressure.
Consult with your hardware vendor to find the total register size available and
adjust the code, or use smaller sub-group size to avoid high register pressure.
@@ -130,7 +142,7 @@ attn_chunk_kernel(const float *__restrict__ q, QsaAttnPools p,
sycl::ext::oneapi::this_work_item::get_work_group<
3>()); // pool row of each cell (page, kv head, slot)
/*
- DPCT1098:447: The '*' expression is used instead of the __ldg call. These
+ DPCT1098: The '*' expression is used instead of the __ldg call. These
two expressions do not provide the exact same functionality. Check the
generated code for potential precision and/or performance issues.
*/
@@ -157,7 +169,7 @@ attn_chunk_kernel(const float *__restrict__ q, QsaAttnPools p,
srow[t] = r;
}
/*
- DPCT1065:448: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -184,7 +196,7 @@ attn_chunk_kernel(const float *__restrict__ q, QsaAttnPools p,
}
}
/*
- DPCT1065:449: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -201,7 +213,7 @@ attn_chunk_kernel(const float *__restrict__ q, QsaAttnPools p,
if (lane == 0) { part_m[slot * G + h] = m; part_l[slot * G + h] = l; }
}
/*
- DPCT1065:450: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -225,7 +237,7 @@ attn_chunk_kernel(const float *__restrict__ q, QsaAttnPools p,
t / KV_Q8_GROUP]))
.convert()[0];
v = (float) p.v_q[srow[c] * HD + t] * sc;
- } else {
+ } else { // modes 2 and 3: V is rotated Q4_0 (kv_q4.hpp); the caller rotates the output back
constexpr int bytes_per_head = (HD / QK4_0) * sizeof(block_q4_0);
const int b = t / QK4_0;
const int rem = t % QK4_0;
@@ -284,13 +296,11 @@ void qsa_decode_attn_batch(const float* q, const QsaAttnPools& pools, const int3
if (n_q <= 0) return;
if (s.head_dim != HD || s.n_head != (int64_t) G * s.n_head_kv || cap <= 0 || !scratch || !ids || !steps ||
!pools.page_table || n_q > 65535) {
- std::fprintf(stderr, "qsa_decode_attn_batch: unsupported geometry or missing buffers (head_dim %lld want %d, "
- "n_head %lld, n_head_kv %lld, cap %lld, n_q %lld, scratch %d ids %d steps %d page_table %d)\n",
- (long long) s.head_dim, HD, (long long) s.n_head, (long long) s.n_head_kv, (long long) cap,
- (long long) n_q, scratch != nullptr, ids != nullptr, steps != nullptr, pools.page_table != nullptr);
+ std::fprintf(stderr, "qsa_decode_attn_batch: unsupported geometry or missing buffers\n");
std::exit(1);
}
- const int kv_mode = pools.k_q4 != nullptr ? 2 : (pools.k_q != nullptr ? 1 : 0);
+ const int kv_mode = pools.k_q4 != nullptr ? 2 : (pools.k_q != nullptr && pools.v_q4 != nullptr ? 3
+ : (pools.k_q != nullptr ? 1 : 0));
const int n_chunks = (int) ((cap + CHUNK - 1) / CHUNK);
// per query: [acc: n_chunks*n_head*HD][m: n_chunks*n_head][l: n_chunks*n_head], all offsets from one stride
const long long stride = (long long) qsa_decode_attn_scratch_floats(cap, s);
@@ -301,13 +311,29 @@ void qsa_decode_attn_batch(const float* q, const QsaAttnPools& pools, const int3
const dpct::dim3 grid((unsigned)n_chunks, (unsigned)s.n_head_kv,
(unsigned)n_q);
dpct::queue_ptr st = strata::q_of(stream);
- if (kv_mode == 2)
+ if (kv_mode == 3)
{
auto exp_props = sycl::ext::oneapi::experimental::properties{
sycl::ext::oneapi::experimental::use_root_sync};
dpct::has_capability_or_fail(st->get_device(), {sycl::aspect::fp16});
- st->parallel_forparallel_for>>(
+ sycl::nd_range<3>(grid * sycl::range(1, 1, THREADS),
+ sycl::range(1, 1, THREADS)),
+ exp_props,
+ [=](sycl::nd_item<3> item_ct1) [[sycl::reqd_sub_group_size(32)]] {
+ attn_chunk_kernel<3>(q, pools, ids, steps, (int)s.n_head_kv,
+ (int)s.page_size, scale, part_acc, part_m,
+ part_l, n_chunks, (int)cap, stride);
+ });
+ } else if (kv_mode == 2)
+ {
+ auto exp_props = sycl::ext::oneapi::experimental::properties{
+ sycl::ext::oneapi::experimental::use_root_sync};
+ dpct::has_capability_or_fail(st->get_device(), {sycl::aspect::fp16});
+
+ st->parallel_for>>(
sycl::nd_range<3>(grid * sycl::range(1, 1, THREADS),
sycl::range(1, 1, THREADS)),
@@ -323,7 +349,7 @@ void qsa_decode_attn_batch(const float* q, const QsaAttnPools& pools, const int3
sycl::ext::oneapi::experimental::use_root_sync};
dpct::has_capability_or_fail(st->get_device(), {sycl::aspect::fp16});
- st->parallel_forparallel_for>>(
sycl::nd_range<3>(grid * sycl::range(1, 1, THREADS),
sycl::range(1, 1, THREADS)),
@@ -338,7 +364,7 @@ void qsa_decode_attn_batch(const float* q, const QsaAttnPools& pools, const int3
sycl::ext::oneapi::experimental::use_root_sync};
dpct::has_capability_or_fail(st->get_device(), {sycl::aspect::fp16});
- st->parallel_forparallel_for>>(
sycl::nd_range<3>(grid * sycl::range(1, 1, THREADS),
sycl::range(1, 1, THREADS)),
@@ -353,7 +379,7 @@ void qsa_decode_attn_batch(const float* q, const QsaAttnPools& pools, const int3
auto exp_props = sycl::ext::oneapi::experimental::properties{
sycl::ext::oneapi::experimental::use_root_sync};
- st->parallel_for>(
+ st->parallel_for>(
sycl::nd_range<3>(
sycl::range(1, (unsigned)n_q, (unsigned)s.n_head) *
sycl::range(1, 1, HD),
@@ -364,7 +390,7 @@ void qsa_decode_attn_batch(const float* q, const QsaAttnPools& pools, const int3
});
}
/*
- DPCT1010:451: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
@@ -383,8 +409,11 @@ void qsa_decode_attn_step(const float* q, const QsaAttnPools& pools, const int32
std::fprintf(stderr, "qsa_decode_attn: unsupported geometry or missing buffers\n");
std::exit(1);
}
- const int kv_mode = pools.k_q4 != nullptr ? 2 : (pools.k_q != nullptr ? 1 : 0);
- if (kv_mode == 2 ? (!pools.v_q4) : (kv_mode == 1 ? (!pools.v_q || !pools.k_scale || !pools.v_scale) : (!pools.k_pool || !pools.v_pool))) {
+ const int kv_mode = pools.k_q4 != nullptr ? 2 : (pools.k_q != nullptr && pools.v_q4 != nullptr ? 3
+ : (pools.k_q != nullptr ? 1 : 0));
+ if (kv_mode == 3 ? (!pools.k_scale || !pools.v_q4)
+ : (kv_mode == 2 ? (!pools.v_q4) : (kv_mode == 1 ? (!pools.v_q || !pools.k_scale || !pools.v_scale)
+ : (!pools.k_pool || !pools.v_pool)))) {
std::fprintf(stderr, "qsa_decode_attn: incomplete KV pools\n");
std::exit(1);
}
@@ -395,13 +424,29 @@ void qsa_decode_attn_step(const float* q, const QsaAttnPools& pools, const int32
const float scale = 1.0f / sqrtf((float) HD);
const dpct::dim3 grid((unsigned)n_chunks, (unsigned)s.n_head_kv);
dpct::queue_ptr st = strata::q_of(stream);
- if (kv_mode == 2)
+ if (kv_mode == 3)
{
auto exp_props = sycl::ext::oneapi::experimental::properties{
sycl::ext::oneapi::experimental::use_root_sync};
dpct::has_capability_or_fail(st->get_device(), {sycl::aspect::fp16});
- st->parallel_forparallel_for>>(
+ sycl::nd_range<3>(grid * sycl::range(1, 1, THREADS),
+ sycl::range(1, 1, THREADS)),
+ exp_props,
+ [=](sycl::nd_item<3> item_ct1) [[sycl::reqd_sub_group_size(32)]] {
+ attn_chunk_kernel<3>(q, pools, ids, step, (int)s.n_head_kv,
+ (int)s.page_size, scale, part_acc, part_m,
+ part_l, n_chunks, 0, 0);
+ });
+ } else if (kv_mode == 2)
+ {
+ auto exp_props = sycl::ext::oneapi::experimental::properties{
+ sycl::ext::oneapi::experimental::use_root_sync};
+ dpct::has_capability_or_fail(st->get_device(), {sycl::aspect::fp16});
+
+ st->parallel_for>>(
sycl::nd_range<3>(grid * sycl::range(1, 1, THREADS),
sycl::range(1, 1, THREADS)),
@@ -417,7 +462,7 @@ void qsa_decode_attn_step(const float* q, const QsaAttnPools& pools, const int32
sycl::ext::oneapi::experimental::use_root_sync};
dpct::has_capability_or_fail(st->get_device(), {sycl::aspect::fp16});
- st->parallel_forparallel_for>>(
sycl::nd_range<3>(grid * sycl::range(1, 1, THREADS),
sycl::range(1, 1, THREADS)),
@@ -432,7 +477,7 @@ void qsa_decode_attn_step(const float* q, const QsaAttnPools& pools, const int32
sycl::ext::oneapi::experimental::use_root_sync};
dpct::has_capability_or_fail(st->get_device(), {sycl::aspect::fp16});
- st->parallel_forparallel_for>>(
sycl::nd_range<3>(grid * sycl::range(1, 1, THREADS),
sycl::range(1, 1, THREADS)),
@@ -447,7 +492,7 @@ void qsa_decode_attn_step(const float* q, const QsaAttnPools& pools, const int32
auto exp_props = sycl::ext::oneapi::experimental::properties{
sycl::ext::oneapi::experimental::use_root_sync};
- st->parallel_for>(
+ st->parallel_for>(
sycl::nd_range<3>(sycl::range(1, 1, (unsigned)s.n_head) *
sycl::range(1, 1, HD),
sycl::range(1, 1, HD)),
@@ -456,7 +501,7 @@ void qsa_decode_attn_step(const float* q, const QsaAttnPools& pools, const int32
});
}
/*
- DPCT1010:453: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
diff --git a/sycl/src/kernels/cuda/qsa_prompt_attn.dp.cpp b/sycl/src/kernels/cuda/qsa_prompt_attn.dp.cpp
index ea2c21be..1f38376b 100644
--- a/sycl/src/kernels/cuda/qsa_prompt_attn.dp.cpp
+++ b/sycl/src/kernels/cuda/qsa_prompt_attn.dp.cpp
@@ -5,11 +5,13 @@
#include "strata/sycl_queue.hpp"
#include "strata/kernels/qsa_prompt_attn.hpp"
#include "strata/kernels/kv_q8.hpp"
+#include "strata/kernels/kv_q4.hpp"
+
+#include
#include
#include
#include
-#include
namespace strata::kernels {
namespace {
@@ -25,7 +27,9 @@ constexpr int QS = HD + 8; // q row stride in halves (bank-conflict-free
// The MMA and cp.async below need sm_80. Builds for older cards (the experimental sm_75 one) compile them to a trap;
// qsa_prompt_attn_batch refuses such a device at run time, so the old kernel runs there.
-#if 0 // SYCL: inline PTX (mma/ldmatrix/cp.async) - the XMX port is pending; see tools/fixups.py
+#if defined(__HIPCC__) // AMD: no mma.sync / cp.async; the host keeps the old kernel (below)
+#define STRATA_PA_SM80 0
+#elif 0 // SYCL: inline PTX (mma/ldmatrix/cp.async) - the XMX port is pending; see tools/fixups.py
#define STRATA_PA_SM80 1
#else
#define STRATA_PA_SM80 0
@@ -77,15 +81,20 @@ __dpct_inline__ uint32_t pack_h2(float lo_k,
}
// KV_MODE 1: int8 codes + fp16 scale per 64 values. KV_MODE 0: fp16 values (scales 1).
+// KV_MODE 3 (hybrid K8V4): K as mode 1, V as mode 0 - the row's q4_0 blocks are dequantized to fp16 at
+// gather, so everything downstream of the load is the mode-0 V path; the caller un-rotates the output.
template
struct Smem {
- using Elem =
+ using KElem =
+ typename std::conditional::type;
+ using VElem =
typename std::conditional::type;
- static constexpr int ROW = KV_MODE == 1 ? HD + 16 : HD + 8; // elements; 16-byte aligned rows, banks spread
+ static constexpr int KROW = KV_MODE == 0 ? HD + 8 : HD + 16; // elements; 16-byte aligned rows, banks spread
+ static constexpr int VROW = KV_MODE == 1 ? HD + 16 : HD + 8;
sycl::half qh[16][QS];
sycl::half ql[16][QS];
- Elem k[CH][ROW];
- Elem v[CH][ROW];
+ KElem k[CH][KROW];
+ VElem v[CH][VROW];
float ks[CH][4];
float vs[CH][4];
float s[16][CH + 1];
@@ -98,7 +107,7 @@ struct Smem {
template
/*
-DPCT1110:134: The total declared local variable size in device function
+DPCT1110: The total declared local variable size in device function
prompt_attn_kernel exceeds 128 bytes and may cause high register pressure.
Consult with your hardware vendor to find the total register size available and
adjust the code, or use smaller sub-group size to avoid high register pressure.
@@ -118,7 +127,7 @@ prompt_attn_kernel(const float *__restrict__ q, QsaAttnPools p,
attn += (size_t) qi * n_head * HD + (size_t) kvh * G * HD;
ids += (size_t) qi * cap;
/*
- DPCT1098:727: The '*' expression is used instead of the __ldg call. These
+ DPCT1098: The '*' expression is used instead of the __ldg call. These
two expressions do not provide the exact same functionality. Check the
generated code for potential precision and/or performance issues.
*/
@@ -134,7 +143,7 @@ prompt_attn_kernel(const float *__restrict__ q, QsaAttnPools p,
qm = sycl::fmax(qm, sycl::fabs(q[i]));
#pragma unroll
/*
- DPCT1108:135: '__shfl_xor_sync' was migrated with the experimental feature
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
@@ -144,7 +153,7 @@ prompt_attn_kernel(const float *__restrict__ q, QsaAttnPools p,
qm, o));
if (lane == 0) S.qmax[warp] = qm;
/*
- DPCT1065:733: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -153,7 +162,7 @@ prompt_attn_kernel(const float *__restrict__ q, QsaAttnPools p,
sycl::fmax(S.qmax[2], S.qmax[3]));
int qe = 0;
/*
- DPCT1017:728: The sycl::frexp call is used instead of the frexpf call. These
+ DPCT1017: The sycl::frexp call is used instead of the frexpf call. These
two calls do not provide exactly the same functionality. Check the potential
precision and/or performance issues for the generated code.
*/
@@ -176,9 +185,7 @@ prompt_attn_kernel(const float *__restrict__ q, QsaAttnPools p,
.convert()[0])
.convert()[0];
}
- if (t < 16) {
- S.mrow[t] = -sycl::bit_cast(0x7f800000U); S.lsum[t] = 0.0f;
- }
+ if (t < 16) { S.mrow[t] = -INFINITY; S.lsum[t] = 0.0f; }
float acc[8][4];
#pragma unroll
@@ -196,46 +203,28 @@ prompt_attn_kernel(const float *__restrict__ q, QsaAttnPools p,
S.row[t] = r;
}
/*
- DPCT1118:136: SYCL group functions and algorithms must be encountered in
+ DPCT1118: SYCL group functions and algorithms must be encountered in
converged control flow. You may need to adjust the code.
*/
/*
- DPCT1065:735: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for
better performance if there is no access to global memory.
*/
item_ct1.barrier(); // rows ready; the previous chunk's p.v is done with
// k, v, s
- // gather the chunk's K and V rows (16-byte pieces) and their scales
+ // gather the chunk's K and V rows (16-byte pieces; K8V4's V as q4_0 blocks dequantized to fp16)
+ // and their scales
{
- constexpr int PIECES = HD * (int) sizeof(typename Smem::Elem) / 16; // per row
- for (int i = t; i < CH * PIECES; i += THREADS) {
- const int c = i / PIECES, pc = i % PIECES;
+ constexpr int KPIECES = HD * (int) sizeof(typename Smem::KElem) / 16; // per K row
+ for (int i = t; i < CH * KPIECES; i += THREADS) {
+ const int c = i / KPIECES, pc = i % KPIECES;
const long long r = S.row[c];
- sycl::uint4 kx = sycl::uint4(0, 0, 0, 0), vx = kx;
+ sycl::uint4 kx = sycl::uint4(0, 0, 0, 0);
if (r >= 0) {
- if constexpr (KV_MODE == 1) {
+ if constexpr (KV_MODE == 0)
/*
- DPCT1098:729: The '*' expression is used instead of the
- __ldg call. These two expressions do not provide the
- exact same functionality. Check the generated code for
- potential precision and/or performance issues.
- */
- kx = *(reinterpret_cast(p.k_q +
- r * HD) +
- pc);
- /*
- DPCT1098:730: The '*' expression is used instead of the
- __ldg call. These two expressions do not provide the
- exact same functionality. Check the generated code for
- potential precision and/or performance issues.
- */
- vx = *(reinterpret_cast(p.v_q +
- r * HD) +
- pc);
- } else {
- /*
- DPCT1098:731: The '*' expression is used instead of the
+ DPCT1098: The '*' expression is used instead of the
__ldg call. These two expressions do not provide the
exact same functionality. Check the generated code for
potential precision and/or performance issues.
@@ -243,23 +232,87 @@ prompt_attn_kernel(const float *__restrict__ q, QsaAttnPools p,
kx = *(reinterpret_cast(p.k_pool +
r * HD) +
pc);
+ else // modes 1 and 3: the K side is INT8
/*
- DPCT1098:732: The '*' expression is used instead of the
+ DPCT1098: The '*' expression is used instead of the
__ldg call. These two expressions do not provide the
exact same functionality. Check the generated code for
potential precision and/or performance issues.
*/
- vx = *(reinterpret_cast(p.v_pool +
+ kx = *(reinterpret_cast(p.k_q +
r * HD) +
pc);
- }
}
*reinterpret_cast(
reinterpret_cast(&S.k[c][0]) + pc * 16) =
kx;
- *reinterpret_cast(
- reinterpret_cast(&S.v[c][0]) + pc * 16) =
- vx;
+ }
+ if constexpr (KV_MODE == 3) { // V: dequantize the row's q4_0 blocks straight into the fp16 V row
+ constexpr int BLKS = HD / QK4_0;
+ constexpr int BYTES = BLKS * (int) sizeof(block_q4_0);
+ for (int i = t; i < CH * BLKS; i += THREADS) {
+ const int c = i / BLKS, b = i % BLKS;
+ const long long r = S.row[c];
+#pragma unroll
+ for (int j = 0; j < QK4_0; ++j)
+ S.v[c][b * QK4_0 + j] = sycl::half(0);
+ if (r >= 0) {
+ const block_q4_0* blk = reinterpret_cast(p.v_q4 + r * BYTES) + b;
+ const float d =
+ sycl::vec(
+ sycl::bit_cast(
+ blk->d))
+ .convert()[0];
+#pragma unroll
+ for (int j = 0; j < QK4_0 / 2; ++j) {
+ S.v[c][b * QK4_0 + j] =
+ sycl::vec(
+ (float)((int)(blk->qs[j] & 0x0F) - 8) * d)
+ .convert()[0];
+ S.v[c][b * QK4_0 + j + QK4_0 / 2] =
+ sycl::vec(
+ (float)((int)(blk->qs[j] >> 4) - 8) * d)
+ .convert()[0];
+ }
+ }
+ }
+ } else {
+ constexpr int VPIECES = HD * (int) sizeof(typename Smem::VElem) / 16; // per V row
+ for (int i = t; i < CH * VPIECES; i += THREADS) {
+ const int c = i / VPIECES, pc = i % VPIECES;
+ const long long r = S.row[c];
+ sycl::uint4 vx = sycl::uint4(0, 0, 0, 0);
+ if (r >= 0) {
+ if constexpr (KV_MODE == 1)
+ /*
+ DPCT1098: The '*' expression is used instead of
+ the __ldg call. These two expressions do not provide
+ the exact same functionality. Check the generated
+ code for potential precision and/or performance
+ issues.
+ */
+ vx = *(reinterpret_cast(
+ p.v_q + r * HD) +
+ pc);
+ else
+ /*
+ DPCT1098: The '*' expression is used instead of
+ the __ldg call. These two expressions do not provide
+ the exact same functionality. Check the generated
+ code for potential precision and/or performance
+ issues.
+ */
+ vx = *(reinterpret_cast(
+ p.v_pool + r * HD) +
+ pc);
+ }
+ *reinterpret_cast(
+ reinterpret_cast(&S.v[c][0]) +
+ pc * 16) = vx;
+ }
}
for (int i = t; i < CH * 4; i += THREADS) {
const int c = i / 4, g = i % 4;
@@ -277,6 +330,13 @@ prompt_attn_kernel(const float *__restrict__ q, QsaAttnPools p,
p.v_scale[r * (HD / KV_Q8_GROUP) + g]))
.convert()[0];
+ } else if constexpr (KV_MODE == 3) { // K as int8, V dequantized to fp16 (scale 1)
+ a = sycl::vec(
+ sycl::bit_cast(
+ p.k_scale[r * (HD / KV_Q8_GROUP) + g]))
+ .convert()[0];
+ b = 1.0f;
} else {
a = b = 1.0f;
}
@@ -286,11 +346,11 @@ prompt_attn_kernel(const float *__restrict__ q, QsaAttnPools p,
}
}
/*
- DPCT1118:137: SYCL group functions and algorithms must be encountered in
+ DPCT1118: SYCL group functions and algorithms must be encountered in
converged control flow. You may need to adjust the code.
*/
/*
- DPCT1065:736: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for
better performance if there is no access to global memory.
*/
@@ -315,7 +375,7 @@ prompt_attn_kernel(const float *__restrict__ q, QsaAttnPools p,
al[1] = *reinterpret_cast(&S.ql[gid + 8][k0 + 2 * tig]);
al[2] = *reinterpret_cast(&S.ql[gid][k0 + 2 * tig + 8]);
al[3] = *reinterpret_cast(&S.ql[gid + 8][k0 + 2 * tig + 8]);
- if constexpr (KV_MODE == 1) {
+ if constexpr (KV_MODE != 0) { // modes 1 and 3: the K side is INT8 codes
b[0] = i8x2_to_h2(*reinterpret_cast(&S.k[cb + gid][k0 + 2 * tig]));
b[1] = i8x2_to_h2(*reinterpret_cast(&S.k[cb + gid][k0 + 2 * tig + 8]));
} else {
@@ -334,23 +394,17 @@ prompt_attn_kernel(const float *__restrict__ q, QsaAttnPools p,
sc[3] = sycl::fma(tg[3], (float)s1, sc[3]);
}
const int c = cb + 2 * tig;
- S.s[gid][c] = c < nh ? sc[0] * qdown
- : -sycl::bit_cast(0x7f800000U);
- S.s[gid][c + 1] = c + 1 < nh
- ? sc[1] * qdown
- : -sycl::bit_cast(0x7f800000U);
- S.s[gid + 8][c] = c < nh ? sc[2] * qdown
- : -sycl::bit_cast(0x7f800000U);
- S.s[gid + 8][c + 1] =
- c + 1 < nh ? sc[3] * qdown
- : -sycl::bit_cast(0x7f800000U);
+ S.s[gid][c] = c < nh ? sc[0] * qdown : -INFINITY;
+ S.s[gid][c + 1] = c + 1 < nh ? sc[1] * qdown : -INFINITY;
+ S.s[gid + 8][c] = c < nh ? sc[2] * qdown : -INFINITY;
+ S.s[gid + 8][c + 1] = c + 1 < nh ? sc[3] * qdown : -INFINITY;
}
/*
- DPCT1118:138: SYCL group functions and algorithms must be encountered in
+ DPCT1118: SYCL group functions and algorithms must be encountered in
converged control flow. You may need to adjust the code.
*/
/*
- DPCT1065:737: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for
better performance if there is no access to global memory.
*/
@@ -359,14 +413,14 @@ prompt_attn_kernel(const float *__restrict__ q, QsaAttnPools p,
{
constexpr int PER = CH / 8;
const int r = t >> 3, sub = t & 7;
- float x[PER], mx = -sycl::bit_cast(0x7f800000U);
+ float x[PER], mx = -INFINITY;
#pragma unroll
for (int j = 0; j < PER; ++j) {
x[j] = S.s[r][sub * PER + j]; mx = sycl::fmax(mx, x[j]);
}
#pragma unroll
/*
- DPCT1108:140: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -380,15 +434,14 @@ prompt_attn_kernel(const float *__restrict__ q, QsaAttnPools p,
float sum = 0.0f;
#pragma unroll
for (int j = 0; j < PER; ++j) {
- const float e = x[j] == -sycl::bit_cast(0x7f800000U)
- ? 0.0f
- : sycl::exp2(x[j] - m_new);
+ const float e =
+ x[j] == -INFINITY ? 0.0f : sycl::exp2(x[j] - m_new);
S.s[r][sub * PER + j] = e;
sum += e;
}
#pragma unroll
/*
- DPCT1108:141: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -400,20 +453,18 @@ prompt_attn_kernel(const float *__restrict__ q, QsaAttnPools p,
sycl::ext::oneapi::this_work_item::get_sub_group());
if (sub == 0) {
const float a =
- m_old == -sycl::bit_cast(0x7f800000U)
- ? 0.0f
- : sycl::exp2(m_old - m_new);
+ m_old == -INFINITY ? 0.0f : sycl::exp2(m_old - m_new);
S.alpha[r] = a;
S.lsum[r] = sycl::fma(S.lsum[r], (float)a, sum);
S.mrow[r] = m_new;
}
}
/*
- DPCT1118:139: SYCL group functions and algorithms must be encountered in
+ DPCT1118: SYCL group functions and algorithms must be encountered in
converged control flow. You may need to adjust the code.
*/
/*
- DPCT1065:738: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for
better performance if there is no access to global memory.
*/
@@ -428,7 +479,7 @@ prompt_attn_kernel(const float *__restrict__ q, QsaAttnPools p,
vmax = sycl::fmax(vmax, S.vs[c][warp]);
#pragma unroll
/*
- DPCT1108:142: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -506,7 +557,7 @@ prompt_attn_kernel(const float *__restrict__ q, QsaAttnPools p,
}
}
/*
- DPCT1065:734: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -552,7 +603,7 @@ __dpct_inline__ void cp_async16(void *smem, const void *gmem, bool valid) {
#else
auto sa = smem;
/*
- DPCT1053:143: Migration of device assembly code is not supported.
+ DPCT1053: Migration of device assembly code is not supported.
*/
asm volatile("cp.async.cg.shared.global [%0], [%1], 16, %2;\n" ::"r"(sa),
"l"(gmem), "r"(valid ? 16 : 0));
@@ -578,7 +629,7 @@ __dpct_inline__ void cp_async_wait1() {
}
/*
-DPCT1110:146: The total declared local variable size in device function
+DPCT1110: The total declared local variable size in device function
prompt_attn_i8_kernel exceeds 128 bytes and may cause high register pressure.
Consult with your hardware vendor to find the total register size available and
adjust the code, or use smaller sub-group size to avoid high register pressure.
@@ -598,7 +649,7 @@ prompt_attn_i8_kernel(const float *__restrict__ q, QsaAttnPools p,
attn += (size_t) qi * n_head * HD + (size_t) kvh * G * HD;
ids += (size_t) qi * cap;
/*
- DPCT1098:741: The '*' expression is used instead of the __ldg call. These
+ DPCT1098: The '*' expression is used instead of the __ldg call. These
two expressions do not provide the exact same functionality. Check the
generated code for potential precision and/or performance issues.
*/
@@ -614,7 +665,7 @@ prompt_attn_i8_kernel(const float *__restrict__ q, QsaAttnPools p,
qm = sycl::fmax(qm, sycl::fabs(q[i]));
#pragma unroll
/*
- DPCT1108:147: '__shfl_xor_sync' was migrated with the experimental feature
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental feature
masked sub_group function which may not be supported by all compilers or
runtimes. You may need to adjust the code.
*/
@@ -623,11 +674,9 @@ prompt_attn_i8_kernel(const float *__restrict__ q, QsaAttnPools p,
0xffffffffu, sycl::ext::oneapi::this_work_item::get_sub_group(),
qm, o));
if (lane == 0) S.qmax[warp] = qm;
- if (t < 16) {
- S.mrow[t] = -sycl::bit_cast(0x7f800000U); S.lsum[t] = 0.0f;
- }
+ if (t < 16) { S.mrow[t] = -INFINITY; S.lsum[t] = 0.0f; }
/*
- DPCT1065:739: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -636,7 +685,7 @@ prompt_attn_i8_kernel(const float *__restrict__ q, QsaAttnPools p,
sycl::fmax(S.qmax[2], S.qmax[3]));
int qe = 0;
/*
- DPCT1017:742: The sycl::frexp call is used instead of the frexpf call. These
+ DPCT1017: The sycl::frexp call is used instead of the frexpf call. These
two calls do not provide exactly the same functionality. Check the potential
precision and/or performance issues for the generated code.
*/
@@ -672,7 +721,7 @@ prompt_attn_i8_kernel(const float *__restrict__ q, QsaAttnPools p,
// the chunk pipeline: cells two chunks ahead, their pool rows one chunk ahead, the data (cp.async) one ahead
const int n_chunks = (n + CH2 - 1) / CH2;
/*
- DPCT1098:743: The '*' expression is used instead of the __ldg call. These
+ DPCT1098: The '*' expression is used instead of the __ldg call. These
two expressions do not provide the exact same functionality. Check the
generated code for potential precision and/or performance issues.
*/
@@ -682,7 +731,7 @@ prompt_attn_i8_kernel(const float *__restrict__ q, QsaAttnPools p,
auto row_of = [&](int cell) -> long long {
if (cell < 0) return -1;
/*
- DPCT1098:744: The '*' expression is used instead of the __ldg call.
+ DPCT1098: The '*' expression is used instead of the __ldg call.
These two expressions do not provide the exact same functionality. Check
the generated code for potential precision and/or performance issues.
*/
@@ -694,12 +743,12 @@ prompt_attn_i8_kernel(const float *__restrict__ q, QsaAttnPools p,
for (int j = 0; j < 4; ++j) {
const int idx = lane + 32 * j, cell = idx >> 2, pc = idx & 3;
/*
- DPCT1108:148: '__shfl_sync' was migrated with the experimental
+ DPCT1108: '__shfl_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
/*
- DPCT1121:149: Make sure that the "r" which is used in the SYCL group
+ DPCT1121: Make sure that the "r" which is used in the SYCL group
function/algorithm is initialized.
*/
const long long rr = dpct::experimental::select_from_sub_group(
@@ -711,7 +760,7 @@ prompt_attn_i8_kernel(const float *__restrict__ q, QsaAttnPools p,
cp_async16(&S.kv[st][warp][1][0][0] + swz(cell, pc * 16), p.v_q + off, ok);
}
/*
- DPCT1098:745: The '*' expression is used instead of the __ldg call.
+ DPCT1098: The '*' expression is used instead of the __ldg call.
These two expressions do not provide the exact same functionality. Check
the generated code for potential precision and/or performance issues.
*/
@@ -721,7 +770,7 @@ prompt_attn_i8_kernel(const float *__restrict__ q, QsaAttnPools p,
.convert()[0]
: 0.0f;
/*
- DPCT1098:746: The '*' expression is used instead of the __ldg call.
+ DPCT1098: The '*' expression is used instead of the __ldg call.
These two expressions do not provide the exact same functionality. Check
the generated code for potential precision and/or performance issues.
*/
@@ -775,11 +824,11 @@ prompt_attn_i8_kernel(const float *__restrict__ q, QsaAttnPools p,
S.part[warp][gid + 8][c + 1] = tg[3] * s1;
}
/*
- DPCT1118:150: SYCL group functions and algorithms must be encountered in
+ DPCT1118: SYCL group functions and algorithms must be encountered in
converged control flow. You may need to adjust the code.
*/
/*
- DPCT1065:747: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for
better performance if there is no access to global memory.
*/
@@ -787,20 +836,17 @@ prompt_attn_i8_kernel(const float *__restrict__ q, QsaAttnPools p,
// online softmax over the four groups' sum (fixed order): row t/8, 4 cells per thread
{
const int r = t >> 3, sub = t & 7;
- float x[4], mx = -sycl::bit_cast(0x7f800000U);
+ float x[4], mx = -INFINITY;
#pragma unroll
for (int j = 0; j < 4; ++j) {
const int c = sub * 4 + j;
- x[j] = c0 + c < n ? (((S.part[0][r][c] + S.part[1][r][c]) +
- S.part[2][r][c]) +
- S.part[3][r][c]) *
- qdown
- : -sycl::bit_cast(0x7f800000U);
+ x[j] = c0 + c < n ? (((S.part[0][r][c] + S.part[1][r][c]) + S.part[2][r][c]) + S.part[3][r][c]) * qdown
+ : -INFINITY;
mx = sycl::fmax(mx, x[j]);
}
#pragma unroll
/*
- DPCT1108:152: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -814,15 +860,14 @@ prompt_attn_i8_kernel(const float *__restrict__ q, QsaAttnPools p,
float sum = 0.0f;
#pragma unroll
for (int j = 0; j < 4; ++j) {
- const float e = x[j] == -sycl::bit_cast(0x7f800000U)
- ? 0.0f
- : sycl::exp2(x[j] - m_new);
+ const float e =
+ x[j] == -INFINITY ? 0.0f : sycl::exp2(x[j] - m_new);
S.p[r][sub * 4 + j] = e;
sum += e;
}
#pragma unroll
/*
- DPCT1108:153: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -834,20 +879,18 @@ prompt_attn_i8_kernel(const float *__restrict__ q, QsaAttnPools p,
sycl::ext::oneapi::this_work_item::get_sub_group());
if (sub == 0) {
const float a =
- m_old == -sycl::bit_cast(0x7f800000U)
- ? 0.0f
- : sycl::exp2(m_old - m_new);
+ m_old == -INFINITY ? 0.0f : sycl::exp2(m_old - m_new);
S.alpha[r] = a;
S.lsum[r] = sycl::fma(S.lsum[r], (float)a, sum);
S.mrow[r] = m_new;
}
}
/*
- DPCT1118:151: SYCL group functions and algorithms must be encountered in
+ DPCT1118: SYCL group functions and algorithms must be encountered in
converged control flow. You may need to adjust the code.
*/
/*
- DPCT1065:748: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for
better performance if there is no access to global memory.
*/
@@ -857,7 +900,7 @@ prompt_attn_i8_kernel(const float *__restrict__ q, QsaAttnPools p,
float vmax = S.sc[st][warp][1][lane];
#pragma unroll
/*
- DPCT1108:154: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -929,7 +972,7 @@ prompt_attn_i8_kernel(const float *__restrict__ q, QsaAttnPools p,
sycl::group_barrier(sycl::ext::oneapi::this_work_item::get_sub_group());
}
/*
- DPCT1065:740: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for better
performance if there is no access to global memory.
*/
@@ -955,7 +998,7 @@ bool launch_i8(const float *q, const QsaAttnPools &pools, const int32_t *ids,
int dev = 0;
dev = dpct::get_current_device_id();
/*
- DPCT1083:155: The size of local memory in the migrated code may be different
+ DPCT1083: The size of local memory in the migrated code may be different
from the original code. Check that the allocated memory size in the migrated
code is correct.
*/
@@ -963,12 +1006,12 @@ bool launch_i8(const float *q, const QsaAttnPools &pools, const int32_t *ids,
if (dev < 0 || dev >= 64) return false;
if (!attr[dev]) {
/*
- DPCT1027:749: The call to cudaFuncSetAttribute was replaced with 0
+ DPCT1027: The call to cudaFuncSetAttribute was replaced with 0
because SYCL currently does not support corresponding setting.
*/
if (0 != 0) {
/*
- DPCT1026:750: The call to cudaGetLastError was removed because this
+ DPCT1026: The call to cudaGetLastError was removed because this
functionality is redundant in SYCL.
*/
return false;
@@ -994,7 +1037,7 @@ bool launch_i8(const float *q, const QsaAttnPools &pools, const int32_t *ids,
auto attn_q0_s_n_head_HD_ct7 = attn + q0 * s.n_head * HD;
cgh.parallel_for<
- dpct_kernel_name>(
+ dpct_kernel_name>(
sycl::nd_range<3>(
sycl::range(1, (unsigned)s.n_head_kv, (unsigned)nb) *
sycl::range(1, 1, THREADS),
@@ -1015,7 +1058,7 @@ bool launch_i8(const float *q, const QsaAttnPools &pools, const int32_t *ids,
}
}
/*
- DPCT1010:751: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
@@ -1037,7 +1080,7 @@ bool launch(const float *q, const QsaAttnPools &pools, const int32_t *ids,
int dev = 0;
dev = dpct::get_current_device_id();
/*
- DPCT1083:156: The size of local memory in the migrated code may be different
+ DPCT1083: The size of local memory in the migrated code may be different
from the original code. Check that the allocated memory size in the migrated
code is correct.
*/
@@ -1045,12 +1088,12 @@ bool launch(const float *q, const QsaAttnPools &pools, const int32_t *ids,
if (dev < 0 || dev >= 64) return false;
if (!attr[dev]) {
/*
- DPCT1027:756: The call to cudaFuncSetAttribute was replaced with 0
+ DPCT1027: The call to cudaFuncSetAttribute was replaced with 0
because SYCL currently does not support corresponding setting.
*/
if (0 != 0) {
/*
- DPCT1026:753: The call to cudaGetLastError was removed because this
+ DPCT1026: The call to cudaGetLastError was removed because this
functionality is redundant in SYCL.
*/
return false;
@@ -1076,7 +1119,7 @@ bool launch(const float *q, const QsaAttnPools &pools, const int32_t *ids,
auto attn_q0_s_n_head_HD_ct7 = attn + q0 * s.n_head * HD;
cgh.parallel_for<
- dpct_kernel_name>>(
sycl::nd_range<3>(
sycl::range(1, (unsigned)s.n_head_kv, (unsigned)nb) *
@@ -1098,7 +1141,7 @@ bool launch(const float *q, const QsaAttnPools &pools, const int32_t *ids,
}
}
/*
- DPCT1010:754: SYCL uses exceptions to report errors and does not use the
+ DPCT1010: SYCL uses exceptions to report errors and does not use the
error codes. The cudaGetLastError function call was replaced with 0. You
need to rewrite this code.
*/
@@ -1123,7 +1166,7 @@ bool qsa_prompt_attn_batch(const float *q, const QsaAttnPools &pools,
static int cc_major[64] = {};
int dev = 0;
/*
- DPCT1026:757: The call to cudaGetLastError was removed because this
+ DPCT1026: The call to cudaGetLastError was removed because this
functionality is redundant in SYCL.
*/
if (DPCT_CHECK_ERROR(dev = dpct::get_current_device_id()) != 0 ||
@@ -1135,7 +1178,7 @@ bool qsa_prompt_attn_batch(const float *q, const QsaAttnPools &pools,
if (DPCT_CHECK_ERROR(
major = dpct::get_device(dev).get_major_version()) != 0) {
/*
- DPCT1026:758: The call to cudaGetLastError was removed because
+ DPCT1026: The call to cudaGetLastError was removed because
this functionality is redundant in SYCL.
*/
return false;
@@ -1145,10 +1188,17 @@ bool qsa_prompt_attn_batch(const float *q, const QsaAttnPools &pools,
(void) cc_major[dev];
return false; // SYCL: the tensor-core kernel is not ported yet; the caller takes the older kernel
}
+#if defined(__HIPCC__)
+ return false; // the tensor-core kernel is compiled out on AMD (its major version is not a CUDA sm)
+#endif
if (pools.k_q4 != nullptr || s.head_dim != HD || s.n_head != (int64_t) G * s.n_head_kv || cap <= 0 || !ids ||
!steps || !pools.page_table)
return false;
dpct::queue_ptr st = strata::q_of(stream);
+ if (pools.k_q != nullptr && pools.v_q4 != nullptr) { // hybrid K8V4: int8 K + dequantized-q4 V
+ if (!pools.k_scale) return false;
+ return launch<3>(q, pools, ids, steps, cap, s, attn, n_q, st);
+ }
if (pools.k_q != nullptr) {
if (!pools.v_q || !pools.k_scale || !pools.v_scale) return false;
// STRATA_PROMPT_ATTN_V1=1 (debug): the first version, same accuracy, another summation order - the control
diff --git a/sycl/src/kernels/cuda/qsa_select.dp.cpp b/sycl/src/kernels/cuda/qsa_select.dp.cpp
index 676a8993..91ef8f69 100644
--- a/sycl/src/kernels/cuda/qsa_select.dp.cpp
+++ b/sycl/src/kernels/cuda/qsa_select.dp.cpp
@@ -50,7 +50,7 @@ __dpct_inline__ void block_scores_kernel(const float *__restrict__ pooled,
k4.w() * q4.w();
#pragma unroll
/*
- DPCT1108:112: '__shfl_xor_sync' was migrated with the experimental
+ DPCT1108: '__shfl_xor_sync' was migrated with the experimental
feature masked sub_group function which may not be supported by all
compilers or runtimes. You may need to adjust the code.
*/
@@ -67,7 +67,7 @@ __dpct_inline__ void block_scores_kernel(const float *__restrict__ pooled,
}
/*
-DPCT1110:113: The total declared local variable size in device function
+DPCT1110: The total declared local variable size in device function
block_topk_kernel exceeds 128 bytes and may cause high register pressure.
Consult with your hardware vendor to find the total register size available and
adjust the code, or use smaller sub-group size to avoid high register pressure.
@@ -111,11 +111,11 @@ auto &hist = *sycl::ext::oneapi::group_local_memory_for_overwrite(
#pragma unroll
for (int i = t; i < 256; i += TOPK_T) hist[i] = 0;
/*
- DPCT1118:114: SYCL group functions and algorithms must be encountered in
+ DPCT1118: SYCL group functions and algorithms must be encountered in
converged control flow. You may need to adjust the code.
*/
/*
- DPCT1065:610: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for
better performance if there is no access to global memory.
*/
@@ -130,11 +130,11 @@ auto &hist = *sycl::ext::oneapi::group_local_memory_for_overwrite(
&hist[(k >> shift) & 255], w);
}
/*
- DPCT1118:115: SYCL group functions and algorithms must be encountered in
+ DPCT1118: SYCL group functions and algorithms must be encountered in
converged control flow. You may need to adjust the code.
*/
/*
- DPCT1065:611: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for
better performance if there is no access to global memory.
*/
@@ -150,11 +150,11 @@ auto &hist = *sycl::ext::oneapi::group_local_memory_for_overwrite(
s_above = cum;
}
/*
- DPCT1118:116: SYCL group functions and algorithms must be encountered in
+ DPCT1118: SYCL group functions and algorithms must be encountered in
converged control flow. You may need to adjust the code.
*/
/*
- DPCT1065:612: Consider replacing sycl::nd_item::barrier() with
+ DPCT1065: Consider replacing sycl::nd_item::barrier() with
sycl::nd_item::barrier(sycl::access::fence_space::local_space) for
better performance if there is no access to global memory.
*/
@@ -162,11 +162,11 @@ auto &hist = *sycl::ext::oneapi::group_local_memory_for_overwrite