Skip to content

samples: Refactor input handling with data-driven approach#23955

Open
HanKuanChen wants to merge 1 commit intoiree-org:mainfrom
HanKuanChen:refactor-static_library_demo
Open

samples: Refactor input handling with data-driven approach#23955
HanKuanChen wants to merge 1 commit intoiree-org:mainfrom
HanKuanChen:refactor-static_library_demo

Conversation

@HanKuanChen
Copy link
Copy Markdown
Contributor

@HanKuanChen HanKuanChen commented Mar 29, 2026

  • Introduce input_buffer_descriptor_t struct to describe input buffer metadata (shape, element type, data pointer, size).
  • Add push_back_buffer_view() helper function to encapsulate buffer view allocation and input pushing logic, eliminating code duplication.
  • Use array of descriptors with a loop to process inputs, making it easier to add or modify inputs without repeating code.

This refactoring improves code maintainability and makes it simpler to work with different element types (e.g., float32, float16, uint8).

- Introduce `input_buffer_descriptor_t` struct to describe input buffer
metadata (shape, element type, data pointer, size).
- Add `push_back_buffer_view()` helper function to encapsulate buffer
view allocation and input pushing logic, eliminating code duplication.
- Use array of descriptors with a loop to process inputs, making it
easier to add or modify inputs without repeating code.

This refactoring improves code maintainability and makes it simpler to
work with different element types (e.g., float32, float16, uint8).

Signed-off-by: Han-Kuan Chen <hankuan.chen@sifive.com>
@HanKuanChen HanKuanChen force-pushed the refactor-static_library_demo branch from 274e321 to 0641dce Compare March 29, 2026 09:16
@HanKuanChen HanKuanChen changed the title samples: Add helper function for pushing buffer views with different types samples: Refactor input handling with data-driven approach Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant