Skip to content

benchmarks: Add sudoku_search constraint solver#212

Open
OmerFarkash wants to merge 1 commit intoembench:masterfrom
OmerFarkash:add-sudoku-benchmark
Open

benchmarks: Add sudoku_search constraint solver#212
OmerFarkash wants to merge 1 commit intoembench:masterfrom
OmerFarkash:add-sudoku-benchmark

Conversation

@OmerFarkash
Copy link
Copy Markdown

Description:
This commit introduces a new integer-heavy benchmark based on a recursive backtracking algorithm to solve a 25x25 Sudoku puzzle. The workload is designed to provide a stable, measurable execution time on modern high-performance embedded cores while remaining portable to 32-bit targets.

Key Features:

Workload Characteristics: Exercises recursive stack frame management, deep recursion depth, and high-frequency conditional branching via constraint-checking logic.

Self-Verification: Includes a robust verify_benchmark function. It performs a post-execution pass to ensure the grid is fully populated and validates each cell against Sudoku constraints (row, column, and subgrid) using the is_safe logic. This ensures that the performance metrics reflect a functionally correct execution.

Predictable Baseline: Configured with a 25x25 grid to achieve a ~4000ms baseline, allowing for accurate speed scoring across various ISA implementations.

Verification Results:

Code Size: 592 bytes (Text section).

Performance: Achieved a consistent Speed score of 400.00 on x86_64 native target against the 4000ms reference.

Portability: Verified compilation and logic structure for RISC-V (rv32imac) targets.

Files modified/added:
src/sudoku_search/sudoku_search.c: Core implementation, recursive solver, and Embench API.
src/sudoku_search/sudoku_search.h: Grid configuration (BOARD_SIZE 25), constants, and headers.
baseline-data/size.json: Added baseline memory footprints (Text, ROData, BSS).
baseline-data/speed.json: Added reference timing (4000ms).

This commit introduces a new integer-heavy benchmark based on a
recursive backtracking algorithm to solve a 25x25 Sudoku puzzle.

The workload is designed to exercise:
- Recursive stack frame management and depth.
- Conditional branching performance (via constraint checking).
- Global/Static data access patterns.

A 25x25 grid was chosen to provide a stable, measurable execution
time on modern high-performance embedded cores while remaining
portable to small 32-bit targets.

The benchmark includes a verification function to ensure functional
correctness after execution.

Files modified/added:
* src/sudoku_search/sudoku_search.c: Core implementation and API.
* src/sudoku_search/sudoku_search.h: Grid configuration and headers.
* baseline-data/size.json: Added baseline memory footprints.
* baseline-data/speed.json: Added reference timing (4000ms).
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