Skip to content

use heap hints where possible in benchmark#10121

Open
JacobBarthelmeh wants to merge 1 commit intowolfSSL:masterfrom
JacobBarthelmeh:bench
Open

use heap hints where possible in benchmark#10121
JacobBarthelmeh wants to merge 1 commit intowolfSSL:masterfrom
JacobBarthelmeh:bench

Conversation

@JacobBarthelmeh
Copy link
Copy Markdown
Contributor

No description provided.

@JacobBarthelmeh JacobBarthelmeh self-assigned this Apr 1, 2026
Copilot AI review requested due to automatic review settings April 1, 2026 21:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the wolfCrypt benchmark to pass heap hints into allocation/init APIs so benchmark objects can be allocated from the configured heap.

Changes:

  • Pass HEAP_HINT into XMALLOC/XFREE for benchmark stats tracking.
  • Pass HEAP_HINT into several *_Init functions used by benchmark routines.
  • Switch Falcon initialization to wc_falcon_init_ex(...) to allow heap-hint/device-id aware init.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

ret = wc_LmsKey_Init(&key, NULL, INVALID_DEVID);
ret = wc_LmsKey_Init(&key, HEAP_HINT, devId);
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

This PR is titled around using heap hints, but this change (and several others in the diff) also switches the device id argument from INVALID_DEVID to devId, which can materially change runtime behavior (e.g., selecting a crypto device/accelerator). If the devId switch is intentional, please update the PR title/description accordingly; otherwise, consider keeping the device-id argument unchanged and limiting the PR to heap-hint wiring.

Copilot uses AI. Check for mistakes.
bench_stats_prepare();

ret = wc_AesInit(&enc, NULL, INVALID_DEVID);
ret = wc_AesInit(&enc, HEAP_HINT, INVALID_DEVID);
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

Device-id usage is inconsistent across benchmarks: many call sites in this PR were changed to pass devId, but AES-OFB still uses INVALID_DEVID. If devId is the benchmark’s intended device selection mechanism, consider standardizing on devId here too for consistent behavior and easier benchmarking comparisons across algorithms.

Suggested change
ret = wc_AesInit(&enc, HEAP_HINT, INVALID_DEVID);
ret = wc_AesInit(&enc, HEAP_HINT, devId);

Copilot uses AI. Check for mistakes.
Comment on lines +14232 to +14234
ret = wc_falcon_init_ex(&key, HEAP_HINT, devId);
if (ret != 0) {
printf("wc_falcon_init failed %d\n", ret);
printf("wc_falcon_init_ex failed %d\n", ret);
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

Switching from wc_falcon_init to wc_falcon_init_ex may reduce build compatibility if some configurations expose Falcon but not the _ex initializer. Consider gating this with an appropriate feature macro and falling back to wc_falcon_init(&key) when _ex isn’t available, while still using heap-hint/device-id aware init when it is.

Copilot uses AI. Check for mistakes.
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.

2 participants