Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TL] Inject Storage Sync Scope Automatically for TL #177

Merged
merged 43 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
d8884e6
Refactor BatchMatMulEmitter and BatchMatMulSelector for improved read…
LeiWang1999 Jul 5, 2024
fc84173
Refactor import statements for improved readability and maintainability
LeiWang1999 Jul 5, 2024
02f64de
Refactor import statements for improved readability and maintainability
LeiWang1999 Jul 5, 2024
397eee6
disable failure email for ci
LeiWang1999 Jul 5, 2024
20f6ad1
remove email notifications.
LeiWang1999 Jul 6, 2024
b93c394
move relax pass from testing to mlc_llm
LeiWang1999 Jul 6, 2024
ba6a6df
Merge branch 'main' of https://github.com/Microsoft/BitBLAS into main
LeiWang1999 Jul 6, 2024
257693a
Refactor scripts with se check_eual_ref_scripts_with_emitter function
LeiWang1999 Jul 6, 2024
9bb7f49
Lint Fix
LeiWang1999 Jul 6, 2024
39e7614
Merge branch 'main' of https://github.com/Microsoft/BitBLAS into main
LeiWang1999 Jul 6, 2024
93eb5a5
Refactor scripts with se check_eual_ref_scripts_with_emitter function
LeiWang1999 Jul 6, 2024
72b9740
Merge branch 'main' of https://github.com/Microsoft/BitBLAS into main
LeiWang1999 Aug 23, 2024
5b65979
Merge branch 'main' of https://github.com/Microsoft/BitBLAS into main
LeiWang1999 Aug 27, 2024
d9bd479
Merge branch 'main' of https://github.com/Microsoft/BitBLAS into main
LeiWang1999 Aug 29, 2024
99515cb
buf fix for matrix support
LeiWang1999 Aug 29, 2024
14406ef
lint fix
LeiWang1999 Aug 29, 2024
d30ec4f
dispatch tensor core based on shapes
LeiWang1999 Aug 29, 2024
fde4029
update install commands
LeiWang1999 Aug 30, 2024
6a04749
import scripts
LeiWang1999 Aug 31, 2024
9d90c40
Merge branch 'main' of https://github.com/Microsoft/BitBLAS into docs
LeiWang1999 Aug 31, 2024
9ef14e9
remove shared mem hack
LeiWang1999 Sep 1, 2024
63f363e
revert change for swizzling
LeiWang1999 Sep 1, 2024
b29c66c
bug fix
LeiWang1999 Sep 1, 2024
4643dd9
Merge branch 'main' of https://github.com/Microsoft/BitBLAS into docs
LeiWang1999 Sep 1, 2024
28beb13
tl examples
LeiWang1999 Sep 2, 2024
c0b476f
Enhance Swizzle
LeiWang1999 Sep 2, 2024
2bf14a8
lint fix
LeiWang1999 Sep 2, 2024
52accbf
Merge branch 'main' of https://github.com/Microsoft/BitBLAS into tl-l…
LeiWang1999 Sep 2, 2024
19aa985
test fix
LeiWang1999 Sep 3, 2024
ef8f93c
lint fix
LeiWang1999 Sep 3, 2024
4015cc4
optimize layout
LeiWang1999 Sep 3, 2024
5c5880c
update tl utils.
LeiWang1999 Sep 3, 2024
1042ffd
macro optimization
LeiWang1999 Sep 3, 2024
1ecd76e
Merge branch 'main' of https://github.com/Microsoft/BitBLAS into tl-l…
LeiWang1999 Sep 3, 2024
7bb21e7
test fix
LeiWang1999 Sep 4, 2024
6a22442
gemm_ss
LeiWang1999 Sep 4, 2024
b9ea093
Merge branch 'main' of https://github.com/Microsoft/BitBLAS into tl-l…
LeiWang1999 Sep 4, 2024
e9b56b4
doc fix
LeiWang1999 Sep 4, 2024
3eb6888
lint fix
LeiWang1999 Sep 6, 2024
5322785
Merge branch 'main' of https://github.com/Microsoft/BitBLAS into tl-l…
LeiWang1999 Sep 6, 2024
6f18d15
lint fix
LeiWang1999 Sep 6, 2024
187f448
remove debug print
LeiWang1999 Sep 6, 2024
e1fac68
remove debug print
LeiWang1999 Sep 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3rdparty/tvm
22 changes: 11 additions & 11 deletions bitblas/tl/macro_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def MMA(inst, A_local_buf, B_local_buf, C_local_buf):
for i, j in T.grid(inst.warp_rows, inst.warp_cols):
T.ptx_mma(
inst.accum_dtype,
"m16n8k16",
inst.mma_prefix,
"row",
"col",
inst.a_dtype_abbrv,
Expand All @@ -114,7 +114,7 @@ def MMA(inst, A_local_buf, B_local_buf, C_local_buf):

T.ptx_mma(
inst.accum_dtype,
"m16n8k16",
inst.mma_prefix,
"row",
"col",
inst.a_dtype_abbrv,
Expand Down Expand Up @@ -142,19 +142,18 @@ def LDMATRIX_A(
stride = inst.chunk
tx = thread_bindings % inst.WARP_SIZE
ty = (thread_bindings // inst.WARP_SIZE) % inst.block_row_warps
# self.ty = (thread_bindings // warp_size) % block_row_warps
# self.tz = thread_bindings // (warp_size * block_row_warps)

for i in T.serial(inst.warp_rows):
T.ptx_ldmatrix(
"float16",
inst.a_dtype,
T.bool(False),
4,
".b16",
A_local_buf.data,
i * inst.local_size_a,
T.address_of(A_shared_buf[ty * inst.warp_row_tiles + i * inst.micro_size_x,
ki * inst.micro_size_k,]),
get_ldmatrix_offset("A", tx, 0, stride, inst.a_dtype, False),
get_ldmatrix_offset("A", tx, 0, stride, inst.a_dtype, inst.a_transposed),
)

@staticmethod
Expand All @@ -171,15 +170,15 @@ def LDMATRIX_B(
tz = thread_bindings // (inst.WARP_SIZE * inst.block_row_warps)
for j in T.serial(inst.warp_cols):
T.ptx_ldmatrix(
"float16",
inst.b_dtype,
T.bool(False), # TODO(lei): should be optimized
4,
".b16",
B_local_buf.data,
j * inst.local_size_b,
T.address_of(B_shared_buf[tz * inst.warp_col_tiles + j * inst.micro_size_y,
ki * inst.micro_size_k,]),
get_ldmatrix_offset("B", tx, 0, stride, inst.b_dtype, True),
get_ldmatrix_offset("B", tx, 0, stride, inst.b_dtype, inst.b_transposed),
)

# STS
Expand All @@ -203,13 +202,14 @@ def STMATRIX(inst, C_local_buf, C_shared_buf, thread_bindings):
@staticmethod
@T.macro
def GEMM_SS(inst, A_shared_buf, B_shared_buf, C_local_buf, thread_bindings):
A_local_buf = T.alloc_fragment((inst.warp_rows * inst.local_size),
# TODO(lei): alloc_buffer within the macro is not supported yet.
A_local_buf = T.alloc_fragment((inst.warp_rows * inst.local_size_a),
inst.a_dtype,
scope="local")
B_local_buf = T.alloc_fragment((inst.warp_cols * inst.local_size),
B_local_buf = T.alloc_fragment((inst.warp_cols * inst.local_size_b),
inst.b_dtype,
scope="local")
for ki in T.serial(0, (inst.block_K // inst.micro_size_k)):
for ki in T.serial(0, (inst.chunk // inst.micro_size_k)):
inst.LDMATRIX_A(
inst,
A_local_buf,
Expand Down
2 changes: 1 addition & 1 deletion bitblas/tl/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def get_swizzle_layout(row_idx, col_idx, row_size, dtype: Union[DataType, str]):
# permutation on 4 banks, each bank has 32 bits
bank_elems = BANK_SIZE_BYTES // dtype.bits
new_col_idx_outer = None
print(f"coalescent_bits: {coalescent_bits}")

if coalescent_bits % 1024 == 0:
# Use 8 * 8 permuted layout
# Every number below corresponds to 8 consecutive fp16 number in shared mem, i.e. one read
Expand Down
1 change: 1 addition & 0 deletions docs/ExtendOperatorsWithDSL.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### Using BitBLAS from DSL
```python
from bitblas.gpu.matmul_analysis import get_tensorized_func_and_tags
from bitblas.base.roller.policy import TensorCorePolicy, DefaultPolicy
from bitblas.base.arch import CUDA
from bitblas.base.utils import apply_and_build
Expand Down
Loading