aien-train
AIEN training programme: language-model history, GB10 constraints and the route to training on the project engine. Plans and runnable checks are distinguished.
Brought by drakestapleton
aien-train / tests / omegese45 / core / mutate.om
| 1 | note SPDX-License-Identifier: AGPL-3.0-only |
| 2 | note Native source fault injector for native/omegese45/core/model.om (aien-train #45). |
| 3 | note Reads one ASCII mode byte then model.om; writes the mutant to stdout. Exactly one |
| 4 | note match is required (rc 76 otherwise). Mode 0 flips the sign of the output gradient |
| 5 | note (the gradient check must fail, rc 86); mode 1 makes the target the id one position |
| 6 | note later (the mask/target oracle comparison must fail). |
| 7 | global opmin uchar 65536 |
| 8 | global opmmd ulong 1 |
| 9 | text opm0n "put opgy v mul 2.0f32 d\n" |
| 10 | text opm0r "put opgy v mul -2.0f32 d\n" |
| 11 | text opm1n "ret ulong get opseq t\n" |
| 12 | text opm1r "ret ulong get opseq add t 1\n" |
| 13 | |
| 14 | fn opmsize to ulong |
| 15 | if eq get opmmd 0 0 |
| 16 | ret len opm0n |
| 17 | end |
| 18 | ret len opm1n |
| 19 | end |
| 20 | |
| 21 | fn opmpat i ulong to uchar |
| 22 | if eq get opmmd 0 0 |
| 23 | ret get opm0n i |
| 24 | end |
| 25 | ret get opm1n i |
| 26 | end |
| 27 | |
| 28 | fn opmemit to void |
| 29 | if eq get opmmd 0 0 |
| 30 | n = write 1 opm0r 0 len opm0r |
| 31 | if ne n long len opm0r |
| 32 | exit 74 |
| 33 | end |
| 34 | ret |
| 35 | end |
| 36 | n = write 1 opm1r 0 len opm1r |
| 37 | if ne n long len opm1r |
| 38 | exit 74 |
| 39 | end |
| 40 | end |
| 41 | |
| 42 | fn opmat pos ulong to bool |
| 43 | for i ulong opmsize |
| 44 | if ne get opmin add pos i opmpat i |
| 45 | ret false |
| 46 | end |
| 47 | end |
| 48 | ret true |
| 49 | end |
| 50 | |
| 51 | fn main to int |
| 52 | p = ulong 0 |
| 53 | rd = true |
| 54 | while rd bound 65537 |
| 55 | if eq p 65536 |
| 56 | ret 75 |
| 57 | end |
| 58 | n = read 0 opmin p sub 65536 p |
| 59 | if eq n 0 |
| 60 | rd = false |
| 61 | else |
| 62 | if lt n 0 |
| 63 | ret 74 |
| 64 | end |
| 65 | p = add p ulong n |
| 66 | end |
| 67 | end |
| 68 | if lt p 2 |
| 69 | ret 75 |
| 70 | end |
| 71 | m = get opmin 0 |
| 72 | if or lt m 48 gt m 49 |
| 73 | ret 75 |
| 74 | end |
| 75 | put opmmd 0 ulong sub m 48 |
| 76 | ln = opmsize |
| 77 | if le p ln |
| 78 | ret 75 |
| 79 | end |
| 80 | found = ulong 0 |
| 81 | where = ulong 0 |
| 82 | for s ulong sub p ln |
| 83 | pos = add s 1 |
| 84 | if opmat pos |
| 85 | found = add found 1 |
| 86 | where = pos |
| 87 | end |
| 88 | end |
| 89 | if ne found 1 |
| 90 | ret 76 |
| 91 | end |
| 92 | n = write 1 opmin 1 sub where 1 |
| 93 | if ne n long sub where 1 |
| 94 | ret 74 |
| 95 | end |
| 96 | opmemit |
| 97 | tl = add where ln |
| 98 | n = write 1 opmin tl sub p tl |
| 99 | if ne n long sub p tl |
| 100 | ret 74 |
| 101 | end |
| 102 | ret 0 |
| 103 | end |