[Bug] [Relax][Runtime] CPU TopK builds for uint64 but fails in the runtime sort
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 80/100
Hướng nghiên cứu
Đọc logic dispatch sắp xếp CPU trong src/runtime/extra/contrib/sort/sort.cc, đặc biệt là nhánh int64 quanh các dòng 456–575. Chạy bản tái hiện ONNX TopK được cung cấp bằng bản build TVM có bật LLVM; công việc được xem là hoàn tất khi UINT64 trả về các giá trị và chỉ mục mong đợi, giống như trường hợp đối chứng INT64.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Expected behavior
A legal UINT64 ONNX TopK should return the selected values and indices on CPU, as the equivalent INT64 control does.
Actual behavior
Both models import and build. INT64 runs correctly, but UINT64 fails only when the VM executes:
InternalError: Unsupported input dtype: uint64
The CPU sort dispatch has an int64 branch but no uint64 branch. The script checks ONNX reference results and uses nonnegative values representable in both types.
Environment
TVM 0.28.dev0, LLVM 18.1.3, Linux x86_64; Python 3.12.3, NumPy 2.5.4, ONNX 1.22.0, ORT 1.29.0. The installed binary build revision is unknown; current main was inspected statically, not rebuilt.
Steps to reproduce
Run with an LLVM-enabled TVM installation:
import numpy as np
import onnx
import tvm
from onnx import TensorProto as T, helper as h, numpy_helper as nh
from onnx.reference import ReferenceEvaluator
from tvm import relax
from tvm.relax.frontend.onnx import from_onnx
for dtype, elem_type in (("int64", T.INT64), ("uint64", T.UINT64)):
x = np.array([1, 4, 2], dtype=dtype)
expected = [np.array([4, 2], dtype=dtype), np.array([1, 2], dtype="int64")]
model = h.make_model(h.make_graph([
h.make_node("TopK", ["x", "k"], ["values", "indices"])], "topk",
[h.make_tensor_value_info("x", elem_type, [3])],
[h.make_tensor_value_info("values", elem_type, [2]),
h.make_tensor_value_info("indices", T.INT64, [2])],
[nh.from_array(np.array([2], dtype="int64"), "k")]),
opset_imports=[h.make_opsetid("", 11)], ir_version=10)
onnx.checker.check_model(model, full_check=True)
for a, b in zip(ReferenceEvaluator(model).run(None, {"x": x}), expected):
np.testing.assert_array_equal(a, b)
mod = from_onnx(model, keep_params_in_input=False)
vm = relax.VirtualMachine(relax.build(mod, target="llvm"), tvm.cpu())
try:
actual = vm["main"](tvm.runtime.tensor(x))
for a, b in zip(actual, expected):
np.testing.assert_array_equal(a.numpy(), b)
print(dtype, "control passed")
except Exception as error:
if dtype == "int64":
raise
print(dtype, type(error).__name__, str(error).splitlines()[-1])
Triage
- needs-triage
- Ngôn ngữ chính
- Python
- Star
- 13.9k
- Fork
- 4k
- Merge trung bình
- 8 giờ 2 phút
- Pull request đã merge (30 ngày)
- 180
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/tvm
-
[Bug] [Relax][ONNX] OneHot does not convert floating-point depth to int64Có thể đã có người làm @tandede đã nhận hôm nay. Đang mởneeds-triage type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug][Relax] ReorderTakeAfterMatmul fails on vector dot productsCó thể đã có người làm @hiyufan đã nhận 10 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
apache/tvm#20595 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
flow-measurement measurement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
MichaelYcJo/SpecSeal#1366 ·
-
bug c/evals c/ui size:L
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Arize-ai/phoenix#17633 · 2 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
TransformerLensOrg/TransformerLens#1980 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Module: Solr Needs: Lead Needs: Triage Theme: Search Type: Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
internetarchive/openlibrary#14284 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 69/100
SpaceCowMedia/commander-spellbook-backend#1292 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày