use heap hints where possible in benchmark#10121
use heap hints where possible in benchmark#10121JacobBarthelmeh wants to merge 1 commit intowolfSSL:masterfrom
Conversation
There was a problem hiding this comment.
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_HINTintoXMALLOC/XFREEfor benchmark stats tracking. - Pass
HEAP_HINTinto several*_Initfunctions 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); |
There was a problem hiding this comment.
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.
| bench_stats_prepare(); | ||
|
|
||
| ret = wc_AesInit(&enc, NULL, INVALID_DEVID); | ||
| ret = wc_AesInit(&enc, HEAP_HINT, INVALID_DEVID); |
There was a problem hiding this comment.
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.
| ret = wc_AesInit(&enc, HEAP_HINT, INVALID_DEVID); | |
| ret = wc_AesInit(&enc, HEAP_HINT, devId); |
| 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); |
There was a problem hiding this comment.
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.
No description provided.