feat(balls): add NliBall — non-uniform linear interpolation for non-linear ops (SiLU) - #105
Open
chipcrowd[bot] wants to merge 3 commits into
Open
feat(balls): add NliBall — non-uniform linear interpolation for non-linear ops (SiLU)#105chipcrowd[bot] wants to merge 3 commits into
chipcrowd[bot] wants to merge 3 commits into
Conversation
…rm linear interpolation) Add a new NliBall that evaluates non-linear functions with NLI (non-uniform linear interpolation): 16 piecewise-linear segments whose cutpoints are placed offline where the function is most curved. The Ball is function-agnostic (SiLU, GELU, exp, ...); the segment table is loaded through the coefficient bank with MVIN. - arch: Chisel RTL (2 read / 1 write ports, 16 INT8 lanes, comparator-tree segment select + Q7 MAC) - emu: BEMU golden model (bit-exact with RTL) - compiler: NliBall.td + LegalizeForLLVMExport + AssignPhysicalBank patterns - workloads: C test (datapath + SiLU accuracy) + ISA header - scripts: offline cutpoint optimisation for SiLU - README: contract, data layout, datapath and accuracy results Register NliBall in the pebble core (ballNum 11, bid 10, mnemonic NLI, funct7 73).
…tters - Move registration from pebble to toy (toy is the maintenance core for new Balls; production cores keep their fixed Ball set). - Revert the pebble balldomain and compiler wiring. - Apply scalafmt / black / clang-format so the pre-commit CI job passes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements issue #34: a new NliBall for non-linear operators, using the NLI (Non-uniform Linear Interpolation) methodology from "NLI: Non-uniform Linear Interpolation Approximation of Nonlinear Operations for Efficient LLMs Inference".
What it does
NliBallapproximates any non-linear function with 16 piecewise-linear segments whose cutpoints are placed non-uniformly (offline, where the function is most curved). The Ball is function-agnostic — the segment table (cutpoints / slopes / intercepts) is loaded through a coefficient bank withMVIN, so SiLU, GELU, exp, … all run on the same hardware.Per INT8 lane it selects the segment with a comparator tree, then evaluates one Q7 MAC:
Deliverables
examples/balls/nli/arch/src/main/scala/NliBall.scala(Chisel, 2 read / 1 write ports, 16 INT8 lanes/row).examples/balls/nli/workloads/ctests/nli_test.c(datapath + SiLU accuracy),workloads/isa/nli.h.examples/balls/nli/README.md(contract, data layout, datapath, results).NliBall.td,LegalizeForLLVMExport.cpp,AssignPhysicalBankPatterns.cpp.emu/src/{lib.rs,nli.rs}(BEMU golden model, bit-exact with RTL).scripts/gen_silu_table.py(cutpoint optimisation).ballNum 11,bid 10, mnemonicNLI,funct7 73.Results
SiLU over the full INT8 domain
[-128, 127](16 segments):16 non-uniform linear segments reach the fixed-point quantization floor and match a 256-entry uniform LUT with 16x less table — including the extreme outliers where a coarse uniform LUT collapses.
Validation performed
validate(ball-domain registration): all checks pass.chip.pb) and compiler registry generation: pass; NLI td/legalize/assign all discovered.mill buckyball.compile).Note: full
bemu/Verilator simulation requires thebuckyball-devMCP tooling, which was not available in this session (the nix development environment could not be entered under the sandbox), so the on-target sim run is left for CI.