mlc-ai / mlc-ai/web-stable-diffusion

Check failed: kNumAttrs == attrs.size() (2 vs. 1) : ValueError: Incorrect kNumAttrs for instruction: Split

Open
#63 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
3.7k
Forks
238
PR merge metrics
No merged PRs in 30d

Description

When I tried to build the model on my Mac, I got an error:

python3 build.py
Automatically configuring target: metal -keys=metal,gpu -max_function_args=31 -max_num_threads=256 -max_shared_memory_per_block=32768 -max_threads_per_block=1024 -thread_warp_size=32
Load cached module from dist/mod_cache_before_build.pkl and skip tracing. You can use --use-cache=0 to retrace
Traceback (most recent call last):
  File "/Users/b03/Desktop/old/build.py", line 195, in <module>
    build(mod, ARGS)
  File "/Users/b03/Desktop/old/build.py", line 130, in build
    db = ms.database.create(work_dir=args.db_path)
  File "/opt/anaconda3/envs/web2/lib/python3.10/site-packages/tvm/meta_schedule/database/database.py", line 417, in create
    return JSONDatabase(*args, **kwargs)
  File "/opt/anaconda3/envs/web2/lib/python3.10/site-packages/tvm/meta_schedule/database/json_database.py", line 86, in __init__
    self.__init_handle_by_constructor__(
  File "tvm/_ffi/_cython/./object.pxi", line 132, in tvm._ffi._cy3.core.ObjectBase.__init_handle_by_constructor__
  File "tvm/_ffi/_cython/./packed_func.pxi", line 288, in tvm._ffi._cy3.core.ConstructorCall
  File "tvm/_ffi/_cython/./packed_func.pxi", line 277, in tvm._ffi._cy3.core.FuncCall
  File "tvm/_ffi/_cython/./base.pxi", line 182, in tvm._ffi._cy3.core.CHECK_CALL
  File "/opt/anaconda3/envs/web2/lib/python3.10/site-packages/tvm/_ffi/base.py", line 481, in raise_last_ffi_error
    raise py_err
tvm._ffi.base.TVMError: Traceback (most recent call last):
  File "/Users/catalyst/Workspace/mlc-ai-package-self-runner/_work/package/package/tvm/src/support/parallel_for.cc", line 128
RuntimeError: parallel_for_dynamic error with [17:46:32] /Users/catalyst/Workspace/mlc-ai-package-self-runner/_work/package/package/tvm/src/meta_schedule/database/json_database.cc:198: ValueError: Unable to parse TuningRecord, on line 7 of file log_db/database_tuning_record.json. The workload is:
# from tvm.script import ir as I
# from tvm.script import tir as T

@I.ir_module
class Module:
    @T.prim_func
    def main(rxplaceholder: T.Buffer((T.int64(1), T.int64(4), T.int64(64), T.int64(64)), "float32"), T_multiply: T.Buffer((T.int64(1), T.int64(4), T.int64(64), T.int64(64)), "float32")):
        T.func_attr({"op_pattern": 0, "tir.noalias": T.bool(True)})
        # with T.block("root"):
        for ax0, ax1, ax2, ax3 in T.grid(T.int64(1), T.int64(4), T.int64(64), T.int64(64)):
            with T.block("T_multiply"):
                v_ax0, v_ax1, v_ax2, v_ax3 = T.axis.remap("SSSS", [ax0, ax1, ax2, ax3])
                T.reads(rxplaceholder[v_ax0, v_ax1, v_ax2, v_ax3])
                T.writes(T_multiply[v_ax0, v_ax1, v_ax2, v_ax3])
                T_multiply[v_ax0, v_ax1, v_ax2, v_ax3] = T.float32(0.041666667908430099) * rxplaceholder[v_ax0, v_ax1, v_ax2, v_ax3]
The JSONObject of TuningRecord is:
[T.int64(6), [[[["GetBlock", [], ["T_multiply", "main"], ["b0"]], ["GetLoops", ["b0"], [], ["l1", "l2", "l3", "l4"]], ["Fuse", ["l1", "l2", "l3", "l4"], [T.int64(1)], ["l5"]], ["SampleCategorical", [], [[T.int64(32), T.int64(64), T.int64(128), T.int64(256), T.int64(512), T.int64(1024)], [T.float64(0.16666666666666666), T.float64(0.16666666666666666), T.float64(0.16666666666666666), T.float64(0.16666666666666666), T.float64(0.16666666666666666), T.float64(0.16666666666666666)]], ["v6"]], ["Split", ["l5", "None", "v6"], [T.int64(1)], ["l7", "l8"]], ["Bind", ["l7"], ["blockIdx.x"], []], ["Bind", ["l8"], ["threadIdx.x"], []], ["EnterPostproc", [], [], []]], [[T.int64(3), T.int64(0)]]], [T.float64(2.767325769084694e-05)], {"thread_warp_size": T.int64(32), "host": {"mtriple": "arm64-apple-macos", "tag": "", "kind": "llvm", "mcpu": "apple-latest", "keys": ["arm_cpu", "cpu"]}, "max_threads_per_block": T.int64(1024), "max_function_args": T.int64(31), "max_num_threads": T.int64(256), "tag": "", "max_shared_memory_per_block": T.int64(32768), "kind": "metal", "keys": ["metal", "gpu"]}, [["TENSOR", "float32", [T.int64(1), T.int64(4), T.int64(64), T.int64(64)]], ["TENSOR", "float32", [T.int64(1), T.int64(4), T.int64(64), T.int64(64)]]]]]
The error message is:
[17:46:32] /Users/catalyst/Workspace/mlc-ai-package-self-runner/_work/package/package/tvm/src/meta_schedule/database/database.cc:167: ValueError: Unable to parse the JSON object: [[[["GetBlock", [], ["T_multiply", "main"], ["b0"]], ["GetLoops", ["b0"], [], ["l1", "l2", "l3", "l4"]], ["Fuse", ["l1", "l2", "l3", "l4"], [T.int64(1)], ["l5"]], ["SampleCategorical", [], [[T.int64(32), T.int64(64), T.int64(128), T.int64(256), T.int64(512), T.int64(1024)], [T.float64(0.16666666666666666), T.float64(0.16666666666666666), T.float64(0.16666666666666666), T.float64(0.16666666666666666), T.float64(0.16666666666666666), T.float64(0.16666666666666666)]], ["v6"]], ["Split", ["l5", "None", "v6"], [T.int64(1)], ["l7", "l8"]], ["Bind", ["l7"], ["blockIdx.x"], []], ["Bind", ["l8"], ["threadIdx.x"], []], ["EnterPostproc", [], [], []]], [[T.int64(3), T.int64(0)]]], [T.float64(2.767325769084694e-05)], {"thread_warp_size": T.int64(32), "host": {"mtriple": "arm64-apple-macos", "tag": "", "kind": "llvm", "mcpu": "apple-latest", "keys": ["arm_cpu", "cpu"]}, "max_threads_per_block": T.int64(1024), "max_function_args": T.int64(31), "max_num_threads": T.int64(256), "tag": "", "max_shared_memory_per_block": T.int64(32768), "kind": "metal", "keys": ["metal", "gpu"]}, [["TENSOR", "float32", [T.int64(1), T.int64(4), T.int64(64), T.int64(64)]], ["TENSOR", "float32", [T.int64(1), T.int64(4), T.int64(64), T.int64(64)]]]]
The error is: [17:46:32] /Users/catalyst/Workspace/mlc-ai-package-self-runner/_work/package/package/tvm/src/tir/schedule/primitive/.././instruction_traits.h:387: InternalError: Check failed: kNumAttrs == attrs.size() (2 vs. 1) : ValueError: Incorrect kNumAttrs for instruction: Split

Environments:
Mac M2
Python 3.10
mlc-ai-nightly 0.15.dev315

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The report points to build.py:130 and log_db/database_tuning_record.json; begin by reproducing the failure with python3 build.py and inspecting how the cached TuningRecord is read. Done means the model build completes on the stated Mac M2, Python 3.10, and mlc-ai-nightly environment without the Split parsing error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.