Skip to content

Commit 528e03e

Browse files
committed
add test and fix editorconfig mistakes
1 parent 9db3e6f commit 528e03e

File tree

5 files changed

+47
-7
lines changed

5 files changed

+47
-7
lines changed

ggml/include/ggml.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ extern "C" {
10371037
struct ggml_context * ctx,
10381038
struct ggml_tensor * a);
10391039

1040-
1040+
10411041
GGML_API struct ggml_tensor * ggml_sgn(
10421042
struct ggml_context * ctx,
10431043
struct ggml_tensor * a);

ggml/src/ggml-sycl/ggml-sycl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3626,9 +3626,9 @@ static bool ggml_sycl_compute_forward(ggml_backend_sycl_context & ctx, struct gg
36263626
case GGML_UNARY_OP_ABS:
36273627
ggml_sycl_abs(ctx, dst);
36283628
break;
3629-
case GGML_UNARY_OP_FLOOR:
3629+
case GGML_UNARY_OP_FLOOR:
36303630
ggml_sycl_floor(ctx, dst);
3631-
break;
3631+
break;
36323632
case GGML_UNARY_OP_ELU:
36333633
ggml_sycl_elu(ctx, dst);
36343634
break;

ggml/src/ggml.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2489,7 +2489,7 @@ struct ggml_tensor * ggml_floor(
24892489
}
24902490

24912491
struct ggml_tensor * ggml_floor_inplace(
2492-
struct ggml_context * ctx,
2492+
struct ggml_context * ctx,
24932493
struct ggml_tensor * a) {
24942494
return ggml_unary_inplace(ctx, a, GGML_UNARY_OP_FLOOR);
24952495
}

tests/test-backend-ops.cpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3512,6 +3512,45 @@ struct test_log : public test_case {
35123512
}
35133513
};
35143514

3515+
// GGML_OP_FLOOR
3516+
struct test_floor : public test_case {
3517+
const ggml_type type;
3518+
const std::array<int64_t, 4> ne;
3519+
3520+
std::string vars() override {
3521+
return VARS_TO_STR2(type, ne);
3522+
}
3523+
3524+
test_floor(ggml_type type = GGML_TYPE_F32,
3525+
std::array<int64_t, 4> ne = {10, 5, 4, 3})
3526+
: type(type), ne(ne) {}
3527+
3528+
ggml_tensor * build_graph(ggml_context * ctx) override {
3529+
ggml_tensor * a = ggml_new_tensor(ctx, type, 4, ne.data());
3530+
ggml_set_param(a);
3531+
ggml_set_name(a, "a");
3532+
3533+
ggml_tensor * out = ggml_floor(ctx, a);
3534+
ggml_set_name(out, "out");
3535+
3536+
return out;
3537+
}
3538+
3539+
void initialize_tensors(ggml_context * ctx) override {
3540+
for (ggml_tensor * t = ggml_get_first_tensor(ctx); t != NULL; t = ggml_get_next_tensor(ctx, t)) {
3541+
init_tensor_uniform(t, -10.0f, 10.0f);
3542+
}
3543+
}
3544+
3545+
float grad_eps() override {
3546+
return 1.0f;
3547+
}
3548+
3549+
bool grad_precise() override {
3550+
return true;
3551+
}
3552+
};
3553+
35153554
// GGML_OP_SIN
35163555
struct test_sin : public test_case {
35173556
const ggml_type type;
@@ -6176,6 +6215,7 @@ static std::vector<std::unique_ptr<test_case>> make_test_cases_eval() {
61766215
test_cases.emplace_back(new test_sqr(type));
61776216
test_cases.emplace_back(new test_sqrt(type));
61786217
test_cases.emplace_back(new test_log(type));
6218+
test_cases.emplace_back(new test_floor(type));
61796219
test_cases.emplace_back(new test_sin(type));
61806220
test_cases.emplace_back(new test_cos(type));
61816221
test_cases.emplace_back(new test_clamp(type));

vendor/miniaudio/miniaudio.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28227,7 +28227,7 @@ static ma_result ma_device_start__alsa(ma_device* pDevice)
2822728227
}
2822828228

2822928229
if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) {
28230-
/*
28230+
/*
2823128231
When data is written to the device we wait for the device to get ready to receive data with poll(). In my testing
2823228232
I have observed that poll() can sometimes block forever unless the device is started explicitly with snd_pcm_start()
2823328233
or some data is written with snd_pcm_writei().
@@ -34520,7 +34520,7 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev
3452034520
#endif
3452134521
}
3452234522

34523-
34523+
3452434524
status = ((ma_AudioUnitSetProperty_proc)pContext->coreaudio.AudioUnitSetProperty)(pData->audioUnit, kAudioUnitProperty_StreamFormat, formatScope, formatElement, &bestFormat, sizeof(bestFormat));
3452534525
if (status != noErr) {
3452634526
((ma_AudioComponentInstanceDispose_proc)pContext->coreaudio.AudioComponentInstanceDispose)(pData->audioUnit);
@@ -38526,7 +38526,7 @@ static ma_result ma_device_reinit__aaudio(ma_device* pDevice, ma_device_type dev
3852638526
ma_device_stop(pDevice); /* Do a full device stop so we set internal state correctly. */
3852738527
}
3852838528
}
38529-
38529+
3853038530
result = MA_SUCCESS;
3853138531
}
3853238532
done:

0 commit comments

Comments
 (0)