nx_trig_kat.nx
buildroot/runtime/nx_trig_kat.nx
about
nx_trig_kat.nx -- KAT for nx_f32_cos/nx_f32_sin at rope-realistic arguments. RoPE at position p rotates the
i=0 (highest-freq) dim by angle p -> cos(p)/sin(p) for p up to seq_len. If the range reduction is only good
near 0, varied multi-token sequences get corrupted rope on the fast dims (masked by repetition = the residual
bug after the QKV-bias fix). Self-consistency check: cos^2+sin^2 == 1.0 (0x3F800000) for ALL args; a deviation
at larger args localizes a range-reduction bug. Also checks cos(0)=1, sin(0)=0. expect_exit: 0
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_tier.nxnx_f32.nxnx_f32_sincos.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 11 | func pw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 12 | func ph(v: i64) -> i64 { let b: *u8=sys_mmap(8); var i: i64=0; while i<8 { let nib: i64=(v>>((7-i)*4))&0xF; if nib<10 {b[i]=(48+nib) as u8} else {b[i]=(87+nib) as u8} i=i+1 } sys_write(1,b,8); return 0 } |
| 15 | func near_one(sum: i64) -> i64 called by 1: one |
| 22 | func one(label: *u8, x: i64) -> i64 |
| 34 | func main() -> i64 |