Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

hip: encode the BF16 fixtures of the hipBLASLt tuner and parity test with bf16_from_f32()

bsorensen110025602c2be0b
diff --git a/tests/hip/prefill_hipblaslt_gemm.cpp b/tests/hip/prefill_hipblaslt_gemm.cpp
index e237af390..9d59945c9 100644
--- a/tests/hip/prefill_hipblaslt_gemm.cpp
+++ b/tests/hip/prefill_hipblaslt_gemm.cpp
@@ -5,6 +5,7 @@
#include <hipblas/hipblas.h>
#include <hipblaslt/hipblaslt.h>
+#include "strata/kernels/bf16_bits.hpp"
#include "strata/prefill/gemm.hpp"
#include "hipblaslt_tuning.hpp"
@@ -42,7 +43,7 @@ struct DeviceBuffer {
};
uint16_t encode(float value, bool bf16) {
- if (bf16) return hip_bfloat16(value).data;
+ if (bf16) return strata::kernels::bf16_from_f32(value);
const __half half = __float2half_rn(value);
uint16_t bits = 0;
std::memcpy(&bits, &half, sizeof(bits));
diff --git a/tools/hip/tune_hipblaslt.cpp b/tools/hip/tune_hipblaslt.cpp
index 5af18bfc3..ded114fc1 100644
--- a/tools/hip/tune_hipblaslt.cpp
+++ b/tools/hip/tune_hipblaslt.cpp
@@ -1,6 +1,7 @@
#include <hip/hip_runtime.h>
#include <hip/hip_fp16.h>
#include <hip/hip_bfloat16.h>
+#include "../../include/strata/kernels/bf16_bits.hpp"
#include <hip/hip_version.h>
#include <hipblas/hipblas.h>
#include <hipblaslt/hipblaslt.h>
@@ -99,7 +100,7 @@ std::string config_hex(const hipblasLtMatmulAlgo_t &algo) {
return o.str();
}
uint16_t input_bits(float x, bool bf16) {
- if (bf16) return hip_bfloat16(x).data;
+ if (bf16) return strata::kernels::bf16_from_f32(x);
const __half half = __float2half_rn(x);
uint16_t bits = 0;
std::memcpy(&bits, &half, sizeof(bits));