Skip to content

add mov op#453

Open
kangjiaming1 wants to merge 13 commits into
mouliangyu:feature-vpto-backendfrom
kangjiaming1:feature-kjm-op
Open

add mov op#453
kangjiaming1 wants to merge 13 commits into
mouliangyu:feature-vpto-backendfrom
kangjiaming1:feature-kjm-op

Conversation

@kangjiaming1

Copy link
Copy Markdown
Collaborator

add mov op

Comment thread lib/TileOps/tmov2bias_template.py Outdated
# Calculate burst parameters
# For bias: len_burst = ceil(N * sizeof(dtype) / 32)
# For simplicity, use single burst for aligned cases
pto.bias_load(src.as_ptr(), dst.as_ptr(), n)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请参考这个表使用新接口名:

_LEGACY_CUBE_ALIAS_CANONICAL = {
    "cube_load": "mte_gm_l1",
    "cube_store": "mte_l1_ub",
    "cube_load_frac": "mte_gm_l1_frac",
    "bias_load": "mte_l1_bt",
    "left_load": "mte_l1_l0a",
    "right_load": "mte_l1_l0b",
    "left_load_mx": "mte_l1_l0a_mx",
    "right_load_mx": "mte_l1_l0b_mx",
    "acc_store": "mte_l0c_l1",
    "acc_store_gm": "mte_l0c_gm",
    "acc_store_ub": "mte_l0c_ub",
}

Comment thread lib/TileOps/tmov2left_template.py Outdated

@pto.ckernel(
target="a5",
op="pto.tmov2left",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有pto.tmov2left这个OP, 只有tmov, 你需要根据输入输出tile的location给这个tempalte加上constraint, 来实现dst是left tile时,让当前版本生效

self._render_cube_fb_load(expr, env, indent=indent, into=into)
return _RenderedValue(name="__void_call__", type=SemanticMetaType(kind="void"))

if expr.name in {"left_load", "right_load", "left_load_mx", "right_load_mx"}:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这些都是旧OP命名,新命名已经全量支持了,不用改这里

# FP4 types: lowercase names match Python variable names in types.py
# (used for getattr lookup); actual ScalarType.name is uppercase for MLIR
"f4e1m2x2",
"f4e2m1x2",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

低精度类型在VPTO后端还没支持,先不用实现,提个issue记录下

%bt_n_burst = arith.constant 1 : i64
%bt_src_gap = arith.constant 0 : i64
%bt_dst_gap = arith.constant 0 : i64
pto.mte_l1_bt %l1_bias, %bias_addr, %bt_len_burst nburst(%bt_n_burst, %bt_src_gap, %bt_dst_gap)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是无效测例,你直接用了微指令实现了tmov的功能,没有测试到expand-tileop这条路径,也就是说你写的template根本不会在这里展开

%fb_n_burst = arith.constant 2 : i64
%fb_src_gap = arith.constant 0 : i64
%fb_dst_gap = arith.constant 0 : i64
pto.mte_l1_fb %l1_scale, %scale_addr, %fb_len_burst nburst(%fb_n_burst, %fb_src_gap, %fb_dst_gap)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里还是微指令,没有用tmov

pto.wait_flag["PIPE_M", "PIPE_FIX", "EVENT_ID1"]

// TSTORE: Acc -> GM
pto.mte_l0c_gm %l0c, %c_gm, %c16_i64, %c16_i64, %c16_i64, %c16_i64, %c0_i64, %c0_i64,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里还是store的tmatmul的结果,bias_tile没有被输出校验,其他case也需要排查

Comment thread lib/TileOps/tmov_fp_template.py Outdated
The tmov.fp operation performs fixpipe quantization.
"""
# The tmov.fp op takes src (Acc), fp (scaling), and dst (Mat)
pto.tmov_fp(src.as_ptr(), scale.as_ptr(), dst.as_ptr())

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?这里为啥直接写个tileop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants