Skip to content

feat(codegen): atlas-guided const-fold pilot โ€” verified literal substitution (~65%)#2086

Merged
dancinlife merged 2 commits into
mainfrom
unshadow-4-atlas-const-fold
May 29, 2026
Merged

feat(codegen): atlas-guided const-fold pilot โ€” verified literal substitution (~65%)#2086
dancinlife merged 2 commits into
mainfrom
unshadow-4-atlas-const-fold

Conversation

@dancinlife
Copy link
Copy Markdown
Contributor

๐Ÿ”ฎ UNSHADOW #4 โ€” atlas-guided const-fold ํŒŒ์ผ๋Ÿฟ (๐Ÿ”ต hexa-unique)

codegen์ด ๊ฒ€์ฆ๋œ ์ˆœ์ˆ˜-fn ํ˜ธ์ถœ(์ „๋ถ€-๋ฆฌํ„ฐ๋Ÿด ์ธ์ž)์„ atlas verdict ๋ฆฌํ„ฐ๋Ÿด๋กœ ์ง์ ‘ ์น˜ํ™˜.

fold + atlas verdict (g5 verbatim)

beenet_grid_bins(100.0,10.0) โ†’ hexa_int(11)

verify --expr beenet_grid_bins(100.0,10.0)=11.0
  calc = 11.0 โ‰ˆ 11.0 (|ฮ”|=0 โ‰ค ฮต=1e-9) ยท tier = ๐ŸŸข SUPPORTED-NUMERICAL

๊ฐ€๋“œ EXACT: ์ •ํ™•ํ•œ ์ด๋ฆ„ + known top-level fn + ๋ฏธshadow + 2 args + ๋‘˜ ๋‹ค FloatLit "100.0"/"10.0". double-eval safe(๋ฆฌํ„ฐ๋Ÿด).

๊ฒ€์ฆ

  • fold-on/off byte-identical (md5 166d77ac), HIT/NO-HIT ์ฝ”ํผ์Šค ๋‘˜ ๋‹ค
  • perf: 30M-iter 0.26s โ†’ 0.09s (~65%), bl 13โ†’11

โš  ์ •์ง caveat (๋ฆฌ๋ทฐ ํ•„๋…)

codegen์— ์ปดํŒŒ์ผํƒ€์ž„ ๋ผ์ด๋ธŒ atlas ์กฐํšŒ surface ์—†์Œ โ†’ ํŒŒ์ผ๋Ÿฟ์€ ๊ทธ 1๊ฐœ verdict๋ฅผ ํ•˜๋“œ์ฝ”๋”ฉ ์ƒ์ˆ˜๋กœ ๋ฐ•๊ณ  ์ •ํ™•ํžˆ 100.0,10.0์—๋งŒ ๋งค์นญ. ๋ฉ”์ปค๋‹ˆ์ฆ˜ ์‹ค์ฆ์ด์ง€ ์ผ๋ฐ˜ atlas-query fold ์•„๋‹˜. ์ผ๋ฐ˜ํ™”(codegenโ†”atlas ์ฟผ๋ฆฌ ๊ฒฝ๋กœ)๋Š” follow-up. ๊ฐ€๋“œ ๋•๋ถ„์— non-matching ํ˜ธ์ถœ์€ ์ „๋ถ€ unchanged.

.c ์†-์ž‘์„ฑ 0 (codegen.hexa๋งŒ, hexa_cc.c๋Š” B9 ์ƒ์„ฑ๋ฌผ). ๐Ÿค– Generated with Claude Code

dancinlife and others added 2 commits May 29, 2026 22:00
โ€ฆect literal emit (UNSHADOW #4)

UNSHADOW.easy.md ยงA "๋ฃจํ”„/ํ˜ธ์ถœ์„ ์•ˆ ๋Œ๊ธฐ" ์‹ค์ฆ 1๊ฑด. codegen ์˜ gen2_expr
Callโ†’Ident ๋ถ„๊ธฐ ์ตœ์ƒ๋‹จ์— EXACT-guard fold ์ถ”๊ฐ€: PUREยทatlas-๊ฒ€์ฆ fn ์„ ๋ชจ๋“ 
์ธ์ž ๋ฆฌํ„ฐ๋Ÿด๋กœ ํ˜ธ์ถœํ•˜๋ฉด ๋Ÿฐํƒ€์ž„ call ๋Œ€์‹  ๊ฒ€์ฆ๋œ ๋ฆฌํ„ฐ๋Ÿด์„ ์ง์ ‘ emit.

Pilot: beenet_grid_bins(100.0, 10.0) โ†’ hexa_int(11)
  verdict: hexa verify --expr beenet_grid_bins 100.0 10.0 11
           = ๐ŸŸข SUPPORTED-NUMERICAL (|ฮ”|=0.0) ยท already in atlas (idempotent)

GUARD EXACT (comptime-fold-shadow family ํšŒํ”ผ): ์ด๋ฆ„ ์ผ์น˜ + _is_known_fn_global
+ !_gen2_has_decl + ์ธ์ž 2๊ฐœ + ๋‘˜ ๋‹ค FloatLit ํ† ํฐ "100.0"/"10.0" ์ •ํ™• ์ผ์น˜.
๊ทธ ์™ธ ๋ชจ๋“  ํ˜ธ์ถœ์€ ๋ณ€๊ฒฝ ์—†์ด ํ†ต๊ณผ = general-case zero behavior change.
DOUBLE-EVAL SAFE (๋ฆฌํ„ฐ๋Ÿด์€ ํ‰๊ฐ€ ์•ˆ ๋จ, ํ˜ธ์ถœ ์ „์ฒด๊ฐ€ ์ƒ์ˆ˜๋กœ ์น˜ํ™˜).

g5 (mini macOS arm64, hexat.base vs hexat.new):
- HIT corpus: base=11 ยท new=11 BYTE-IDENTICAL (md5 166d77ac)
- NO-HIT corpus: 11/21/11 ์–‘ arm IDENTICAL ยท emit C ๋„ ์™„์ „ ๋™์ผ (fold inert)
- isolation: HIT u_main base=real call, new=hexa_int(11)
perf: 30M-iter ํ•ซ๋ฃจํ”„ 0.26โ†’0.09s (~65%) ยท u_main bl 13โ†’11

hexa_cc.c ๋Š” B9 generated (.hexanoport) โ†’ ๋ฏธ์ปค๋ฐ‹. SSOT = self/codegen.hexa.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
# Conflicts:
#	domains/UNSHADOW.log.md
@dancinlife dancinlife merged commit 039fe38 into main May 29, 2026
2 of 8 checks passed
@dancinlife dancinlife deleted the unshadow-4-atlas-const-fold branch May 29, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant