Expand description
GPU #include row parser. Phase 17b.7: per TOK_PREPROC token of
kind TOK_PP_INCLUDE / TOK_PP_INCLUDE_NEXT, extracts the path
byte span and <…> vs "…" flag. Per-thread, fully parallel.
GPU #include row parser.
Phase 17b.7: per TOK_PREPROC token classified as
TOK_PP_INCLUDE or TOK_PP_INCLUDE_NEXT, extract the include
path’s byte span and whether it was the <…> (system) form or
"…" (local) form. Per-thread, fully parallel.
§Output columns (one row per token)
path_start,path_len- byte span between the delimiters (</>or"/").is_system-1for<…>,0for"…".
Non-INCLUDE rows get all-zero output. path_len == 0 after this
kernel means “not a parsed #include row” - equivalent to the CPU
parse_include_literal returning None/error.
§Real-GPU lowering note
Two real-GPU lowering pitfalls (both shared with
gpu_directive_metadata):
DataType::U8storage buffers are emitted by vyre-emit-naga asarray<u32>(WGSL has no u8 storage).Expr::load("source", addr)therefore returns the u32 word at indexaddr, not the byte at byte-addressaddr. The kernel does the byte extraction inline so it produces the correct value on both backends.- Whitespace skipping uses fixed-depth chained Selects because C directive separators are short in practice. Path extraction is bounded by the directive row length, so Linux-scale include paths are not truncated by a compile-time probe cap.
§Wire layout
Inputs:
tok_starts(U32),tok_lens(U32),directive_kinds(U32) - output of 17a.source(U8).
Outputs (all U32, one element per token):
path_start_out,path_len_out,is_system_out.
Constants§
- BINDING_
DIRECTIVE_ KINDS - Canonical binding for the input directive-kinds buffer.
- BINDING_
IS_ SYSTEM_ OUT - Canonical binding for the output
is_systemcolumn. - BINDING_
PATH_ LEN_ OUT - Canonical binding for the output
path_lencolumn. - BINDING_
PATH_ START_ OUT - Canonical binding for the output
path_startcolumn. - BINDING_
SOURCE - Canonical binding for the input source bytes.
- BINDING_
TOK_ LENS - Canonical binding for the input per-token length buffer.
- BINDING_
TOK_ STARTS - Canonical binding for the input per-token start-offset buffer.
- OP_ID
- Canonical op id.
Functions§
- gpu_
include_ parse - Build the 17b.7
#includerow parserProgram. - gpu_
include_ parse_ u8 - Build the 17b.7
#includerow parser over rawDataType::U8source bytes.