Skip to content

refactor(inference): extract WGSL shaders to .wgsl files (gpu/inner/shaders.rs + gpu_gemm.rs) #712

Description

@ohdearquant

Follow-up to the native-Metal shader extraction (#710). The portable wgpu path still carries inline WGSL in Rust string literals:

  • crates/inference/src/forward/gpu/inner/shaders.rs — 10 WGSL compute shaders (MATMUL_BT_SHADER, RMS_NORM_SHADER, COPY_SHADER, ADD_SHADER, SILU_SHADER, MUL_SHADER, ROPE_SHADER, ATTENTION_SCORES_SHADER, ATTENTION_SOFTMAX_SHADER, ATTENTION_CONTEXT_SHADER), all pub(super) const … = r#"…"#.
  • crates/inference/src/forward/gpu_gemm.rsGEMM_SHADER (r#"…"#).

Lift each to a plain .wgsl file loaded via include_str!, same proven byte-identical method as #710 (raw-string consts → clean byte-slice; diff-verified). Keep WGSL under its own convention (shaders/*.wgsl or shaders/wgsl/) so it does not muddy the native-Metal .metal library — WGSL is a different language and serves portability, not the "borrow from other Metal engines" goal.

Blocked on #711 (keep-or-drop the wgpu path). If that resolves to drop, close this as won't-do; if keep, this is a low-risk hygiene lift.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions