Repository navigation
selfhost: Shader DSL (FSL) on flowc, Python backends retired (#683) - #998
Merged
Merged
Conversation
godofecht
force-pushed
the
port/shader-dsl-flowc
branch
from
September 29, 2026 06:36
e3b45af to
a58a5be
Compare
Contributor
Author
|
Merge train: rebased onto #999 (which is rebased onto #1003). The fill-shader stub is now the first stage (mask 8) of flowc_expand_stages_in_place in resolve.flow, so main.flow, driver.flow and every bundle read get it through the shared helper; #998's own read helper and per-site calls are gone. Old bootstrap commit dropped and C regenerated: fixed point OK, bootstrap_from_c --verify and self_host_full pass, parity field/dynamics/flow_blocks pass. parity_shader_dsl passes fixtures (102/0), host stub (2530 files) and WGSL/host e2e; its Metal e2e step fails locally only because this Mac's Metal toolchain component is missing. |
godofecht
force-pushed
the
port/shader-dsl-flowc
branch
2 times, most recently
from
September 29, 2026 07:10
8e4ead2 to
2c4be72
Compare
godofecht
added a commit
that referenced
this pull request
Sep 29, 2026
Rebased onto main containing #1003, #999, #998 and #989. Carries #1001's parse-only mode, located parse errors (flowc_parser_print_error, which the driver, emit and bundle paths now use), theorem/assume/therefore/claim references, flow blocks, handle, ui layout and pipeline blocks, let without initializer, contextual unit, distinct, effect rows, or-patterns, guards, nested patterns, [T; N], capability types, ?, vector literals, soft names, sort-by keys, entropy policies and module blocks, the parse coverage script and its CI floor, and the Python-grammar parser contract test. The #1001/#1003 reconciliation follows the one in #1012.
…in flowc (#683) compiler/src/shader_dsl.flow is the whole of the former shader_dsl.py, shader_codegen.py and shader_codegen_wgsl.py: head extraction, the FSL lexer and parser, type guessing, and both backends with their preludes. compiler/src/shader_emit.flow writes the gallery files. main.flow dispatches FLOWC_SHADER=metal|wgsl|list|expand.
src/flow/shader_codegen.py and shader_codegen_wgsl.py are gone and shader_dsl.py is a bridge to flowc FLOWC_SHADER. ./flow shader builds Metal (and, with --wgsl, WGSL) and transpiles the viewer host with flowc instead of python3. The module resolver takes the fill-shader host stub from flowc. scripts/emit_fsl_wgsl.py is replaced by ./flow shader --wgsl.
A fill-shader module is not host Flow. The Python module resolver gave it a stub main so the C transpile corpus passes. flowc now does the same as the first stage of flowc_expand_stages_in_place in resolve.flow (mask 8), so the compile paths in main.flow and driver.flow and every bundle pass see the stub through the shared read helper. The self-emit scripts build shader_dsl as a leaf frontend module. Only a fill head that starts a line counts. The Python matched one anywhere, which turned tests/lang/test_dsl_detect.flow (it names the syntax in a string) into an empty stub.
compiler/scripts/parity_shader_dsl.sh holds flowc to goldens recorded from the Python at 0b6d6ac (30 fixtures, both targets, plus digests of the six shader examples), checks the host stub over every tracked .flow file, diffs live against the Python at any revision, and builds the examples with python and python3 stubbed out. tests/lang/test_shader_dsl_port.flow covers the Flow API.
godofecht
force-pushed
the
port/shader-dsl-flowc
branch
from
September 29, 2026 07:35
2c4be72 to
0a35225
Compare
extract_shader_module left with the Python shader backends, so check_doc_examples.py failed to import and every doc-example job and test_docs_blocks failed. It asks flowc for the fill names instead.
line_starts_with and line_starts_with_ns declared i32 and returned a bool. The Python host used to turn tests/lang/test_dsl_detect.flow into a fill-shader stub, so it never type-checked the module; with the stub now limited to a fill head at line start it does, and tier-2 failed.
godofecht
added a commit
that referenced
this pull request
Sep 29, 2026
Rebased onto main containing #1003, #999, #998 and #989. Carries #1001's parse-only mode, located parse errors (flowc_parser_print_error, which the driver, emit and bundle paths now use), theorem/assume/therefore/claim references, flow blocks, handle, ui layout and pipeline blocks, let without initializer, contextual unit, distinct, effect rows, or-patterns, guards, nested patterns, [T; N], capability types, ?, vector literals, soft names, sort-by keys, entropy policies and module blocks, the parse coverage script and its CI floor, and the Python-grammar parser contract test. The #1001/#1003 reconciliation follows the one in #1012.
godofecht
added a commit
that referenced
this pull request
Sep 29, 2026
Rebased onto main containing #1003, #999, #998 and #989. Carries #1001's parse-only mode, located parse errors (flowc_parser_print_error, which the driver, emit and bundle paths now use), theorem/assume/therefore/claim references, flow blocks, handle, ui layout and pipeline blocks, let without initializer, contextual unit, distinct, effect rows, or-patterns, guards, nested patterns, [T; N], capability types, ?, vector literals, soft names, sort-by keys, entropy policies and module blocks, the parse coverage script and its CI floor, and the Python-grammar parser contract test. The #1001/#1003 reconciliation follows the one in #1012.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Shader DSL (FSL,
shader fillblocks andfnhelpers) now builds entirely inside flowc. The three Python modules behind it are gone.compiler/src/shader_dsl.flow: the whole of the formershader_dsl.py,shader_codegen.pyandshader_codegen_wgsl.py. Head extraction, the FSL lexer and parser,guess_type, both backends and both preludes. Each regex is a hand-written scan. Output is byte-identical to the Python, including its quirks (unmatched characters are skipped,//lexes as two divisions, braces in comments count during extraction).compiler/src/shader_emit.flow:FLOWC_SHADER=metal|wgsl|list|expandwrites the same files the Python did (<stem>_gallery.metal,.entries, per-fill.metal/.entry;<stem>_gallery.wgslor<name>_fill.wgsl,.wgsl.entries).FLOWC_SHADER_NAMEselects one fill.function main() -> i32 { return 0 }, as the Python module resolver did, inmain.flow,driver.flowand all five bundle reads inresolve.flow. The self-emit scripts androundtrip.shbuildshader_dslas a leaf frontend module../flow shadercalls flowc for the Metal gallery, and with--wgslfor WGSL. The viewer host (lib/runtime/shader_host.flow) is also transpiled by flowc instead ofpython3 -m flow.transpiler.shader_codegen.py(370),shader_codegen_wgsl.py(394),scripts/emit_fsl_wgsl.py(29) andtests/unit/test_shader_codegen_wgsl.py(122) deleted.shader_dsl.pyis a 96-line bridge to flowc (was 483) for the module resolver,wasm/flow_webgpu_shader.pyandscripts/record_shader_gallery.py.module_resolver.pyloses its AST stub. Net: 1,575 Python lines removed, 183 added (-1,392). Ratchet lowered.tests/lang/test_shader_dsl_port.flowcovers the Flow API.One deliberate difference: flowc stubs a module only when a fill head starts a line. The Python matched one anywhere, so it replaced
tests/lang/test_dsl_detect.flow(which names the syntax in a string literal) with an empty stub under the Python host. That test now runs for real on both hosts.Parity
compiler/scripts/parity_shader_dsl.sh --python 58a5fea8:compiler/fixtures/shader_dsl/, each with Metal and WGSL goldens (every output file) or the error text, plus the host-stub outcome, recorded from the Python. The six shader examples are held by SHA-256 of their full output (the 60-material Metal gallery runs to megabytes)..flowfile, both targets, and requires the same bytes or the same error from flowc, plus the same host-stub outcome.pythonandpython3onPATHreplaced by stubs that log and exit 127. The log stayed empty.Bootstrap
Regenerated last, in its own commit, on top of 58a5fea, per AGENTS.md. Python-host self-test prints
flowc: PASS. Fixed point holds.bootstrap_from_c.sh --verify,self_host_full.sh(three generations byte-identical) androundtrip.shpass. Bootstrap suite 120/19, identical pass and fail sets to origin/main's bootstrap with the same harness.Not changed
docs/language/shaders.md,docs/project/python-in-flow.mdanddocs/project/vgpu-parity.mdstill name the Python modules. The prose hook blocks them for pre-existing dashes, so they are left for a docs pass.lib/runtime/shader_host.flowcallsflow_shader_show_gallery_file_ex, whichruntime/shader_view_metal.mdoes not define.--emit-onlyand--wgslare unaffected.wasm/flow_webgpu_shader.pyandscripts/record_shader_gallery.pystay Python; they now only call flowc for the shader.Issues opened for Flow gaps met on the way: #985 (shared growable byte buffer for compiler modules), #986 (Stage-A parse errors give only a byte offset).
Closes #683.