Skip to content
Merged
Changes from all commits
Commits
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
20 changes: 13 additions & 7 deletions iron/operators/gemm/design.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,11 @@ def my_matmul(

# AIE Core Function declarations
scalar_suffix = "_scalar" if use_scalar else ""
gemm_object = kernel_object or f"{func_prefix}gemm_{m}x{k}x{n}.o"
gemm_object = (
f"{func_prefix}{kernel_object}"
if kernel_object
else f"{func_prefix}gemm_{m}x{k}x{n}.o"
)
if use_larger_internal_buffer:
# Fix fifo depth for C objfifo to 1 since 1 buffer will be used for accumulation
# and another for transfer to L2
Expand All @@ -289,17 +293,17 @@ def my_matmul(
C_l1_ty_internal = np.ndarray[(m, n), np.dtype[dtype_out_internal]]
# A kernel to convert from the internal f32 accumulation to bf16 for transfer to L2 is needed
convert_copy_kernel = Kernel(
f"convert_copy_f32_to_bf16",
"convert_copy.o",
f"{func_prefix}convert_copy_f32_to_bf16",
f"{func_prefix}convert_copy.o",
[C_l1_ty_internal, C_l1_ty, np.int32],
)
# Fix the kernels to use f32 outputs
zero_kernel = Kernel(
f"zero{scalar_suffix}_f32",
f"{func_prefix}zero{scalar_suffix}_f32",
gemm_object,
[C_l1_ty_internal],
)
matmul_func_name = f"matmul{scalar_suffix}_{dtype_in_str}_f32"
matmul_func_name = f"{func_prefix}matmul{scalar_suffix}_{dtype_in_str}_f32"
matmul_kernel = Kernel(
matmul_func_name,
gemm_object,
Expand All @@ -310,11 +314,13 @@ def my_matmul(
# we only need the zero and matmul kernels
fifo_depth_out = fifo_depth
zero_kernel = Kernel(
f"zero{scalar_suffix}_{dtype_out_str}",
f"{func_prefix}zero{scalar_suffix}_{dtype_out_str}",
gemm_object,
[C_l1_ty],
)
matmul_func_name = f"matmul{scalar_suffix}_{dtype_in_str}_{dtype_out_str}"
matmul_func_name = (
f"{func_prefix}matmul{scalar_suffix}_{dtype_in_str}_{dtype_out_str}"
)
matmul_kernel = Kernel(
matmul_func_name,
gemm_object,
Expand Down
Loading