Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
one
spconv
Commits
99c8a0bd
Commit
99c8a0bd
authored
Sep 06, 2022
by
yan.yan
Browse files
fix small bug
parent
d0bfb3a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
spconv/csrc/sparse/all.py
spconv/csrc/sparse/all.py
+17
-12
No files found.
spconv/csrc/sparse/all.py
View file @
99c8a0bd
...
...
@@ -1530,17 +1530,20 @@ class SpconvOps(pccm.Class):
if (direct_table){{
hash_size = int(
{
SPCONV_DIRECT_TABLE_HASH_SIZE_SCALE
}
* max_act_out_in_theory);
}}
size_t res = 0;
if (subm){{
re
turn
hash_size * (use_int64_hash_k ? 3 : 2) * sizeof(int) + 1 * sizeof(int);
re
s =
hash_size * (use_int64_hash_k ? 3 : 2) * sizeof(int) + 1 * sizeof(int);
}}else{{
size_t pair_single_size = kv * num_act_in; // 40000
size_t ind_uniq_and_bkp_size = (pair_single_size + 1) * 2 * (use_int64_hash_k ? sizeof(int64_t) : sizeof(int32_t));
size_t
hash_size = hash_size * (use_int64_hash_k ? 3 : 2) * sizeof(int);
re
turn
ind_uniq_and_bkp_size + hash_size + 1 * sizeof(int);
hash_size = hash_size * (use_int64_hash_k ? 3 : 2) * sizeof(int);
re
s =
ind_uniq_and_bkp_size + hash_size + 1 * sizeof(int);
}}
return res;
"""
)
return
code
.
ret
(
"std::size_t"
)
@
pccm
.
pybind
.
mark
@
pccm
.
static_function
def
get_indice_gen_tensors_from_workspace
(
self
):
...
...
@@ -1561,14 +1564,14 @@ class SpconvOps(pccm.Class):
hash_size = int(
{
SPCONV_DIRECT_TABLE_HASH_SIZE_SCALE
}
* max_act_out_in_theory);
}}
if (use_int64_hash_k){{
auto ten = tv::from_blob(workspace, {{int64_t(hash_size)
* 2
}}, tv::int64, 0);
auto ten = tv::from_blob(workspace, {{int64_t(hash_size)}}, tv::int64, 0);
res.insert({{
{
pccm
.
literal
(
AllocKeys
.
HashKOrKV
)
}
, ten}});
workspace += ten.nbytes();
auto ten2 = tv::from_blob(workspace, {{int64_t(hash_size)
* 2
}}, tv::int32, 0);
auto ten2 = tv::from_blob(workspace, {{int64_t(hash_size)}}, tv::int32, 0);
res.insert({{
{
pccm
.
literal
(
AllocKeys
.
HashV
)
}
, ten2}});
workspace += ten2.nbytes();
}}else{{
auto ten = tv::from_blob(workspace, {{2, int64_t(hash_size)
* 2
}}, tv::int32, 0);
auto ten = tv::from_blob(workspace, {{2, int64_t(hash_size)}}, tv::int32, 0);
res.insert({{
{
pccm
.
literal
(
AllocKeys
.
HashKOrKV
)
}
, ten}});
workspace += ten.nbytes();
}}
...
...
@@ -1585,7 +1588,8 @@ class SpconvOps(pccm.Class):
res.insert({{
{
pccm
.
literal
(
AllocKeys
.
TightUniqueCount
)
}
, uniq_cnt}});
workspace += uniq_cnt.nbytes();
TV_ASSERT_RT_ERR(workspace - ws_prev == expected_size, "this shouldn't happen");
TV_ASSERT_RT_ERR(workspace - ws_prev == expected_size, "this shouldn't happen", kv, num_act_in,num_act_out_bound, max_act_out_in_theory,
subm, use_int64_hash_k, direct_table, "expected", expected_size, workspace - ws_prev);
return res;
"""
)
return
code
.
ret
(
"std::unordered_map<std::string, tv::Tensor>"
)
...
...
@@ -1782,13 +1786,14 @@ class SpconvOps(pccm.Class):
hash_v = hash_kv_gurad->tensor[1];
}}
}}
indice_pairs_uniq_guard = allocator.empty_guard({{
2,
int64_t(pair_size + 1)}},
indice_pairs_uniq_guard = allocator.empty_guard({{int64_t(pair_size + 1)}},
indice_uniq_dtype, 0,
{
pccm
.
literal
(
AllocKeys
.
IndicePairsUniq
)
}
);
indice_pairs_uniq = indice_pairs_uniq_guard->tensor[0];
auto indice_pairs_uniq_bkp = indice_pairs_uniq_guard->tensor[1];
// indice_pairs_uniq_bkp_guard = allocator.empty_guard({{int64_t(pair_size + 1)}},
// indice_uniq_dtype, 0,
{
pccm
.
literal
(
AllocKeys
.
IndicePairsUniqBackup
)
}
);
indice_pairs_uniq = indice_pairs_uniq_guard->tensor;
// auto indice_pairs_uniq_bkp = indice_pairs_uniq_guard->tensor[1];
indice_pairs_uniq_bkp_guard = allocator.empty_guard({{int64_t(pair_size + 1)}},
indice_uniq_dtype, 0,
{
pccm
.
literal
(
AllocKeys
.
IndicePairsUniqBackup
)
}
);
auto indice_pairs_uniq_bkp = indice_pairs_uniq_bkp_guard->tensor;
{{
tv::CUDAKernelTimerGuard timer_guard("gen_conv_inds_stage1",
timer, reinterpret_cast<cudaStream_t>(stream_int));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment