Conversation
|
/run a5 |
There was a problem hiding this comment.
Code Review
This pull request introduces the pto.tgemv.mx operation family for mixed-precision matrix-vector multiplication on A5 targets, including IR definitions, documentation, and lowering patterns. Review feedback highlights the need for unique intrinsic names for the accumulation and bias variants to prevent backend collisions, the importance of updating conversion patterns and test expectations accordingly, and the necessity of preserving result types during view-to-memref transformations to maintain SSA consistency.
| }]; | ||
|
|
||
| let extraClassDeclaration = [{ | ||
| static StringRef getIntrinsicName() { return "TGEMV_MX"; } |
There was a problem hiding this comment.
There was a problem hiding this comment.
Backend API named "TGEMV_MX".
| }]; | ||
|
|
||
| let extraClassDeclaration = [{ | ||
| static StringRef getIntrinsicName() { return "TGEMV_MX"; } |
There was a problem hiding this comment.
There was a problem hiding this comment.
Backend API named "TGEMV_MX".
lib/PTO/Transforms/PTOToEmitC.cpp
Outdated
| replaceOrEraseWithOpaqueCall(op.getOperation(), "TGEMV_MX", | ||
| {dst, cIn, a, aScale, b, bScale}, rewriter); |
There was a problem hiding this comment.
This variant should map to the TGEMV_MX_ACC intrinsic. Mapping both acc and bias variants to the same TGEMV_MX name with different argument structures will lead to incorrect C code generation or compilation errors in the backend.
| replaceOrEraseWithOpaqueCall(op.getOperation(), "TGEMV_MX", | |
| {dst, cIn, a, aScale, b, bScale}, rewriter); | |
| replaceOrEraseWithOpaqueCall(op.getOperation(), "TGEMV_MX_ACC", | |
| {dst, cIn, a, aScale, b, bScale}, rewriter); |
There was a problem hiding this comment.
Backend API named "TGEMV_MX".
lib/PTO/Transforms/PTOToEmitC.cpp
Outdated
| replaceOrEraseWithOpaqueCall(op.getOperation(), "TGEMV_MX", | ||
| {dst, a, aScale, b, bScale, bias}, rewriter); |
There was a problem hiding this comment.
This variant should map to the TGEMV_MX_BIAS intrinsic. Using a generic name for operations with different argument signatures is fragile and likely incorrect for the EmitC backend.
| replaceOrEraseWithOpaqueCall(op.getOperation(), "TGEMV_MX", | |
| {dst, a, aScale, b, bScale, bias}, rewriter); | |
| replaceOrEraseWithOpaqueCall(op.getOperation(), "TGEMV_MX_BIAS", | |
| {dst, a, aScale, b, bScale, bias}, rewriter); |
There was a problem hiding this comment.
Backend API named "TGEMV_MX".
| } | ||
| }; | ||
|
|
||
| struct PTOTGemvMXAccToTGEMV_MX |
There was a problem hiding this comment.
| } | ||
| }; | ||
|
|
||
| struct PTOTGemvMXBiasToTGEMV_MX |
| IRRewriter rewriter(ctx); | ||
| rewriter.setInsertionPoint(op); | ||
| rewriter.replaceOpWithNewOp<pto::TGemvMxOp>( | ||
| op, TypeRange{}, |
There was a problem hiding this comment.
Using TypeRange{} will drop any results the original operation might have had. If these operations are in the tensor domain (where they return a result aliasing the destination buffer), this will break the SSA chain. It is safer to use op->getResultTypes() to preserve the original result signature.
| op, TypeRange{}, | |
| op, op->getResultTypes(), |
| // CHECK: TGEMV_MX( | ||
| // CHECK: TGEMV_MX( |
A5 板测失败
日志尾部 |
|
/run a5 |
A5 板测失败
日志尾部 |
|
/run a3 |
|
/run a5 |
|
/run a5 test/basic/tgemv_mx_emitc.pto |
A5 板测失败
失败用例
|
A5 板测失败详情:PR #418tgemv_mx_emitc
|
|
/run a5 test/basic/tgemv_mx_emitc.pto test/basic/tgemv_mx_variants_emitc.pto |
A5 板测失败
日志尾部 |
1 similar comment
A5 板测失败
日志尾部 |
|
/run a5 tgemv_mx_emitc tgemv_mx_variants_emitc |
A5 板测成功
|
TGEMV_MX is A5-only op