Skip to content

feat(compiler): Zig fork — 7 patches for ternary SIMD (f16 vectors, i2 SIMD, popcount) #342

Description

@gHashTag

Zig Compiler Fork for Ternary Architecture

Fork: gHashTag/zig from ziglang/zig

7 Patches (by priority)

# Feature Blocks Complexity Upstream
1 Vector @floatCast f16↔f32 f16 SIMD matmul (#330) easy #16267
2 @Vector(N, i2) optimized packed ternary SIMD (#333) medium —
3 Mixed-width vector ops (i2×f32) ternary × float medium —
4 @popCount for vectors integer attention (#334) easy —
5 Comptime SIMD width detection auto-tune platform easy —
6 @prefetch for slices safe prefetch API easy —
7 Vector asm register constraints f16 fallback intrinsics medium —

Strategy

  • Workarounds in Trinity (inline for, asm) work WITHOUT fork
  • Fork needed only for native performance (remove workaround overhead)
  • Each patch = separate PR to upstream ziglang/zig
  • Fork = staging area for our patches until merge upstream

Patch #1: Vector @floatcast

Location: src/Sema.zig → zirFloatCast

Current: blocks @floatcast for vector types with TODO.
Fix: emit LLVM fpext/fptrunc for vector float types (LLVM supports natively).

Checklist

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions