Bruce Lee's Notes

Systems, programming, and engineering practice

When Weights Move to the Left: A Transpose Identity That Moves the Whole Compiler Chain

A transpose identity starts the rewrite; weight identity and quantization axes must follow.

Series contents · Operators and Layouts · 阅读中文版 “It is still matrix multiplication. Why can it no longer compile just because the weights are on the left?” From linear algebra’s perspective, that i......

A Sigmoid After MatMul: Why the Compiler Still Refuses to Fuse It

Understand how consumers, views, and dependencies constrain matrix-activation fusion.

Series contents · Operators and Layouts · 阅读中文版 “If convolution can fuse, surely the Sigmoid after this matrix multiplication can too?” Sometimes it can. Sometimes the compiler quite deliberately s......

Putting Activation Inside Convolution: Preserve the Quantization Boundary Before Removing the Node

Preserve intermediate quantization and legality when fusing convolution with activation.

Series contents · Operators and Layouts · 阅读中文版 “These two nodes are adjacent. Fusing them should make things faster, right?” “Possibly. First, explain what that intermediate tensor used to be.” Th......

Who Moved My Scratch Register? Teaching an Emitter to Borrow and Return

Replace informal scratch-register conventions with explicit borrowing and lifetime rules.

Series contents · Operators and Layouts · 阅读中文版 Two code-generation functions work beautifully in isolation. Combine them, and the result suddenly breaks. The first says, “I only borrowed a scratch......

Abs and Sign: One Line of Arithmetic Does Not Make Their Parameter Contracts Interchangeable

Carry a unary operator's definition through types, quantization, and parameter encoding.

Series contents · Operators and Layouts · 阅读中文版 If asked to name two operators that ought to be easy to implement, many people would choose Abs and Sign. One takes an absolute value; the other dete......