Replies: 1 comment 2 replies
|
@atassis Thank you for #3410! I'm excited to add to the open source kernels here and in To answer your questions:
I look forward to seeing your future PRs! |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
While building an open-source inference engine on aie2p (NPU2), I've written a set of small, generic
transformer/conv kernels. A few look useful beyond my engine, so before I open a stack of PRs I want to
check appetite and preferred shape.
As a concrete example I just opened #3410, a LayerNorm numerical fix. The exported bf16
layer_norminaie_kernels/aie2p/layer_norm.ccaccumulates the mean sum in bf16 and computes the variance asE[x^2] - mean^2, so its error grows with the row length: measured rel-L2 rises from 1.1% at cols=2048to 1.9% at 4096 (input uniform[-1,1], vs an f32 host reference). The file already has a
layer_norm_welford, but it's float-only and reduces over the row axis rather than the feature axis, soit can't back the per-row bf16 path as-is. The fix accumulates the mean in f32 and centers the variance
(two-pass); the interface and the eps/gamma/beta constants are unchanged, the error goes flat (~0.6%),
and the PR has the before/after plus a host-reference test.
Beyond that, in rough order of readiness, I also have: an extension of
basic/transposesto runtime-dimbf16/f32 (it currently covers compile-time int8/16/32); a depthwise 1D conv on
sliding_mul; ahigher-precision f32
2^xas an alternative to theaie::exp2-basedbf16_exppath, forsoftmax/sigmoid cases that need more than bf16 precision (the note in
softmax.ccalready flags thatsensitivity); and a couple of fused mmul epilogues (LayerNorm, activations) that are parameterized
rather than tied to my model. Full list if it's useful.
Two questions:
aie_kernels/aie2p/, or keep it lean?example or a separate kernel?
Each would come with a host-reference test and its
aie.iron.kernelsfactory. #3410 is the first; I'llfollow your steer on the rest.
All reactions