Skip to content

support FP16 tensor computation through FP32 kernels - #1423

Open
zhangzhenghao wants to merge 1 commit into
gorse-io:pr-1398-fp16-storagefrom
zhangzhenghao:feat/tensor-fp16-computation
Open

zhangzhenghao wants to merge 1 commit into
gorse-io:pr-1398-fp16-storagefrom
zhangzhenghao:feat/tensor-fp16-computation

Conversation

@zhangzhenghao

@zhangzhenghao zhangzhenghao commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Depends on #1398 (FP16 tensor storage). This stacked PR targets pr-1398-fp16-storage, an exact mirror of #1398's storage-only head, so its diff contains computation changes only. Merge #1398 first, then retarget this PR to master.

  • Dispatch FP16 operators through transient FP32 conversion and existing FP32 kernels; round outputs to the first dispatched input's dtype, preserving existing Add/Mul operand reordering.
  • Preserve original graph connectivity and retain FP32 kernel outputs strongly for backward operations; keep gradients FP32 and support graph-free inference.
  • Update FP16 parameters with SGD/Adam using transient FP32 values, rounding into existing FP16 backing storage to preserve aliases. Keep Adam moments FP32; no persistent master weights.
  • Support FP16 NormalInit and cover primitive forwards/backwards, matrix transpose variants, mixed operands, chained/shared graphs with forced GC, inference, optimizer multistep updates/weight decay/aliasing, and initialization.

Verification

Passed locally with system Go 1.27.3, without modifying go.mod/go.sum:

  • go test ./common/nn ./protocol -count=1
  • go test -race ./common/nn ./protocol -count=1
  • go test -tags=noasm ./common/nn ./protocol -count=1
  • go vet -composites=false ./common/nn ./protocol
  • git diff --cached --check
  • Independent review: no blocking security or logic issues; split integrity verified.

The resulting source tree exactly matches the former combined #1398 head 5e39e1a4a3cff412df6f6b12683f42ea96b30692 (tree adea68644abaec590de64501a76736ae3ac40b13). No computation behavior was changed by the split. GitHub Actions currently filters pull requests to master / release-**, so this stacked PR does not trigger remote CI while targeting pr-1398-fp16-storage. Local verification above passed; remote CI must run after retargeting to master once #1398 merges.

This branch has not been deployed

No deployments
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.

2 participants