-
Notifications
You must be signed in to change notification settings - Fork 83
feat: add B11 indexed concat and exact fillpad #2192
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -144,6 +144,18 @@ static std::string MakeNaryCodegenPTO(const std::string& pto_op_name, size_t ari | |
| return ""; | ||
| } | ||
|
|
||
| static std::string MakeConcatIdxCodegenPTO(const CallPtr& op, codegen::CodegenBase& codegen_base) { | ||
| auto& codegen = AsPto(codegen_base); | ||
| CheckArity(op, "pto.tconcatidx", 5); | ||
| std::vector<std::pair<std::string, std::string>> inputs; | ||
| inputs.reserve(4); | ||
| for (size_t i = 0; i < 4; ++i) { | ||
| inputs.emplace_back(codegen.GetExprAsCode(op->args_[i]), codegen.GetExprTypeAnnotation(op->args_[i])); | ||
| } | ||
| EmitInsOuts(codegen, "pto.tconcatidx", inputs); | ||
|
Comment on lines
+147
to
+155
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== repo files around pto_ops_elementwise =="
fd -a 'pto_ops_elementwise\.cpp|codegen.*test|test.*codegen|.*ptos?.*test.*' . | sed 's#^\./##' | head -100
echo
echo "== target file outline =="
ast-grep outline src/backend/common/pto_ops_elementwise.cpp --view expanded || true
echo
echo "== target lines 100-190 =="
sed -n '100,190p' src/backend/common/pto_ops_elementwise.cpp | nl -ba -v100
echo
echo "== search concatidx/tconcatidx/codegen test markers =="
rg -n "tconcatidx|concatidx|tconcat|ins\(|outs\(|dst|destination|dest" src test tests .github tools bench 2>/dev/null | head -200 || trueRepository: hw-native-sys/pypto Length of output: 3464 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== target file outline =="
ast-grep outline src/backend/common/pto_ops_elementwise.cpp --view expanded || true
echo
echo "== target lines 100-190 =="
nl -ba src/backend/common/pto_ops_elementwise.cpp | sed -n '100,190p'
echo
echo "== search concatidx/tconcatidx/codegen test markers =="
rg -n "tconcatidx|concatidx|tconcat|pto\.(tconcatidx|fillpad_inplace)|ins\(|outs\(|dst|destination|dest" src test tests .github tools bench 2>/dev/null | head -300 || true
echo
echo "== likely pto/ptotest files =="
git ls-files | rg 'ptotest|pto.*test|test.*pte|code.*test|elementwise.*pt|common/.*test' | head -200Repository: hw-native-sys/pypto Length of output: 1918 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== target file lines 100-190 =="
awk 'NR>=100 && NR<=190 { printf "%6d %s\n", NR, $0 }' src/backend/common/pto_ops_elementwise.cpp
echo
echo "== registration/ops around concat_idx =="
awk 'NR>=420 && NR<=510 { printf "%6d %s\n", NR, $0 }' src/backend/common/pto_ops_elementwise.cpp
echo
echo "== test_pto references to concat_idx/tconcatidx/source =="
python3 - <<'PY'
import pathlib, re
for p in pathlib.Path('tests').rglob('*'):
if p.is_file():
try:
txt=p.read_text(errors='ignore')
except Exception:
continue
if 'concat_idx' in txt or 'tconcatidx' in txt:
print(f'\n--- {p} ---')
for i,line in enumerate(txt.splitlines(),1):
if 'concat_idx' in line or 'tconcatidx' in line:
print(f'{i}: {line}')
PY
echo
echo "== all files with concat_idx or tconcatidx =="
python3 - <<'PY'
import pathlib
for p in pathlib.Path('.').rglob('*'):
if not p.is_file(): continue
if any(part in {'.git','build','dist'} for part in p.parts): continue
try:
txt = p.read_text(errors='ignore')
except Exception:
continue
if 'concat_idx' in txt or 'tconcatidx' in txt or 'pto.tconcatidx' in txt:
print(p)
PY
echo
echo "== inspect EmitInsOuts definitions/usages =="
rg -n "EmitInsOuts|MakeConcatIdxCodegenPTO|ptotest|ptotest|pto.*test" src backend tests -g '*.cpp' -g '*.py' -g '*.cc' -g '*.h' | head -300 || trueRepository: hw-native-sys/pypto Length of output: 19862 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== test_pto_codegen concat_idx test =="
awk 'NR>=480 && NR<=535 { printf "%6d %s\n", NR, $0 }' tests/ut/codegen/test_pto_codegen.py
echo
echo "== EmitInsOuts implementation =="
awk 'NR>=350 && NR<=380 { printf "%6d %s\n", NR, $0 }' src/backend/common/pto_ops_shared.cpp
awk 'NR>=70 && NR<=90 { printf "%6d %s\n", NR, $0 }' src/backend/common/pto_ops_internal.h
echo
echo "== concat_idx registration and op definitions =="
awk 'NR>=505 && NR<=520 { printf "%6d %s\n", NR, $0 }' src/backend/common/pto_ops_elementwise.cpp
rg -n -C 5 "tile\.concat_idx|concat_idx|set_output_reuses_input|set_input_layout|set_output_layout" python src tests/ut/ir/operators/test_concat_idx.py tests/st/runtime/ops/test_concat_idx.py | head -240Repository: hw-native-sys/pypto Length of output: 27955 Assert the exact
🤖 Prompt for AI Agents |
||
| return ""; | ||
| } | ||
|
|
||
| static std::string MakeTileSelCodegenPTO(const CallPtr& op, codegen::CodegenBase& codegen_base) { | ||
| auto& codegen = AsPto(codegen_base); | ||
| CheckArity(op, "pto.tsel", 4); | ||
|
|
@@ -439,7 +451,7 @@ static const SimpleOpEntry kSimpleOps[] = { | |
| // Padding operations | ||
| {"tile.fillpad", "pto.tfillpad", 1}, | ||
| // Inplace variant: set_output_reuses_input(0) makes src/dst share UB addr. | ||
| {"tile.fillpad_inplace", "pto.tfillpad", 1}, | ||
| {"tile.fillpad_inplace", "pto.tfillpad_inplace", 1}, | ||
| // Matrix multiplication operations (PipeType::M → CUBE/AIC core) | ||
| {"tile.matmul", "pto.tmatmul", 2}, | ||
| {"tile.matmul_mx", "pto.tmatmul.mx", 4}, | ||
|
|
@@ -496,6 +508,8 @@ void RegisterElementwiseOps(Backend& backend, const std::unordered_set<std::stri | |
| if (exclude_ops.count(op_name) > 0) return; | ||
| backend.RegisterOp(op_name).f_codegen(std::move(fn)); | ||
| }; | ||
| reg("tile.concat_idx", | ||
| [](const CallPtr& op, codegen::CodegenBase& codegen) { return MakeConcatIdxCodegenPTO(op, codegen); }); | ||
|
Comment on lines
+511
to
+512
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== repo files =="
git ls-files | rg 'src/backend/common/pto_ops_elementwise\.cpp|src/backend|pto_ops_elementwise' | head -100
echo "== target outline =="
ast-grep outline src/backend/common/pto_ops_elementwise.cpp --view expanded || true
echo "== target lines =="
sed -n '1,90p; 450,560p' src/backend/common/pto_ops_elementwise.cpp
echo "== searches for concat_idx / layout setup / MakeConcatIdxCodegenPTO =="
rg -n "MakeConcatIdxCodegenPTO|concat_idx|row.*major|col.*major|LayoutConfig|layout" src/backend/common/pto_ops_elementwise.cpp src/backend -S | head -200
echo "== relevant files list =="
git ls-files src/backend | head -200Repository: hw-native-sys/pypto Length of output: 29275 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== pto_ops_elementwise concat_idx implementation =="
sed -n '120,210p; 488,515p' src/backend/common/pto_ops_elementwise.cpp
echo "== pto_ops_common subview layout handling =="
sed -n '1,220p; 380,475p' src/backend/common/pto_ops_common.cpp
echo "== pto layout codegen for tile_type =="
rg -n "pto\.tile_type|LayoutConfig|LayoutSpec|TileLayoutSpec|input_layouts|output_layout" src backend include -S | head -240
echo "== backend registry entry layout spec behavior =="
sed -n '400,505p' src/backend/common/backend.cpp
echo "== call stack or type-check for MakeConcatIdxCodegenPTO inputs =="
grep -n "MakeConcatIdxCodegenPTO\|tile\.concat_idx\|concat_idx" src -R -S
echo "== inspect backend registry header if present =="
fd -i 'backend.*\.h' src | head -20
sed -n '1,220p' src/backend/common/backend_registry.cpp 2>/dev/null || true
sed -n '1,220p' src/backend/common/backend_registry.h 2>/dev/null || trueRepository: hw-native-sys/pypto Length of output: 13174 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== resolve_backend_op_layouts_pass implementation =="
sed -n '110,270p' src/ir/transforms/resolve_backend_op_layouts_pass.cpp
echo "== backend.h relevant declarations =="
sed -n '70,145p; 235,255p' include/pypto/backend/common/backend.h
echo "== RegisterElementwiseOps rest =="
sed -n '360,560p' src/backend/common/pto_ops_elementwise.cpp
echo "== GetExprTypeAnnotation implementation candidates =="
rg -n "GetExprTypeAnnotation|GetCurrentResultTileBufTypeString|EmitInsOuts|GetExprAsCode" include src -S | head -200
echo "== read header files for pto codegen likely locations =="
fd -e h . include | rg 'codegen|pto|backend' | head -80
echo "== read likely header contents =="
fd -i 'codegen.*\.h|pto.*\.h' include src include | xargs -r -n1 sh -c 'echo "--- $0"; sed -n "1,220p" "$0"' | head -500Repository: hw-native-sys/pypto Length of output: 50377 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== backend.cpp finalize and lookup =="
sed -n '420,450p; 500,525p' src/backend/common/backend.cpp
echo "== registration macro and setter behavior =="
sed -n '130,235p' include/pypto/backend/common/backend.h
sed -n '460,505p' src/backend/common/backend.cpp
echo "== pto type annotation implementation =="
sed -n '1780,1895p' src/codegen/pto/pto_codegen.cpp
echo "== current result target/type implementation =="
sed -n '1860,1905p; 1360,1430p' src/codegen/pto/pto_codegen.cpp
echo "== layout predicates =="
rg -n "class BackendOpRegistryEntry|BackendOpRegistryEntry::~|BackendOpRegistryEntry::.*;" include src pypto backend -S
rg -n "RequiresRowMajor|IsRowMajor|TileLayout::row_major|SetCurrentResult" include src pypto backend -S | head -200
echo "== pto op declarations for concat_idx =="
rg -n "concat_idx|tile\.concat|mrgsort_format[12]|mrgsort_format" src include -SRepository: hw-native-sys/pypto Length of output: 17400 Add row-max layout constraints to the custom registration.
🤖 Prompt for AI Agents |
||
|
|
||
| auto register_precision_op = [&](const char* op_name, const char* pto_op_name, size_t arity, | ||
| const char* attr_kind) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -919,6 +919,75 @@ REGISTER_OP("tile.concat") | |
| return DeduceTileConcatType(args, kwargs); | ||
| }); | ||
|
|
||
| static TypePtr DeduceTileConcatIdxType(const std::vector<ExprPtr>& args) { | ||
| CHECK(args.size() == 5) | ||
| << "tile.concat_idx requires 5 arguments (src0, src1, src0_idx, src1_idx, dst), got " << args.size(); | ||
| auto src0 = As<TileType>(args[0]->GetType()); | ||
| auto src1 = As<TileType>(args[1]->GetType()); | ||
| auto idx0 = As<TileType>(args[2]->GetType()); | ||
| auto idx1 = As<TileType>(args[3]->GetType()); | ||
| auto dst = As<TileType>(args[4]->GetType()); | ||
| CHECK(src0 && src1 && idx0 && idx1 && dst) << "tile.concat_idx requires five TileType operands"; | ||
| CHECK(src0->dtype_ == src1->dtype_ && src0->dtype_ == dst->dtype_) | ||
| << "tile.concat_idx requires src0, src1, and dst to have the same dtype"; | ||
| const auto is_data_dtype = [](DataType dtype) { | ||
| return dtype == DataType::INT8 || dtype == DataType::UINT8 || dtype == DataType::INT16 || | ||
| dtype == DataType::UINT16 || dtype == DataType::INT32 || dtype == DataType::UINT32 || | ||
| dtype == DataType::FP16 || dtype == DataType::BF16 || dtype == DataType::FP32; | ||
| }; | ||
| const auto is_index_dtype = [](DataType dtype) { | ||
| return dtype == DataType::INT8 || dtype == DataType::UINT8 || dtype == DataType::INT16 || | ||
| dtype == DataType::UINT16 || dtype == DataType::INT32 || dtype == DataType::UINT32; | ||
| }; | ||
| CHECK(is_data_dtype(src0->dtype_)) | ||
| << "tile.concat_idx requires 8/16/32-bit integer, FP16, BF16, or FP32 data tiles"; | ||
| CHECK(idx0->dtype_ == idx1->dtype_ && is_index_dtype(idx0->dtype_)) | ||
| << "tile.concat_idx requires matching 8/16/32-bit integer index tiles"; | ||
|
Comment on lines
+938
to
+945
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n 'DataType::UINT(8|16|32)|tile\.concat_idx|pto\.tconcatidx' \
src/ir/op/tile_ops/transform.cpp src/backend/common/pto_ops_elementwise.cppRepository: hw-native-sys/pypto Length of output: 2079 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== transform.cpp relevant section =="
sed -n '900,995p' src/ir/op/tile_ops/transform.cpp
echo "== pto_ops_elementwise.cpp relevant sections =="
sed -n '130,175p' src/backend/common/pto_ops_elementwise.cpp
sed -n '490,525p' src/backend/common/pto_ops_elementwise.cpp
echo "== dtype formatting / tconcatidx references =="
rg -n "DataType::UINT|UINT|to_dtype|dtype_name|ui8|ui16|ui32|tconcatidx|concat_idx" src backend tools include lib -g '*.{cpp,h,hpp,py,cc,cu,txt,json}' | head -n 200Repository: hw-native-sys/pypto Length of output: 24569 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== generate_expr_type_annotation implementation =="
sed -n '90,155p' src/codegen/codegen_base.cpp
echo "== tile concat_idx type annotations in codebase =="
python3 - <<'PY'
from pathlib import Path
import re
for path in Path('.').rglob('*'):
if path.is_file() and path.suffix in {'.cpp', '.hpp', '.h', '.py', '.tt':True}:
txt = path.read_text(errors='ignore')
if 'tile.concat_idx' in txt or 'DeduceTileConcatIdxType' in txt:
# Print concise context for each file
print(f"\n--- {path} ---")
lines = txt.splitlines()
for i,l in enumerate(lines,1):
if 'tile.concat_idx' in l or 'DeduceTileConcatIdxType' in l:
lo=max(1,i-8); hi=min(len(lines),i+14)
print(f"@@ {lo}-{hi}")
for j in range(lo,hi+1):
print(f"{j}: {lines[j-1]}")
break
PY
echo "== any explicit PTOAS tconcatidx dtype expectations (including docs/schema) =="
rg -n "tconcatidx|concat_idx|tile\.concat_idx|ui8|ui16|ui32|PTOAS|ptoas" . \
-g '*.{md,txt,json,yaml,yml,py,pyi,cc,cpp,h,hpp,cu,cuh,h}' \
| head -n 200Repository: hw-native-sys/pypto Length of output: 2885 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== CodegenBase::GetExprTypeAnnotation definitions/usages =="
rg -n "GetExprTypeAnnotation|EmitInsOutsClause|GenerateInsOutsClause" src include | head -n 200
echo "== pto codegen helper around tile instruction emission =="
sed -n '160,320p' src/codegen/pto/pto_scalar_expr_codegen.cpp
rg -n "i8|i16|i32|ui8|ui16|ui32|tile" src/codegen/pto/pto_scalar_expr_codegen.cpp | head -n 160
echo "== fixed file scan for tile.concat_idx =="
python3 - <<'PY'
from pathlib import Path
for path in Path('.').rglob('*'):
if path.is_file() and path.suffix not in {'.lock'}:
txt = path.read_text(errors='ignore')
if 'tile.concat_idx' in txt or 'DeduceTileConcatIdxType' in txt:
lines = txt.splitlines()
print(f"\n--- {path} ---")
for i,l in enumerate(lines,1):
if 'tile.concat_idx' in l or 'DeduceTileConcatIdxType' in l:
for j in range(max(1,i-6), min(len(lines),i+8)+1):
print(f"{j}: {lines[j-1]}")
PYRepository: hw-native-sys/pypto Length of output: 33603 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== PTO getTypeString for integer dtypes =="
sed -n '15,80p' src/codegen/pto/pto_type_utils.cpp
echo "== GenerateInsOutsClause implementation =="
sed -n '300,380p' src/backend/common/pto_ops_shared.cpp
echo "== Test concat_idx dtype construction =="
sed -n '40,70p' tests/ut/ir/operators/test_concat_idx.py
sed -n '490,525p' tests/ut/codegen/test_pto_codegen.py
echo "== Behavioral extraction of unsigned index annotations (read-only source text) =="
python3 - <<'PY'
from pathlib import Path
text = Path("src/ir/op/tile_ops/transform.cpp").read_text()
if ("return dtype == DataType::INT8 || dtype == DataType::UINT8 || dtype == DataType::INT16 ||\n dtype == DataType::UINT16 || dtype == DataType::INT32 || dtype == DataType::UINT32" in text):
print("is_index_dtype accepts UINT8, UINT16, UINT32")
text = Path("src/codegen/pto/pto_type_utils.cpp").read_text()
for dtype in ("UINT8", "UINT16", "UINT32"):
if f"\"ui{dtype[4].lower()}{dtype[5:] if len(dtype)==3 else int(dtype[4:])}\"" in text or f'return "ui{dtype[4].lower()}{dtype[5:] if len(dtype)==3 else int(dtype[4:])}"' in text:
print(f"ptype_map emits {dtype} as ui{dtype[4].lower()}{dtype[5:] if len(dtype)==3 else int(dtype[4:])}")
text = Path("src/backend/common/pto_ops_elementwise.cpp").read_text()
print("MakeConcatIdxCodegenPTO uses GetExprTypeAnnotation:", "GetExprTypeAnnotation(op->args_[i])" in text)
PYRepository: hw-native-sys/pypto Length of output: 8108 🌐 Web query:
💡 Result: In the context of the PTOAS (PTO Advanced System) project, Citations:
Reject or normalize unsigned index tiles before PTO emission.
🤖 Prompt for AI Agents |
||
| CHECK(src0->shape_.size() == 2 && src1->shape_.size() == 2 && idx0->shape_.size() == 2 && | ||
| idx1->shape_.size() == 2 && dst->shape_.size() == 2) | ||
| << "tile.concat_idx requires rank-2 tiles"; | ||
| for (const auto& type : {src0, src1, idx0, idx1}) { | ||
| CHECK(ProveValidExtentEqual(type->shape_[0], dst->shape_[0]) == ProofResult::kTrue) | ||
| << "tile.concat_idx requires all physical row counts to match dst"; | ||
| } | ||
| const auto dst_valid = GetValidShape(dst); | ||
| for (const auto& type : {src0, src1, idx0, idx1}) { | ||
| const auto valid = GetValidShape(type); | ||
| CHECK(ProveValidExtentEqual(valid[0], dst_valid[0]) == ProofResult::kTrue) | ||
| << "tile.concat_idx requires all valid row counts to match dst"; | ||
| } | ||
| const auto idx0_valid = GetValidShape(idx0); | ||
| const auto idx1_valid = GetValidShape(idx1); | ||
| auto one = std::make_shared<ConstInt>(1, DataType::INDEX, Span::unknown()); | ||
| CHECK(ProveValidExtentEqual(idx0_valid[1], one) == ProofResult::kTrue && | ||
| ProveValidExtentEqual(idx1_valid[1], one) == ProofResult::kTrue) | ||
| << "tile.concat_idx requires index tiles with valid_shape columns equal to 1"; | ||
|
Comment on lines
+949
to
+964
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n 'requires all physical row counts|valid_shape columns equal to 1|ProveValidExtentEqual' \
src/ir/op/tile_ops/transform.cppRepository: hw-native-sys/pypto Length of output: 657 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Inspect the function around the reported checks and nearby implementation.
sed -n '880,995p' src/ir/op/tile_ops/transform.cpp
# Search for tile.concat_idx implementation, shape validation docs / tests / usages.
rg -n "tile\.concat_idx|concat_idx|tile_concat_idx|TileOps|valid_shape" src tests -S | head -n 200Repository: hw-native-sys/pypto Length of output: 28172 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Inspect the concat_idx lowering/semantics and index operands to determine whether shape_[0]
# and valid_shape[1] constraints are tied to actual use.
rg -n "tile\.concat_idx|concat_idx|GetValidShape|InheritTileViewLayout|DeduceTileConcatIdxType" src -S
sed -n '960,1080p' src/backend/common/pto_ops_elementwise.cpp
rg -n "src0_idx|src1_idx|x0|x1|concat_idx|cat" src backend codegen -S | head -n 240Repository: hw-native-sys/pypto Length of output: 35782 🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '130,185p' src/backend/common/pto_ops_elementwise.cpp
rg -n "MakeConcatIdxCodegenPTO|padd|concat|idx|src0_idx|src1_idx|x0|x1|col" src/backend/src -S 2>/dev/null || true
rg -n "concat_idx|tconcatidx|tile.create|tile.concat_idx" tests src -S | head -n 200Repository: hw-native-sys/pypto Length of output: 27364 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Inspect tile.concat_idx behavior tests and the relevant invalid-index contract test shape.
sed -n '1,120p' tests/ut/ir/operators/test_concat_idx.py
sed -n '300,355p' tests/ut/ir/operators/test_concat_idx.py
sed -n '10,360p' tests/st/runtime/ops/test_concat_idx.py
# Inspect tile type helper definitions.
sed -n '1,130p' src/ir/type.cpp
rg -n "GetValidShape|tile_view_semantics::GetEffectiveTileView|ProveValidExtentEqual|InheritTileViewLayout" src/ir src/backend common -S | head -n 180Repository: hw-native-sys/pypto Length of output: 31925 Validate canonical valid extents instead of storage shape counts.
🤖 Prompt for AI Agents |
||
| TileView view; | ||
| view.valid_shape = dst_valid; | ||
| InheritTileViewLayout(view, dst); | ||
| return std::make_shared<TileType>(dst->shape_, dst->dtype_, std::nullopt, view); | ||
| } | ||
|
|
||
| REGISTER_OP("tile.concat_idx") | ||
| .set_op_category("TileOp") | ||
| .set_description("Indexed per-row concatenation into a destination tile") | ||
| .add_argument("src0", "First source tile") | ||
| .add_argument("src1", "Second source tile") | ||
| .add_argument("src0_idx", "Per-row source-0 column count") | ||
| .add_argument("src1_idx", "Per-row source-1 column count") | ||
| .add_argument("dst", "Destination tile") | ||
| .set_input_memory(0, MemorySpace::Vec) | ||
| .set_input_memory(1, MemorySpace::Vec) | ||
| .set_input_memory(2, MemorySpace::Vec) | ||
| .set_input_memory(3, MemorySpace::Vec) | ||
| .set_input_memory(4, MemorySpace::Vec) | ||
| .set_output_memory(MemorySpace::Vec) | ||
| .set_output_reuses_input(4) | ||
|
Comment on lines
+971
to
+985
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n 'tile\.concat_idx|set_input_layout|set_output_layout' \
src/backend/common/pto_ops_elementwise.cppRepository: hw-native-sys/pypto Length of output: 1288 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== file around REGISTER_OP tile.concat_idx =="
sed -n '950,1000p' src/ir/op/tile_ops/transform.cpp
echo
echo "== candidate helpers near REGISTER_OP =="
rg -n 'void REGISTER_OP|struct .*Register|class .*Register|set_input_memory\(|set_input_layout\(|set_output_layout\(|add_argument' src/ir/op/tile_ops/transform.cpp src/ir/op -g'*.cpp' -g'*.h' | head -220Repository: hw-native-sys/pypto Length of output: 25491 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== define/register helper declarations/usages for REGISTER_OP =="
rg -n 'REGISTER_OP\b|struct .*OpRegistry|class .*OpRegistry|OpRegistry|RegEntry' src/ir/op src/include -g'*.cpp' -g'*.h' | head -200
echo
echo "== locate simple ops code =="
rg -n 'kSimpleOps|set_input_layout\\(|set_output_layout\\(' src -g'*.cpp' -g'*.h' | head -200Repository: hw-native-sys/pypto Length of output: 14226 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== tile concat idx in backend =="
rg -n 'concat_idx|tconcatidx|kSimpleOps|SrcSimpleOps|SimpleOps|tile\.concat_idx|set_input_layout\(' src/backend src/include -g'*.cpp' -g'*.h' -g'*.py' 2>/dev/null | head -250
echo
echo "== op registry/map definition candidates =="
rg -n 'typedef|class|struct.*OpRegistry|OpRegistry::|GetOp\\(|SimpleOp|SrcSimpleOps|kSimpleOps' src/backend src -g'*.cpp' -g'*.h' | head -250
echo
echo "== precise backend occurrences without include path dependency =="
find src -type f \
\( -name '*.cpp' -o -name '*.h' \) -print0 \
| xargs -0 rg -n 'tile\.concat_idx|tconcatidx|set_input_layout\\(|set_output_layout\\(|kSimpleOps|SrcSimpleOps|SimpleOp' | head -300Repository: hw-native-sys/pypto Length of output: 2835 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== pto_ops_elementwise around codegen and kSimpleOps =="
sed -n '1,180p' src/backend/common/pto_ops_elementwise.cpp
echo
sed -n '360,535p' src/backend/common/pto_ops_elementwise.cpp
echo
echo "== BackendOpRegistryEntry layout API =="
sed -n '460,500p' src/backend/common/backend.cppRepository: hw-native-sys/pypto Length of output: 18083 Register row-major constraints for
🤖 Prompt for AI Agents |
||
| .f_deduce_type([](const std::vector<ExprPtr>& args, | ||
| const std::vector<std::pair<std::string, std::any>>& /*kwargs*/) { | ||
| return DeduceTileConcatIdxType(args); | ||
| }); | ||
|
|
||
| TypePtr DeduceTileSetValidShapeType(const std::vector<ExprPtr>& args, | ||
| const std::vector<std::pair<std::string, std::any>>& kwargs) { | ||
| CHECK(args.size() == 3) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
TFILLPAD_INPLACE marked ST-supported in both English and Chinese status docs, but hardware evidence is narrower than the claimed status. Per PR objectives, only three older A2 zero/max/min cases have actual hardware confirmation, while the new test suite defines a much broader dtype × mode × valid-shape × platform matrix that hasn't itself been run to conclusion on hardware. The shared root cause is one overclaiming status value duplicated across the two localized docs.
docs/en/dev/ptoas-op-status.md#L194: revert the exec/ST column to ❌ and adjust the note until the broader matrix is validated on-device.docs/zh/dev/ptoas-op-status.md#L180: apply the identical reversion to keep the Chinese doc in sync with the English one.📍 Affects 2 files
docs/en/dev/ptoas-op-status.md#L194-L194(this comment)docs/zh/dev/ptoas-op-status.md#L180-L180🤖 Prompt for AI Agents