microsoft / BitBLAS

BitBLAS is a library to support mixed-precision matrix multiplications, especially for quantized LLM deployment.
MIT License
423 stars 34 forks source link

[Feature Request] Enhance Simplification to remove unused function arguments #215

Closed LeiWang1999 closed 1 month ago

LeiWang1999 commented 1 month ago

Ref to PR #214.

The scheduling template in TL is quite complex because, for different tensor arguments, we need to implement separate TL templates. This complexity arises because TL cannot automatically remove unused tensor arguments, and the tensor arguments cannot be extended as flexibly as needed.

Expected Behavior:

# Given Program
@T.prim_func
def main(A, B, Scale, C):
    if with_scale:
        f(A, B, Scale, C)
    else:
        f(A, B, C)

If with_scale is set to False, the Scale argument should be removed from the function's argument list.

### Tasks
- [x] Test Case
- [x] Implement TL.Simplify Pass
LeiWang1999 commented 1 month ago

I think the best solution is to implement a new tl prim_func pass, such as tl.Simplify, similar to tir.Specialize found in 3rdparty/tvm/src/tir/ir/specialize.cc.”

tzj-fxz commented 1 month ago

Thanks. PR #216 has been created to implement tl.transform.Simplify pass and add test case for it.

I think the best solution is to implement a new tl prim_func pass, such as tl.Simplify, similar to tir.Specialize found in 3rdparty/tvm/src/tir/ir/specialize.cc.”

LeiWang1999 commented 1 month ago

Resloved.