ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
sweep_block_internal.h
Go to the documentation of this file.
1
31#pragma once
32
33#include <stdint.h>
34
35#include "ra8_attributes.h"
36#include "ra8_vsource.h"
37#include "sweep_block.h"
38
63
87 const char* name;
89 int (*setup)(cbs_backend_t* be,
90 ra8_vsource_read_fn payload_read,
91 void* payload_ctx,
92 uint32_t blob_bytes,
93 uint32_t block_bytes,
94 cb_sweep_config_t* config);
96 void (*teardown)(cbs_backend_t* be);
98 void* read_ctx;
99 uint64_t backing_bytes;
100 const uint64_t* src_bytes;
101};
102
117typedef struct {
118 const char* backend;
119 const char* leg;
120 uint32_t block_bytes;
121 uint32_t frames;
122 uint64_t reads;
123 uint64_t hits;
124 uint64_t misses;
125 uint64_t evictions;
126 uint64_t be_calls;
127 uint64_t be_bytes;
128 uint64_t src_bytes;
129 uint64_t backing_bytes;
130 uint64_t wall_ns;
131} cbs_row_t;
132
143typedef struct {
145 void* inner_ctx;
146 uint64_t calls;
147 uint64_t bytes;
149
151typedef struct {
152 uint64_t rng;
153 uint32_t word_index;
154 uint32_t word_offset;
155 uint32_t sentence_words;
156 uint8_t phase;
158
166
180
198RA8_PRIV int priv_payload_init(cbs_payload_t* payload, void* workspace, size_t capacity);
199
219RA8_PRIV ra8_err_t priv_payload_read(void* ctx, uint64_t offset, uint8_t* buffer, uint32_t length);
220
239RA8_PRIV uint64_t priv_now_ns(void);
240
265RA8_PRIV ra8_err_t priv_meter_read(void* ctx, uint64_t offset, uint8_t* buf, uint32_t len);
266
284RA8_PRIV cbs_backend_t* priv_backends(uint32_t* out_count);
285
308RA8_PRIV int priv_print_row(cb_sink_t* sink, const cbs_row_t* r);
309
339 const cbs_row_t* rows,
340 uint32_t nrows,
341 const char* be,
342 const uint32_t* blocks,
343 uint32_t nblocks);
344
372 const cbs_row_t* rows,
373 uint32_t nrows,
374 const char* be,
375 const uint32_t* blocks,
376 uint32_t nblocks);
377
407 const cbs_row_t* rows,
408 uint32_t nrows,
409 const uint32_t* blocks,
410 uint32_t nblocks);
Annotation-attribute framework macros for ra8-firmware.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Virtual-memory object sources – the page-cache storage seam (Layer 1, #147).
ra8_err_t(* ra8_vsource_read_fn)(void *ctx, uint64_t offset, uint8_t *buf, uint32_t len)
Read len bytes at offset from a paged object's backing.
Definition ra8_vsource.h:79
Injected output sink.
Caller-owned bindings for the block sweep.
Definition sweep_block.h:51
One byte-addressed backing store the sweep reads through – the backend DIP seam the #208 hardware leg...
uint64_t backing_bytes
On-medium size of the backing, in bytes.
const uint64_t * src_bytes
Raw medium-byte counter, or NULL if == delivered.
const char * name
Backend name for the report rows.
ra8_vsource_read_fn read
Byte reader over the backing (set by setup).
int(* setup)(cbs_backend_t *be, ra8_vsource_read_fn payload_read, void *payload_ctx, uint32_t blob_bytes, uint32_t block_bytes, cb_sweep_config_t *config)
Build the backing for blob at block_bytes; 0 on success.
void(* teardown)(cbs_backend_t *be)
Release everything setup acquired (idempotent).
void * read_ctx
Context for read (set by setup).
Counting shim around an ra8_vsource_read_fn.
uint64_t bytes
Bytes served through the shim.
uint64_t calls
Read calls forwarded so far.
void * inner_ctx
Context for inner.
ra8_vsource_read_fn inner
Wrapped reader.
Serializable pseudo-text generator cursor.
uint64_t rng
PRNG state.
uint32_t word_index
Selected word or sentinel.
uint32_t word_offset
Byte position in the selected word.
uint8_t phase
Word/separator phase.
uint32_t sentence_words
Words emitted in the current sentence.
Resettable exact pseudo-text byte source with bounded checkpoints.
uint64_t cursor_offset
End offset cached for sequential reads.
const void * checkpoints
Caller-owned generator-state index.
cbs_payload_state_t cursor_state
State at cursor_offset.
uint32_t checkpoint_count
Entries in the index.
One measured (backend, leg, block size) result row.
uint64_t evictions
ra8_vmem evictions.
const char * leg
Workload leg: "seq" or "hot".
uint64_t reads
Reader requests issued.
uint64_t backing_bytes
On-medium backing size at this block size.
uint32_t frames
Cache frames at this size (budget / block).
uint64_t wall_ns
Wall-clock time of the timed loop, in ns.
uint64_t be_calls
Backend read calls (storage commands).
uint32_t block_bytes
Swept block / frame / chunk size in bytes.
uint64_t be_bytes
Bytes delivered to the cache by the backend.
uint64_t misses
ra8_vmem misses.
const char * backend
Backend name (cbs_backend_t.name).
uint64_t hits
ra8_vmem hits.
uint64_t src_bytes
Raw medium bytes moved (compressed for RBKC).
#208 block/frame-size sweep: the byte-size axis the capacity sweep never touches, so the chunked ....
ra8_err_t priv_meter_read(void *ctx, uint64_t offset, uint8_t *buf, uint32_t len)
ra8_vsource_read_fn forwarding through a cbs_meter_t.
int priv_print_hot_table(cb_sink_t *sink, const cbs_row_t *rows, uint32_t nrows, const char *be, const uint32_t *blocks, uint32_t nblocks)
Print one backend's same-block re-read summary table (leg b).
cbs_dim_t
Workload geometry and fixed sweep parameters.
@ k_cbs_hot_reads
Accesses in the same-block re-read leg.
@ k_cbs_bucket_min
Minimum hash-bucket count for tiny caches.
@ k_cbs_ns_per_us
Nanoseconds per microsecond.
@ k_cbs_cache_bytes
1 MiB resident cache budget (constant).
@ k_cbs_seq_passes
Whole-object passes in the seq leg.
@ k_cbs_blob_bytes
8 MiB payload (2^23; all sizes divide it).
@ k_cbs_max_rows
2 backends x 6 sizes x 2 legs.
@ k_cbs_kib
Bytes per KiB (block-size labels).
@ k_cbs_knee_pct
%% of peak throughput that names the knee.
@ k_cbs_default_chunk
#204 .rabook chunk-size default.
@ k_cbs_words_per_dot
Words per sentence in the text filler.
@ k_cbs_req_bytes
Reader request grain (divides every size).
@ k_cbs_ns_per_s
Nanoseconds per second.
int priv_payload_init(cbs_payload_t *payload, void *workspace, size_t capacity)
Build the payload source index into caller-owned storage.
int priv_print_crossover(cb_sink_t *sink, const cbs_row_t *rows, uint32_t nrows, const uint32_t *blocks, uint32_t nblocks)
Name the measured crossover and print the chunk-size recommendation.
int priv_print_row(cb_sink_t *sink, const cbs_row_t *r)
Print one machine-parseable result row (sweep-block key=value ...).
int priv_print_seq_table(cb_sink_t *sink, const cbs_row_t *rows, uint32_t nrows, const char *be, const uint32_t *blocks, uint32_t nblocks)
Print one backend's sequential-scan summary table (leg a).
ra8_err_t priv_payload_read(void *ctx, uint64_t offset, uint8_t *buffer, uint32_t length)
Read exact historical pseudo-text bytes at any bounded offset.
cbs_backend_t * priv_backends(uint32_t *out_count)
Expose the registered sweep backends (the seam the HW leg extends).
size_t priv_payload_workspace_required(void)
Return exact workspace bytes required by the pseudo-text source index.
uint64_t priv_now_ns(void)
Monotonic wall-clock in nanoseconds.
struct cbs_backend cbs_backend_t