[RFC]: add native float32 support for ML loss functions and activation primitives

オープン
#16,124 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@AryanSharma48 がすでに取り組んでいます。

2026年10月25日 から。

  • #16313 @AryanSharma48 による — オープン
  • #16317 @AryanSharma48 による — オープン
  • #16358 @Harsh28-raj による — オープン
  • #16594 @devxsubh による — オープン

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
12/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
c, javascript

調査の方向性

This is a tracking RFC, not a single task, so start by reading the existing float64 loss implementations under ml/base/loss/ and the float32 backlog in #649 to see how a float32 variant is laid out. The blocked activations (math/base/special/siluf, geluf, fast/gelu-tanhf, fast/gelu-quickf) depend on primitives such as erfcf and expitf that do not exist yet. Done means the team has agreed on the scope and each checklist package has its implementation, tests and benchmarks.

索引モデルが issue の本文から書いたものです。

説明

Accepted C Feature JavaScript Machine Learning Math RFC
Description

This RFC proposes adding native single-precision (float32) support for the core machine learning loss functions and activation primitives.

Currently, the lack of float32 packages forces the engine to cast Float32Array buffers up to float64 to compute mathematical operations before casting back down. This doubles memory bandwidth usage and hinders SIMD vectorization. These proposed packages rely on standard algebraic arithmetic and can be efficiently implemented via single-precision C kernels without requiring new polynomial derivations.

Core ML Loss Functions (Forward & Gradients)

  • ml/base/loss/float32/epsilon-insensitive
  • ml/base/loss/float32/epsilon-insensitive-gradient #16317
  • ml/base/loss/float32/hinge
  • ml/base/loss/float32/hinge-gradient #16275
  • ml/base/loss/float32/huber
  • ml/base/loss/float32/huber-gradient #16289
  • ml/base/loss/float32/log
  • ml/base/loss/float32/log-gradient
  • ml/base/loss/float32/modified-huber
  • ml/base/loss/float32/modified-huber-gradient #16313
  • ml/base/loss/float32/squared-epsilon-insensitive
  • ml/base/loss/float32/squared-epsilon-insensitive-gradient #16358
  • ml/base/loss/float32/squared-error
  • ml/base/loss/float32/squared-error-gradient #16287
  • ml/base/loss/float32/squared-hinge
  • ml/base/loss/float32/squared-hinge-gradient #16276

ML Activations

  • math/base/special/siluf
  • math/base/special/geluf
  • math/base/special/fast/gelu-tanhf
  • math/base/special/fast/gelu-quickf
Prerequisites

The above ML pipeline relies on the following core single-precision math primitives, which are already being tracked in the #649:

  • math/base/special/erfcf (Required for geluf)
  • math/base/special/expitf (Required for siluf and gelu-tanhf)
  • math/base/special/log1pexpf (Required for log loss functions)
Related Issues

None.

Questions

None.

Other

No.

Checklist
  • I have read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.
  • The issue name begins with RFC:.
主要言語
JavaScript
スター
6k
フォーク
1.3k
平均マージ
1日 21時間
マージ済み PR(30日)
224

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

stdlib-js/stdlib のほかの issue

stdlib-js/stdlib の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。