code wiki / _hdl_build / nx_self_measure_cost.nx

nx_self_measure_cost.nx

buildroot/runtime/_hdl_build/nx_self_measure_cost.nx

2601 B53 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind librarytopic self
docsdependenciesstructsconstsfunctions

about

nx_self_measure_cost.nx -- BUILD OUR OWN cost data, on whatever chip the seed lands on. uops.info only characterizes Intel; this measures THIS silicon directly with rdtsc/rdcycle -- so a sovereign RV64 core, an ARM garden sensor, or a throttled/damaged unit each get a REAL profile uops.info never had. The node times dependent op-chains (latency) and normalizes to add. This is the seed growing to meet its hardware's measured reality (Cardinal: optimize to THIS chip).

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_self_measure_cost.nx nx_cost_federation_test.nx

imports: nx_syscalls.nx

imported by: nx_cost_federation_test.nx

structs

none

consts

9const SM_MAGIC_3750763034362895579: i64 = 3750763034362895579
10const SM_MAGIC_1099511628211: i64 = 1099511628211
12const SM_ITERS: i64 = 2000000

functions

16func sm_add() -> i64 { let t0: i64 = __rdtsc(); var a: i64 = 7; var i: i64 = 0; while i < SM_ITERS { a = a + i; i = i + 1 } let t1: i64 = __rdtsc(); if a == 0 - 1 { sys_write(1, "" as *u8, 0) } return t1 - t0 }
called by 1: sm_profile calls 1: sys_write
17func sm_mul() -> i64 { let t0: i64 = __rdtsc(); var a: i64 = 7; var i: i64 = 0; while i < SM_ITERS { a = a * 3; a = a | 1; i = i + 1 } let t1: i64 = __rdtsc(); if a == 0 - 1 { sys_write(1, "" as *u8, 0) } return t1 - t0 }
called by 1: sm_profile calls 1: sys_write
18func sm_shl() -> i64 { let t0: i64 = __rdtsc(); var a: i64 = 7; var i: i64 = 0; while i < SM_ITERS { a = a << 1; a = a | 1; i = i + 1 } let t1: i64 = __rdtsc(); if a == 0 - 1 { sys_write(1, "" as *u8, 0) } return t1 - t0 }
called by 1: sm_profile calls 1: sys_write
22func sm_profile(out: *i64) -> i64
called by 1: main calls 3: sm_addsm_mulsm_shl
40func sm_sane(p: *i64) -> i64
called by 1: cf_contribute
48func sm_hash(p: *i64, n: i64) -> i64
called by 1: cf_contribute