Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
6963dc9
nll loss v1
AndrewZhaoLuo Aug 25, 2021
d6f420f
add converter
AndrewZhaoLuo Aug 25, 2021
83998d0
decode strings in byte form
AndrewZhaoLuo Aug 25, 2021
6c7ec71
decode variable length inputs
AndrewZhaoLuo Aug 25, 2021
1fbc3b7
make shapes correct
Aug 25, 2021
0cec344
unsqueeze
AndrewZhaoLuo Aug 25, 2021
1bd6573
fix
Aug 26, 2021
173054d
proper weight handling
Aug 26, 2021
e69997f
simplify if statement
AndrewZhaoLuo Aug 27, 2021
8949e5f
fix tests
Aug 31, 2021
ed36b75
add comment about tests
Aug 31, 2021
409b8a3
delete extra file
Aug 31, 2021
86229c2
lint
Aug 31, 2021
2a7b2b7
so cool
Aug 31, 2021
0ddfd30
Update CI Lint Image Version (#8841)
mehrdadh Aug 25, 2021
9f501cc
[BUG] ToBasicBlockNormalForm immutability (#8778)
ganler Aug 25, 2021
c757bd2
[GRAPH EXECUTOR,VM] Add benchmarking function to graph executor and v…
Aug 26, 2021
39ca27f
Apply CPPLint to CRT Tests (#8844)
Mousius Aug 26, 2021
3e1187d
[Relay][TOPI] Support of depthwise conv2d NHWC for Mali/Bifrost. (#8584)
AnastasiaStulova Aug 26, 2021
a221761
Support for CMSIS-NN in Corstone300 Makefile (#8831)
asparkhi Aug 26, 2021
c2d1940
[microtvm][Zephyr] Increase timeout to fix flaky tests (#8846)
mehrdadh Aug 26, 2021
73c9f07
[AMP] Bump up tolerance on flaky test (#8850)
AndrewZhaoLuo Aug 26, 2021
2231f0d
[Hexagon] Rework tvm.target.hexagon() interface (#8823)
Aug 26, 2021
9447946
[Pattern matching] Add an option to rewrite the graph only once (#8843)
ekalda Aug 26, 2021
8ca142b
update gpu and cpu (#8853)
mehrdadh Aug 26, 2021
9a68712
VTA cmake change to include Verilator header for building tsim librar…
aasorokiin Aug 26, 2021
c105a1b
[FIX] Bug fix for a floormod rewrite simplify rule (#8852)
jcf94 Aug 26, 2021
d833218
move rust lint script (#8726)
mehrdadh Aug 26, 2021
3862ce6
[AMP] Disallow fp16 conversion for summation-like ops (#8810)
masahi Aug 26, 2021
934b4e5
[TOPI] [Relay] Sparse Conv2d Implementation for 3x3 kernels (#8605)
Tantalus13A98B5F Aug 27, 2021
382b194
extend repeat_interleave op for relay.Expr (#8839)
vvchernov Aug 27, 2021
b5aaa39
Change AOT from ExprVisitor to MixedModeVisitor (#8856)
Mousius Aug 27, 2021
8633399
Add a PaddlePaddle Frontend (#8645)
jiangjiajun Aug 27, 2021
7cce940
[Runtime] add set_output_zero_copy (#8497)
sunjiweiswift Aug 27, 2021
b3d6d78
[Hexagon] Change declaration order of unique_ptr objects to fix crash…
Aug 27, 2021
2501640
[Graph Executor, VM] Add end to end benchmarking of models (#8858)
Aug 27, 2021
d19b66c
[UnitTests] Expose TVM pytest helpers as plugin (#8532)
Lunderberg Aug 27, 2021
5328acb
Remove AOT Executor header from Arduino project (#8857)
Mousius Aug 27, 2021
fb29996
[Community] @mdw-octoml -> Reviewer (#8868)
yzhliu Aug 28, 2021
bbe2998
[TIR] Fix opaque access in buffer locator pass and match_buffer in re…
Hzfengsy Aug 28, 2021
3d43446
[Autoscheduler] Configurable workload keys (#8862)
AndrewZhaoLuo Aug 28, 2021
a5cb1a9
[Tutorial][Executor] Fix the usage of executors in tutorials (#8586)
ganler Aug 28, 2021
d5c699c
[Frontend][Onnx] Simplify onnx input since name accesses are not reli…
Aug 28, 2021
91effea
[TIR] GetBlockReadWriteRegion (#8875)
MasterJH5574 Aug 29, 2021
aad9a88
[RISCV] Add support for llvm parameter -mabi (-target-abi) (#8860)
apivovarov Aug 30, 2021
0ee4c63
[Community] @manupa-arm -> Committer (#8870)
Aug 30, 2021
6b87fb5
[RPC] Fix ios_rpc build (#8864)
echuraev Aug 31, 2021
b1d9d11
[Vulkan][Target] Added the driver name to the vulkan target string. (…
Lunderberg Aug 31, 2021
dc9b2d7
[ONNX][TOPI] Support select_last_index for argmin/max (#8816)
AndrewZhaoLuo Aug 31, 2021
f6d6229
refactor optimize GEMM on CPU tutorial (#8825)
adstraw Aug 31, 2021
aca2844
Change target string to Target object in the TE compiler and interpre…
electriclilies Aug 31, 2021
6a417c2
[TensorIR][M2a] CacheRead/Write (#8863)
Aug 31, 2021
1fbb74a
[CI] make pre-commit hooks to run on every push instead of every comm…
mikepapadim Aug 31, 2021
ff8e138
[TVMScript] Fix printing ForNode annotations (#8891)
vinx13 Sep 1, 2021
3655e8e
[1/10] CMSIS-NN graph partitioner for softmax (#8653)
asparkhi Sep 1, 2021
60014c8
[microTVM][RVM] Add Arduino RVM (#8748)
guberti Sep 1, 2021
d5c4113
sce loss example
Sep 1, 2021
3371073
Merge branch 'main' into aluo/onnx/sceloss
Sep 1, 2021
4e43297
Merge branch 'main' into aluo/onnx/sceloss
AndrewZhaoLuo Sep 2, 2021
7d70d63
add comments, remove other tests
Sep 3, 2021
4f138f3
lint
AndrewZhaoLuo Sep 3, 2021
ccc57d4
lint
AndrewZhaoLuo Sep 3, 2021
75da5cc
jostle
Sep 6, 2021
95bdb82
lint up
AndrewZhaoLuo Sep 6, 2021
1c2806c
Merge branch 'aluo/onnx/sceloss' of github.com:AndrewZhaoLuo/tvm into…
AndrewZhaoLuo Sep 6, 2021
d677eb8
jostle
AndrewZhaoLuo Sep 6, 2021
6d3aeb8
Merge branch 'main' into aluo/onnx/sceloss
AndrewZhaoLuo Sep 16, 2021
812acf3
uncomment some tests
AndrewZhaoLuo Sep 16, 2021
4418709
proper return
AndrewZhaoLuo Sep 16, 2021
09e6069
clean up
AndrewZhaoLuo Sep 16, 2021
7d6a90a
lint
AndrewZhaoLuo Sep 16, 2021
d6eace4
minor merge errors
Sep 16, 2021
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
Prev Previous commit
Next Next commit
[FIX] Bug fix for a floormod rewrite simplify rule (#8852)
* Update rewrite_simplify.cc

* Update test_arith_rewrite_simplify.py

* Update test_arith_rewrite_simplify.py

* Update test_arith_rewrite_simplify.py
  • Loading branch information
jcf94 authored and Andrew Zhao Luo committed Sep 1, 2021
commit c105a1b07b7ad3695d76fc245035f0f5dd4765bf
16 changes: 10 additions & 6 deletions src/arith/rewrite_simplify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -858,14 +858,18 @@ PrimExpr RewriteSimplifier::Impl::VisitExpr_(const FloorModNode* op) {
ModularSet bmod = analyzer_->modular_set(b1.Eval());
int64_t ramp_min = floordiv(bmod->base, c2val);
int64_t ramp_max = floordiv(bmod->base + (lanes.Eval() - 1) * c1val, c2val);
if (bmod->coeff % c2val == 0) {
if (ramp_min == ramp_max) {
if (ramp_min == ramp_max) {
// If b1 can devide c2
if (bmod->coeff % c2val == 0) {
return ramp(floormod(bmod->base, c2), c1, lanes).Eval();
} else {
return floormod(ramp(floormod(bmod->base, c2), c1, lanes), broadcast(c2, lanes)).Eval();
}
} else if (c2val % bmod->coeff == 0 && ramp_min == ramp_max) {
return ramp(floormod(b1, c2), c1, lanes).Eval();
// If all indices can be guaranteed to settle inside a coeff range
if (c2val % bmod->coeff == 0 && bmod->base + (lanes.Eval() - 1) * c1val < bmod->coeff) {
return ramp(floormod(b1, c2), c1, lanes).Eval();
}
}
if (bmod->coeff % c2val == 0) {
return floormod(ramp(floormod(bmod->base, c2), c1, lanes), broadcast(c2, lanes)).Eval();
}
}
}
Expand Down
22 changes: 14 additions & 8 deletions tests/python/unittest/test_arith_rewrite_simplify.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,16 @@ def test_vector_simplify():
ck.verify(
fld(tvm.tir.Ramp(x * 4, 1, 5), tvm.tir.Broadcast(64, 5)),
fld(tvm.tir.Ramp(x * 4, 1, 5), tvm.tir.Broadcast(64, 5)),
)
) # Example negative case: x = 15; [60, 61, 62, 63, 64] / 64 = [0, 0, 0, 0, 1]
ck.verify(
fld(tvm.tir.Ramp(x * 4 + 3, 1, 4), tvm.tir.Broadcast(64, 4)),
fld(tvm.tir.Ramp(x * 4 + 3, 1, 4), tvm.tir.Broadcast(64, 4)),
)
) # Example negative case: x = 15; [63, 64, 65, 66] % 64 = [0, 1, 1, 1]
ck.verify(
fld(tvm.tir.Ramp(x * 7, 1, 4), tvm.tir.Broadcast(64, 4)),
fld(tvm.tir.Ramp(x * 7, 1, 4), tvm.tir.Broadcast(64, 4)),
)
) # Example negative case: x = 9; [63, 70, 77, 84] % 64 = [0, 1, 1, 1]

# floor mod
ck.verify(flm(y.astype("int32x2"), x.astype("int32x2")), flm(y, x).astype("int32x2"))
ck.verify(flm(tvm.tir.Ramp(x, 4, 4), 2), tvm.tir.Broadcast(flm(x, 2), 4))
Expand All @@ -136,16 +137,21 @@ def test_vector_simplify():
flm(tvm.tir.Ramp(x * 8, 2, 4), tvm.tir.Broadcast(64, 4)), tvm.tir.Ramp(flm(x * 8, 64), 2, 4)
)
ck.verify(
flm(tvm.tir.Ramp(x * 4, 1, 5), tvm.tir.Broadcast(64, 5)), tvm.tir.Ramp(flm(x * 4, 64), 1, 5)
)
flm(tvm.tir.Ramp(x * 4, 1, 5), tvm.tir.Broadcast(64, 5)),
flm(tvm.tir.Ramp(x * 4, 1, 5), tvm.tir.Broadcast(64, 5)),
) # Example negative case: x = 15; [60, 61, 62, 63, 64] % 64 = [60, 61, 62, 63, 0]
ck.verify(
flm(tvm.tir.Ramp(x * 4 + 3, 1, 4), tvm.tir.Broadcast(64, 4)),
tvm.tir.Ramp(flm(x * 4 + 3, 64), 1, 4),
)
flm(tvm.tir.Ramp(x * 4 + 3, 1, 4), tvm.tir.Broadcast(64, 4)),
) # Example negative case: x = 15; [63, 64, 65, 66] % 64 = [63, 0, 1, 2]
ck.verify(
flm(tvm.tir.Ramp(x * 2, 1, 8), tvm.tir.Broadcast(20, 8)),
flm(tvm.tir.Ramp(x * 2, 1, 8), tvm.tir.Broadcast(20, 8)),
) # Example negative case: x = 9; [18, 19, 20, ..., 25] % 20 = [18, 19, 0, 1, ..., 5]
ck.verify(
flm(tvm.tir.Ramp(x * 7, 1, 4), tvm.tir.Broadcast(64, 4)),
flm(tvm.tir.Ramp(x * 7, 1, 4), tvm.tir.Broadcast(64, 4)),
)
) # Example negative case: x = 9; [63, 70, 77, 84] % 64 = [63, 6, 13, 20]

# Min/Max rules
vx = te.var("vx", dtype="int32x2")
Expand Down