Skip to content

[TOPI] update depthconv padding api; fix shared memory overflow - #365

Merged
tqchen merged 2 commits into
apache:masterfrom
Huyuwei:topi
Aug 21, 2017
Merged

[TOPI] update depthconv padding api; fix shared memory overflow#365
tqchen merged 2 commits into
apache:masterfrom
Huyuwei:topi

Conversation

@Huyuwei

@Huyuwei Huyuwei commented Aug 21, 2017

Copy link
Copy Markdown
Contributor

No description provided.

@tqchen
tqchen merged commit 310f56f into apache:master Aug 21, 2017
tqchen pushed a commit to tqchen/tvm that referenced this pull request May 26, 2018
The below compilation warning is fixed.

In file included from /mnt/D_DRIVE/work/nnvm_8_feb/dmlc-core/include/dmlc/any.h:16:0,
                 from include/nnvm/./base.h:11,
                 from include/nnvm/graph.h:15,
                 from src/compiler/fold_scale_axis.cc:6:
src/compiler/fold_scale_axis.cc: In function ‘nnvm::Graph nnvm::compiler::FoldScaleAxis(nnvm::Graph)’:
src/compiler/fold_scale_axis.cc:155:39: warning: enum constant in boolean context [-Wint-in-bool-context]
     CHECK(kind == kPassTroughFirst || kMulConsumer);
                                       ^
/mnt/D_DRIVE/work/nnvm_8_feb/dmlc-core/include/dmlc/./logging.h:110:9: note: in definition of macro ‘CHECK’
   if (!(x))
tqchen pushed a commit that referenced this pull request May 29, 2018
The below compilation warning is fixed.

In file included from /mnt/D_DRIVE/work/nnvm_8_feb/dmlc-core/include/dmlc/any.h:16:0,
                 from include/nnvm/./base.h:11,
                 from include/nnvm/graph.h:15,
                 from src/compiler/fold_scale_axis.cc:6:
src/compiler/fold_scale_axis.cc: In function ‘nnvm::Graph nnvm::compiler::FoldScaleAxis(nnvm::Graph)’:
src/compiler/fold_scale_axis.cc:155:39: warning: enum constant in boolean context [-Wint-in-bool-context]
     CHECK(kind == kPassTroughFirst || kMulConsumer);
                                       ^
/mnt/D_DRIVE/work/nnvm_8_feb/dmlc-core/include/dmlc/./logging.h:110:9: note: in definition of macro ‘CHECK’
   if (!(x))
tqchen pushed a commit to tqchen/tvm that referenced this pull request Jul 6, 2018
The below compilation warning is fixed.

In file included from /mnt/D_DRIVE/work/nnvm_8_feb/dmlc-core/include/dmlc/any.h:16:0,
                 from include/nnvm/./base.h:11,
                 from include/nnvm/graph.h:15,
                 from src/compiler/fold_scale_axis.cc:6:
src/compiler/fold_scale_axis.cc: In function ‘nnvm::Graph nnvm::compiler::FoldScaleAxis(nnvm::Graph)’:
src/compiler/fold_scale_axis.cc:155:39: warning: enum constant in boolean context [-Wint-in-bool-context]
     CHECK(kind == kPassTroughFirst || kMulConsumer);
                                       ^
/mnt/D_DRIVE/work/nnvm_8_feb/dmlc-core/include/dmlc/./logging.h:110:9: note: in definition of macro ‘CHECK’
   if (!(x))
sergei-mironov pushed a commit to sergei-mironov/tvm that referenced this pull request Aug 8, 2018
The below compilation warning is fixed.

In file included from /mnt/D_DRIVE/work/nnvm_8_feb/dmlc-core/include/dmlc/any.h:16:0,
                 from include/nnvm/./base.h:11,
                 from include/nnvm/graph.h:15,
                 from src/compiler/fold_scale_axis.cc:6:
src/compiler/fold_scale_axis.cc: In function ‘nnvm::Graph nnvm::compiler::FoldScaleAxis(nnvm::Graph)’:
src/compiler/fold_scale_axis.cc:155:39: warning: enum constant in boolean context [-Wint-in-bool-context]
     CHECK(kind == kPassTroughFirst || kMulConsumer);
                                       ^
/mnt/D_DRIVE/work/nnvm_8_feb/dmlc-core/include/dmlc/./logging.h:110:9: note: in definition of macro ‘CHECK’
   if (!(x))
junrushao pushed a commit to junrushao/tvm that referenced this pull request Feb 8, 2023
* Update RunCodegen pass

* update TensorRT codegen for the new interface

* typo fix

* fix unused var warning

* leave todo comment on dep on RemoveUnusedfunctions

* introduce src/tranform/utils.h

* also move GetExtSymbol to transform/utils.h

* build fix

* add missing file
yelite pushed a commit to yelite/tvm that referenced this pull request Feb 17, 2023
* Update RunCodegen pass

* update TensorRT codegen for the new interface

* typo fix

* fix unused var warning

* leave todo comment on dep on RemoveUnusedfunctions

* introduce src/tranform/utils.h

* also move GetExtSymbol to transform/utils.h

* build fix

* add missing file
tlopex pushed a commit to tlopex/tvm that referenced this pull request Mar 9, 2026
tqchen added a commit to tqchen/tvm that referenced this pull request Sep 6, 2026
Add compiled structural visit, mutate, and maybe-in-place-mutate
hooks for every Expr and Stmt node family using the current tvm-ffi
structural-hook ABI.

The branch pins tvm-ffi at `9d784c4da74ff7360d76c79a89fe60a63516f880`,
including the callback-owned `StructuralMutate` API from tvm-ffi apache#751 and the
visit-hook success-tail macro from apache#753. Checked Map-valued hook fields use the
current Expected-returning type-error path.

`StmtNode` and `TypeNode` declare
`_type_s_eq_hash_subclass_kind_fixed = true`. The current hierarchy census
finds 18 final registered children under Stmt and 14 under Type, with no FreeVar
or DAG kind override in either hierarchy. This lets typed structural-map
callbacks over Stmt and Type fold out the identity-remap branch. `Expr`,
`PrimExpr`, and `BaseFunc` retain the default because their descendants
include FreeVar or DAG kinds.

Definition-region annotations are aligned with reflected fallback behavior:
direct definitions use non-recursive regions, container-owned definitions are
established at their Var sites, and dynamic Var type descent remains a use. The
hooks preserve the established visitor/mutator field set and same-object short
circuits on unchanged mutations.

Call hooks keep ordinary descent for args and nonempty type arguments, while
skipping primitive result types, interned Op operators, and empty type-argument
containers. Dynamic result types, function-valued operators, and populated type
arguments retain ordinary descent.

`PostOrderVisit` and `Substitute` remain unchanged. Direct
`StructuralMap` roots in this PR are confined to focused tests: the
intentionally shared lvalue exercises copy-on-write, while owned roots move
into the by-value API to preserve eligible in-place reuse.

The six core hook source files each use one anonymous namespace and non-static
file-local hook functions. Rebuilds box moved typed copies directly, unchanged
paths box typed `self`, and constant leaves explicitly extract typed `self`.
Every visit hook uses direct early-return macro calls per field and terminates
with `TVM_FFI_S_VISIT_RETURN_NONE()`.

`MaybeInplaceMutateSeqStmtRaw` separately verifies unique ownership of its
`seq` field and borrows each element from raw array storage so the element
remains eligible for in-place mutation. Nested SeqStmt results contribute zero,
one, or many statements through one cursor: the existing array is reshaped
when capacity permits, while overflow evaluates the remaining suffix exactly
once and allocates one exactly sized array. Differential tests cover first and
last positions, multiple splices, growth, size preservation, shrink, an empty
result, array reuse, overflow replacement, and callback non-replay.

Owner measurements in the apache#373 harness on a 256-element SeqStmt record the
accepted timing guardrail. Two replacements change from 23,511 to 24,444 ns
(+4.0%), 16 from 24,430 to 24,768 ns (+1.4%), 64 from 25,464 to 25,132 ns
(-1.3%), and 128 from 27,367 to 25,245 ns (-7.8%). Rebuilds fall from 3-5 to
zero at every density, with crossover near one quarter. This repair lands for
correct element-level in-place semantics and reduced splice allocation, not as
a uniform speedup.

Earlier general performance measurements for this work in apache#364/apache#365 were
collected at the previous `556514c76225cb35a55e0649098b07be3fba2991` engine
pin and predate this bump; they should not be interpreted as measurements of
the newer engine. The SeqStmt-specific figures above are the later apache#373
measurement of the accepted repair tradeoff.
tqchen added a commit to tqchen/tvm that referenced this pull request Sep 6, 2026
Add compiled structural visit, mutate, and maybe-in-place-mutate
hooks for every Expr and Stmt node family using the current tvm-ffi
structural-hook ABI.

The branch pins tvm-ffi at `9d784c4da74ff7360d76c79a89fe60a63516f880`,
including the callback-owned `StructuralMutate` API from tvm-ffi apache#751 and the
visit-hook success-tail macro from apache#753. Checked Map-valued hook fields use the
current Expected-returning type-error path.

`StmtNode` and `TypeNode` declare
`_type_s_eq_hash_subclass_kind_fixed = true`. The current hierarchy census
finds 18 final registered children under Stmt and 14 under Type, with no FreeVar
or DAG kind override in either hierarchy. This lets typed structural-map
callbacks over Stmt and Type fold out the identity-remap branch. `Expr`,
`PrimExpr`, and `BaseFunc` retain the default because their descendants
include FreeVar or DAG kinds.

Definition-region annotations are aligned with reflected fallback behavior:
direct definitions use non-recursive regions, container-owned definitions are
established at their Var sites, and dynamic Var type descent remains a use. The
hooks preserve the established visitor/mutator field set and same-object short
circuits on unchanged mutations.

Call hooks keep ordinary descent for args and nonempty type arguments, while
skipping primitive result types, interned Op operators, and empty type-argument
containers. Dynamic result types, function-valued operators, and populated type
arguments retain ordinary descent.

`PostOrderVisit` and `Substitute` remain unchanged. Direct
`StructuralMap` roots in this PR are confined to focused tests: the
intentionally shared lvalue exercises copy-on-write, while owned roots move
into the by-value API to preserve eligible in-place reuse.

All eight hook source files use one anonymous namespace and non-static
file-local hook functions. Rebuilds box moved typed copies directly, unchanged
paths box typed `self`, and constant leaves explicitly extract typed `self`.
Every visit hook uses direct early-return macro calls per field and terminates
with `TVM_FFI_S_VISIT_RETURN_NONE()`.

`MaybeInplaceMutateSeqStmtRaw` separately verifies unique ownership of its
`seq` field and borrows each element from raw array storage so the element
remains eligible for in-place mutation. Mapped `Evaluate(0)` entries are
omitted just as they are by `SeqStmt::Flatten`; zero or one remaining statement
normalizes to `Evaluate(0)` or the sole statement without constructing a
prohibited SeqStmt. This does not change the SeqStmt constructor or contract.

Both SeqStmt mutation hooks scan their unchanged prefix with only one
same-object test per element, then tail-return to changed-path helpers at the
first divergence. Ordinary mutation allocates and initializes its unchanged
prefix only there. In-place mutation begins its `total` cursor there: drops and
splices compact into the existing array while writes remain behind unread
input; a splice that would cross that boundary transfers once to an
`InplaceSplice` output and continues the remaining callbacks exactly once.
Differential tests cover first and last positions, multiple splices, growth,
size preservation, `Evaluate(0)` shrink, zero/one-result normalization, array
reuse, overflow replacement, and callback non-replay without constructing raw
empty or size-one SeqStmt nodes.

Owner measurements in the apache#373 harness on a 256-element SeqStmt record the
accepted timing guardrail. Two replacements change from 23,511 to 24,444 ns
(+4.0%), 16 from 24,430 to 24,768 ns (+1.4%), 64 from 25,464 to 25,132 ns
(-1.3%), and 128 from 27,367 to 25,245 ns (-7.8%). Rebuilds fall from 3-5 to
zero at every density, with crossover near one quarter. A follow-up L=8
allocation check finds that repaired shrink reuses the node array instead of
allocating once, while growth remains one allocation with or without spare
capacity. This repair lands for correct element-level in-place semantics and
reduced splice allocation, not as a uniform speedup.

Earlier general performance measurements for this work in apache#364/apache#365 were
collected at the previous `556514c76225cb35a55e0649098b07be3fba2991` engine
pin and predate this bump; they should not be interpreted as measurements of
the newer engine. The SeqStmt-specific figures above are the later apache#373
measurement of the accepted repair tradeoff.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants