Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(plugin): Cleanup and consolidate functions #153

Merged
merged 3 commits into from
Jan 20, 2025

Conversation

papazof
Copy link
Collaborator

@papazof papazof commented Jan 10, 2025

Cleanup, rename and consolidate plugin/op-related functions:

  • Move and cleanup op-related declarations/macros from plugin.h to op.h
  • Move plugin-related functions from vaccel.c to plugin.c
  • Rename plugin-related functions and add plugin_ prefix
  • Cleanup and expose both vaccel_plugin_load() and vaccel_parse_and_load()
  • Remove fs check from vaccel_plugin_load() so the user can provide libraries without a full path. dlopen will search in the library path if only a library filename is provided
  • Remove redundant misc.c|h and related tests
  • Remove plugin_register|unregister() from public headers, since they are not currently meant to be used explicitly
  • Update ops with proper function pointer types for plugin_get_op_func()
    results

@papazof papazof force-pushed the refactor_plugin_cleanup_and_consolidate branch from fc15b6a to 3a952c8 Compare January 10, 2025 16:31
@papazof papazof marked this pull request as ready for review January 13, 2025 19:16
@papazof papazof force-pushed the refactor_plugin_cleanup_and_consolidate branch from 3a952c8 to 1a80696 Compare January 13, 2025 19:35
@papazof papazof marked this pull request as draft January 13, 2025 20:15
@papazof papazof marked this pull request as ready for review January 14, 2025 16:38
@papazof papazof requested review from ilagomatis and ananos January 14, 2025 17:06
@papazof papazof force-pushed the refactor_plugin_cleanup_and_consolidate branch from 56618ce to d1b854b Compare January 14, 2025 17:23
Copy link
Contributor

@ilagomatis ilagomatis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @papazof, very interesting changes!

papazof and others added 3 commits January 17, 2025 15:32
Cleanup, rename and consolidate plugin/op-related functions:
- Move and cleanup op-related declarations/macros from `plugin.h` to
  `op.h`
- Move plugin-related functions from `vaccel.c` to `plugin.c`
- Rename plugin-related functions and add `plugin_` prefix
- Cleanup and expose both `vaccel_plugin_load()` and
  `vaccel_parse_and_load()`
- Remove fs check from `vaccel_plugin_load()` so the user can provide
  libraries without a full path. `dlopen` will search in the library
  path if only a library filename is provided
- Remove redundant `misc.c|h` and related tests
- Remove `plugin_register|unregister()` from public headers, since they
  are not currently meant to be used explicitly

PR: #153
Signed-off-by: Kostis Papazafeiropoulos <[email protected]>
Reviewed-by: Ilias Lagomatis <[email protected]>
Approved-by: Ilias Lagomatis <[email protected]>
Update ops with proper function pointer types for `plugin_get_op_func()`
results

PR: #153
Signed-off-by: Kostis Papazafeiropoulos <[email protected]>
Reviewed-by: Ilias Lagomatis <[email protected]>
Approved-by: Ilias Lagomatis <[email protected]>
PR: #153
Signed-off-by: github-actions[bot] <[email protected]>
Reviewed-by: Ilias Lagomatis <[email protected]>
Approved-by: Ilias Lagomatis <[email protected]>
@github-actions github-actions bot force-pushed the refactor_plugin_cleanup_and_consolidate branch from f6c47ee to 975e0b7 Compare January 17, 2025 15:32
Copy link
Contributor

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-tidy (v18.1.8) reports: 106 concern(s)
  • examples/classify_generic.c:15:16: warning: [readability-magic-numbers]

    512 is a magic number; consider replacing it with a named constant

       15 |         char out_text[512];
          |                       ^
  • examples/classify_generic.c:16:21: warning: [readability-magic-numbers]

    512 is a magic number; consider replacing it with a named constant

       16 |         char out_imagename[512];
          |                            ^
  • examples/depth_generic.c:15:21: warning: [readability-magic-numbers]

    512 is a magic number; consider replacing it with a named constant

       15 |         char out_imagename[512];
          |                            ^
  • examples/detect_generic.c:15:21: warning: [readability-magic-numbers]

    512 is a magic number; consider replacing it with a named constant

       15 |         char out_imagename[512];
          |                            ^
  • examples/exec_generic.c:31:10: warning: [readability-magic-numbers]

    10 is a magic number; consider replacing it with a named constant

       31 |         input = 10; /* some random input value */
          |                 ^
  • examples/minmax_generic.c:21:14: warning: [readability-magic-numbers]

    5 is a magic number; consider replacing it with a named constant

       21 |         if (argc != 5) {
          |                     ^
  • examples/minmax_generic.c:76:25: warning: [readability-magic-numbers]

    5 is a magic number; consider replacing it with a named constant

       76 |         struct vaccel_arg read[5] = {
          |                                ^
  • examples/minmax_generic.c:90:41: warning: [readability-magic-numbers]

    5 is a magic number; consider replacing it with a named constant

       90 |         ret = vaccel_genop(&session, &read[0], 5, &write[0], 3);
          |                                                ^
  • examples/minmax_generic.c:100:33: warning: [readability-magic-numbers]

    10e3 is a magic number; consider replacing it with a named constant

      100 |                 max, time_diff_usec(t0, t1) / 10e3);
          |                                               ^
  • examples/pose_generic.c:15:21: warning: [readability-magic-numbers]

    512 is a magic number; consider replacing it with a named constant

       15 |         char out_imagename[512];
          |                            ^
  • examples/pynq_array_copy_generic.c:13:8: warning: [readability-magic-numbers]

    6 is a magic number; consider replacing it with a named constant

       13 |         int a[6] = { 12, 15, 12, 15, 12, 11 };
          |               ^
  • examples/pynq_array_copy_generic.c:13:15: warning: [readability-magic-numbers]

    12 is a magic number; consider replacing it with a named constant

       13 |         int a[6] = { 12, 15, 12, 15, 12, 11 };
          |                      ^
  • examples/pynq_array_copy_generic.c:13:19: warning: [readability-magic-numbers]

    15 is a magic number; consider replacing it with a named constant

       13 |         int a[6] = { 12, 15, 12, 15, 12, 11 };
          |                          ^
  • examples/pynq_array_copy_generic.c:13:23: warning: [readability-magic-numbers]

    12 is a magic number; consider replacing it with a named constant

       13 |         int a[6] = { 12, 15, 12, 15, 12, 11 };
          |                              ^
  • examples/pynq_array_copy_generic.c:13:27: warning: [readability-magic-numbers]

    15 is a magic number; consider replacing it with a named constant

       13 |         int a[6] = { 12, 15, 12, 15, 12, 11 };
          |                                  ^
  • examples/pynq_array_copy_generic.c:13:31: warning: [readability-magic-numbers]

    12 is a magic number; consider replacing it with a named constant

       13 |         int a[6] = { 12, 15, 12, 15, 12, 11 };
          |                                      ^
  • examples/pynq_array_copy_generic.c:13:35: warning: [readability-magic-numbers]

    11 is a magic number; consider replacing it with a named constant

       13 |         int a[6] = { 12, 15, 12, 15, 12, 11 };
          |                                          ^
  • examples/pynq_array_copy_generic.c:14:8: warning: [readability-magic-numbers]

    6 is a magic number; consider replacing it with a named constant

       14 |         int b[6];
          |               ^
  • examples/pynq_array_copy_generic.c:41:2: warning: [readability-avoid-unconditional-preprocessor-if]

    preprocessor condition is always 'false', consider removing both the condition and its contents

       41 | #if 0
          |  ^
  • examples/pynq_array_copy_generic.c:49:22: warning: [readability-magic-numbers]

    6 is a magic number; consider replacing it with a named constant

       49 |         for (int i = 0; i < 6; i++) {
          |                             ^
  • examples/pynq_parallel_generic.c:18:30: warning: [readability-magic-numbers]

    5 is a magic number; consider replacing it with a named constant

       18 |         float b[N * N] = { 2, 3, 4, 5 };
          |                                     ^
  • examples/pynq_vector_add_generic.c:13:10: warning: [readability-magic-numbers]

    5 is a magic number; consider replacing it with a named constant

       13 |         float a[5] = { 5.0, 1.0, 2.1, 1.2, 5.2 };
          |                 ^
  • examples/pynq_vector_add_generic.c:13:17: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'double' to 'float'

       13 |         float a[5] = { 5.0, 1.0, 2.1, 1.2, 5.2 };
          |                        ^
  • examples/pynq_vector_add_generic.c:13:17: warning: [readability-magic-numbers]

    5.0 is a magic number; consider replacing it with a named constant

  • examples/pynq_vector_add_generic.c:13:22: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'double' to 'float'

       13 |         float a[5] = { 5.0, 1.0, 2.1, 1.2, 5.2 };
          |                             ^
  • examples/pynq_vector_add_generic.c:13:27: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'double' to 'float'

       13 |         float a[5] = { 5.0, 1.0, 2.1, 1.2, 5.2 };
          |                                  ^
  • examples/pynq_vector_add_generic.c:13:27: warning: [readability-magic-numbers]

    2.1 is a magic number; consider replacing it with a named constant

  • examples/pynq_vector_add_generic.c:13:32: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'double' to 'float'

       13 |         float a[5] = { 5.0, 1.0, 2.1, 1.2, 5.2 };
          |                                       ^
  • examples/pynq_vector_add_generic.c:13:32: warning: [readability-magic-numbers]

    1.2 is a magic number; consider replacing it with a named constant

  • examples/pynq_vector_add_generic.c:13:37: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'double' to 'float'

       13 |         float a[5] = { 5.0, 1.0, 2.1, 1.2, 5.2 };
          |                                            ^
  • examples/pynq_vector_add_generic.c:13:37: warning: [readability-magic-numbers]

    5.2 is a magic number; consider replacing it with a named constant

  • examples/pynq_vector_add_generic.c:14:10: warning: [readability-magic-numbers]

    5 is a magic number; consider replacing it with a named constant

       14 |         float b[5] = { -2.2, 1.1, 6.4, 2.3, 6.1 };
          |                 ^
  • examples/pynq_vector_add_generic.c:14:17: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'double' to 'float'

       14 |         float b[5] = { -2.2, 1.1, 6.4, 2.3, 6.1 };
          |                        ^
  • examples/pynq_vector_add_generic.c:14:18: warning: [readability-magic-numbers]

    2.2 is a magic number; consider replacing it with a named constant

       14 |         float b[5] = { -2.2, 1.1, 6.4, 2.3, 6.1 };
          |                         ^
  • examples/pynq_vector_add_generic.c:14:23: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'double' to 'float'

       14 |         float b[5] = { -2.2, 1.1, 6.4, 2.3, 6.1 };
          |                              ^
  • examples/pynq_vector_add_generic.c:14:23: warning: [readability-magic-numbers]

    1.1 is a magic number; consider replacing it with a named constant

  • examples/pynq_vector_add_generic.c:14:28: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'double' to 'float'

       14 |         float b[5] = { -2.2, 1.1, 6.4, 2.3, 6.1 };
          |                                   ^
  • examples/pynq_vector_add_generic.c:14:28: warning: [readability-magic-numbers]

    6.4 is a magic number; consider replacing it with a named constant

  • examples/pynq_vector_add_generic.c:14:33: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'double' to 'float'

       14 |         float b[5] = { -2.2, 1.1, 6.4, 2.3, 6.1 };
          |                                        ^
  • examples/pynq_vector_add_generic.c:14:33: warning: [readability-magic-numbers]

    2.3 is a magic number; consider replacing it with a named constant

  • examples/pynq_vector_add_generic.c:14:38: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'double' to 'float'

       14 |         float b[5] = { -2.2, 1.1, 6.4, 2.3, 6.1 };
          |                                             ^
  • examples/pynq_vector_add_generic.c:14:38: warning: [readability-magic-numbers]

    6.1 is a magic number; consider replacing it with a named constant

  • examples/pynq_vector_add_generic.c:15:10: warning: [readability-magic-numbers]

    5 is a magic number; consider replacing it with a named constant

       15 |         float c[5] = { 0, 0, 0, 0, 0 };
          |                 ^
  • examples/segment_generic.c:15:21: warning: [readability-magic-numbers]

    512 is a magic number; consider replacing it with a named constant

       15 |         char out_imagename[512];
          |                            ^
  • examples/sgemm_generic.c:23:4: warning: [bugprone-implicit-widening-of-multiplication-result]

    result of multiplication in type 'int' is used as a pointer offset after an implicit widening conversion to type 'ptrdiff_t'

       23 |                         ELEM_2D(A, i, j, k) = ((float)i * j) / m;
          |                         ^
    ../examples/sgemm_generic.c:13:37: note: expanded from macro 'ELEM_2D'
       13 | #define ELEM_2D(array, i, j, ld) (*((array) + (i) * (ld) + (j)))
          |                                     ^
    ../examples/sgemm_generic.c:23:4: note: make conversion explicit to silence this warning
       23 |                         ELEM_2D(A, i, j, k) = ((float)i * j) / m;
          |                         ^
    ../examples/sgemm_generic.c:13:47: note: expanded from macro 'ELEM_2D'
       13 | #define ELEM_2D(array, i, j, ld) (*((array) + (i) * (ld) + (j)))
          |                                               ^~~~~~~~~~
    ../examples/sgemm_generic.c:23:4: note: perform multiplication in a wider type
       23 |                         ELEM_2D(A, i, j, k) = ((float)i * j) / m;
          |                         ^
    ../examples/sgemm_generic.c:13:47: note: expanded from macro 'ELEM_2D'
       13 | #define ELEM_2D(array, i, j, ld) (*((array) + (i) * (ld) + (j)))
          |                                               ^~~
  • examples/sgemm_generic.c:23:38: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'int' to 'float'

       23 |                         ELEM_2D(A, i, j, k) = ((float)i * j) / m;
          |                                                           ^
  • examples/sgemm_generic.c:23:43: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'int' to 'float'

       23 |                         ELEM_2D(A, i, j, k) = ((float)i * j) / m;
          |                                                                ^
  • examples/sgemm_generic.c:27:4: warning: [bugprone-implicit-widening-of-multiplication-result]

    result of multiplication in type 'int' is used as a pointer offset after an implicit widening conversion to type 'ptrdiff_t'

       27 |                         ELEM_2D(B, i, j, n) = ((float)i * j) / m;
          |                         ^
    ../examples/sgemm_generic.c:13:37: note: expanded from macro 'ELEM_2D'
       13 | #define ELEM_2D(array, i, j, ld) (*((array) + (i) * (ld) + (j)))
          |                                     ^
    ../examples/sgemm_generic.c:27:4: note: make conversion explicit to silence this warning
       27 |                         ELEM_2D(B, i, j, n) = ((float)i * j) / m;
          |                         ^
    ../examples/sgemm_generic.c:13:47: note: expanded from macro 'ELEM_2D'
       13 | #define ELEM_2D(array, i, j, ld) (*((array) + (i) * (ld) + (j)))
          |                                               ^~~~~~~~~~
    ../examples/sgemm_generic.c:27:4: note: perform multiplication in a wider type
       27 |                         ELEM_2D(B, i, j, n) = ((float)i * j) / m;
          |                         ^
    ../examples/sgemm_generic.c:13:47: note: expanded from macro 'ELEM_2D'
       13 | #define ELEM_2D(array, i, j, ld) (*((array) + (i) * (ld) + (j)))
          |                                               ^~~
  • examples/sgemm_generic.c:27:38: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'int' to 'float'

       27 |                         ELEM_2D(B, i, j, n) = ((float)i * j) / m;
          |                                                           ^
  • examples/sgemm_generic.c:27:43: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'int' to 'float'

       27 |                         ELEM_2D(B, i, j, n) = ((float)i * j) / m;
          |                                                                ^
  • examples/sgemm_generic.c:31:4: warning: [bugprone-implicit-widening-of-multiplication-result]

    result of multiplication in type 'int' is used as a pointer offset after an implicit widening conversion to type 'ptrdiff_t'

       31 |                         ELEM_2D(C, i, j, n) = ((float)i * j) / m;
          |                         ^
    ../examples/sgemm_generic.c:13:37: note: expanded from macro 'ELEM_2D'
       13 | #define ELEM_2D(array, i, j, ld) (*((array) + (i) * (ld) + (j)))
          |                                     ^
    ../examples/sgemm_generic.c:31:4: note: make conversion explicit to silence this warning
       31 |                         ELEM_2D(C, i, j, n) = ((float)i * j) / m;
          |                         ^
    ../examples/sgemm_generic.c:13:47: note: expanded from macro 'ELEM_2D'
       13 | #define ELEM_2D(array, i, j, ld) (*((array) + (i) * (ld) + (j)))
          |                                               ^~~~~~~~~~
    ../examples/sgemm_generic.c:31:4: note: perform multiplication in a wider type
       31 |                         ELEM_2D(C, i, j, n) = ((float)i * j) / m;
          |                         ^
    ../examples/sgemm_generic.c:13:47: note: expanded from macro 'ELEM_2D'
       13 | #define ELEM_2D(array, i, j, ld) (*((array) + (i) * (ld) + (j)))
          |                                               ^~~
  • examples/sgemm_generic.c:31:38: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'int' to 'float'

       31 |                         ELEM_2D(C, i, j, n) = ((float)i * j) / m;
          |                                                           ^
  • examples/sgemm_generic.c:31:43: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'int' to 'float'

       31 |                         ELEM_2D(C, i, j, n) = ((float)i * j) / m;
          |                                                                ^
  • examples/sgemm_generic.c:46:16: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'double' to 'float'

       46 |         float alpha = 32412.0;
          |                       ^
  • examples/sgemm_generic.c:46:16: warning: [readability-magic-numbers]

    32412.0 is a magic number; consider replacing it with a named constant

  • examples/sgemm_generic.c:47:15: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'double' to 'float'

       47 |         float beta = 2123.0;
          |                      ^
  • examples/sgemm_generic.c:47:15: warning: [readability-magic-numbers]

    2123.0 is a magic number; consider replacing it with a named constant

  • examples/sgemm_generic.c:96:25: warning: [readability-magic-numbers]

    8 is a magic number; consider replacing it with a named constant

       96 |         struct vaccel_arg read[8] = {
          |                                ^
  • examples/sgemm_generic.c:111:41: warning: [readability-magic-numbers]

    8 is a magic number; consider replacing it with a named constant

      111 |         ret = vaccel_genop(&session, &read[0], 8, &write[0], 1);
          |                                                ^
  • examples/sgemm_generic.c:119:28: warning: [readability-magic-numbers]

    10e3 is a magic number; consider replacing it with a named constant

      119 |                 time_diff_usec(t0, t1) / 10e3);
          |                                          ^
  • examples/sgemm_generic.c:121:28: warning: [bugprone-misplaced-widening-cast]

    either cast from 'int' to 'unsigned long' is ineffective, or there is loss of precision before the conversion

      121 |                 fwrite(C, sizeof(float), (unsigned long)(m * n), data_fp);
          |                                          ^
  • plugins/exec/vaccel.c:167:7: warning: [bugprone-multi-level-implicit-pointer-conversion]

    multilevel pointer conversion from 'void **' to 'void *', please use explicit cast

      167 |         free(dl);
          |              ^
  • plugins/mbench/vaccel.c:29:8: warning: [bugprone-narrowing-conversions]

    narrowing conversion from '__time_t' (aka 'long') to 'double'

       29 |         sts = t.tv_sec * 1e9 + t.tv_nsec; // nsec
          |               ^
  • plugins/mbench/vaccel.c:29:8: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'double' to 'uint64_t' (aka 'unsigned long')

  • plugins/mbench/vaccel.c:29:19: warning: [readability-magic-numbers]

    1e9 is a magic number; consider replacing it with a named constant

       29 |         sts = t.tv_sec * 1e9 + t.tv_nsec; // nsec
          |                          ^
  • plugins/mbench/vaccel.c:29:25: warning: [bugprone-narrowing-conversions]

    narrowing conversion from '__syscall_slong_t' (aka 'long') to 'double'

       29 |         sts = t.tv_sec * 1e9 + t.tv_nsec; // nsec
          |                                ^
  • plugins/mbench/vaccel.c:32:9: warning: [bugprone-narrowing-conversions]

    narrowing conversion from '__time_t' (aka 'long') to 'double'

       32 |                 ets = t.tv_sec * 1e9 + t.tv_nsec; // nsec
          |                       ^
  • plugins/mbench/vaccel.c:32:9: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'double' to 'uint64_t' (aka 'unsigned long')

  • plugins/mbench/vaccel.c:32:20: warning: [readability-magic-numbers]

    1e9 is a magic number; consider replacing it with a named constant

       32 |                 ets = t.tv_sec * 1e9 + t.tv_nsec; // nsec
          |                                  ^
  • plugins/mbench/vaccel.c:32:26: warning: [bugprone-narrowing-conversions]

    narrowing conversion from '__syscall_slong_t' (aka 'long') to 'double'

       32 |                 ets = t.tv_sec * 1e9 + t.tv_nsec; // nsec
          |                                        ^
  • plugins/mbench/vaccel.c:33:21: warning: [readability-magic-numbers]

    1000000 is a magic number; consider replacing it with a named constant

       33 |                 if ((ets - sts) / 1000000 >= (uint64_t)time)
          |                                   ^
  • plugins/mbench/vaccel.c:44:11: warning: [clang-diagnostic-unused-parameter]

    unused parameter 'write'

       44 |                          void *write, size_t nr_write)
          |                                ^
  • plugins/mbench/vaccel.c:44:25: warning: [clang-diagnostic-unused-parameter]

    unused parameter 'nr_write'

       44 |                          void *write, size_t nr_write)
          |                                              ^
  • plugins/noop/vaccel.c:44:19: warning: [readability-magic-numbers]

    10000.0 is a magic number; consider replacing it with a named constant

       44 |         double tmp_max = 10000.0;
          |                          ^
  • plugins/noop/vaccel.c:212:18: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'unsigned long' to signed type 'int' is implementation-defined

      212 |         int nr_output = write[0].size / sizeof(int);
          |                         ^
  • plugins/noop/vaccel.c:442:33: warning: [clang-diagnostic-unused-parameter]

    unused parameter 'status'

      442 |                                    int nr_outputs, uint8_t *status)
          |                                                             ^
  • plugins/noop/vaccel.c:569:59: warning: [clang-diagnostic-unused-parameter]

    unused parameter 'a'

      569 | static int v_mmult(struct vaccel_session *session, float *a, float *b,
          |                                                           ^
  • plugins/noop/vaccel.c:569:69: warning: [clang-diagnostic-unused-parameter]

    unused parameter 'b'

      569 | static int v_mmult(struct vaccel_session *session, float *a, float *b,
          |                                                                     ^
  • plugins/noop/vaccel.c:579:14: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'double' to 'float'

      579 |                 c_out[i] = 9.1;
          |                            ^
  • plugins/noop/vaccel.c:579:14: warning: [readability-magic-numbers]

    9.1 is a magic number; consider replacing it with a named constant

  • plugins/noop/vaccel.c:587:36: warning: [clang-diagnostic-unused-parameter]

    unused parameter 'run_options'

      587 |         const struct vaccel_torch_buffer *run_options,
          |                                           ^
  • plugins/noop/vaccel.c:669:37: warning: [clang-diagnostic-unused-parameter]

    unused parameter 'in_A'

      669 |                             struct vaccel_torch_tensor **in_A,
          |                                                          ^
  • plugins/noop/vaccel.c:670:37: warning: [clang-diagnostic-unused-parameter]

    unused parameter 'in_B'

      670 |                             struct vaccel_torch_tensor **in_B,
          |                                                          ^
  • plugins/noop/vaccel.c:671:37: warning: [clang-diagnostic-unused-parameter]

    unused parameter 'in_C'

      671 |                             struct vaccel_torch_tensor **in_C, int M, int N,
          |                                                          ^
  • plugins/noop/vaccel.c:672:44: warning: [clang-diagnostic-unused-parameter]

    unused parameter 'out'

      672 |                             int K, struct vaccel_torch_tensor **out)
          |                                                                 ^
  • plugins/noop/vaccel.c:703:2: warning: [readability-avoid-unconditional-preprocessor-if]

    preprocessor condition is always 'false', consider removing both the condition and its contents

      703 | #if 0
          |  ^
  • src/include/vaccel/plugin.h:44:41: warning: [readability-magic-numbers]

    100 is a magic number; consider replacing it with a named constant

       44 |         char *plugin_type_str = (char *)malloc(100);
          |                                                ^
  • src/include/vaccel/plugin.h:49:44: warning: [readability-magic-numbers]

    9 is a magic number; consider replacing it with a named constant

       49 |         for (i = 0; i < VACCEL_PLUGIN_TYPE_MAX >> 9; i++) {
          |                                                   ^
  • src/ops/blas.c:54:17: warning: [readability-magic-numbers]

    7 is a magic number; consider replacing it with a named constant

       54 |         if (nr_read != 7) {
          |                        ^
  • src/ops/blas.c:72:42: warning: [readability-magic-numbers]

    5 is a magic number; consider replacing it with a named constant

       72 |         long long int ldb = (long long int)read[5].size;
          |                                                 ^
  • src/ops/blas.c:73:27: warning: [readability-magic-numbers]

    5 is a magic number; consider replacing it with a named constant

       73 |         float *b = (float *)read[5].buf;
          |                                  ^
  • src/ops/blas.c:74:30: warning: [readability-magic-numbers]

    6 is a magic number; consider replacing it with a named constant

       74 |         float beta = *(float *)read[6].buf;
          |                                     ^
  • src/resource.c:363:7: warning: [bugprone-multi-level-implicit-pointer-conversion]

    multilevel pointer conversion from 'struct vaccel_file **' to 'void *', please use explicit cast

      363 |         free(res->files);
          |              ^
  • src/resource.c:468:7: warning: [bugprone-multi-level-implicit-pointer-conversion]

    multilevel pointer conversion from 'struct vaccel_file **' to 'void *', please use explicit cast

      468 |         free(res->files);
          |              ^
  • src/resource.c:628:7: warning: [bugprone-multi-level-implicit-pointer-conversion]

    multilevel pointer conversion from 'char **' to 'void *', please use explicit cast

      628 |         free(res->paths);
          |              ^
  • src/resource.c:690:7: warning: [bugprone-multi-level-implicit-pointer-conversion]

    multilevel pointer conversion from 'struct vaccel_file **' to 'void *', please use explicit cast

      690 |         free(res->files);
          |              ^
  • src/resource.c:763:7: warning: [bugprone-multi-level-implicit-pointer-conversion]

    multilevel pointer conversion from 'struct vaccel_file **' to 'void *', please use explicit cast

      763 |         free(res->files);
          |              ^
  • src/resource.c:794:8: warning: [bugprone-multi-level-implicit-pointer-conversion]

    multilevel pointer conversion from 'struct vaccel_file **' to 'void *', please use explicit cast

      794 |                 free(res->files);
          |                      ^
  • src/resource.c:811:8: warning: [bugprone-multi-level-implicit-pointer-conversion]

    multilevel pointer conversion from 'char **' to 'void *', please use explicit cast

      811 |                 free(res->paths);
          |                      ^
  • test/core/test_bootstrap_shutdown.cpp:15:1: warning: [performance-enum-size]

    enum '(unnamed enum at ../test/core/test_bootstrap_shutdown.cpp:15:1)' uses a larger base type ('unsigned int', size: 4 bytes) than necessary for its value set, consider using 'std::uint16_t' (2 bytes) as the base type to reduce its size

       15 | enum { MAX_SESSIONS = 1024, MAX_RESOURCES = 2048, MAX_RESOURCE_RUNDIR = 1024 };
          | ^
  • test/core/test_plugin.cpp:351:9: warning: [misc-include-cleaner]

    no header providing "setenv" is directly included

       24 |                 ret = setenv("VACCEL_IGNORE_VERSION", "1", 1);
          |                       ^
  • test/core/test_resource.cpp:42:41: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       42 | FAKE_VALUE_FUNC(struct vaccel_plugin *, plugin_virtio);
          |                                         ^
  • test/core/test_resource.cpp:43:22: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       43 | FAKE_VALUE_FUNC(int, net_nocurl_file_download, const char *, const char *);
          |                      ^
  • test/core/test_session.cpp:31:41: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       31 | FAKE_VALUE_FUNC(struct vaccel_plugin *, plugin_virtio);
          |                                         ^
  • test/core/test_session.cpp:34:1: warning: [performance-enum-size]

    enum '(unnamed enum at ../test/core/test_session.cpp:34:1)' uses a larger base type ('unsigned int', size: 4 bytes) than necessary for its value set, consider using 'std::uint16_t' (2 bytes) as the base type to reduce its size

       34 | enum { MAX_VACCEL_SESSIONS = 1024 };
          | ^
  • test/ops/test_minmax.cpp:67:2: warning: [misc-include-cleaner]

    no header providing "clock_gettime" is directly included

       22 |         clock_gettime(CLOCK_MONOTONIC_RAW, &t0);
          |         ^

Have any feedback or feature suggestions? Share it here.

Copy link
Contributor

Coverage report diff

Filename Stmts Miss Cover
src/misc.c -6 0 -100.00%
src/ops/fpga.c +4 +1 +2.31%
src/ops/opencv.c +1 +1 +100.00%
src/plugin.c +43 +10 -0.00%
src/session.c +1 0 +0.12%
src/vaccel.c -42 -7 -6.46%
TOTAL +1 +5 -0.13%

@papazof papazof merged commit 0255230 into main Jan 20, 2025
24 checks passed
papazof added a commit that referenced this pull request Jan 20, 2025
Cleanup, rename and consolidate plugin/op-related functions:
- Move and cleanup op-related declarations/macros from `plugin.h` to
  `op.h`
- Move plugin-related functions from `vaccel.c` to `plugin.c`
- Rename plugin-related functions and add `plugin_` prefix
- Cleanup and expose both `vaccel_plugin_load()` and
  `vaccel_parse_and_load()`
- Remove fs check from `vaccel_plugin_load()` so the user can provide
  libraries without a full path. `dlopen` will search in the library
  path if only a library filename is provided
- Remove redundant `misc.c|h` and related tests
- Remove `plugin_register|unregister()` from public headers, since they
  are not currently meant to be used explicitly

PR: #153
Signed-off-by: Kostis Papazafeiropoulos <[email protected]>
Reviewed-by: Ilias Lagomatis <[email protected]>
Approved-by: Ilias Lagomatis <[email protected]>
papazof added a commit that referenced this pull request Jan 20, 2025
Update ops with proper function pointer types for `plugin_get_op_func()`
results

PR: #153
Signed-off-by: Kostis Papazafeiropoulos <[email protected]>
Reviewed-by: Ilias Lagomatis <[email protected]>
Approved-by: Ilias Lagomatis <[email protected]>
@papazof papazof deleted the refactor_plugin_cleanup_and_consolidate branch January 20, 2025 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants