ggml-webgpu: Enable NVIDIA self-hosted CI (#22976)
* Enabel nvidia ci for webgpu * Address precision issues * fix placement * Relax more set_rows and div * Try relaxing all f16 * formatting and naming * Add comment explaining max_nmse_err logic Added comment referencing pull request for clarification.
This commit is contained in:
@@ -1128,7 +1128,11 @@ struct test_case {
|
||||
}
|
||||
|
||||
virtual double max_nmse_err(ggml_backend_t backend) {
|
||||
GGML_UNUSED(backend);
|
||||
ggml_backend_reg_t reg = ggml_backend_dev_backend_reg(ggml_backend_get_device(backend));
|
||||
// See https://github.com/ggml-org/llama.cpp/pull/22976 for explanation.
|
||||
if (contains_f16 && strcmp(ggml_backend_reg_name(reg), "WebGPU") == 0) {
|
||||
return std::max(max_nmse_err(), 1e-6);
|
||||
}
|
||||
return max_nmse_err();
|
||||
}
|
||||
|
||||
@@ -1205,6 +1209,18 @@ struct test_case {
|
||||
std::vector<ggml_tensor *> sentinels;
|
||||
|
||||
std::string current_op_name;
|
||||
bool contains_f16 = false;
|
||||
|
||||
// Used by the WebGPU backend to relax error thresholds on ops on f16 tensors
|
||||
void check_for_f16_tensor(ggml_context * ctx) {
|
||||
contains_f16 = false;
|
||||
for (ggml_tensor * t = ggml_get_first_tensor(ctx); t != nullptr; t = ggml_get_next_tensor(ctx, t)) {
|
||||
if (t->type == GGML_TYPE_F16) {
|
||||
contains_f16 = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void add_sentinel(ggml_context * ctx) {
|
||||
if (mode == MODE_PERF || mode == MODE_GRAD || mode == MODE_SUPPORT) {
|
||||
@@ -1298,6 +1314,7 @@ struct test_case {
|
||||
|
||||
ggml_tensor * out = build_graph(ctx);
|
||||
current_op_name = op_desc(out);
|
||||
check_for_f16_tensor(ctx);
|
||||
|
||||
if (!matches_filter(out, op_names_filter)) {
|
||||
//printf(" %s: skipping\n", op_desc(out).c_str());
|
||||
@@ -1973,9 +1990,19 @@ struct test_unary : public test_case {
|
||||
}
|
||||
|
||||
void initialize_tensors(ggml_context * ctx) override {
|
||||
float min = -150.f;
|
||||
float max = 150.f;
|
||||
|
||||
// Keep FP16 exp/expm1 inputs in-range so all backends stay finite instead of
|
||||
// disagreeing on whether overflow saturates to max-F16 or produces +inf.
|
||||
if (type == GGML_TYPE_F16 && (op == GGML_UNARY_OP_EXP || op == GGML_UNARY_OP_EXPM1)) {
|
||||
min = -10.f;
|
||||
max = 10.f;
|
||||
}
|
||||
|
||||
for (ggml_tensor * t = ggml_get_first_tensor(ctx); t != NULL; t = ggml_get_next_tensor(ctx, t)) {
|
||||
// test extended range of values to check for NaNs in GELU
|
||||
init_tensor_uniform(t, -150.f, 150.f);
|
||||
init_tensor_uniform(t, min, max);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user