Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/tvm/tirx/tirx_stmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ namespace tirx {
*/
class TilePrimitiveCallNode : public StmtNode {
public:
explicit TilePrimitiveCallNode(ffi::UnsafeInit tag) : op(tag) {}

TilePrimitiveCallNode(tvm::Op op, ffi::Array<ffi::Any> args,
ffi::Map<ffi::String, Buffer> workspace,
ffi::Map<ffi::String, ffi::Any> config, ffi::Optional<ffi::String> dispatch,
Expand Down
29 changes: 28 additions & 1 deletion tests/python/tirx/test_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import pickle

import pytest

from tvm.ir import Op
from tvm.ir import Op, assert_structural_equal
from tvm.tirx.buffer import decl_buffer
from tvm.tirx.exec_scope import ExecScope
from tvm.tirx.stmt import TilePrimitiveCall


Expand All @@ -44,6 +47,30 @@ def test_gemm():
_test("gemm", D[:, :], A[:, :], B[:, :], C[:, :], True, False, 1.0, 0.0)


def test_tile_primitive_call_pickle_roundtrip():
"""TilePrimitiveCall reflection must provide a deserialization creator."""
A = decl_buffer((64,), "float32", scope="local")
workspace = decl_buffer((16,), "float32", scope="shared")
call = TilePrimitiveCall(
A[:],
1.0,
op=Op.get("tirx.tile.fill"),
workspace={"scratch": workspace},
config={"hint": "roundtrip", "stages": 2},
dispatch="reg",
scope=ExecScope("warpgroup"),
)
restored = pickle.loads(pickle.dumps(call))

assert_structural_equal(restored, call)
assert restored.op.same_as(call.op)
assert_structural_equal(restored.args, call.args)
assert_structural_equal(restored.workspace, call.workspace)
assert_structural_equal(restored.config, call.config)
assert restored.dispatch == call.dispatch
assert_structural_equal(restored.scope, call.scope)


def test_buffer_replacer_no_shared_default():
"""Regression test for F4: BufferReplacer default dicts must not be shared."""
from tvm.tirx.transform.common import BufferReplacer
Expand Down
Loading