Skip to content

Commit

Permalink
Add fast module
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Apr 15, 2024
1 parent 337afe7 commit 369cf27
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/bindings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ napi_value Init(napi_env env, napi_value exports) {
InitRandom(env, exports);
InitFFT(env, exports);
InitLinalg(env, exports);
InitFast(env, exports);
return exports;
}

Expand Down
1 change: 1 addition & 0 deletions src/bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ void InitIO(napi_env env, napi_value exports);
void InitRandom(napi_env env, napi_value exports);
void InitFFT(napi_env env, napi_value exports);
void InitLinalg(napi_env env, napi_value exports);
void InitFast(napi_env env, napi_value exports);

#endif // SRC_BINDINGS_H_
13 changes: 13 additions & 0 deletions src/fast.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "src/array.h"
#include "src/stream.h"

void InitFast(napi_env env, napi_value exports) {
napi_value fast = ki::CreateObject(env);
ki::Set(env, exports, "fast", fast);

ki::Set(env, fast,
"rmsNorm", &mx::fast::rms_norm,
"layerNorm", &mx::fast::layer_norm,
"rope", &mx::fast::rope,
"scaledDotProductAttention", &mx::fast::scaled_dot_product_attention);
}

0 comments on commit 369cf27

Please sign in to comment.